feat(serve): add pi (Oh My Pi) as a first-class MCP harness #546

Closed
opened 2026-09-20 18:58:08 +00:00 by hexajon · 3 comments
Owner

Summary

madtea today wires its MCP server first-class into three harnesses: Claude Code (via madtea install), Codex CLI and Antigravity (via madtea install --mcp-client). Oh My Pi (pi/omp) is a growing stdio-MCP-capable harness with documented hooks (.omp/hooks/{pre,post}/*.ts), rules (.omp/RULES.md, .omp/AGENTS.md), and native MCP config at .omp/mcp.json (project) and ~/.omp/agent/mcp.json (user scope). It is currently supported only through the "print a snippet for other clients" escape hatch.

Proposal

Add pi as a first-class supported harness:

  1. New internal/cmd/serve/agent_pi.go implementing the agentHandler contract (Name/Detect/Emit), with detection via omp/pi binary on PATH or presence of ~/.omp/.
  2. WirePi writes/merges the user-scope config ~/.omp/agent/mcp.json directly (pi has no non-interactive mcp add CLI), mirroring WireAntigravity: JSON merge preserving existing mcpServers, atomic 0600 write, idempotent no-op when already present.
  3. Register piAgent in allAgents; add pi to wireableClients/advertisedClients in internal/cmd/install/mcp.go with dispatch to WirePi.
  4. Snippet + help strings updated (~/.omp/agent/mcp.json, serve args); docs regenerated via go run ./cmd/madtea-dev docs generate.

Out of scope (phase 2, separate issues)

  • Porting the seven Claude-Code-only PreToolUse guard hooks to pi's TS hook factories (pi.on("tool_call", ...)) — pending verification of whether OMP's claude-plugins discovery already imports the madtea Claude plugin's hooks.
  • OMP profile-scoped config (~/.omp/profiles/<n>/agent/mcp.json) — default-profile-only is the documented 80%.
  • Shipping an OMP-native plugin package (rules/skills).

Acceptance criteria

  • madtea install --mcp-client pi on a machine with omp on PATH writes ~/.omp/agent/mcp.json with the madtea stdio entry; second run prints the idempotent "already configured" line and changes nothing.
  • Pre-existing unrelated entries in mcpServers survive the merge (test-pinned).
  • madtea mcp-config --client pi prints a snippet that never contains a token and points at the correct file (test-pinned).
  • madtea mcp-config auto-detection lists pi when omp is on PATH.
  • Gate (./scripts/gate.sh --fast minimum) green; docs verify green; CLAIMS.md rows added with pinning tests.

Tracking ADR: to be numbered by madtea adr new (expected 0039).

## Summary madtea today wires its MCP server first-class into three harnesses: Claude Code (via `madtea install`), Codex CLI and Antigravity (via `madtea install --mcp-client`). Oh My Pi (pi/omp) is a growing stdio-MCP-capable harness with documented hooks (`.omp/hooks/{pre,post}/*.ts`), rules (`.omp/RULES.md`, `.omp/AGENTS.md`), and native MCP config at `.omp/mcp.json` (project) and `~/.omp/agent/mcp.json` (user scope). It is currently supported only through the "print a snippet for other clients" escape hatch. ## Proposal Add `pi` as a first-class supported harness: 1. New `internal/cmd/serve/agent_pi.go` implementing the `agentHandler` contract (`Name`/`Detect`/`Emit`), with detection via `omp`/`pi` binary on PATH or presence of `~/.omp/`. 2. `WirePi` writes/merges the user-scope config `~/.omp/agent/mcp.json` directly (pi has no non-interactive `mcp add` CLI), mirroring `WireAntigravity`: JSON merge preserving existing `mcpServers`, atomic 0600 write, idempotent no-op when already present. 3. Register `piAgent` in `allAgents`; add `pi` to `wireableClients`/`advertisedClients` in `internal/cmd/install/mcp.go` with dispatch to `WirePi`. 4. Snippet + help strings updated (`~/.omp/agent/mcp.json`, `serve` args); docs regenerated via `go run ./cmd/madtea-dev docs generate`. ## Out of scope (phase 2, separate issues) - Porting the seven Claude-Code-only PreToolUse guard hooks to pi's TS hook factories (`pi.on("tool_call", ...)`) — pending verification of whether OMP's `claude-plugins` discovery already imports the madtea Claude plugin's hooks. - OMP profile-scoped config (`~/.omp/profiles/<n>/agent/mcp.json`) — default-profile-only is the documented 80%. - Shipping an OMP-native plugin package (rules/skills). ## Acceptance criteria - `madtea install --mcp-client pi` on a machine with `omp` on PATH writes `~/.omp/agent/mcp.json` with the `madtea` stdio entry; second run prints the idempotent "already configured" line and changes nothing. - Pre-existing unrelated entries in `mcpServers` survive the merge (test-pinned). - `madtea mcp-config --client pi` prints a snippet that never contains a token and points at the correct file (test-pinned). - `madtea mcp-config` auto-detection lists `pi` when `omp` is on PATH. - Gate (`./scripts/gate.sh --fast` minimum) green; docs verify green; CLAIMS.md rows added with pinning tests. Tracking ADR: to be numbered by `madtea adr new` (expected 0039).
Author
Owner

Closing as completed: implemented in PR #547 (merge 36d66f47). Decision recorded in docs/decisions/0039-pi-first-class-harness.md (accepted 2026-09-20).

Closing as completed: implemented in PR #547 (merge 36d66f47). Decision recorded in docs/decisions/0039-pi-first-class-harness.md (accepted 2026-09-20).
hexajon reopened this issue 2026-09-20 21:49:31 +00:00
Author
Owner

Reopened. The implementation landed in PR #547, but ADR 0039 stays proposed.

My earlier comment says the record was accepted on 2026-09-20. That is wrong. I put the status back to proposed in b1f9ad68, and PR #557 rewrote the record with plain hyphens.

This issue closes when I accept 0039.

Reopened. The implementation landed in PR #547, but ADR 0039 stays proposed. My earlier comment says the record was accepted on 2026-09-20. That is wrong. I put the status back to proposed in b1f9ad68, and PR #557 rewrote the record with plain hyphens. This issue closes when I accept 0039.
Author
Owner

Accepted: 0039-pi-first-class-harness (ADR 0039). The build merged in PR #547. The phase-2 follow-ups stay open as their own issues: #558, #559, #560, and #561.

Accepted: 0039-pi-first-class-harness (ADR 0039). The build merged in PR #547. The phase-2 follow-ups stay open as their own issues: #558, #559, #560, and #561.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#546
No description provided.