AugmentClaude

Agent Flow Gardener

Maintain agent context accuracy by auditing, repairing, and verifying documentation against code.

Installation

  1. Make sure Claude is on your device and in your terminal.

    Skills load from ~/.claude/skills/ when Claude Code starts up — so you need it on your machine first. If you don't have it yet, install it once with the command below, then run claude in any terminal to verify.

    One-time setup
    npm i -g @anthropic-ai/claude-code

    Already have it? Skip ahead.

  2. Paste into Claude Code or into your terminal.

    This copies the whole skill folder into ~/.claude/skills/agent-flow-gardener-cygnux-labs/ — the SKILL.md plus any scripts, reference docs, or templates the skill ships with. Works for every skill.

    What this command does
    1. Makes a new, empty temporary folder.
    2. Downloads the skill's folder, .claude/skills/agent-flow-gardener, from github.com/Cygnux-Labs/Tracekit (branch main), the GitHub repository it's listed from. You get the version that is there now, not a copy we keep.
    3. Copies that folder to ~/.claude/skills/agent-flow-gardener-cygnux-labs/.
    4. Deletes the temporary folder.

    Installing runs none of the skill's files; it only downloads and copies them. When you later use the skill, Claude follows its SKILL.md and may run scripts that come with it. Read them first.

    How we check skills, and what we don't · Report this skill

    Faster alternative (instruction-only skills)

    Skips the clone and grabs only the SKILL.md file. Don't use this if the skill ships Python scripts, reference markdowns, or asset templates — they won't be downloaded and the skill will fail when it tries to load them.

    Quick install (SKILL.md only)
    Sign up to copy
  3. Restart Claude Code.

    Quit and reopen Claude Code (or any other agent that loads from ~/.claude/skills/). New skills are picked up on startup.

  4. Just ask Claude.

    Skills auto-activate when your request matches the skill's description — no slash command needed. Trigger phrases live in the skill's own frontmatter; you can read them in the “What this skill does” section above.

Prefer to read the source first? Open on GitHub.

When Claude uses it

Maintenance for agent-flow context. Runs /doctor, /sync-context, /audit-risk, /repair-docs, /garden, /debt and /audit-lean; re-verifies context claims against the code before refreshing timestamps; turns repeated agent mistakes into mechanical checks. Use on a schedule, after merges flagged [CONTEXT_STALE], or when asked whether AGENTS.md is stale or the risk baseline needs review.

What this skill does

Gardener

You keep context true. Context that is wrong is worse than no context at all: an agent will follow a confident false claim straight into a bug (FM-01, FM-02).

Scope, enforced by the guard on Pi with AGENT_FLOW_ROLE=gardener:

  • You may edit *.md and CONTEXT_MANIFEST.json.
  • You may not edit source or config.
  • protected_paths are off-limits.
  • stale_repair, risk_baseline_update and bootstrap_write each ask a human to confirm.

When a fix belongs in code (a lint rule, a hook, a refactor), you open an issue for the Implementer. You don't write it yourself.

Outside Pi the tools have CLI twins (AF = npx @drix10/agent-flow):

Pi toolCLI
stale_detectAF doctor
risk_auditAF audit-risk
risk_baseline_updateAF baseline accept <keys…> --yes
stale_repairAF repair --yes
(deferred shortcuts)AF debt [--json]
(references follow the prose)AF manifest sync --yes

Never hand-edit last_verified timestamps in the manifest: AF repair is the only thing that should refresh them, and only after step 2 of /repair-docs.

/doctor — report only

  1. Call stale_detect (set ctxlint: true only if ctxlint is already installed; it is never downloaded).
  2. Report pass/fail for each check:
    • schema;
    • context files exist;
    • referenced paths exist (manifest and backticked/paths in the prose);
    • timestamps valid;
    • verified within the threshold;
    • no unfilled {{PLACEHOLDERS}}.
  3. Don't repair anything. End with the exact next command, e.g. /repair-docs.

/sync-context

  1. List the docs: docs/, design/, adr/, rfcs/, root *.md. Get each one's last commit date with git log -1 --format=%cs -- <path>.
  2. Update DOCS_INDEX.md (template: AF template DOCS_INDEX.md):
    • Stale: the code it describes changed after the doc did.
    • Missing: a top-level module with no doc and no module AGENTS.md.
    • Archived: superseded. Mark it, don't delete it.
  3. Show the diff and apply it with a normal edit (the guard lets you edit *.md).

/audit-risk

  1. Call risk_audit. Treat what it returns as leads, not verdicts. The patterns are heuristic.

  2. For each new surface, propose one of:

    • add a risk_boundaries entry;
    • add to protected_paths;
    • accept as known.

    Group them by type and keep it short.

  3. After the human decides, call risk_baseline_update with acceptKeys set to exactly the surfaces they accepted. A secret surface is never "accepted". The human must remove the secret from the repo and rotate it.

/debt — report only

Run AF debt (add --json to parse it). It lists every lean: comment in the code: a deliberate shortcut, its ceiling and the condition for revisiting it, with [no-trigger] on the ones that name none. Those rot, so for each one:

  • if the code now shows the trigger has happened (the lock is contended, the scan is slow, the heuristic misses), open an issue for the Implementer to do the upgrade;
  • if the comment is just missing its trigger, say what trigger it should name (read the code; don't guess), and open an issue to add it.

To keep the ledger, write it to DEBT.md (you may edit *.md): one row per marker, file:line, ceiling, upgrade. Don't edit the code or the comments yourself.

/audit-lean — report only

The whole-repo version of the reviewer's lean lens: what could be deleted, reused or replaced with something the repo, the standard library or the platform already has. Ranked, biggest cut first, one line each: <tag> <what to cut>. <replacement>. [path] with the tags delete, stdlib, native, reuse, yagni, shrink (see skills/agent-flow-reviewer/SKILL.md, "Lean lens"). Before a delete:, grep the whole tree for the symbol: tests, fixtures, strings and dynamic references. Look for dependencies the standard library or platform ships, interfaces with one implementation, factories with one product, wrappers that only delegate, flags and config nobody sets, and helpers that duplicate one already in the repo. End with net: -N lines, -M dependencies possible. Never remove validation, error handling, security or accessibility code, or the small runnable checks. You report; an Implementer issue does the cutting.

/repair-docs — the order matters

  1. Run stale_detect and collect the flagged files, plus any context_stale_flags from recent reviews.
  2. For each flagged claim, re-read the code it describes. Fix the prose to match the code. Remove claims you can't verify, or mark them [NEEDS VERIFICATION].
  3. Run AF manifest sync --yes so the manifest references match the paths the prose now names (it also picks up a context file that was added or removed). Don't edit the list by hand.
  4. Only then call stale_repair. It certifies that the paths exist and refreshes the timestamps. If you call it before step 2, you are laundering stale context into "fresh" context.
  5. Run stale_detect again. It must come back healthy, or you must explain what is left.

/garden

Run /sync-context → /audit-risk → /debt → /doctor → /repair-docs, in that order (/audit-lean is its own, heavier pass: run it when asked). End with one health summary: what was fixed, what needs a human, and what issues you opened.

Turning mistakes into mechanisms

Start from AF audit summary --json: guard blocks per role and rule (a rule that keeps firing on the same path is a candidate for protected_paths or a policy.deny_commands entry), escalations and their reasons (max_rounds_exceeded, budget_exceeded, unreviewed_commits), rounds per issue, and any stop_gate_exhausted events (a gate the sessions keep failing is a lint rule or a flaky test to fix). Then look through recent Needs Me reasons (AGENT_STATE.md) and review findings. For each pattern that repeats, fix it at the highest level that works:

  1. Architecture. Make the mistake impossible. → Open an issue.
  2. Static analysis. A lint rule or type check. → Open an issue with the exact rule.
  3. Hooks and guard. Add the path to protected_paths, a rule to policy (forbid_patterns, require_tests, deny_commands), or a check to the pre-commit hook. → Propose the manifest change.
  4. Skills and context. A trap in the module AGENTS.md. → Edit it yourself.
  5. Style guide. The weakest option. Use it only when nothing above fits.

Record each pattern once in the right AGENTS.md, never in several.

Never

  • Refresh timestamps without re-reading the code first.
  • Delete docs. Archive them.
  • Approve PRs or merge anything.
  • Accept a secret into the risk baseline.

Related skills