@floydous/pi-agent-kernel 0.3.2 → 0.3.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_KERNEL_SYS_PROMPT.md +4 -4
- package/CHANGELOG.md +4 -26
- package/README.md +35 -16
- package/config.toml +1 -0
- package/package.json +2 -1
- package/src/config/agent_kernel_command.ts +849 -0
- package/src/config/index.ts +1 -0
- package/src/config/kernel_config.ts +73 -0
- package/src/index.ts +105 -7
- package/src/retrieval/search_index.ts +8 -0
- package/src/safety/output_clamper.ts +28 -7
- package/src/tools/edit_tool.ts +440 -309
- package/src/tools/read_tool.ts +139 -14
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
## Tool Selection
|
|
2
|
-
- **Known identifier / error string / symbol:** Use `rg` (via bash) directly.
|
|
2
|
+
- **Known identifier / error string / symbol:** Use `rg` (via bash) directly with specific symbols or assertion phrases. Avoid broad single-word searches (e.g. `index`, `path`) that return noisy matches.
|
|
3
3
|
- **Unlocated concept with no names:** Use `code_search` to find relevant files.
|
|
4
|
-
- **Code inspection:**
|
|
4
|
+
- **Code inspection:** When search identifies a file and line, read a targeted range centered on that location via `read(path, offset, limit)`. Plain text reads are default and most token-efficient; request `anchors` only for narrow ranges (<100 lines) when editing with anchors. Use multi-file `paths` when inspecting multiple short files or when their relevant regions are independently known. Use `symbol=` for isolated functions in large files (>500 lines).
|
|
5
5
|
|
|
6
6
|
## Execution Workflow
|
|
7
|
-
1. **Turn 1 Grounding:**
|
|
7
|
+
1. **Turn 1 Grounding:** Check the workspace reproduction diff provided in context under "Workspace Pre-Flight" and run the failing test on Turn 1. Avoid redundant `git diff`, `git log`, or `git status` commands when the reproduction patch is already visible.
|
|
8
8
|
2. **Root-Cause Layering:** Trace call chains to the callee/producer where the value originates. Fix the root cause, never the downstream caller.
|
|
9
|
-
3. **Surgical Edits:** Use single-block replacements with 2–3 lines of unique surrounding context for clear anchoring.
|
|
9
|
+
3. **Surgical Edits:** Use single-block replacements with 2–3 lines of unique surrounding context for clear anchoring. When a fix spans multiple files, apply them together in one turn using `edit(files: [{path, search, replace}, ...])`.
|
|
10
10
|
4. **Deterministic Exit:** Run the verification test immediately after editing. When tests pass (exit code 0), conclude immediately with a concise summary. Do not invoke further diffs or checks.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.3.
|
|
3
|
+
## [0.3.31] - 2026-09-22
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
|
-
- **
|
|
7
|
-
- **
|
|
8
|
-
- **Live Embedding Throughput & Stream Arrow Status**: Added real-time chunk processing throughput (`chunk/s`) with a static Stream Arrow indicator during workspace indexing (`🧠 retrieval:dense-768d ⇢ 45% (22/48 • 14.2 chunk/s)`).
|
|
9
|
-
- **Automatic Kernel Guidance Injection**: Bundled `AGENT_KERNEL_SYS_PROMPT.md` is injected through Pi's `before_agent_start` lifecycle hook, enabled by default and configurable with `[instructions] enabled = false`.
|
|
10
|
-
- **Benchmark Comparison Chart**: Added the latest aggregate harness comparison graphic at `static/benchmark-comparison.png` for display in the project README.
|
|
11
|
-
- **Six-Harness Cross-Agent Benchmark**: Integrated comprehensive multi-harness comparison runner supporting Pi Kernel, Pi Vanilla, Claude Code, Codex CLI, OMP, and OpenCode across 8 real-world tasks.
|
|
12
|
-
- **Passive Shield Architecture**: Gated exploratory tools (`ast_search`, `get_repo_map`, `lsp`) behind `enable_tools: false` / `PI_ENABLE_ALL_RETRIEVAL_TOOLS=1`, keeping the active tool interface lean (`read`, `edit`, `write`, `bash`, and compact `code_search`) to eliminate per-turn schema overhead and tool distraction loops.
|
|
13
|
-
- **Deterministic Delimiter Auto-Healing**: Added patch-scoped lexical delimiter balancing and Tree-sitter AST repair (`MISSING` node detection) to automatically recover truncated closing braces/brackets (`})`, `};`, `]}`) pre-write.
|
|
14
|
-
- **Line-Hinted Range Disambiguation & Multi-Block Line Deltas**: Added optional `line_hint`, `start_line`, and `end_line` parameters (supporting both camelCase and snake_case) to `edit` with sequential delta tracking to disambiguate identical search blocks without line-hash bloat.
|
|
15
|
-
- **Capped Plain-Text Reads**: Enforced 50KB / 2,000-line caps on broad reads with continuation hints (`offset`) and oversized line detection, recording precise exposure ranges in `EpistemicGuard`.
|
|
16
|
-
- **Model Property Aliasing & Epistemic Confirmation**: Supported model convention drift across parameter names (`search`/`replace`, `old`/`new`, `old_text`/`new_text`) and emitted concise positive confirmation strings (`Successfully applied edit to <file>.`) to prevent paranoid agent verification loops.
|
|
6
|
+
- **Unified `/agent-kernel` Settings**: Added interactive modal and CLI commands (`status`, `set`, `reset`) for managing extension settings across workspace (`.pi/config.toml`) and global (`~/.pi/agent/config.toml`) scopes.
|
|
7
|
+
- **Spillover Hardening**: Enforced restrictive `0o600` permissions on temporary command output logs in `/tmp` with automated 20-file bounded rotation.
|
|
17
8
|
|
|
18
9
|
### Changed
|
|
19
|
-
-
|
|
20
|
-
- Added lifecycle coverage for guidance injection, duplicate prevention, and the disabled configuration path.
|
|
21
|
-
- **Tool Description Optimization**: Completely redesigned tool descriptions for `read` and `edit` to explicitly declare clean plain-text defaults and precision parameter expectations, dropping 10k+ prompt inflation tokens on real benchmarks.
|
|
22
|
-
- **Diagnostic Benchmark**: Cut token consumption by 50.6% (762k vs 1.54M total turn tokens) and reduced tool calls by 24.8% (112 vs 149) compared to unguided Pi Vanilla on the 8-task Luna High diagnostic suite.
|
|
23
|
-
- **Historical Benchmark**: In the initial v0.3.1-to-v0.4.0 Passive Shield evaluation, token consumption dropped from 1,214,112 tokens down to 465,139 tokens (-61.7%) across 8 real-world repositories.
|
|
24
|
-
- **Persistent Vector Profiles**: Preserved dimension-specific binary caches (`vectors-256d.bin`, `vectors-768d.bin`) on disk across profile switches, preventing cache loss when toggling to BM25.
|
|
25
|
-
- **On-Demand Embedder Loading**: Removed premature model preloading on startup; weights load on-demand only when unindexed chunks are detected.
|
|
26
|
-
|
|
27
|
-
### Fixed
|
|
28
|
-
- **Startup Background Indexing Visibility**: Fixed a bug where workspace indexing on `session_start` ran silently in the background without updating the UI statusline on cold or unindexed workspaces.
|
|
29
|
-
- **Companion Symbol Token Inflation**: Deduplicated companion symbols and clamped surrounding context lines during targeted symbol reads to eliminate token bloat.
|
|
30
|
-
|
|
31
|
-
### Removed
|
|
32
|
-
- Removed the obsolete `AGENT_KERNEL_PROPMPTS.md` prompt document.
|
|
10
|
+
- Removed repository-level `AGENTS.md` from git tracking.
|
package/README.md
CHANGED
|
@@ -20,27 +20,23 @@ How tool overhead compares to an unconstrained agent harness across standard cod
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Benchmarks
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Evaluating 6 coding agent harnesses across 8 real-world bug fixes (`hono`, `ky`, `zod`, `ufo`, `picomatch`, `fastify`, `uuid`, `p-limit`) on `cx/gpt-5.6-luna:high`:
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Six harnesses were run on the same 8 tasks with identical prompts and repository states on `cx/gpt-5.6-luna:high` through OmniRoute:
|
|
30
|
-
|
|
31
|
-
| Harness | Tasks Solved | Success Rate | Total Time | Input Tokens | Output Tokens | Total Turn Tokens | Tool Calls |
|
|
27
|
+
| Harness | Solved | Success | Time | Input Tokens | Output Tokens | Total Turn Tokens | Tool Calls |
|
|
32
28
|
|---|:---:|:---:|---:|---:|---:|---:|:---:|
|
|
33
|
-
| Pi + Agent-Kernel | 8 / 8 | 100% |
|
|
34
|
-
| Pi (Vanilla) | 8 / 8 | 100% |
|
|
35
|
-
| Codex CLI | 8 / 8 | 100% |
|
|
36
|
-
| OpenCode | 8 / 8 | 100% |
|
|
37
|
-
| OMP | 7 / 8 | 87.5% |
|
|
38
|
-
| Claude Code | 6 / 8 | 75% |
|
|
39
|
-
|
|
40
|
-
The suite tests retrieval, root-cause diagnosis, and verification from behavioral descriptions. Pi + Agent-Kernel solved all 8 tasks with the lowest token footprint: 762,626 total turn tokens compared to Pi Vanilla's 1,544,373 (-50.6% token reduction, saving 781,747 tokens) and external harnesses ranging from 3.28M (Codex CLI) to 4.48M (Claude Code). Note on cross-harness metrics: token accounting reflects each harness's reported telemetry and diff format (for example, OpenCode emits verbose full diffs). In Claude Code, 6 tasks completed within turn limits, and 1 additional task passed test verification after timing out. OMP failed verification on task-4-ufo.
|
|
29
|
+
| Pi + Agent-Kernel | 8 / 8 | 100% | 10m 00s | 270k | 13.5k | 861k | 107 |
|
|
30
|
+
| Pi (Vanilla) | 8 / 8 | 100% | 20m 24s | 709k | 32.3k | 1.54M | 149 |
|
|
31
|
+
| Codex CLI | 8 / 8 | 100% | 20m 28s | 3.24M | 40.1k | 3.28M | 102 |
|
|
32
|
+
| OpenCode | 8 / 8 | 100% | 25m 57s | 1.42M | 23.0k | 3.61M | 229 |
|
|
33
|
+
| OMP | 7 / 8 | 87.5% | 19m 24s | 906k | 29.8k | 4.16M | 384 |
|
|
34
|
+
| Claude Code | 6 / 8 | 75.0% | 36m 00s | 4.39M | 85.8k | 4.48M | 183 |
|
|
41
35
|
|
|
42
36
|

|
|
43
37
|
|
|
38
|
+
*Prompts describe symptoms and expected behavior without providing the fix. Token totals reflect each tool's reported telemetry. In Claude Code, 1 additional task passed test verification after timing out.*
|
|
39
|
+
|
|
44
40
|
---
|
|
45
41
|
|
|
46
42
|
## Quick start
|
|
@@ -126,7 +122,30 @@ To install a language server directly:
|
|
|
126
122
|
|
|
127
123
|
---
|
|
128
124
|
|
|
129
|
-
### 5.
|
|
125
|
+
### 5. Unified settings & configuration (`/agent-kernel`)
|
|
126
|
+
|
|
127
|
+
Manage all Agent Kernel settings interactively or from the command line:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
/agent-kernel
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- **Interactive TUI Modal**: Mirrors native Pi component layouts (`/thinking` and `/settings`) with 4 categorized domains (`Retrieval & Exploration`, `Safety & Verification`, `Editing Engine`, `System Guidance & UI`).
|
|
134
|
+
- **Interactive Search**: Type to filter across setting IDs, labels, categories, and descriptions in real time.
|
|
135
|
+
- **Dynamic Descriptions**: Updates in real time to explain the active option value.
|
|
136
|
+
- **Global Scope Toggle (`G`)**: Press `G` (or `Ctrl+G`) on any setting to toggle applying it globally (`~/.pi/agent/config.toml`) vs. workspace-local (`.pi/config.toml`). Global settings are highlighted in **yellow**.
|
|
137
|
+
- **Tab Navigation**: Jump between categories with `Tab` / `Shift+Tab`.
|
|
138
|
+
|
|
139
|
+
Headless CLI commands:
|
|
140
|
+
```text
|
|
141
|
+
/agent-kernel status # Print current configuration and file paths
|
|
142
|
+
/agent-kernel set <key> <val> # Update a specific setting globally
|
|
143
|
+
/agent-kernel reset # Reset global configuration to defaults
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 6. Disable Pi documentation for external projects
|
|
130
149
|
|
|
131
150
|
Pi loads instructions for developing Pi extensions, skills, and themes by default. When working on standard application code, you can disable those instructions to free up prompt space:
|
|
132
151
|
|
package/config.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floydous/pi-agent-kernel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
4
4
|
"description": "Focused code retrieval, editing, safety checks, and language-server support for Pi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "npx tsx tests/run-all.ts",
|
|
12
12
|
"typecheck": "tsc --noEmit",
|
|
13
|
+
"preindex": "npx tsx agent-kernel-benchmark/preindex.ts",
|
|
13
14
|
"bench": "npx tsx agent-kernel-benchmark/run.ts",
|
|
14
15
|
"bench:clean": "npx tsx agent-kernel-benchmark/run.ts --clean",
|
|
15
16
|
"bench:chart": "PATH=\"$HOME/.local/bin:$HOME/.venv/bin:$PATH\" python3 agent-kernel-benchmark/generate_chart.py"
|