agentleFS
ianshankianshank/Agents/claude-foundation/AGENTS.md

Agents / claude-foundation

AGENTS.md1 starsChanged 58 days agoApache-2.0View on GitHub

A Claude Code plugin, not a package in the import graph. It also holds the repo's only CLAUDE.md. This directory packages the foundation plugin: reusable skills, least-privilege subagents and lifecycle hook guards, plus the foundation_tools validators that gate them. It is staged in-tree pending extraction, so it behaves like its own repository while living inside this one. - This directory holds the repo's only CLAUDE.md, and it decides what you can see. Under Claude Code's default project-instructions setting, a CLAUDE.md…

The file

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

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Staged in-tree, and still inside this repo's gates: Run its own commands from here as if this were the repository root, but tests/ is a …

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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

AGENTS.md — claude-foundation

A Claude Code plugin, not a package in the import graph. It also holds the repo's only CLAUDE.md.

This directory packages the foundation plugin: reusable skills, least-privilege subagents and lifecycle hook guards, plus the foundation_tools validators that gate them. It is staged in-tree pending extraction, so it behaves like its own repository while living inside this one.

Map

PathRole
.claude-plugin/plugin.jsonThe plugin manifest — name foundation, version 1.0.0
.claude-plugin/marketplace.jsonSelf-hosted marketplace entry consumers pin a ref against
CLAUDE.mdBuild commands and compatibility contract — and a context trap, see below
hooks/hooks.jsonWires the three hooks to their events and matchers
hooks/pre_tool_guard.pyThe security guard. Fails closed, including on its own errors
hooks/post_edit_verify.py, session_logger.pyAdvisory. Always exit 0
agents/, skills/The four subagents and the four foundation:* skills, each with evals
tools/foundation_tools/Validators: frontmatter, schemas, no-hardcode scan, compat diff
tests/backwards_compat_baseline.jsonThe append-only component-name surface

Diagram

flowchart TD
  accTitle: claude-foundation plugin surface and hook fail modes
  accDescr: The plugin manifest publishes skills, subagents and hooks; the pre-tool guard fails closed and denies on any error while the post-edit verifier and session logger always exit zero, and the foundation tools validators gate the whole surface against a committed baseline.

  MAN[".claude-plugin/<br/>plugin + marketplace"]
  SK["skills/<br/>foundation:* skills"]
  AG["agents/<br/>4 subagents"]
  HK["hooks/hooks.json"]
  GUARD["pre_tool_guard.py<br/>FAILS CLOSED"]
  ADV["post_edit_verify.py<br/>session_logger.py<br/>FAIL OPEN"]
  ENV["CLAUDE_FOUNDATION_*<br/>env config only"]
  TOOLS["foundation_tools/<br/>validate, scan, compat"]
  BASE["tests/<br/>backwards_compat_baseline.json"]

  MAN --> SK
  MAN --> AG
  MAN --> HK
  HK --> GUARD
  HK --> ADV
  ENV --> GUARD
  ENV --> ADV
  SK --> TOOLS
  AG --> TOOLS
  HK --> TOOLS
  TOOLS --> BASE

  classDef here fill:#e8f0fe,stroke:#1a73e8,stroke-width:2px
  class MAN here

Rules that bite here

  • This directory holds the repo's only CLAUDE.md, and it decides what you can see. Under Claude Code's default project-instructions setting, a CLAUDE.md in the working directory or above it makes Claude read CLAUDE.md files only, so an agent working here would otherwise receive none of the repo-wide contract. The single line @AGENTS.md at the top of CLAUDE.md is what pulls this file — and through it ../AGENTS.md — back into context. Delete that line and every agent working here goes blind, silently.
  • The hook fail modes are asymmetric on purpose (ADR 0002). pre_tool_guard.py fails CLOSED — a matched deny rule and any internal error both deny, so a crash can never let a tool call through. post_edit_verify.py and session_logger.py fail OPEN and always exit 0, so a broken config cannot paralyse every edit in a consumer repo. Never invert either one.
  • Component names are append-only within a major version. Removing or renaming a skill, subagent or hook needs a major bump, then python -m foundation_tools.backwards_compat --root . --update in the same change — run after the bump, since it snapshots the current one.
  • No literals in hook behaviour. Everything configurable comes from a CLAUDE_FOUNDATION_* environment variable, and foundation_tools.scan enforces that against an allowlist policy.
  • Staged in-tree, and still inside this repo's gates. Run its own commands from here as if this were the repository root, but tests/** is a protected path and its 85 floor is declared in both pyproject.toml and scripts/quality-gate.sh.

Verify

make -C claude-foundation check

Subagents

Task in this directoryAgentWhy
Locate where a component name is declared across manifest, skills and baselineexplorerRead-only; the name appears in several files and all of them must agree
Run the gate and isolate a validator or compat-diff failuretest-runnerHas Bash; the compat gate reports a surface diff that needs reading back
Review a hook change before pushingnarrow-criticA fail-mode inversion is a one-character diff and a security regression

See also

DocRead it when
README.mdYou need the component table, install flow and environment-variable contract
CLAUDE.mdYou need this component's own build commands and release gate
../AGENTS.mdYou need the repo-wide contract — reached only via the @AGENTS.md import
docs/adr/0002-hook-fail-modes.mdYou are changing a hook's exit path and need the exact blocking mechanics
docs/adr/0004-backwards-compat-manifest-diff.mdYou are removing or renaming a component and need the bump procedure
../docs/decisions/0017-claude-foundation-reconciliation.mdThe in-tree staging is in your way and you need the extraction plan

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.