Skip to content

fix: agent guidance truth and implementation-derived consistency checks - #606

Merged
jimhoyd merged 10 commits into
mainfrom
claude/agent-guidance-truth
Sep 24, 2026
Merged

jimhoyd merged 10 commits into
mainfrom
claude/agent-guidance-truth

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Agent guidance truth and consistency checks (PR 8).

What changed

#539 — generated AGENTS.md trust section. packages/core/src/agents-guide.ts now separates the injected context (only declared args/env/secrets) from trusted Node's ambient authority (process.env, filesystem, network, installed modules), and says outright that this is not confinement. starters/default/AGENTS.md is regenerated and still under 80 lines. test/cli.test.ts asserts both halves and rejects the old wording.

#540 — stored short links. The authoring and operations skills (and the plugin copies), docs/AI-AUTHORING.md, docs/EXTENSIONS.md, plus ROUTING.md, SPECIFICATION.md, BEST-PRACTICES.md and packages/admin/docs/SPIKE-ADMIN.md now send readers to extensions.store.config.shortLinks and state its constraints: a bounded unique key, a required format: http-url destination, one counter, and a public GET/HEAD redirect mount. A gap is reported only for needs beyond that.

#585 — wildcard rule. get_context pathShape/wildcardMounts, the static and redirect capability constraints, the schema descriptions for static/redirect, the authoring skill and AI-AUTHORING all give the same rule:

  • a redirect may end in /**
  • a static route must end in /*
  • an extension mount must end in a non-root /*
  • no other route accepts a wildcard

#558 — trust-model prose. Rewrote MIDDLEWARE-EXAMPLES, LOCAL-DEVELOPMENT (the starter has no routes now; there is no "sandboxed" /hello), READINESS:224, RECIPES:26/28, TYPESCRIPT:7, and the guest-API sentences in MIDDLEWARE.md, yaml/functions.md and ROUTING.md. All now describe trusted-by-default with sandbox: true as the opt-in.

scripts/check-trust-model-prose.ts gains an unscoped-guest-api rule. It flags "guest API" and "sandboxed function(s)" unless the sentence names the opt-in or the trusted mode, or sits under a sandbox/guest/QuickJS heading. It has regression fixtures. The rule covers prose only, so it does not flag the bare "guest" in recipes/middleware/*.mjs comments. A TODO for #555 marks where to widen it.

#541 — semantic consistency check. New scripts/check-agent-facts.ts is wired into check:docs, and so into npm run verify and the CI docs job. It builds an inventory from implementation sources:

  • the bundle set from prepare-extension-bundles.ts, cross-checked against BUNDLE_CATALOG_NAMES
  • auth/admin kit adoption from auth-ui.ts/admin-ui.ts
  • --with canonicalization in init-with.ts
  • MCP read/host/authoring tool lists, through a new mcpToolInventory export
  • the store shortLinks authoring surface

It then fails on agent-visible prose that contradicts any of those facts. Exemptions need <!-- agent-facts: exempt REASON --> with a non-empty reason. --inventory prints the JSON. When run against the prose on main, it catches every contradiction listed in the issue and several more.

Contradictions fixed:

  • forms is in the signed bundle (README, FRAMEWORK, packages/forms/llms.txt)
  • the ui llms.txt now describes kit adoption
  • auth,admin,ui is not refused (COMPOSING-A-SITE)
  • the MCP server has 24 read tools, not 22 (TOOLING)

Regenerated: llms-full.txt and the plugin skill copies. A changeset covers the ui and forms llms.txt patches.

Evidence

  • npm run typecheck, npm run lint, npm run check: pass
  • npm test: 778 pass, 1 skipped, after updating the documentation-check count in test/ci-release.test.ts from 8 to 9
  • npm run verify:workspaces: pass
  • npm run test:package: pass
  • New test/agent-facts.test.ts: inventory matches the implementation, the prose check passes, and context, capability and schema all state the wildcard rule

Limitations

Closes #539
Closes #540
Closes #541
Closes #585
Closes #558

🤖 Generated with Claude Code

jimhoyd and others added 10 commits September 23, 2026 17:13
…tradictions

Add scripts/check-agent-facts.ts (wired into check:docs) that derives an
inventory from implementation sources -- extension bundle set, auth/admin kit
adoption, --with canonical ordering, MCP tool counts and the store shortLinks
contract -- and fails on agent-visible prose contradicting it. Fix the forms,
ui, --with ordering and MCP count contradictions it found.

Refs #541

Co-Authored-By: Claude Opus 5.5 <[email protected]>
….ts's self-import

check-agent-facts.ts (new in this PR) imports packages/core/src/mcp.ts,
which imports its own public export '@jimhoyd/urlcode/agent-context' to
prove that export is sufficient. That resolves to dist/agent-context.js,
which the docs CI job (changed by #596 to skip building) never produces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/RECIPES.md
#	llms-full.txt
@jimhoyd
jimhoyd merged commit 0a2b6eb into main Sep 24, 2026
61 checks passed
@jimhoyd
jimhoyd deleted the claude/agent-guidance-truth branch September 24, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment