Files
bot/docs/concepts/agent.md
hanzo-dev 0fa6a33a93 Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

5.1 KiB
Raw Permalink Blame History

summary, read_when, title
summary read_when title
Agent runtime (embedded pi-mono), workspace contract, and session bootstrap
Changing agent runtime, workspace bootstrap, or session behavior
Agent Runtime

Agent Runtime 🤖

HanzoBot runs a single embedded agent runtime derived from pi-mono.

Workspace (required)

HanzoBot uses a single agent workspace directory (agents.defaults.workspace) as the agents only working directory (cwd) for tools and context.

Recommended: use hanzo-bot setup to create ~/.hanzo-bot/hanzo-bot.json if missing and initialize the workspace files.

Full workspace layout + backup guide: Agent workspace

If agents.defaults.sandbox is enabled, non-main sessions can override this with per-session workspaces under agents.defaults.sandbox.workspaceRoot (see Gateway configuration).

Bootstrap files (injected)

Inside agents.defaults.workspace, HanzoBot expects these user-editable files:

  • AGENTS.md — operating instructions + “memory”
  • SOUL.md — persona, boundaries, tone
  • TOOLS.md — user-maintained tool notes (e.g. imsg, sag, conventions)
  • BOOTSTRAP.md — one-time first-run ritual (deleted after completion)
  • IDENTITY.md — agent name/vibe/emoji
  • USER.md — user profile + preferred address

On the first turn of a new session, HanzoBot injects the contents of these files directly into the agent context.

Blank files are skipped. Large files are trimmed and truncated with a marker so prompts stay lean (read the file for full content).

If a file is missing, HanzoBot injects a single “missing file” marker line (and hanzo-bot setup will create a safe default template).

BOOTSTRAP.md is only created for a brand new workspace (no other bootstrap files present). If you delete it after completing the ritual, it should not be recreated on later restarts.

To disable bootstrap file creation entirely (for pre-seeded workspaces), set:

{ agent: { skipBootstrap: true } }

Built-in tools

Core tools (read/exec/edit/write and related system tools) are always available, subject to tool policy. apply_patch is optional and gated by tools.exec.applyPatch. TOOLS.md does not control which tools exist; its guidance for how you want them used.

Skills

HanzoBot loads skills from three locations (workspace wins on name conflict):

  • Bundled (shipped with the install)
  • Managed/local: ~/.hanzo-bot/skills
  • Workspace: <workspace>/skills

Skills can be gated by config/env (see skills in Gateway configuration).

pi-mono integration

HanzoBot reuses pieces of the pi-mono codebase (models/tools), but session management, discovery, and tool wiring are HanzoBot-owned.

  • No pi-coding agent runtime.
  • No ~/.pi/agent or <workspace>/.pi settings are consulted.

Sessions

Session transcripts are stored as JSONL at:

  • ~/.hanzo-bot/agents/<agentId>/sessions/<SessionId>.jsonl

The session ID is stable and chosen by HanzoBot. Legacy Pi/Tau session folders are not read.

Steering while streaming

When queue mode is steer, inbound messages are injected into the current run. The queue is checked after each tool call; if a queued message is present, remaining tool calls from the current assistant message are skipped (error tool results with "Skipped due to queued user message."), then the queued user message is injected before the next assistant response.

When queue mode is followup or collect, inbound messages are held until the current turn ends, then a new agent turn starts with the queued payloads. See Queue for mode + debounce/cap behavior.

Block streaming sends completed assistant blocks as soon as they finish; it is off by default (agents.defaults.blockStreamingDefault: "off"). Tune the boundary via agents.defaults.blockStreamingBreak (text_end vs message_end; defaults to text_end). Control soft block chunking with agents.defaults.blockStreamingChunk (defaults to 8001200 chars; prefers paragraph breaks, then newlines; sentences last). Coalesce streamed chunks with agents.defaults.blockStreamingCoalesce to reduce single-line spam (idle-based merging before send). Non-Telegram channels require explicit *.blockStreaming: true to enable block replies. Verbose tool summaries are emitted at tool start (no debounce); Control UI streams tool output via agent events when available. More details: Streaming + chunking.

Model refs

Model refs in config (for example agents.defaults.model and agents.defaults.models) are parsed by splitting on the first /.

  • Use provider/model when configuring models.
  • If the model ID itself contains / (OpenRouter-style), include the provider prefix (example: openrouter/moonshotai/kimi-k2).
  • If you omit the provider, HanzoBot treats the input as an alias or a model for the default provider (only works when there is no / in the model ID).

Configuration (minimal)

At minimum, set:

  • agents.defaults.workspace
  • channels.whatsapp.allowFrom (strongly recommended)

Next: Group Chats 🦞