CLI & example apps
The tiny CLI, the reference app, and the Electron demo
The monorepo ships three runnable consumers of the SDK — use them as living documentation.
Tiny CLI
Interactive coding-agent session with the first installed provider:
pnpm cliOr pick a provider and send an initial task:
pnpm cli -- --provider codex "fix the failing tests"Flags: -p/--provider, -C/--cwd, -m/--mode <read-only|ask|accept-edits|full-auto> (default ask), --model.
Inside the REPL:
| Command | Effect |
|---|---|
/switch claude | Change agents. Each provider's conversation stays live while parked — switching back restores its session. |
/model opus | Change the active provider's model; selections are remembered per provider. |
/providers | Show availability. |
/new | Reset only the active conversation. |
/status, /clear, /help, /exit | The usual. |
The CLI asks before privileged actions by default. Ctrl-C interrupts the active turn first, quits second.
Reference app
apps/reference exercises the core API end to end:
pnpm --filter klein-kit-reference start detect
pnpm --filter klein-kit-reference start chat codex "explain this repo"
pnpm --filter klein-kit-reference start pipeline "add a health endpoint"It also hosts the live smoke suite — one real turn per provider in a temp dir (uses real quota):
pnpm --filter klein-kit-reference smoke # all providers
pnpm --filter klein-kit-reference smoke codex pi # a subsetElectron demo
apps/demo-ui-app is a React chat UI over the SDK:
pnpm demo-uiThe main process owns sessions and pumps AgentEvents to the renderer — its src/shared/ipc.ts is a good reference for exposing Klein Kit over an IPC or HTTP boundary.