| name | agent-contracts |
|---|---|
| description | Create, execute, and resolve agent-to-agent UUIDv8 contracts under the Vertex LLC protocol. Manages the full contract lifecycle: draft, propose, sign, activate, milestone, complete, dispute, terminate. All contracts report to the central transactional registry at registry.somacosf.com. Use when: establishing new agent agreements, tracking contract milestones, resolving disputes, querying contract history, or registering new agents. |
| user-invocable | true |
| disable-model-invocation | false |
Create and manage agent-to-agent UUIDv8 contracts under the Vertex LLC protocol. Every contract is a deterministic UUID. Every state change reports to registry.somacosf.com. Every dollar flows through Locus escrow.
Every agent has a GYST UUID v8 identity:
- Type
0x500: Root agent (Vertex itself) - Type
0x501: City SPOC node operator - Type
0x502: Developer agent - Type
0x503: Advisor agent - Type
0x504: Task executor agent - Type
0x505: Contract witness/validator
Every contract is a GYST UUID v8 (type 0x510), deterministically generated from:
seed: contract:{party_a_uuid}:{party_b_uuid}:{terms_hash}
Same parties + same terms = same UUID. Always. Idempotent by design.
draft → proposed → signed → active → completed
→ disputed → resolved
→ terminated
All events report to: registry.somacosf.com
- Database:
data/agent-contracts.db(local SQLite mirror) - Remote:
POST registry.somacosf.com/api/contracts/:id/action(when deployed)
Local SQLite at data/agent-contracts.db:
CREATE TABLE IF NOT EXISTS agents (
uuid TEXT PRIMARY KEY,
designation TEXT NOT NULL UNIQUE,
type_code INTEGER NOT NULL,
display_name TEXT,
capabilities TEXT, -- JSON array
locus_wallet TEXT,
locus_policy TEXT, -- JSON object
parent_agent TEXT,
registered_at TEXT NOT NULL,
registered_by TEXT,
status TEXT DEFAULT 'active',
FOREIGN KEY (parent_agent) REFERENCES agents(uuid)
);
CREATE TABLE IF NOT EXISTS contracts (
uuid TEXT PRIMARY KEY,
version TEXT DEFAULT '1.0.0',
party_a TEXT NOT NULL,
party_b TEXT NOT NULL,
witnesses TEXT, -- JSON array of agent UUIDs
terms_summary TEXT NOT NULL,
terms_hash TEXT NOT NULL,
terms_uri TEXT, -- IPFS/Arweave URI
locus_escrow_id TEXT,
locus_policy_ref TEXT,
payment_amount REAL,
payment_currency TEXT DEFAULT 'USDC',
payment_schedule TEXT, -- one-time | recurring | milestone
state TEXT DEFAULT 'draft',
created_at TEXT NOT NULL,
signed_at TEXT,
activated_at TEXT,
completed_at TEXT,
expires_at TEXT,
parent_contract TEXT,
root_entity TEXT DEFAULT 'VERTEX-LLC',
FOREIGN KEY (party_a) REFERENCES agents(uuid),
FOREIGN KEY (party_b) REFERENCES agents(uuid),
FOREIGN KEY (parent_contract) REFERENCES contracts(uuid)
);
CREATE TABLE IF NOT EXISTS contract_signatures (
id INTEGER PRIMARY KEY AUTOINCREMENT,
contract_uuid TEXT NOT NULL,
agent_uuid TEXT NOT NULL,
signature TEXT NOT NULL,
key_fingerprint TEXT,
signed_at TEXT NOT NULL,
FOREIGN KEY (contract_uuid) REFERENCES contracts(uuid),
FOREIGN KEY (agent_uuid) REFERENCES agents(uuid)
);
CREATE TABLE IF NOT EXISTS contract_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
contract_uuid TEXT NOT NULL,
event_type TEXT NOT NULL, -- created | proposed | signed | activated |
-- milestone | completed | disputed | resolved | terminated
actor_uuid TEXT NOT NULL,
details TEXT, -- JSON
timestamp TEXT NOT NULL,
FOREIGN KEY (contract_uuid) REFERENCES contracts(uuid),
FOREIGN KEY (actor_uuid) REFERENCES agents(uuid)
);
CREATE TABLE IF NOT EXISTS milestones (
id INTEGER PRIMARY KEY AUTOINCREMENT,
contract_uuid TEXT NOT NULL,
milestone_number INTEGER NOT NULL,
description TEXT,
amount REAL,
status TEXT DEFAULT 'pending', -- pending | delivered | approved | rejected
delivered_at TEXT,
approved_at TEXT,
FOREIGN KEY (contract_uuid) REFERENCES contracts(uuid)
);
CREATE INDEX IF NOT EXISTS idx_contracts_state ON contracts(state);
CREATE INDEX IF NOT EXISTS idx_contracts_party_a ON contracts(party_a);
CREATE INDEX IF NOT EXISTS idx_contracts_party_b ON contracts(party_b);
CREATE INDEX IF NOT EXISTS idx_events_contract ON contract_events(contract_uuid);
CREATE INDEX IF NOT EXISTS idx_events_timestamp ON contract_events(timestamp);
CREATE INDEX IF NOT EXISTS idx_milestones_contract ON milestones(contract_uuid);/agent-contracts register AGENT-WINE-REVIEWER-001 --type executor --capabilities review,photo
Steps:
- Generate deterministic UUID:
generateGystUuidV8Deterministic({ typeCode: 0x504, namespaceHash: hashNamespace12('vertex.llc'), domain: 0x7 }, 'agent:vertex.llc:AGENT-WINE-REVIEWER-001') - Insert into
agentstable - Log registration event to
contract_events - Report to registry:
POST registry.somacosf.com/api/agents/register - Output: agent UUID, type, capabilities, registration confirmation
/agent-contracts create --from AGENT-AUSTIN-001 --to AGENT-NEWYORK-001 --terms "10 venue reviews at $20 each" --amount 200 --schedule milestone
Steps:
- Look up both agent UUIDs from the local DB
- Compute terms_hash:
sha256(terms_summary) - Generate deterministic contract UUID from
contract:{party_a}:{party_b}:{terms_hash} - Insert contract in
draftstate - If milestone schedule: prompt for milestone breakdown (count, amounts, descriptions)
- Insert milestones
- Log
createdevent - Output: contract UUID, terms, escrow amount, state
/agent-contracts propose CONTRACT-UUID
Steps:
- Verify contract is in
draftstate - Transition to
proposed - Log
proposedevent with party_a as actor - Report to registry
- Output: "Contract proposed to {party_b designation}. Awaiting co-signature."
/agent-contracts sign CONTRACT-UUID --as AGENT-NEWYORK-001
Steps:
- Verify contract is in
proposedstate - Verify signer is party_b (or a listed witness)
- Generate signature placeholder (in production: Ed25519 from agent key)
- Insert into
contract_signatures - If both parties have signed: transition to
signed - Log
signedevent - Report to registry
/agent-contracts activate CONTRACT-UUID
Steps:
- Verify contract is in
signedstate - If payment_amount > 0: record Locus escrow reference
- Transition to
active - Log
activatedevent - Report to registry
- Output: "Contract active. Escrow: {amount} USDC. Work may begin."
/agent-contracts milestone CONTRACT-UUID --number 1 --action deliver
/agent-contracts milestone CONTRACT-UUID --number 1 --action approve
Steps:
- Verify contract is
active - For
deliver: mark milestone asdelivered, log event - For
approve: mark milestone asapproved, record Locus release, log event - If all milestones approved: transition contract to
completed - Report to registry
/agent-contracts complete CONTRACT-UUID
Steps:
- Verify contract is
activeand all milestones (if any) are approved - Transition to
completed - Log
completedevent - Report to registry
- Output: "Contract completed. Total paid: {amount}. Duration: {days}."
/agent-contracts dispute CONTRACT-UUID --reason "Milestone 3 deliverable does not meet terms"
Steps:
- Verify contract is
active - Transition to
disputed - Log
disputedevent with reason in details - Report to registry
- Output: "Contract disputed. Escrow frozen. Reason recorded."
/agent-contracts resolve CONTRACT-UUID --outcome "Milestone 3 re-delivered and accepted" --release partial --amount 150
Steps:
- Verify contract is
disputed - Transition to
completedorterminatedbased on outcome - Record escrow distribution (full release, partial, or return)
- Log
resolvedevent - Report to registry
/agent-contracts terminate CONTRACT-UUID --reason "Mutual agreement to cancel"
Steps:
- Verify contract is in
draft,proposed,signed, oractive - Transition to
terminated - If escrow exists: record return to party_a
- Log
terminatedevent - Report to registry
/agent-contracts list
/agent-contracts list --agent AGENT-AUSTIN-001
/agent-contracts list --state active
Output a formatted table of contracts with: UUID (short), parties, terms summary, amount, state, date.
/agent-contracts info CONTRACT-UUID
Show full contract details: both parties, all terms, escrow status, signatures, milestones, event history.
/agent-contracts agents
Output table: UUID (short), designation, type, capabilities, status, registration date.
/agent-contracts feed
/agent-contracts feed --last 20
Show recent contract events in chronological order: creation, signatures, activations, milestones, completions. Formatted as a live feed.
/agent-contracts stats
Show: total agents, total contracts by state, total USDC escrowed/released/returned, milestone completion rate, most active agents.
When registry.somacosf.com is deployed:
- Every write operation also POSTs to the registry API
GET /api/feedreturns the global event streamGET /api/contracts/:idreturns contract + full event history- Local SQLite is the source of truth; registry is the public mirror
When the registry is not yet deployed (local-only mode):
- All operations work against
data/agent-contracts.db - A
synccommand will batch-upload local state when the registry comes online
- Use
generateGystUuidV8Deterministicfromlib/uuidv8.tsfor all UUID generation - Agent type codes: 0x500-0x505. Contract type codes: 0x510-0x512. LLC: 0x520-0x522. Credentials: 0x530-0x531
- All timestamps are ISO 8601
- All amounts are in USDC (numeric, 2 decimal places)
- terms_hash is SHA-256 hex string
- The
root_entityfield on every contract is always "VERTEX-LLC" - Locus integration is via placeholder references until API keys are configured
After any write operation:
- Query the local DB to confirm the state change
- Show the updated contract/agent record
- Show the logged event in the feed
- Confirm registry sync status (synced / pending / local-only)
This skill should be considered when:
- User mentions "contract", "agreement", "deal", or "hire" between agents
- User asks about agent registration or capabilities
- User wants to check contract status or payment flows
- User references Vertex, Locus, or the Says Network in a transactional context
- A new city node or agent needs to be onboarded