feat(memory): complete CYA-WP-0006 Profile 1 production hardening

Add guided reflection capture with preview, cya memory reflections CLI,
near-duplicate compaction, budget-capped surfacing, and expanded tests.
Profile 1 is now documented as production-ready in README and MemoryVision.
This commit is contained in:
2026-06-22 01:39:07 +02:00
parent a0d24a31eb
commit c14d09c14d
12 changed files with 735 additions and 52 deletions

View File

@@ -115,12 +115,29 @@ Run a guided reflection session to review how memory was used and explicitly set
cya retrospect
```
During the session `cya` will (Profile 1 spike in T05 adds optional verbal lesson capture at the end):
During the session `cya` will:
- Show recent memory items that were activated.
- Help you reflect on what worked or didn't.
- Let you record new **interaction goals** (e.g. "be more concise", "always show one safe alternative for destructive commands").
- Optionally capture **13 verbal lessons** (Profile 1) with guided prompts, preview, and confirmation.
These goals are stored as first-class retrospection memory and will influence future activations and responses.
Example Profile 1 flow at the end of `cya retrospect`:
```
Capture 13 verbal lessons from this session? (y/n) y
What went well that you want to remember? (or 'skip') Safety warnings were clear
What should cya remember for next time? (or 'skip') Always suggest git status first
What should cya avoid in this scope? (or 'skip') skip
Preview — verbal lessons to save
1. [went well] Safety warnings were clear
2. [remember] Always suggest git status first
Save these lessons? (y/n) y
Saved 2 verbal reflection(s) (Profile 1).
```
These goals and lessons are stored as first-class memory and will influence future activations and responses.
### Inspecting and Controlling Memory
@@ -132,6 +149,8 @@ All memory is stored in plain, user-editable JSON:
Useful commands:
```bash
cya --explain-context "..." # See exactly what memory was activated and why
cya memory reflections # List verbal reflections for the current scope
cya memory reflections --json # Export reflections as JSON
# (You can also use the memory ports directly in Python if you want to script it.)
```
@@ -142,7 +161,9 @@ Memory also feeds the safety layer: a "never auto-run" preference you set during
- Activation is automatic based on cwd + git root (with full provenance).
- Retrospection outcomes are stored with special kinds (`retrospection`, `interaction_goal`) and get preferential treatment in future context building.
- Everything is designed to be replaced/enriched by a full `phase-memory` implementation later (see MemoryVision.md).
- Current implementation is formally **Profile 0** (post-0003 local JSON + activation + retrospection loop). See CYA-WP-0005 and the "Profile 0 Baseline" section in MemoryVision.md for the exact definition and the roadmap to Profiles 13 (self-improving verbal reflections, hierarchical synthesis, and procedural rules).
- **Profile 0** (post-0003 local JSON + activation + retrospection loop) is the stable foundation.
- **Profile 1** (verbal reflections) is production-ready as of CYA-WP-0006: guided capture in `cya retrospect`, `cya memory reflections`, compaction, and surfacing in responses / `--explain-context`.
- Profiles 23 (hierarchical synthesis, procedural rules) remain roadmap items — see MemoryVision.md.
See:
- `docs/cya-memory-activation-and-retrospection-concept.md` (the T01 design)