计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
prune-agent-memory【效率与协作】審、分、擇之忘儲憶。含憶之列與依型/齡/取頻分、識陳訊之朽、以外錨行真實察、 選刪之決樹、為避再生而於敗策施反憶接種、防未來憶污染之先濾規、忘本身可審之留跡。 憶長大未理、項狀自憶書時已大變、取質衰、或為與 manage-memory 並之定期維時用之。
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
審、分、擇之忘儲憶。憶為基設。忘為策。此技定策。
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 |
各條另注:
得:完之列,每憶條皆依型、齡、取頻分。瞬條已標待即除。
敗則:若憶文過大或不結構不能逐條分,於節級行。分整節非個別點。目為涵,非粒。
對當前項狀比憶聲。朽為憶衰之最常形。
察此朽之模:
# 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.
各刪皆記條、其分、刪因(用於第七步)。
施此樹之任刪動前,察其條是否值接種(第五步)。敗策、棄法、險模為刪加接種之候,非唯刪。
得:明列:欲刪、欲更、欲留之條——各附記之因。留/刪之比依憶健;維良憶或修 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 總條修(多計漂與瞬漏)」。
得:時戳修剪記條,記何刪何因。記存於憶目,與憶同處。
敗則:若立分文覺過(唯 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 — 評推脈絡之健,憶質直影之