ClaudeForge / agent
CLAUDE.md429 starsChanged 11 months agoMITView on GitHub
Parent context: see the root CLAUDE.md for project-wide guidelines and behavioural rules. Chained import: @../CLAUDE.md Guidelines for the claude-md-guardian background-maintenance agent. agent/claude-md-guardian.md — installs to ~/.claude/agents/claude-md-guardian.md. Hooks use Anthropic's canonical keyed-object schema (event → array of { matcher, hooks: [{ type, command }] }): The array-of-{event, commands} shape used in earlier versions did not match the documented schema and silently did not fire. The agent uses claude-md-enhancer (the skill's frontmatter name; installed as claudeforge-skill/) as its core capability. Invoke it…
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- command/CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- skill/CLAUDE.mdCLAUDE.md
- claude-md-enhancerSkill
The file
We split this CLAUDE.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
- Very specific: line 75
When the agent runs sync, it follows command/sync-claude-md.md: never commit, leave the diff for the user to review.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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.
Files
Parent context: see the root CLAUDE.md for project-wide guidelines and behavioural rules. Chained import:
@../CLAUDE.md
Guardian Agent Development
Guidelines for the claude-md-guardian background-maintenance agent.
File
agent/claude-md-guardian.md — installs to ~/.claude/agents/claude-md-guardian.md.
Modifying the Agent
- Edit
agent/claude-md-guardian.md. - YAML frontmatter fields to preserve:
permissions: [Bash, Read, Write, Edit, Grep, Glob, Skill]model: haiku— token efficiency for routine sync runs.color: purple— visual indicator in Claude Code UI.fork_safe: true— agent runs independently.hooks: [SessionStart, PreToolUse, PostToolUse].
- Workflow phases inside the agent:
- Assessment — read
git diff/git status/ changed-file counts. - Analysis — decide if changes are significant enough to update CLAUDE.md.
- Update — invoke the skill for targeted section updates rather than full regeneration (~70–80% token saving vs. rewrite).
- Assessment — read
- Re-install for testing:
cp agent/claude-md-guardian.md ~/.claude/agents/.
v2.0.0+ Frontmatter Reference
Hooks use Anthropic's canonical keyed-object schema (event → array of { matcher, hooks: [{ type, command }] }):
hooks:
PostToolUse:
- matcher: "Write|Edit"
hooks:
- type: command
command: "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/validate-claude-md.py"
InstructionsLoaded:
- matcher: "session_start|nested_traversal|path_glob_match|include|compact"
hooks:
- type: command
command: "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/validate-claude-md.py"The array-of-{event, commands} shape used in earlier versions did not match the documented schema and silently did not fire.
Skill ↔ Agent Integration
The agent uses claude-md-enhancer (the skill's frontmatter name; installed as claudeforge-skill/) as its core capability. Invoke it with Skill: claude-md-enhancer inside the agent workflow.
Hook responsibilities:
- SessionStart — check
git diff; if significant drift is detected, invoke the skill for an incremental update. - PreToolUse — validate before a CLAUDE.md edit lands.
- PostToolUse — after
Edit/Writeto any CLAUDE.md, the plugin-levelhooks/hooks.jsonrunshooks/validate-claude-md.py. The script exits2with stderr feedback when the file is over 150 lines; the guardian then proposes a/sync-claude-mdrun. - InstructionsLoaded — same script fires on every
load_reason(session_start,nested_traversal,path_glob_match,include,compact), so the cap is enforced deterministically at load time, not just at write time.
Agent ↔ Git
The agent watches for change signals via:
git diff --name-status HEAD~10
git log --since="1 week ago" --oneline --no-merges
git diff HEAD~10 -- package.json requirements.txt pyproject.toml go.mod Cargo.tomlTriggers an update when any of these hold:
- 5+ files modified since the last sync.
- New dependencies added to a manifest file.
- New top-level directories created (potential new sub-CLAUDE.md candidates).
- Manual invocation after a milestone or release.
When the agent runs sync, it follows command/sync-claude-md.md: never commit, leave the diff for the user to review.
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
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.

