For AI agents: the complete documentation index is available at https://mfdoctor.kevinbeier.com/llms.txt, the full documentation bundle is available at https://mfdoctor.kevinbeier.com/llms-full.txt, and this page is available as Markdown at https://mfdoctor.kevinbeier.com/agent-loop.md.

Agent loop

Agents often treat a clean mfdoctor check as a full green bill of health. That is wrong. Offline check is tier 1 (config / static). Tier 2 is plugin emit on a real build plus the workspace gate. Claim green only after both tiers pass, and never treat incomplete analysis as a pass.

Two tiers

TierWhat to runWhat it provesWhat it does not prove
1, Config / staticmfdoctor check (JSON/SARIF + diagnostics when handing off)Offline config, imports, and other facts available without a bundler emitEmitted manifests, stats, assets, or cross-app federation contracts
2, Emit + workspaceBuild with a mfdoctor adapter, then mfdoctor workspace (or federation --workspace)Post-emit project facts (.mf/doctor/project.json) and host↔remote / shared topologyNothing further is required for a local/CI green claim; optional runtime / probe stay opt-in

Hard rule: do not claim green from mfdoctor check alone.

Intended loop

  1. Discover the versioned CLI contract (no project config, no network):

    mfdoctor capabilities
  2. Run tier 1 and keep machine-readable artifacts (do not scrape ANSI terminal output):

    mfdoctor check --ci --format terminal,json,sarif \
      --diagnostics-dir .mf/doctor/diagnostics
  3. Load structured fix guidance when needed:

    mfdoctor prompt --finding <ruleId|fingerprint> .mf/doctor/report.json

    Prefer findings[].suggestion in the JSON report and SARIF properties.fix / runs[0].properties.incompleteReasons[].fix over scraping engine stderr. A failed run that already wrote report.json prints the structured report instead of a duplicate could not complete dump.

  4. Apply a narrow fix for that finding. Rebuild with a mfdoctor adapter so emit evidence exists, then re-run tier 1 as needed.

  5. Before claiming green, finish tier 2:

    # each host/remote already built with its mfdoctor adapter
    mfdoctor workspace
    # or: mfdoctor federation --workspace

Quiet success prints nothing. Exit codes: 0 policy passed, 1 policy failed, 2 analysis incomplete.

doctor/partial-analysis is not green

doctor/partial-analysis means mfdoctor lacked facts it needed, missing MF options, unresolved dynamic imports, unread sources, budget-limited projects, omitted workspace projects, or missing emit capabilities (for example Vite without manifest: true).

Treat it as incomplete analysis, not a soft warning you can ignore:

  • Do not claim green while a non-suppressed doctor/partial-analysis remains.
  • Exit code 2 means analysis incomplete, same rule: not a pass.
  • Prefer restoring evidence (pass moduleFederation, enable emit/manifests, fix source reads, raise budgets, or use an opt-in runtime trace) over muting the rule. Suppress only when the user asked for intentional governance.

Rules that depend on absent evidence stay honest: for example unresolved package-capable dynamics suppress false shared/unused certainty in favor of partial analysis. See the capability matrix.

Who this helps

AudienceTakeaway
Agent"Am I done?" = tier 1 and tier 2; partial analysis blocks green
Humancheck ≠ plugin emit ≠ workspace; the plugin remains the primary DX
CIWhy builds register adapters and why a workspace job follows app builds

Out of scope (do not invent)

mfdoctor does not ship, and agents must not invent:

  • HTML UI / --ui dashboard
  • In-browser doctor or runtime agent injection
  • A general --fix that mutates the project without a finding-driven change
  • MCP servers, VS Code problem matchers, or check --watch (tracked separately)
  • A Next.js (@module-federation/nextjs-mf) adapter, unsupported; prefer Rsbuild or Modern.js (limitations)

For Module Federation concepts (shared, remotes, Bridge, observability), use the upstream mf skill. For mfdoctor commands, formats, and exit codes, see the CLI reference and Get started.