brain-archive

brain-archive is a command for Claude Code from jim4226/claude-workspace-brain. It costs 16 tokens per session (612 once invoked), scanned A, original, MIT.

A command for reviewing old project-memory entries and proposing their move to WORKSPACE_BRAIN_ARCHIVE.md, a separate history file. It covers completed work, old sessions, and outdated decisions.

In plain words
What is it for?
Use it to identify archive candidates, review a proposed migration, adjust age limits, and then apply the approved move.
Why use it?
It keeps the active project-memory file smaller while preserving older information for reference. It waits for approval before making changes.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python .claude/scripts/brain_lint.py WORKSPACE_BRAIN.md.

Good fit Use it to identify archive candidates, review a proposed migration, adjust age limits, and then apply the approved move.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/jim4226/claude-workspace-brain
agentmods
npx agentmods add commands/jim4226/claude-workspace-brain/brain-archive

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for brain-archive

README.md
[![agentmods](https://agentmods.dev/badge/commands/jim4226/claude-workspace-brain/brain-archive/github.svg)](https://agentmods.dev/commands/jim4226/claude-workspace-brain/brain-archive)
Your own site
<a href="https://agentmods.dev/commands/jim4226/claude-workspace-brain/brain-archive"><img src="https://agentmods.dev/badge/commands/jim4226/claude-workspace-brain/brain-archive/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for brain-archive

Your own site · 80×15
<a href="https://agentmods.dev/commands/jim4226/claude-workspace-brain/brain-archive"><img src="https://agentmods.dev/badge/commands/jim4226/claude-workspace-brain/brain-archive.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 612 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00016 $0.00612
Opus 5 $0.00008 $0.00306
Sonnet 5 $0.00003 $0.00122
Haiku 4.5 $0.00002 $0.00061

Measured 9d ago against content hash 5f387bb58799, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

brain-archive scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.claude/commands/brain-archive.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Keep WORKSPACE_BRAIN.md lean by moving aged-out content to a sidecar archive. The active brain stays small (fast to inject); the archive preserves history without bloating every session.

Step 1 — survey

Read WORKSPACE_BRAIN.md and identify:

  • Completed threads in ACTIVE THREADS marked (done), [x], or a check. Anything older than 14 days is a strong archive candidate.
  • Sessions in RECENT SESSIONS beyond the 10 newest entries.
  • Decisions in DECISIONS LOG older than 90 days that aren't load-bearing for current decisions (skim the SYNAPSES section to check for references).
  • Resolved open questions — these should already be removed when answered; flag any that look stale (>30 days old, no recent activity nearby).

Report a preview to the user: "I propose to move threads, sessions, and decisions to archive. Total: ~ lines, ~ KB."

Step 2 — wait for approval

Do not edit anything yet. Ask the user one of:

  1. "Apply the migration as proposed?"
  2. "Adjust the cutoff? (default: 14d threads / 10 sessions / 90d decisions)"
  3. "Skip - cancel."

Wait for their answer.

Step 3 — execute the migration

If approved:

  1. If WORKSPACE_BRAIN_ARCHIVE.md doesn't exist, create it with the header:

    # WORKSPACE BRAIN — Archive
    > Aged-out entries from WORKSPACE_BRAIN.md. Not auto-injected.
    > Append-only; oldest at bottom.
    

    Use Write for creation. Otherwise use Edit to insert at the top (newest archived first).

  2. For each archived entry, prepend to the archive under a date-stamped section: ## Archived 2026-MM-DD, then the entries grouped by their original section name (### From ACTIVE THREADS, etc.).

  3. Remove the same entries from WORKSPACE_BRAIN.md using Edit.

Step 4 — verify

Run the linter on the trimmed brain:

python .claude/scripts/brain_lint.py WORKSPACE_BRAIN.md

Report the new size + score. The archive operation should improve the size budget axis. Don't proceed if the brain ends up with an empty required section — restore those entries and warn the user.

Read the full file on GitHub · 70 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 70 lines · 16 tokens per session scan A 5f387bb58799

Subscribe to this mod's changes

brain-archive is a command published in the GitHub repository jim4226/claude-workspace-brain (1 stars, last pushed 1mo ago), licensed MIT. It adds 16 tokens to every session and 612 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.