@floydous/pi-agent-kernel
Focused code retrieval, editing, and safety checks for Pi.
Package details
Install @floydous/pi-agent-kernel from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@floydous/pi-agent-kernel- Package
@floydous/pi-agent-kernel- Version
0.6.2- Published
- Dec 3, 2026
- Downloads
- 710/mo · 81/wk
- Author
- floydous
- License
- ISC
- Types
- extension
- Size
- 19.3 MB
- Dependencies
- 6 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
What it does
pi-agent-kernel is a runtime harness extension for the Pi coding agent. Without guardrails, coding agents often grep into test files instead of source implementations, patch lines they only skimmed, or lose the actual assertion failure inside thousands of lines of build logs.
pi-agent-kernel fixes those failure modes at the tool layer:
- Local
code_searchindexes functions and classes with Tree-sitter across 14 languages and ranks source code ahead of tests in about 20 ms. editblocks changes to lines the agent has not read yet, runs an immediate syntax check after saving, and rolls back multi-file patches atomically on failure.bashtrims long output down to the command start, exit summary, and failing assertion lines, whilereadstreams large spillover logs without loading the whole file./agent-kerneladds an in-Pi settings screen to toggle guards, switch between keyword and semantic search, and exclude generated folders from indexing.
Quick start
Requires Pi and Node.js 20 or newer.
pi install npm:@floydous/pi-agent-kernel # global install
pi install -l npm:@floydous/pi-agent-kernel # project-local install
- Restart Pi (or start a new session). Background keyword indexing (
leanprofile) starts automatically on launch. - Run
/agent-kernel statusto verify the extension loaded and check where global (~/.pi/agent/config.toml) and project (.pi/config.toml) settings live. - Optional setup: run
/agent-kernel engineto enable local semantic embeddings (fullprofile, ~147 MB download on first use),/agent-kernel scopeto uncheck noisy folders from indexing, or/pi-docs offwhen working outside Pi extension projects.
Configuration
Run /agent-kernel in Pi to open the three-tab settings UI (Kernel Settings, Retrieval Engine, and File Index Scope), or configure it from the prompt:
/agent-kernel status # Active settings and config paths
/agent-kernel engine # Open the Retrieval Engine tab
/agent-kernel scope # Open the File Index Scope tab
/agent-kernel set <key> <val> # Set a global option (e.g. set profile full, set max_lines 200)
/agent-kernel reset # Reset global settings to defaults
Use /pi-docs off (or /pi-docs on) to hide Pi's built-in extension manual when working on ordinary repositories.
Retrieval profiles
| Profile | Engine | Use when |
|---|---|---|
lean (default) |
AST-chunked BM25 keyword search | You want fast startup with zero model downloads |
full |
BM25 merged with gte-modernbert-base vectors via RRF (hybrid alias) |
You are searching by behavior without knowing symbol names |
auto |
lean below 4 CPU cores, full on 4+ cores |
You want profile selection tied to machine hardware |
off |
Disables indexing (code_search tells the model to use rg) |
You want to rely on shell search only |
Tools
| Tool | Role | Key behavior |
|---|---|---|
code_search |
Local code search | Ranks source chunks ahead of tests; supports mode (auto, full, preview, summary), path filters, and rrf_k (1-200). |
read |
Bounded file reader | Caps reads at 50 KB / 2,000 lines (250 lines by default), batches paths, and streams spillover logs up to 50 MB. |
edit |
Guarded code patcher | Enforces read-before-edit checks, preserves CRLF/LF, checks syntax after edits, and supports line_hint and atomic files[]. |
write |
Atomic file writer | Writes via temp file and atomic rename while preserving permissions and rejecting symlinks. |
bash |
Clamped shell runner | Keeps head/tail context centered on test failure diffs and links cleanly to deduplicated spillover logs. |
Documentation
Architecture · Retrieval & Indexing · Editing & Syntax Verification · Configuration Reference · Testing & Verification · Changelog · ISC License