Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JSON schemas

Tools that talk to sspur without the MCP server use two JSON formats: transactions going in, and diagnostics coming out. Both have a JSON Schema (draft 2020-12).

SchemaDescribes
ops.schema.jsonA transaction for sspur apply and the MCP tool apply: optional base, agent, reason and merge, and a list of ops
diagnostic.schema.jsonOne diagnostic, as printed by sspur check --json (one per line) and returned in diags by edit --json and apply
node.schema.jsonThe wire form of a stored definition from the graph model design. The CLI doesn’t print it today; queries return text or their own --json objects

Transactions

{"agent": "a1", "reason": "add total", "ops": [
  {"op": "add", "path": "total", "src": "fn total(xs: List[Int]) -> Int\n= xs.sum"},
  {"op": "attach", "target": "total", "kind": "test", "value": "total([1, 2]) == 3"}
]}
OpFieldsNotes
addpath, srcsrc holds exactly one definition, named path (E_OP_SRC, E_OP_NAME)
replacepath, srcCallers stay linked by name, and their hashes update
renamefrom, toScope-aware, including constructors; never changes a hash
removepath
refinetarget, contract: {pre?, post?, effects?}effects items are "+log" or "-log"
fillhole, expr, optional targethole is "?name" or "?"
attachtarget, kind ("test" or "req"), value
resolvepath, pick ("ours" or "theirs")Only with "merge": true, while a sync pull is pending

If the result doesn’t typecheck, nothing changes and the result lists the diagnostics. A transaction that lost a race comes back with E_MERGE or E_CONFLICT and a rebase object, {base, ops}, to retry (A multi-agent codebase). Most agents never write JSON: sspur edit takes plain definitions and builds the transaction.

Diagnostics

{"code":"E_TYPE_MISMATCH","severity":"error","def":"half","span":[25,32],"msg":"expected F64, found Int","hint":"convert with '.to_f64'"}

span is a byte range in the source. fix, when present, is a list of ops that apply the fix as they are. The error codes page lists every code.