Skip to content

feat(pi): Add Pi coding agent integration#2022

Closed
Doctacon wants to merge 1 commit into
rtk-ai:developfrom
Doctacon:develop
Closed

feat(pi): Add Pi coding agent integration#2022
Doctacon wants to merge 1 commit into
rtk-ai:developfrom
Doctacon:develop

Conversation

@Doctacon
Copy link
Copy Markdown

@Doctacon Doctacon commented May 21, 2026

Summary

Adds first-class RTK integration for the Pi coding agent via a TypeScript extension.

The Pi extension listens for Pi bash tool calls, delegates rewrite decisions to rtk rewrite, and mutates the bash command in place when RTK has a supported rewrite. This keeps Pi integration thin and reuses the existing RTK rewrite registry.

What changed

  • Added hooks/pi/rtk.ts, a fail-open Pi extension for bash tool calls.
  • Added rtk init --agent pi install/uninstall support.
  • Installs to:
    • ~/.pi/agent/extensions/rtk.ts
    • or $PI_CODING_AGENT_DIR/extensions/rtk.ts when configured.
  • Added tests for:
    • --agent pi CLI parsing
    • Pi config path resolution
    • extension install/update behavior
    • dry-run behavior
    • uninstall dispatch routing
  • Updated docs:
    • README.md
    • docs/guide/getting-started/supported-agents.md
    • hooks/README.md
    • src/hooks/README.md
    • hooks/pi/README.md

Design notes

  • The extension only targets Pi’s bash tool calls.
  • All rewrite decisions stay in rtk rewrite.
  • The extension fails open:
    • missing rtk
    • rewrite timeout/error
    • unsupported command
    • unexpected extension/runtime error
  • This does not change RTK filter behavior or rewrite registry semantics.

Test plan

cargo fmt --all --check
cargo clippy --all-targets
cargo test --all

Also smoke-tested install behavior with an isolated Pi config dir:

TMP_PI_DIR=$(mktemp -d)
PI_CODING_AGENT_DIR="$TMP_PI_DIR" cargo run --quiet -- init --agent pi
cmp -s hooks/pi/rtk.ts "$TMP_PI_DIR/extensions/rtk.ts"

And current-user install:

cargo run --quiet -- init --agent pi
cmp -s hooks/pi/rtk.ts ~/.pi/agent/extensions/rtk.ts

Notes for reviewers

Pi must be restarted or /reload must be run after installation for the extension to become active.

This PR targets develop.

Introduces a TypeScript extension for the Pi coding agent, enabling RTK to automatically rewrite bash `tool_call` commands.

This integration includes:
- `rtk init --agent pi` for streamlined installation and uninstallation.
- A fail-open TypeScript extension that delegates rewrite decisions to `rtk rewrite`.
- Comprehensive documentation updates across READMEs and supported agent guides.
- Core Rust backend logic to manage the extension's lifecycle.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
All committers have signed the CLA.

@gitbluf
Copy link
Copy Markdown
Contributor

gitbluf commented May 22, 2026

Have you checked #1741 ?

@Doctacon
Copy link
Copy Markdown
Author

Have you checked #1741 ?

I hadn't! Thank you for the heads up @gitbluf

@Doctacon Doctacon closed this May 23, 2026
@aeppling
Copy link
Copy Markdown
Contributor

Thanks @Doctacon for participating to PI integration, we've merged #1741 and will be available in RTK 0.42

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.

4 participants