clikit-plugin 0.3.3 → 0.3.5
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/AGENTS.md +34 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +524 -111
- package/memory/_digest.md +1 -1
- package/memory/project/gotchas.md +102 -0
- package/package.json +3 -4
- package/skill/compaction/SKILL.md +69 -0
- package/skill/context-engineering/SKILL.md +93 -0
- package/skill/context-management/SKILL.md +70 -0
- package/dist/beads-context.test.d.ts +0 -2
- package/dist/beads-context.test.d.ts.map +0 -1
- package/dist/cli.test.d.ts +0 -2
- package/dist/cli.test.d.ts.map +0 -1
- package/dist/clilog.test.d.ts +0 -12
- package/dist/clilog.test.d.ts.map +0 -1
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/hooks/tilth-reading.test.d.ts +0 -2
- package/dist/hooks/tilth-reading.test.d.ts.map +0 -1
package/memory/_digest.md
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Project Gotchas
|
|
2
|
+
|
|
3
|
+
> Lessons learned and known pitfalls for this project. Updated as issues are discovered.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## DCP Beta (`@tarquinen/opencode-dcp@beta`)
|
|
8
|
+
|
|
9
|
+
### Single compress tool — no prune, no distill
|
|
10
|
+
|
|
11
|
+
DCP beta ships with **one tool: `compress`**. The old 3-tool system (`distill`, `compress`, `prune`) is gone.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
❌ /dcp prune → does not exist in beta
|
|
15
|
+
❌ /dcp distill → does not exist in beta
|
|
16
|
+
✅ /dcp compress → the only compression tool
|
|
17
|
+
✅ /dcp sweep → aggressive compress variant
|
|
18
|
+
✅ /dcp stats → token breakdown
|
|
19
|
+
✅ /dcp context → full context breakdown
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If you encounter guidance mentioning `prune` or `distill`, it is outdated.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### Config location
|
|
27
|
+
|
|
28
|
+
DCP reads config in this priority order (highest last):
|
|
29
|
+
|
|
30
|
+
1. `~/.config/opencode/dcp.jsonc` (global)
|
|
31
|
+
2. `$OPENCODE_CONFIG_DIR/dcp.jsonc` (if env set)
|
|
32
|
+
3. `.opencode/dcp.jsonc` ← **project level, highest priority**
|
|
33
|
+
|
|
34
|
+
DCP's own code lives at: `~/.cache/opencode/node_modules/@tarquinen/opencode-dcp/`
|
|
35
|
+
Do not edit files there — they get overwritten on reinstall.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### Auto-protected tools
|
|
40
|
+
|
|
41
|
+
DCP will **never** prune output from these tools (hardcoded in beta):
|
|
42
|
+
|
|
43
|
+
| Tool | Reason protected |
|
|
44
|
+
|------|-----------------|
|
|
45
|
+
| `task` | Subagent results are always critical |
|
|
46
|
+
| `skill` | Skill content must persist for active use |
|
|
47
|
+
| `todowrite` | In-session task state |
|
|
48
|
+
| `todoread` | In-session task state |
|
|
49
|
+
| `compress` | DCP's own operations |
|
|
50
|
+
| `batch` | Batched tool call containers |
|
|
51
|
+
| `plan_enter` | Plan mode boundary markers |
|
|
52
|
+
| `plan_exit` | Plan mode boundary markers |
|
|
53
|
+
|
|
54
|
+
These are also listed in `.opencode/dcp.jsonc → protectedToolNames`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Nudge configuration
|
|
59
|
+
|
|
60
|
+
Current project config (`.opencode/dcp.jsonc`):
|
|
61
|
+
|
|
62
|
+
```jsonc
|
|
63
|
+
"nudgeFrequency": 5, // suggest after every 5 iterations
|
|
64
|
+
"iterationNudgeThreshold": 15, // become more insistent after 15 iterations
|
|
65
|
+
"nudgeForce": "soft" // suggests, does not force auto-compress
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `nudgeForce: "soft"` = DCP nudges but **you** trigger compress.
|
|
69
|
+
- If you want DCP to auto-compress: change to `"nudgeForce": "auto"` (not recommended for default).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Reduced cache invalidation
|
|
74
|
+
|
|
75
|
+
Beta has reduced cache invalidation compared to v2. This improves performance but means:
|
|
76
|
+
- Config changes in `dcp.jsonc` may not take effect until OpenCode restarts.
|
|
77
|
+
- If compress behavior seems wrong after config edit → restart OpenCode.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### compress.permission: "ask"
|
|
82
|
+
|
|
83
|
+
Default config uses `"permission": "ask"` — DCP will prompt before compressing.
|
|
84
|
+
If you want silent auto-compress: change to `"permission": "auto"`.
|
|
85
|
+
|
|
86
|
+
Avoid `"permission": "deny"` unless debugging — it disables all compression.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Installing alongside CliKit
|
|
91
|
+
|
|
92
|
+
DCP beta is installed automatically by CliKit when you run:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
bun x clikit-plugin install
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This adds **both** entries to `opencode.json`:
|
|
99
|
+
- `clikit-plugin@latest`
|
|
100
|
+
- `@tarquinen/opencode-dcp@beta`
|
|
101
|
+
|
|
102
|
+
Restart OpenCode after install to activate.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clikit-plugin",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "OpenCode plugin — 7 agents, 15 commands,
|
|
3
|
+
"version": "0.3.5",
|
|
4
|
+
"description": "OpenCode plugin — 7 agents, 15 commands, 25 skills, 10 hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -30,9 +30,8 @@
|
|
|
30
30
|
"lint": "tsc --noEmit",
|
|
31
31
|
"prepublishOnly": "bun run clean && bun run build",
|
|
32
32
|
"postpublish": "rm -rf ~/.cache/opencode/node_modules/clikit-plugin && rm -f ~/.cache/opencode/bun.lock && echo '✓ Cleared OpenCode plugin cache — next start will install fresh'",
|
|
33
|
-
"test": "bun test",
|
|
34
33
|
"typecheck": "tsc --noEmit",
|
|
35
|
-
"verify": "bun run lint && bun run
|
|
34
|
+
"verify": "bun run lint && bun run build",
|
|
36
35
|
"dev": "bun run build --watch"
|
|
37
36
|
},
|
|
38
37
|
"keywords": [
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: compaction
|
|
3
|
+
description: Use when preparing for context compaction or session compression. Compress-first patterns with DCP beta. Replaces legacy prune/distill guidance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Compaction (Compress-First)
|
|
7
|
+
|
|
8
|
+
## What Changed in DCP Beta
|
|
9
|
+
|
|
10
|
+
| Old (v2 / legacy) | New (beta) |
|
|
11
|
+
|-------------------|-----------|
|
|
12
|
+
| `/dcp distill` | Removed |
|
|
13
|
+
| `/dcp prune` | Removed |
|
|
14
|
+
| `/dcp compress` | ✅ The single compress tool |
|
|
15
|
+
| 3-tool system | Single `compress` tool |
|
|
16
|
+
|
|
17
|
+
**If you see guidance referencing `distill` or `prune`, it is outdated. Use `compress` instead.**
|
|
18
|
+
|
|
19
|
+
## Compress-First Workflow
|
|
20
|
+
|
|
21
|
+
### Before starting a long task
|
|
22
|
+
```
|
|
23
|
+
/dcp stats # baseline token state
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Mid-task (when yellow zone)
|
|
27
|
+
```
|
|
28
|
+
/dcp compress # consolidate — DCP will ask permission
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### End of heavy task
|
|
32
|
+
```
|
|
33
|
+
/dcp sweep # aggressive final compression before /handoff
|
|
34
|
+
/dcp stats # verify savings
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## When Compaction Happens
|
|
38
|
+
|
|
39
|
+
OpenCode triggers its own internal compaction (`experimental.session.compacting`) at high context usage. DCP runs *before* that threshold with `/dcp compress` to prevent reaching it.
|
|
40
|
+
|
|
41
|
+
**Priority order:**
|
|
42
|
+
1. `/dcp compress` — DCP-level (smart, preserves task state)
|
|
43
|
+
2. OpenCode internal compaction — last resort (less targeted)
|
|
44
|
+
|
|
45
|
+
## Beads State is Protected
|
|
46
|
+
|
|
47
|
+
The `beads-context` hook injects Beads task state into every compaction event. Even after compression, agents will still see:
|
|
48
|
+
- Current in-progress issue
|
|
49
|
+
- Blocked issues
|
|
50
|
+
- Ready tasks
|
|
51
|
+
|
|
52
|
+
This is automatic — no extra action needed.
|
|
53
|
+
|
|
54
|
+
## Compaction Checklist
|
|
55
|
+
|
|
56
|
+
Before compressing:
|
|
57
|
+
- [ ] Any critical output still needed? Copy key parts to `memory/` first
|
|
58
|
+
- [ ] Active Beads task ID noted? (will be preserved automatically)
|
|
59
|
+
- [ ] Currently in the middle of a multi-file edit? Finish the file first, then compress
|
|
60
|
+
|
|
61
|
+
After compressing:
|
|
62
|
+
- [ ] Run `/dcp stats` to verify savings
|
|
63
|
+
- [ ] Continue task normally
|
|
64
|
+
|
|
65
|
+
## Anti-patterns
|
|
66
|
+
|
|
67
|
+
- ❌ Waiting until red zone (> 80%) — compress early, compress often
|
|
68
|
+
- ❌ Using prune/distill commands — they do not exist in beta
|
|
69
|
+
- ❌ Compressing during an active `multiedit` or write batch — finish writes first
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-engineering
|
|
3
|
+
description: Use when designing how information should flow through context — what to include, exclude, protect, and compress. DCP beta compress-only model.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Engineering (DCP Beta)
|
|
7
|
+
|
|
8
|
+
## Model
|
|
9
|
+
|
|
10
|
+
DCP beta: **single compress tool** at `@tarquinen/opencode-dcp@beta`.
|
|
11
|
+
There is no `distill` or `prune`. All context reduction goes through `compress`.
|
|
12
|
+
|
|
13
|
+
## Layers of Context Control
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Session start → beads-context hook injects task state
|
|
17
|
+
→ memory-digest hook injects project observations
|
|
18
|
+
Mid-session → /dcp compress (DCP) + truncator hook (output limits)
|
|
19
|
+
Session end → /dcp sweep + /handoff (disk persistence)
|
|
20
|
+
Compaction event → OpenCode internal + beads-context preservation
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What to Keep vs. Compress
|
|
24
|
+
|
|
25
|
+
| Content | Strategy |
|
|
26
|
+
|---------|----------|
|
|
27
|
+
| Current task (Beads state) | **Always keep** — auto-protected |
|
|
28
|
+
| Skill content just loaded | Keep until task using it is done |
|
|
29
|
+
| Subagent results (`task` tool) | **Always keep** — auto-protected |
|
|
30
|
+
| Repeated tool outputs (same file read multiple times) | Compress — DCP deduplication handles this |
|
|
31
|
+
| Error traces from resolved issues | Compress — DCP `purgeErrors` strategy |
|
|
32
|
+
| Old superseded file writes | Compress — DCP `supersedeWrites` strategy |
|
|
33
|
+
|
|
34
|
+
## DCP Strategies Reference
|
|
35
|
+
|
|
36
|
+
| Strategy | What it removes | Default |
|
|
37
|
+
|----------|----------------|---------|
|
|
38
|
+
| `deduplication` | Repeated identical tool outputs | enabled |
|
|
39
|
+
| `supersedeWrites` | Earlier versions of the same file write | enabled |
|
|
40
|
+
| `purgeErrors` | Tool errors older than N turns | enabled (4 turns) |
|
|
41
|
+
|
|
42
|
+
## Protecting Critical Context
|
|
43
|
+
|
|
44
|
+
Add to `.opencode/dcp.jsonc` → `protectedToolNames` to prevent DCP from compressing specific tool outputs:
|
|
45
|
+
|
|
46
|
+
```jsonc
|
|
47
|
+
"protectedToolNames": [
|
|
48
|
+
"task", "skill", "todowrite", "todoread",
|
|
49
|
+
"compress", "batch", "plan_enter", "plan_exit"
|
|
50
|
+
]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Default protected tools are set in `.opencode/dcp.jsonc`. Do not remove them.
|
|
54
|
+
|
|
55
|
+
## Token Budget Signals
|
|
56
|
+
|
|
57
|
+
Watch for DCP nudges — when `nudgeFrequency: 5` is hit, DCP will suggest compression.
|
|
58
|
+
At `iterationNudgeThreshold: 15`, it becomes more insistent (still `soft` force — not automatic).
|
|
59
|
+
|
|
60
|
+
## Common Patterns
|
|
61
|
+
|
|
62
|
+
### Pattern 1: Long research task
|
|
63
|
+
```
|
|
64
|
+
Start → /dcp stats (baseline)
|
|
65
|
+
→ multiple @research / @explore calls
|
|
66
|
+
→ context yellow → /dcp compress
|
|
67
|
+
→ continue
|
|
68
|
+
→ done → /dcp sweep (cleanup)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Pattern 2: Multi-packet implementation
|
|
72
|
+
```
|
|
73
|
+
Before each new packet → /dcp stats
|
|
74
|
+
→ if > 55% → /dcp compress before starting packet
|
|
75
|
+
→ complete packet → evidence bundle
|
|
76
|
+
→ repeat
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Pattern 3: Session handoff
|
|
80
|
+
```
|
|
81
|
+
Task complete or blocked
|
|
82
|
+
→ /dcp compress (reduce context noise)
|
|
83
|
+
→ /handoff (persist state to disk)
|
|
84
|
+
→ beads-village_done or leave open
|
|
85
|
+
→ end session
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Anti-patterns
|
|
89
|
+
|
|
90
|
+
- ❌ Referencing `/dcp prune` or `/dcp distill` — removed in beta
|
|
91
|
+
- ❌ Expecting automatic compression — `permission: "ask"` means DCP waits for approval
|
|
92
|
+
- ❌ Loading large skill files repeatedly — load once, reference by name after
|
|
93
|
+
- ❌ Ignoring DCP nudges — they are signals, not noise
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-management
|
|
3
|
+
description: Use when context is growing large or you need to decide how to handle token pressure. Compress-first workflow with DCP beta.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Management (DCP Beta)
|
|
7
|
+
|
|
8
|
+
## Core Principle
|
|
9
|
+
|
|
10
|
+
DCP beta uses a **single `compress` tool**. There is no `prune` or `distill`.
|
|
11
|
+
When context pressure builds: **compress first, then handoff if needed**.
|
|
12
|
+
|
|
13
|
+
## Context Pressure Thresholds
|
|
14
|
+
|
|
15
|
+
| Level | Context % | Action |
|
|
16
|
+
|-------|-----------|--------|
|
|
17
|
+
| 🟢 Green | < 40% | Normal — no action needed |
|
|
18
|
+
| 🟡 Yellow | 40–65% | Run `/dcp stats` to inspect; offload non-critical findings to `memory/` |
|
|
19
|
+
| 🟠 Orange | 65–80% | Run `/dcp compress` before continuing; consider `/handoff` if complex work remains |
|
|
20
|
+
| 🔴 Red | > 80% | Run `/dcp sweep` immediately, write `/handoff`, end session |
|
|
21
|
+
|
|
22
|
+
## DCP Commands
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
/dcp stats # Token breakdown and savings summary
|
|
26
|
+
/dcp context # Full context breakdown by source
|
|
27
|
+
/dcp compress # Compress context (asks permission first by default)
|
|
28
|
+
/dcp sweep # Aggressive compression for critical-level pressure
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Decision Flow
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Context pressure detected?
|
|
35
|
+
│
|
|
36
|
+
├── Yellow → /dcp stats → is it tool output noise? → /dcp compress
|
|
37
|
+
│
|
|
38
|
+
├── Orange → /dcp compress → continue task → if still growing → /handoff
|
|
39
|
+
│
|
|
40
|
+
└── Red → /dcp sweep → /handoff → end session
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What DCP Protects (auto-protected tools)
|
|
44
|
+
|
|
45
|
+
DCP will **never** prune output from these tools:
|
|
46
|
+
|
|
47
|
+
- `task` — subagent results
|
|
48
|
+
- `skill` — skill loads
|
|
49
|
+
- `todowrite` / `todoread` — in-session task state
|
|
50
|
+
- `compress` — DCP's own operations
|
|
51
|
+
- `batch` — batched tool calls
|
|
52
|
+
- `plan_enter` / `plan_exit` — plan mode boundaries
|
|
53
|
+
|
|
54
|
+
## Rules
|
|
55
|
+
|
|
56
|
+
- ✅ Compress when context > 65%
|
|
57
|
+
- ✅ Use `/dcp stats` proactively — do not wait until red
|
|
58
|
+
- ✅ Combine with `session-management` skill for handoff triggers
|
|
59
|
+
- ❌ Do NOT run `/dcp prune` or `/dcp distill` — unsupported in beta
|
|
60
|
+
- ❌ Do NOT let context hit 90%+ without `/dcp sweep` + `/handoff`
|
|
61
|
+
|
|
62
|
+
## Config Reference
|
|
63
|
+
|
|
64
|
+
Project-level config: `.opencode/dcp.jsonc`
|
|
65
|
+
|
|
66
|
+
Key settings:
|
|
67
|
+
- `compress.permission: "ask"` — DCP prompts before compressing
|
|
68
|
+
- `nudgeFrequency: 5` — nudge after every 5 iterations
|
|
69
|
+
- `iterationNudgeThreshold: 15` — force nudge after 15 iterations
|
|
70
|
+
- `nudgeForce: "soft"` — suggests, does not force
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"beads-context.test.d.ts","sourceRoot":"","sources":["../src/beads-context.test.ts"],"names":[],"mappings":""}
|
package/dist/cli.test.d.ts
DELETED
package/dist/cli.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.test.d.ts","sourceRoot":"","sources":["../src/cli.test.ts"],"names":[],"mappings":""}
|
package/dist/clilog.test.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration test: cliLog + hookErr route through client.app.log
|
|
3
|
-
*
|
|
4
|
-
* Validates that:
|
|
5
|
-
* 1. cliLog() calls ctx.client.app.log with correct shape
|
|
6
|
-
* 2. hookErr() calls ctx.client.app.log with level="error" and formatted message
|
|
7
|
-
* 3. showToast() calls ctx.client.tui.showToast with correct shape
|
|
8
|
-
* 4. When client.app.log throws, cliLog falls back to console.error (doesn't rethrow)
|
|
9
|
-
* 5. Toast failures don't break hook flow (returns false, doesn't throw)
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=clilog.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clilog.test.d.ts","sourceRoot":"","sources":["../src/clilog.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
package/dist/config.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tilth-reading.test.d.ts","sourceRoot":"","sources":["../../src/hooks/tilth-reading.test.ts"],"names":[],"mappings":""}
|