Code Generation & Transcripts
Relevant source files
The following files were used as context for generating this wiki page:
Code Generation & Transcripts manages the conversion of agent conversation logs into replayable hook events. This system allows the oboete memory engine to ingest historical data from coding agents like Claude Code and Codex. It extracts prompts, tool uses, and assistant replies from JSONL transcript files to populate the memory store.
The system also provides integration points for various coding agents through setup scripts and specialized plugins. These integrations ensure that new code generation sessions are captured in real-time or imported from existing transcripts for retrospective analysis.
Transcript Conversion Architecture
The transcript module parses agent-specific log formats into a standardized JSONL format used by oboete replay. The convert function serves as the entry point, identifying the agent type and initializing an Emitter to process the file.
Emitter Logic and Data Flow
The Emitter structure tracks the state of a session during parsing. It manages pending tool calls, turn-based assistant messages, and session metadata. It ensures that events are sorted by timestamp, even when processing sub-agents stored in separate files.
The diagram shows how agent-specific lines are routed through specialized parsers before reaching the Emitter state to produce standardized events.
Sources: src/transcript.rs:95-156, src/transcript.rs:511-544
Supported Agent Log Formats
| Agent | Source Format | Key Data Extracted |
|---|---|---|
| Claude Code | JSONL | User prompts, Tool results, Sub-agent turns, Compaction summaries |
| Codex | JSONL | Session meta, Turn context, Response items, Function calls |
Sources: src/transcript.rs:242-421
Hook Event Capture
Real-time capture transforms incoming agent payloads into standard events for the raw.db store. The system implements redaction rules and size limits during this process.
Capture Processing Flow
- Event Mapping: Payload fields are mapped to event types like
start,prompt,tool, orreply. - Redaction (Gate): Text passes through a
Gatewhereredact::scan_cappedmasks sensitive information. - Marker Replacement: Base64 runs and images become marker objects containing MIME types and SHA256 hashes.
- Labeling: Git metadata (branch, HEAD SHA) is read directly from filesystem files.
The sequence diagram represents the transformation of raw agent data into stored, redacted events.
Sources: src/capture.rs:93-180, src/capture.rs:232-262
Capture Constraints
- MAX_FIELD_BYTES: Stored strings are capped at 64 KB; only head and tail are kept for larger strings.
- HEAD_TAIL_BYTES: Tool outputs can be further restricted to 8 KB if configured.
- BASE64_THRESHOLD: Any run of 1,024 or more base64 characters is converted to a marker.
Sources: src/capture.rs:18-35, src/capture.rs:361-380
Agent Integrations & Setup
The setup module wires the oboete binary to various agent environments. It modifies configuration files and installs plugins to enable real-time memory access.
Integration Mechanism by Agent
- Claude/Codex/Grok: Setup modifies
settings.jsonorconfig.tomlto register command hooks for specific events. - Pi: Installs a TypeScript extension (
oboete.ts) that spawns theoboete hookprocess. - OpenCode: Installs a JavaScript plugin that communicates via standard I/O and registers an MCP server.
The graph illustrates how the setup command targets different integration points based on the agent type.
Sources: src/setup.rs:77-133, src/setup.rs:335-365, src/pi.ts:20-50
Extension Snippet (Pi Agent)
The Pi integration uses a spawn call to execute the binary for every hooked event:
const call = (event, cwd, payload) => new Promise((resolve) => {
const child = spawn(OBOETE_BIN, [...OBOETE_ARGS, "hook", "pi", event], {
cwd, stdio: ["pipe", "pipe", "ignore"],
});
// ... handling timeout and output ...
});
Sources: src/pi.ts:20-33
Command Reference
Users interact with code generation data and transcripts via the oboete CLI.
| Command | Description | Relevant Source |
|---|---|---|
hook <agent> <event> | Receives one agent hook event on stdin and stores it. | src/main.rs:56-62 |
transcript <path> --agent <name> | Converts a raw agent transcript into a replay fixture. | src/main.rs:159-166 |
setup <agent> | Wires the binary into an agent's hooks. | src/main.rs:115-119 |
replay <fixture> | Replays a standardized JSONL fixture through the hook path. | src/main.rs:179-195 |
Sources: src/main.rs:49-210
Summary
The Code Generation & Transcripts system provides the necessary bridge between diverse coding agents and the oboete memory engine. By standardizing historical transcripts and providing robust real-time hooks, it enables persistent memory across different development environments. This architecture ensures data integrity through redaction gates and deterministic sorting of session events.