CYA-WP-0005 T05 done (ralph iter 5): Minimal Profile 1 (Reflexion verbal) spike

- Added KIND_REFLECTION + remember_reflection() helper in memory (thin, exported).
- Wired into run_retrospection(): optional 'capture verbal lesson' step at end.
- Main recall now includes reflections for preferential activation.
- Final LLM response + explain surface verbal reflections when activated.
- Added roundtrip test + import updates.
- Small README note.
- All changes small/inspectable, safety preserved (still through RiskClassifier).
- T05 acceptance criteria met with working end-to-end spike.

Committed as ralph iter 5. Ready for T06+ or close.
This commit is contained in:
2026-05-28 03:24:44 +02:00
parent 16fde868cf
commit a87cd4ab42
5 changed files with 72 additions and 3 deletions

View File

@@ -21,8 +21,10 @@ from cya.memory import (
forget,
export_memory,
remember_retrospection_outcome,
remember_reflection,
KIND_RETROSPECTION,
KIND_INTERACTION_GOAL,
KIND_REFLECTION,
)
from cya.safety.risk import classify, RiskLevel
@@ -167,6 +169,23 @@ def test_recall_with_kinds_and_activation_context(isolated_memory):
assert KIND_INTERACTION_GOAL in kinds or "retrospection" in kinds
def test_profile_1_reflection_helper_and_activation(isolated_memory):
"""Minimal T05 Profile 1 spike: remember_reflection + preferential recall by kind."""
remember_reflection("lesson_rust", "Always run cargo clippy before suggesting fixes", scope="proj-rust")
data = recall_preferences(
scope="proj-rust",
kinds=[KIND_REFLECTION],
activation_context={"cwd": "proj-rust"},
)
assert len(data.get("items", [])) >= 1
kinds = [i.get("kind") for i in data.get("items", [])]
assert KIND_REFLECTION in kinds
# The helper stored it correctly
assert any("cargo clippy" in str(i.get("value", "")) for i in data.get("items", []))
# ---------------------------------------------------------------------------
# CYA-WP-0005 T02 — Explicit Profile 0 baseline assertions
# ---------------------------------------------------------------------------