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
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Let your AI coding agent talk to other AI coding agents.

x-agent is a set of [agentskills.io](https://agentskills.io) skills that enable any AI CLI tool — Codex, Cursor, Claude
Code, Gemini CLI, Junie, Qwen Code, OpenCode — to delegate tasks to or get second opinions from the others. Install it once, and your agent
gains the ability to call any of the other six.
Code, Gemini CLI, Junie, Qwen Code, OpenCode, Pi — to delegate tasks to or get second opinions from the others. Install it once, and your agent
gains the ability to call any of the other seven.

## Why

Expand Down Expand Up @@ -42,6 +42,7 @@ adds a round-trip to another CLI, so use it when the extra signal is worth the t
| Junie | `junie` | Junie default | LLM-agnostic, BYOK support |
| Qwen Code | `qwen` | Qwen default | Qwen model family, `--yolo` for auto-approve |
| OpenCode | `opencode` | OpenCode default | Multi-provider, uses `run` subcommand with auto-approval |
| Pi | `pi` | `sonnet` | Multi-provider, minimal terminal coding harness |

## How to use it

Expand Down Expand Up @@ -117,7 +118,7 @@ git clone https://github.com/darshitpp/x-agent.git .claude/skills/x-agent
```

After installation, the skills appear automatically in Claude Code's available skills list. Each CLI has its own skill (
`codex`, `cursor`, `claude`, `gemini`, `junie`, `qwen`, `opencode`) that triggers based on context.
`codex`, `cursor`, `claude`, `gemini`, `junie`, `qwen`, `opencode`, `pi`) that triggers based on context.

To update later:

Expand All @@ -142,6 +143,7 @@ x-agent/
├── junie/SKILL.md # Thin entry point (~27 lines)
├── qwen/SKILL.md # Thin entry point (~27 lines)
├── opencode/SKILL.md # Thin entry point (~27 lines)
├── pi/SKILL.md # Thin entry point (~20 lines)
├── references/
│ ├── shared-procedure.md # Core procedure (~105 lines)
│ ├── cli-codex.md # Codex CLI identity, invocation, version matrix
Expand All @@ -150,7 +152,8 @@ x-agent/
│ ├── cli-gemini.md # Gemini CLI identity, invocation, version matrix
│ ├── cli-junie.md # Junie CLI identity, invocation, version matrix
│ ├── cli-qwen.md # Qwen Code CLI identity, invocation, version matrix
│ └── cli-opencode.md # OpenCode CLI identity, invocation, version matrix
│ ├── cli-opencode.md # OpenCode CLI identity, invocation, version matrix
│ └── cli-pi.md # Pi CLI identity, invocation, version matrix
├── scripts/
│ ├── validate-metadata.py # Validates SKILL.md frontmatter (authoring + CI)
│ ├── query-cli.sh # Maintainer-only CLI wrapper (not used by skills at runtime)
Expand Down Expand Up @@ -241,7 +244,7 @@ a `SKILL.md` entry point.
| Project | `.claude/skills/x-agent/` |

**Invoke:** Ask naturally ("get a second opinion from Cursor") or explicitly with `/codex`, `/cursor`, `/claude`,
`/gemini`, `/junie`, `/qwen`, `/opencode`. Claude loads the skill automatically when relevant.
`/gemini`, `/junie`, `/qwen`, `/opencode`, `/pi`. Claude loads the skill automatically when relevant.

[Claude Code skills docs](https://code.claude.com/docs/en/skills)

Expand Down
2 changes: 1 addition & 1 deletion assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion claude/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion claude/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
2 changes: 1 addition & 1 deletion codex/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion codex/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
2 changes: 1 addition & 1 deletion cursor/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion cursor/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
2 changes: 1 addition & 1 deletion gemini/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion gemini/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
2 changes: 1 addition & 1 deletion junie/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion junie/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
2 changes: 1 addition & 1 deletion opencode/assets/result-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
2 changes: 1 addition & 1 deletion opencode/references/shared-procedure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Delegation mode uses lighter context — task description and relevant file path
| Version not in matrix | Use latest known version's flags, warn user |
| Host model family undetectable | Prefer models from a different provider than target CLI's default |
| CLI execution timeout (>120s) | Kill process, report timeout, suggest simpler prompt or different model |
| Unrecognized model name | Classify as Balanced, proceed normally |
| Unrecognized model name | Classify as Balanced, proceed normally |
20 changes: 20 additions & 0 deletions pi/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: pi
description: Delegate tasks or get a second opinion from Pi CLI. Infers mode (delegation vs validation) from prompt context. Detects available models at runtime via the CLI. Use when cross-validating code, plans, or architecture with Pi, or offloading work to it. Do not use when already running inside Pi CLI or for tasks that do not benefit from cross-model input.
---

# Cross-Agent Task Runner — Pi CLI

## Procedures

**Step 1: Self-Call Detection**

1. Check for `PI_AGENT` environment variable or `pi` in process ancestry.
2. If detected, stop and inform the user:
"Cannot invoke Pi from within Pi. Use a different target CLI."

**Step 2: Execute Shared Procedure**

1. Read `references/shared-procedure.md` for the core workflow (mode inference, context gathering, prompt construction, result presentation).
2. Read `references/cli-pi.md` for Pi-specific flags, model selection heuristics, and version compatibility matrix.
3. Follow the shared procedure using the Pi-specific details.
42 changes: 42 additions & 0 deletions pi/assets/result-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- VALIDATION MODE TEMPLATE -->

## Cross-Model Validation

**Target CLI:** `<cli-name>`
**Model:** `<model-id>` (<selection-reason>)
**Review type:** `<plan|code|architecture|general>`
**Mode:** validation

### Second Opinion

<Target model's key findings. Quote directly where precise.>

### Agreement

<Points where host agent agrees, with reasoning.>

### Counterpoints

<Points where host agent disagrees or finds low-signal. Explain reasoning.>

### Synthesis

<Recommended action based on both perspectives.>

<!-- DELEGATION MODE TEMPLATE -->

## Delegated Task Result

**Target CLI:** `<cli-name>`
**Model:** `<model-id>` (<selection-reason>)
**Mode:** delegation

### Result

<Target CLI's output, presented directly.>

### Notes

<Brief commentary only if output needs clarification. Otherwise omit this section.>

<!-- Note: Templates use ## (h2) headers. Adjust header depth to fit the host agent's current output context. -->
31 changes: 31 additions & 0 deletions pi/references/cli-pi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Pi CLI Reference

## 1. CLI Identity & Invocation

- **Command:** `pi`
- **Non-interactive flag:** `-p` / `--print`
- **Output format flag:** `--output-format text|json|stream-json`
- **Trust/auto-approve flag:** `--dangerously-skip-permissions`
- **List models command:** `pi --list-models 2>&1` (if available) or infer from `pi --help`
- **Self-call detection:** Check for `PI_AGENT` environment variable or `pi` in process ancestry

## 2. Model Selection Heuristic

- **Default model (fallback):** `sonnet` (alias for claude-sonnet-4-6)
- **Aliases:** `opus` → claude-opus-4-6, `sonnet` → claude-sonnet-4-6, `haiku` → claude-haiku-4-5
- **Quirks:** Model can also be set via `ANTHROPIC_MODEL` env var. Supports `--fallback-model` for overload scenarios.

## 3. Invocation Template

| Mode | Command |
|----------------|------------------------------------------------------------------------|
| **Validation** | `cat "$PROMPT_FILE" \| pi -p --model <model> --output-format text` |
| **Delegation** | `cat "$PROMPT_FILE" \| pi -p --model <model> --output-format text` |

Note: Pi validation and delegation use the same invocation — no separate trust flag needed for print mode.

## 4. Version Compatibility Matrix

| Version | Print Flag | Model Flag | Output Format | Notes |
|---------|------------------|------------|-------------------------------------------|---------|
| 2.1.x | `-p` / `--print` | `--model` | `--output-format text\|json\|stream-json` | Current |
Loading
Loading