feat: initial cog release — cognitive architecture for Claude Code
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
135
.claude/commands/housekeeping.md
Normal file
135
.claude/commands/housekeeping.md
Normal file
@@ -0,0 +1,135 @@
|
||||
Use this skill to perform memory housekeeping. Trigger if the user says "housekeeping", "clean up memory", "prune memory", "archive old data", or similar maintenance requests.
|
||||
|
||||
## 1. Garbage Collect Memory
|
||||
|
||||
Review and archive stale data per CLAUDE.md glacier rules. All glacier files must have YAML frontmatter.
|
||||
|
||||
**Observations — archive by primary tag:**
|
||||
- If any `observations.md` has >50 entries, group oldest entries by primary tag and move to `memory/glacier/{domain}/observations-{tag}.md`
|
||||
- If `memory/cog-meta/self-observations.md` has >50 entries, group by primary tag → `memory/glacier/cog-meta/observations-{tag}.md`
|
||||
|
||||
**Other files — standard rules:**
|
||||
- If any `action-items.md` has >10 completed items, move to `memory/glacier/{domain}/action-items-done.md`
|
||||
- Apply same logic for all domains listed in `memory/domains.yml`
|
||||
- If `memory/cog-meta/improvements.md` has >10 implemented items, move to `memory/glacier/cog-meta/improvements-done-{YYYY}.md`
|
||||
|
||||
## 2. Prune Hot Memory (rule-based)
|
||||
|
||||
Keep ALL hot-memory.md files under 50 lines. Relevance judgment (promote/demote) is /reflect's job — you apply structural rules:
|
||||
|
||||
**Files to check:**
|
||||
Read `memory/domains.yml` to discover all active domains. Check `hot-memory.md` for each domain, plus the cross-domain `memory/hot-memory.md`.
|
||||
|
||||
**Pruning priority (trim in this order):**
|
||||
1. **Resolved items** — anything with ~~strikethrough~~, "DONE", "RESOLVED"
|
||||
2. **Past events** — entries about dates that have already occurred
|
||||
3. **SSOT violations** — same fact in hot-memory AND the canonical file (entities, action-items, etc.). Keep in canonical file, replace hot-memory copy with `[[link]]` or remove
|
||||
4. **Stale entries** — items not referenced in 14+ days
|
||||
5. **Low-signal entries** — FYI items with no action or deadline
|
||||
|
||||
**Where trimmed entries go:**
|
||||
- Entries with lasting value → append to domain's `observations.md`
|
||||
- Entries that are purely historical → let them go
|
||||
- Never silently delete — always move or note removal in debrief
|
||||
|
||||
## 3. Surface Opportunities & Accountability
|
||||
|
||||
Review all `action-items.md` files across every domain:
|
||||
- **Stale items** (open >2 weeks): list with age and suggested next action
|
||||
- **Dormant domains**: if any domain has 0 new observations in >4 weeks, flag
|
||||
- **Health escalation**: items open >6 months get flagged with urgency label
|
||||
- **Birthday prep**: if any birthday in entities.md is <2 weeks away, pull interests and suggest ideas
|
||||
|
||||
Be direct. Don't just report — recommend specific actions.
|
||||
|
||||
## 4. Rebuild Glacier Index
|
||||
|
||||
Scan all `memory/glacier/**/*.md` files. Extract YAML frontmatter. Write results to `memory/glacier/index.md`:
|
||||
|
||||
```
|
||||
# Glacier Index
|
||||
<!-- Auto-generated by housekeeping. Do not edit. -->
|
||||
<!-- Last updated: YYYY-MM-DD -->
|
||||
|
||||
| File | Domain | Type | Tags | Date Range | Entries | Summary |
|
||||
|------|--------|------|------|------------|---------|---------|
|
||||
```
|
||||
|
||||
## 5. Link Audit (discover missing links)
|
||||
|
||||
For each non-glacier memory file:
|
||||
1. **Entity mentions**: Scan for names matching `### <Name>` headers in entities.md — add `[[links]]` if missing
|
||||
2. **Cross-domain references**: If a file mentions a topic from another domain, add a cross-domain link
|
||||
3. **Action item references**: If an observation references a task, link it
|
||||
|
||||
Only add links where the reference is substantive.
|
||||
|
||||
## 5b. Temporal Fact Maintenance
|
||||
|
||||
Scan all `entities.md` files for `(until YYYY-MM)` markers with past dates:
|
||||
1. If the line has no ~~strikethrough~~, add it
|
||||
2. If already struck through, move to a `## Historical` subsection at the bottom of that entity's block (create the subsection if absent)
|
||||
3. Report moved facts in the debrief
|
||||
|
||||
## 6. Rebuild Link Index
|
||||
|
||||
Scan all memory files (excluding `glacier/`) for `[[wiki-links]]`. For each link, record: target → source.
|
||||
|
||||
Rewrite `memory/link-index.md`:
|
||||
|
||||
```markdown
|
||||
# Memory Link Index
|
||||
<!-- Auto-generated by housekeeping. Do not edit. -->
|
||||
<!-- Last updated: YYYY-MM-DD -->
|
||||
|
||||
| Target | Linked from |
|
||||
|--------|-------------|
|
||||
| `personal/entities` | `personal/observations`, `personal/hot-memory` |
|
||||
```
|
||||
|
||||
Rules:
|
||||
- Only include targets with at least one inbound link
|
||||
- Combine multiple sources per target on one row (comma-separated)
|
||||
- Exclude glacier files from both source and target
|
||||
|
||||
## 7. Write Briefing Bridge
|
||||
|
||||
Write key findings to `memory/cog-meta/briefing-bridge.md` so foresight can pick them up:
|
||||
|
||||
```markdown
|
||||
# Briefing Bridge
|
||||
<!-- Auto-generated by housekeeping. Consumed by foresight. -->
|
||||
<!-- Last updated: YYYY-MM-DD -->
|
||||
|
||||
## Stale Items (>2 weeks)
|
||||
- <item> — <age> — suggested action: <action>
|
||||
|
||||
## Birthday Prep
|
||||
- <name> birthday in <N> days — interests: <from entities>
|
||||
|
||||
## Dormant Domains
|
||||
- <domain> — last activity: <date>
|
||||
|
||||
## Health Escalation
|
||||
- <item> — open <N> months
|
||||
```
|
||||
|
||||
Only include sections that have content.
|
||||
|
||||
## 8. L0 Header Maintenance
|
||||
|
||||
Check all active memory files for missing `<!-- L0: ... -->` headers. If a file is missing its L0:
|
||||
- Read the file content, write a one-line summary (max 80 chars)
|
||||
- Add on the line after the `# Title`
|
||||
|
||||
L0 headers are the first tier of the retrieval protocol — they let any skill scan what a file contains before deciding to read it.
|
||||
|
||||
## 9. Compose Debrief
|
||||
|
||||
Summarize everything done:
|
||||
- What was archived/pruned
|
||||
- Upcoming events flagged
|
||||
- Action items surfaced
|
||||
- Links added
|
||||
|
||||
Keep it concise but informative.
|
||||
Reference in New Issue
Block a user