Skip to content

fix(mcp): agent-docs prose corpus is a stale pre-#1373 snapshot — 60 api-clients references still ship to agents, and no CI check can see it #1531

Description

@rickylabs

Summary

docs/site contains zero references to lib/api-clients.ts#1373/PR #1424 swept it clean.
But the checked-in agent-docs prose corpus still carries 60 occurrences, and that corpus is
compiled into packages/mcp/src/publish-assets.generated.ts and shipped to every agent that reads
NetScript documentation through MCP. The corpus snapshot was taken ~6 hours before the sweep
merged and nothing regenerates or diffs it in CI, so the staleness is invisible by construction.

This is the same defect class as #1425 (a surface #1373's page-scoped acceptance did not cover),
at 60× the count and on the surface agents actually read.

Evidence

Verified at 01aa12b67:

  1. docs/site is clean. grep -rn "api-clients" docs/ → 0 matches.
  2. The corpus is not. gunzip -c .llm/assets/agent-docs/prose.json.gz | grep -o "api-clients" | wc -l
    60.
  3. It ships. packages/mcp/src/publish-assets.generated.ts (header:
    // @generated by .llm/tools/generate-publish-assets.ts) embeds that prose, including
    a `lib/api-clients.ts`, that exports a typed `ordersClient`…, // apps/dashboard/lib/api-clients,
    and import { widgets } from "../lib/api-clients — i.e. the exact module path and the exact
    dialect fix(docs/sdk): the golden path names three different client modules and two incompatible query APIs, and the file the quickstart points at is a CSS entry #1373 removed. .llm/tools/generate-publish-assets.ts:3 imports the docs-corpus port;
    :190 reads .llm/assets/agent-docs/prose.json.gz.
  4. The snapshot predates the fix by ~6 hours. .llm/assets/agent-docs/provenance.json:
    "version": "0.0.5", "sourceCommit": "eda49bb2e", "extractionTimestamp": "2026-08-09T10:03:43Z".
    eda49bb2e is dated 2026-08-09 09:25:38 +0200. PR fix(docs/sdk): teach one client module and query dialect #1424 (fix(docs/sdk): teach one client module and query dialect) merged at 2026-08-09T16:04:57Z. The corpus has not been
    regenerated since.
  5. Nothing regenerates or diffs it in CI. gen:agent-docs-prose (deno.json:106) appears in
    no workflow. check:assets-barrel (deno.json:109) runs gen:assets-barrel and diffs the
    *.generated.ts barrels, but never runs gen:agent-docs-prose, so a prose corpus that has
    drifted from docs/site produces no diff and no failure.

Why it matters

The MCP corpus is the surface an agent consumes when it asks NetScript how to write a data layer.
Today it teaches lib/api-clients.ts and the demoted query dialect, while every human-facing page
teaches apps/<app>/lib/<service>.ts. An agent scaffolding from our own documentation produces
code that does not match the framework it just read about — and the human-facing sweep that was
supposed to fix this shipped three days ago.

Scope

  • Regenerate the agent-docs prose corpus from current docs/site and rebuild the dependent
    generated assets.
  • Add a CI gate that fails when the corpus is stale relative to its sources — the same
    regenerate-and-diff shape check:assets-barrel already uses for the barrels, extended to
    gen:agent-docs-prose. Without the gate, the next docs sweep re-opens this issue.

Boundaries

Acceptance criteria

  • gunzip -c .llm/assets/agent-docs/prose.json.gz | grep -c "api-clients" returns 0.
  • packages/mcp/src/publish-assets.generated.ts contains no api-clients reference.
  • provenance.json's sourceCommit is at or after PR fix(docs/sdk): teach one client module and query dialect #1424's merge commit 2e7c845ad.
  • A CI check regenerates the prose corpus and fails on drift from docs/site.
  • Negative test: reverting a docs/site page without regenerating the corpus fails that check.

Provenance

Found by the 0.0.6 documentation-lane orchestrator while independently verifying PR #1526's
repo-wide api-clients census (#1425). The census was correct within its stated scope
(packages/sdk/**); this is the surface that scope did not cover. Filed to Backlog / Triage
rather than 0.0.6 because it falls outside that lane's exclusive ownership — triage should decide
whether it belongs in the current release.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions