Files
phase-memory/docs/ops-warden-memory-contract.md
tegwick dc699be976 Implement PMEM-WP-0016 ops-warden cross-runtime memory contracts.
Add ops-warden coordination profile, session event schemas, activation helpers,
adapter pack, evaluation scenarios, and contract documentation for shared memory
across worker, agent session, and operator CLI surfaces.
2026-07-02 23:40:45 +02:00

2.1 KiB

Ops-Warden Cross-Runtime Memory Contract

Updated: 2026-07-02

Purpose

phase-memory provides a shared experiential substrate for ops-warden across:

  • warden worker ticks with llm-connect / OpenRouter inference
  • Coding agent sessions (Claude Code, Codex, Grok, future agents)
  • Direct operator CLI use

All runtimes use one canonical store and the same redaction rules.

Canonical Store

Setting Default
Path ~/.local/share/warden/memory/
Override WARDEN_MEMORY_STORE
Opt-out WARDEN_MEMORY=0

Layout:

  • metadata.json — store schema and profile id
  • events.jsonl — append-only session episodes

Session Kinds

Runtime session_kind Selection
Worker warden.worker WARDEN_SESSION_KIND=warden.worker during worker ticks
Operator CLI warden.operator default when WARDEN_AGENT_ID is unset
Agent session warden.agent.<id> `WARDEN_AGENT_ID=claude

Event Schema

Schema: phase_memory.ops_warden.session_event.v1

Required metadata fields:

  • session_kind, command, outcome (resolved|escalated|skipped)
  • need_fingerprint (digest only — never the raw need text when sensitive)
  • route_id, agent_id, session_id, diagnostic_codes

Rejected writes containing token-like values or raw URLs.

Activation

activate_ops_warden_memory returns:

  • stabilized route matches (verified repeats)
  • recent episodes filtered by session kind / need fingerprint
  • llm_calls_avoided when stabilized memory covers the need

Rigid memory (charter, allowlist) is import-only and never promoted from episodes.

Agent Session Orientation

Coding agents should:

  1. Set WARDEN_AGENT_ID to their runtime id.
  2. Run warden memory activate --json at session start.
  3. Use normal warden route / warden access commands; episodes are recorded automatically when memory is enabled.

Evaluation

Ops-warden memory quality is measured by:

  • routing_repeat_accuracy
  • cross_runtime_continuity
  • llm_calls_avoided_count

Use evaluation_trend_regression_gate when promoting worker or routing changes.