Skip to main content
AI coding agents generate code at scale, but they don’t perform codebase-level analysis. Building a module graph, tracing re-export chains, detecting duplication across thousands of files, scoring complexity hotspots: these require a dedicated tool. Fallow provides deterministic, exhaustive codebase analysis that agents call via CLI or MCP.
Every agent that can run shell commands can use fallow. The CLI is the primary interface. MCP is an optional structured layer on top.

Why agents need fallow

Codebase analysis means building and traversing a graph, not reading files in a context window.
Static analysis requires building and traversing a module graph. No amount of context window makes an LLM equivalent to a graph algorithm.

CLI: the primary agent interface

Every AI coding agent can run shell commands. No MCP required:
Always use --format json when agents run fallow. JSON output is structured, machine-readable, and easy for LLMs to parse. The human-readable format works too, but JSON eliminates parsing ambiguity.
Consuming fallow’s JSON output from TypeScript? import type { CheckOutput, HealthOutput, DupesOutput, AuditOutput } from "fallow/types" exposes the full output contract, generated from the same schema fallow uses internally. SchemaVersion is pinned to a literal at codegen time so major schema bumps fail to compile at your call sites instead of silently drifting.

Agent workflow examples

After generating code:
Codebase cleanup:
Before a PR:

MCP: structured tool calling

For agents that support , fallow-mcp exposes analysis as structured tools. Agents get typed inputs and outputs instead of parsing CLI text. The MCP server uses and wraps the fallow CLI binary. Set the FALLOW_BIN environment variable to point to the fallow binary (defaults to fallow in PATH).
Add to your .claude/settings.json:
Installed fallow as a project devDependency? "command": "fallow-mcp" assumes the binary is on your PATH (a global install). When fallow lives in node_modules/.bin/, it is not on PATH, so the server fails to start with ENOENT. Launch it through your package manager’s runner so the binary resolves from node_modules/.bin/:
Start the agent from the project root so the runner finds the local install. If you need an explicit fallow binary, keep setting FALLOW_BIN.

Available MCP tools

Runtime source-map confidence

Cloud runtime tools can include source-map confidence metadata when the response capabilities array contains function_identity_v2. Function list responses use resolutionStatus and mappingQuality; runtime-context responses use resolution_status and mapping_quality. These fields describe source-map confidence, not whether the function ran.
The MCP server wraps the CLI, so all fallow features are available: production mode, baselines, and incremental analysis.

Notable tool parameters

Some tools accept additional parameters beyond the common root, config, no_cache, and threads:

Structured actions in tool responses

All tools now return structured actions arrays on every finding, enabling agents to programmatically apply fixes or suppressions:
  • Dead code (analyze, check_changed): fix action (e.g. remove-export) + suppress action. Agents can use the auto_fixable flag to decide whether to call fix_apply or handle the suggestion manually. See the dead-code CLI reference for action type details.
  • Health (check_health, audit): complexity findings and styling findings carry an actions array. Complexity findings select their primary action with the CRAP/coverage formula keyed off coverage_tier, cyclomatic, and max_crap_threshold; possible action types include refactor-function, add-tests, increase-coverage, and suppress-line. Styling findings use styling-specific read-only verification and suppression actions. When --baseline/--save-baseline is passed OR health.suggestInlineSuppression: false, suppress-line is omitted and a top-level actions_meta: { suppression_hints_omitted: true, reason } breadcrumb is added (under health.actions_meta in combined-mode and audit output). Targets get apply-refactoring + suppress (when evidence exists). Hotspots get refactor-file + add-tests.
  • Duplication (find_dupes, audit): extract-shared + suppress actions on clone families and groups.
  • Audit (audit): inherits actions from all three sub-analyses (dead code, health, duplication).

Command-level next_steps[]

Distinct from the per-finding actions[], the analyze, check_health, find_dupes, and audit responses (and combined output) carry a top-level next_steps[] array of read-only follow-up commands computed from the run’s findings. Each entry is { id, command, reason }:
  • command is runnable as-is and never a fix or any other mutating command (fallow surfaces evidence; deciding and applying the change is the agent’s job).
  • The stable kebab-case id (setup, impact-report, trace-unused-export, trace-clone, complexity-breakdown, scope-workspaces, audit-changed) names a verification step to run before acting. When working through MCP, dispatch on the id to the matching tool (trace_export, trace_clone, check_health with complexity_breakdown: true, audit) or code_execute host call rather than shelling out the CLI command string.
  • A leading setup step (command: fallow schema) appears only on unconfigured, non-CI projects with findings. It has no mutating tool equivalent by design: read the manifest, then offer the guided-setup commands (fallow init --agents, fallow hooks install --target agent) to the user instead of running them unprompted. It disappears once a config exists or after fallow init --decline.
  • An at-most-weekly impact-report step (command: fallow impact) carries the local value digest (commits contained at the gate, findings resolved) when impact tracking is enabled and has non-zero results. The cadence stamp lives in the impact store, so it is consistent across agents and sessions, and the step may appear even on a clean run. Relay the non-zero numbers to the user in one line.
The array is deduplicated, priority-ordered, capped at three, and omitted when empty. Set FALLOW_SUGGESTIONS=off in the server env to suppress it.

value_schema on add-to-config actions

add-to-config actions (emitted for unused-dependency, type-only-dependency, test-only-dependency, duplicate-export, and similar findings where the resolution is “add an entry to the fallow config”) carry an optional value_schema field alongside value:
The value_schema URL is a JSON Pointer fragment into fallow’s published schema.json. Agents that want to validate value before writing it into a user’s config (for example, to reject a malformed { file, exports } rule object on the ignoreExports action) can fetch the linked schema and apply it locally. The field is strictly additive: actions that did not have a schema before continue to work without one, and agents that ignore the field keep working unchanged.

Combined output from bare fallow

Running bare fallow (no subcommand) executes all analyses in one pass and returns a combined JSON object with dead_code, duplication, and health sections:
This is the most efficient way for agents to get a full picture of the codebase in a single call. The combined output includes all issue types from dead code, duplication findings, and health metrics.

CLI vs MCP: when to use which

Environment variables

Error handling

The MCP server returns structured JSON errors when the underlying CLI fails:
  • Exit code 1: treated as success (issues found, not an error). The full JSON output is returned.
  • Exit code 2+: the server passes through the CLI’s structured JSON error from stdout when available. If no JSON is available, it constructs {"error": true, "message": "...", "exit_code": N} from stderr.
  • Subprocess timeout: if the CLI does not exit within FALLOW_TIMEOUT_SECS (default 120s), the server kills the process and returns a timeout error.

Architecture

The MCP server is a thin subprocess wrapper. All analysis logic stays in the CLI binary. The MCP crate only handles protocol framing and argument mapping, built with rmcp (Rust MCP SDK).
  • CLI and MCP always produce identical results
  • Any fallow CLI update automatically improves MCP
  • Install with cargo install fallow-mcp or grab a binary from GitHub Releases

See also

Agent Skills

Install fallow skills for Claude Code, Cursor, Windsurf, and more.

CI integration

Catch what agents and humans miss in CI.

VS Code extension

Real-time feedback for human developers.

All analysis areas

Dead code, duplication, complexity, and boundaries.