status · diff

git:20260912.9ee3372 to git:20260912.708b336

22 added, 9 removed. Audit A to A.

---
name: status
description: "Memory health dashboard showing line counts, topic files, capacity, stale entries, and recommendations."
command: /self-improving-agent:status
---
# /self-improving-agent:status — Memory Health Dashboard
Quick overview of your project's memory state across all memory systems.
## Usage
```
/self-improving-agent:status # Full dashboard
/self-improving-agent:status --brief # One-line summary
```
## What It Reports
### Step 1: Locate all memory files
```bash
# Auto-memory directory. Claude Code replaces EVERY non-alphanumeric character in the
# resolved absolute cwd with a single "-" (dots, spaces and CJK included).
MEMORY_DIR="$HOME/.claude/projects/$(pwd -P | sed 's/[^a-zA-Z0-9]/-/g')/memory"
# The counts below are 0 when the path is wrong, which reads exactly like "healthy".
# Verify the directory first; under LC_ALL=C sed goes per byte, so glob as a fallback:
# [ -d "$MEMORY_DIR" ] || ls -d ~/.claude/projects/*"$(basename "$PWD" | sed 's/[^a-zA-Z0-9]/-/g')"*
# Count lines in MEMORY.md
wc -l "$MEMORY_DIR/MEMORY.md" 2>/dev/null || echo "0"
# List topic files
ls "$MEMORY_DIR/"*.md 2>/dev/null | grep -v MEMORY.md
# CLAUDE.md
wc -l ./CLAUDE.md 2>/dev/null || echo "0"
wc -l ~/.claude/CLAUDE.md 2>/dev/null || echo "0"
# Rules directory
ls .claude/rules/*.md 2>/dev/null | wc -l
```
### Step 2: Analyze capacity
| Metric | Healthy | Warning | Critical |
|--------|---------|---------|----------|
| MEMORY.md lines | < 120 | 120-180 | > 180 |
| CLAUDE.md lines | < 150 | 150-200 | > 200 |
| Topic files | 0-3 | 4-6 | > 6 |
| Stale entries | 0 | 1-3 | > 3 |
### Step 3: Quick stale check
For each MEMORY.md entry that references a file path:
```bash
- # Verify referenced files still exist.
- # Two things this MUST get right, or it reports garbage:
- # 1. Resolve against BOTH the project root (cwd) and $MEMORY_DIR. MEMORY.md's own links
- # point at sibling topic files, which do not exist relative to cwd.
- # 2. Skip bare filenames (no "/"). Those are topic-file links like [x](user_role.md),
- # not project paths — judging them as project paths marks nearly every entry STALE.
- grep -oE '[a-zA-Z0-9_/.-]+\.(ts|js|py|md|json|yaml|yml)' "$MEMORY_DIR/MEMORY.md" \
+ # Verify referenced files still exist. There are TWO kinds of reference and they resolve
+ # against different roots — lumping them together is how this check breaks:
+ #
+ # 1. Topic-file links, always written as markdown links with a BARE filename:
+ # [Some title](user_role.md). They live NEXT TO MEMORY.md, so resolve against
+ # $MEMORY_DIR. These are the majority (a real MEMORY.md here: 47 bare vs 1 with a slash).
+ # 2. Project paths, which always contain "/". Resolve against the project root (cwd).
+ #
+ # Bare filenames that are NOT link targets (CLAUDE.md, ci.yml, plugin.json mentioned in
+ # prose) are neither kind — the link-target pattern skips them on its own. Do not "simplify"
+ # this into one pass: resolving everything against cwd reports ~46 false STALE on a healthy
+ # memory dir, and skipping every bare name makes the topic-file check dead code.
+
+ # 1. topic files — markdown link targets with no "/", resolved next to MEMORY.md
+ grep -oE '\]\([^)/]+\.(ts|js|py|md|json|yaml|yml)\)' "$MEMORY_DIR/MEMORY.md" \
+ | sed 's/^](//; s/)$//' | sort -u | while IFS= read -r f; do
+ [ -f "$MEMORY_DIR/$f" ] || echo "STALE (topic): $f"
+ done
+
+ # 2. project paths — anything containing "/", including absolute paths, resolved from cwd
+ grep -oE '/?([a-zA-Z0-9_.-]+/)+[a-zA-Z0-9_.-]+\.(ts|js|py|md|json|yaml|yml)' "$MEMORY_DIR/MEMORY.md" \
| sort -u | while IFS= read -r f; do
- case "$f" in */*) ;; *) continue ;; esac
- [ -f "$f" ] || [ -f "$MEMORY_DIR/$f" ] || echo "STALE: $f"
+ [ -f "$f" ] || echo "STALE (path): $f"
done
```
### Step 4: Output
```
📊 Memory Status
Auto-Memory (MEMORY.md):
Lines: {{n}}/200 ({{bar}}) {{emoji}}
Topic files: {{count}} ({{names}})
Last updated: {{date}}
Project Rules:
CLAUDE.md: {{n}} lines
Rules: {{count}} files in .claude/rules/
User global: {{n}} lines (~/.claude/CLAUDE.md)
Health:
Capacity: {{healthy/warning/critical}}
Stale refs: {{count}} (files no longer exist)
Duplicates: {{count}} (entries repeated across files)
{{if recommendations}}
💡 Recommendations:
- {{recommendation}}
{{endif}}
```
### Brief mode
```
/self-improving-agent:status --brief
```
Output: `📊 Memory: {{n}}/200 lines | {{count}} rules | {{status_emoji}} {{status_word}}`
## Interpretation
- **Green (< 60%)**: Plenty of room. Auto-memory is working well.
- **Yellow (60-90%)**: Getting full. Consider running `/self-improving-agent:review` to promote or clean up.
- **Red (> 90%)**: Near capacity. Auto-memory may start dropping older entries. Run `/self-improving-agent:review` now.
## Tips
- Run `/self-improving-agent:status --brief` as a quick check anytime
- If capacity is yellow+, run `/self-improving-agent:review` to identify promotion candidates
- Stale entries waste space — delete references to files that no longer exist
- Topic files are fine — Claude creates them to keep MEMORY.md under 200 lines