brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
prune-agent-memoryAudit, classify, and selectively forget stored memories. Covers memory enumeration and classification by type/age/access frequency, staleness detection for outdated references, fidelity checks using external anchors, a decision tree for selective deletion, counter-memory inoculation for failed strategies that would otherwise be re-derived, preemptive filter…
Independent GitHub snapshot · Automated classification · Original documentation governs
審、分、擇忘所存憶。憶為基。忘為策。此技定策。
manage-memory 聚於組與長憶(何留、何構),此技聚反:何棄、如何察衰、如何使忘為意非偶。二技互補、定期維時當共用。
~/.claude/projects/<project-path>/memory/)讀諸憶檔、各項按四維分。
# Inventory the memory directory
ls -la <memory-dir>/
wc -l <memory-dir>/*.md
# Count total entries (approximate by counting top-level bullets and headers)
grep -c "^- \|^## " <memory-dir>/MEMORY.md
for f in <memory-dir>/*.md; do echo "$f: $(grep -c '^- \|^## ' "$f") entries"; done
各憶項分為下型之一:
| Type | Description | Example | Default retention |
|---|---|---|---|
| Project | Facts about project structure, architecture, conventions | "skills/ has 310 SKILL.md files across 55 domains" | Keep until verified stale |
| Decision | Choices made and their rationale | "Chose hub-and-spoke over sequential for review teams because..." | Keep indefinitely |
| Pattern | Debugging solutions, workflow insights, recurring behaviors | "Exit code 5 means quoting error — use temp files" | Keep until superseded |
| Reference | Links, version numbers, external resources | "mcptools docs: https://..." | Keep until verified stale |
| Feedback | User preferences, corrections, style guidance | "User prefers kebab-case for file names" | Keep indefinitely |
| Ephemeral | Session-specific context that leaked into persistent memory | "Currently working on issue #42" | Prune immediately |
各項亦注:
得:完錄含每憶項按型分、含齡與取頻估。Ephemeral 項已標即除。
敗:憶檔過大或無構不可逐項分→於段級行。分全段非各項。標為覆、非粒。
對今案態比憶述。舊為憶衰之最常式。
察下舊式:
# Spot-check counts against source of truth
grep -oP '\d+ skills' <memory-dir>/MEMORY.md
grep -c "^ - id:" skills/_registry.yml
# Check for references to files that no longer exist
grep -oP '`[^`]+\.(md|yml|R|js|ts)`' <memory-dir>/MEMORY.md | sort -u | while read f; do
path="${f//\`/}"
[ ! -f "$path" ] && echo "STALE: $path referenced but not found"
done
# Check for references to old names/paths
grep -i "old-name\|previous-name\|renamed-from" <memory-dir>/*.md
各舊項標其舊型與今正值。
得:舊項列含特變據。各舊項薦行:更(若知正值)、驗(若不確)、修(若全項已廢)。
敗:因外態(API、三方文、布署態)而不能驗→標為 unverifiable 勿假其正。未驗項為修候若無活用。
試憶取時否仍生用境。此最難——主不能驗己縮憶之誠——需外錨。
誠檢法:
往返驗:讀憶項、後察其述之實案態。憶引至正檔、正式、正結乎?
縮失察:憶撮對原源比。50 行討縮為 2 行憶、縮保行洞乎抑只題標?
# Find the source that a memory entry was derived from
# (git log, old PRs, original files)
git log --oneline --all --grep="<keyword from memory entry>" | head -5
矛盾掃:搜憶相矛或矛 CLAUDE.md/案文。
# Look for potential contradictions in counts
grep -n "total" <memory-dir>/MEMORY.md
grep -n "total" CLAUDE.md
# Compare the values — they should agree
用試:各憶項問:「此項除、後 5 會何錯?」答「恐無」→項誠值低即正。
得:各憶項今有誠評:高(驗準用)、中(恐準偶用)、低(未驗或罕用)、敗(驗誤或矛)。
敗:諸項誠檢不決→聚最高效項。誤憶於案架險於誤憶於除錯。骨級實察先於肉級細。
用此決樹按序定何修:
Pruning Decision Tree (apply in order):
1. EPHEMERAL entries (Step 1 classification)
→ Delete immediately. These should never have been persisted.
2. FAILED fidelity entries (Step 3)
→ Delete immediately. Inaccurate memories are worse than no memories.
3. DUPLICATES
→ Keep the most complete/accurate version, delete others.
→ If duplicates span MEMORY.md and a topic file, keep the topic file version.
4. STALE entries with known corrections (Step 2)
→ UPDATE if the entry is otherwise useful (change the stale value to current).
→ DELETE if the entire entry is obsolete (the topic no longer matters).
5. LOW fidelity, low access frequency entries
→ Delete. These are taking space without providing value.
6. MEDIUM fidelity entries about completed/closed work
→ Archive or delete. Past sprint details, resolved incidents, merged PRs.
→ Exception: keep if the resolution contains a reusable pattern.
7. REFERENCE entries with freely available sources
→ Delete if the reference is a Google search away.
→ Keep if the reference is hard to find or has project-specific context.
各除、記項、其分、除由(用於步八)。
施此樹之 DELETE 前、察項否當受逆種(步五)。敗策、棄徑、險式為「除兼種」之候、非「唯除」。
得:明列除項、更項、留項——各含記由。留/除比依憶健;善養者修 5-10%、忽者修 30-50%。
敗:諸項決樹模→緊濾:「今知所知、今書此項乎?」否→修候。傾修——重學實易於繞誤憶。
某棄結不可徑除。除孤敗於生憶之件未滅——系自同入沿同推徑重生所除之憶。為此例、書一逆憶以絕重生、與除並行(或代之)。
決則——唯除、除兼種、唯種:
| 憶類 | 行 | 由 |
|---|---|---|
| 舊實、過指、廢境 | 唯除 | 唯取清;重生無行險 |
| 敗策、險式、棄徑而觸件仍存 | 除兼種 | 推徑將自重生其結 |
| 後覆之決而原由猶要 | 唯種 | 留原項;加 SUPERSEDED 逆憶指其 |
SUPERSEDED 錄式(auto-memory frontmatter;構從他憶系而適):
---
name: superseded-<short-id>
description: Counter-memory preventing re-derivation of <pattern>
type: superseded
---
SUPERSEDED <YYYY-MM-DD>
Pattern: <what was tried — describe the conclusion or strategy>
Period: <start> to <end>
Evidence: <what happened — concrete data, not narrative>
Abandonment reason: <specific cause; not "did not work">
Do not re-derive from: <signal types or input patterns that previously led here>
Supersedes: <path to original memory if delete + inoculate, or N/A>
SUPERSEDED 錄各為己檔置於憶目(如 superseded_strategy_X.md)使取時與活憶並現。逆憶乃所行之變機:相號至、SUPERSEDED 浮、絕重生之徑。
何時不種:
種衛:
Pattern 與 Do not re-derive from 宜特。模逆憶(如「勿試繁解」)為噪得:步四之除候涉棄策險式者、各於除前生對應 SUPERSEDED 逆憶檔。修誌錄除與種。活憶猶瘦而重生徑絕。
敗:項當種否未定→默種。冗 SUPERSEDED 之費少;重生惡式之費厚。SUPERSEDED 列大至自為噪→是上層件生諸棄之兆——修在入層、非憶層。
定「何不存」則防未來憶污。察現憶為書時當濾之式。
永不為持憶之式:
| Pattern | Why | Example |
|---|---|---|
| Session-specific task state | Stale by next session | "Currently debugging issue #42" |
| Intermediate reasoning | Not a conclusion | "Tried approach A, didn't work because..." |
| Debug output / stack traces | Ephemeral diagnostic data | "Error was: TypeError at line 234..." |
| Exact command sequences | Brittle, version-dependent | "Run npm install foo@3.2.1 && ..." |
| Emotional/tonal notes | Not actionable | "User seemed frustrated" |
| Duplicates of CLAUDE.md | Already in system prompt | "Project uses renv for dependencies" |
| Unverified single observations | May be wrong | "I think the API rate limit is 100/min" |
現憶有此式者→加於步四除列。
濾則記於 MEMORY.md 或 retention-policy.md 題檔以使未會於書新憶前察。
得:憶目記之前濾則。現項合此式者標除。
敗:記濾則似早(憶小、污少)→略記而仍施濾以捉現違。則可後形於憶目熟時。
各除錄使忘可察。立或更修誌。
<!-- In <memory-dir>/pruning-log.md or appended to MEMORY.md -->
## Pruning Log
### YYYY-MM-DD Audit
- **Entries audited**: N
- **Entries pruned**: M (X%)
- **Entries updated**: K
- **Staleness found**: [list of stale patterns detected]
- **Fidelity failures**: [list of entries that failed verification]
#### Deletions
| Entry (summary) | Type | Reason |
|-----------------|------|--------|
| "Currently working on issue #42" | Ephemeral | Session-specific, stale |
| "skills/ has 280 SKILL.md files" | Project | Count drift: actual is 310 |
| "Use acquaint::mcp_session()" | Pattern | Package renamed to mcptools |
修誌簡。為責、非考古。誌大→撮老項:「2025:3 審、47 項修(多數漂與 ephemeral 漏)」。
得:時印之修誌項記何除何由。誌存於憶目與憶共。
敗:分檔似過(唯 1-2 項修)→於 MEMORY.md 加短注:<!-- Last pruned: YYYY-MM-DD, removed 2 stale entries -->。任記優於默除。
某憶項當免修不論齡、頻、誠分。為失即需大力重構之不可代境。
護憶則:
| Category | Examples | Why protected |
|---|---|---|
| Architecture decisions | "Chose flat skill directory over nested" | Rationale is lost if re-derived later |
| User identity preferences | "Always use kebab-case," "Never auto-commit" | Explicit user intent, not inferrable |
| Security audit results | "Last audit: 2025-12-13 — PASSED" | Compliance evidence with timestamps |
| Rename/migration records | "Repo renamed: X to Y on date Z" | Cross-reference integrity depends on this |
標法:護項以 <!-- PROTECTED --> 內標或於修誌持 protected 列。步四決樹必先察護態乃施除則。
解護:修護項→先明除標、於修誌記由。二步防偶除高值憶。
得:護項過諸修。修誌記任護加除。
敗:護集過大(>總 30%)→察則——護為不可代境、非「重」項。重而可重立之實當受常修。
除後餘憶恐碎——交引指除項、題檔失連、MEMORY.md 有缺。重合復構整。
重合清單:
得:修後憶構固——無孤引、無冗片、無不連題檔。冷項分為未來修決。
敗:重合顯修過激(要境失)→察修誌、自審跡重立。此為審跡所以存。
憶漂於存實默誤——非始誤、實底變而憶未更。漂復試就地修憶非修除。
漂察觸:
復程:
[corrected YYYY-MM-DD] 注unverifiable 而標修得:漂憶可則就地修保境。不可修者標修。防則減未來漂。
敗:漂廣(>20%)→憶恐需全重立非漸修。則檔當前憶目、自始、擇重入過驗者。
manage-memory — 組與長憶之補技;共用為全憶維meditate — 清接地可顯何憶生噪rest — 有時最佳憶維為不維assess-context — 推境健察、憶質直影