KaleidoAgent is a separate, always-on server. It does not currently embed KaleidoMind’s
Engine and runs its own agent loop instead. See KaleidoMind’s relationship note for the convergence path being considered.Capabilities
Architecture
:4242.
Two Execution Modes
MCP Server Wiring
KaleidoAgent registerskaleido-mcp, the unified MCP server, as its primary tool source, giving it spark_*, wdk_*/rln_*, kaleidoswap_*, mpp_*/l402_*, and kaleido_node_* tools in one connection. Historically its config also referenced the now-archived standalone kaleidoswap-mcp and l402-gateway-mcp servers directly; since both are superseded by kaleido-mcp (see Retired Servers), new configurations should rely on kaleido-mcp alone rather than wiring those up separately.
Remote, third-party MCP servers can be registered too, gated behind an API key check. For example, a Bitrefill gift-card MCP is only registered if a BITREFILL_API_KEY env var is present, since the upstream endpoint rejects anonymous connections.
Autonomous Loops
Each loop is driven by a skill.
Risk Controls
Risk limits live inagent.config.json under portfolio. They are checked before any swap is submitted.
Trading Modes
Atomic Swap Flow
Same 5-step HTLC protocol as elsewhere in the KaleidoSwap stack, driven viakaleido-mcp or the CLI:
Run It
Prerequisites: Node.js 20 or newer, KaleidoCLI in$PATH, the Nanobot runtime, and an Anthropic or OpenAI API key.
1
Clone and install
2
Set the API key
Create a
.env file in the repository root with ANTHROPIC_API_KEY or OPENAI_API_KEY. Use AGENT_PROVIDER to pick between anthropic and openai:3
Configure the wallet and portfolio
Edit
agent.config.json:mcp.kaleido.env.WDK_SEED, the wallet mnemonic.mcp.kaleido.env.RLN_NODE_URL, the RGB Lightning Node URL.mcp.spark.env.WDK_SPARK_SEED, an optional separate Spark seed.portfolio.targets, the target allocation across BTC, USDT, and XAUT.portfolio.dry_run, keeptrueuntil the setup is verified.
agent.config.json: model choice, MCP server commands and env, portfolio targets and risk limits, schedule intervals, and the enabled skill list. See the repo README for the full schema and environment variable reference.4
Build and start
npm start runs the agent and its local status API on http://localhost:4242. The dashboard is served separately: run npm run dev:webapp (or npm run start:webapp for the built webapp) to serve it on http://localhost:5173. Use npm run daemon:start to run the agent as a background process instead..env.container.example to .env.container and run the container stack:
First Run
With the agent running, drive one loop by hand and read what it decided before letting it trade for real.1
Confirm dry run is still on
portfolio.dry_run defaults to true in agent.config.json. Leave it there. The agent will reason, decide, and report a trade without submitting it.2
Trigger a loop by hand
Rather than waiting on the schedule, ask the status API to run one:Then read
GET /status to see the decision, the balances it saw, and the token cost. The dashboard on http://localhost:5173 shows the same run if you started it.3
Review the risk limits
Confirm
max_swap_usd, min_btc_reserve_sats, and stop_loss_btc_sats match what you are willing to lose on a test network. These are checked before any swap is submitted, see Risk Controls above.4
Only then disable dry run
Set
portfolio.dry_run to false when the dry-run decisions have looked correct across several runs.Status API
The agent exposes a localhost-only control API on port4242, used by the dashboard and callable directly.