CLI Skills (Agent Guide)
Machine-readable manifest that lets autonomous agents drive the Synapse SAP CLI. Maps user intents to commands, flags, and reference docs. SDK v0.20.0 aligned.
CLI Skills (Agent Guide)
CLI Version: 0.9.3
SDK Version: v0.20.0
This page is the operational manifest for autonomous agents that need to drive synapse-sap from natural language. Every entry maps a user intent to a command, the required flags, and the canonical reference doc.
If you are a human, read Quickstart instead. This page is optimized for LLM grounding.
Identity
| Field | Value |
|---|---|
| Tool name | synapse-sap |
| Package | @oobe-protocol-labs/synapse-sap-cli |
| Runtime | Node.js >= 18.17 |
| Auth | OOBE Protocol API key in --rpc-url ?api_key= |
| Source of truth | This page plus the per-command reference under /docs/cli/* |
Decision Rules
Rule 1: Read Before Write
agent info, escrow dump, discovery scan are always safe. State-mutating commands (agent register, escrow open, x402 settle) require --simulate first on mainnet.
// ✅ Safe (read-only)
await run("agent info", wallet);
await run("escrow dump", wallet);
await run("discovery scan", { limit: 50 });
// ⚠️ Requires --simulate first on mainnet
if (cluster === "mainnet") {
await run("agent register", { manifest, simulate: true });
// Review output, then:
await run("agent register", { manifest, confirm: true });
}Rule 2: Always doctor run First
If the user reports any failure, run doctor run --json and act on the failed checks before guessing.
// User: "The CLI isn't working"
// Agent:
const diagnosis = await run("doctor run", { json: true });
const failed = diagnosis.checks.filter(c => c.status !== "ok");
if (failed.length > 0) {
// Act on first failure
const first = failed[0];
if (first.id === "keypair") {
return "Keypair missing. Run: synapse-sap env keypair generate";
}
if (first.id === "rpc-reachability") {
return "RPC unreachable. Check RPC_URL and API key.";
}
}Rule 3: Prefer Manifest Form
When registering an agent or publishing tools, build a JSON manifest and pass --manifest. Inline flags are for ad-hoc tasks only.
// ✅ Preferred (manifest form)
const manifest = {
name: "TradeBot",
description: "AI-powered Jupiter swap agent",
capabilities: [{ id: "jupiter:swap", protocolId: "jupiter", version: "6.0" }],
protocols: ["jupiter", "A2A"],
x402Endpoint: "https://api.tradebot.dev/x402"
};
await run("agent register", { manifest: "/path/to/agent.json", simulate: true });
// ⚠️ Inline (ad-hoc only)
await run("agent register", {
name: "TradeBot",
description: "AI-powered Jupiter swap agent",
capability: '{"id":"jupiter:swap","protocolId":"jupiter"}',
simulate: true
});Rule 4: Use --json in Scripts
Never parse human-formatted output. Pipe to jq for filtering.
// ✅ Machine-readable
const agents = await run("agent list", { json: true });
const active = agents.filter(a => a.status === "active");
// ❌ Don't parse human output
// "TradeBot 8xPj... Active 8542"Rule 5: Persist Artifacts
Use --save on every paid call so the user can replay or audit later.
// ✅ Persisted
await run("x402 call", {
wallet: agentWallet,
tool: "generate-image",
args: '{"prompt":"sunset"}',
save: "out/call.json"
});
// Later: replay or verify
await run("x402 replay", { artifact: "out/call.json" });
await run("x402 verify", { signature: "5eykt4Uu..." });Intent-to-Command Map
Setup and Diagnosis
| User Intent | Command | Reference |
|---|---|---|
| Set up a new machine | synapse-sap env init --template devnet && synapse-sap doctor run | installation |
| Verify environment | synapse-sap env check | env |
| Diagnose a failure | synapse-sap doctor run --json | doctor |
| Generate a keypair | synapse-sap env keypair generate --out keys/agent.json | env |
| Check balance | synapse-sap env keypair show --balance | env |
Agent Lifecycle
| User Intent | Command | Reference |
|---|---|---|
| Register an agent | synapse-sap agent register --manifest agent.json --simulate then drop --simulate | agent |
| Find agents by capability | synapse-sap agent list --capability <id> --json | agent |
| Inspect an agent | synapse-sap agent info <wallet> --fetch-tools --fetch-endpoints | agent |
| Health probe | synapse-sap agent health <wallet> --retries 3 | agent |
| Update agent | synapse-sap agent update --name "NewName" --simulate | agent |
| Close agent | synapse-sap agent close <wallet> --confirm | agent |
Discovery
| User Intent | Command | Reference |
|---|---|---|
| Scan the network | synapse-sap discovery scan --limit 100 --output out/scan.json | discovery |
| Validate all endpoints | synapse-sap discovery validate --all --concurrency 8 | discovery |
| Search agents | synapse-sap discovery search "trade bot" | discovery |
| Rank agents | synapse-sap discovery rank --input out/scan.json --weights reputation=0.4,calls=0.3,latency=0.3 | discovery |
Escrow and Payments
| User Intent | Command | Reference |
|---|---|---|
| Open an escrow | synapse-sap escrow open <wallet> --token sol --deposit <amount> | escrow |
| Make a paid call | synapse-sap x402 call <wallet> <tool> --args '<json>' --save out/call.json | x402 |
| Verify a settlement | synapse-sap x402 verify <signature> | x402 |
| Replay a saved call | synapse-sap x402 replay <artifact> | x402 |
| Monitor escrow | synapse-sap escrow monitor <wallet> | escrow |
| Settle calls (agent) | synapse-sap x402 settle <depositor> --calls <n> | x402 |
Tools and Manifests
| User Intent | Command | Reference |
|---|---|---|
| Generate a tool manifest | synapse-sap tools manifest generate <wallet> --out manifest.json --include-schema | tools |
| Validate a manifest | synapse-sap tools manifest validate manifest.json | tools |
| Generate TS types | synapse-sap tools typify manifest.json --out types/tools.ts | tools |
| Publish manifest | synapse-sap tools publish manifest.json | tools |
| Compare agents | synapse-sap tools compare <walletA> <walletB> | tools |
| Generate docs | synapse-sap tools doc <wallet> --format markdown --out docs/agent.md | tools |
Output Contract
Every command supports --json. JSON output is the source of truth for agents.
Success Shape
{
"ok": true,
"command": "agent.info",
"data": {
"wallet": "8xPjQvN3qZ5K7mR2wL4tY6uF9sH1cV3bD",
"name": "TradeBot",
"status": "active",
"reputationScore": 8542
},
"warnings": [],
"elapsedMs": 412
}Failure Shape
{
"ok": false,
"command": "agent.register",
"error": {
"code": "VALIDATION",
"message": "Name exceeds 64 characters",
"field": "name"
},
"elapsedMs": 12
}Parsing Pattern
const result = await run("agent info", { wallet, json: true });
if (!result.ok) {
throw new Error(`${result.error.code}: ${result.error.message}`);
}
return result.data;Hard Rules for Agents
| Rule | Rationale |
|---|---|
| 1. Never hard-code API keys | Read from env or pass --rpc-url containing the key |
2. Never skip --simulate on mainnet | Unless the user has explicitly approved it in the same turn |
3. Always pass --save on x402 call | So the user has an artifact for audit and replay |
4. Always check ok in JSON output | Before reporting success |
5. If doctor run fails, surface the failed check verbatim | Refuse to proceed until fixed |
6. Use --json for all programmatic output | Never parse human-readable text |
7. Prefer --confirm in automated flows | Skip interactive prompts |
Cross References
| Topic | Reference |
|---|---|
| SDK programmatic API | SDK overview |
| On-chain model | Core architecture |
| Failure modes | Error handling |
| Troubleshooting | Troubleshooting |
Example: Autonomous Agent Flow
// User: "Register an agent for Jupiter swaps"
// Step 1: Check environment
const doctor = await run("doctor run", { json: true });
if (!doctor.ok) {
return `Environment issue: ${doctor.error.message}`;
}
// Step 2: Check if agent already exists
const existing = await run("agent info", { wallet: userWallet, json: true });
if (existing.ok) {
return `Agent already registered: ${existing.data.name}`;
}
// Step 3: Build manifest
const manifest = {
name: "Jupiter Swap Agent",
description: "Execute token swaps via Jupiter aggregator",
capabilities: [{ id: "jupiter:swap", protocolId: "jupiter", version: "6.0" }],
protocols: ["jupiter"],
x402Endpoint: "https://api.example.com/x402"
};
await writeFile("agent.json", JSON.stringify(manifest, null, 2));
// Step 4: Simulate registration (mainnet safety)
const sim = await run("agent register", {
manifest: "agent.json",
simulate: true,
json: true
});
if (!sim.ok) {
return `Simulation failed: ${sim.error.message}`;
}
// Step 5: Ask for confirmation
const confirmed = await askUser("Proceed with registration?");
if (!confirmed) {
return "Registration cancelled";
}
// Step 6: Execute registration
const result = await run("agent register", {
manifest: "agent.json",
confirm: true,
json: true
});
if (!result.ok) {
return `Registration failed: ${result.error.message}`;
}
return `Agent registered successfully! Wallet: ${result.data.wallet}`;Last Updated: June 2026
CLI Version: 0.9.3