@pi-unipi/unipi 0.1.14 → 0.1.16
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 +23 -1
- package/package.json +11 -4
- package/packages/autocomplete/src/constants.ts +30 -0
- package/packages/autocomplete/src/settings.ts +2 -2
- package/packages/compactor/README.md +50 -24
- package/packages/compactor/index.ts +7 -0
- package/packages/compactor/skills/compactor/SKILL.md +21 -65
- package/packages/compactor/skills/compactor-detail/SKILL.md +133 -0
- package/packages/compactor/src/commands/index.ts +186 -109
- package/packages/compactor/src/compaction/filter-noise.ts +4 -3
- package/packages/compactor/src/compaction/hooks.ts +25 -6
- package/packages/compactor/src/compaction/search-entries.ts +51 -4
- package/packages/compactor/src/config/manager.ts +55 -6
- package/packages/compactor/src/config/presets.ts +69 -5
- package/packages/compactor/src/config/schema.ts +10 -1
- package/packages/compactor/src/display/diff-presentation.ts +6 -1
- package/packages/compactor/src/display/diff-renderer.ts +34 -8
- package/packages/compactor/src/display/diff-width-safety.ts +83 -0
- package/packages/compactor/src/display/line-width-safety.ts +14 -2
- package/packages/compactor/src/index.ts +297 -16
- package/packages/compactor/src/info-screen.ts +137 -46
- package/packages/compactor/src/security/policy.ts +23 -0
- package/packages/compactor/src/session/analytics.ts +198 -0
- package/packages/compactor/src/session/auto-inject.ts +60 -0
- package/packages/compactor/src/session/db.ts +68 -8
- package/packages/compactor/src/session/resume-inject.ts +13 -1
- package/packages/compactor/src/store/db-base.ts +11 -0
- package/packages/compactor/src/store/index.ts +150 -4
- package/packages/compactor/src/store/unified.ts +109 -0
- package/packages/compactor/src/tools/context-budget.ts +50 -0
- package/packages/compactor/src/tools/ctx-batch-execute.ts +2 -5
- package/packages/compactor/src/tools/ctx-fetch-and-index.ts +3 -8
- package/packages/compactor/src/tools/ctx-index.ts +3 -9
- package/packages/compactor/src/tools/ctx-search.ts +3 -7
- package/packages/compactor/src/tools/ctx-stats.ts +6 -4
- package/packages/compactor/src/tools/register.ts +251 -216
- package/packages/compactor/src/tui/settings-overlay.ts +359 -149
- package/packages/compactor/src/types.ts +30 -7
- package/packages/footer/README.md +206 -0
- package/packages/footer/index.ts +6 -0
- package/packages/footer/src/commands.ts +207 -0
- package/packages/footer/src/config.ts +177 -0
- package/packages/footer/src/events.ts +256 -0
- package/packages/footer/src/index.ts +220 -0
- package/packages/footer/src/presets.ts +131 -0
- package/packages/footer/src/registry/index.ts +160 -0
- package/packages/footer/src/rendering/icons.ts +318 -0
- package/packages/footer/src/rendering/renderer.ts +310 -0
- package/packages/footer/src/rendering/separators.ts +112 -0
- package/packages/footer/src/rendering/theme.ts +98 -0
- package/packages/footer/src/segments/compactor.ts +135 -0
- package/packages/footer/src/segments/core.ts +242 -0
- package/packages/footer/src/segments/kanboard.ts +75 -0
- package/packages/footer/src/segments/mcp.ts +100 -0
- package/packages/footer/src/segments/memory.ts +142 -0
- package/packages/footer/src/segments/notify.ts +50 -0
- package/packages/footer/src/segments/ralph.ts +108 -0
- package/packages/footer/src/segments/status-ext.ts +124 -0
- package/packages/footer/src/segments/workflow.ts +101 -0
- package/packages/footer/src/tui/settings-tui.ts +313 -0
- package/packages/footer/src/types.ts +183 -0
- package/packages/input-shortcuts/README.md +116 -0
- package/packages/input-shortcuts/index.ts +5 -0
- package/packages/input-shortcuts/src/chord-overlay.ts +235 -0
- package/packages/input-shortcuts/src/clipboard.ts +119 -0
- package/packages/input-shortcuts/src/index.ts +411 -0
- package/packages/input-shortcuts/src/registers.ts +92 -0
- package/packages/input-shortcuts/src/settings-overlay.ts +142 -0
- package/packages/input-shortcuts/src/status.ts +35 -0
- package/packages/input-shortcuts/src/types.ts +48 -0
- package/packages/input-shortcuts/src/undo-redo.ts +86 -0
- package/packages/mcp/src/index.ts +2 -5
- package/packages/memory/index.ts +1 -1
- package/packages/notify/index.ts +2 -1
- package/packages/notify/skills/configure-notify/SKILL.md +43 -6
- package/packages/unipi/index.ts +8 -0
- package/packages/updater/README.md +71 -0
- package/packages/updater/index.ts +6 -0
- package/packages/updater/skills/configure-updater/SKILL.md +65 -0
- package/packages/updater/src/cache.ts +67 -0
- package/packages/updater/src/changelog.ts +141 -0
- package/packages/updater/src/checker.ts +84 -0
- package/packages/updater/src/commands.ts +83 -0
- package/packages/updater/src/index.ts +178 -0
- package/packages/updater/src/installer.ts +74 -0
- package/packages/updater/src/markdown.ts +173 -0
- package/packages/updater/src/readme.ts +139 -0
- package/packages/updater/src/settings.ts +98 -0
- package/packages/updater/src/tui/changelog-overlay.ts +256 -0
- package/packages/updater/src/tui/readme-overlay.ts +236 -0
- package/packages/updater/src/tui/settings-overlay.ts +191 -0
- package/packages/updater/src/tui/update-overlay.ts +261 -0
- package/packages/utility/README.md +54 -1
- package/packages/utility/src/commands.ts +41 -3
- package/packages/utility/src/diff/highlighter.ts +352 -0
- package/packages/utility/src/diff/parser.ts +191 -0
- package/packages/utility/src/diff/renderer.ts +395 -0
- package/packages/utility/src/diff/settings.ts +199 -0
- package/packages/utility/src/diff/theme.ts +319 -0
- package/packages/utility/src/diff/wrapper.ts +339 -0
- package/packages/utility/src/index.ts +11 -0
- package/packages/utility/src/tui/badge-settings.ts +17 -58
- package/packages/utility/src/tui/util-settings-tui.ts +498 -0
- package/packages/web-api/README.md +76 -15
- package/packages/web-api/skills/web/SKILL.md +54 -11
- package/packages/web-api/src/engine/constants.ts +36 -0
- package/packages/web-api/src/engine/dependencies.ts +145 -0
- package/packages/web-api/src/engine/dom.ts +266 -0
- package/packages/web-api/src/engine/extract.ts +642 -0
- package/packages/web-api/src/engine/format.ts +306 -0
- package/packages/web-api/src/engine/profiles.ts +102 -0
- package/packages/web-api/src/engine/types.ts +169 -0
- package/packages/web-api/src/index.ts +9 -2
- package/packages/web-api/src/providers/base.ts +9 -1
- package/packages/web-api/src/settings.ts +70 -4
- package/packages/web-api/src/tools.ts +281 -24
- package/packages/web-api/src/tui/progress.ts +168 -0
- package/packages/web-api/src/tui/result.ts +173 -0
- package/packages/web-api/src/tui/settings-dialog.ts +168 -0
- package/packages/workflow/index.ts +2 -2
- package/packages/workflow/skills/gather-context/SKILL.md +25 -2
- package/packages/workflow/skills/review-work/SKILL.md +8 -0
- package/packages/workflow/skills/work/SKILL.md +18 -1
- package/packages/compactor/skills/compactor-ops/SKILL.md +0 -65
- package/packages/compactor/skills/compactor-tools/SKILL.md +0 -120
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ pi install npm:@pi-unipi/mcp
|
|
|
26
26
|
pi install npm:@pi-unipi/ask-user
|
|
27
27
|
pi install npm:@pi-unipi/milestone
|
|
28
28
|
pi install npm:@pi-unipi/kanboard
|
|
29
|
+
pi install npm:@pi-unipi/footer
|
|
30
|
+
pi install npm:@pi-unipi/updater
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
## Packages
|
|
@@ -47,6 +49,8 @@ pi install npm:@pi-unipi/kanboard
|
|
|
47
49
|
| `@pi-unipi/ask-user` | Structured user input with options and freeform text |
|
|
48
50
|
| `@pi-unipi/milestone` | Milestone tracking and project progress management |
|
|
49
51
|
| `@pi-unipi/kanboard` | Kanboard visualization server with TUI overlay |
|
|
52
|
+
| `@pi-unipi/footer` | Persistent status bar with live stats from all packages |
|
|
53
|
+
| `@pi-unipi/updater` | Auto-updater, changelog browser, and readme browser |
|
|
50
54
|
|
|
51
55
|
## Commands
|
|
52
56
|
|
|
@@ -217,7 +221,23 @@ pi install npm:@pi-unipi/kanboard
|
|
|
217
221
|
|---------|-------------|
|
|
218
222
|
| `/unipi:kanboard` | Toggle kanboard visualization server |
|
|
219
223
|
| `/unipi:kanboard-doctor` | Diagnose and fix kanboard parser issues |
|
|
220
|
-
|
|
224
|
+
|
|
225
|
+
### Footer (`/unipi:footer*`)
|
|
226
|
+
|
|
227
|
+
| Command | Description |
|
|
228
|
+
|---------|-------------|
|
|
229
|
+
| `/unipi:footer` | Toggle footer or switch preset |
|
|
230
|
+
| `/unipi:footer-settings` | Open footer settings — toggle groups and segments |
|
|
231
|
+
|
|
232
|
+
### Updater (`/unipi:updater*`)
|
|
233
|
+
|
|
234
|
+
| Command | Description |
|
|
235
|
+
|---------|-------------|
|
|
236
|
+
| `/unipi:readme [package]` | Browse package README files in TUI overlay |
|
|
237
|
+
| `/unipi:changelog` | Browse CHANGELOG.md with version list and detail view |
|
|
238
|
+
| `/unipi:updater-settings` | Configure check interval and auto-update mode |
|
|
239
|
+
|
|
240
|
+
### Name Badge
|
|
221
241
|
|
|
222
242
|
## How It Works
|
|
223
243
|
|
|
@@ -251,6 +271,8 @@ pi install npm:@pi-unipi/kanboard
|
|
|
251
271
|
|
|
252
272
|
**Kanboard** provides a visualization server with htmx + Alpine.js UI for kanban boards, workflow timelines, and milestone progress. Includes a TUI overlay for quick access.
|
|
253
273
|
|
|
274
|
+
**Footer** renders a persistent status bar at the bottom of the terminal, showing live stats from all Unipi packages — compactor tokens, memory count, MCP status, Ralph loops, workflow state, kanboard tasks, and notifications. Fully configurable with presets and per-segment toggles.
|
|
275
|
+
|
|
254
276
|
## Module Discovery
|
|
255
277
|
|
|
256
278
|
Modules announce presence via `pi.events`. When `@pi-unipi/workflow` detects `@pi-unipi/ralph`, it enables loop integration. Each module works standalone.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/unipi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "All-in-one extension suite for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
"node_modules/@pi-unipi/notify/index.ts",
|
|
51
51
|
"node_modules/@pi-unipi/milestone/index.ts",
|
|
52
52
|
"node_modules/@pi-unipi/kanboard/index.ts",
|
|
53
|
-
"node_modules/@pi-unipi/command-enchantment/src/index.ts"
|
|
53
|
+
"node_modules/@pi-unipi/command-enchantment/src/index.ts",
|
|
54
|
+
"node_modules/@pi-unipi/footer/src/index.ts",
|
|
55
|
+
"node_modules/@pi-unipi/updater/src/index.ts",
|
|
56
|
+
"node_modules/@pi-unipi/input-shortcuts/src/index.ts"
|
|
54
57
|
],
|
|
55
58
|
"skills": [
|
|
56
59
|
"node_modules/@pi-unipi/workflow/skills",
|
|
@@ -63,7 +66,8 @@
|
|
|
63
66
|
"node_modules/@pi-unipi/compactor/skills",
|
|
64
67
|
"node_modules/@pi-unipi/notify/skills",
|
|
65
68
|
"node_modules/@pi-unipi/milestone/skills",
|
|
66
|
-
"node_modules/@pi-unipi/kanboard/skills"
|
|
69
|
+
"node_modules/@pi-unipi/kanboard/skills",
|
|
70
|
+
"node_modules/@pi-unipi/updater/skills"
|
|
67
71
|
]
|
|
68
72
|
},
|
|
69
73
|
"peerDependencies": {
|
|
@@ -88,7 +92,10 @@
|
|
|
88
92
|
"@pi-unipi/milestone": "*",
|
|
89
93
|
"@pi-unipi/kanboard": "*",
|
|
90
94
|
"@pi-unipi/web-api": "*",
|
|
91
|
-
"@pi-unipi/workflow": "*"
|
|
95
|
+
"@pi-unipi/workflow": "*",
|
|
96
|
+
"@pi-unipi/footer": "*",
|
|
97
|
+
"@pi-unipi/updater": "*",
|
|
98
|
+
"@pi-unipi/input-shortcuts": "*"
|
|
92
99
|
},
|
|
93
100
|
"devDependencies": {
|
|
94
101
|
"@types/node": "^25.6.0",
|
|
@@ -29,6 +29,9 @@ export const PACKAGE_ORDER: string[] = [
|
|
|
29
29
|
"compact",
|
|
30
30
|
"notify",
|
|
31
31
|
"kanboard",
|
|
32
|
+
"footer",
|
|
33
|
+
"updater",
|
|
34
|
+
"input-shortcuts",
|
|
32
35
|
];
|
|
33
36
|
|
|
34
37
|
// ─── Package Colors ──────────────────────────────────────────────────
|
|
@@ -46,6 +49,9 @@ export const PACKAGE_COLORS: Record<string, string> = {
|
|
|
46
49
|
compact: `${ESC}[37m`, // White
|
|
47
50
|
notify: `${ESC}[96m`, // Bright Cyan
|
|
48
51
|
kanboard: `${ESC}[92m`, // Bright Green
|
|
52
|
+
footer: `${ESC}[34m`, // Blue
|
|
53
|
+
updater: `${ESC}[93m`, // Bright Yellow
|
|
54
|
+
"input-shortcuts": `${ESC}[95m`, // Bright Magenta
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
// ─── Command Registry ────────────────────────────────────────────────
|
|
@@ -143,6 +149,18 @@ export const COMMAND_REGISTRY: Record<string, string> = {
|
|
|
143
149
|
// kanboard (3 commands)
|
|
144
150
|
"unipi:kanboard": "kanboard",
|
|
145
151
|
"unipi:kanboard-doctor": "kanboard",
|
|
152
|
+
|
|
153
|
+
// footer (2 commands)
|
|
154
|
+
"unipi:footer": "footer",
|
|
155
|
+
"unipi:footer-settings": "footer",
|
|
156
|
+
|
|
157
|
+
// updater (3 commands)
|
|
158
|
+
"unipi:readme": "updater",
|
|
159
|
+
"unipi:changelog": "updater",
|
|
160
|
+
"unipi:updater-settings": "updater",
|
|
161
|
+
|
|
162
|
+
// input-shortcuts (1 command)
|
|
163
|
+
"unipi:stash-settings": "input-shortcuts",
|
|
146
164
|
};
|
|
147
165
|
|
|
148
166
|
// ─── Description Map ─────────────────────────────────────────────────
|
|
@@ -227,6 +245,15 @@ export const COMMAND_DESCRIPTIONS: Record<string, string> = {
|
|
|
227
245
|
|
|
228
246
|
"unipi:milestone-onboard": "Create MILESTONES.md from existing workflow docs",
|
|
229
247
|
"unipi:milestone-update": "Sync MILESTONES.md with completed work",
|
|
248
|
+
|
|
249
|
+
"unipi:footer": "Toggle footer or switch preset",
|
|
250
|
+
"unipi:footer-settings": "Open footer settings — toggle groups and segments",
|
|
251
|
+
|
|
252
|
+
"unipi:readme": "Browse package README files",
|
|
253
|
+
"unipi:changelog": "Browse changelog (Keep a Changelog format)",
|
|
254
|
+
"unipi:updater-settings": "Configure updater — check interval and auto-update",
|
|
255
|
+
|
|
256
|
+
"unipi:stash-settings": "Open input shortcuts settings — customize keybindings",
|
|
230
257
|
};
|
|
231
258
|
|
|
232
259
|
// ─── Package Display Names ───────────────────────────────────────────
|
|
@@ -244,4 +271,7 @@ export const PACKAGE_LABELS: Record<string, string> = {
|
|
|
244
271
|
compact: "compact",
|
|
245
272
|
notify: "notify",
|
|
246
273
|
kanboard: "kanboard",
|
|
274
|
+
footer: "footer",
|
|
275
|
+
updater: "updater",
|
|
276
|
+
"input-shortcuts": "input-shortcuts",
|
|
247
277
|
};
|
|
@@ -52,8 +52,8 @@ export function loadConfig(): CommandEnchantmentConfig {
|
|
|
52
52
|
...config,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
} catch
|
|
56
|
-
|
|
55
|
+
} catch {
|
|
56
|
+
// Silently ignore — config load failure falls back to defaults.
|
|
57
57
|
}
|
|
58
58
|
return DEFAULT_CONFIG;
|
|
59
59
|
}
|
|
@@ -15,45 +15,71 @@ Context engine for Pi coding agent. Fuses zero-LLM compaction, session continuit
|
|
|
15
15
|
| Command | Description |
|
|
16
16
|
|---------|-------------|
|
|
17
17
|
| `/unipi:compact` | Manual compaction with stats |
|
|
18
|
-
| `/unipi:
|
|
18
|
+
| `/unipi:session-recall` | Search session history (BM25 or regex) |
|
|
19
|
+
| `/unipi:content-index` | Index current project into FTS5 |
|
|
20
|
+
| `/unipi:content-search` | Search indexed content |
|
|
21
|
+
| `/unipi:content-purge` | Wipe all indexed content |
|
|
19
22
|
| `/unipi:compact-stats` | Context savings dashboard |
|
|
20
23
|
| `/unipi:compact-doctor` | Run diagnostics |
|
|
21
24
|
| `/unipi:compact-settings` | TUI settings overlay |
|
|
22
25
|
| `/unipi:compact-preset <name>` | Apply quick preset |
|
|
23
|
-
| `/unipi:compact-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
|
30
|
-
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
|
|
26
|
+
| `/unipi:compact-help` | Show detailed documentation |
|
|
27
|
+
|
|
28
|
+
## Agent Tools
|
|
29
|
+
|
|
30
|
+
| Tool | Family | Description |
|
|
31
|
+
|------|--------|-------------|
|
|
32
|
+
| `compact` | compaction | Trigger manual compaction (dryRun: true to preview) |
|
|
33
|
+
| `session_recall` | session | BM25 session history search |
|
|
34
|
+
| `sandbox` | sandbox | Run code in sandbox (11 languages) |
|
|
35
|
+
| `sandbox_file` | sandbox | Execute file via FILE_CONTENT |
|
|
36
|
+
| `sandbox_batch` | sandbox | Atomic batch of commands + searches |
|
|
37
|
+
| `content_index` | content | Chunk content → FTS5 index |
|
|
38
|
+
| `content_search` | content | Query indexed content |
|
|
39
|
+
| `content_fetch` | content | Fetch URL → index |
|
|
40
|
+
| `compactor_stats` | compactor | Context savings dashboard |
|
|
41
|
+
| `compactor_doctor` | compactor | Diagnostics checklist |
|
|
42
|
+
| `context_budget` | compactor | Estimate remaining context window |
|
|
43
|
+
|
|
44
|
+
## Two-Tier Skills
|
|
45
|
+
|
|
46
|
+
- **Tier 1** (`compactor`): ~175 tokens, always loaded. Routing + critical rules + Ralph awareness.
|
|
47
|
+
- **Tier 2** (`compactor-detail`): On-demand. Full tool reference, anti-patterns, sandbox languages, FTS5 modes, workflows.
|
|
41
48
|
|
|
42
49
|
## Configuration
|
|
43
50
|
|
|
44
|
-
Config lives at `~/.unipi/config/compactor/config.json`.
|
|
51
|
+
Config lives at `~/.unipi/config/compactor/config.json`. Per-project overrides at `<project>/.unipi/config/compactor.json`.
|
|
45
52
|
|
|
46
53
|
### Presets
|
|
47
54
|
|
|
48
55
|
| Preset | Description |
|
|
49
56
|
|--------|-------------|
|
|
50
|
-
| `
|
|
51
|
-
| `balanced` |
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
57
|
+
| `precise` | Code-heavy, minimal waste — compaction: full, pipeline: 2/6 on |
|
|
58
|
+
| `balanced` | Daily use (default) — all strategies moderate, pipeline: all on |
|
|
59
|
+
| `thorough` | Debug/audit — everything on, full transcript |
|
|
60
|
+
| `lean` | Quick fixes — compaction only, pipeline: all off |
|
|
54
61
|
|
|
55
62
|
Apply via `/unipi:compact-preset <name>`.
|
|
56
63
|
|
|
64
|
+
### Pipeline Features
|
|
65
|
+
|
|
66
|
+
| Feature | Description | Context |
|
|
67
|
+
|---------|-------------|---------|
|
|
68
|
+
| TTL Cache | Cache with time-based expiry | On Compaction |
|
|
69
|
+
| Auto Injection | Inject behavioral state after compaction | On Compaction |
|
|
70
|
+
| MMap Pragma | Use mmap for SQLite I/O | On Compaction |
|
|
71
|
+
| Proximity Reranking | Rerank search results by proximity | On Search |
|
|
72
|
+
| Timeline Sort | Sort session events chronologically | On Search |
|
|
73
|
+
| Progressive Throttling | Slow down indexing for large projects | On Index |
|
|
74
|
+
|
|
75
|
+
### TUI
|
|
76
|
+
|
|
77
|
+
Tabbed settings interface (Presets / Strategies / Pipeline):
|
|
78
|
+
- `/` key opens search filter in Strategies tab
|
|
79
|
+
- Preset selection shows 3-line preview
|
|
80
|
+
- Per-project override checkbox (`o` key)
|
|
81
|
+
- Keyboard: `←→` cycle modes, `Space` toggle, `s` save, `Esc` cancel
|
|
82
|
+
|
|
57
83
|
## Architecture
|
|
58
84
|
|
|
59
85
|
```
|
|
@@ -1,74 +1,30 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: compactor
|
|
3
|
-
description:
|
|
3
|
+
description: Context management — compact session, recall history, run code, search content.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Compactor
|
|
6
|
+
# Compactor — Context Management
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## When Context Is Tight
|
|
9
|
+
- `context_budget` → check % full. `compact` → free tokens (zero-LLM, 98%+ reduction).
|
|
10
|
+
Compact BEFORE complex work. `compact(dryRun: true)` to preview without compacting.
|
|
11
|
+
- `compactor_stats` → check savings. `compactor_doctor` → diagnose.
|
|
9
12
|
|
|
10
|
-
##
|
|
13
|
+
## Finding Past Work
|
|
14
|
+
- `session_recall(query)` → search this session (BM25 or regex).
|
|
15
|
+
- `content_search(query)` → search indexed files/docs.
|
|
16
|
+
→ Index first: `content_index` or `content_fetch(url)`.
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
│ └── /unipi:compact or `compact` tool
|
|
16
|
-
│
|
|
17
|
-
├── Find something from earlier in the session
|
|
18
|
-
│ └── /unipi:compact-recall <query> or `vcc_recall` tool
|
|
19
|
-
│
|
|
20
|
-
├── Run code safely
|
|
21
|
-
│ └── `ctx_execute` tool (single) or `ctx_batch_execute` (batch)
|
|
22
|
-
│
|
|
23
|
-
├── Index project files for search
|
|
24
|
-
│ └── /unipi:compact-index or `ctx_index` tool
|
|
25
|
-
│
|
|
26
|
-
├── Search indexed content
|
|
27
|
-
│ └── /unipi:compact-search <query> or `ctx_search` tool
|
|
28
|
-
│
|
|
29
|
-
├── Fetch and index a URL
|
|
30
|
-
│ └── `ctx_fetch_and_index` tool
|
|
31
|
-
│
|
|
32
|
-
├── View compactor stats
|
|
33
|
-
│ └── /unipi:compact-stats or `ctx_stats` tool
|
|
34
|
-
│
|
|
35
|
-
├── Diagnose issues
|
|
36
|
-
│ └── /unipi:compact-doctor or `ctx_doctor` tool
|
|
37
|
-
│
|
|
38
|
-
├── Change settings
|
|
39
|
-
│ └── /unipi:compact-settings (TUI overlay)
|
|
40
|
-
│ └── /unipi:compact-preset <name> (quick preset)
|
|
41
|
-
│
|
|
42
|
-
└── Wipe indexed content
|
|
43
|
-
└── /unipi:compact-purge
|
|
44
|
-
```
|
|
18
|
+
## Running Code
|
|
19
|
+
- `sandbox(lang, code)` → single script. `sandbox_batch(items)` → atomic.
|
|
20
|
+
`sandbox_file(lang, path)` → run file. Only stdout enters context.
|
|
45
21
|
|
|
46
|
-
##
|
|
22
|
+
## Complex Multi-Step Tasks
|
|
23
|
+
⚠ When the task spans many operations, PREFER Ralph loops
|
|
24
|
+
(`/unipi:work`, `ralph_start`) if available — they manage
|
|
25
|
+
context pressure better than monolithic runs.
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
## When to Recall
|
|
54
|
-
|
|
55
|
-
- User references something from earlier
|
|
56
|
-
- Need to find a file path mentioned before
|
|
57
|
-
- Looking for a previous error or decision
|
|
58
|
-
- Searching for a specific code snippet
|
|
59
|
-
|
|
60
|
-
## When to Index
|
|
61
|
-
|
|
62
|
-
- Starting work on a large codebase
|
|
63
|
-
- Need fast search across many files
|
|
64
|
-
- Documentation or reference material
|
|
65
|
-
- Before a research-heavy task
|
|
66
|
-
|
|
67
|
-
## Presets
|
|
68
|
-
|
|
69
|
-
| Preset | Best For |
|
|
70
|
-
|--------|----------|
|
|
71
|
-
| `opencode` | Code-heavy work, minimal context waste |
|
|
72
|
-
| `balanced` | General use, good defaults |
|
|
73
|
-
| `verbose` | Maximum context preservation |
|
|
74
|
-
| `minimal` | Maximum token savings |
|
|
27
|
+
## Critical Rules
|
|
28
|
+
- Compact BEFORE starting, not when full.
|
|
29
|
+
- `session_recall` instead of scrolling history.
|
|
30
|
+
- Index project files early if you'll search often.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: compactor-detail
|
|
3
|
+
description: Full compactor reference — tool parameters, anti-patterns, sandbox languages, FTS5 modes, workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Compactor — Full Reference
|
|
7
|
+
|
|
8
|
+
## Tool Parameter Reference
|
|
9
|
+
|
|
10
|
+
### compact
|
|
11
|
+
```
|
|
12
|
+
compact()
|
|
13
|
+
```
|
|
14
|
+
Trigger manual context compaction. Zero LLM — pure regex/text processing.
|
|
15
|
+
Returns stats after next `session_compact` event.
|
|
16
|
+
|
|
17
|
+
### session_recall
|
|
18
|
+
```
|
|
19
|
+
session_recall(query: string, mode?: "bm25" | "regex", limit?: number, offset?: number, expand?: boolean)
|
|
20
|
+
```
|
|
21
|
+
Search session history. BM25 is default (TF-IDF ranked). Regex is fallback.
|
|
22
|
+
|
|
23
|
+
### sandbox
|
|
24
|
+
```
|
|
25
|
+
sandbox(language: string, code: string, timeout?: number)
|
|
26
|
+
```
|
|
27
|
+
Run code in sandboxed env. Only stdout enters context. 100MB output cap. 30s default timeout.
|
|
28
|
+
|
|
29
|
+
### sandbox_file
|
|
30
|
+
```
|
|
31
|
+
sandbox_file(language: string, path: string, timeout?: number)
|
|
32
|
+
```
|
|
33
|
+
Execute file. Content injected as `FILE_CONTENT` variable.
|
|
34
|
+
|
|
35
|
+
### sandbox_batch
|
|
36
|
+
```
|
|
37
|
+
sandbox_batch(items: Array<{type: "execute", language, code} | {type: "search", query}>)
|
|
38
|
+
```
|
|
39
|
+
Atomic batch — all items run, results returned together.
|
|
40
|
+
|
|
41
|
+
### content_index
|
|
42
|
+
```
|
|
43
|
+
content_index(label: string, content?: string, filePath?: string, contentType?: "markdown"|"json"|"plain", chunkSize?: number)
|
|
44
|
+
```
|
|
45
|
+
Index content into FTS5. Provide either `content` or `filePath`. Auto-chunks by type.
|
|
46
|
+
|
|
47
|
+
### content_search
|
|
48
|
+
```
|
|
49
|
+
content_search(query: string, limit?: number, offset?: number)
|
|
50
|
+
```
|
|
51
|
+
Search FTS5 index. Returns ranked results with title, content, source, rank.
|
|
52
|
+
|
|
53
|
+
### content_fetch
|
|
54
|
+
```
|
|
55
|
+
content_fetch(url: string, label?: string, chunkSize?: number)
|
|
56
|
+
```
|
|
57
|
+
Fetch URL → markdown → index. Auto-indexes for later search.
|
|
58
|
+
|
|
59
|
+
### compactor_stats
|
|
60
|
+
```
|
|
61
|
+
compactor_stats()
|
|
62
|
+
```
|
|
63
|
+
Dashboard: session events, compactions, tokens saved, indexed docs, sandbox runs, search queries.
|
|
64
|
+
|
|
65
|
+
### compactor_doctor
|
|
66
|
+
```
|
|
67
|
+
compactor_doctor()
|
|
68
|
+
```
|
|
69
|
+
Diagnostics: config file, session DB, content store, runtimes (node, python3, bash).
|
|
70
|
+
|
|
71
|
+
### context_budget
|
|
72
|
+
```
|
|
73
|
+
context_budget()
|
|
74
|
+
```
|
|
75
|
+
Estimate remaining context tokens and % full. Returns guidance on whether to compact.
|
|
76
|
+
|
|
77
|
+
## Sandbox Language Reference
|
|
78
|
+
|
|
79
|
+
| Language | Binaries | Timeout | Notes |
|
|
80
|
+
|----------|----------|---------|-------|
|
|
81
|
+
| javascript | Bun/node | 30s | Default: Bun if available |
|
|
82
|
+
| typescript | Bun/node | 30s | Compiled via Bun transform |
|
|
83
|
+
| python | python3 | 30s | - |
|
|
84
|
+
| shell | bash | 30s | Pipelines supported |
|
|
85
|
+
| ruby | ruby | 30s | - |
|
|
86
|
+
| go | go | 30s | go run |
|
|
87
|
+
| rust | rustc+cargo | 30s | cargo script or rustc |
|
|
88
|
+
| php | php | 30s | - |
|
|
89
|
+
| perl | perl | 30s | - |
|
|
90
|
+
| r | Rscript | 30s | - |
|
|
91
|
+
| elixir | elixir | 30s | - |
|
|
92
|
+
|
|
93
|
+
## FTS5 Search Modes
|
|
94
|
+
|
|
95
|
+
| Mode | When To Use |
|
|
96
|
+
|------|-------------|
|
|
97
|
+
| **porter** | Exact term matching with stemming |
|
|
98
|
+
| **trigram** | Fuzzy/spelling errors, partial matches |
|
|
99
|
+
| **rrf** | Best overall (Reciprocal Rank Fusion of porter+trigram) |
|
|
100
|
+
| **fuzzy** | Auto-correction of misspellings from vocabulary |
|
|
101
|
+
|
|
102
|
+
Default: `rrf` (best general-purpose).
|
|
103
|
+
|
|
104
|
+
## Anti-Patterns
|
|
105
|
+
|
|
106
|
+
1. **Don't call `compact` in a tight loop.** It triggers the full compaction pipeline. Call once before complex work.
|
|
107
|
+
2. **Don't search without indexing.** `content_search` has nothing to search until you `content_index` or `content_fetch`.
|
|
108
|
+
3. **Don't use `sandbox` for file ops.** Use bash instead. Sandbox is for computation.
|
|
109
|
+
4. **Don't use `session_recall` with empty query.** It needs meaningful search terms.
|
|
110
|
+
5. **Don't index node_modules.** Stick to source files and documentation.
|
|
111
|
+
6. **Don't compact mid-task.** Wait for a natural break point.
|
|
112
|
+
|
|
113
|
+
## Workflow Patterns
|
|
114
|
+
|
|
115
|
+
### Research → Index → Search → Test
|
|
116
|
+
1. `content_fetch(url)` — index reference docs
|
|
117
|
+
2. `content_search(query)` — find relevant sections
|
|
118
|
+
3. `sandbox(lang, code)` — test hypotheses
|
|
119
|
+
|
|
120
|
+
### Diagnose → Fix → Verify
|
|
121
|
+
1. `compactor_doctor` — check system health
|
|
122
|
+
2. Fix issues (install runtimes, rebuild index)
|
|
123
|
+
3. `compactor_stats` — verify metrics
|
|
124
|
+
|
|
125
|
+
### Before Complex Work
|
|
126
|
+
1. `compact` — free up context
|
|
127
|
+
2. `content_index` — index relevant files
|
|
128
|
+
3. `session_recall("goals")` — load context
|
|
129
|
+
|
|
130
|
+
### After Long Session
|
|
131
|
+
1. `compactor_stats` — check savings
|
|
132
|
+
2. `compact` — compact if needed
|
|
133
|
+
3. `session_recall(topic)` — verify recall quality
|