Skip to content

Commit 246d594

Browse files
committed
add pi coding agent adapter (fixes #4)
1 parent 361fa6f commit 246d594

5 files changed

Lines changed: 142 additions & 6 deletions

File tree

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Follow me on [@AV1DLIVE](https://twitter.com/AV1DLIVE) for updates/collabs on pr
1010
1111
> **One brain, many harnesses.** A portable `.agent/` folder (memory + skills
1212
> + protocols) that plugs into Claude Code, Cursor, Windsurf, OpenCode,
13-
> OpenClient, Hermes, or a DIY Python loop, and keeps its knowledge when
14-
> you switch.
13+
> OpenClient, Hermes, Pi Coding Agent, or a DIY Python loop, and keeps
14+
> its knowledge when you switch.
1515
1616
<p align="center">
1717
<img src="docs/demo.gif" alt="agentic-stack demo" width="880"/>
@@ -32,7 +32,7 @@ Based on the article:
3232
Every guide shows the folder structure. This repo gives you the folder
3333
structure **plus the files that actually go inside**: a working portable
3434
brain with five seed skills, four memory layers, enforced permissions, a
35-
nightly staging cycle, host-agent review tools, and adapters for seven
35+
nightly staging cycle, host-agent review tools, and adapters for eight
3636
harnesses.
3737

3838
- **Memory**`working/`, `episodic/`, `semantic/`, `personal/`. Each
@@ -79,7 +79,7 @@ brew install agentic-stack
7979
# drop the brain into any project — the onboarding wizard runs automatically
8080
cd your-project
8181
agentic-stack claude-code
82-
# or: cursor | windsurf | opencode | openclient | hermes | standalone-python
82+
# or: cursor | windsurf | opencode | openclient | hermes | pi | standalone-python
8383
```
8484

8585
### Windows (PowerShell)
@@ -103,6 +103,7 @@ brew update && brew upgrade agentic-stack
103103
git clone https://github.com/codejunkie99/agentic-stack.git
104104
cd agentic-stack && ./install.sh claude-code # mac / linux / git-bash
105105
# or on Windows PowerShell: .\install.ps1 claude-code
106+
# adapters: claude-code | cursor | windsurf | opencode | openclient | hermes | pi | standalone-python
106107
```
107108

108109
## Onboarding wizard
@@ -209,6 +210,7 @@ adapters/ # one small shim per harness
209210
├── opencode/ (AGENTS.md + opencode.json)
210211
├── openclient/ (system-prompt include)
211212
├── hermes/ (AGENTS.md)
213+
├── pi/ (AGENTS.md + .pi/skills symlink)
212214
└── standalone-python/ (DIY conductor entrypoint)
213215
214216
docs/ # architecture, getting-started, per-harness
@@ -232,6 +234,7 @@ onboard_write.py # atomic file write with backup
232234
| **OpenCode** | `AGENTS.md` + `opencode.json` | partial (permission rules) |
233235
| **OpenClient** | system-prompt include | varies by fork |
234236
| **Hermes Agent** | `AGENTS.md` (agentskills.io compatible) | partial (own memory) |
237+
| **Pi Coding Agent** | `AGENTS.md` + `.pi/skills/` | no (extension system) |
235238
| **Standalone Python** | `run.py` (any LLM) | yes (full control) |
236239

237240
## Seed skills

adapters/pi/AGENTS.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AGENTS.md — Pi Coding Agent adapter for agentic-stack
2+
3+
[Pi Coding Agent](https://github.com/badlogic/pi-mono) reads `AGENTS.md`
4+
(or `CLAUDE.md`) natively as workspace-level context. This file points
5+
it at the portable brain in `.agent/`.
6+
7+
## Startup (read in order)
8+
1. `.agent/AGENTS.md` — the map
9+
2. `.agent/memory/personal/PREFERENCES.md` — user conventions
10+
3. `.agent/memory/semantic/LESSONS.md` — distilled lessons
11+
4. `.agent/protocols/permissions.md` — hard rules
12+
13+
## Skills
14+
Pi scans `.pi/skills/` and `.agents/skills/` for skill packages. The
15+
install script symlinks `.pi/skills``.agent/skills` so every skill
16+
under the portable brain is visible to pi without duplication. Pi's
17+
skill format (frontmatter + body) is compatible with ours out of the
18+
box.
19+
20+
## Memory discipline
21+
- Update `.agent/memory/working/WORKSPACE.md` as you work.
22+
- After significant actions, run
23+
`python3 .agent/tools/memory_reflect.py <skill> <action> <outcome>`.
24+
- Never delete memory entries; archive only.
25+
26+
## Hard rules
27+
- No force push to `main`, `production`, `staging`.
28+
- No modification of `.agent/protocols/permissions.md`.
29+
30+
## Pi-specific extensions
31+
- System prompt override: put `.pi/SYSTEM.md` at project root if you
32+
want to replace pi's default system prompt entirely.
33+
- Prompt templates go in `.pi/prompts/`.
34+
- TypeScript extensions go in `.pi/extensions/` (advanced).

adapters/pi/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Pi Coding Agent adapter
2+
3+
[Pi Coding Agent](https://github.com/badlogic/pi-mono) by Mario Zechner
4+
is a minimalist terminal coding harness with multi-provider LLM support
5+
and an extension system. Our adapter layers the portable `.agent/` brain
6+
on top so you keep one knowledge base even if you later swap harnesses.
7+
8+
## Install
9+
```bash
10+
./install.sh pi
11+
```
12+
13+
Then install pi itself:
14+
```bash
15+
npm install -g @mariozechner/pi-coding-agent
16+
```
17+
18+
## What it wires up
19+
- `AGENTS.md` — pi reads this natively as workspace-level context.
20+
Points at `.agent/`. **Skipped if `AGENTS.md` already exists**
21+
(e.g. from the hermes or opencode adapter — pi reads the same file,
22+
so you don't need a second copy).
23+
- `.pi/skills/` → symlink to `.agent/skills/`. Pi scans this path at
24+
startup. Symlink means there's one source of truth; customize under
25+
`.agent/skills/` and pi sees it immediately.
26+
- `.pi/` directory is created even if empty — ready for optional pi
27+
extensions, prompt templates, and `.pi/SYSTEM.md` overrides.
28+
29+
## Coexisting with other adapters
30+
Pi, hermes, and opencode all read `AGENTS.md`. You can install any
31+
combination — only the first one to run writes the root `AGENTS.md`;
32+
subsequent installs are no-ops on that file.
33+
34+
## Verify
35+
In pi: ask "what's in my LESSONS file?" — it should read
36+
`.agent/memory/semantic/LESSONS.md`.
37+
38+
## Optional
39+
If pi's default system prompt doesn't fit your workflow, drop a
40+
`.pi/SYSTEM.md` at project root. Pi uses it as a complete override.

docs/per-harness/pi.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Pi Coding Agent setup
2+
3+
[Pi Coding Agent](https://github.com/badlogic/pi-mono) (by Mario
4+
Zechner) is a minimalist terminal coding harness with 15+ LLM providers
5+
and a TypeScript extension system. Our adapter layers the portable
6+
`.agent/` brain on top so you keep one knowledge base across harnesses.
7+
8+
## What the adapter installs
9+
- `AGENTS.md` at project root (pi reads this natively). Skipped if one
10+
already exists, since pi/hermes/opencode share this file.
11+
- `.pi/` directory
12+
- `.pi/skills` symlinked to `.agent/skills` (falls back to copy on
13+
platforms without symlinks, e.g. Windows without developer mode)
14+
15+
## Install
16+
```bash
17+
./install.sh pi
18+
npm install -g @mariozechner/pi-coding-agent
19+
pi
20+
```
21+
22+
## How it works
23+
- Pi loads `AGENTS.md` (or `CLAUDE.md`) from `~/.pi/agent/` and walks
24+
the current directory up to the filesystem root, aggregating
25+
context.
26+
- Skills at `.pi/skills/<name>/SKILL.md` use the same frontmatter-plus
27+
-body shape as agentskills.io and our `.agent/skills/` layout.
28+
- Pi extensions live in `.pi/extensions/` (TypeScript, optional).
29+
30+
## Troubleshooting
31+
- If pi doesn't see your skills, run `pi skills list` — it should
32+
print entries from `.pi/skills/`. If the directory is a broken
33+
symlink, re-run `./install.sh pi` to rebuild.
34+
- On Windows without symlink support, the installer copies
35+
`.agent/skills/` instead. Changes to `.agent/skills/` won't
36+
propagate — re-run the installer to sync.
37+
- Pi's multi-provider gateway is independent of the brain. The
38+
portable `.agent/` doesn't care which model you use.

install.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
# install.sh — copy an adapter into the consuming project, then run the onboarding wizard
33
# Usage: ./install.sh <adapter-name> [target-dir] [--yes] [--reconfigure]
4-
# adapter-name: claude-code | cursor | windsurf | opencode | openclient | hermes | standalone-python
4+
# adapter-name: claude-code | cursor | windsurf | opencode | openclient | hermes | pi | standalone-python
55
# target-dir: where your project lives (default: current dir)
66
# --yes accept all wizard defaults without prompting (safe for CI)
77
# --reconfigure re-run the wizard even if PREFERENCES.md is already filled
@@ -13,7 +13,7 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
1313

1414
if [[ -z "$ADAPTER" ]]; then
1515
echo "usage: $0 <adapter-name> [target-dir]" >&2
16-
echo "adapters: claude-code cursor windsurf opencode openclient hermes standalone-python" >&2
16+
echo "adapters: claude-code cursor windsurf opencode openclient hermes pi standalone-python" >&2
1717
exit 2
1818
fi
1919

@@ -64,6 +64,27 @@ case "$ADAPTER" in
6464
hermes)
6565
cp "$SRC/AGENTS.md" "$TARGET/AGENTS.md"
6666
;;
67+
pi)
68+
# pi, hermes, and opencode all read AGENTS.md — don't stomp an existing one
69+
if [[ -f "$TARGET/AGENTS.md" ]]; then
70+
echo " ~ $TARGET/AGENTS.md already exists — skipping (pi reads whatever is there)"
71+
else
72+
cp "$SRC/AGENTS.md" "$TARGET/AGENTS.md"
73+
echo " + AGENTS.md"
74+
fi
75+
mkdir -p "$TARGET/.pi"
76+
# symlink .pi/skills -> .agent/skills so pi sees the one true skill tree.
77+
# ln -sfn atomically replaces an existing symlink; fall back to cp -R
78+
# on filesystems that don't support symlinks (e.g. Windows without dev mode).
79+
SKILLS_SRC="$(cd "$TARGET/.agent/skills" && pwd)"
80+
if ln -sfn "$SKILLS_SRC" "$TARGET/.pi/skills" 2>/dev/null; then
81+
echo " + .pi/skills -> $SKILLS_SRC"
82+
else
83+
rm -rf "$TARGET/.pi/skills"
84+
cp -R "$SKILLS_SRC" "$TARGET/.pi/skills"
85+
echo " + .pi/skills (copy; symlink not supported here)"
86+
fi
87+
;;
6788
standalone-python)
6889
cp "$SRC/run.py" "$TARGET/run.py"
6990
;;

0 commit comments

Comments
 (0)