v0.1.2 · Zero-LLM · Python 3.11+ stdlib

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 init

Install globally with uv tool (or pip install sidefx), then run sidefx init inside your repo.

Failure Mode 01

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.

Failure Mode 02

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.

Drop-In Setup

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.

.mcp.json

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 GitHub
Architecture & Guarantees

Six 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.

Durability

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
JSON-RPC 2.0

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
Fail-Closed

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
Guardrails

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
Ground Truth

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
Hardening

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
Agent Recovery Contract

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 / ErrorJSON-RPC / ExitMeaningRequired Next Step
OUTCOME UNKNOWN — reconcile before retrying-32002 · exit 75 / 124 / child codeA 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 ...-32001A .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 2The 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-sentnone (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.

Chaos Fault-Injection Suite

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.

Chaos ScenariosPASS
6/6
13.1s total runtime (uv run sidefx eval)
Duplicate Remote WritesVerified
0
Across crashes, timeouts & 4-worker races
Receipt AccuracyGround truth
100.0%
Verified against remote state (JSON & MD)
MCP Read PassthroughNo WAL write
~+0.02 ms
~0.033 ms proxy vs ~0.014 ms direct stdio
Duplicate Replay0 upstream
~0.044 ms
Answered from journal (--deterministic-ids)
ScenarioWhat It InjectsStatusDuplicatesRemote WritesReceipt
pre_commit_crash_and_timeoutPre-write timeout & crash across GitHub CLI, git push (pre-receive), and MCP proxy; plus HTTP 503 uncertain reconcilePASS03/3—
post_commit_response_lossPost-write timeout & crash before reply across GitHub CLI, git push (slow post-receive), and MCP proxyPASS05/5—
concurrent_duplicate_dispatch4 concurrent OS worker processes racing on sidefx wrap with the same action_idPASS01/1—
payload_mutation_reused_idModified arguments/command under an existing action_id across CLI wrap and mcp-proxyPASS03/3—
preflight_policy_enforcementNumeric cap (amount > 50), protected branch denylist (main), and email domain allow/deny rules through mcp-proxyPASS02/2—
session_receipt_ground_truthMixed CLI + MCP session (confirmed, reconciled, failed, unknown) verified against remote server state (JSON & Markdown)PASS05/5100.0%
Totals: 6/6 passed · 0 duplicate remote writes · 100.0% receipt accuracy · 13.1s total runtimeuv run sidefx eval
Performance & Overhead

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.

OperationNMedianp95Notes
Journal get_action lookup300~0.005 ms~0.006 msIndexed SQLite read
Journal begin_action replay hit300~0.011 ms~0.012 msHash check + cached status hit
Journal begin_action + mark_confirmed100~8.0 ms~8.2 msTwo durable fullfsync WAL commits
MCP direct stdio baseline (get_item)80~0.014 ms~0.032 msUnwrapped local Python MCP server
MCP proxy read-only passthrough80~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 msAnswered from journal; zero upstream calls
CLI bare /usr/bin/true baseline20~2.1 ms~2.4 msBaseline 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 msReplayed from journal without spawning child
FAQ

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.