Stop AI agents from double-posting after timeouts.
sidefx puts a durable SQLite WAL write-ahead journal, transparent stdio MCP proxy, CLI mutation wrapper, read-only crash reconciler, and ground-truth session receipts in front of external writes — with zero runtime dependencies.
uv tool install sidefx && sidefx initInstall globally with uv tool (or pip install sidefx), then run sidefx init inside your repo.
Timeouts and crashes cause duplicate writes
When gh issue create, git push, or an MCP tools/call loses its reply after landing, agents retry blindly. sidefx records pending in SQLite WAL first, blocks retries with OUTCOME UNKNOWN, and reconciles read-only.
Handoff summaries miss or hallucinate side effects
Wrap-ups written from compressed conversation context drop pushes or claim failed writes succeeded. sidefx report and Claude Code's Stop hook read .sidefx/journal.db strictly read-only to report what actually happened.
Configure once across MCP clients and shell commands
Switch between real configurations and outputs straight from the repository — zero wrapper lock-in, works with any stdio MCP server or shell command.
Wrap any stdio MCP server in Claude Code (.mcp.json or ~/.claude.json). Read-only calls pass straight through; mutating calls journal write-ahead in SQLite.
{
"mcpServers": {
"github": {
"command": "sidefx",
"args": [
"mcp-proxy",
"--target",
"mcp:github",
"--deterministic-ids",
"--timeout",
"30",
"--",
"docker",
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}Tip: If you have not installed sidefx globally, set "command": "uvx" and prepend "sidefx" to args.
Full docs on GitHubSix deterministic layers, zero third-party dependencies
Pure Python 3.11+ standard library (sqlite3, json, urllib, subprocess, hashlib) — fast startup, no native compilation, CI-tested on Python 3.11, 3.12, and 3.13.
Write-Ahead SQLite WAL Journal
Atomically claims every mutating intent as pending before dispatching any external call, preventing race-condition double writes across concurrent workers.
- PRAGMA journal_mode=WAL + synchronous=FULL (+ fullfsync=ON on macOS)
- Attempt-fenced BEGIN IMMEDIATE state transitions
- UNIQUE (actor, target, action_id) deduplication key
Transparent Stdio MCP Proxy
Drops in front of any stdio MCP server in Claude Code, Cursor, or Codex. Read-only calls pass straight through while mutations gain idempotency and timeout recovery.
- --deterministic-ids & automatic initialize protocol guidance
- Stable workspace session in .sidefx/current-session across restarts
- Opt-in --restart-on-timeout process-group recovery & handshake replay
Read-Only Crash Reconciler
Recovers lost URLs and commit refs after response-loss crashes or timeouts instead of posting duplicates, and never guesses on HTTP or pagination errors.
- git push reconciled via read-only git ls-remote
- GitHub Issues/PRs/Comments via <!-- sidefx:id=<marker> -->
- Manual attestation via sidefx resolve --landed | --not-landed
Deterministic Preflight Rules
Evaluates .sidefx.json argument constraints locally before any upstream server is touched, returning structured JSON-RPC -32001 errors on policy denials.
- required: true stops omitted-argument bypasses
- Numeric min/max caps and glob allow/deny lists
- Hardened allow_domains / deny_domains for URLs and emails
Session Receipts & Claude Code Stop Hook
Renders Markdown, plain-text, or JSON summaries directly from durable SQLite rows rather than compressed model memory.
- Strict read-only SQLite URI (mode=ro + PRAGMA query_only=ON)
- sidefx hook claude-code stays completely silent at 0 writes
- Surfaces loud warnings whenever pending or unknown rows exist
Privacy & Security Hardening
Built for real credentials and untrusted remote output: never persists raw tool arguments and strips secrets before writing targets, snippets, or errors.
- Stores SHA-256 argument/argv hashes instead of raw payloads
- Redacts URL credentials, webhook tokens, Bearer/Basic & API keys
- ANSI/BiDi/Markdown sanitization + 0700/0600 perms & auto-.gitignore
What the agent sees, and what it should do
Every blocking response embeds exact recovery steps directly in the JSON-RPC message (since most MCP clients only show the text to the model) alongside structured fields in error.data.
| Response / Error | JSON-RPC / Exit | Meaning | Required Next Step |
|---|---|---|---|
| OUTCOME UNKNOWN — reconcile before retrying | -32002 · exit 75 / 124 / child code | A write was sent and the reply was lost or ambiguous. It may have landed on the remote service. | Do not re-send or reword the call. Run the sidefx reconcile command from the message. If still unknown, verify with a read-only call and run sidefx resolve --landed or --not-landed. If landed, stop; if not landed, re-run the original command. |
| Preflight check denied tool ... | -32001 | A .sidefx.json policy rule rejected an argument. Nothing was sent. | Do not retry unchanged. Update the argument to satisfy the rule, or ask the user for approval. |
| Payload mismatch for action ... | -32004 · exit 2 | The action ID was already used for a different payload. Nothing was sent. | Use a new action ID for a new write, or repeat the original payload to receive the original result. |
| [sidefx] Duplicate call not re-sent | none (appended to result) | With --deterministic-ids, an identical call already ran in this session. | Do nothing unless a second write was explicitly intended — then repeat with a unique _sidefx_action_id argument. |
Paste into AGENTS.md / CLAUDE.md
Drop-in instructions so coding agents follow the exact reconcile, resolve, and receipt workflow.
Structured error.data payload
Example -32002 OUTCOME UNKNOWN JSON payload returned to programmatic MCP clients.
Verified against real faults, not mocks of mocks
sidefx eval spins up a local HTTP mock GitHub server, a bare git repo with fault-injecting pre-receive/post-receive hooks, a subprocess stdio MCP server with an fsync ledger, and 4 concurrent OS workers.
| Scenario | What It Injects | Status | Duplicates | Remote Writes | Receipt |
|---|---|---|---|---|---|
| pre_commit_crash_and_timeout | Pre-write timeout & crash across GitHub CLI, git push (pre-receive), and MCP proxy; plus HTTP 503 uncertain reconcile | PASS | 0 | 3/3 | — |
| post_commit_response_loss | Post-write timeout & crash before reply across GitHub CLI, git push (slow post-receive), and MCP proxy | PASS | 0 | 5/5 | — |
| concurrent_duplicate_dispatch | 4 concurrent OS worker processes racing on sidefx wrap with the same action_id | PASS | 0 | 1/1 | — |
| payload_mutation_reused_id | Modified arguments/command under an existing action_id across CLI wrap and mcp-proxy | PASS | 0 | 3/3 | — |
| preflight_policy_enforcement | Numeric cap (amount > 50), protected branch denylist (main), and email domain allow/deny rules through mcp-proxy | PASS | 0 | 2/2 | — |
| session_receipt_ground_truth | Mixed CLI + MCP session (confirmed, reconciled, failed, unknown) verified against remote server state (JSON & Markdown) | PASS | 0 | 5/5 | 100.0% |
Single-run latency with full durability enabled
Representative single-run measurements from a git clone via uv run python evals/benchmark.py on macOS (Darwin arm64, Python 3.13.14, SQLite 3.53.1) with journal_mode=WAL, synchronous=FULL, and fullfsync=ON; exact timings vary by disk and OS.
| Operation | N | Median | p95 | Notes |
|---|---|---|---|---|
| Journal get_action lookup | 300 | ~0.005 ms | ~0.006 ms | Indexed SQLite read |
| Journal begin_action replay hit | 300 | ~0.011 ms | ~0.012 ms | Hash check + cached status hit |
| Journal begin_action + mark_confirmed | 100 | ~8.0 ms | ~8.2 ms | Two durable fullfsync WAL commits |
| MCP direct stdio baseline (get_item) | 80 | ~0.014 ms | ~0.032 ms | Unwrapped local Python MCP server |
| MCP proxy read-only passthrough | 80 | ~0.033 ms | ~0.058 ms | ~+0.02 ms median overhead (no SQLite write) |
| MCP proxy mutating write-ahead (create_item) | 80 | ~8.0 ms | ~9.9 ms | ~+8.0 ms median overhead (preflight + 2 durable commits) |
| MCP proxy duplicate replay (--deterministic-ids) | 80 | ~0.044 ms | ~0.18 ms | Answered from journal; zero upstream calls |
| CLI bare /usr/bin/true baseline | 20 | ~2.1 ms | ~2.4 ms | Baseline process spawn |
| CLI sidefx wrap (new action) | 20 | ~69 ms | ~78 ms | ~+67 ms median overhead (Python startup + WAL commits) |
| CLI sidefx wrap (replayed hit) | 20 | ~55 ms | ~59 ms | Replayed from journal without spawning child |
Operational details
How reconciliation, deterministic action IDs, timeout restarts, and secret redaction work in practice.
Built-in read-only reconcilers cover git push (via git ls-remote) and GitHub issues, pull requests, and comments (via GitHub REST GET looking for the embedded <!-- sidefx:id=<marker> --> marker across both open and closed items). They fail closed: any HTTP error, auth error, or pagination truncation keeps the action unknown. For any tool without a built-in reconciler (custom MCP servers, deploy scripts, or arbitrary webhooks), sidefx reconcile reports 'No reconciler available' and keeps the call blocked until you check the remote system yourself and run sidefx resolve --action-id <id> --landed --ref <url> (marks reconciled and replays on retries) or --not-landed (marks failed and re-opens the call). Pending rows require --force-pending so an active worker is not clobbered.