Agent Journal provides two vendor adapters that write compatible core events and portable traces.
Both capture modules require a Java 21 runtime because their SDK dependencies are published as Java 21 bytecode.
The Claude adapter consumes the Claude Agent SDK for Java, and the Gemini adapter consumes the gemini-cli-sdk published with Agent Client.
Claude Code
Add the adapter:
SessionLogParser converts an Iterator<ParsedMessage> from the Claude Code SDK into a PhaseCapture.
The six-argument overload also writes a portable trace and controls modeled and raw content independently:
Here, response is an Iterator<ParsedMessage> returned by the SDK and promptText is the exact prompt or null.
Record the capture into a durable journal with RunRecorder:
The recorder writes execution events to events.jsonl and per-step cost attribution to analysis.jsonl.
It fails at finish when it produced derived events but the configured backend does not persist them durably.
Call lenient() only when losing the derived stream after process exit is intentional.
Gemini CLI
Add the adapter:
GeminiSessionParser converts the Gemini SDK’s synchronous QueryResult into a GeminiPhaseCapture:
Here, result is a QueryResult and run is an open Agent Journal Run.
Configure JsonFileStorage if the derived StepCostEvent must survive process exit.
Gemini’s typed SDK exposes result-level text, usage, cost, duration, model, and status, but it does not expose per-tool calls.
The adapter therefore records one turn-level step and does not invent tool detail.
It has no TraceRawMode because the typed Gemini message does not retain a verbatim wire envelope.
Portable trace modes
TraceContentMode controls content bodies on modeled trace lines:
TraceRawMode is Claude-only and orthogonal:
All trace modes require a data-handling decision.
The capture record and journal events can contain the caller-supplied prompt text.
Tool inputs are present on portable tool_use lines even in LENGTHS mode.
TRUNCATED and FULL portable traces can include assistant text, file contents, tool results, and command output.
TraceRawMode.FULL adds the complete available vendor message and can include fields omitted from the typed model.
Treat trace and journal files as sensitive, restrict filesystem access, and keep them out of version control.
Two schemas
Do not conflate the two JSONL formats:
- Canonical journal streams use
@type and currently have schema version 1.
- Portable capture traces use
type, ts, and seq and currently have schema version 2.
Both formats have their own header and evolution contract.