Skip to content

Add Pi coding agent as a supported host#1220

Closed
qwadratic wants to merge 9 commits intogarrytan:mainfrom
qwadratic:pi-host-support
Closed

Add Pi coding agent as a supported host#1220
qwadratic wants to merge 9 commits intogarrytan:mainfrom
qwadratic:pi-host-support

Conversation

@qwadratic
Copy link
Copy Markdown

@qwadratic qwadratic commented Apr 26, 2026

Adds Pi as a supported host. Follows the Adding a Host guide and existing patterns.

Changes (8 files, +101/-8)

File What
hosts/pi.ts Pi host adapter config (~74 lines)
hosts/index.ts Register in ALL_HOST_CONFIGS + re-exports
.gitignore Add .pi/ (generated output, gitignored)
README.md Add Pi row to host table
setup Add --host pi companion installer instructions
scripts/gen-skill-docs.ts Pi-only fix: frontmatter name: must match directory name
test/host-config.test.ts Bump host count assertion 10→11

Host adapter config

Config Value
paths .pi/agent/skills/gstack (global), .pi/skills/gstack (local)
frontmatter allowlist: name + description only
path rewrites .claude/skills/.pi/agent/skills/, Claude CodePi, CLAUDE.mdAGENTS.md
tool rewrites AskUserQuestionask_user, WebSearchweb_search, Agent toolsubagent (5 variants), Grep tool, Skill toolRead the skill file, ExitPlanMode/plan (toggle off)
suppressed resolvers none (follows the Hermes pattern, graceful degradation)
skipped skills codex
linking strategy symlink-generated
learnings mode basic

Generator fix (Pi-only)

Pi requires the frontmatter name: to match the parent directory. Templates use short names (ship) but Pi emits into gstack-ship/. Added a Pi-scoped rewrite in processExternalHost() so name: shipname: gstack-ship only when host === 'pi'. Other external hosts are unaffected.

Verification

  • bun test test/host-config.test.ts test/gen-skill-docs.test.ts test/skill-validation.test.ts768 pass, 0 fail
  • bun run gen:skill-docs --host pi → 43 skills generated, no .claude path leakage
  • bun run skill:check → all Pi generated files fresh ✅
  • grep -r '.claude/skills' .pi/skills/no results (clean rewrite)
  • Codex/Factory golden files unchanged

Companion installer

pi-gstack handles the Pi side:

  • Generates skills from gstack templates, symlinks into ~/.pi/agent/skills/
  • Links runtime assets (bin/, review/, ETHOS.md, VERSION)
  • Installs a Pi extension bridging built-ins (PreToolUse hooks, plan mode, ask_user, subagent with worktree isolation)
  • 79 tests passing

Related: #1218

@qwadratic qwadratic marked this pull request as draft April 26, 2026 12:06
qwadratic added 5 commits April 26, 2026 23:10
Add hosts/pi.ts for Mario Zechner's Pi coding agent (https://github.com/mariozechner/pi).

Pi is an open-source CLI coding agent with its own skill/extension system.
This adapter enables GStack's gen-skill-docs pipeline to generate Pi-specific
SKILL.md files with:

- Path rewrites: .claude/skills/ → .pi/agent/skills/
- Tool rewrites: AskUserQuestion → ask_user
- Frontmatter: allowlist mode (name + description only)
- Suppressed resolvers: GBRAIN_CONTEXT_LOAD, GBRAIN_SAVE_RESULTS
- Skip: codex skill (Claude-specific)

Companion migrator tool: https://github.com/qwadratic/pi-gstack

Tested with bun run gen:skill-docs --host pi — generates 43 skills, all
validation tests pass.
additional pathRewrites:
- CLAUDE.md -> AGENTS.md (Pi uses AGENTS.md for project config)

additional toolRewrites:
- Invoke the Skill tool -> Read the skill file
- via the Skill tool -> by reading the skill file
- ExitPlanMode -> /plan (toggle off)

companion: https://github.com/qwadratic/pi-gstack
@qwadratic qwadratic marked this pull request as ready for review April 26, 2026 21:12
qwadratic added 4 commits April 26, 2026 23:50
Templates use short names (e.g., 'ship') but external hosts emit into
gstack-prefixed directories (e.g., gstack-ship/). Pi requires the
frontmatter name to match the parent directory — name: ship in
gstack-ship/ triggers a skill conflict warning on load.

After transformFrontmatter, rewrite the name: field to use the
externalSkillName (the directory name). Fixes all 39 skill conflicts
reported on Pi load.

Also: bump host count assertion 10→11, refresh golden fixtures,
add .pi/ to .gitignore.
./setup --host pi now prints install instructions pointing to
the pi-gstack companion repo. Pi added to the README host table
with a link to the companion installer.

Without this, Pi users who clone gstack have no way to discover
that a companion extension exists for slash commands, plan mode,
and ask_user polyfills.
Other external hosts don't require the frontmatter name to match the
directory name. Reverts golden file changes for Codex and Factory.
Pi has no dedicated Grep tool (only Read, Write, Edit, Bash).
Rewrites 'the Grep tool' → 'the Bash tool (grep)' across all
variants including the post-pathRewrite form 'Pi's Grep tool'.
@qwadratic qwadratic closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant