Skip to content

feat(pi): add native Pi integration#227

Open
felipe3dfx wants to merge 2 commits intoGentleman-Programming:mainfrom
felipe3dfx:feat/pi-support
Open

feat(pi): add native Pi integration#227
felipe3dfx wants to merge 2 commits intoGentleman-Programming:mainfrom
felipe3dfx:feat/pi-support

Conversation

@felipe3dfx
Copy link
Copy Markdown

@felipe3dfx felipe3dfx commented Apr 24, 2026

🔗 Linked Issue

Closes #127


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Adds engram setup pi to install a native, offline Pi package via pi install.
  • Adds a native Pi extension, skill, and canonical mem_* tools with notify-only startup and compaction recovery guidance.
  • Adds deterministic runtime harness coverage for Pi extension registration, tools, startup, compaction, and session summary preservation.

📂 Changes

File Change
plugin/pi/** Adds Pi package manifest, native extension, memory skill, and runtime harness.
internal/setup/** Adds Pi installer support, embedded assets, contract fixture, and deterministic harness test.
internal/store/store.go Preserves existing high-signal session summaries when low-signal shutdown metadata arrives.
internal/mcp/** Exposes canonical agent tool names for cross-agent/Pi consistency checks.
docs/AGENT-SETUP.md, docs/PLUGINS.md, docs/ARCHITECTURE.md, DOCS.md, README.md Documents Pi setup, runtime behavior, and session summary preservation semantics.
PRD-pi-support.md Captures the product requirements for Pi support.

🧪 Test Plan

  • Unit tests pass locally: go test ./...
  • E2E tests pass locally: go test -tags e2e ./internal/server/...
  • Manually tested the affected functionality

Manual/runtime validation performed:

  • Native Pi mem_* tools worked without bash.
  • Startup memory notification shown without automatic context injection.
  • Input hook capture worked.
  • /engram-recovery worked.
  • Auto-start worked after Node runtime spawn fix.
  • Deterministic Pi runtime harness passed for source and embedded extension copies.

🤖 Automated Checks

Check What it verifies Status
Check Issue Reference PR body contains Closes #N / Fixes #N / Resolves #N
Check Issue Has status:approved Linked issue has status:approved label
Check PR Has type: Label* PR has exactly one type:* label
Unit Tests go test ./... passes
E2E Tests go test -tags e2e ./internal/server/... passes

✅ Contributor Checklist

  • I linked an approved issue above (Closes #N)
  • I added exactly one type:* label to this PR
  • I ran unit tests locally: go test ./...
  • I ran e2e tests locally: go test -tags e2e ./internal/server/...
  • Docs updated (if behavior changed)
  • Commits follow conventional commits format
  • No Co-Authored-By trailers in commits

💬 Notes for Reviewers

Issue #127 currently showed status:needs-review when checked locally; PR validation may require maintainers to move it to status:approved.

Two non-blocking hardening notes remain:

  • Runtime harness validates part of summary preservation in a mocked Pi host; store tests cover backend semantics.
  • Low-signal shutdown metadata detection is currently pattern-based for shutdown reason=... target=....

Copilot AI review requested due to automatic review settings April 24, 2026 04:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class native Pi (pi-coding-agent) support to Engram via engram setup pi, shipping an embedded/offline Pi package (extension + skill) and validating runtime behavior with a deterministic harness. Also hardens session summary persistence so low-signal shutdown metadata doesn’t overwrite higher-signal session summaries.

Changes:

  • Add Pi setup installer that materializes embedded package assets and runs pi install <package-dir> across OS path variants.
  • Add Pi native extension + memory skill, including canonical mem_* tools, notify-only startup, compaction guidance, and <private> redaction.
  • Add/extend tests (Go + Node harness) for Pi runtime behaviors, privacy redaction, canonical tool naming, and session summary preservation.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
plugin/pi/test/runtime-harness.mjs Deterministic Node harness to validate Pi extension registration, startup, compaction, and error behavior.
plugin/pi/skills/engram/SKILL.md Pi skill documenting mem_* usage, startup policy, compaction recovery flow.
plugin/pi/package.json Pi package manifest declaring extension + skills for pi install.
plugin/pi/extensions/engram.ts Native Pi extension implementing mem_* tools, lifecycle hooks, redaction, backend autostart, compaction handling.
internal/store/store_test.go Adds tests for <private> redaction in passive capture and summary-preservation semantics on shutdown.
internal/store/store.go Preserves existing non-empty summaries when incoming summary is low-signal shutdown metadata.
internal/setup/testdata/pi-contract.json Fixture capturing validated Pi contract assumptions for installer/runtime behavior.
internal/setup/setup_test.go Adds Pi setup tests (paths, idempotency, embedded asset drift checks, docs assertions).
internal/setup/setup.go Implements installPi, embeds Pi assets, adds pi agent support and OS-specific install paths.
internal/setup/plugins/pi/skills/engram/SKILL.md Embedded Pi skill copy synced from plugin/pi.
internal/setup/plugins/pi/package.json Embedded Pi package manifest copy synced from plugin/pi.
internal/setup/plugins/pi/extensions/engram.ts Embedded Pi extension copy synced from plugin/pi.
internal/setup/pi_runtime_harness_test.go Go test runner that executes the Node runtime harness against source + embedded extensions.
internal/setup/generate.go Extends go generate to sync embedded Pi assets alongside OpenCode.
internal/server/server_test.go Validates <private> redaction through HTTP endpoints used by the Pi extension.
internal/mcp/mcp_test.go Ensures canonical mem_* tool surface remains stable and free of engram_* aliases.
internal/mcp/mcp.go Adds stable, sorted accessor for agent tool names (AgentProfileToolNames).
docs/PLUGINS.md Documents Pi contract assumptions, install flow, and runtime behavior.
docs/ARCHITECTURE.md Updates repo structure and CLI reference to include Pi integration.
docs/AGENT-SETUP.md Adds Pi setup instructions, policy defaults, and E2E checklist/troubleshooting.
cmd/engram/main_test.go Updates CLI usage and post-install messaging assertions for pi.
cmd/engram/main_extra_test.go Ensures interactive setup mode lists Pi as an option.
cmd/engram/main.go Adds Pi post-install instructions and updates CLI help text.
README.md Adds Pi to quickstart setup table + note about offline embedded install.
PRD-pi-support.md Product requirements document describing Pi support goals and constraints.
DOCS.md Documents session end semantics (including shutdown-metadata summary preservation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/pi/extensions/engram.ts Outdated
Comment thread docs/AGENT-SETUP.md Outdated
Comment thread plugin/pi/test/runtime-harness.mjs Outdated
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.

feat(setup): add Pi extension integration via engram setup pi

2 participants