---
title: "Pi Development Workflow"
---

# Pi Development Workflow

This guide summarizes a sane workflow for working on the pi integration in SKYKOI.

## Type Checking and Linting

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

## Running Pi Tests

Use the dedicated script for the pi integration test set:

```bash
scripts/pi/run-tests.sh
```

To include the live test that exercises real provider behavior:

```bash
scripts/pi/run-tests.sh --live
```

The script runs all pi related unit tests via these globs:

- `src/koi/pi-*.test.ts`
- `src/koi/pi-embedded-*.test.ts`
- `src/koi/pi-tools*.test.ts`
- `src/koi/pi-settings.test.ts`
- `src/koi/pi-tool-definition-adapter.test.ts`
- `src/koi/pi-extensions/*.test.ts`

## Manual Testing

Recommended flow:

- Run the gateway in dev mode:
  - `pnpm gateway:dev`
- Trigger the koi directly:
  - `pnpm SKYKOI koi --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 see tool streaming and payload handling.

## Clean Slate Reset

State lives under the SKYKOI state directory. Default is `~/.SKYKOI`. If `SKYKOI_STATE_DIR` is set, use that directory instead.

To reset everything:

- `SKYKOI.json` for config
- `credentials/` for auth profiles and tokens
- `kois/<koiId>/sessions/` for koi session history
- `kois/<koiId>/sessions.json` for the session index
- `sessions/` if legacy paths exist
- `workspace/` if you want a blank workspace

If you only want to reset sessions, delete `kois/<koiId>/sessions/` and `kois/<koiId>/sessions.json` for that koi. Keep `credentials/` if you do not want to reauthenticate.

## References

- [https://docs.SKYKOI.com/testing](https://docs.SKYKOI.com/testing)
- [https://docs.SKYKOI.com/start/getting-started](https://docs.SKYKOI.com/start/getting-started)
