docs/openclaw-agent-runtime.md
A sane workflow for working on the OpenClaw agent runtime in OpenClaw.
pnpm checkpnpm build when the change can affect build output, packaging, or lazy-loading/module boundariespnpm check && pnpm testRun the agent-runtime test set directly with Vitest:
pnpm test \
"src/agents/agent-*.test.ts" \
"src/agents/embedded-agent-*.test.ts" \
"src/agents/agent-tools*.test.ts" \
"src/agents/agent-settings.test.ts" \
"src/agents/agent-tool-definition-adapter*.test.ts" \
"src/agents/agent-hooks/**/*.test.ts"
To include the live provider exercise:
OPENCLAW_LIVE_TEST=1 pnpm test src/agents/embedded-agent-runner-extraparams.live.test.ts
This covers the main agent runtime unit suites:
src/agents/agent-*.test.tssrc/agents/embedded-agent-*.test.tssrc/agents/agent-tools*.test.tssrc/agents/agent-settings.test.tssrc/agents/agent-tool-definition-adapter.test.tssrc/agents/agent-hooks/*.test.tsRecommended flow:
pnpm gateway:devpnpm openclaw agent --message "Hello" --thinking lowpnpm tuiFor tool call behavior, prompt for a read or exec action so you can see tool streaming and payload handling.
State lives under the OpenClaw state directory. Default is ~/.openclaw. If OPENCLAW_STATE_DIR is set, use that directory instead.
To reset everything:
openclaw.json for configagents/<agentId>/agent/auth-profiles.json for model auth profiles (API keys + OAuth)credentials/ for provider/channel state that still lives outside the auth profile storeagents/<agentId>/sessions/ for agent session historyagents/<agentId>/sessions/sessions.json for the session indexsessions/ if legacy paths existworkspace/ if you want a blank workspaceIf you only want to reset sessions, delete agents/<agentId>/sessions/ for that agent. If you want to keep auth, leave agents/<agentId>/agent/auth-profiles.json and any provider state under credentials/ in place.