Skip to content
Merged
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: anthropic # per-node override (uses node-level provider)
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.

The workflow example uses provider: anthropic, but workflow/node provider only accepts the assistant providers (claude, codex, pi). For Pi, keep provider: pi and set the Anthropic model via model: anthropic/<model-id>; if you intend to use the native Claude client, use provider: claude instead.

Suggested change
provider: anthropic # per-node override (uses node-level provider)
provider: pi # per-node override (uses Pi with the node-level model)

Copilot uses AI. Check for mistakes.
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';
};
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';
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.

defaultAssistant is now typed to include 'pi', but this setup flow only reasons about Claude/Codex (hasClaude/hasCodex) and never offers/configures Pi. Either add Pi detection + selection + config generation, or keep the type here limited to assistants that archon setup can actually configure so the generated config doesn’t imply unsupported values.

Suggested change
let defaultAssistant: 'claude' | 'codex' | 'pi' = 'claude';
let defaultAssistant: 'claude' | 'codex' = 'claude';

Copilot uses AI. Check for mistakes.

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",
"@openai/codex-sdk": "^0.116.0",
"pg": "^8.11.0",
"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'`);
}
}
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