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

@@ -4,11 +4,11 @@ type: workplan
title: "Profile 1 Production Hardening: Reflection UX, Compaction, and Surfacing"
domain: capabilities
repo: can-you-assist
status: ready
status: finished
owner: grok
topic_slug: foerster-capabilities
created: "2026-06-19"
updated: "2026-06-19"
updated: "2026-06-22"
state_hub_workstream_id: "f62c6908-dec0-442c-83d2-e34f0e87c1e7"
---
@@ -35,6 +35,7 @@ provenance, memory signals add caution only (never downgrade risk or bypass conf
recommends production-hardening Profile 1 as the highest-leverage next deepening step.
- **Profile definitions:** MemoryVision.md — Profile 1 section and Capability Matrix.
- **Safety contract:** `src/cya/safety/risk.py` + CYA-WP-0002-T04 invariants.
- **Gap checklist (T01):** `docs/CYA-WP-0006-profile-1-gap-checklist.md`
## Non-Goals (for this slice)
@@ -50,7 +51,7 @@ provenance, memory signals add caution only (never downgrade risk or bypass conf
```task
id: CYA-WP-0006-T01
status: todo
status: done
priority: high
state_hub_task_id: "ec8cc24d-80ca-4a51-b98c-87d0cfc9a110"
```
@@ -63,11 +64,13 @@ Produce a short checklist in the workplan or `docs/` that gates T02T05.
- Gap checklist exists with prioritized items mapped to tasks T02T05.
- No code changes required unless a blocking bug is found (file separately as ADHOC if so).
**Done:** `docs/CYA-WP-0006-profile-1-gap-checklist.md`
### T02 — Improve `cya retrospect` reflection capture UX
```task
id: CYA-WP-0006-T02
status: todo
status: done
priority: high
state_hub_task_id: "c7f381d4-d362-4183-a7bd-d3ceea7e997d"
```
@@ -83,11 +86,13 @@ Enhance the optional verbal-lesson step in `run_retrospection()`:
- Skipping leaves no orphan/empty reflection records.
- Existing retrospection kinds and goals flow unchanged.
**Done:** `_capture_reflection_lessons()` in `orchestrator.py`; helpers in `memory/reflections.py`.
### T03 — Reflection review and lightweight compaction
```task
id: CYA-WP-0006-T03
status: todo
status: done
priority: medium
state_hub_task_id: "078d6f17-6d56-42ec-85c9-140c41d7e83f"
```
@@ -104,11 +109,13 @@ Add user-visible reflection management without hiding state:
- Duplicate detection works on a small fixture set; merge/replace is opt-in.
- Compaction never bypasses safety or provenance requirements.
**Done:** `cya memory reflections` CLI; `_offer_reflection_compaction()` in retrospect; `compact_reflections()` / `find_duplicate_reflection_groups()`.
### T04 — Strengthen surfacing in responses and `--explain-context`
```task
id: CYA-WP-0006-T04
status: todo
status: done
priority: high
state_hub_task_id: "b1f7a333-bf9a-478c-993b-e421524ced3a"
```
@@ -123,11 +130,13 @@ Improve how activated reflections appear in `handle_request()` and context expla
- Roundtrip test: stored reflection → recall → visible in explain output.
- Output remains readable for 0, 1, and 5+ reflections.
**Done:** `format_reflection_surfacing()`; recall prioritization for `KIND_REFLECTION`.
### T05 — Tests, observability, and safety regression coverage
```task
id: CYA-WP-0006-T05
status: todo
status: done
priority: high
state_hub_task_id: "b42c8fa1-6ab7-4b75-bdd5-43006e2d0a9c"
```
@@ -145,11 +154,13 @@ Add basic observability in `export_memory` (reflection counts by scope).
- `make test` / `python3 -m pytest tests/ -q` passes cleanly.
- At least one test per new behavior path from T02T04.
**Done:** 9 new tests in `test_memory.py`; `tests/test_orchestrator.py` added.
### T06 — Documentation updates
```task
id: CYA-WP-0006-T06
status: todo
status: done
priority: medium
state_hub_task_id: "18498a09-1d1c-424b-bf13-6952fabd34d3"
```
@@ -161,11 +172,13 @@ SCOPE.md if delivered scope changes materially.
- README documents the hardened Profile 1 flow with an example session.
- MemoryVision notes Profile 1 as "production" (not "spike") when T02T05 complete.
**Done:** README, MemoryVision, SCOPE updated.
### T07 — Register, sync, and handoff
```task
id: CYA-WP-0006-T07
status: todo
status: done
priority: medium
state_hub_task_id: "a9c2627f-7ed8-45a9-b1ee-7ba64ebbcd09"
```
@@ -200,7 +213,4 @@ When complete:
- Safety and explainability invariants from Profile 0 remain intact.
- Users reading README + MemoryVision understand Profile 1 as shipped capability, not a spike.
---
**Status note:** Promoted to `ready` on 2026-06-19 after operator review. Move to
`active` when implementation begins (ralph-workplan or direct session).
**Completed 2026-06-22.** All tasks done; 36 tests pass.