| name | rudi-context-gardener |
| description | Audit and right-size durable agent instructions across AGENTS.md, CLAUDE.md, and other repository guidance. Use when instructions feel bloated, duplicated, contradictory, stale, host-specific, or poorly divided between global guidance, repository guidance, nested guidance, skills, configuration, and executable stacks. |
RUDI Context Gardener
Audit first. Treat deterministic findings as signals for human or agent review,
not proof that guidance is wrong.
Workflow
-
Resolve the repository or workspace root the user placed in scope.
-
Run the bundled audit without editing instructions:
node <skill-dir>/scripts/audit-agent-context.mjs --root <root> --format markdown
-
Read references/context-placement-rules.md before recommending moves.
-
Inspect every reported duplicate, large file, host-specific reference, and
conditional-workflow candidate in its surrounding context.
-
Classify each material instruction as:
- keep where it is;
- move to a narrower repository or subtree instruction file;
- extract into a reusable skill;
- enforce with configuration or a hook;
- implement as a stack only when executable tools or persistent state are
required;
- retire because it is obsolete or contradicted by a stronger source.
-
Present the proposed moves and the invariants that must survive. Do not edit
files when the user asked only for an audit.
-
When edits are authorized, make narrow changes, preserve the strongest
applicable safety rule, and rerun the audit.
Use --format json when another tool or artifact will consume the report. The
script scans only recognized instruction files, skips symlinks and noisy build
or dependency directories, and reads no secret files.
Judgment rules
- Keep always-applicable safety, authority, repository-boundary, and completion
invariants in durable instructions.
- Move conditional procedures such as deployment, publishing, migration, or
specialized testing into focused skills when they do not apply to most turns.
- Do not remove duplication blindly. A repeated rule may be intentional when a
narrower host or subtree must remain independently usable.
- Do not claim two rules contradict each other from keyword matching alone.
Read both rules, their scope, and their precedence.
- Prefer references to canonical manuals over copying long specialized
standards into always-loaded context.
- Keep public registry skills portable. Put personal paths, client state, and
machine-specific defaults in private or local overlays.
Host adaptation
- Use the current host's native instruction hierarchy and skill discovery.
- Treat
AGENTS.md as shared repository guidance when the host supports it.
- Treat host-specific instruction files as adapters, not the canonical copy of
a cross-host workflow.
- If the host cannot preview a generated report, return the Markdown or JSON
artifact path and a concise summary.
Output
Return:
- instruction files inspected;
- high-confidence duplication and placement findings;
- possible contradictions requiring semantic review;
- recommended moves with destination and rationale;
- instructions intentionally retained;
- edits made, if authorized;
- residual uncertainty and the next audit command.