Summary
Add a safe, opt-in "harness WAL" path for the Claude Code and Codex plugins that normalizes supported hook/transcript events into Basic Memory producer envelopes and writes useful agent-memory artifacts.
Design note: memory://basic-memory-7020de4e925843c68c9056c60d101d9e/basic-memory-llc/product/ideas/harness-wal-capture-river-ingestion
Why
Claude Code and Codex sessions generate a stream of useful work context: prompts, tool calls, file changes, tests, blockers, decisions, handoffs, and compaction points. Today we capture some high-signal checkpoints, but the broader session stream still mostly evaporates.
The idea is to treat the harness output like an append-only event log:
Claude/Codex hook event
-> normalized producer envelope
-> durable inbox/raw event record
-> coalesced artifact writer
-> SessionNote / ToolLedger / RecallQuery / DecisionNote candidates
-> consolidation or memory_routine follow-up
This implements the producer side of SPEC-55 and feeds SPEC-61 memory routines without turning Basic Memory into an agent runtime.
Scope for v0
- Add a shared event/envelope helper for Claude Code and Codex plugins.
- Capture supported lifecycle hooks into a normalized envelope shape.
- Include source, session id, turn id when available, cwd, project hint, timestamp, hook name, and safe payload summary.
- Coalesce events into existing artifact types from SPEC-55, especially
SessionNote and ToolLedger.
- Keep hooks fast; expensive summarization and consolidation should happen out of band.
- Add idempotency keys so repeated hooks do not duplicate notes.
- Add opt-in configuration and clear redaction controls.
- Emit provenance observations such as
[source] codex/<session_id> or [source] claude-code/<session_id>.
Possible normalized event types
session_started
user_prompted
assistant_message
tool_called
tool_result
file_changed
test_ran
decision_observed
blocked
handoff_requested
compaction_imminent
session_ended
V0 should only capture events exposed through supported harness hooks and visible transcript artifacts. It should not try to capture private model reasoning.
Privacy and safety constraints
- Capture must be opt-in or clearly tied to plugin installation/configuration.
- Do not capture hidden chain-of-thought or private model reasoning.
- Prefer summaries, metadata, and selected visible turns over raw transcript dumps.
- Redact obvious secrets before writing artifacts.
- Provide deny rules for paths, tools, environment-like values, and large payloads.
- Preserve source offsets or hook event ids so artifacts can be audited without storing everything forever.
- Fail fast on missing Basic Memory project mapping rather than writing to the wrong project.
Related specs
- SPEC-55: Agent Memory Pipeline (Producer Framework)
- SPEC-61: Event-Driven Memory Routines
- SPEC-56: Memory Consolidation (Dream Mode)
- SPEC-74: Semantic Diff for Basic Memory Notes
Open questions
- Should raw envelopes be stored locally in an inbox first, or should plugin hooks write directly through existing Basic Memory MCP/API calls for v0?
- Which hook events are available and stable enough across Claude Code and Codex today?
- Should Codex and Claude plugins share one helper package/script, or duplicate thin adapters with a shared envelope schema?
- What is the minimum useful artifact: session checkpoint, tool ledger, recall query, or all three?
- How should users configure redaction and excluded paths?
- Should the first version only run on
PreCompact and SessionEnd, or also capture PostToolUse events?
- Where should raw event retention live once the local daemon exists?
Summary
Add a safe, opt-in "harness WAL" path for the Claude Code and Codex plugins that normalizes supported hook/transcript events into Basic Memory producer envelopes and writes useful agent-memory artifacts.
Design note:
memory://basic-memory-7020de4e925843c68c9056c60d101d9e/basic-memory-llc/product/ideas/harness-wal-capture-river-ingestionWhy
Claude Code and Codex sessions generate a stream of useful work context: prompts, tool calls, file changes, tests, blockers, decisions, handoffs, and compaction points. Today we capture some high-signal checkpoints, but the broader session stream still mostly evaporates.
The idea is to treat the harness output like an append-only event log:
This implements the producer side of SPEC-55 and feeds SPEC-61 memory routines without turning Basic Memory into an agent runtime.
Scope for v0
SessionNoteandToolLedger.[source] codex/<session_id>or[source] claude-code/<session_id>.Possible normalized event types
session_starteduser_promptedassistant_messagetool_calledtool_resultfile_changedtest_randecision_observedblockedhandoff_requestedcompaction_imminentsession_endedV0 should only capture events exposed through supported harness hooks and visible transcript artifacts. It should not try to capture private model reasoning.
Privacy and safety constraints
Related specs
Open questions
PreCompactandSessionEnd, or also capturePostToolUseevents?