Add phase-memory bridge, warden memory CLI, route/access/sign recording, memory-aware worker planning with OpenRouter skip, tests, wiki, and AGENTS.md orientation for Claude, Codex, Grok, and future agent sessions.
9.5 KiB
id, type, title, domain, repo, status, owner, topic_slug, planning_priority, planning_order, created, updated, state_hub_workstream_id
| id | type | title | domain | repo | status | owner | topic_slug | planning_priority | planning_order | created | updated | state_hub_workstream_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WARDEN-WP-0024 | workplan | Experiential Memory Across Worker, Agent Sessions, And OpenRouter | infotech | ops-warden | finished | codex | custodian | high | 24 | 2026-07-02 | 2026-07-02 | 5d9fafb3-f9b6-43bf-b259-5f5301daa2e9 |
WARDEN-WP-0024 — Experiential memory across worker, agent sessions, and OpenRouter
Problem
warden worker (WARDEN-WP-0020) plans each inbox message in isolation. Coding
agent sessions (Claude Code, Codex, Grok, and future agents) invoke warden route and warden access without continuity — every session rediscovers routing
from scratch. OpenRouter inference via llm-connect is invoked even when a
stabilized routing pattern already exists.
ops-warden needs experiential memory that is present in every runtime:
| Surface | Today | Target |
|---|---|---|
warden worker + OpenRouter |
Stateless per message | Retrieve past outcomes before plan; record after execute |
| Coding agent session | Cold warden route find |
Activate relevant memory at session start and after each warden call |
| Operator CLI | No learning loop | Same store; optional --memory context on advisory commands |
Goal
Integrate phase-memory as ops-warden's shared experiential substrate so routing, coordination, and inference improve from recorded outcomes — without ever storing secret values or widening the guardrail allowlist.
Non-Goals
- Hold or vend secrets (conduit-not-broker unchanged).
- Auto-commit routing catalog diffs (human review remains required).
- Own phase-memory schemas (PMEM-WP-0016 owns the profile and contract).
- Replace llm-connect or embed OpenRouter keys in ops-warden.
Guardrails (unchanged — memory is untrusted context)
- Retrieved memory is context, not instructions — fixed charter wins.
- Guardrail allowlist enforced on every action regardless of memory content.
- No secret values in memory writes, activation packs, or llm-connect prompts.
propose_catalog_diffstays human-reviewed even when memory is confident.
Architecture
sequenceDiagram
participant Agent as Coding agent<br/>(claude/codex/grok)
participant Warden as ops-warden CLI
participant Memory as phase-memory store
participant LLM as llm-connect / OpenRouter
participant Hub as State Hub
Note over Agent,Hub: Agent session path
Agent->>Warden: warden route find "..."
Warden->>Memory: activate(session_kind=warden.agent.grok)
Memory-->>Warden: bounded routing context
Warden-->>Agent: route answer + memory digest
Warden->>Memory: record episode (metadata only)
Note over Warden,Hub: Worker tick path
Warden->>Hub: unread messages
Warden->>Memory: activate(session_kind=warden.worker)
Memory-->>Warden: stabilized + fluid context
alt stabilized match
Warden->>Warden: RuleBrain (skip LLM)
else ambiguous
Warden->>LLM: LlmConnectBrain + activated context
LLM-->>Warden: action plan
end
Warden->>Warden: guardrail pass
Warden->>Hub: execute / escalate
Warden->>Memory: record outcome
T01 - Canonical memory store and discovery
id: WARDEN-WP-0024-T01
status: done
priority: high
state_hub_task_id: "6305f1bc-c016-4298-adc2-a07d52b6aca5"
Establish the canonical phase-memory store path and discovery commands.
Acceptance:
- Default store at XDG location (e.g.
~/.local/share/warden/memory/) with override viaWARDEN_MEMORY_STORE. warden memory statusreports store path, schema version, episode counts bysession_kind, and last activation timestamp — no secret fields.- Store initializes idempotently; missing phase-memory dependency fails with a clear install pointer, not a traceback.
- Tests cover default path, override, and first-run initialization.
T02 - Session recording hooks in CLI commands
id: WARDEN-WP-0024-T02
status: done
priority: high
state_hub_task_id: "242a4d9a-5375-4df8-8d43-063b0491d202"
Record metadata-only episodes when route, access, and sign complete.
Acceptance:
- Each command writes a phase-memory event with
session_kindderived from environment:WARDEN_AGENT_ID(claude|codex|grok|...) when set, elsewarden.operator. - Recorded fields match
PMEM-WP-0016-T03schema; secret patterns are rejected. - Recording is opt-out via
WARDEN_MEMORY=0for air-gapped/debug use. warden activityand phase-memory audit export remain consistent (no duplicate secret-bearing logs).
T03 - Memory-aware worker tick
id: WARDEN-WP-0024-T03
status: done
priority: high
state_hub_task_id: "176fcae1-e4e5-481f-9a83-e9a7000fac1a"
Retrieve coordination memory before Brain.plan and record outcomes after execute.
Acceptance:
warden worker runactivates memory withsession_kind=warden.workerbefore planning each message.- Activated context is passed to
LlmConnectBrainas bounded, redacted context — never replacing the fixed charter. - Post-execute hook records: message id, proposed actions, guardrail outcome, escalation reason, and route ids referenced.
- Worker tick with empty store degrades gracefully (current behavior).
T04 - Agent session activation helper
id: WARDEN-WP-0024-T04
status: done
priority: high
state_hub_task_id: "16501557-6cde-44ea-bc6f-1726cb7ec070"
Expose memory activation for coding agent sessions across Claude, Codex, Grok, and future agents.
Acceptance:
warden memory activate [--agent <id>] [--json]returns a bounded activation package for session orientation.- Agent instructions (AGENTS.md template in consuming repos) document setting
WARDEN_AGENT_IDand callingwarden memory activateat session start. - Activation works without OpenRouter (local retrieval only).
- Tests cover agent ids:
claude,codex,grok, and an unknown future id.
T05 - Cross-runtime continuity
id: WARDEN-WP-0024-T05
status: done
priority: high
state_hub_task_id: "55ae679c-c08f-4afd-8646-9f5f3019f86e"
Ensure worker ticks see agent session episodes and vice versa.
Acceptance:
- Agent session routing outcomes appear in worker activation within the same store without manual export/import.
- Worker escalation outcomes are visible to subsequent agent session activations.
- Continuity is verified by an integration test: agent session write → worker read → agent session read round-trip.
- Episode retention follows the ops-warden profile compaction rules from PMEM-WP-0016.
T06 - OpenRouter efficiency layer
id: WARDEN-WP-0024-T06
status: done
priority: medium
state_hub_task_id: "fc2dffcf-7184-4f3d-8653-d26dc18a9afc"
Skip or downgrade OpenRouter calls when stabilized memory provides a verified match.
Acceptance:
- When stabilized memory contains a verified route match for the message need,
RuleBrainhandles the plan and llm-connect is not called. - Ambiguous cases still use
LlmConnectBrain; memory context is additive only. - Efficiency metrics (llm_calls_avoided, rule_brain_resolution_rate) are recorded for evaluation scenarios in PMEM-WP-0016.
- Dry-run mode reports whether LLM would have been skipped and why.
T07 - Operator and agent documentation
id: WARDEN-WP-0024-T07
status: done
priority: medium
state_hub_task_id: "ca2aaf23-833f-49a6-a49b-a0b659208f5f"
Document the memory workflow for operators and coding agents.
Acceptance:
- Wiki page covers: store location, session kinds, agent env vars, memory activation at session start, and interaction with OpenRouter inference.
- ops-warden AGENTS.md and the state-hub agent template include memory orientation steps for Claude, Codex, and Grok sessions.
- Credential routing doc cross-links PMEM-WP-0016 contract; anti-patterns updated (no secret values in memory store).
- Scheduled worker playbook notes memory retention and evaluation gate checks.
Acceptance Criteria
- phase-memory is present and useful in all three runtime surfaces (worker, agent session, operator CLI) through one canonical store.
- OpenRouter inference cost decreases when stabilized routing memory matches.
- Cross-runtime continuity is tested and regression-gated.
- Security invariants (no-secret, allowlist, conduit-not-broker) are unchanged.
Dependencies
PMEM-WP-0016(phase-memory) — profile, event schema, activation pack, evaluation scenarios. Implement contract (T01–T03) before WARDEN T03–T05.WARDEN-WP-0020— worker brain and guardrails (finished).WARDEN-WP-0022— audit trail for correlation (finished).- llm-connect / OpenRouter — required only for T06 live efficiency measurement; T01–T05 work offline.
Suggested Implementation Order
- PMEM-WP-0016 T01–T03 (profile + contract + event schema)
- WARDEN-WP-0024 T01–T02 (store + CLI recording)
- PMEM-WP-0016 T04 (activation pack)
- WARDEN-WP-0024 T03–T05 (worker + agent activation + continuity)
- PMEM-WP-0016 T05–T06 + WARDEN-WP-0024 T06–T07 (evaluation + docs)
Closure Review
Integrated phase-memory across all ops-warden runtime surfaces:
warden memory statusandwarden memory activatewith canonical XDG store.- CLI recording hooks on
route find,access, andsign(opt-out viaWARDEN_MEMORY=0). - Memory-aware worker planning with stabilized-route RuleBrain short-circuit and LlmConnectBrain context injection.
- Cross-runtime continuity verified in tests (agent session → worker activation).
wiki/OpsWardenMemory.mdand AGENTS.md session orientation for Claude, Codex, Grok, and future agents.