agentleFS
serpro69serpro69/claude-toolbox/AGENTS.md

claude-toolbox

AGENTS.md156 starsChanged 7 days agoApache-2.0View on GitHub

This file provides guidance to AI agents like claude-code, codex, and others, when working with this repository. This is a repository providing a complete development environment for agentic tools like Claude Code and Codex, with tool configs, pre-configured MCP servers, and plugins. It provides opinionated configurations and installable plugins for claude-code and codex. Machine delivery adds install.sh and kk/ to the components below. kk/lib/ owns staging, activation, launch, offline rollback and repository migration. kk/baseline/ contains release defaults and generated policy/agent…

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. serpro69/agentstakk★ 156100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 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 repository2 other files it gives its agents.

The file

Show its rules and text

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

21 rules. About 0 are common, 5 are distinctive, and 16 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 16

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Developer workflow: After editing skills or agents in klaude-plugin/, run make generate-kodex to regenerate.

    line 32
  2. Very specific:

    After editing klaude-plugin/scripts/guard/, run make generate-guard.

    line 36
  3. Very specific:

    Run bash test/test-kk.sh for machine installation, lifecycle, launchers and migration orchestration.

    line 46
  4. Distinctive:

    Test agreed behavior and consequential risks.

    line 60
  5. Very specific:

    Family prefixes for grouped skills: When multiple skills do the same action on different targets, share a prefix: /kk:review-design, …

    line 86
  6. Distinctive:

    Only symlink into skills that actually reference the file — don't blanket-symlink.

    line 114
  7. Distinctive:

    When adding a new shared instruction:

    line 116
  8. Very specific:

    Create klaude-plugin/skills/_shared/<name>.md (bare basename, no shared- prefix on the source file).

    line 118
  9. Very specific:

    Update test/test-plugin-structure.sh EXPECTED_SKILLS and EXPECTED_COMMANDS.

    line 125
  10. Very specific:

    Leave docs/feat/done/ untouched — it's frozen history.

    line 126
  11. Distinctive:

    When touching a skill description in the future, re-check the docs page linked above in case the caps have shifted.

    line 144
  12. Distinctive:

    Dedup pass: After drafting, grep the skill directory for repeated investigation-entry instructions — collapse duplicated full git diff / …

    line 164
  13. Very specific:

    Every profile lives at klaude-plugin/profiles/<name>/ and follows the same shape:

    line 219
  14. Very specific:

    Forward: Every markdown link in index.md resolves to a file on disk.

    line 261
  15. Very specific:

    Reverse: Every .md file in the phase subdirectory (except index.md itself) is referenced by at least one link in index.md.

    line 262
  16. Very specific:

    Literal-reference authoring rule: When prose _inside_ klaude-plugin/ (SKILL.md, agent files, profile content) needs to reference the …

    line 279
  17. Very specific:

    Use ${CLAUDE_PLUGIN_ROOT}/… freely in plugin-load files (SKILL.md, agent files, hook/MCP configs).

    line 288
  18. Very specific:

    Never use Glob against ${CLAUDE_PLUGIN_ROOT}/… patterns regardless of substitution: Glob is cwd-scoped and returns 0 matches for …

    line 290
  19. Very specific:

    Run bash test/test-plugin-structure.sh and confirm green.

    line 304
  20. Very specific:

    Add a file to an existing profile: Add a files entry to the manifest, run make vendor-go.

    line 317
  21. Very specific:

    Add vendoring for a new profile: Create scripts/<profile>-vendor-manifest.yml, add a make vendor-<profile> target.

    line 318

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

This file provides guidance to AI agents like claude-code, codex, and others, when working with this repository.

Repository Overview

This is a repository providing a complete development environment for agentic tools like Claude Code and Codex, with tool configs, pre-configured MCP servers, and plugins. It provides opinionated configurations and installable plugins for claude-code and codex.

Architecture

Machine delivery adds install.sh and kk/ to the components below. kk/lib/ owns staging, activation, launch, offline rollback and repository migration. kk/baseline/ contains release defaults and generated policy/agent files. Keep kodex-guard/ separate from the Codex skills plugin to preserve guard trust across skills-only upgrades. kk migrate obtains the full legacy template and its cleanup scripts from the maintenance tag pinned in kk/lib/migrate.py. See ADR 0014.

Provider components:

  1. Claude Code (.claude/): Repository preferences and Capy setup
  2. Codex (.codex/, kodex-plugin/, kodex-guard/): Codex-equivalent config, hooks, rules, agents, and separate skills and permission-guard plugins. See §Codex Support below
  3. kk plugin (klaude-plugin/): Skills, commands, hooks, and utility scripts — the canonical source of truth, distributed via the Claude Code plugin system

For API keys and MCP server setup, see MCP servers.

Codex Support

klaude-plugin/ is the canonical source. A Go generation tool (cmd/generate-kodex/) produces:

  • kodex-plugin/ — transformed skills for Codex (resolves ${CLAUDE_PLUGIN_ROOT}, injects headers)
  • kk/baseline/codex/agents/*.toml — sub-agent definitions for the machine release, converted from klaude-plugin/agents/*.md

The permission-guard generator (scripts/generate-guard.sh) copies the canonical runtime and license from klaude-plugin/scripts/guard/ into kodex-guard/scripts/guard/. It writes kk/baseline/codex/kk.rules and kk/baseline/claude/deny.json, and refreshes the marked tables in docs/user-guide/configuration.md.

Hand-authored codex files (not generated): .codex/config.toml, .codex/hooks.json, and AGENTS.md.

Developer workflow: After editing skills or agents in klaude-plugin/, run make generate-kodex to regenerate. CI checks freshness across kodex-plugin/ and kk/baseline/codex/agents/, including newly generated files.

Edit Claude session instructions in klaude-plugin/instructions/ and statusline scripts in klaude-plugin/statusline/. Both ship directly in the Claude plugin.

After editing klaude-plugin/scripts/guard/, run make generate-guard. CI and both release workflows use make check-guard to regenerate every guard projection and check for tracked or untracked differences. Never edit generated copies directly. make generate-all refreshes guard output before the other generators and their structure checks.

Testing

Tests are in test/. Run with:

for test in test/test-*.sh; do $test; done

Run bash test/test-kk.sh for machine installation, lifecycle, launchers and migration orchestration. make docs-build checks the published documentation.

Key test suites: test-plugin-structure.sh (klaude-plugin + kodex-plugin generated output), test-codex-structure.sh (codex config, hooks, agents, rules), test-template-sync.sh (released client handoff). Tests use shared utilities from test/helpers.sh.

The Go tools under cmd/ have their own tests: make generate-kodex (Codex generation + freshness) and make plugin-graph (the cmd/plugin-graph/ dependency-graph analyzer's tests, plus plugin-graph validate against klaude-plugin/ as a broken-link/orphan gate). See docs/contributing/architecture.md for what plugin-graph analyzes.

Eval-fixture links are intentionally partial. plugin-graph validate (and any "fix the broken link" instinct) must not touch deliberately-broken markdown links under evals/ or in example-*.md templates — several eval fixtures omit their link targets precisely to exercise missing-target detection. validate exempts these nonOperativeSources by design; "fixing" them breaks the evals.

Troubleshooting

See the machine install guide, MCP setup and template migration guide.

Proportionate verification

Test agreed behavior and consequential risks. Preserve explicit repository and release checks, but do not manufacture requirements through test assertions or require exhaustive branches for every change. For LLM evaluations, distinguish material failures, quality observations and evidence limits; judge semantic outcomes rather than perfect wording or optional follow-up. Validate the test and grader before adding instructions. Compare targeted changes with their immediate predecessor and stop when further checks are unlikely to change the decision. An authorized retirement of a bad gate must update live completion criteria while preserving historical results.

ADR 0010 records the R6/R7 learning. Shipped workflows use the self-contained verification policy.

Working from GitHub issues

Issues in this repo are often filed from agent sessions in sibling projects (e.g., capy) that cannot change toolbox themselves, so they tend to spec the most cautious possible interface: explicit opt-in flags, activation checks, rollback procedures, release gating. Treat those acceptance criteria as negotiable and the underlying problem as the deliverable. Before adopting any of them, ask whether a stateless check at the point of use makes them unnecessary, and say so. Example: issue #170 asked for a manifest opt-in plus rollback; the implementation is a per-event jq check of capy's entries in .codex/hooks.json, re-evaluated on every call, with no stored state.

Skill & Command Naming Conventions

Applies when creating or renaming kk-plugin skills and commands.

Skills

  • Imperative verbs over noun phrases. /kk:design not /kk:analysis-process, /kk:implement not /kk:implementation-process. Drop filler suffixes like -process. Skills are invoked as /skill-name — shorter names are faster to type.
  • Self-documenting over acronyms. /kk:chain-of-verification beats cove. If the name requires expansion to understand it, it's the wrong name.
  • Family prefixes for grouped skills. When multiple skills do the same action on different targets, share a prefix: /kk:review-design, /kk:review-spec, /kk:review-code. Tab-completion, discoverability, and mental grouping all benefit.
  • Always use /kk: prefix. Reference skills with the /kk: prefix everywhere — prose, invocation examples, docs (e.g., `/kk:review-code` not `review-code`). This ensures consistent, greppable, unambiguous skill references. The codex generation tool rewrites /kk: → $kk: for Codex output. Exception: kk:review-findings, kk:lang-idioms, etc. are capy knowledge-store labels, not skill references.

Commands

Commands live under klaude-plugin/commands/<name>/. For skills with standard + isolated modes:

  • default.md — standard variant, invoked as /kk:<name>:default
  • isolated.md — isolated sub-agent variant, invoked as /kk:<name>:isolated

Symmetric naming avoids stuttering (/kk:cove:cove → /kk:chain-of-verification:default).

Agents

Agent names describe the role, not the skill that invokes them. code-reviewer, design-reviewer, spec-reviewer persist across skill renames. Don't rename agent files when renaming the skills that delegate to them.

Plugin content is self-contained

klaude-plugin/ ships standalone via the plugin marketplace — consumers get the plugin tree only, never this repo's docs/. Therefore skill, agent, and profile prose must NEVER reference toolbox-repo documents: no "(ADR NNNN)" citations, no docs/adr/-as-this-repo links, no docs/feat/wip|done pointers. For a consumer these are unresolvable at best; at worst they collide with the consumer repo's own ADR numbering and point to unrelated decisions. State the rule and its rationale in full in the plugin file itself; keep the ADR back-reference in repo-side docs only (the ADR cites the operative plugin files, not the other way around). Distinguish: consumer-repo paths as behavioral targets (e.g. review-architecture accepting artifacts from the consumer's docs/adr/, the document skill writing ADRs to the consumer's /docs/adr) are correct and expected.

Shared instructions

Instructions referenced by more than one skill live in klaude-plugin/skills/_shared/<name>.md with a bare basename (e.g., review-scope-protocol.md, pal-codereview-invocation.md).

Each consuming skill gets a per-skill symlink at klaude-plugin/skills/<skill>/shared-<name>.md pointing to ../_shared/<name>.md. Reasons:

  • Markdown links inside a skill stay local — [shared-foo.md](shared-foo.md) resolves without ../ path traversal, which keeps links working when the skill is bundled/copied.
  • The shared- prefix in the skill directory makes it obvious at a glance which files are shared vs skill-specific.
  • Only symlink into skills that actually reference the file — don't blanket-symlink.

When adding a new shared instruction:

  1. Create klaude-plugin/skills/_shared/<name>.md (bare basename, no shared- prefix on the source file).
  2. In each consuming skill directory, run ln -s ../_shared/<name>.md shared-<name>.md.
  3. Reference it in skill docs as [shared-<name>.md](shared-<name>.md).
  4. Agents (in klaude-plugin/agents/) can't use the per-skill symlink pattern — reference shared files by their repo-relative path: klaude-plugin/skills/_shared/<name>.md.

When renaming

  • Update test/test-plugin-structure.sh EXPECTED_SKILLS and EXPECTED_COMMANDS.
  • Leave docs/feat/done/** untouched — it's frozen history.
  • Watch for substring collisions (e.g., a design-review → /kk:review-design rename will also hit the design-reviewer agent name via simple sed; hand-fix those).

Skill description budget

Claude Code loads skill descriptions into context so the model can pick the right skill. Two caps apply (see Claude Code docs — Skill descriptions are cut short):

  • Per-entry cap: 1,536 characters. Each skill's description + when_to_use combined text is truncated at 1,536 characters regardless of the global budget.
  • Global context budget. Scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Override via the SLASH_COMMAND_TOOL_CHAR_BUDGET environment variable. When many skills are loaded, each description's share of the budget shrinks — trailing content gets stripped first.

OpenCode's documented limit for the same field is 1024 characters. For portability across both harnesses, treat 1,024 as a soft budget for skills that must work on both; stay under 1,536 at a minimum.

Authoring rules:

  • Lead with trigger keywords. Truncation happens at the tail, so the decisive "when to invoke this" words must come first.
  • Front-load the key use case. The Claude Code docs' own guidance — one concrete TRIGGER phrase beats a paragraph of hedging.
  • Keep descriptions tight. Detailed rules, cascades, and examples belong in the SKILL.md body, not the description.

When touching a skill description in the future, re-check the docs page linked above in case the caps have shifted.

Skill workflow ordering — instructions before action

Applies to every plugin skill. The canonical failure example surfaced in /kk:review-code, but the rule is universal. See ADR 0004 for the full rationale and the failure transcripts.

Core rule: a skill MUST fully load its instructions before taking any action on its subject matter, except for the bounded routing inspection defined below.

  • Instructions = SKILL.md + every process/rubric/protocol file it links + every per-skill symlinked shared instruction + (for profile-driven skills) every profile file the detection procedure resolves.
  • Action on subject matter = reading diff/file content, editing code, engaging with idea prose beyond detection keywords, running tests, emitting documentation, producing findings.
  • Minimal early scope is permitted — enough to drive profile detection. Examples: git diff --stat for filenames, a feature-directory listing, a keyword scan of idea prose limited to declared detection tokens.
  • Bounded routing inspection is the sole early-content exception. After basic process instructions (SKILL.md, referenced process/rubric files and shared protocols) load, inspect at most approximately 16 KiB per candidate file solely to resolve a declared detection or conditional-load predicate. Log the predicate and path. If a conditional cannot be decided within that bound, conservatively load its instruction. This permits no behavioral analysis, findings, full-diff investigation, edits or tests. Load every matching or conservatively selected instruction before proceeding to subject-matter investigation.
  • The entry point for content-level investigation appears exactly once in the workflow, after the instruction-load steps. Keep routing inspection distinct from that entry point; restating full content reads earlier — even as a "Preflight" step — re-creates the failure mode. Later targeted re-reads to substantiate findings remain permitted.

Profile-driven skills have an additional specialization: profile content (resolved checklists, gotchas, rubrics, validator lists) is part of "instructions". Every (profile, <phase>/<content>) pair the detection procedure resolves, including conservative conditional loads, is read via the Read tool before subject-matter investigation — index entries alone are not enough. Bounded routing determines which instructions to load; it does not apply them to assess behavior.

Authoring requirements for every skill:

  1. Mandatory-order directive at the top of SKILL.md's Workflow section, explicitly stating that the flow is strictly sequential and subject-matter action is blocked until instructions are loaded, with only the bounded routing exception above. Name the rule by intent, not by step numbers — step numbers drift; intent does not.
  2. Workflow phase summary in SKILL.md matches the detailed process file. A reader who skims SKILL.md must not see a different ordering than the process file prescribes.
  3. Dedup pass. After drafting, grep the skill directory for repeated investigation-entry instructions — collapse duplicated full git diff / source-read steps to one post-instruction entry point, without removing bounded routing or later targeted verification reads.

Sub-agents delegated by skills (in klaude-plugin/agents/) inherit the same rule. Payload delivery order (the spawning skill passing instructions and subject matter in the same prompt) is not sufficient — the sub-agent's own workflow must read instructions before acting, or the LLM will re-create the shortcut on its side.

Skill evaluations

Skills with non-trivial decision logic (routing, detection, conditional loading) should ship evaluation scenarios under klaude-plugin/skills/<skill>/evals/. Evals are spec files — no built-in harness exists (Anthropic docs — Evaluation and iteration) — but they give a reviewer or future harness an objective rubric to grade against.

Directory layout:

klaude-plugin/skills/<skill>/evals/
  <eval-name>/
    eval.json          # scenario definition
    test-files/        # real fixtures (YAML, code, configs, …) — everything here may be staged for the model under test
      …
    oracle/            # grader-only expected outputs (gold-claims.json, expected-verdicts.json, …) — optional

Oracles are grader-only and live outside test-files/. Expected-output files (gold-claims.json, expected-verdicts.json, …) go in a sibling oracle/ directory, never inside test-files/. A harness may stage the whole test-files/ directory, so an oracle placed there would leak the graded answers to the model under test even when omitted from files[]. oracle/ contents are consumed only by the grader.

One directory per eval, not a single evals.json. Skills that detect on paths or directory adjacency (e.g., /kk:review-code → values* adjacent to Chart.yaml, templates/ ancestor chains, kustomization.yaml filename signal) can only be exercised against real filesystem structure. Inline-in-prompt fixtures force the evaluator to describe directory layout in prose, which tests pattern-matching on prose rather than the detection logic. Real fixtures are also syntax-highlightable, validatable (kubeconform, helm lint, go build), and trivial to edit — YAML embedded in JSON strings as \n-escaped text is not.

eval.json schema:

{
  "id": 1,
  "name": "eval-name-kebab-case",
  "description": "One-sentence summary of what this eval tests.",
  "skills": ["skill-name"],
  "prompt": "The natural user prompt that triggers the skill.",
  "trap": "The failure hypothesis — what a model is likely to get wrong.",
  "files": ["test-files/foo.yaml", "test-files/bar.yaml"],
  "assertions": [
    { "id": "1.1", "text": "Specific, graded behavior bullet." },
    { "id": "1.2", "text": "…" }
  ]
}
  • skills, prompt, files follow the Anthropic best-practices format so a future harness aligned with that spec can ingest these evals.
  • trap and numbered {id, text} assertions are borrowed from samber/cc-skills-golang — the trap sharpens intent (which failure mode is this eval testing?); numbered assertions make manual grading and failure reports traceable.
  • assertions[].id follows <eval-id>.<n> — eval 1's assertions are 1.1, 1.2, …; eval 2's are 2.1, 2.2, ….

When to author evals. Proactively, for skills with detection/routing logic where false positives and false negatives both matter; for skills with conditional content loading; and include at least one regression eval proving the skill does NOT activate (or falls back to default behavior) when it shouldn't. Skip for trivial skills whose behavior is captured by the skill's markdown alone.

Running. No built-in harness. A reviewer (or a future harness) stages the eval's test-files/ where the skill expects input — never the oracle/ directory — sends prompt with the target skill available, and grades the response against each assertion (consulting oracle/ for expected outputs). Keep per-eval directories self-contained so the harness has zero external dependencies.

Profile Conventions

Applies when authoring profiles under klaude-plugin/profiles/. Profiles make per-domain concerns (programming languages, IaC DSLs, config schemas) available to every phase of the /kk:design → /kk:implement → /kk:review-code → /kk:test → /kk:document flow.

Directory layout

Every profile lives at klaude-plugin/profiles/<name>/ and follows the same shape:

klaude-plugin/profiles/<name>/
  DETECTION.md       # authoritative trigger rule (required)
  overview.md        # human-readable summary + dependency-lookup targets (required)
  review-code/       # per-phase subdirectory (populated as needed)
    index.md         # router; see §`index.md` contract
    <content files>
  design/
  implement/
  test/
  document/
  review-spec/

Not every profile populates every phase — a programming-language profile may only need review-code/; an IaC profile like k8s populates all six; a tooling profile like skill-md populates only the phases where domain-specific guidance adds value. A phase subdirectory contains only its index.md and the files the index references; human-facing authoring notes belong in overview.md or a sibling file at the profile root.

Design-only profile archetype. A valid profile may populate only design/, with all three DETECTION.md file-signal sections (## Path signals, ## Filename signals, ## Content signals) left empty and only ## Design signals populated. Empty file signals mean the profile never activates in file-based phases — it is reachable solely through the confirm-gated /kk:design design-token path. This is the shape used to adopt cross-cutting methodologies that have no reliable file-detection signal (see ADR 0008); the first instance is the twelve-factor profile.

DETECTION.md — schema

DETECTION.md is the single authoritative source for "when does this profile activate". It has three mandatory sections (every heading must be present even when its body is empty) and one optional section:

  • ## Path signals — path globs that promote a file to a candidate. Fast pre-filter only; not authoritative on their own.
  • ## Filename signals — literal filenames or filename globs. Authoritative: any match activates the profile.
  • ## Content signals — content-inspection rules (anchors, regexes, key presence). Authoritative for files not already caught by filename signals. Bounded inspection (~16 KB per file; multi-document YAML inspected per ----separated block).
  • ## Design signals (optional) — enables design-phase detection for profiles that participate before code exists. Contains display_name (human-readable label for confirmation prompts) and tokens (keyword list matched against idea prose). Not required; not asserted by the structure test. Only relevant to profiles that need design-phase activation.

Two dimensions, different orders. Signals are evaluated in cost order (path → filename → content) but authority runs filename ≈ content > path — filename and content are equally authoritative; filename resolves first only because it is cheaper to evaluate (a filename match short-circuits content inspection for that file). A file caught only by a path signal does not activate the profile.

Consumers invoke klaude-plugin/skills/_shared/profile-detection.md (via the per-skill symlinks shared-profile-detection.md) — they do not replicate per-profile logic.

index.md contract — bidirectional invariant

Each phase subdirectory's index.md is the contract between the profile and the consuming skill. It has two sections:

  • Always load. Files loaded whenever the profile is active. Each entry: markdown link + one-line description.
  • Conditional. Files loaded only when a stated trigger matches. Each entry: link + description + an explicit Load if: clause naming concrete diff properties (field values, filenames, directory names) — not vague category labels. Two agents evaluating the same diff against the same trigger must reach the same conclusion.

Bidirectional invariant (enforced by test/test-plugin-structure.sh):

  • Forward. Every markdown link in index.md resolves to a file on disk.
  • Reverse. Every .md file in the phase subdirectory (except index.md itself) is referenced by at least one link in index.md.

An unreferenced .md inside a phase subdirectory is always a bug — an orphan checklist or a stray README. Authoring notes and READMEs belong at the profile root (in overview.md or a sibling file), not inside a phase subdirectory.

Naming

  • Lowercase profile names. Underscores allowed where filename-safe (e.g., js_ts).
  • Phase subdirectory names match the consuming skill's directory name exactly: review-code/, review-spec/, design/, implement/, test/, document/.

Referencing profile content from skills and agents

Skills and agents reference profile content via ${CLAUDE_PLUGIN_ROOT}/profiles/<name>/... — no symlinks from skills into profiles/ (ADR 0003).

Brace form required for substitution. The Claude Code harness substitutes ${CLAUDE_PLUGIN_ROOT} (with braces) before any agent reads the content. Bare $CLAUDE_PLUGIN_ROOT is NOT substituted.

Substitution is markdown-container-unaware. The harness applies a literal text replacement. Substitution happens inside inline backticks, fenced code blocks (plain / bash / markdown / tilde), indented code blocks, blockquotes, and HTML comments. No markdown container escapes substitution.

Literal-reference authoring rule. When prose inside klaude-plugin/ (SKILL.md, agent files, profile content) needs to reference the variable by name — documenting or explaining it, not using it as a runtime path — use one of two surviving forms:

  • Bare $CLAUDE_PLUGIN_ROOT (simplest; verified not substituted on 2026-04-18).
  • HTML entity &#36;{CLAUDE_PLUGIN_ROOT} (useful when the brace shape must appear in rendered output).

Substitution boundary: plugin-load vs Read tool. The harness substitutes ${CLAUDE_PLUGIN_ROOT} at plugin-load time for files the harness loads directly — SKILL.md, agents/*.md, hook configs, MCP configs. The brace form in those files reaches the agent as a resolved absolute path and can be used directly in tool arguments. The Read tool does NOT substitute — it returns file content byte-for-byte. Any ${CLAUDE_PLUGIN_ROOT} inside a file an agent reads at runtime via Read (everything under klaude-plugin/skills/_shared/, per-skill referenced content, every profiles/**/*.md) reaches the agent as a literal token. Forwarding that literal into another tool call fails: Bash shell-expands against the usually-unset env var to empty; Read fails ENOENT.

Authoring consequence:

  • Use ${CLAUDE_PLUGIN_ROOT}/… freely in plugin-load files (SKILL.md, agent files, hook/MCP configs).
  • In files consumed via Read at runtime, prefer explicit content over tokens: hard-code the names/paths the procedure needs (e.g., the Known Profiles list in shared-profile-detection.md). If the file must describe a plugin-root path, instruct the agent to construct it using the resolved prefix it already knows from the SKILL.md that invoked it — not to forward the literal ${CLAUDE_PLUGIN_ROOT} token.
  • Never use Glob against ${CLAUDE_PLUGIN_ROOT}/… patterns regardless of substitution: Glob is cwd-scoped and returns 0 matches for outside-cwd absolute paths.

TOOLBOX_PLUGIN_ROOT — session-wide runtime alternative. A SessionStart hook in klaude-plugin/hooks/hooks.json exports TOOLBOX_PLUGIN_ROOT into every Bash call via $CLAUDE_ENV_FILE. Unlike ${CLAUDE_PLUGIN_ROOT} (plugin-load-time only), ${TOOLBOX_PLUGIN_ROOT} is available in the shell environment throughout the session. Use it in Bash commands when the plugin root is needed at runtime — e.g., ls ${TOOLBOX_PLUGIN_ROOT}/profiles/. For a machine-managed install, the hook exports the running release’s physical plugin directory. For a Git-marketplace install, it resolves the path via klaude-plugin/scripts/cpr.py (which reads installed_plugins.json and returns the versioned cache/ path); the harness-substituted ${CLAUDE_PLUGIN_ROOT} passed as the hook's argument is the fallback. Read-only sub-agents (e.g. code-reviewer, profile-resolver) have no shell to resolve the variable — the spawning skill resolves it and injects the absolute path into their prompt under a ## Plugin Root heading.

Files outside klaude-plugin/ (this CLAUDE.md, README.md, ADRs under docs/adr/) are NOT subject to substitution and may use the brace form freely.

Adding a new profile

  1. Copy an existing profile as a template (e.g., cp -r klaude-plugin/profiles/go klaude-plugin/profiles/<name>).
  2. Rewrite DETECTION.md with the new profile's signals. Keep all three mandatory headings (## Path signals, ## Filename signals, ## Content signals) even when empty. Add ## Design signals if the profile needs design-phase activation.
  3. Rewrite overview.md: what the profile covers, when it activates, and "Looking up dependencies" cascade targets for each dependency category the profile cares about.
  4. Populate the phase subdirectories the profile needs. Each populated phase must have an index.md listing its content files (always-load + conditional with explicit Load if: clauses). Leave phases the profile does not serve absent — the structure test's presence-conditional assertion only fires on directories that exist.
  5. Append the profile name to EXPECTED_PROFILES in test/test-plugin-structure.sh — after the profile's files exist, not before. Per-profile assertions will fail if the profile is listed first.
  6. Append the profile name to the Known profiles list in klaude-plugin/skills/_shared/profile-detection.md. This list is the authoritative runtime enumeration — consumers iterate it rather than enumerating the filesystem (see §Referencing profile content for why).
  7. Run bash test/test-plugin-structure.sh and confirm green.

Vendored profile content

Some profiles populate phase content by vendoring files from external upstream repositories (e.g., the Go profile vendors from samber/cc-skills-golang). A Go CLI tool at cmd/vendor-profiles/ drives this:

  1. A YAML manifest (scripts/<profile>-vendor-manifest.yml) maps upstream files to profile phase directories, specifying keep transforms, target filenames, and load conditions.
  2. The tool fetches each file, applies transforms (strip frontmatter via from_first_h1, extract specific headings, or passthrough), rewrites internal markdown links, and writes to the target phase directory.
  3. Each phase's index.md is updated between <!-- BEGIN VENDORED --> / <!-- END VENDORED --> injection markers. Content outside the markers (hand-written entries) is preserved.

Developer workflow:

  • Update upstream version: Edit the manifest's ref field, run make vendor-go, review the diff, commit.
  • Add a file to an existing profile: Add a files entry to the manifest, run make vendor-go.
  • Add vendoring for a new profile: Create scripts/<profile>-vendor-manifest.yml, add a make vendor-<profile> target. The tool is profile-agnostic.

The make vendor-go target runs the vendor tool and then test/test-plugin-structure.sh to validate the bidirectional index invariant. See docs/feat/wip/go-vendor-integration/design.md for the full manifest schema and transform details.

ADR location

Architecture decisions that span more than one feature live at docs/adr/NNNN-slug.md using Michael Nygard's template (Context, Decision, Consequences). Per-feature design docs live at docs/feat/wip/<feature>/ while work is active and move to docs/feat/done/<feature>/ on completion — they are not ADRs.

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.