compound-engineering-plugin icon indicating copy to clipboard operation
compound-engineering-plugin copied to clipboard

Pi subagent discovery broken - agents not registered

Open benwilson opened this issue 3 months ago • 3 comments

Problem

The Compound Engineering plugin's native Pi extension only exposes skills, not agents. The README claims "OpenCode, Pi, and oh-my-pi (omp) use native package/plugin loading from this repository" but this is only true for skills.

What's Broken

When you try to invoke CE agents via Pi subagents (e.g., compound-engineering:ce-work, compound-engineering:lfg), you get:

Error: Run 'main' failed: Unknown agent: compound-engineering:ce-work

Root Cause

The package.json has:

"pi": {
  "extensions": ["./.pi/extensions/compound-engineering.ts"],
  "skills": ["./skills"]
}

But it's missing the pi-subagents configuration:

"pi-subagents": {
  "agents": ["./.agents/agents"]
}

Pi's agent discovery (extractSubagentPathsFromPackageRoot()) reads package.json for:

  • pi-subagents.agents array
  • pi.subagents.agents array (fallback)

The CE plugin was missing both, so Pi can't discover agent definitions even though the ./.agents/agents/*.md files exist.

Impact

Users trying to use the LFG pipeline or individual CE agents via Pi subagents get Unknown agent errors. The native Pi extension only registers skills, not agents.

Fix

Add to package.json:

"pi-subagents": {
  "agents": ["./.agents/agents"]
}

Files Created

I've already created agent definition files in ./.agents/agents/*.md:

  • ce-work.md
  • ce-plan.md
  • ce-code-review.md
  • ce-commit.md
  • ce-commit-push-pr.md
  • ce-babysit-pr.md
  • lfg.md

Next Steps

The fix is ready. Would you like me to:

  • Submit a PR with these changes?
  • Keep it as a local patch?
  • Update the README to document this?

benwilson avatar Aug 21 '26 20:08 benwilson

Thanks for reporting this. I want to make sure we're looking at the path that actually failed.

Did this happen after invoking /lfg normally in Pi, or did you explicitly ask pi-subagents to run compound-engineering:ce-work / compound-engineering:lfg as the agent?

CE intentionally no longer ships formal standalone agent definitions. ce-work and lfg are skills. Those skills run the workflow and use the harness's generic subagent primitive, seeded with their skill-local persona prompts. If Pi received agent: "compound-engineering:ce-work", Unknown agent is expected because that's a skill identifier, not a Pi agent. If normal /lfg caused CE itself to make that call, though, that's a real Pi portability bug.

Could you share:

  • the exact top-level invocation or prompt
  • the emitted subagent tool call, if available
  • the installed CE commit/version and pi-subagents version

That will tell us whether we need to fix normal CE skill routing or whether this is a separate request to make whole CE workflows launchable as Pi background agents.

tmchow avatar Aug 23 '26 16:08 tmchow

Agent disclosure

Automated triage by an AI coding agent (OMP/Multica), investigating this issue for a proposed fix. No code changes were made; no PR was opened.

Finding: implementing the proposed fix would conflict with this repo's current architecture

I looked at implementing the pi-subagents/pi.subagents package.json registration plus ./.agents/agents/*.md files as proposed here, but stopped before making changes because it directly contradicts a deliberate, already-merged architectural decision in this repo:

  • docs/brainstorms/2026-06-19-agentless-plugin-surface-reduction-requirements.md (merged via #967, commit 02b72bc8) explicitly decided to delete all standalone plugins/compound-engineering/agents/ definitions and move specialist behavior into skill-local prompt assets (skills/<skill>/references/agents/*.md or references/personas/*.md), dispatched through the harness's generic subagent primitive rather than typed/named agent registration.
  • tests/skill-agent-ce-prefix.test.ts actively enforces this: test("does not ship standalone agents", () => expect(existsSync(AGENTS_DIR)).toBe(false)), plus assertions that no skill prose uses subagent_type: or fully-qualified typed-agent dispatch.
  • Requirement R3 from that doc: "No plugins/compound-engineering/agents/ directory remains after migration," and R1: "No surviving CE skill may dispatch a standalone ce-* agent by name."

Registering ./.agents/agents in package.json for native Pi discovery would recreate exactly the standalone-agent registration surface that migration removed, and the .agents/agents/*.md files this issue proposes creating would fail tests/skill-agent-ce-prefix.test.ts outright.

This also lines up with @tmchow's comment above: ce-work and lfg are skills, not Pi agents by design, and Unknown agent: compound-engineering:ce-work is expected when something calls them via typed agent dispatch rather than as skills. The fix belongs in whatever caller (e.g. pi-subagents, or user prompt) is trying to invoke CE skills as if they were named Pi agents — not in CE re-adding standalone agent registration.

Recommendation

I'm not opening a PR for the fix as originally scoped, since it would reintroduce a pattern this repo intentionally removed and would fail existing tests. If native Pi skill discovery (as opposed to agent discovery) is incomplete, that would be a different, narrower fix worth re-scoping — happy to pick that up if a maintainer confirms that's the actual gap.

Amanjyot-P avatar Aug 26 '26 12:08 Amanjyot-P

Closing this as working as designed. ce-work and lfg are skills. CE has shipped only skills since #967, and Pi loads them through pi.skills in package.json. So Unknown agent: compound-engineering:ce-work is what Pi returns when something asks it to run a skill name as a subagent. Adding a pi-subagents.agents entry would bring back the standalone agent definitions #967 removed, and the test suite blocks that on purpose.

If running /lfg normally in Pi produces that error, please open a new issue with the exact prompt and the subagent tool call it emitted. That would be a real Pi bug and we'll fix it.

tmchow avatar Nov 11 '26 01:11 tmchow