agentleFS
YehudaFrankelYehudaFrankel/clankbrain/AGENTS.md

clankbrain

AGENTS.md16 starsChanged 7 months agoMITView on GitHub

Keep this file under 200 lines. Commands only. Project conventions → rules/project-context.md. Everything the agent needs to remember → .claude/memory/. Long sessions → /learn then /compact. Team Pull runs automatically at Start Session — no command needed.

The file

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

11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

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

    If setup.py exists run it.

    line 18
  2. Very specific:

    Read STATUS.md → memory/lessons.md → memory/decisions.md → memory/tasks/regret.md → memory/tasks/todo.md

    line 22
  3. Very specific:

    Run /learn — extract lessons + decisions from this session

    line 27
  4. Distinctive:

    Update memory files for everything changed (see Auto-Save Rule)

    line 28
  5. Very specific:

    Update STATUS.md — increment session, one-line summary

    line 29
  6. Very specific:

    If on a team: share what you learned → Team Push

    line 31
  7. Distinctive:

    After any code change, immediately update the relevant memory file — don't wait for End Session:

    line 94
  8. Distinctive:

    Every memory file uses this frontmatter + structure:

    line 109
  9. Very specific:

    Run python tools/memory.py --mempalace-audit to find files missing Source blocks or valid_until dates.

    line 143
  10. Very specific:

    Skill chaining: add ## Auto-Chain to any SKILL.md — On pass: → run X / On fail: → run Y

    line 149
  11. Distinctive:

    Unsaved memory reminder: stop hook fires when memory has unsaved changes

    line 151

≈ “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

[Project Name] — Claude Code + Codex Project Context

Keep this file under 200 lines. Commands only. Project conventions → rules/project-context.md. Everything the agent needs to remember → .claude/memory/. Long sessions → /learn then /compact.


Session Commands

TierCommands
CoreStart Session · End Session
On DemandPlan · Debug Session · /learn · /evolve · Check Drift · Guard Check · Pre-Ship Check · Code Health · Mode · Estimate · Handoff · Search Memory · Generate Guards · Generate Skills · Update Kit
Opt-InTeam Pull / Team Push · Sync Memory / Pull Memory

Setup Memory

If setup.py exists run it. Otherwise: python -c "import urllib.request; exec(urllib.request.urlopen('https://raw.githubusercontent.com/YehudaFrankel/clankbrain/main/install.py').read().decode())"

Start Session

  1. Run python tools/memory.py --session-start
  2. Read STATUS.md → memory/lessons.md → memory/decisions.md → memory/tasks/regret.md → memory/tasks/todo.md
  3. Scan memory/plans/ — surface any file with Status: Draft or On Hold
  4. Report: "Session N ready. Last change: [X]. What are we working on?"

End Session

  1. Run /learn — extract lessons + decisions from this session
  2. Update memory files for everything changed (see Auto-Save Rule)
  3. Update STATUS.md — increment session, one-line summary
  4. Run python tools/memory.py --check-drift
  5. If on a team: share what you learned → Team Push
  6. Report: "Session N complete. Updated: [list]. Memory clean."

Plan [feature]

Invoke the plan skill. Opens/creates memory/plans/[slug].md, walks problem → research → options → decision → spec. Always show the full plan file after every update — never a diff or summary.

Debug Session

Invoke the debug-session skill: reproduce → isolate → hypothesize → fix only the confirmed root cause → verify → log to tasks/errors.md.

On-Demand Commands

CommandAction
Check Driftpython tools/memory.py --check-drift — fix any found
Guard Checkpython tools/memory.py --guard-check — PASS/FAIL per guard
Pre-Ship Checkguard-check + drift-check + session edit count + git diff --stat
Code HealthScan for console.log, hardcoded values, missing error handling, dead code, files >500 lines
Mode [develop|review|safe|deploy]Set + enforce tool access constraints for the session
Estimate: [task]Read files → complexity + risk + file list → write to todo.md if confirmed
HandoffGenerate HANDOFF.md from STATUS + todo + decisions + errors + gotchas
Search Memory: [topic]python tools/memory.py --search "[topic]"
Progress Reportpython tools/memory.py --progress-report
Kit Healthpython tools/memory.py --kit-health — fix FAILs immediately
Generate GuardsInvoke generate-guards skill
Generate SkillsInvoke generate-guards then scan stack for useful project skills
Analyze CodebaseScan all JS/CSS/backend files, update memory files with findings
Install MemoryScan codebase, fill memory files, copy to system memory path
Update KitRun update.py if present, otherwise fetch from clankbrain repo
/learnInvoke learn skill — extract lessons, decisions, rejected approaches
/evolveInvoke evolve skill — patch failing skills, cluster patterns (every 3–5 sessions)

Team (opt-in)

CommandWhat it does
Setup Team [url]You're the manager. Run once. Sends teammates the URL to join.
Join Team [url]You're a new member. Run once with the URL your manager sent.
Team PushShare what you learned with the team. Run at End Session.
Team StatusCheck last sync times and what's been shared.

Team Pull runs automatically at Start Session — no command needed.

Sync (opt-in)

  • Sync Memory / Pull Memory → python sync.py push / python sync.py pull
  • Setup: python sync.py setup [repo-url]

Skill Map

WorkflowSkills in Order
Build to Learn (discovery)Declare build-mode: learn → product-risk → prototype-hypothesis → (prototype) → parallel-prototypes (if multiple options) → log to prototype_log.md
Build to Earn (delivery)Declare build-mode: earn → search-first → plan → (code) → code-reviewer → verification-loop → /learn
Bug Fixdebug-session → (fix) → verification-loop → /learn
End of Session/learn → /evolve-check → /evolve (every 3–5 sessions)
Maintenancecheck-drift → guard-check → code-health
Memory/recall [topic] · search-memory · /forget [topic]

Full agent orchestrations (human-in-the-loop breakpoints): see .claude/agents/


Auto-Save Rule

After any code change, immediately update the relevant memory file — don't wait for End Session:

What changedUpdate this
JS function added/changedjs_functions.md
HTML/CSS changedhtml_css_reference.md
Endpoint or backend methodbackend_reference.md
Architecture decisiondecisions.md
Rejected approachtasks/regret.md
Any change when code-map existscode-map.md — flow, line number, DB entry

Memory File Conventions (MemPalace-inspired)

Every memory file uses this frontmatter + structure:

---
name: short-id
description: one-line hook for MEMORY.md index
type: rule | correction | decision | state | reference | user
valid_from: YYYY-MM-DD        # optional — memory not applicable before this date
valid_until: YYYY-MM-DD       # required for type: state/project — when this may go stale
related: [other-memory.md]    # optional — tunnels to connected memories
---

[Summary — the rule, fact, or decision in plain English]

**Why:** [reason this matters]
**How to apply:** [when to use it]

## Source
> [Verbatim snippet from the conversation where this was established]
— Session N

Types:

  • rule — permanent coding/workflow rule (no expiry needed)
  • correction — one-time fix Claude made that shouldn't repeat
  • decision — locked architectural choice
  • state — current phase, active work, temporary facts — always needs valid_until
  • reference — pointer to external system (Jira, Slack, URL)
  • user — who the user is, their preferences and expertise

Why ## Source: Storing verbatim context alongside summaries improves recall accuracy from ~84% to ~97%. When the summary is ambiguous, the Source block gives Claude the original exchange to reason from.

related: links are followed automatically by the pre-edit hook (Tunnels). If two memories are connected — e.g. a rule and its exception — link them.

Run python tools/memory.py --mempalace-audit to find files missing Source blocks or valid_until dates.


Autonomous Behaviors

  • Skill chaining: add ## Auto-Chain to any SKILL.md — On pass: → run X / On fail: → run Y
  • Self-healing: minimal fix → retry → escalate only if second attempt fails (add ## Recovery to skills)
  • Unsaved memory reminder: stop hook fires when memory has unsaved changes
  • Compound learning: /learn every session → skill_scores.md → /evolve every 3–5 sessions → better skills

@rules/build-mode.md @rules/plan-before-edit.md @rules/work-rules.md @rules/token-rules.md


Project conventions, file paths, tech stack, design system, and gotchas belong in rules/project-context.md. Copy the template: cp examples/project-context-template.md .claude/rules/project-context.md

Session Starter Prompt

"Read CLAUDE.md or AGENTS.md, plus STATUS.md. We're continuing [Project Name]. Check which phases are complete and let's pick up where we left off."

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.