openclaw/docs/openclaw-agent-runtime.md
Vincent Koc 47ff7bfb11
docs: close remaining cross-link gaps across concepts, gateway, and security (#143923)
Adds the missing reciprocal links and one mis-targeted link fix for the
last open `link` audit findings.

- Related back-links: system prompt (context engine, timezone), diagnostics
  flags (gateway diagnostics, gateway troubleshooting), cloud workers
  (operator scopes), auth credential semantics (secrets, auth storage),
  agent runtime architecture (agent runtimes), agent runtime workflow
  (testing), network (remote access, architecture), threat model (gateway
  security index, network proxy), backups/updating/doctor (database schemas).
- docs/security/network-proxy.md gains a Related section.
- docs/security/incident-response.md links back to the three sibling pages
  that already link to it.
- docs/concepts/typing-indicators.md links the heartbeat and groups pages
  that its Defaults section describes.
- docs/diagnostics/flags.md links the environment-variable reference from
  the timeline section that names three OPENCLAW_DIAGNOSTICS_* variables.
- docs/concepts/main-session.md names `session.maintenance.maxDiskBytes` and
  links the maintenance reference instead of stating a bare 10 GB default.
- docs/network.md pointed its "Gateway config reference" entry at
  /gateway/configuration; retargeted to /gateway/configuration-reference.
- docs/openclaw-agent-runtime.md merges its References list into Related and
  keeps the old `#references` anchor as a stub.
- Six zh-CN glossary sources added beside their related existing terms.
2026-09-10 18:34:34 +08:00

3.5 KiB

summary title read_when
Developer workflow for OpenClaw agent runtime: build, test, and live validation OpenClaw agent runtime workflow
Working on OpenClaw agent runtime code or tests
Running agent-runtime lint, typecheck, and live test flows

Developer workflow for the agent runtime (src/agents/) in the OpenClaw repo.

Type checking and linting

  • Default local gate: pnpm check (typecheck, lint, policy guards)
  • Build gate: pnpm build when the change can affect build output, packaging, or lazy-loading/module boundaries
  • Full pre-push gate: pnpm build && pnpm check && pnpm check:test-types && pnpm test

Running Agent Runtime Tests

Run the agent runtime unit suites:

pnpm test \
  "src/agents/agent-*.test.ts" \
  "src/agents/embedded-agent-*.test.ts" \
  "src/agents/agent-hooks/**/*.test.ts"

The first glob also covers the agent-tools*, agent-settings, and agent-tool-definition-adapter* suites.

Live tests are excluded from the unit config; run them through the live wrapper (sets OPENCLAW_LIVE_TEST=1 and needs provider credentials):

pnpm test:live src/agents/embedded-agent-runner-extraparams.live.test.ts

Manual testing

  • Run the Gateway in dev mode (skips channel connections via OPENCLAW_SKIP_CHANNELS=1): pnpm gateway:dev
  • Trigger one agent turn through the Gateway: pnpm openclaw agent --message "Hello" --thinking low
  • Use the TUI for interactive debugging: pnpm tui

For tool call behavior, prompt for a read or exec action so you can watch tool streaming and payload handling.

Clean slate reset

State lives in the OpenClaw state directory: ~/.openclaw by default, or $OPENCLAW_STATE_DIR when set. Paths relative to that directory:

Path Holds
openclaw.json Config
state/openclaw.sqlite Shared runtime state database
agents/<agentId>/agent/openclaw-agent.sqlite Per-agent model auth profiles (API keys + OAuth) and runtime state
credentials/ Provider/channel credentials outside the auth profile store
agents/<agentId>/sessions/ Transcript history and legacy session migration sources
sessions/ Legacy single-agent session store (old installs only)
workspace/ Default agent workspace (extra agents use workspace-<agentId>)

Delete those paths for a full reset. Narrower resets:

  • Sessions only: do not delete agents/<agentId>/agent/openclaw-agent.sqlite; session rows live there alongside other per-agent state. Use /new or /reset to start a fresh session for one chat, and openclaw sessions cleanup for session maintenance.
  • Keep auth: leave agents/<agentId>/agent/openclaw-agent.sqlite and credentials/ in place.

Legacy auth-profiles.json files are no longer read at runtime; openclaw doctor --fix imports them into the SQLite store.