Overview
Codaph uses a dual-store architecture that balances local performance with cloud collaboration:Local JSONL Mirror
Fast, deterministic timeline rendering from append-only local storage
Mubit Cloud Memory
Shared collaborative backend for cross-contributor context and semantic query
Design Goals
Capture without disruption
Record coding-agent activity without changing your normal agent workflows
Components
Adapters
Adapters capture events from different agent sources:Codex SDK Adapter
Codex SDK Adapter
Location:
src/lib/adapter-codex-sdk.tsCaptures live events from Codex SDK streamed runs. Subscribes to the Codex event stream and transforms events into Codaph’s canonical format.Codex Exec Adapter
Codex Exec Adapter
Location:
src/lib/adapter-codex-exec.tsParses JSON output from codex exec --json. Spawns the codex process and parses JSONL output line-by-line.History Sync Adapters
History Sync Adapters
Locations:
src/codex-history-sync.ts- Codex~/.codex/sessionssrc/claude-history-sync.ts- Claude Code transcriptssrc/gemini-history-sync.ts- Gemini CLI transcripts
Ingestion Pipeline
Location:src/lib/ingest-pipeline.ts
The IngestPipeline normalizes events, redacts sensitive data, and orchestrates dual writes:
Canonicalization
Creates canonical events with
createCapturedEvent() - adds eventId, actorId, timestampsStorage Layer
Local JSONL Mirror
Location:src/lib/mirror-jsonl.ts
The JsonlMirror maintains an append-only event store under .codaph/:
- Manifest: Tracks all segments with checksums
- Sparse index: Maps sessions to segments for fast lookup
- Event ID index: Enables deduplication checks
Mubit Cloud Memory
Location:src/lib/memory-mubit.ts
The MubitMemoryEngine writes canonical events to Mubit control APIs:
- Supports project-scoped and session-scoped run IDs
- Appends
codaph_eventactivity for remote replay - Provides semantic query over evidence
Query and Visualization
Query Service
Location:src/lib/query-service.ts
Reads the local mirror and returns:
- Sessions list with metadata
- Timeline events with filters
- Diff summaries
- Contributor lists
CLI and TUI
Location:src/index.ts
Exposes:
- CLI commands for setup, sync, status, inspection
- Interactive TUI for browsing sessions and timelines
- Local sync and remote Mubit sync workflows
Data Flow
Event Types
Fromsrc/lib/core-types.ts:
Each event source maintains its own sequence numbering and event ID generation to ensure deterministic deduplication.
Circuit Breaker
The ingest pipeline includes a fail-open circuit breaker for Mubit writes:- Tracks consecutive Mubit write errors
- Opens circuit after 3 consecutive failures (configurable)
- Local mirror writes continue even when circuit is open
- Allows
codaph repair cloudto backfill missed events
Performance Tuning
For bulk sync operations (e.g.,codaph push):
See Also
Data Model
Event envelope structure and types
Sync Automation
Git hooks and sync triggers
Identity Resolution
Project and actor ID resolution
API Reference
TypeScript APIs and types