Operating principle
Production agents should run in phases:| Phase | Allowed by default | Purpose |
|---|---|---|
| Diagnose | read, diagnostic | Verify CLI, auth, JSON, manifest, and user-data readiness. |
| Read | read, user_data, market_data, research | Build current context and candidate actions. |
| Propose | none beyond read | Emit commands it wants to run, with reasons and side-effect class. |
| Approve | human or policy service | Decide whether writes, runtime, or trade actions are allowed. |
| Execute | explicit allowlist only | Run approved write/runtime/trade commands. |
| Audit | diagnostic, read | Save trace, summarize receipts, record outcome. |
Boot sequence
Every host should begin with the same read-only checks:| Command | Healthy signal |
|---|---|
sf status --json | Config, API URL, auth, exchange, and runtime status are visible. |
sf doctor --agent --deep --json | Public health, world JSON, manifest truth, and intended user reads are ok. |
sf describe --all --json | Manifest parses as one JSON array. |
sf guide --agent --json | Local playbook parses without network dependency. |
sf tools plan ... --json | Returns ordered commands and side-effect metadata. |
Default policy
For production research jobs:write from --deny only after approval:
trade or runtime to unattended cron, CI, or external coding-agent prompts.
Side-effect classes
Usesf describe --all --json as ground truth. Current side-effect classes include:
| Class | Meaning | Examples |
|---|---|---|
none | Read-only or diagnostic. | world, discover, inspect, book, trace receipt |
write | Mutates SimpleFunctions state but does not hit an exchange. | watchlist add, alerts create, monitor create, thesis signal |
runtime | Starts or stops a local daemon. | runtime start, quoteengine start |
trade | Creates exchange-facing intent or order behavior. | intent buy, buy, quote create, quoteengine stop |
Cron pattern
Use cron for read-only recurring review:Claude Code or Codex host
When Claude Code, Codex, or another coding agent drivessf, give it command boundaries:
sf tools plan "<task>" --json before writing custom command plans. The live plan includes skipped side effects and candidate tools.
Approval packet
Before any write, runtime, or trade action, the agent should emit:Trace and receipt
Record every production agent run:| Question | Evidence |
|---|---|
| What tools did the agent call? | Trace receipt tool list. |
| Did it attempt a blocked action? | Policy and stderr logs. |
| What did it spend? | Agent usage in trace and run logs. |
| What state changed? | Approval packet plus command output. |
Recovery
| Symptom | First response |
|---|---|
doctor public health fails | Check network/sandbox first; then retry sf world --json. |
| JSON parse fails | Run sf doctor --agent --deep --json; inspect the failing check id. |
| Agent proposes direct order | Reject; ask for an intent or paper quote proposal with pre-read context. |
| Runtime is running unexpectedly | sf runtime status --json, then human-approved sf runtime stop. |
| QuoteEngine is running unexpectedly | sf quoteengine status --json, then human-approved sf quoteengine stop. |
| Output too large | Use --limit, --since, --hours, --cursor, or --include flags. |
| Tool output on stderr | Keep stdout for JSON/protocol, stderr for progress and warnings. |
Promotion checklist
Before promoting a new agent prompt, model, or workflow:- Run it read-only with
--deny trade,runtime,fs,write. - Record trace.
- Run
sf trace receipt. - Replay the same trace when possible.
- Check it never depends on rendered UI or terminal tables.
- Check it proposes side-effecting commands instead of running them.
- Run one live dry-run workflow such as
sf workflow demo monitor --dry-run --json.
Related docs
Headless agent
Interface patterns for
sf agent --plain and sf agent --headless.Evaluation and replay
Trace receipts, replay, backtests, and model comparison.
Agentic CLI
Full command control plane and permission categories.
Trade intents
Declarative execution boundary.