Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 90 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ The Web UI and CLI work out of the box. Optionally connect a chat platform for r
▼ ▼ ▼ ▼
┌───────────┐ ┌────────────┐ ┌──────────────────────────┐
│ Command │ │ Workflow │ │ AI Assistant Clients │
│ Handler │ │ Executor │ │ (Claude / Codex)
│ Handler │ │ Executor │ │ (Claude / Codex / Pi)
│ (Slash) │ │ (YAML) │ │ │
└───────────┘ └────────────┘ └──────────────────────────┘
│ │ │
Expand All @@ -282,6 +282,94 @@ The Web UI and CLI work out of the box. Optionally connect a chat platform for r
└─────────────────────────────────────────────────────────┘
```

## Using Pi.dev as Your AI Backend

[Pi](https://pi.dev) is a multi-provider coding agent that works with Anthropic, OpenAI, Google, and many other LLM providers. Archon integrates Pi as a first-class AI assistant alongside Claude and Codex.

### Why Pi?

- **Multi-provider** — One integration, many models: Anthropic, OpenAI, Google Gemini, OpenRouter, Mistral, and more
- **Same tools** — Pi uses the same file tools (read, bash, edit, write) as Claude Code
- **No vendor lock-in** — Swap models without changing your workflows

### Setup

**1. Install Pi**

```bash
npm install -g @mariozechner/pi-coding-agent
```

**2. Authenticate with your LLM provider**

Pi reads API keys from environment variables. Set the key for your chosen provider:

```bash
# Anthropic (Claude models)
export ANTHROPIC_API_KEY=sk-ant-...

# OpenAI (GPT models, Codex)
export OPENAI_API_KEY=sk-...

# Google (Gemini models)
export GOOGLE_API_KEY=AIza...

# Or log in interactively (OAuth for supported providers)
pi /login
```

**3. Set Pi as the default assistant in `.archon/config.yaml`**

```yaml
# ~/.archon/config.yaml (global) or .archon/config.yaml (per-repo)
defaultAssistant: pi

assistants:
pi:
model: anthropic/claude-opus-4-5 # provider/model-id format
```

Model format is `provider/model-id`. Omit `model` to let Pi auto-select based on available API keys.

**Supported providers and example model strings:**

| Provider | Example `model` value |
|----------|----------------------|
| Anthropic | `anthropic/claude-opus-4-5` |
| OpenAI | `openai/gpt-4o` |
| Google | `google/gemini-2.5-pro` |
| OpenRouter | `openrouter/openai/gpt-5.1-codex` |
| Mistral | `mistral/devstral-medium-latest` |
| Azure OpenAI | `azure-openai-responses/gpt-5.2` |

### Using Pi in Workflows

Set `provider: pi` on a workflow or individual node:

```yaml
# .archon/workflows/my-workflow.yaml
provider: pi
model: openai/gpt-4o # optional — falls back to config default

nodes:
- id: plan
prompt: "Explore the codebase and create an implementation plan"

- id: implement
depends_on: [plan]
provider: pi # per-node override (uses Pi backend)
model: anthropic/claude-opus-4-5
prompt: "Implement the plan"
```

> **Note:** Claude-specific features (hooks, MCP servers, skills, structured output) are silently skipped when using `provider: pi`. Pi workflows use the standard read/bash/edit/write tool set.

### Environment Variable Override

```bash
DEFAULT_AI_ASSISTANT=pi bun run dev
```

## Documentation

Full documentation is available at **[archon.diy](https://archon.diy)**.
Expand All @@ -294,7 +382,7 @@ Full documentation is available at **[archon.diy](https://archon.diy)**.
| [Authoring Workflows](https://archon.diy/guides/authoring-workflows/) | Create custom YAML workflows |
| [Authoring Commands](https://archon.diy/guides/authoring-commands/) | Create reusable AI commands |
| [Configuration](https://archon.diy/reference/configuration/) | All config options, env vars, YAML settings |
| [AI Assistants](https://archon.diy/getting-started/ai-assistants/) | Claude and Codex setup details |
| [AI Assistants](https://archon.diy/getting-started/ai-assistants/) | Claude, Codex, and Pi setup details |
| [Deployment](https://archon.diy/deployment/) | Docker, VPS, production setup |
| [Architecture](https://archon.diy/reference/architecture/) | System design and internals |
| [Troubleshooting](https://archon.diy/reference/troubleshooting/) | Common issues and fixes |
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface SetupConfig {
claudeOauthToken?: string;
codex: boolean;
codexTokens?: CodexTokens;
defaultAssistant: 'claude' | 'codex';
defaultAssistant: 'claude' | 'codex' | 'pi';
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

pi is typed as selectable, but the setup wizard cannot actually select/configure it.

defaultAssistant now includes 'pi', but collectAIConfig() only offers Claude/Codex. This leaves setup unable to produce a Pi-first configuration through the intended flow.

Please either add a Pi option/branch in the assistant selection flow, or defer this union widening until the wizard supports it end-to-end.

Also applies to: 680-680

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/commands/setup.ts` at line 48, The type union for
defaultAssistant includes 'pi' but the setup flow in collectAIConfig only offers
'claude' and 'codex', causing an impossible selection; either remove 'pi' from
the defaultAssistant type or add a selectable/configuration branch for Pi in the
wizard. Locate the defaultAssistant declaration and the collectAIConfig function
(assistant selection logic) and either (A) revert the union to 'claude' |
'codex' to match the UI, or (B) add a 'pi' option in the assistant selection
prompt and implement the Pi-specific configuration branch (prompt fields,
validation, and returned config) so the wizard can produce a Pi-first
configuration end-to-end.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

};
platforms: {
github: boolean;
Expand Down Expand Up @@ -677,7 +677,7 @@ After upgrading, run 'archon setup' again.`,
}

// Determine default assistant
let defaultAssistant: 'claude' | 'codex' = 'claude';
let defaultAssistant: 'claude' | 'codex' | 'pi' = 'claude';

if (hasClaude && hasCodex) {
const defaultChoice = await select({
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@archon/isolation": "workspace:*",
"@archon/paths": "workspace:*",
"@archon/workflows": "workspace:*",
"@mariozechner/pi-coding-agent": "^0.66.1",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update lockfiles when adding Pi SDK dependency

A new direct dependency is added here, but neither bun.lock nor package-lock.json is updated in the commit. This breaks reproducible installs in CI because .github/workflows/test.yml installs with bun install --frozen-lockfile, and Bun's help explicitly says --frozen-lockfile disallows lockfile changes; with manifest/lock drift, dependency installation will fail before tests run.

Useful? React with 👍 / 👎.

"@openai/codex-sdk": "^0.116.0",
"pg": "^8.11.0",
Comment on lines 33 to 38
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency was added but the repo’s lockfiles don’t appear to be updated (no pi-coding-agent entry in bun.lock or package-lock.json). This can break reproducible installs/CI. Please regenerate and commit the lockfile updates for the package manager(s) this repo uses.

Copilot uses AI. Check for mistakes.
"zod": "^3"
Expand Down
10 changes: 7 additions & 3 deletions packages/core/src/clients/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* AI Assistant Client Factory
*
* Dynamically instantiates the appropriate AI assistant client based on type string.
* Supports Claude and Codex assistants.
* Supports Claude, Codex, and Pi assistants.
*/
import type { IAssistantClient } from '../types';
import { ClaudeClient } from './claude';
import { CodexClient } from './codex';
import { PiClient } from './pi';
import { createLogger } from '@archon/paths';

/** Lazy-initialized logger (deferred so test mocks can intercept createLogger) */
Expand All @@ -19,7 +20,7 @@ function getLog(): ReturnType<typeof createLogger> {
/**
* Get the appropriate AI assistant client based on type
*
* @param type - Assistant type identifier ('claude' or 'codex')
* @param type - Assistant type identifier ('claude', 'codex', or 'pi')
* @returns Instantiated assistant client
* @throws Error if assistant type is unknown
*/
Expand All @@ -31,7 +32,10 @@ export function getAssistantClient(type: string): IAssistantClient {
case 'codex':
getLog().debug({ provider: 'codex' }, 'client_selected');
return new CodexClient();
case 'pi':
getLog().debug({ provider: 'pi' }, 'client_selected');
return new PiClient();
default:
throw new Error(`Unknown assistant type: ${type}. Supported types: 'claude', 'codex'`);
throw new Error(`Unknown assistant type: ${type}. Supported types: 'claude', 'codex', 'pi'`);
}
Comment on lines +35 to 40
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory error message and supported-type list changed to include pi, but existing unit tests still assert the old message (“Supported types: 'claude', 'codex'”) and there’s no coverage for the new pi branch. Update/add tests accordingly so CI doesn’t fail and the new provider is covered.

Copilot uses AI. Check for mistakes.
}
1 change: 1 addition & 0 deletions packages/core/src/clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

export { ClaudeClient } from './claude';
export { CodexClient } from './codex';
export { PiClient } from './pi';
export { getAssistantClient } from './factory';

// Re-export types for consumers importing from this submodule directly
Expand Down
Loading