Overview
Thecodaph repair cloud command repairs missing or inconsistent cloud synchronization by replaying your local .codaph mirror to Mubit, then republishing shared session and diff artifacts.
This is a recovery tool for when cloud sync fails or events are missing from Mubit. Your local mirror is the source of truth.
When to Use Repair Cloud
- Cloud sync interrupted: Network issues or API errors prevented events from reaching Mubit
- Missing sessions: Sessions appear locally but not in collaborative context
- Artifact republish: Session summaries or diffs need to be regenerated in Mubit
- Mubit setup changed: Switched project IDs or run scopes and need to backfill
Basic Usage
.codaph mirror, replays all events to Mubit, and republishes session artifacts.
Workflow
1. Backfill Phase
The repair process reads your local JSONL mirror and replays events to Mubit:- Scans all sessions in
.codaph/sessions/ - Reads canonical event envelopes from JSONL files
- Writes events to Mubit with deduplication
- Handles concurrent write batching for performance
2. Artifact Republish Phase
After backfill completes, shared artifacts are regenerated:- Session summaries: Written to
codaph:<project>:session-summaryrun - Diff artifacts: Written to
codaph:<project>:diffrun - Prompt timeline: Written to
codaph:<project>:promptrun
Options
Working directory (defaults to current directory)
Repair only a specific session ID (filter)
Output summary in JSON format
Show detailed progress for each event
Examples
Repair All Sessions
Repair Single Session
JSON Output
Architecture Details
Event Source
Repair cloud reads from your local JSONL mirror (src/lib/mirror-jsonl.ts:74):
- Mirror maintains manifest, sparse indexes, and eventId deduplication
- Events stored as canonical
CapturedEventEnvelopewitheventId,source,repoId,actorId,sessionId,threadId,ts,eventType,payload - Source is append-only and deterministic
Mubit Write Pipeline
Events flow through the ingest pipeline (src/lib/ingest-pipeline.ts:14):
- Redaction: Sensitive data stripped via
redactUnknown()(src/lib/security.ts:26) - Deduplication: Based on
eventIdhash - Batching: Concurrent writes with configurable batch size and timeout
- Circuit breaker: Fail-open after consecutive errors (local mirror unaffected)
Mubit Run Scopes
Repair respects your configured run scope (src/lib/memory-mubit.ts:22):
- Project scope:
codaph:<projectId>— shared run across contributors/sessions - Session scope:
codaph:<projectId>:<sessionId>— separate run per session
codaph:<projectId>:promptcodaph:<projectId>:session-summarycodaph:<projectId>:diff
Troubleshooting
”Mubit is disabled”
Error:High Deduplication Count
Ifdedup count is high, events were already in Mubit. This is normal after successful sync.
Failed Events
Iffailed > 0, check:
- Network connectivity to Mubit API
- API key validity (
codaph doctor) - Mubit write timeout (default 15s):
--mubit-write-timeout-ms 30000
Related Commands
codaph push— Import local agent history to Codaph mirror + Mubitcodaph pull— Sync Mubit cloud timeline back to local mirrorcodaph doctor— Verify Mubit configuration and connectivity
Implementation
Source:src/index.ts:2547 (repairCloud function)
Key modules:
src/mubit-remote-sync.ts:284— syncMubitRemoteActivity (reverse: cloud → local)src/lib/memory-mubit.ts:143— MubitMemoryEngine.writeEventsrc/lib/mirror-jsonl.ts:74— JsonlMirror append/read operations