Swap v1 agent + demo: 3 MCP tools, fork-demo stub, swap-e2e (#26)#69
Merged
Merged
Conversation
Add the agent and demo layer on top of the already-built daemon swap trust path (epic #23, child #26). - deckard-mcp grows from 6 to 9 tools: deckard_swap_quote (price a CoW sell order, read-only), deckard_swap (shaped propose to a request_id, always needs human approval), and deckard_submit_order (the daemon signs the stored order, the sidecar POSTs it to the CoW orderbook). The sidecar now builds deckard-core with the cow-client feature; the signer daemon stays HTTP-free. - deckard-core gains a fork-demo orderbook stub behind DECKARD_DEMO_SWAP_STUB: a deterministic fixture quote plus a simulated fill via anvil setStorageAt, because a real CoW order cannot be accepted from a local fork. Every stubbed response is marked simulated:true and never fabricates a mainnet success. - just swap-e2e runs an env-gated live-Sepolia trust-path harness (ignored by default; needs RPC_URL_SEPOLIA). - Docs move from 6 to 9 tools across the agent quickstart, mcp-shape, README, and STATUS; THREAT-MODEL and CONTRIBUTING gain the swap surface and the new harness. Closes #26
This was referenced Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the agent + demo layer on top of the already-built daemon swap trust path (epic #23): three new MCP tools take the surface from 6 to 9 —
deckard_swap_quote(read-only CoW pricing),deckard_swap(a shaped propose that always comes backneeds_approval), anddeckard_submit_order(the daemon signs the stored order, then the key-less sidecar POSTs it to the CoW orderbook). A default-off fork-demo stub returns a fixture quote and simulates the fill viaanvil_setStorageAt, because a real CoW order can't be accepted from a local Sepolia fork; every simulated response is markedsimulated: trueand never fabricates a live success. It also addsjust swap-e2e(an env-gated,#[ignore]d live-Sepolia trust-path harness) plus THREAT-MODEL and CONTRIBUTING updates. The signer daemon stays HTTP-free — thecow-clientfeature is enabled only on the sidecar'sdeckard-coreedge, and the existingfeature_gatetest enforces that the daemon never compiles it.Linked issue
Closes #26
Definition of Done
cargo fmt --all --checkis cleanjust checkis green — clippy-D warningson both the default config and--features traycargo test --workspaceis greenCargo.lock. The onlyCargo.tomlchange enables the existingcow-clientfeature ondeckard-mcp'sdeckard-corepath dep (so the sidecar can quote/POST to CoW) —reqwest/hickoryare already vendored via the app's default build, so this adds zero lockfile entries. In-scope for Swap v1 agent + demo: MCP swap tools, fork-demo stub, swap-e2e harness #26.deckard-appview changed (the app only recompiles as a downstream consumer ofdeckard-core); noDESIGN.mdsurface touched.Zeroizingand are never logged/Debug-printed — the swap path handles no seed/key/passphrase; the only secret the sidecar ever touches (the Railgun viewing key inshield) is unchanged.Evidence (paste command output here)
Notes for reviewers
Reviewed by codex (verdict ACHIEVED-WITH-NITS, all trust invariants holding) and a 9-angle recall review. All confirmed findings are fixed in this branch:
DECKARD_DEMO_SWAP_STUBwas never set on the documented demo path (just demo/install --demo), so the fork-demo stub was dead code and a demo swap would have hit the live orderbook. Both entry points now set it, so the fork demo actually simulates the fill.demo_stub::quotewrote the relativevalid_forinto the absolutevalid_to(a 1970 expiry) → nownow + valid_for, with a test assertion.DECKARD_RPC_URLfor the fill, snapshotted once atCowOrderbookconstruction so thesimulatedlabel can never diverge from the route taken.evaluate_orderpolicy gate (that gate is unit-tested indeckard-contract::policy).Where to look hardest: the no-self-approve path (
submit_order→ daemonSignOrder→Denied{not_approved}when unapproved) and the stub's honest-failure design (unknown token / unreachable fill RPC →credited=false, never a fabricated success). Test caveats: the swap-e2e harness and live CoW roundtrip are#[ignore]d (needRPC_URL_SEPOLIA); the MCP acceptance swap tests are hermetic (stub flag on, no anvil).