@pi-unipi/unipi 0.1.14 → 0.1.15
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 +13 -1
- package/package.json +5 -3
- package/packages/autocomplete/src/constants.ts +10 -0
- 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 +22 -1
- 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 +9 -0
- package/packages/compactor/src/index.ts +183 -10
- package/packages/compactor/src/info-screen.ts +10 -4
- package/packages/compactor/src/security/policy.ts +23 -0
- package/packages/compactor/src/session/auto-inject.ts +60 -0
- package/packages/compactor/src/session/db.ts +65 -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 +25 -1
- package/packages/footer/README.md +206 -0
- package/packages/footer/index.ts +6 -0
- package/packages/footer/src/commands.ts +204 -0
- package/packages/footer/src/config.ts +177 -0
- package/packages/footer/src/events.ts +256 -0
- package/packages/footer/src/index.ts +208 -0
- package/packages/footer/src/presets.ts +131 -0
- package/packages/footer/src/registry/index.ts +162 -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 +283 -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 +140 -0
- package/packages/footer/src/segments/notify.ts +50 -0
- package/packages/footer/src/segments/ralph.ts +109 -0
- package/packages/footer/src/segments/status-ext.ts +119 -0
- package/packages/footer/src/segments/workflow.ts +100 -0
- package/packages/footer/src/tui/settings-tui.ts +252 -0
- package/packages/footer/src/types.ts +183 -0
- package/packages/memory/index.ts +1 -1
- package/packages/unipi/index.ts +4 -0
- package/packages/utility/README.md +54 -1
- package/packages/utility/src/commands.ts +41 -3
- package/packages/utility/src/diff/highlighter.ts +353 -0
- package/packages/utility/src/diff/parser.ts +191 -0
- package/packages/utility/src/diff/renderer.ts +422 -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 +287 -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/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,7 @@ 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
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
## Packages
|
|
@@ -47,6 +48,7 @@ pi install npm:@pi-unipi/kanboard
|
|
|
47
48
|
| `@pi-unipi/ask-user` | Structured user input with options and freeform text |
|
|
48
49
|
| `@pi-unipi/milestone` | Milestone tracking and project progress management |
|
|
49
50
|
| `@pi-unipi/kanboard` | Kanboard visualization server with TUI overlay |
|
|
51
|
+
| `@pi-unipi/footer` | Persistent status bar with live stats from all packages |
|
|
50
52
|
|
|
51
53
|
## Commands
|
|
52
54
|
|
|
@@ -217,7 +219,15 @@ pi install npm:@pi-unipi/kanboard
|
|
|
217
219
|
|---------|-------------|
|
|
218
220
|
| `/unipi:kanboard` | Toggle kanboard visualization server |
|
|
219
221
|
| `/unipi:kanboard-doctor` | Diagnose and fix kanboard parser issues |
|
|
220
|
-
|
|
222
|
+
|
|
223
|
+
### Footer (`/unipi:footer*`)
|
|
224
|
+
|
|
225
|
+
| Command | Description |
|
|
226
|
+
|---------|-------------|
|
|
227
|
+
| `/unipi:footer` | Toggle footer or switch preset |
|
|
228
|
+
| `/unipi:footer-settings` | Open footer settings — toggle groups and segments |
|
|
229
|
+
|
|
230
|
+
### Name Badge
|
|
221
231
|
|
|
222
232
|
## How It Works
|
|
223
233
|
|
|
@@ -251,6 +261,8 @@ pi install npm:@pi-unipi/kanboard
|
|
|
251
261
|
|
|
252
262
|
**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
263
|
|
|
264
|
+
**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.
|
|
265
|
+
|
|
254
266
|
## Module Discovery
|
|
255
267
|
|
|
256
268
|
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.15",
|
|
4
4
|
"description": "All-in-one extension suite for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,8 @@
|
|
|
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/index.ts"
|
|
54
55
|
],
|
|
55
56
|
"skills": [
|
|
56
57
|
"node_modules/@pi-unipi/workflow/skills",
|
|
@@ -88,7 +89,8 @@
|
|
|
88
89
|
"@pi-unipi/milestone": "*",
|
|
89
90
|
"@pi-unipi/kanboard": "*",
|
|
90
91
|
"@pi-unipi/web-api": "*",
|
|
91
|
-
"@pi-unipi/workflow": "*"
|
|
92
|
+
"@pi-unipi/workflow": "*",
|
|
93
|
+
"@pi-unipi/footer": "*"
|
|
92
94
|
},
|
|
93
95
|
"devDependencies": {
|
|
94
96
|
"@types/node": "^25.6.0",
|
|
@@ -29,6 +29,7 @@ export const PACKAGE_ORDER: string[] = [
|
|
|
29
29
|
"compact",
|
|
30
30
|
"notify",
|
|
31
31
|
"kanboard",
|
|
32
|
+
"footer",
|
|
32
33
|
];
|
|
33
34
|
|
|
34
35
|
// ─── Package Colors ──────────────────────────────────────────────────
|
|
@@ -46,6 +47,7 @@ export const PACKAGE_COLORS: Record<string, string> = {
|
|
|
46
47
|
compact: `${ESC}[37m`, // White
|
|
47
48
|
notify: `${ESC}[96m`, // Bright Cyan
|
|
48
49
|
kanboard: `${ESC}[92m`, // Bright Green
|
|
50
|
+
footer: `${ESC}[34m`, // Blue
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
// ─── Command Registry ────────────────────────────────────────────────
|
|
@@ -143,6 +145,10 @@ export const COMMAND_REGISTRY: Record<string, string> = {
|
|
|
143
145
|
// kanboard (3 commands)
|
|
144
146
|
"unipi:kanboard": "kanboard",
|
|
145
147
|
"unipi:kanboard-doctor": "kanboard",
|
|
148
|
+
|
|
149
|
+
// footer (2 commands)
|
|
150
|
+
"unipi:footer": "footer",
|
|
151
|
+
"unipi:footer-settings": "footer",
|
|
146
152
|
};
|
|
147
153
|
|
|
148
154
|
// ─── Description Map ─────────────────────────────────────────────────
|
|
@@ -227,6 +233,9 @@ export const COMMAND_DESCRIPTIONS: Record<string, string> = {
|
|
|
227
233
|
|
|
228
234
|
"unipi:milestone-onboard": "Create MILESTONES.md from existing workflow docs",
|
|
229
235
|
"unipi:milestone-update": "Sync MILESTONES.md with completed work",
|
|
236
|
+
|
|
237
|
+
"unipi:footer": "Toggle footer or switch preset",
|
|
238
|
+
"unipi:footer-settings": "Open footer settings — toggle groups and segments",
|
|
230
239
|
};
|
|
231
240
|
|
|
232
241
|
// ─── Package Display Names ───────────────────────────────────────────
|
|
@@ -244,4 +253,5 @@ export const PACKAGE_LABELS: Record<string, string> = {
|
|
|
244
253
|
compact: "compact",
|
|
245
254
|
notify: "notify",
|
|
246
255
|
kanboard: "kanboard",
|
|
256
|
+
footer: "footer",
|
|
247
257
|
};
|
|
@@ -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
|