opencode-acp 1.0.0

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.
Files changed (137) hide show
  1. package/LICENSE +622 -0
  2. package/README.md +340 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +8261 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/auth.d.ts +4 -0
  8. package/dist/lib/auth.d.ts.map +1 -0
  9. package/dist/lib/commands/compression-targets.d.ts +14 -0
  10. package/dist/lib/commands/compression-targets.d.ts.map +1 -0
  11. package/dist/lib/commands/context.d.ts +52 -0
  12. package/dist/lib/commands/context.d.ts.map +1 -0
  13. package/dist/lib/commands/decompress.d.ts +12 -0
  14. package/dist/lib/commands/decompress.d.ts.map +1 -0
  15. package/dist/lib/commands/help.d.ts +17 -0
  16. package/dist/lib/commands/help.d.ts.map +1 -0
  17. package/dist/lib/commands/index.d.ts +8 -0
  18. package/dist/lib/commands/index.d.ts.map +1 -0
  19. package/dist/lib/commands/manual.d.ts +23 -0
  20. package/dist/lib/commands/manual.d.ts.map +1 -0
  21. package/dist/lib/commands/recompress.d.ts +12 -0
  22. package/dist/lib/commands/recompress.d.ts.map +1 -0
  23. package/dist/lib/commands/stats.d.ts +15 -0
  24. package/dist/lib/commands/stats.d.ts.map +1 -0
  25. package/dist/lib/commands/sweep.d.ts +23 -0
  26. package/dist/lib/commands/sweep.d.ts.map +1 -0
  27. package/dist/lib/compress/index.d.ts +4 -0
  28. package/dist/lib/compress/index.d.ts.map +1 -0
  29. package/dist/lib/compress/message-utils.d.ts +8 -0
  30. package/dist/lib/compress/message-utils.d.ts.map +1 -0
  31. package/dist/lib/compress/message.d.ts +4 -0
  32. package/dist/lib/compress/message.d.ts.map +1 -0
  33. package/dist/lib/compress/pipeline.d.ts +29 -0
  34. package/dist/lib/compress/pipeline.d.ts.map +1 -0
  35. package/dist/lib/compress/protected-content.d.ts +7 -0
  36. package/dist/lib/compress/protected-content.d.ts.map +1 -0
  37. package/dist/lib/compress/range-utils.d.ts +10 -0
  38. package/dist/lib/compress/range-utils.d.ts.map +1 -0
  39. package/dist/lib/compress/range.d.ts +4 -0
  40. package/dist/lib/compress/range.d.ts.map +1 -0
  41. package/dist/lib/compress/search.d.ts +11 -0
  42. package/dist/lib/compress/search.d.ts.map +1 -0
  43. package/dist/lib/compress/state.d.ts +10 -0
  44. package/dist/lib/compress/state.d.ts.map +1 -0
  45. package/dist/lib/compress/timing.d.ts +18 -0
  46. package/dist/lib/compress/timing.d.ts.map +1 -0
  47. package/dist/lib/compress/types.d.ts +94 -0
  48. package/dist/lib/compress/types.d.ts.map +1 -0
  49. package/dist/lib/compress-permission.d.ts +6 -0
  50. package/dist/lib/compress-permission.d.ts.map +1 -0
  51. package/dist/lib/config.d.ts +80 -0
  52. package/dist/lib/config.d.ts.map +1 -0
  53. package/dist/lib/gc/truncate.d.ts +15 -0
  54. package/dist/lib/gc/truncate.d.ts.map +1 -0
  55. package/dist/lib/hooks.d.ts +38 -0
  56. package/dist/lib/hooks.d.ts.map +1 -0
  57. package/dist/lib/host-permissions.d.ts +11 -0
  58. package/dist/lib/host-permissions.d.ts.map +1 -0
  59. package/dist/lib/logger.d.ts +31 -0
  60. package/dist/lib/logger.d.ts.map +1 -0
  61. package/dist/lib/message-ids.d.ts +19 -0
  62. package/dist/lib/message-ids.d.ts.map +1 -0
  63. package/dist/lib/messages/index.d.ts +10 -0
  64. package/dist/lib/messages/index.d.ts.map +1 -0
  65. package/dist/lib/messages/inject/inject.d.ts +8 -0
  66. package/dist/lib/messages/inject/inject.d.ts.map +1 -0
  67. package/dist/lib/messages/inject/subagent-results.d.ts +4 -0
  68. package/dist/lib/messages/inject/subagent-results.d.ts.map +1 -0
  69. package/dist/lib/messages/inject/utils.d.ts +33 -0
  70. package/dist/lib/messages/inject/utils.d.ts.map +1 -0
  71. package/dist/lib/messages/priority.d.ts +13 -0
  72. package/dist/lib/messages/priority.d.ts.map +1 -0
  73. package/dist/lib/messages/prune.d.ts +5 -0
  74. package/dist/lib/messages/prune.d.ts.map +1 -0
  75. package/dist/lib/messages/query.d.ts +7 -0
  76. package/dist/lib/messages/query.d.ts.map +1 -0
  77. package/dist/lib/messages/reasoning-strip.d.ts +8 -0
  78. package/dist/lib/messages/reasoning-strip.d.ts.map +1 -0
  79. package/dist/lib/messages/shape.d.ts +5 -0
  80. package/dist/lib/messages/shape.d.ts.map +1 -0
  81. package/dist/lib/messages/sync.d.ts +4 -0
  82. package/dist/lib/messages/sync.d.ts.map +1 -0
  83. package/dist/lib/messages/utils.d.ts +28 -0
  84. package/dist/lib/messages/utils.d.ts.map +1 -0
  85. package/dist/lib/prompts/compress-message.d.ts +2 -0
  86. package/dist/lib/prompts/compress-message.d.ts.map +1 -0
  87. package/dist/lib/prompts/compress-range.d.ts +2 -0
  88. package/dist/lib/prompts/compress-range.d.ts.map +1 -0
  89. package/dist/lib/prompts/context-limit-nudge.d.ts +2 -0
  90. package/dist/lib/prompts/context-limit-nudge.d.ts.map +1 -0
  91. package/dist/lib/prompts/extensions/nudge.d.ts +10 -0
  92. package/dist/lib/prompts/extensions/nudge.d.ts.map +1 -0
  93. package/dist/lib/prompts/extensions/system.d.ts +4 -0
  94. package/dist/lib/prompts/extensions/system.d.ts.map +1 -0
  95. package/dist/lib/prompts/extensions/tool.d.ts +3 -0
  96. package/dist/lib/prompts/extensions/tool.d.ts.map +1 -0
  97. package/dist/lib/prompts/index.d.ts +4 -0
  98. package/dist/lib/prompts/index.d.ts.map +1 -0
  99. package/dist/lib/prompts/iteration-nudge.d.ts +2 -0
  100. package/dist/lib/prompts/iteration-nudge.d.ts.map +1 -0
  101. package/dist/lib/prompts/store.d.ts +25 -0
  102. package/dist/lib/prompts/store.d.ts.map +1 -0
  103. package/dist/lib/prompts/system.d.ts +2 -0
  104. package/dist/lib/prompts/system.d.ts.map +1 -0
  105. package/dist/lib/prompts/turn-nudge.d.ts +2 -0
  106. package/dist/lib/prompts/turn-nudge.d.ts.map +1 -0
  107. package/dist/lib/protected-patterns.d.ts +5 -0
  108. package/dist/lib/protected-patterns.d.ts.map +1 -0
  109. package/dist/lib/state/index.d.ts +5 -0
  110. package/dist/lib/state/index.d.ts.map +1 -0
  111. package/dist/lib/state/persistence.d.ts +49 -0
  112. package/dist/lib/state/persistence.d.ts.map +1 -0
  113. package/dist/lib/state/state.d.ts +7 -0
  114. package/dist/lib/state/state.d.ts.map +1 -0
  115. package/dist/lib/state/tool-cache.d.ts +13 -0
  116. package/dist/lib/state/tool-cache.d.ts.map +1 -0
  117. package/dist/lib/state/types.d.ts +102 -0
  118. package/dist/lib/state/types.d.ts.map +1 -0
  119. package/dist/lib/state/utils.d.ts +22 -0
  120. package/dist/lib/state/utils.d.ts.map +1 -0
  121. package/dist/lib/strategies/deduplication.d.ts +10 -0
  122. package/dist/lib/strategies/deduplication.d.ts.map +1 -0
  123. package/dist/lib/strategies/index.d.ts +3 -0
  124. package/dist/lib/strategies/index.d.ts.map +1 -0
  125. package/dist/lib/strategies/purge-errors.d.ts +13 -0
  126. package/dist/lib/strategies/purge-errors.d.ts.map +1 -0
  127. package/dist/lib/subagents/subagent-results.d.ts +5 -0
  128. package/dist/lib/subagents/subagent-results.d.ts.map +1 -0
  129. package/dist/lib/token-utils.d.ts +19 -0
  130. package/dist/lib/token-utils.d.ts.map +1 -0
  131. package/dist/lib/ui/notification.d.ts +17 -0
  132. package/dist/lib/ui/notification.d.ts.map +1 -0
  133. package/dist/lib/ui/utils.d.ts +10 -0
  134. package/dist/lib/ui/utils.d.ts.map +1 -0
  135. package/dist/lib/update.d.ts +22 -0
  136. package/dist/lib/update.d.ts.map +1 -0
  137. package/package.json +75 -0
package/README.md ADDED
@@ -0,0 +1,340 @@
1
+ <p align="center">
2
+ <strong>Active Context Pruning</strong> for <a href="https://opencode.ai">OpenCode</a>
3
+ <br />
4
+ The model decides <em>when</em> and <em>what</em> to compress — not a hard limit.
5
+ </p>
6
+
7
+ ---
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/opencode-acp"><img src="https://img.shields.io/npm/v/opencode-acp.svg?style=flat-square" alt="npm"></a>
11
+ <a href="https://github.com/ranxianglei/opencode-acp/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/opencode-acp.svg?style=flat-square" alt="license"></a>
12
+ <a href="https://github.com/ranxianglei/opencode-acp"><img src="https://img.shields.io/badge/GitHub-ranxianglei%2Fopencode--acp-181717?style=flat-square&logo=github" alt="GitHub"></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <code>opencode plugin opencode-acp@latest --global</code>
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## Why ACP
22
+
23
+ ACP is a hardened fork of [DCP](https://github.com/Tarquinen/opencode-dynamic-context-pruning) with **35 bug fixes** applied. It turns context management from a passive, crash-prone mechanism into something stable enough for production use.
24
+
25
+ | | DCP (original) | ACP (this fork) |
26
+ |---|---|---|
27
+ | **Max stable session** | ~200 messages | 10,000+ messages |
28
+ | **Per-turn overhead** | 20 -- 50 seconds | ~90ms |
29
+ | **State persistence** | Lost on restart | Survives restart |
30
+ | **GC effectiveness** | Never deactivates old blocks | Age-based auto-cleanup |
31
+ | **Compress reliability** | Fails on edge cases, model gives up | Auto-recovers reversed boundaries |
32
+
33
+ > **Active** means the model proactively decides *when* and *what* to compress -- as opposed to passive approaches that only react when context hits a hard limit. The model uses the `compress` tool to produce high-fidelity summaries of completed conversation segments, preserving important details while freeing context space. This is superior to passive truncation because the model controls what information to keep.
34
+
35
+ Key fixes include: state persistence across restarts, token usage reporting (was returning 0), summary message ID resolution, GC age-based deactivation, 268x logger/tokenizer speedup, auto-swap for reversed compress boundaries, and aging warning suppression at low context usage.
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ opencode plugin opencode-acp@latest --global
43
+ ```
44
+
45
+ Or add to your opencode config:
46
+
47
+ ```json
48
+ {
49
+ "plugin": {
50
+ "opencode-acp": "latest"
51
+ }
52
+ }
53
+ ```
54
+
55
+ ---
56
+
57
+ ## How It Works
58
+
59
+ ACP reduces context size through a compress tool and automatic cleanup. Your session history is never modified -- ACP replaces pruned content with placeholders before sending requests to your LLM.
60
+
61
+ ### Compress
62
+
63
+ Compress is a tool exposed to your model that replaces closed, stale conversation content with high-fidelity technical summaries. You can think of this as a much smarter version of Opencode's compaction process. Instead of triggering statically when your session reaches its maximum context and on the entire coding session, Compress allows the model to pick when to activate based on task completion, and to only compress the specific messages that are no longer needed verbatim.
64
+
65
+ ACP supports two compression modes:
66
+
67
+ - **`range` mode** compresses contiguous spans of conversation into one or more summaries.
68
+ - **`message` mode** (experimental) compresses individual raw messages independently, letting the model manage context much more surgically.
69
+
70
+ In `range` mode, when a new compression overlaps an earlier one, the earlier summary is nested inside the new one so information is preserved through layers of compression rather than diluted away. In both modes, protected tool outputs (such as subagents and skills) and protected file patterns are kept in compression summaries, ensuring that the most important information is never lost. You can also enable `protectUserMessages` to preserve your messages verbatim during compression, though note that large prompts (e.g. copy-pasting log files in the prompt) will then never be compressed away.
71
+
72
+ ### Deduplication
73
+
74
+ Identifies repeated tool calls (same tool, same arguments) and keeps only the most recent output. Recalculated when the compress tool runs, so prompt cache is only impacted alongside compression.
75
+
76
+ ### Purge Errors
77
+
78
+ Prunes inputs from errored tool calls after a configurable number of turns (default: 4). Error messages are preserved; only the potentially large input content is removed. Recalculated on compress tool use.
79
+
80
+ ---
81
+
82
+ ## Commands
83
+
84
+ ACP provides an `/acp` slash command (also accepts `/dcp` for backward compatibility):
85
+
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `/acp` | Shows available ACP commands |
89
+ | `/acp context` | Token usage breakdown by category (system, user, assistant, tools, etc.) and how much has been saved through pruning |
90
+ | `/acp stats` | Cumulative pruning statistics across all sessions |
91
+ | `/acp sweep [n]` | Prunes all tools since the last user message. Optional count: `/acp sweep 10` prunes the last 10 tools. Respects `commands.protectedTools` |
92
+ | `/acp manual [on\|off]` | Toggle manual mode. When on, the AI will not autonomously use context management tools |
93
+ | `/acp compress [focus]` | Trigger a single compress tool execution. Optional focus text directs what content to compress, following the active `compress.mode` |
94
+ | `/acp decompress <n>` | Restore a specific active compression by ID. Running without an argument shows available compression IDs, token sizes, and topics |
95
+ | `/acp recompress <n>` | Re-apply a user-decompressed compression by ID. Running without an argument shows recompressible IDs, token sizes, and topics |
96
+
97
+ ---
98
+
99
+ ## Configuration
100
+
101
+ ACP uses its own config file, searched in order:
102
+
103
+ 1. **Global:** `~/.config/opencode/dcp.jsonc` (or `dcp.json`), created automatically on first run
104
+ 2. **Custom config directory:** `$OPENCODE_CONFIG_DIR/dcp.jsonc` (or `dcp.json`), if `OPENCODE_CONFIG_DIR` is set
105
+ 3. **Project:** `.opencode/dcp.jsonc` (or `dcp.json`) in your project's `.opencode` directory
106
+
107
+ > **Note:** The config file name `dcp.jsonc` is kept for backward compatibility with DCP installations.
108
+
109
+ Each level overrides the previous, so project settings take priority over global. Restart OpenCode after making config changes.
110
+
111
+ > [!NOTE]
112
+ > If you use models with smaller context windows, such as GitHub Copilot models or local models, lower `compress.minContextLimit` and `compress.maxContextLimit` in your configuration to match the available context.
113
+
114
+ <details>
115
+ <summary><strong>Default Configuration</strong> (click to expand)</summary>
116
+
117
+ ```jsonc
118
+ {
119
+ "$schema": "https://raw.githubusercontent.com/Opencode-DCP/opencode-dynamic-context-pruning/master/dcp.schema.json",
120
+ // Enable or disable the plugin
121
+ "enabled": true,
122
+ // Automatically update npm-installed ACP when a newer npm latest is available.
123
+ // Version-locked plugin specs are not updated.
124
+ "autoUpdate": true,
125
+ // Enable debug logging to ~/.config/opencode/logs/dcp/
126
+ "debug": false,
127
+ // Notification display: "off", "minimal", or "detailed"
128
+ "pruneNotification": "detailed",
129
+ // Notification type: "chat" (in-conversation) or "toast" (system toast)
130
+ "pruneNotificationType": "chat",
131
+ // Slash commands configuration
132
+ "commands": {
133
+ "enabled": true,
134
+ // Additional tools to protect from pruning via commands (e.g., /acp sweep)
135
+ "protectedTools": [],
136
+ },
137
+ // Manual mode: disables autonomous context management,
138
+ // tools only run when explicitly triggered via /acp commands
139
+ "manualMode": {
140
+ "enabled": false,
141
+ // When true, automatic cleanup (deduplication, purgeErrors)
142
+ // still runs even in manual mode
143
+ "automaticStrategies": true,
144
+ },
145
+ // Protect from pruning for <turns> message turns past tool invocation
146
+ "turnProtection": {
147
+ "enabled": false,
148
+ "turns": 4,
149
+ },
150
+ // Experimental settings
151
+ "experimental": {
152
+ // Allow ACP processing in subagent sessions
153
+ "allowSubAgents": false,
154
+ // Enable user-editable prompt overrides under dcp-prompts directories
155
+ // When false (default), prompt override files/directories are ignored
156
+ "customPrompts": false,
157
+ },
158
+ // Protect file operations from pruning via glob patterns
159
+ // Patterns match tool parameters.filePath (e.g. read/write/edit)
160
+ "protectedFilePatterns": [],
161
+ // Unified context compression tool and behavior settings
162
+ "compress": {
163
+ // Compression mode: "range" (compress spans into block summaries)
164
+ // or experimental "message" (compress individual raw messages)
165
+ "mode": "range",
166
+ // Permission mode: "allow" (no prompt), "ask" (prompt), "deny" (tool not registered)
167
+ "permission": "allow",
168
+ // Show compression content in a chat notification
169
+ "showCompression": false,
170
+ // Let active summary tokens extend the effective maxContextLimit
171
+ "summaryBuffer": true,
172
+ // Soft upper threshold: above this, ACP keeps injecting strong
173
+ // compression nudges (based on nudgeFrequency), so compression is
174
+ // much more likely. Accepts: number or "X%" of model context window.
175
+ "maxContextLimit": 100000,
176
+ // Soft lower threshold for reminder nudges: below this, turn/iteration
177
+ // reminders are off (compression less likely). At/above this, reminders
178
+ // are on. Accepts: number or "X%" of model context window.
179
+ "minContextLimit": 50000,
180
+ // Optional per-model override for maxContextLimit by providerID/modelID.
181
+ // If present, this wins over the global maxContextLimit.
182
+ // Accepts: number or "X%".
183
+ // Example:
184
+ // "modelMaxLimits": {
185
+ // "openai/gpt-5.3-codex": 120000,
186
+ // "anthropic/claude-sonnet-4.6": "80%"
187
+ // },
188
+ // Optional per-model override for minContextLimit.
189
+ // If present, this wins over the global minContextLimit.
190
+ // "modelMinLimits": {
191
+ // "openai/gpt-5.3-codex": 50000,
192
+ // "anthropic/claude-sonnet-4.6": "25%"
193
+ // },
194
+ // How often the context-limit nudge fires (1 = every fetch, 5 = every 5th)
195
+ "nudgeFrequency": 5,
196
+ // Start adding compression reminders after this many
197
+ // messages have happened since the last user message
198
+ "iterationNudgeThreshold": 15,
199
+ // Controls how likely compression is after user messages
200
+ // ("strong" = more likely, "soft" = less likely)
201
+ "nudgeForce": "soft",
202
+ // Tool names whose completed outputs are appended to the compression
203
+ "protectedTools": [],
204
+ // Preserve text wrapped in <protect>...</protect> when compressed
205
+ "protectTags": false,
206
+ // Preserve your messages during compression.
207
+ // Warning: large copy-pasted prompts will never be compressed away
208
+ "protectUserMessages": false,
209
+ },
210
+ // Automatic pruning strategies
211
+ "strategies": {
212
+ // Remove duplicate tool calls (same tool with same arguments)
213
+ "deduplication": {
214
+ "enabled": true,
215
+ // Additional tools to protect from pruning
216
+ "protectedTools": [],
217
+ },
218
+ // Prune tool inputs for errored tools after X turns
219
+ "purgeErrors": {
220
+ "enabled": true,
221
+ // Number of turns before errored tool inputs are pruned
222
+ "turns": 4,
223
+ // Additional tools to protect from pruning
224
+ "protectedTools": [],
225
+ },
226
+ },
227
+ }
228
+ ```
229
+
230
+ </details>
231
+
232
+ ### Prompt Overrides
233
+
234
+ ACP exposes six editable prompts:
235
+
236
+ - `system`
237
+ - `compress-range`
238
+ - `compress-message`
239
+ - `context-limit-nudge`
240
+ - `turn-nudge`
241
+ - `iteration-nudge`
242
+
243
+ This feature is disabled by default. Set `experimental.customPrompts` to `true` in your ACP config to activate it.
244
+
245
+ When enabled, managed defaults are written to `~/.config/opencode/dcp-prompts/defaults/` as plain-text prompt files. A single `README.md` in that directory explains each prompt and how to create overrides.
246
+
247
+ To customize behavior, add a file with the same name under an overrides directory and edit it as plain text.
248
+
249
+ To reset an override, delete the matching file from your overrides directory.
250
+
251
+ ### Protected Tools
252
+
253
+ By default, these tools are always protected from pruning:
254
+ `task`, `skill`, `todowrite`, `todoread`, `compress`, `batch`, `plan_enter`, `plan_exit`, `write`, `edit`
255
+
256
+ The `protectedTools` arrays in `commands` and `strategies` add to this default list.
257
+
258
+ For the `compress` tool, `compress.protectedTools` ensures specific tool outputs are appended to the compressed summary. By default it includes `task`, `skill`, `todowrite`, and `todoread`.
259
+
260
+ ---
261
+
262
+ ## Impact on Prompt Caching
263
+
264
+ LLM providers cache prompts based on exact prefix matching. When ACP prunes content, it changes messages, which invalidates cached prefixes from that point forward.
265
+
266
+ **Trade-off:** You lose some cache reads but gain token savings from reduced context size and fewer hallucinations from stale context. In most cases, especially in long sessions, the savings outweigh the cache miss cost.
267
+
268
+ > [!NOTE]
269
+ > In testing, cache hit rates were approximately 85% with ACP vs 90% without.
270
+
271
+ **No impact for:**
272
+
273
+ - **Request-based billing** -- Providers like GitHub Copilot that charge per request, not tokens.
274
+ - **Uniform token pricing** -- Providers like Cerebras that bill cached and uncached tokens at the same rate.
275
+
276
+ ---
277
+
278
+ ## Migrating from DCP
279
+
280
+ ACP is a drop-in replacement for DCP. To migrate:
281
+
282
+ 1. Remove the old DCP plugin from your `opencode.json`
283
+ 2. Install ACP: `opencode plugin install opencode-acp@latest --global`
284
+ 3. Restart OpenCode
285
+
286
+ **What's preserved:**
287
+
288
+ - Session state (compression blocks, message ID mappings) -- stored in `~/.local/share/opencode/storage/plugin/dcp/`
289
+ - Config file `~/.config/opencode/dcp.jsonc` -- ACP reads the same config
290
+ - Prompt overrides in `~/.config/opencode/dcp-prompts/`
291
+
292
+ **What changes:**
293
+
294
+ - Slash command: `/dcp` to `/acp` (both work for backward compatibility)
295
+ - Notification headers: `DCP` to `ACP`
296
+ - Context usage label: `DCP threshold` to `ACP threshold`
297
+
298
+ Internal storage paths and config file names keep the `dcp` naming for backward compatibility.
299
+
300
+ ---
301
+
302
+ <details>
303
+ <summary><strong>Bug Fixes (35 total)</strong> -- applied on top of DCP v3.1.11</summary>
304
+
305
+ | # | Severity | Summary |
306
+ |---|----------|---------|
307
+ | 1 | CRITICAL | State not persisted across restarts -- messageIds, block deactivation, save errors silently lost |
308
+ | 2 | CRITICAL | resetOnCompaction() clears all compression blocks -- undoes all pruning work |
309
+ | 3 | CRITICAL | prune silently drops summary -- DATA LOSS when no user message precedes anchor |
310
+ | 4 | CRITICAL | getCurrentTokenUsage returns 0 -- prevents nudge from ever triggering |
311
+ | 5 | HIGH | loadPruneMessagesState duplicates activeBlockIds + reasoning-strip undefined guard |
312
+ | 6 | HIGH | Synthetic summary messages get mNNNN refs but are invisible to boundary lookup |
313
+ | 7 | HIGH | State not persisted across restarts -- messageIds, block deactivation, and save errors silently lost |
314
+ | 8 | HIGH | isMessageCompacted() inconsistent with compaction summary message handling |
315
+ | 9 | HIGH | Compressed block summaries retain stale mNNNN message ID tags -- model copies stale IDs |
316
+ | 10 | HIGH | Model uses stale mNNNN IDs from nudges/summaries -- compress fails with "startId not available" |
317
+ | 11 | HIGH | Major GC skips legacy blocks without generation field -- oversized blocks never collected |
318
+ | 12 | HIGH | Percentage-based thresholds calculated against effective input context instead of full model context window |
319
+ | 13 | HIGH | Context window leaks -- compressed messages reappear after /compact |
320
+ | 14 | HIGH | Compression notifications write full block summaries to DB -- can reach 150KB+ per notification |
321
+ | 15 | HIGH | npm auto-install overwrites fork with upstream package |
322
+ | 16 | HIGH | Summary mNNNN refs in compress output -- model copies stale message IDs |
323
+ | 17 | HIGH | Synthetic messages not in messageIdToBlockId -- compress fails to find them |
324
+ | 18 | HIGH | Compress stops model from responding after compression completes |
325
+ | 19 | HIGH | Dynamic block guidance breaks API prefix cache |
326
+ | 20 | HIGH | GC never deactivates old blocks -- dead-weight accumulates indefinitely |
327
+ | 21 | HIGH | Logger + tokenizer 20-50s per-turn latency (268x slowdown) |
328
+ | 22 | HIGH | compress throws hard error on reversed block boundaries -- model gives up |
329
+ | 23--34 | MEDIUM | Various fixes for dedup, purge errors, schema validation, hook timing, etc. |
330
+ | 35 | HIGH | Aging warnings shown at low context usage (<50%) -- triggers unnecessary compress, wastes tokens |
331
+
332
+ For the complete list with root cause analysis, see the [bug tracker](https://github.com/ranxianglei/opencode-acp/issues).
333
+
334
+ </details>
335
+
336
+ ---
337
+
338
+ ## License
339
+
340
+ AGPL-3.0-or-later -- This project is a fork of [@tarquinen/opencode-dcp](https://github.com/Tarquinen/opencode-dynamic-context-pruning). Original copyright belongs to the original author. Modifications and bug fixes by ranxianglei.
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ declare const server: Plugin;
3
+ export default server;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAqBjD,QAAA,MAAM,MAAM,EAAE,MAiHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}