@xynogen/pix-optimizer 1.1.7 → 1.1.8
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/README.md +40 -39
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/status.ts +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# pix-optimizer
|
|
2
2
|
|
|
3
|
-
Token-optimization suite for Pi Coding Agent.
|
|
4
|
-
extension via `src/index.ts`, fronted by a single `/
|
|
3
|
+
Token-optimization suite for Pi Coding Agent. Four tools wired into one
|
|
4
|
+
extension via `src/index.ts`, fronted by a single `/optimizer` command and one
|
|
5
5
|
shared status-bar cell:
|
|
6
6
|
|
|
7
7
|
- **Caveman** (``) — terse-output system prompt
|
|
@@ -11,16 +11,18 @@ shared status-bar cell:
|
|
|
11
11
|
|
|
12
12
|
## Command
|
|
13
13
|
|
|
14
|
-
One command
|
|
14
|
+
One command opens an interactive overlay that fronts every tool:
|
|
15
15
|
|
|
16
16
|
```text
|
|
17
|
-
/
|
|
18
|
-
/opt caveman <level> → set caveman level (1/2/3/lite/full/ultra/micro/off/config)
|
|
19
|
-
/opt rtk [on|off] → toggle RTK rewriting
|
|
20
|
-
/opt toon [on|off] → toggle jq+TOON guidance
|
|
21
|
-
/opt ponytail <level> → set ponytail level (1/2/3/lite/full/ultra/off/config)
|
|
17
|
+
/optimizer → open the overlay (←→ cycle value, ↑↓ move, esc close)
|
|
22
18
|
```
|
|
23
19
|
|
|
20
|
+
There is no text-arg form: the overlay is the only UI. Selecting a value calls
|
|
21
|
+
the tool's `run()` handler, which persists the new value and repaints the
|
|
22
|
+
shared status cell. Headless/test fallbacks print a plain status summary.
|
|
23
|
+
|
|
24
|
+
State persists to `~/.pi/agent/optimizer.json` (caveman/rtk/toon/ponytail).
|
|
25
|
+
|
|
24
26
|
## Status bar
|
|
25
27
|
|
|
26
28
|
A single cell always shows the enabled icons in a fixed order (` `), color-
|
|
@@ -32,15 +34,15 @@ coded by state: **accent** when the tool is enabled, **dim** when disabled.
|
|
|
32
34
|
|
|
33
35
|
Cuts ~75% of output tokens while keeping full technical accuracy.
|
|
34
36
|
|
|
35
|
-
|
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
37
|
+
| Level | Description |
|
|
38
|
+
|-------|------------------------------|
|
|
39
|
+
| lite | Professional, no fluff |
|
|
40
|
+
| full | Classic caveman |
|
|
41
|
+
| ultra | Maximum compression |
|
|
42
|
+
| micro | Experimental prompt-minimized |
|
|
41
43
|
|
|
42
|
-
`/
|
|
43
|
-
|
|
44
|
+
The `/optimizer` overlay opens a settings dialog when needed. Default level
|
|
45
|
+
for new sessions is restored from `~/.pi/agent/optimizer.json`.
|
|
44
46
|
|
|
45
47
|
### RTK Tool Rewriting (``)
|
|
46
48
|
|
|
@@ -88,14 +90,11 @@ writing code the agent stops at the first rung that holds: does this need to
|
|
|
88
90
|
exist → stdlib → native platform → installed dep → one line → minimum that
|
|
89
91
|
works. Validation, error handling, security, and accessibility are never cut.
|
|
90
92
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
97
|
-
`/opt ponytail config` opens a settings dialog. Default level for new sessions
|
|
98
|
-
and status-bar visibility are saved to `~/.pi/agent/ponytail.json`.
|
|
93
|
+
| Level | Description |
|
|
94
|
+
|-------|--------------------------------------|
|
|
95
|
+
| lite | Name the lazier alternative, you pick |
|
|
96
|
+
| full | The ladder enforced (default) |
|
|
97
|
+
| ultra | YAGNI extremist |
|
|
99
98
|
|
|
100
99
|
**No install required** — pure prompt injection, no external binary or PATH
|
|
101
100
|
dependency (unlike RTK and TOON).
|
|
@@ -116,16 +115,18 @@ pi install npm:@xynogen/pix-optimizer
|
|
|
116
115
|
|
|
117
116
|
| File | Role |
|
|
118
117
|
|-------------------|-----------------------------------------------------------|
|
|
119
|
-
| `src/index.ts` | Wires the four tools + shared status, registers `/
|
|
120
|
-
| `src/opt.ts` | The `/
|
|
118
|
+
| `src/index.ts` | Wires the four tools + shared status, registers `/optimizer` |
|
|
119
|
+
| `src/opt.ts` | The `/optimizer` overlay UI (keyboard nav + cycling) |
|
|
121
120
|
| `src/status.ts` | Shared status-bar cell + `OptimizerHandle` contract |
|
|
122
|
-
| `src/caveman.ts` | Caveman logic, levels, prompt
|
|
121
|
+
| `src/caveman.ts` | Caveman logic, levels, prompt |
|
|
123
122
|
| `src/rtk.ts` | RTK prompt + bash command rewriting |
|
|
124
123
|
| `src/json.ts` | jq+TOON guidance, heuristics, system-prompt injection |
|
|
125
|
-
| `src/ponytail.ts` | Ponytail logic, levels, prompt
|
|
124
|
+
| `src/ponytail.ts` | Ponytail logic, levels, prompt |
|
|
125
|
+
| `src/persist.ts` | Disk-backed `~/.pi/agent/optimizer.json` persistence |
|
|
126
|
+
| `src/tool-result-filter.ts` | Strips model-guidance warnings from tool_result |
|
|
126
127
|
|
|
127
128
|
Each tool registers its own lifecycle hooks and exposes an `OptimizerHandle`
|
|
128
|
-
that `/
|
|
129
|
+
that `/optimizer` dispatches to. All four share one `OptimizerStatus`.
|
|
129
130
|
|
|
130
131
|
## Development
|
|
131
132
|
|
|
@@ -137,22 +138,22 @@ bun test
|
|
|
137
138
|
|
|
138
139
|
This package was built by merging two upstream Pi community packages:
|
|
139
140
|
|
|
140
|
-
- **Caveman mode** — merged from
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
- **Caveman mode** — merged from `npm:pi-caveman`. Reimplemented here with
|
|
142
|
+
multiple compression levels and integration with the shared `/optimizer`
|
|
143
|
+
command.
|
|
143
144
|
|
|
144
|
-
- **RTK rewriting** — merged from `npm:pi-rtk-optimizer`. Reimplemented here
|
|
145
|
-
approach: prompt injection + live bash command rewriting
|
|
146
|
-
(`&&`, `||`, `;`, `|`).
|
|
145
|
+
- **RTK rewriting** — merged from `npm:pi-rtk-optimizer`. Reimplemented here
|
|
146
|
+
with a two-layer approach: prompt injection + live bash command rewriting
|
|
147
|
+
that handles chained commands (`&&`, `||`, `;`, `|`).
|
|
147
148
|
|
|
148
149
|
- **Ponytail mode** — ruleset adapted from [`git:github.com/DietrichGebert/ponytail`](https://github.com/DietrichGebert/ponytail),
|
|
149
|
-
the "lazy senior dev" skill. Reimplemented here as a native `/
|
|
150
|
-
|
|
150
|
+
the "lazy senior dev" skill. Reimplemented here as a native `/optimizer`
|
|
151
|
+
tool with three intensity levels — no external hooks or files. The
|
|
151
152
|
ruleset (the YAGNI ladder + safety carve-outs) is rewritten as a system-prompt fragment.
|
|
152
153
|
|
|
153
154
|
All upstreams are MIT licensed. No codebase was copied directly — the logic was
|
|
154
|
-
rewritten and combined into a single extension with a unified `/
|
|
155
|
-
This package does not sync back to any upstream.
|
|
155
|
+
rewritten and combined into a single extension with a unified `/optimizer`
|
|
156
|
+
command and shared status bar. This package does not sync back to any upstream.
|
|
156
157
|
|
|
157
158
|
## Full distro
|
|
158
159
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-optimizer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Performance optimization suite for Pi Coding Agent - caveman mode + RTK tool rewriting + jq/TOON JSON compression + ponytail lazy-dev mode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pix-optimizer — token-optimization suite for Pi Coding Agent.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Four tools, combined into one extension + one command:
|
|
5
5
|
* - caveman: terse-output system prompt
|
|
6
6
|
* - rtk: prefixes shell commands with `rtk` + injects RTK prompt
|
|
7
7
|
* - toon: jq + TOON guidance for dense JSON (+ bundled skill)
|
|
8
8
|
* - ponytail: lazy-senior-dev system prompt (minimal code, YAGNI)
|
|
9
9
|
*
|
|
10
|
-
* They share ONE status-bar cell ( ,
|
|
10
|
+
* They share ONE status-bar cell ( , all four always shown — dimmed when off, accented when on) and ONE
|
|
11
11
|
* command (/optimizer — an interactive overlay). index.ts wires lifecycle hooks
|
|
12
12
|
* via each module, then registers the overlay command from their handles.
|
|
13
13
|
*/
|
package/src/status.ts
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* caveman / rtk / toon / ponytail each toggle independently, but they're all the same
|
|
5
5
|
* class of thing (token-optimization tools), so they share ONE status cell
|
|
6
6
|
* instead of three. Each tool reports its on/off state into a single registry;
|
|
7
|
-
* the cell renders
|
|
8
|
-
*
|
|
7
|
+
* the cell renders ALL four icons in a fixed order — accent-colored when the
|
|
8
|
+
* tool is enabled, dim when disabled. The cell is never empty.
|
|
9
9
|
*
|
|
10
|
-
* all on:
|
|
11
|
-
* caveman off:
|
|
12
|
-
* all off:
|
|
10
|
+
* all on: all four accent
|
|
11
|
+
* caveman off: caveman dim, rest accent
|
|
12
|
+
* all off: all four dim
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type {
|