Skip to content

Optimize OpenClaw Pi Development: Build and Test Workflow

Ever feel like your development workflow is a bit of a mess? We’ve all been there—juggling tests, linting errors, and state issues while trying to get a feature out the door. It’s frustrating when you just want to focus on the code but spend half your time fighting the environment.

Getting the Pi integration right in OpenClaw requires a bit of a rhythm. This guide covers a sane way to handle your daily tasks without losing your mind.

Before you commit anything, you should make sure the basics are covered. You don’t want the CI to fail because of a missing semicolon or a type mismatch. Use these commands to keep your code clean:

  • Type check and build: pnpm build
  • Lint: pnpm lint
  • Format check: pnpm format
  • Full gate before pushing: pnpm lint && pnpm build && pnpm test

When you are working specifically on Pi, you don’t need to run the entire project’s test suite. You can run the Pi-focused test set directly with Vitest:

Terminal window
pnpm test -- \
"src/agents/pi-*.test.ts" \
"src/agents/pi-embedded-*.test.ts" \
"src/agents/pi-tools*.test.ts" \
"src/agents/pi-settings.test.ts" \
"src/agents/pi-tool-definition-adapter*.test.ts" \
"src/agents/pi-hooks/**/*.test.ts"

If you need to include the live provider exercise, use this command:

Terminal window
OPENCLAW_LIVE_TEST=1 pnpm test -- src/agents/pi-embedded-runner-extraparams.live.test.ts

This covers the main Pi unit suites:

  • src/agents/pi-*.test.ts
  • src/agents/pi-embedded-*.test.ts
  • src/agents/pi-tools*.test.ts
  • src/agents/pi-settings.test.ts
  • src/agents/pi-tool-definition-adapter.test.ts
  • src/agents/pi-hooks/*.test.ts

Sometimes automated tests aren’t enough, and you need to see how things feel in practice. Here is a recommended flow for manual testing:

  • Start by running the gateway in dev mode (pnpm gateway:dev) and triggering the agent directly (pnpm openclaw agent --message "Hello" --thinking low).
  • Use the TUI (pnpm tui) for interactive debugging when you need to step through the process.

For tool call behavior, you should prompt for a read or exec action. This lets you see how tool streaming and payload handling work in real-time.

If things get weird, you might need to clear

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.