CLI-first bootstrap (OpenClaw-style)
Use the repo-local CLI viapnpm openboa ...:
Global install (next-step, CLI-first)
If you want the same ergonomics asopenclaw (install once, run anywhere):
- build once:
pnpm build
- install from source tree:
pnpm install -g .(or package-specific publish flow)
- then run directly:
openboa setupopenboa agent spawn --name <agent_id>openboa agent chat --name <agent_id>
pnpm openboa).
Global install + Homebrew formula generation is planned once packaging policy is finalized.
pnpm openboa setup- creates
.openboaworkspace scaffold (bootstrap/runtime.json,system/base.prompt, required folders)
- creates
pnpm openboa agent spawn --name <agent_id>- creates agent runtime config under
.openboa/agents/<agent_id>/agent.json
- creates agent runtime config under
pnpm openboa agent list- lists configured agents
pnpm openboa agent chat --name <agent_id>- starts interactive chat with that agent
pnpm openboa setup-codex-pi-agent <agent_id>- legacy alias of
agent spawn
- legacy alias of
pnpm openboa codex-login- launches oauth flow and writes
.openboa/auth/codex.oauth.json
- launches oauth flow and writes
pnpm dev -- "hello pi runtime"for one-shot turn with default agentpnpm dev -- tui [agentId]for direct TUI
What It Includes
- Unified turn envelope protocol for both Agent ↔ Human and Agent ↔ Agent:
protocol: "boa.turn.v1"
- Minimal gateway WebSocket route handler:
BoaGateway.handleWebSocketMessage(rawJson)
- Runtime turn loop:
- inbound persist -> context build -> adapter stream -> outbound persist -> checkpoint append
- Local JSONL boundaries:
- Chat source of truth:
.openboa/chat/chats/<chatId>.jsonl - Session metadata/checkpoints:
.openboa/agents/<agentId>/sessions/<sessionId>.jsonl
- Chat source of truth:
- Bootstrap/system prompt/context path:
.openboa/bootstrap/runtime.json(tokenBudget).openboa/system/base.prompt.openboa/system/agents/<agentId>.prompt
- Minimal Codex auth reference path:
CODEX_API_KEYenv first- fallback
.openboa/auth/codex.oauth.json
New quick flow (recommended)
- Agent config is created with
auth.required: trueby default. - If code key is unavailable, use
pnpm openboa codex-loginfirst. - No secrets are printed or committed.
API Mode (Pi, API-key only)
Start API server:- API key is env-only (
OPENAI_API_KEY), never committed in files. /chatenforces request size limit and timeout with normalized error responses.- Session continuity is preserved through default ids (
api-chat/api-session) or caller-provided ids.
Operation Modes (Pi)
- One-loop (single turn):
pnpm dev -- "hello pi runtime"
- Forever (HTTP service):
pnpm dev -- serve
systemd service sketch:
Failure Modes / Quick Triage
- Auth required but missing:
run 'openboa codex-login' for oauth- or set
CODEX_API_KEY
- Token lookup order to verify quickly:
CODEX_API_KEY->.openboa/auth/codex.oauth.json
- Inspect runtime artifacts:
.openboa/chat/chats/*.jsonl.openboa/agents/*/sessions/*.jsonl
Recovery / Triage
- Storage locations:
- chat:
.openboa/chat/chats/<chatId>.jsonl - session:
.openboa/agents/<agentId>/sessions/<sessionId>.jsonl
- chat:
- Missing file behavior:
- treated as empty history (no crash)
- Error split:
- malformed payload / missing required fields / invalid participant kind =>
invalid turn envelope - unsupported protocol version =>
unsupported protocol: <value>
- malformed payload / missing required fields / invalid participant kind =>
- Malformed file behavior:
- malformed trailing line is skipped (tolerated)
- malformed non-trailing line fails fast for integrity
- Quick inspection commands:
tail -n 20 .openboa/chat/chats/<chatId>.jsonltail -n 20 .openboa/agents/<agentId>/sessions/<sessionId>.jsonltail -n 20 .openboa/chat/chats/<chatId>.jsonl | jq -c .
sender.kindandrecipient.kindmust be one of:human,agent- Other values are rejected as
invalid turn envelope
unsupported protocol: boa.turn.v0
Protocol Envelope Example
CI / PR Triage (Issue #16 scope)
For this runtime track, CI intentionally splits runtime checks from docs-only changes:checkjob runs format/lint/type/test when non-doc files changeddocsjob runs markdown + link checks when docs changedrequired-ciis the single gate expected by branch protection
Validation Matrix (Canonical)
| Acceptance Criteria | Evidence (file) | Verify command |
|---|---|---|
| CLI bootstrap + agent lifecycle | src/index.ts, src/runtime/setup.ts, docs/runtime-single-agent-pi.md | pnpm openboa setup && pnpm openboa agent spawn --name agent_1 && pnpm openboa agent list |
| Single-agent e2e turn path | test/runtime.single-agent.test.ts | pnpm -s vitest run test/runtime.single-agent.test.ts |
| Restart recovery (checkpoint) | test/runtime.single-agent.test.ts | pnpm -s vitest run test/runtime.single-agent.test.ts -t "checkpoint" |
| Protocol/gateway input safety | test/runtime.gateway.validation.test.ts | pnpm -s vitest run test/runtime.gateway.validation.test.ts |
| Context budget trimming boundary | test/runtime.context-builder.test.ts | pnpm -s vitest run test/runtime.context-builder.test.ts |
| Agent setup + runtime turn success | test/runtime.single-agent.test.ts | pnpm -s vitest run test/runtime.single-agent.test.ts |
| Baseline runtime harness health | test/smoke.test.ts | pnpm -s vitest run test/smoke.test.ts |
| Runtime flow + triage docs | docs/runtime-single-agent-pi.md | pnpm check:docs && pnpm docs:linkcheck |
openboa/) and ensure Node/pnpm deps are installed (pnpm install --frozen-lockfile).