Add Claude Code support, credential routing polish, and CYA-WP-0006

Mirror sibling-repo Claude setup (CLAUDE.md + .claude/rules/*), align
AGENTS.md with fleet credential-routing template, and close housekeeping
gaps (WP-0002-T05 done, WP-0005 status note). Draft CYA-WP-0006 for
Profile 1 production hardening as the proposed next slice.
This commit is contained in:
2026-06-19 20:33:13 +02:00
parent ad11632bd4
commit f4e965cc04
14 changed files with 600 additions and 3 deletions

View File

@@ -137,10 +137,11 @@ completed: "2026-05-26"
```task
id: CYA-WP-0002-T05
status: progress
status: done
priority: high
state_hub_task_id: "d30f159c-3459-4c7b-ba31-990a73deaffb"
started: "2026-05-26 final ralph push"
completed: "2026-05-28"
```
- Expand the test suite (building on T07) with memory-specific tests (in-memory fake phase-memory adapter, profile scenarios, error cases).

View File

@@ -254,7 +254,9 @@ When complete:
---
**Status note**: This workplan is created in `proposed` state. It captures a focused, high-leverage planning and feedback slice. Implementation of the profiles (beyond the baseline documentation and optional Profile 1 spike) should be activated only after review and operator go-ahead, following the ralph-workplan discipline used for 00010004.
**Status note**: Completed 2026-05-28. Profile 0 baseline, Profiles 13 definitions, phase-memory
feedback artifact, and minimal Profile 1 spike are delivered. Production hardening for Profile 1
is tracked in `workplans/CYA-WP-0006-profile-1-production-hardening.md`.
**References** (non-exhaustive):
- Research: `history/2026-05-28-CYA-Agentic-Memory-Research-Variations.md`

View File

@@ -0,0 +1,199 @@
---
id: CYA-WP-0006
type: workplan
title: "Profile 1 Production Hardening: Reflection UX, Compaction, and Surfacing"
domain: capabilities
repo: can-you-assist
status: proposed
owner: grok
topic_slug: foerster-capabilities
created: "2026-06-19"
updated: "2026-06-19"
---
# CYA-WP-0006: Profile 1 Production Hardening
## Goal
Move the **Profile 1** (Reflexion-style verbal reflections) spike from CYA-WP-0005-T05
from "minimal but working" to **production-quality** behavior that users can rely on daily:
- Clearer capture UX inside `cya retrospect`
- Lightweight reflection management (review, edit path, basic compaction)
- Stronger surfacing in normal responses and `--explain-context`
- Expanded tests and observability
Preserve all Profile 0 / safety invariants: user-controlled inspectable memory, full
provenance, memory signals add caution only (never downgrade risk or bypass confirmation).
## Background & References
- **Profile 1 spike (done):** `remember_reflection()`, `KIND_REFLECTION`, optional capture
step in `run_retrospection()`, preferential recall by kind, basic output surfacing.
- **Gap analysis:** `history/2026-05-28-CYA-Intent-Scope-Gap-Analysis-Post-0005.md`
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.
## Non-Goals (for this slice)
- Profile 2 (hierarchical synthesis) or Profile 3 (procedural evolution) implementation.
- Real `llm-connect` client wiring (separate future slice).
- Deep `phase-memory` graph/planner integration (feedback doc exists; wiring is later).
- Automatic background reflection generation without explicit user trigger.
- PyPI publishing or CI automation (registered debt from CYA-WP-0004).
## Task Breakdown
### T01 — Audit Profile 1 spike gaps vs MemoryVision acceptance
```task
id: CYA-WP-0006-T01
status: todo
priority: high
```
Document the delta between shipped spike behavior and MemoryVision Profile 1 acceptance
criteria: capture UX, activation surfacing, compaction, explainability, safety integration.
Produce a short checklist in the workplan or `docs/` that gates T02T05.
**Acceptance criteria:**
- 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).
### T02 — Improve `cya retrospect` reflection capture UX
```task
id: CYA-WP-0006-T02
status: todo
priority: high
```
Enhance the optional verbal-lesson step in `run_retrospection()`:
- Guided prompts (what went well / what to remember / what to avoid)
- Preview before save; allow skip without storing empty records
- Store structured metadata (session date, scope) in provenance
**Acceptance criteria:**
- Users can capture 13 concise lessons with clear prompts and confirmation.
- Skipping leaves no orphan/empty reflection records.
- Existing retrospection kinds and goals flow unchanged.
### T03 — Reflection review and lightweight compaction
```task
id: CYA-WP-0006-T03
status: todo
priority: medium
```
Add user-visible reflection management without hiding state:
- `export_memory(..., kinds=["reflection"])` surfaced via CLI helper or documented path
- Simple compaction: detect near-duplicate reflections in the same scope (string similarity
or normalized key collision) and offer merge/replace in retrospect or a small subcommand
- All compaction is explicit — no silent deletion
**Acceptance criteria:**
- User can list/export reflections for a scope.
- Duplicate detection works on a small fixture set; merge/replace is opt-in.
- Compaction never bypasses safety or provenance requirements.
### T04 — Strengthen surfacing in responses and `--explain-context`
```task
id: CYA-WP-0006-T04
status: todo
priority: high
```
Improve how activated reflections appear in `handle_request()` and context explanation:
- Show count + truncated lesson text in `--explain-context` with provenance
- Normal responses include a concise "reflections influenced this" line when relevant
- Cap token/line budget to avoid wall-of-text
**Acceptance criteria:**
- Roundtrip test: stored reflection → recall → visible in explain output.
- Output remains readable for 0, 1, and 5+ reflections.
### T05 — Tests, observability, and safety regression coverage
```task
id: CYA-WP-0006-T05
status: todo
priority: high
```
Expand `tests/test_memory.py` and orchestrator tests for:
- New capture UX paths (prompt/skip/preview)
- Compaction opt-in behavior
- Surfacing in explain-context
- Safety invariant: reflections cannot downgrade destructive-command confirmation
Add basic observability in `export_memory` (reflection counts by scope).
**Acceptance criteria:**
- `make test` / `python3 -m pytest tests/ -q` passes cleanly.
- At least one test per new behavior path from T02T04.
### T06 — Documentation updates
```task
id: CYA-WP-0006-T06
status: todo
priority: medium
```
Update README.md (retrospect / Profile 1 section), MemoryVision.md status note, and
SCOPE.md if delivered scope changes materially.
**Acceptance criteria:**
- README documents the hardened Profile 1 flow with an example session.
- MemoryVision notes Profile 1 as "production" (not "spike") when T02T05 complete.
### T07 — Register, sync, and handoff
```task
id: CYA-WP-0006-T07
status: todo
priority: medium
```
Register workstream in State Hub via `make fix-consistency REPO=can-you-assist`,
log progress event, set workplan to `ready` after review or `active` when implementation
starts.
**Acceptance criteria:**
- `state_hub_workstream_id` and task ids written by fix-consistency.
- `.custodian-brief.md` regenerated with CYA-WP-0006 visible.
## Dependencies & Cross-Repo Coordination
- **phase-memory:** Optional future compaction planner hooks — not required for this slice.
See `docs/phase-memory-optimization-suggestions.md` for long-term asks.
- **llm-connect:** Not required (reflections are user-authored text in this slice).
## Debt & Future Work (Registered)
- Profile 2 synthesis spikes (user-triggered, dry-run first).
- Real `llm-connect` adapter implementation slice.
- CI gate for `make test` + `make check-dist` (from CYA-WP-0004 debt).
- Profile selection UX (`cya memory profile ...`).
## Success Criteria
When complete:
- Profile 1 is demonstrably production-usable: capture, review, activation, and surfacing
are polished and tested.
- Safety and explainability invariants from Profile 0 remain intact.
- Users reading README + MemoryVision understand Profile 1 as shipped capability, not a spike.
---
**Status note:** Created `proposed` on 2026-06-19 after CYA-WP-0005 completion and gap
analysis recommendations. Activate to `ready` after operator review; move to `active` when
implementation begins (ralph-workplan or direct session).