Skip to content

feat: add FOUNDRY_MACHINE_MODE=true env var for agent-friendly output #13855

@0xClandestine

Description

@0xClandestine

Component

Other (please describe)

Describe the feature you would like

Summary

As AI coding agents (Claude Code, Cursor, Copilot Workspace, etc.) increasingly run forge and cast as subprocesses, Foundry's human-oriented terminal output has become a source of unnecessary token waste and parsing friction. I'd like to propose a single environment variable FOUNDRY_MACHINE_MODE=true that switches all command output to a compact, structured, agent-friendly format.

Motivation

Foundry's current output is designed for human consumption: it includes ANSI color codes, progress spinners, decorative banners, verbose compilation messages, and richly formatted test tables. When an LLM agent reads this output, most of that content is noise it burns context window tokens on content that carries zero signal for automated decision-making.

This is not a hypothetical problem. rtk, a Rust CLI proxy specifically built to reduce LLM token consumption, cites test runners like cargo test achieving up to 90% token reduction by suppressing passing-test output and emitting failures only.

An agent only needs to know: did tests pass? If not, which ones and why?

Proposal

Introduce a top-level environment variable FOUNDRY_MACHINE_MODE=true (a boolean, not part of the config namespace treated specially like FOUNDRY_PROFILE and FOUNDRY_CONFIG) that activates machine-friendly output across all Foundry tools.

Expected impact

For a typical agentic coding session running forge heavily (build checks, test loops, cast calls), this should reduce Foundry-originated token consumption by 60–80%, consistent with rtk's benchmarks on analogous Rust tooling. More importantly, it eliminates the need for wrapper scripts or third-party proxies to make Foundry usable in agentic pipelines.

Additional context

Claude helped with grammar and clarity
Removed some bloat from issue description

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions