Who it is forAn operations engineer running an agent that changes a real system and must not apply the same change twice after a restart or failure.
The problemIf a process dies mid-request, it is unclear whether the tool ran, and retrying can repeat the change.
The outcomeRepeated requests return the recorded outcome, and interrupted requests are marked UNKNOWN for external checking and explicit reconciliation.
What you need first
- CMake 3.18+ and a C++17 compiler on Linux or macOS
- Python 3 for tests and packaging
- libcurl development files only if you want the HTTP model adapter
- SQLite development files only if you want durable storage
Steps
- Build with SQLite support by following the Quick start build steps with libsqlite3 development files installed.
- Run a request with state and identity using
./build/cli/sparx run --state ./state/agent.db --session alice --request-id ac-001 --input 'set AC to 22 degrees'. (inferred, check the README) - Repeat the same command after a restart and confirm it returns the recorded outcome without a second tool call.
- After an interruption, run
./build/cli/sparx recover --state ./state/agent.dbto mark unfinished requests as UNKNOWN. - Check the external system for each UNKNOWN request, then follow the recovery guide at
docs/durable_recovery.mdto reconcile it.
Prompt for your agent
Using the repo OpenSparX/MasterAgent, run `sparx run --state ./state/agent.db --session <session> --request-id <id> --input '<command>'` twice, restarting between runs, then run `sparx recover --state ./state/agent.db`. Expected output is the same recorded outcome on the second run and any unfinished requests listed as UNKNOWN. Verify that the tool was not invoked a second time.
Caveat. The README states there is no transaction across a real device and SQLite, so this is not an exactly-once guarantee, and storage is not encrypted.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for OpenSparX/MasterAgent and "Stop repeated tool runs after a crash"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer