← Catalog

pi-morph-plugin

Pi extension for Morph SDK — Fast Apply, WarpGrep, Public Repo Context, and Compaction

Package

Install

Install with PiG

pig install npm:pi-morph-plugin

Install with Pi

pi install npm:pi-morph-plugin
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "prompts": [
    "./prompts"
  ],
  "extensions": [
    "./extensions"
  ]
}

README

Written by the package's publisher, shown as published in version 1.0.17 (README.md). PiG does not review it.

🌀 pi-morph-plugin

Fast Apply, WarpGrep, Compaction & Repo Context via Morph

10,500+ tok/s code editing, agentic search, and 25,000+ tok/s compression for pi.

pi extension license

Pi 1.0 compatibility (1.0.13)

Development SDKs are pinned to 1.0.0; host-provided dependencies remain wildcard peers. Run bun run test:pi for offline real-host registrations, prompt/tool loadouts, nested calls, reload and shutdown. Set PI1_HOST_PACKAGE to an installed Pi package directory and PI1_HOST_ENTRY=bundle to check its bundled runtime.



Quick Start

1. Get a Morph API key

Sign up at morphllm.com/dashboard and configure it:

Option A: Environment variable (recommended for quick setup)

export MORPH_API_KEY="sk-..."

Add this to your shell profile (~/.zshrc, ~/.bashrc, etc.) so it persists.

Option B: auth.json (recommended for persistent config)

Add to ~/.pi/agent/auth.json:

{
  "morph": { "type": "api_key", "key": "sk-..." }
}

The environment variable takes priority over auth.json.

2. Install the plugin

pi install https://github.com/morphllm/pi-morph-plugin

Or install locally in your project:

pi install -l https://github.com/morphllm/pi-morph-plugin

3. Start Pi

pi

You should see morph_edit, warpgrep_codebase_search, and warpgrep_github_search in the available tools. Compaction runs automatically when context exceeds the threshold.


Tools

Fast Apply (morph_edit)

10,500+ tok/s code merging. The LLM writes partial snippets with lazy markers (// ... existing code ...), Morph merges them into the full file.

Best for large files (300+ lines) and multiple scattered changes. For small exact replacements, use Pi's built-in edit tool.

Fast agentic codebase search. Runs multi-turn ripgrep + file reads to find relevant code contexts. Sub-6s per query. Best for exploratory queries ("how does X work?", "where is Y handled?").

Search public GitHub repositories without cloning. Pass an owner/repo or GitHub URL and a search query. Returns relevant file contexts from Morph's indexed public repo search.

Compaction

Context compression via the Morph Compact API. When Pi's built-in compaction triggers (context exceeds threshold), this extension intercepts it and uses the Morph Compact API instead of default LLM summarization. Compresses in ~250ms at 25,000+ tok/s.


Configuration

All configuration is via environment variables.

VariableDefaultDescription
MORPH_API_KEYrequiredYour Morph API key
MORPH_COMPACT_RATIO0.3Target compression ratio (0.05-1.0, lower = more aggressive)
MORPH_COMPACT_PRESERVE_RECENT1Number of recent messages to keep uncompacted
MORPH_COMPACTtrueSet false to disable compaction
MORPH_EDITtrueSet false to disable Fast Apply
MORPH_WARPGREPtrueSet false to disable WarpGrep
MORPH_WARPGREP_GITHUBtrueSet false to disable public repo search

Pi's compaction threshold is configured in ~/.pi/agent/settings.json or .pi/settings.json:

{
  "compaction": {
    "enabled": true,
    "reserveTokens": 16384,
    "keepRecentTokens": 20000
  }
}

Development

npm install

To test locally:

pi -e ./extensions/index.ts

Or symlink into your pi extensions directory:

ln -s $(pwd)/extensions/index.ts ~/.pi/agent/extensions/morph-plugin.ts

License

MIT