agentleFS
minipuftminipuft/claude-prompts-mcp/AGENTS.md

claude-prompts-mcp

AGENTS.md187 starsChanged 3 months agoMITView on GitHub

- Edit CLAUDE.md and .claude/rules/*.md; do not edit this generated file. - This compact file is the default Codex/OpenCode context. It preserves the project-wide decisions that change most tasks while staying within Codex's documented default 32 KiB project guidance budget. - Claude Code applies rule paths: natively. Codex and OpenCode do not, so use the dispatch table below: when a task touches a matching path, read that canonical rule before editing. - For project details not projected here, consult CLAUDE.md…

  • Reads credentials
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not edit this downstream compatibility file.

    line 4
  2. Very specific:

    ONLY sanctioned plan mention and the gate FAILS while that plan's status: is non-final, so a PR executing one step of a multi-step plan …

    line 55
  3. Distinctive:

    Read the relevant doc before editing.

    line 95
  4. Very specific:

    MCP Contract Dev: Verify upstream first (rg "paramName" src/mcp/tools src/modules src/engine).

    line 146
  5. Very specific:

    Framework validity: Always frameworkManager.getFramework(id) -- never hardcode framework lists.

    line 151
  6. Very specific:

    Pipeline state: Use context.gates, context.frameworkAuthority, context.diagnostics -- never mutate arrays directly.

    line 153

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md
<!-- GENERATED by scripts/sync-project-guidance.js. Source of truth: CLAUDE.md and .claude/rules/*.md. This is a compact semantic projection, not a concatenation. Do not edit this downstream compatibility file. -->

Agent Rules · Claude Prompts MCP

Canonical ownership and loading

  • Edit CLAUDE.md and .claude/rules/*.md; do not edit this generated file.
  • This compact file is the default Codex/OpenCode context. It preserves the project-wide decisions that change most tasks while staying within Codex's documented default 32 KiB project guidance budget.
  • Claude Code applies rule paths: natively. Codex and OpenCode do not, so use the dispatch table below: when a task touches a matching path, read that canonical rule before editing.
  • For project details not projected here, consult CLAUDE.md and its documentation pointers.

Core Principles

  1. MCP Tooling Only -- Prompts, templates, chains flow through MCP tools. Manual edits under server/prompts/** forbidden.
  2. Contract ownership -- Hand-written schemas in src/mcp/tools/schemas/ own runtime validation; tooling/contracts/*.json own descriptions/parameter metadata generated into src/mcp/contracts/schemas/_generated/. Run npm run generate:contracts, never edit _generated/. config.schema.json <- ConfigFile (generate:config-schema).
  3. Transport Parity -- Runtime changes must work in STDIO and Streamable HTTP. The two differ in instance lifetime, and that difference is load-bearing: STDIO pins one McpServer per connection, while HTTP builds a fresh one per request. A change that mutates a registered instance passes STDIO and silently no-ops over HTTP. HTTP+SSE was removed in the SDK v2 upgrade.
  4. Docs/Code Lockstep -- Update relevant doc in docs/ when behavior changes.
  5. Validation Discipline -- npm run typecheck && npm run lint:ratchet && npm run typecheck:tests:ratchet && npm run test:all minimum. validate:arch (module boundaries) is not a separate add-on: it is a member of the validate:all suite below, and runs there. typecheck:tests:ratchet is not optional: tsconfig.json excludes tests/, so typecheck is blind to every call site a signature change breaks, and validate:all -- which CI runs whole -- runs the ratchet second. Omitting it locally means CI fails on work that passed every gate you ran. test:all, not test:ci: test:ci is an alias for test:unit and runs neither tests/integration nor tests/e2e, while CI runs both as separate jobs -- so its name promises the opposite of what it does. Measured 2026-08-27: a default-deny control landed with the unit suite green, and 20 integration plus 17 e2e failures went unseen for five commits because every local check stopped at test:ci. pre-push does not run integration or e2e tests -- CI runs them at the PR boundary. test:all is the only way to catch this locally before a push.

Node.js Support Boundaries

SurfaceSupported Node.jsEnforcement
MCP server and desktop extension>=22.13.0server/package.json, manifest.json, CI on 22.13.0 and 24
Standalone CPM CLI>=18.18.0cli/package.json and CLI runtime validation
Local development and publishing24.node-version and publish workflows

The server floor is where node:sqlite is available without an experimental flag. The standalone CLI remains a separate, self-contained compatibility surface.

Pull Request Boundary

npm run pr:check is the whole local gate, and it is a subset of CI by construction.

PR Conventions is a required context whose gating steps on a non-bot PR are: two positive controls, the body against .github/pull_request_template.md, and commitlint on the title. Run every one of them before gh pr create, from the repo root:

TITLE="feat(scope): outcome"
npm run pr:body -- --out /tmp/pr-body.md     # seed it; never author a body from scratch
$EDITOR /tmp/pr-body.md
npm run pr:check -- --body-file /tmp/pr-body.md --title "$TITLE"

The template requires ## Demonstration (consumer-observable before/after, or n/a: <reason>), a ## How it was verified TABLE (claim · probe · baseline -> measured · the mutation that fails it -- a count with no baseline is noise), and ## Notes for Reviewers, under a 400-word above-the-fold budget that fenced blocks, tables and <details> do not count against. The Plan: footer is the ONLY sanctioned plan mention and the gate FAILS while that plan's status: is non-final, so a PR executing one step of a multi-step plan omits the footer entirely.

Parity is enforced rather than documented: scripts/pr-check.mjs names each workflow step it mirrors and server/tests/unit/scripts/pr-check-ci-parity.test.ts reads pr-conventions.yml and fails when the two sets diverge. That test exists because the relation had already broken in the direction that costs a CI cycle -- CONTRIBUTING.md documented only the body check, and the body checker states outright that it "does not read the title beyond its type", so following the instructions exactly still shipped an unchecked title (#283, subject-case, 2026-09-14). A hand-written body cost a second run three missing sections and a 488-word fold (#312, 2026-09-16).

This section IS projected into AGENTS.md (PROJECTED_HANDBOOK_SECTIONS in scripts/sync-project-guidance.js). It previously was not: the projection measured 32,709 of its 32,768-byte ceiling with this section absent -- 59 bytes of headroom, not enough to add it. Evicting ## Validation Gates (one contract, impact-aware subsets) (below) freed the room: that section is CI-routing detail a Codex or OpenCode reader does not need to act on, while this one is a command they run before every PR. Codex and OpenCode also still reach this contract through CONTRIBUTING.md §Pull Request Process and the usage text pr-check.mjs prints when invoked without arguments.

Documentation Map

TopicDoc
Architecture & runtimedocs/architecture/overview.md
SQLite persistencedocs/architecture/sqlite-persistence.md
MCP tools & symbolic commandsdocs/reference/mcp-tools.md
MCP contract maintenancedocs/guides/mcp-contract-maintenance.md
Prompt authoringdocs/tutorials/build-first-prompt.md
Chains lifecycledocs/concepts/chains-lifecycle.md
Gatesdocs/guides/gates.md
Injection controldocs/guides/injection-control.md
Identity & scopedocs/guides/identity-scope.md
Skills Syncdocs/guides/skills-sync.md
Telemetry & observabilitydocs/guides/telemetry-observability.md
Troubleshootingdocs/guides/troubleshooting.md
Contributing & PR processCONTRIBUTING.md
README charter (root README authoring rules)docs/portfolio/readme-charter.md
Release highlightsCHANGELOG.md

Read the relevant doc before editing. Update docs when behavior changes.

Command Reference (run inside server/)

CommandPurpose
npm run buildesbuild bundle -> dist/index.js
npm run verify:mcpSpawn a server from dist/ and prove all 3 MCP tools answer — use instead of restarting Claude Code to check a build. Refuses to run against a stale dist/
npm run typecheckStrict TS type validation — src/ only, tsconfig.json excludes tests/
npm testFull Jest suite
npm run lint:ratchetFail if ESLint violations increased or decreased without lowering the baseline
npm run typecheck:tests:ratchetFail if tests/ type errors increased or decreased without a baseline update. Covers call sites typecheck misses — a broken test file can otherwise land green
npm run generate:contractsRegenerate MCP schemas from contracts
npm run validate:lockfile-syncFail when node_modules has drifted from package-lock.json — compares npm's own node_modules/.package-lock.json, so no subprocess and no output parsing
npm run setup:pythonInstall the pinned Ruff/Pyrefly/Pytest/PyYAML from requirements-dev.txt — the same file CI installs from
npm run validate:allFull validation suite
npm run validate:archDependency Cruiser architecture rules
npm run validate:contractsVerify generated artifacts in sync
npm run validate:domain-ownershipCheck the Domain Ownership Matrix against every module's owns declaration, both directions
npm run validate:tool-parameter-readsFail when a tool command declares a parameter its code never reads, on all three tools. A read is a property read reaching the handler, processor or pipeline stage — never a name in a string
npm run test:integrationFIRST for new features
npm run test:coverageBaseline coverage (target: >80%)
npm run skills:exportExport skills from skills-sync.yaml

Domain Ownership Matrix (ENFORCED)

Stages are thin orchestration. Domain logic lives in owner services.

validate:domain-ownership checks this table both ways against each module's module.yaml owns block -- a row and its declaration must change together, and a row naming a symbol nobody exports, or a path the symbol is not defined in, fails.

If you need...Owner ServiceStage May Only
Gate normalizationGateService (gates/services/)Call gateService.normalize()
Gate enhancementGateEnhancementServiceCall enhancementService.enhance*()
Gate selectionGateManager (gates/gate-manager.ts)Call gateManager.selectGates()
Gate enforcement moderesolveEnforcementMode (execution/pipeline/decisions/gates/)Call resolveEnforcementMode(mode) -- a pure import, because context.gateEnforcement is optional and ?. would silently relax enforcement
Gate verdict processingGateVerdictProcessor (gates/services/)Call processor.handleGateAction()
Inline gate parsingInlineGateProcessor (gates/services/)Call processor.processInlineGates()
Prompt resolutionPromptRegistry (prompts/registry.ts)Call registry.get()
Command parsingUnifiedCommandParser (execution/parsers/command-parser.ts)Call parser.parseCommand()
Step captureStepCaptureService (execution/capture/)Call captureService.captureStep()
Response assemblyResponseAssembler (execution/formatting/)Call assembler.format*()
Framework selectionFrameworkManager (frameworks/)Call frameworkManager.selectFramework()
Framework validityFrameworkManagerCall frameworkManager.getFramework(id) -- never hardcode
Injection decisionsInjectionDecisionService (execution/pipeline/decisions/injection/)Call service.decide()
Style resolutionStyleManager (modules/formatting/style-manager.ts)Call styleManager.getStyle()
Delegation handoff evidenceresolveHandoffEvidence (execution/delegation/handoff-contract.ts)Call resolveHandoffEvidence(input) -- a pure import, never re-parse the HANDOFF RESULT trailer inline
Detached report routingresolveDetachedReport (execution/delegation/detached.ts)Call resolveDetachedReport(input) -- a pure import; a late result lands on the node its trailer names, never on the current step

Key Constraints

  • MCP Contract Dev: Verify upstream first (rg "paramName" src/mcp/tools src/modules src/engine). Contract, schema, generated metadata, router, manager/types, and service must agree.
  • Client-work boundary: Prompt and chain steps guide the client LLM, and resource operations may write only server-owned resource and runtime-state paths. The server DOES execute shell commands, under one operator-held control. shell_verify gate criteria and the inline :: verify:"..." operator both run their command through sh -c (shared/utils/process.ts:381), and script tools run an author-supplied file through a fixed interpreter. This is not incidental — ground-truth verification by exit code is the feature. What bounds it is three operator-held controls (below), not the absence of the capability: MCP_SHELL_VERIFY_ALLOWLIST over WHICH command, MCP_SHELL_VERIFY_ALLOWED_DIRS over WHERE, and a non-negotiable refusal of resource-supplied environment keys that decide what a command resolves to. This line previously claimed the opposite; it was false from the first shell_verify gate, and it is the sentence a reader consults when deciding how far to trust a third-party gate.
  • Instruction surface (accepted, documented): A prompt's systemMessage, userMessageTemplate, description, and argument descriptions ARE instruction to the client LLM. That is the product, not a defect — but it means installing a third-party prompt pack is equivalent to letting its author write into your model's context, and two surfaces deliver that text before anyone invokes anything: the MCP-standard prompts/list (which clients typically fetch at connect) carries every prompt's description and every argument description, and resource_manager list detail:"full" returns every prompt's systemMessage in a single call. Measured 2026-08-25. Treat a prompt pack the way you would treat a dependency, not a config file. The HTTP catalog route serving the same fields is credential-gated (MCP_CATALOG_READ_TOKEN); the MCP surface is not, by design, because the operator chose the client.
  • Guidance owner: PromptGuidanceService remains the central framework-guidance service. Do not introduce a parallel coordinator/orchestrator with overlapping responsibility.
  • Framework validity: Always frameworkManager.getFramework(id) -- never hardcode framework lists.
  • Consolidation over addition: Enhance existing systems vs creating new ones.
  • Pipeline state: Use context.gates, context.frameworkAuthority, context.diagnostics -- never mutate arrays directly.
  • Module organization: import the defining module directly. Banned is the compat re-export shim -- a file whose whole body is export ... from AND which carries a back-compat marker, giving a symbol a second import path so rg for the canonical one misses consumers (the ESLint rule claude/no-compat-reexport-shim enforces exactly this). A markerless barrel is NOT banned and src/ has ~60 of them; prefer direct imports anyway, because validate:arch expresses layer + cycle boundaries as paths, and a barrel spanning layers launders the real edge. Intra-layer barrels launder nothing -- judge by whether consumers cross a layer. A file that re-exports and defines something is not a barrel (infra/logging/index.ts). Dead-barrel detection is npx knip; validate:arch cannot see it (no-orphans needs no incoming AND no outgoing edges, and a re-export always has outgoing). Use internal/ for a genuinely private region.
  • Concurrent sessions: work in a linked worktree, never a second session in this checkout — worktrees share .git/config but not HEAD, and a shared HEAD moves under whoever is mid-edit. Create with npm run worktree:create -- <path> <branch> --from origin/main (the path resolves from the repo root). Do not use Claude Code's --worktree/EnterWorktree here: anthropics/claude-code#72714 writes an absolutized core.hooksPath into the shared .git/config, disabling hooks in every worktree including this one — plain git worktree add is equally unsafe, for the reason CONTRIBUTING.md §Working in a second worktree records. A new worktree's node_modules and server/node_modules are symlinks pointing back at this checkout, so npm ci or an install from a branch that changed package-lock.json writes through them and mutates every worktree's dependency tree at once. Set a distinct PORT if two trees run servers.
  • Commit convention: Conventional Commits enforced. Scopes (commitlint.config.mjs is the enforced list; keep this and CONTRIBUTING.md in lockstep with it): server, cli, runtime, pipeline, gates, frameworks, prompts, chains, styles, scripts, hooks, resources, mcp-tools, contracts, parsers, ci, deps, config, logging, metrics, docs, tests, semantic, execution.
  • Environment (execution capability): MCP_SHELL_VERIFY_ALLOWLIST declares which commands shell_verify may run. Unset means every shell verification is refused — the gate fails with a message naming this variable, and the server keeps serving. Entries are newline-separated (not comma: commands contain commas); an entry ending * is a prefix, but a command carrying shell control characters (; & | \ < > $(or a newline) must match exactly, because a prefix cannot bound what follows a;. The single entry UNSAFE_ALLOW_ALL` permits everything, for an operator who authors all their own gates and accepts the risk. Both transports read it — this is not a listener concern: the sink is reached identically over STDIO and HTTP. The refusal is deliberately not a degrade-to-advisory; a gate reporting as passed while having verified nothing is a defect this repo has already fixed once.
  • Environment (execution capability, continued): MCP_SHELL_VERIFY_ALLOWED_DIRS declares directories, beyond the server's own, that a gate's shell_working_dir may resolve inside. Unset does not mean "anywhere" — it means the server's own directory, which is where a gate that says nothing already runs. Same newline-separated form and same UNSAFE_ALLOW_ALL sentinel as the command allowlist, and deliberately a separate declaration: accepting arbitrary commands is not accepting arbitrary directories. There is no third variable for the environment, and that asymmetry is the point. A resource-supplied shell_env / tool.env naming a key that decides what a command RESOLVES to — PATH, LD_*, DYLD_*, NODE_OPTIONS, PYTHONPATH, BASH_ENV, IFS and their siblings — is refused outright, with no opt-out, because otherwise the allowlist bounds a string whose meaning the author still picks: measured 2026-08-29, an operator allowlisting exactly git status ran the gate author's git. Ordinary variables pass through untouched. The full list and the mechanism behind each entry are in shared/utils/process.ts.
  • Environment (paths): MCP_WORKSPACE (primary — the default for resources AND runtime state), MCP_RESOURCES_PATH (resources base override), MCP_RUNTIME_ROOT (writable root for runtime-state/ and relative logs/), MCP_CONFIG_PATH (config file override, same as --config). Every path setting the server cannot use refuses startup on both transports, before serving, naming the flag or variable, the value, its resolved path, what is wrong and what removing it falls back to: a config path that is not a readable JSON file, an MCP_WORKSPACE/--workspace or MCP_RESOURCES_PATH that is not an existing directory, and a workspace config.json that exists but is unreadable, a directory, or not a JSON object. Before 2026-09-14 each booted on something nobody asked for -- a named config file ignored, a missing workspace created by the logs mkdir, a missing resources path served as the bundled catalog, a malformed workspace config replaced by built-in defaults. One check (PathResolver.assertUsablePathSettings) runs in createRuntimeFoundation before the watcher, the transport choice and any mkdir; the path getters stay unchecked because tests and tooling resolve paths that need not exist. What still falls back, on purpose: a workspace with no config.json (packaged config), an empty value (unset), MCP_RUNTIME_ROOT (created on demand), and the packaged config.json itself (built-in defaults). MCP_WORKSPACE is not the SSOT for all paths: the other three each override it for their own concern, which is what lets a personal resource library live under MCP_WORKSPACE while state.db and logs stay put. Workspace resources overlay bundled ones — the bundled tree stays loaded underneath, and a same-id workspace entry wins. Before 2026-08-28 the workspace root REPLACED the bundle: one workspace framework was enough to make the server exit with FATAL: Framework 'cageerf' not found, and one workspace prompt made the served catalog that one prompt. Overlay detection compares the workspace to the package root, so MCP_RESOURCES_PATH alone does not enable overlays — a personal store must set MCP_WORKSPACE. The Claude Code plugin sets both MCP_WORKSPACE and MCP_RUNTIME_ROOT to ${CLAUDE_PLUGIN_DATA} (.mcp.json, rendered from mcp.json by scripts/render-distributions.mjs): the directory Claude Code keeps across plugin updates and creates before the server starts, while the entry point stays under ${CLAUDE_PLUGIN_ROOT}, which every update replaces. The canonical Agent Plugins mcp.json keeps MCP_WORKSPACE=${PLUGIN_ROOT}, because Codex does not pass PLUGIN_DATA to the MCP server. Hooks do not inherit the server's environment, so get_state_db_path() probes ${CLAUDE_PLUGIN_DATA}/runtime-state/state.db after MCP_RUNTIME_ROOT. A custom workspace is the write root: without MCP_RESOURCES_PATH, a type resolves to <workspace>/resources/<type>/ even before it exists (a legacy <workspace>/<type>/ keeps it), the first write creates it, loaders read it as empty until then, and the file observer watches it once it appears.
  • Environment (secrets): MCP_CATALOG_READ_TOKEN gates executable prompt detail/history/compare; MCP_CATALOG_WRITE_TOKEN independently gates preview/apply/rollback and every legacy /api/v1/tools/* mutation. Either unset value refuses its surface (503), equal read/write values disable writes, and authentication runs before prompt lookup/body parsing. MCP_HTTP_ALLOWED_ORIGINS is a comma-separated allowlist for requests carrying Origin; absent Origin remains valid for server-side clients. HTTP transport only — STDIO reads none of these values.

-> .claude/rules/mcp-contracts.md for critical contract constraints (path-loaded) -> .claude/rules/sqlite-persistence.md for critical persistence constraints (path-loaded) -> docs/guides/mcp-contract-maintenance.md for the full contract procedure -> docs/architecture/sqlite-persistence.md for the table map, scope split, and schema history -> docs/architecture/overview.md for architecture, pipeline stages, subsystems -> docs/reference/mcp-tools.md for MCP tool workflows, symbolic command language -> docs/guides/injection-control.md for injection types, frequency, hierarchy -> docs/guides/gates.md for gate/framework structure and hot-reload -> /testing skill for test patterns and project-specific coverage

Conditional project guidance

  • Multi-Platform Extension Alignment (hooks/**, .claude-plugin/**, manifest.json, mcp.json, server/scripts/synchronize-downstream-lock.js) -> before editing a matching path, read .claude/rules/extension-alignment.md and treat it as mandatory project guidance.
  • MCP Contract Maintenance Standards (server/tooling/contracts/**/*.json, server/src/mcp/contracts/schemas/_generated/**, server/src/mcp/tools/**/*.ts, server/scripts/generate-contracts.ts, docs/reference/mcp-tools.md) -> before editing a matching path, read .claude/rules/mcp-contracts.md and treat it as mandatory project guidance.
  • state.db Persistence Rules (server/src/infra/database/**, server/src/**/*-store.ts, server/src/**/*-registry.ts, server/src/**/*-indexer.ts, server/scripts/validate-table-contracts.ts, server/scripts/validate-no-phantom-columns.ts) -> before editing a matching path, read .claude/rules/sqlite-persistence.md and treat it as mandatory project guidance.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.