This change makes compaction summaries durable under .claude/memory,
feeds those saved memory files back into prompt context, updates /memory
to report both instruction and project-memory files, and moves TodoWrite
persistence to a human-readable .claude/todos.md file.
Constraint: Reuse existing compaction, prompt loading, and slash-command plumbing rather than add a new subsystem
Constraint: Keep persisted project state under Claude-local .claude/ paths
Rejected: Introduce a dedicated memory service module | larger diff with no clear user benefit for this task
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Project memory files are loaded as prompt context, so future format changes must preserve concise readable content
Tested: cargo fmt --all --manifest-path rust/Cargo.toml
Tested: cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -D warnings
Tested: cargo test --manifest-path rust/Cargo.toml --all
Not-tested: Long-term retention/cleanup policy for .claude/memory growth
This improves Rust prompt-building by deduplicating repeated CLAUDE instruction content, surfacing clearer project-context metadata, and truncating oversized instruction payloads so local rules stay useful without overwhelming the runtime prompt.
The change preserves ancestor-chain discovery while making the rendered context more stable, compact, and readable for downstream compaction and CLI flows.
Constraint: Keep existing CLAUDE.md discovery semantics while reducing prompt bloat
Constraint: Avoid adding a new parser or changing user-authored instruction file formats
Rejected: Introduce a structured CLAUDE schema now | too large a shift for this parity slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If richer instruction precedence is added later, keep duplicate suppression conservative so distinct local rules are not silently lost
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Live end-to-end behavior with very large real-world CLAUDE.md trees