Conflux CRDT Shared State

v0.9.2
io.github.lolllll212/conflux-state Checked 2 days ago Published 21 days ago

Zero-dependency CRDT shared state and conflict-resolution MCP server for parallel AI agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

conflux_read

Read the current converged value of a shared CRDT key (PNCounter int, LWWRegister JSON value, MVRegister winning value + active conflicts, or ORSet list).

ParameterTypeDescription
key *stringShared state key (e.g. 'fleet.jobs_done' or 'arch.decision').

conflux_snapshot

Return a full JSON snapshot of all shared CRDT keys (optionally filtered by prefix), active MVRegister conflict count, and the canonical 64-hex SHA-256 state_hash.

ParameterTypeDescription
prefixstringOptional key prefix filter (e.g. 'crew.' or 'tasks/').

conflux_register_set

Write any JSON value to a Last-Writer-Wins (LWW) register in shared Conflux state. Concurrent writes resolve deterministically with zero locks.

ParameterTypeDescription
key *stringRegister key to set.
value *Any JSON-serializable value (string, number, boolean, object, array).

conflux_mv_write

Write a JSON value to a conflict-preserving Multi-Value Register (MVRegister). Sequential writes cleanly replace prior values, while un-synced concurrent writes from parallel agents are BOTH preserved in conflux_conflicts until resolved!

ParameterTypeDescription
key *stringMVRegister key (e.g. 'spec.api_schema').
value *JSON-serializable value proposed by this agent.
supersedesarrayOptional list of 'tick:agent' dots to supersede (defaults to all currently observed dots on this replica).

conflux_conflicts

List all unresolved concurrent write conflicts across MVRegister keys, showing every competing agent's candidate value, causal dot ('tick:agent'), and current canonical winner.

ParameterTypeDescription
prefixstringOptional key prefix to filter conflicts.

conflux_resolve_conflict

Causally resolve all currently observed concurrent MVRegister candidates on 'key' into a single merged/agreed JSON value, clearing the conflict across the mesh.

ParameterTypeDescription
key *stringConflicted MVRegister key to resolve.
resolved_value *Merged/agreed JSON value superseding all prior candidates.

conflux_counter_add

Atomically increment (delta > 0) or decrement (delta < 0) a lock-free shared PNCounter across concurrent agents.

ParameterTypeDescription
key *stringCounter key.
deltaintegerNon-zero integer to add (positive increments, negative decrements).

conflux_set_add

Add an item to a conflict-free Observed-Remove Set (ORSet) in shared state.

ParameterTypeDescription
key *stringSet key (e.g. 'swarm.findings').
value *JSON-serializable element to add.
tagstringOptional unique tag (save this tag if you plan to remove the item later).

conflux_set_remove

Tombstone-remove an element tag from a shared Observed-Remove Set (ORSet).

ParameterTypeDescription
key *stringSet key.
tag *stringTag previously used in conflux_set_add.

conflux_batch

Execute multiple CRDT mutations sequentially in one tool call (ops: register_set, mv_write, counter_add, set_add, set_remove).

ParameterTypeDescription
operations *arrayList of mutation specs: {op, key, value/delta/tag}.

conflux_claim_resource

Advisory file/task claim with TTL lease so parallel coding agents (Claude Code, Cursor) avoid editing the same file simultaneously. Reports 'conflict' if another agent holds an active lease.

ParameterTypeDescription
resource *stringFile path or resource identifier (e.g. 'src/auth.py').
forcebooleanSteal the claim even if another agent's lease has not expired yet.
intentstringShort note describing what this agent is doing with the resource.
ttl_secondsnumberLease duration in seconds before automatic expiry (default 120).

conflux_release_resource

Release an advisory resource/file lease previously claimed by this agent.

ParameterTypeDescription
resource *stringFile path or resource identifier.

conflux_watch_wait

Wait up to timeout_seconds until 'key' changes from 'since_value' (or becomes non-null), enabling event-driven handoffs between parallel MCP agents.

ParameterTypeDescription
key *stringKey to watch.
since_valueReturn immediately once current value differs from since_value.
timeout_secondsnumberMax seconds to wait (capped at 30s).

conflux_task_update

Create or update a replicated multi-agent task record under 'tasks/<task_id>' (status: created | running | done | failed) so parallel agents coordinate work queues.

ParameterTypeDescription
status *stringNew lifecycle status for the task.
task_id *stringUnique task identifier.
errorstringOptional error message when status='failed'.
kindstringTask category/type (used when creating a task).
resultOptional JSON result payload when status='done'.
stepstringOptional current step label.