Files
can-you-assist/workplans/CYA-WP-0005-agentic-memory-profiles-and-phase-memory-feedback.md
tegwick 19e80cc9bc CYA-WP-0005 T02 done (ralph iter 2): Formalize Profile 0 baseline everywhere
- MemoryVision.md: Large new 'Profile 0 Baseline (Post-0003 / Current Shipped)' section with exact ports, activation logic, retrospection, safety invariants, usage sites, and relationship to 1–3 (plus the prior research section from T01).
- src/cya/memory/__init__.py: Updated module docstring to declare Profile 0 reality + references to MemoryVision + CYA-WP-0005.
- src/cya/orchestrator.py: Updated docstring with Profile 0 memory wiring note.
- SCOPE.md: Named Profile 0 explicitly in delivered slices and core capabilities.
- tests/test_memory.py: Added two new explicit 'Profile 0' tests + comments asserting provenance markers, kinds, activation_context support (T02 acceptance).
- README.md + AGENTS.md: Added Profile 0 mentions + links to the workplan.

All T02 acceptance criteria met. Ralph loop active. Next: T03 (full Profiles 1–3 definitions + matrix).
2026-05-27 20:01:51 +02:00

19 KiB
Raw Blame History

id, type, title, domain, repo, status, owner, topic_slug, created, updated, state_hub_workstream_id
id type title domain repo status owner topic_slug created updated state_hub_workstream_id
CYA-WP-0005 workplan Agentic Memory Profiles (03) and phase-memory Interface Optimization capabilities can-you-assist active grok foerster-capabilities 2026-05-28 2026-05-28 42ca48cb-f941-4b6a-9e8b-ad9fe534d1fd

CYA-WP-0005: Agentic Memory Profiles (03) and phase-memory Interface Optimization

Goal

Establish the current memory handling (post-CYA-WP-0003 real JSON + contextual activation + retrospection outcomes + kinds + activation_context ports) as explicit Profile 0 baseline, then define and plan Profiles 13 that progressively add agentic self-improving loop capabilities:

  • Profile 1 (Reflexion-style verbal): Leverage and extend the existing cya retrospect + KIND_RETROSPECTION machinery to store and preferentially activate verbal self-reflections / lessons.
  • Profile 2 (Generative-Agents-style hierarchical synthesis): Episodic capture → periodic LLM synthesis of higher-order abstractions (conventions, patterns, strategies) stored with phase hints and citations.
  • Profile 3 (Procedural / meta-policy evolution): First-class evolvable "how I behave" rules and procedures, with meta-reflection proposing changes under strong user audit and safety guardrails.

As a first-class deliverable, produce concrete, actionable optimization suggestions and missing functionality feedback for the phase-memory sister repo (markitect domain) so that the profile model and self-improving loops can be realized with clean boundaries, dry-run safety, and excellent explainability.

All work preserves cya's non-negotiable invariants: user-controlled & inspectable memory, full provenance/explainability (via --explain-context and export), rule-based safety (memory signals may only increase caution; never downgrade risk or bypass confirmation), and the explicit cya/phase-memory seam (cya is consumer; phase-memory owns storage, lifecycle planners, and profile execution).

Background & References

  • Research foundation: history/2026-05-28-CYA-Agentic-Memory-Research-Variations.md (persisted 2026-05-28) — deep synthesis of Reflexion (Shinn 2023), Generative Agents (Park 2023), procedural/meta-policy patterns (LangMem, A-Mem, LEGOMem, MemGPT), cross-cutting architectures, and direct mappings to cya + phase-memory.
  • Current baseline (Profile 0): Post-0003 implementation in src/cya/memory/__init__.py (real persisting JSON with kinds, activation_context, remember_retrospection_outcome, by_kind export, provenance), wired in orchestrator.py, cli/, and risk classifier. See also docs/cya-memory-activation-and-retrospection-concept.md (0003 T01) and MemoryVision.md integration contract.
  • Gap context: history/2026-05-28-CYA-Intent-Scope-Gap-Analysis-Post-0004.md shows memory & longitudinal adaptation moved from "large" to "small-medium" thanks to 0003; deeper agentic/self-improving behavior and full phase-memory integration remain the next frontier.
  • Vision alignment: MemoryVision.md (profile-driven behavior, phases, primary kinds, safety/explainability requirements, refined port signatures from 0002 T01 contract), INTENT.md ("Personalized Console Helper" that improves over time via user-steerable memory), SCOPE.md (post-0004 delivered: contextual activation + cya retrospect continuous optimization loop).
  • Prior workplans: 0002 (memory ports + real JSON), 0003 (activation + retrospection loops), 0004 (packaging — retired). 0001 (MVP foundation).
  • Sister repo: phase-memory (profile execution, phases: ephemeral/fluid/stabilized/rigid, planners for lifecycle/activation/compaction/synthesis, MemoryGraphStore/EventLog/PolicyGateway ports, Markitect interop). cya must provide clear, prioritized feedback on what it needs from that layer.

This workplan turns the research into an executable, reviewable plan while keeping the first slice deliberately scoped (baseline + definitions + high-quality feedback artifact + minimal Profile 1 skeleton if capacity allows).

Non-Goals (for this workplan)

  • Full implementation of Profiles 2 and 3 (spikes / design only; implementation may be later slices or owned by phase-memory).
  • Automatic / background synthesis or meta-reflection without explicit user trigger or dry-run review.
  • Changes to the rule-based RiskClassifier safety core (memory influence remains strictly additive for caution).
  • Deep embedding / semantic index work (phase-memory concern).
  • PyPI release or CI automation (already registered as debt in 0004).
  • Activation of this workplan or ralph-loop execution (create proposed, register, sync; activation is a later operator decision).

Task Breakdown

T01 — Persist research and establish shared vocabulary

id: CYA-WP-0005-T01
status: done
priority: high
state_hub_task_id: "69f8a82d-4e3d-4590-bdf9-d59a5fff00c6"
started: "2026-05-28 ralph iter 1"
completed: "2026-05-28 ralph iter 1"

Description: Ensure the deep agentic memory research is first-class and referenceable. Create (or confirm) the persisted research document and add a short "Agentic Memory Research" section to MemoryVision.md that introduces the three profile directions with links.

Acceptance criteria:

  • history/2026-05-28-CYA-Agentic-Memory-Research-Variations.md exists, is complete, and contains the three variations, cya mappings, Profile 0 baseline description, and phase-memory suggestions (already produced in pre-workplan step).
  • MemoryVision.md gains a clear "Research Foundation & Profile Directions (2026-05)" section (or equivalent) that references the history doc and the three variations.
  • No duplication of long research text in MemoryVision — it points to the history artifact.

Deliverables: Updated MemoryVision.md (small additive section), confirmation that research doc is committed.

T02 — Formalize Profile 0 as the explicit shipped baseline

id: CYA-WP-0005-T02
status: done
priority: high
state_hub_task_id: "669c0d9e-f2ba-4655-a0b9-c104f5545859"
started: "2026-05-28 ralph iter 2"
completed: "2026-05-28 ralph iter 2"

Description: Treat the current post-0003 memory implementation (local JSON, kinds, activation_context, retrospection helper, provenance, safety integration, cya retrospect) as Profile 0. Document it clearly so Profiles 13 have a stable "from here" point. Update all relevant docs and code headers.

Acceptance criteria:

  • MemoryVision.md contains a new "Profile 0 Baseline (Post-0003)" section that exactly describes the current ports, backing store, activation logic, retrospection flow, safety invariants, and explainability surface (pull from research doc + src/cya/memory + orchestrator).
  • SCOPE.md "Current Delivered Scope" and "Integrates With" sections are updated to name "Profile 0 (contextual activation + retrospection loop on local JSON)" as delivered capability.
  • src/cya/memory/__init__.py and orchestrator.py gain short header comments: "Profile 0 implementation — see CYA-WP-0005 and MemoryVision for evolution to 13."
  • Tests (test_memory.py) explicitly assert Profile 0 behaviors (kinds, activation_context boost, retrospection roundtrip, by_kind export, provenance in results).
  • README and AGENTS.md mention "Current memory profile: 0 (real contextual + retrospection; Profiles 13 planned)" with link to the workplan.

Deliverables: Updated MemoryVision, SCOPE, source headers, tests, README/AGENTS. Clear, testable definition of Profile 0.

T03 — Define Profiles 13 with cya-specific integration plans

id: CYA-WP-0005-T03
status: todo
priority: high
state_hub_task_id: "6f292b8b-b17d-4495-99b3-db031f6fb339"

Description: Turn the research synthesis into concrete profile definitions, each with: intent, core loop, mapping to existing cya ports/kinds/orchestrator/retrospect/risk, delta required, phase-memory dependencies, safety/explainability notes, and acceptance criteria sketch. Include a simple profile selection / capability matrix.

Acceptance criteria:

  • MemoryVision.md (or a new docs/memory-profiles.md) contains crisp definitions for Profiles 1 (Reflexion verbal self-improvement), 2 (hierarchical synthesis), 3 (procedural/meta-policy), each with the elements above and direct references to the 2026-05-28 research doc.
  • Workplan itself contains the same definitions in an appendix or "Profile Definitions" section for standalone readability.
  • A one-page "Profile Capability Matrix" (table) shows for each profile: primary new kinds, activation enhancements, synthesis needs, procedural support, user control surface, safety impact, estimated implementation cost for cya vs phase-memory.
  • No implementation code yet (except minimal scaffolding if it falls out of T04); definitions and docs only for this task.

Deliverables: Rich profile definitions in MemoryVision + workplan, capability matrix, clear handoff points for phase-memory.

T04 — Produce Optimization Suggestions & Missing Functionality feedback for phase-memory

id: CYA-WP-0005-T04
status: todo
priority: high
state_hub_task_id: "d5bc201c-ba10-4031-87fd-fe8207cdee8f"

Description: Extract, polish, and package the "Optimization Suggestions & Missing Functionality for phase-memory" content (already drafted in the research doc) into a clean, reviewable, sister-repo-targeted deliverable. This is one of the primary outputs of the workplan.

Acceptance criteria:

  • A focused artifact exists: docs/phase-memory-optimization-suggestions.md (or history/2026-05-28-CYA-phase-memory-Feedback.md) containing prioritized, actionable items in the 9 categories from the research (refined ports, synthesis/planner hooks, procedural support, activation/retrieval, lifecycle/phase, explainability/audit, safety/policy integration, observability, retrospection interop).
  • Each item states: what cya needs, why (which profile or invariant it enables), suggested interface shape or behavior, and priority (must-have for Profile 1, nice for 2, required for 3).
  • The document is written for phase-memory / markitect owners (clear, non-cya-centric language where possible, references the MemoryVision contract).
  • Workplan and MemoryVision reference the feedback doc as the official coordination artifact.
  • (Optional but recommended) A short summary table or "Top 5 asks" is included for quick reading in State Hub messages or cross-repo sync.

Deliverables: Standalone, high-quality feedback document ready for handoff to the phase-memory team. This directly fulfills the user request "For interface optimization and missing functionality in phase-memory provide optimization suggestions to the sister repo."

id: CYA-WP-0005-T05
status: todo
priority: medium
state_hub_task_id: "4b59d4f4-d067-470b-b6c3-30c64cbc1010"

Description: If time and review allow, implement a thin but real end-to-end slice of Profile 1 on top of Profile 0: new kind="reflection" support (or reuse retrospection), enhancement to cya retrospect (or new cya reflect) to capture verbal lessons, preferential activation for reflection kinds, rendering in --explain-context and final output, tests, and docs. All changes must be small, inspectable, and preserve safety invariants.

Acceptance criteria (if executed):

  • remember_reflection or extended remember_retrospection_outcome path works and stores with the new kind.
  • recall_preferences(..., kinds=["reflection", ...]) + activation_context returns them preferentially.
  • cya retrospect (or a new subcommand) offers a "capture lesson / reflection" step whose output is stored and later activated.
  • --explain-context and normal responses surface "X verbal reflections influenced this" with the actual text when relevant.
  • All new memory still flows through RiskClassifier (can only add caution).
  • Full roundtrip tests + README example.
  • If the spike grows beyond a small delta, it is carved into its own follow-on workplan and this task is marked partial + blocked.

Deliverables: Working (if minimal) Profile 1 behavior that users can exercise today, or a clear "spike complete, production slice needs X" note.

T06 — Update tests, observability, and safety surface for profile evolution

id: CYA-WP-0005-T06
status: todo
priority: medium
state_hub_task_id: "9e9566c5-ce76-4e73-b789-f07eb5fd54fb"

Description: Ensure the test suite and explainability mechanisms treat profiles as first-class and that safety invariants are explicitly asserted for any memory that could influence future profiles.

Acceptance criteria:

  • tests/test_memory.py (and any new profile tests) cover: profile param passthrough, kind filtering/boosting, activation_context with profile, export by_kind including new reflection/procedural kinds, provenance on all recall/export results.
  • Risk classifier tests (or new integration) assert that memory records with high-risk keywords or from procedural kinds still force confirmation and never downgrade risk level.
  • --explain-context output (or the ContextEnvelope) includes profile id and a "memory profile influence" section when non-default.
  • No new auto-execution or hidden memory paths introduced.

Deliverables: Green tests that will continue to pass as Profiles 13 are added; explicit safety assertions for the profile machinery.

T07 — Documentation, examples, and user-facing story

id: CYA-WP-0005-T07
status: todo
priority: medium
state_hub_task_id: "4c42b6f8-955e-442e-ae31-83d794bda304"

Description: Make the new profile model discoverable and usable for the primary operator and future contributors.

Acceptance criteria:

  • README "Memory" or "Advanced" section describes Profile 0 today + the roadmap to 13 with links to the workplan and research doc.
  • AGENTS.md updated with the new workplan reference and any new dev commands (e.g. running retrospect with synthesis).
  • At least one concrete example in docs/ or README showing a user exercising Profile 0 (or 1 if T05 landed) and seeing the self-improvement loop in action.
  • MemoryVision.md "Success Criteria" or "Profile-Driven Behavior" section is refreshed to speak in profile terms.

Deliverables: Updated public docs so a new reader understands where memory is today and where it is headed.

T08 — Register, commit, sync with State Hub, and close the workplan slice

id: CYA-WP-0005-T08
status: todo
priority: high
state_hub_task_id: "fb7b17e5-a22e-465e-8f98-6d2bbdf0059d"

Description: Follow AGENTS.md exactly: commit all artifacts (research doc, workplan, suggestions doc, doc updates), create/register the workstream in State Hub for the topic, seed state_hub_workstream_id (and task ids if returned) into the Markdown frontmatter and task blocks, run make fix-consistency REPO=can-you-assist until it reports ✓ PASS (self-execute per prior "do that yourself" authorization pattern), log a progress event, and mark the workplan frontmatter status: ready or proposed per operator preference (recommended: proposed until review).

Acceptance criteria:

  • Git commit(s) exist with clear messages referencing CYA-WP-0005 and the user request.
  • State Hub workstream exists for topic 64418556-3206-457a-ba29-6884b5b12cf3 with title matching the workplan; id is written into the .md.
  • make fix-consistency REPO=can-you-assist exits with RESULT: ✓ PASS (warnings on description drift or closed bootstrap items are acceptable and noted).
  • .custodian-brief.md is regenerated with the new workplan visible (or noted as ready/proposed).
  • A progress event is POSTed to State Hub with summary of the slice (research persisted + workplan created + feedback prepared for phase-memory).
  • Workplan frontmatter status is set appropriately (proposed or ready); no tasks are left in "in_progress" without justification.
  • Operator is reminded (in final output) to run the consistency make if the assistant did not self-execute it.

Deliverables: Fully registered, synced, committed workplan + artifacts; State Hub and brief reflect the new planning artifact; clean handoff for future activation or ralph-loop.

Dependencies & Cross-Repo Coordination

  • phase-memory (markitect): Primary consumer of the T04 feedback deliverable. The suggestions doc + MemoryVision contract (already shared) + this workplan should be the coordination package. State Hub messages or direct handoff recommended after T04/T08.
  • State Hub: Workstream + task tracking, progress events, decisions (if any profile policy choices arise). Use for cross-domain visibility (capabilities ↔ markitect).
  • No hard runtime dependency on llm-connect for this planning slice.

Debt & Future Work (Registered)

This workplan explicitly registers the following as first-class items for later slices or sister-repo ownership:

  • Full implementation of Profile 2 (hierarchical synthesis + compaction) and Profile 3 (procedural evolution + meta-reflection UX).
  • Profile selection / switching UX (cya memory profile ... or config file) and per-request profile hints.
  • Automatic (background or low-load) synthesis triggers vs purely user-triggered.
  • Rollback / versioning for procedural memory changes.
  • Integration of profile-driven memory evolution proposals into the rule-based risk surface (so a proposed rule change can be risk-assessed before user review).
  • Deeper phase-memory wiring: replace local JSON backing with real graph/event store while preserving the exact same port signatures and explainability surface.
  • PyPI / release of a version that includes Profile 1 (or higher) — builds on 0004 debt.
  • Long-term: cya participation in phase-memory planner dry-runs for activation and compaction budgets.

These will be tracked via State Hub (this workplan's tasks + future ADRs or child workplans).

Success Criteria (for the workplan as a whole)

When complete:

  • Anyone (operator, future contributor, phase-memory owner) can read the research doc + this workplan + MemoryVision and understand exactly what "memory profile 0" is today and what 13 will add.
  • A high-quality, actionable feedback package exists for the phase-memory sister repo that directly enables the three self-improving variations.
  • The seam (ports, kinds, activation_context, provenance) is proven stable enough to support profile evolution without breaking changes.
  • All changes are small, inspectable, tested, safe, and committed + synced per AGENTS protocol.

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.

References (non-exhaustive):

  • Research: history/2026-05-28-CYA-Agentic-Memory-Research-Variations.md
  • Memory contract: MemoryVision.md (esp. 0002 T01 integration contract)
  • Activation/retrospection concept: docs/cya-memory-activation-and-retrospection-concept.md
  • Post-0004 assessment: history/2026-05-28-CYA-Intent-Scope-Gap-Analysis-Post-0004.md
  • Prior workplans: 0002, 0003 (memory foundation), 0004 (packaging)
  • External: Shinn Reflexion (2023), Park Generative Agents (2023), LangMem / A-Mem / MemGPT literature (see research doc for links)

This completes the planning artifact requested in the 2026-05-28 user query.