Skip to content

feat: add Pi coding agent adapter (pi + pi-web) - #157

Merged
RealZST merged 6 commits into
RealZST:mainfrom
XiaoLrrr:main
Oct 18, 2026
Merged

RealZST merged 6 commits into
RealZST:mainfrom
XiaoLrrr:main

Conversation

@XiaoLrrr

Copy link
Copy Markdown
Contributor

What

Adds a pi adapter for Pi, the coding agent by Mario Zechner (badlogic). Its config root is ~/.pi/agent ($PI_CODING_AGENT_DIR).

pi-web is the local browser UI for the same agent and reuses the same ~/.pi/agent configuration — it has no separate config root, so one adapter covers both the pi CLI and pi-web.

Details

  • Skills: ~/.pi/agent/skills (user) + .pi/skills (project), recursive SKILL.md discovery per the Agent Skills spec. Pi also reads the universal ~/.agents/skills / .agents/skills, which stay owned by the codex/antigravity/qoder-cn adapters (not double-claimed).
  • MCP: ~/.pi/agent/mcp.json (user) + .pi/mcp.json (project), JSON {"mcpServers": {...}} with a native per-entry enabled flag. Toggling flips it in place (set_pi_mcp_enabled), preserving description, timeout, exposure, toolExposure, cwd, oauth, env, headers.
  • Plugins: ~/.pi/agent/extensions + .pi/extensions, TypeScript/JS modules (single-file + index.{ts,js} directory form), same shape as omp.
  • Context/rules: AGENTS.md / AGENTS.override.md / CLAUDE.md (+ .MD variants) from the agent dir and each ancestor of the cwd.
  • Remote MCP: new RemoteMcpSchema::PlainUrlHttpOnly — the file shape matches Cursor/Kiro PlainUrl, but Pi rejects the legacy SSE transport (docs/mcp.md), so remote entries are Streamable HTTP only.
  • No shell-command hooks (extensions are TS/JS modules) → HookFormat::None.

Also updates the frontend AGENT_ORDER + display name, the agent capability matrix tests, and the README agent table (16 → 17 agents).

Verification

  • cargo check -p hk-core passes
  • cargo test -p hk-core adapter::tests — 15 passed
  • cargo test -p hk-core adapter::pi::tests — 4 passed
  • cargo test -p hk-core deployer::tests — 82 passed

Note: 3 pre-existing copilot / openclaw tests fail on Windows due to Unix-path assumptions; unrelated to this change.

Upstream docs used

@XiaoLrrr
XiaoLrrr force-pushed the main branch 3 times, most recently from c946db2 to 3efd5fc Compare October 14, 2026 03:29
Pi is the coding agent at github.com/earendil-works/pi with its config root
at ~/.pi/agent ($PI_CODING_AGENT_DIR). pi-web (agegr/pi-web) is the local
browser UI for the same agent and shares this config root, so one adapter
covers both.

- adapter/pi.rs: skills (~/.pi/agent/skills + ~/.agents/skills universal +
  npm package skills/ dirs; project .pi/skills + .agents/skills), MCP
  (~/.pi/agent/mcp.json, .pi/mcp.json — JSON mcpServers with native
  per-entry enabled), plugins (settings.json `packages` npm packages +
  ~/.pi/agent/extensions local TS modules), context files (AGENTS.md /
  CLAUDE.md variants), settings.json
- deployer: set_pi_mcp_enabled (native MCP enabled flag in place) and
  set_pi_package_enabled (add/remove npm package declaration in `packages`)
- manager: toggle dispatch for pi MCP + npm-package vs local-TS plugin toggle
- RemoteMcpSchema::PlainUrlHttpOnly (Pi is Streamable HTTP only, no SSE)
- frontend: AGENT_ORDER + display name "Pi" + onboarding scatter coords
- README: agent matrix + supported-agent count
RealZST and others added 5 commits October 17, 2026 22:26
The frontend test still asserted 16 agents with penguin last, which
failed CI before the Rust suite ran. Also fold the adapter test's name
list to rustfmt's layout.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Packages declared in settings.json `packages` were listed as plugins, but
the toggle removed the declaration itself, so a disabled package vanished
from the list and could not be re-enabled; delete left the declaration
behind. The package.json walk added to scan_skill_dir also ran for every
agent and could attribute any skill under a non-git project to that
project's repository. Pi now covers skills, MCP, local .ts/.js extensions
and rules; `pi install` packages are left for a follow-up.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A project entry with none of `command`, `url` or `type` only overrides
`enabled` / `exposure` / `toolExposure` of the user-level server of the
same name (mcp.md); it was read as a stdio server with an empty command.
The per-entry `enabled` flip is now `set_mcp_server_enabled_flag`,
shared with omp, replacing the copy Pi carried.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both adapters carried the same 90 lines for listing *.ts/*.js modules and
<name>/index.{ts,js} directories. They also declared project_plugin_dirs
without implementing read_plugins_from, so project-level extensions were
never scanned; both now delegate to one helper for either scope.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The mascot is the Pi logo's three-block π with no tile. Hover picks the
blocks up one by one, each growing a side face; click slides them into
a 3×3 square, which puffs away in smoke before the π fades back in.
The agent color is the warm grey of pi.dev's page background, darkened
in the light theme for contrast the way Cursor's neutral is; the same
token drives the filter chip. The onboarding icon's scatter start now
stays inside a 900px window.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@RealZST
RealZST merged commit f5fdb97 into RealZST:main Oct 18, 2026
3 checks passed
@RealZST

RealZST commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thanks for the Pi adapter! I tested it against pi 1.3.0 and pushed five commits on top of yours:

  • c535f43: fixes the failing frontend test. types.test.ts still asserted 16 agents with penguin last, which is why CI was red (run).

  • 035690f: removes support for pi install packages for now. The PR listed them as plugins with an on/off switch, but switching one off deleted it from settings.json (manager.rs), and to Pi that is an uninstall (packages.md). The package then disappeared from HarnessKit, so there was no way to switch it back on. Packages need their own design and will get their own PR.

  • 64be39e: skips project-level MCP overrides. A project's .pi/mcp.json can turn off a user-level server by listing its name with only "enabled": false (mcp.md). The adapter read such an entry as a server with an empty command; it is now skipped, and the user-level server keeps its own row. Also merges set_pi_mcp_enabled into the omp helper, which was the same code.

  • 2743188: makes .pi/extensions show up at project scope. Project plugins are read through read_plugins_from (scanner.rs), which the adapter did not implement (mod.rs); omp had the same gap. Both adapters now share one .ts/.js extension reader.

  • 35fbe25: adds the mascot, drawn from the Pi logo (logo-auto.svg), a colour token for the filter badges, and a scatter position for the onboarding icon.

If anything looks different from what you intended with your Pi setup, please let me know.

Thanks again! Merged

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.

2 participants