z4p · Rust trading harness

Trading agents,
with guardrails.

A Rust-native harness for traders who want automation without handing execution to an unchecked bot. Vault bible, bot scoping, proposals, approvals, and auditable execution.

$curl -fsSL https://raw.githubusercontent.com/zapmarkets/z4p/main/install.sh | sh

Features

Everything needed for safe, autonomous trading.

z4p is an 11-crate Rust workspace built around one idea: powerful automation without giving up control.

Vault bible

A single MarkdownVault per agent: soul, instructions, bots, skills, loops, memories, and learnings.

Approval gates

Every live action stops at a trader-controlled approval surface. Observe first, approve deliberately.

Bot-scoped policies

PermissionEngine enforces wallet roles, allowance budgets, stale-quote checks, and global halt controls.

Multi-chain tools

Solana + Jupiter, EVM + Uniswap, Hyperliquid perps, and MCP servers for 70+ chains.

Self-learning loop

Decisions, guardrails, and outcomes persist as learnings that inform future ticks.

Non-custodial

Your keys stay local. The harness proposes, you sign. No remote custody or black-box execution.

Dry-run by default

Start in observe-only mode. z4p simulates routes and shows proposals before any live wallet is configured.

50+ AI providers

Plug in OpenAI, Anthropic, local models, or any compatible provider with encrypted credential storage.

Local gateway

An Axum-powered gateway with /vault UI, HTTP API, and MCP server — all running on your machine.

How it works

The agent control loop.

Every tick follows the same deliberate path. The default posture is observe-only; real execution is opt-in.

01

Compose

Load the agent's full vault bible every tick — soul, instructions, bots, skills, and recent learnings.

02

Retrieve

Query SQLite FTS5 memory, vault retrieval, and self-learning context so past outcomes inform the next move.

03

Simulate

Dry-run routes across Jupiter, Uniswap, Hyperliquid, and MCP-routed venues to compare slippage, fees, and exposure.

04

Approve

PermissionEngine checks bot policies, wallet roles, allowances, and stale quotes; the trader explicitly approves.

05

Execute

Submit approved orders, track fills, update positions, capture learnings, and feed outcomes back into the vault.

What Ships

Practical surfaces, trader-owned control.

z4p gives agents real tools to work through while keeping the trader close to vault state, policies, and execution.

CLI

One binary for doctor, agent-tick, bot setup, vault edits, trade proposals, executor control, and halt commands.

Vault UI

A local /vault dashboard for file tree, bible preview, bot manager, skills, and loop registry.

Gateway + MCP

Axum API on port 8790 with setup_bot, MCP server management, and 22+ built-in tools.

On-chain bots

Permissioned loop blueprints scoped by bot_id — wallet_monitor, price_watcher, onchain_scanner, base_sweeper.

Quickstart

Install z4p and run an observe-only agent.

Start with dry-run workflows. z4p composes your agent's vault bible, builds proposals, and shows what it would do before you configure live wallets.

Install release binary

curl -fsSL https://raw.githubusercontent.com/zapmarkets/z4p/main/install.sh | sh
z4p doctor
z4p gateway

Create a scoped bot

z4p bot setup \
  --agent trader1 \
  --name jup_sol_bot \
  --strategy "Conservative Jupiter swaps on Solana." \
  --loop price_watcher

Build from source

git clone https://github.com/zapmarkets/z4p
cd z4p
cargo build --release
z4p doctor

Open source

Built in public.

z4p is open-source software you can audit, extend, and run yourself. No remote custody, no black boxes, no hidden execution paths.

Explore the repo