@tarquinen/opencode-dcp 1.3.1-beta.0 → 1.3.1-beta1

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 (145) hide show
  1. package/README.md +8 -17
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +9 -25
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/commands/context.d.ts.map +1 -1
  6. package/dist/lib/commands/context.js +23 -36
  7. package/dist/lib/commands/context.js.map +1 -1
  8. package/dist/lib/config.d.ts +4 -9
  9. package/dist/lib/config.d.ts.map +1 -1
  10. package/dist/lib/config.js +28 -59
  11. package/dist/lib/config.js.map +1 -1
  12. package/dist/lib/hooks.d.ts.map +1 -1
  13. package/dist/lib/hooks.js +16 -8
  14. package/dist/lib/hooks.js.map +1 -1
  15. package/dist/lib/messages/inject.d.ts +0 -7
  16. package/dist/lib/messages/inject.d.ts.map +1 -1
  17. package/dist/lib/messages/inject.js +51 -90
  18. package/dist/lib/messages/inject.js.map +1 -1
  19. package/dist/lib/messages/prune.d.ts.map +1 -1
  20. package/dist/lib/messages/prune.js +1 -42
  21. package/dist/lib/messages/prune.js.map +1 -1
  22. package/dist/lib/messages/utils.d.ts +0 -2
  23. package/dist/lib/messages/utils.d.ts.map +1 -1
  24. package/dist/lib/messages/utils.js +12 -21
  25. package/dist/lib/messages/utils.js.map +1 -1
  26. package/dist/lib/prompts/discard-tool-spec.d.ts +2 -0
  27. package/dist/lib/prompts/discard-tool-spec.d.ts.map +1 -0
  28. package/dist/lib/prompts/discard-tool-spec.js +41 -0
  29. package/dist/lib/prompts/discard-tool-spec.js.map +1 -0
  30. package/dist/lib/prompts/extract-tool-spec.d.ts +2 -0
  31. package/dist/lib/prompts/extract-tool-spec.d.ts.map +1 -0
  32. package/dist/lib/prompts/{distill-tool-spec.js → extract-tool-spec.js} +14 -14
  33. package/dist/lib/prompts/extract-tool-spec.js.map +1 -0
  34. package/dist/lib/prompts/index.d.ts +0 -7
  35. package/dist/lib/prompts/index.d.ts.map +1 -1
  36. package/dist/lib/prompts/index.js +18 -28
  37. package/dist/lib/prompts/index.js.map +1 -1
  38. package/dist/lib/prompts/nudge/both.d.ts +2 -0
  39. package/dist/lib/prompts/nudge/both.d.ts.map +1 -0
  40. package/dist/lib/prompts/nudge/both.js +11 -0
  41. package/dist/lib/prompts/nudge/both.js.map +1 -0
  42. package/dist/lib/prompts/nudge/discard.d.ts +2 -0
  43. package/dist/lib/prompts/nudge/discard.d.ts.map +1 -0
  44. package/dist/lib/prompts/nudge/discard.js +10 -0
  45. package/dist/lib/prompts/nudge/discard.js.map +1 -0
  46. package/dist/lib/prompts/nudge/extract.d.ts +2 -0
  47. package/dist/lib/prompts/nudge/extract.d.ts.map +1 -0
  48. package/dist/lib/prompts/nudge/extract.js +10 -0
  49. package/dist/lib/prompts/nudge/extract.js.map +1 -0
  50. package/dist/lib/prompts/system/both.d.ts +2 -0
  51. package/dist/lib/prompts/system/both.d.ts.map +1 -0
  52. package/dist/lib/prompts/system/both.js +61 -0
  53. package/dist/lib/prompts/system/both.js.map +1 -0
  54. package/dist/lib/prompts/system/discard.d.ts +2 -0
  55. package/dist/lib/prompts/system/discard.d.ts.map +1 -0
  56. package/dist/lib/prompts/system/discard.js +52 -0
  57. package/dist/lib/prompts/system/discard.js.map +1 -0
  58. package/dist/lib/prompts/system/extract.d.ts +2 -0
  59. package/dist/lib/prompts/system/extract.d.ts.map +1 -0
  60. package/dist/lib/prompts/system/extract.js +52 -0
  61. package/dist/lib/prompts/system/extract.js.map +1 -0
  62. package/dist/lib/shared-utils.d.ts +1 -1
  63. package/dist/lib/shared-utils.d.ts.map +1 -1
  64. package/dist/lib/shared-utils.js +3 -10
  65. package/dist/lib/shared-utils.js.map +1 -1
  66. package/dist/lib/state/persistence.d.ts +1 -2
  67. package/dist/lib/state/persistence.d.ts.map +1 -1
  68. package/dist/lib/state/persistence.js +0 -1
  69. package/dist/lib/state/persistence.js.map +1 -1
  70. package/dist/lib/state/state.d.ts +1 -0
  71. package/dist/lib/state/state.d.ts.map +1 -1
  72. package/dist/lib/state/state.js +29 -10
  73. package/dist/lib/state/state.js.map +1 -1
  74. package/dist/lib/state/tool-cache.d.ts.map +1 -1
  75. package/dist/lib/state/tool-cache.js +3 -2
  76. package/dist/lib/state/tool-cache.js.map +1 -1
  77. package/dist/lib/state/types.d.ts +0 -6
  78. package/dist/lib/state/types.d.ts.map +1 -1
  79. package/dist/lib/state/utils.d.ts +0 -4
  80. package/dist/lib/state/utils.d.ts.map +1 -1
  81. package/dist/lib/state/utils.js +0 -33
  82. package/dist/lib/state/utils.js.map +1 -1
  83. package/dist/lib/strategies/index.d.ts +1 -1
  84. package/dist/lib/strategies/index.d.ts.map +1 -1
  85. package/dist/lib/strategies/index.js +1 -1
  86. package/dist/lib/strategies/index.js.map +1 -1
  87. package/dist/lib/{tools/types.d.ts → strategies/tools.d.ts} +4 -1
  88. package/dist/lib/strategies/tools.d.ts.map +1 -0
  89. package/dist/lib/strategies/tools.js +135 -0
  90. package/dist/lib/strategies/tools.js.map +1 -0
  91. package/dist/lib/strategies/utils.d.ts +0 -1
  92. package/dist/lib/strategies/utils.d.ts.map +1 -1
  93. package/dist/lib/strategies/utils.js +4 -5
  94. package/dist/lib/strategies/utils.js.map +1 -1
  95. package/dist/lib/ui/notification.d.ts +0 -1
  96. package/dist/lib/ui/notification.d.ts.map +1 -1
  97. package/dist/lib/ui/notification.js +4 -32
  98. package/dist/lib/ui/notification.js.map +1 -1
  99. package/dist/lib/ui/utils.d.ts +0 -1
  100. package/dist/lib/ui/utils.d.ts.map +1 -1
  101. package/dist/lib/ui/utils.js +0 -16
  102. package/dist/lib/ui/utils.js.map +1 -1
  103. package/package.json +4 -7
  104. package/dist/lib/auth.d.ts +0 -4
  105. package/dist/lib/auth.d.ts.map +0 -1
  106. package/dist/lib/auth.js +0 -32
  107. package/dist/lib/auth.js.map +0 -1
  108. package/dist/lib/prompts/compress-tool-spec.d.ts +0 -2
  109. package/dist/lib/prompts/compress-tool-spec.d.ts.map +0 -1
  110. package/dist/lib/prompts/compress-tool-spec.js +0 -58
  111. package/dist/lib/prompts/compress-tool-spec.js.map +0 -1
  112. package/dist/lib/prompts/distill-tool-spec.d.ts +0 -2
  113. package/dist/lib/prompts/distill-tool-spec.d.ts.map +0 -1
  114. package/dist/lib/prompts/distill-tool-spec.js.map +0 -1
  115. package/dist/lib/prompts/prune-tool-spec.d.ts +0 -2
  116. package/dist/lib/prompts/prune-tool-spec.d.ts.map +0 -1
  117. package/dist/lib/prompts/prune-tool-spec.js +0 -40
  118. package/dist/lib/prompts/prune-tool-spec.js.map +0 -1
  119. package/dist/lib/tools/compress.d.ts +0 -4
  120. package/dist/lib/tools/compress.d.ts.map +0 -1
  121. package/dist/lib/tools/compress.js +0 -81
  122. package/dist/lib/tools/compress.js.map +0 -1
  123. package/dist/lib/tools/distill.d.ts +0 -4
  124. package/dist/lib/tools/distill.d.ts.map +0 -1
  125. package/dist/lib/tools/distill.js +0 -35
  126. package/dist/lib/tools/distill.js.map +0 -1
  127. package/dist/lib/tools/index.d.ts +0 -5
  128. package/dist/lib/tools/index.d.ts.map +0 -1
  129. package/dist/lib/tools/index.js +0 -4
  130. package/dist/lib/tools/index.js.map +0 -1
  131. package/dist/lib/tools/prune-shared.d.ts +0 -6
  132. package/dist/lib/tools/prune-shared.d.ts.map +0 -1
  133. package/dist/lib/tools/prune-shared.js +0 -107
  134. package/dist/lib/tools/prune-shared.js.map +0 -1
  135. package/dist/lib/tools/prune.d.ts +0 -4
  136. package/dist/lib/tools/prune.d.ts.map +0 -1
  137. package/dist/lib/tools/prune.js +0 -21
  138. package/dist/lib/tools/prune.js.map +0 -1
  139. package/dist/lib/tools/types.d.ts.map +0 -1
  140. package/dist/lib/tools/types.js +0 -2
  141. package/dist/lib/tools/types.js.map +0 -1
  142. package/dist/lib/tools/utils.d.ts +0 -26
  143. package/dist/lib/tools/utils.d.ts.map +0 -1
  144. package/dist/lib/tools/utils.js +0 -121
  145. package/dist/lib/tools/utils.js.map +0 -1
@@ -1,14 +1,14 @@
1
- export const DISTILL_TOOL_SPEC = `Distills key findings from tool outputs into preserved knowledge, then removes the raw outputs from context.
1
+ export const EXTRACT_TOOL_SPEC = `Extracts key findings from tool outputs into distilled knowledge, then removes the raw outputs from context.
2
2
 
3
3
  ## IMPORTANT: The Prunable List
4
- A \`<prunable-tools>\` list is provided to you showing available tool outputs you can distill from when there are tools available for pruning. Each line has the format \`ID: tool, parameter\` (e.g., \`20: read, /path/to/file.ts\`). You MUST only use numeric IDs that appear in this list to select which tools to distill.
4
+ A \`<prunable-tools>\` list is provided to you showing available tool outputs you can extract from when there are tools available for pruning. Each line has the format \`ID: tool, parameter\` (e.g., \`20: read, /path/to/file.ts\`). You MUST only use numeric IDs that appear in this list to select which tools to extract.
5
5
 
6
6
  ## When to Use This Tool
7
7
 
8
- Use \`distill\` when you have individual tool outputs with valuable information you want to **preserve in distilled form** before removing the raw content:
8
+ Use \`extract\` when you have gathered useful information that you want to **preserve in distilled form** before removing the raw outputs:
9
9
 
10
- - **Large Outputs:** The raw output is too large but contains valuable technical details worth keeping.
11
- - **Knowledge Preservation:** You have context that contains valuable information (signatures, logic, constraints) but also a lot of unnecessary detail.
10
+ - **Task Completion:** You completed a unit of work and want to preserve key findings.
11
+ - **Knowledge Preservation:** You have context that contains valuable information, but also a lot of unnecessary detail - you only need to preserve some specifics.
12
12
 
13
13
  ## When NOT to Use This Tool
14
14
 
@@ -17,32 +17,32 @@ Use \`distill\` when you have individual tool outputs with valuable information
17
17
 
18
18
 
19
19
  ## Best Practices
20
- - **Strategic Batching:** Wait until you have several items or a few large outputs to distill, rather than doing tiny, frequent distillations. Aim for high-impact distillations that significantly reduce context size.
21
- - **Think ahead:** Before distilling, ask: "Will I need the raw output for upcoming work?" If you researched a file you'll later edit, do NOT distill it.
20
+ - **Strategic Batching:** Wait until you have several items or a few large outputs to extract, rather than doing tiny, frequent extractions. Aim for high-impact extractions that significantly reduce context size.
21
+ - **Think ahead:** Before extracting, ask: "Will I need the raw output for an upcoming task?" If you researched a file you'll later edit, do NOT extract it.
22
22
 
23
23
  ## Format
24
24
 
25
25
  - \`ids\`: Array of numeric IDs as strings from the \`<prunable-tools>\` list
26
26
  - \`distillation\`: Array of strings, one per ID (positional: distillation[0] is for ids[0], etc.)
27
27
 
28
- Each distillation string should capture the essential information you need to preserve - function signatures, logic, constraints, values, etc. Be as detailed as needed.
28
+ Each distillation string should capture the essential information you need to preserve - function signatures, logic, constraints, values, etc. Be as detailed as needed for your task.
29
29
 
30
30
  ## Example
31
31
 
32
- <example_distillation>
32
+ <example_extraction>
33
33
  Assistant: [Reads auth service and user types]
34
- I'll preserve the key details before distilling.
35
- [Uses distill with:
34
+ I'll preserve the key details before extracting.
35
+ [Uses extract with:
36
36
  ids: ["10", "11"],
37
37
  distillation: [
38
38
  "auth.ts: validateToken(token: string) -> User|null checks cache first (5min TTL) then OIDC. hashPassword uses bcrypt 12 rounds. Tokens must be 128+ chars.",
39
39
  "user.ts: interface User { id: string; email: string; permissions: ('read'|'write'|'admin')[]; status: 'active'|'suspended' }"
40
40
  ]
41
41
  ]
42
- </example_distillation>
42
+ </example_extraction>
43
43
 
44
44
  <example_keep>
45
45
  Assistant: [Reads 'auth.ts' to understand the login flow]
46
- I've understood the auth flow. I'll need to modify this file to add the new validation, so I'm keeping this read in context rather than distilling.
46
+ I've understood the auth flow. I'll need to modify this file to add the new validation, so I'm keeping this read in context rather than extracting.
47
47
  </example_keep>`;
48
- //# sourceMappingURL=distill-tool-spec.js.map
48
+ //# sourceMappingURL=extract-tool-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-tool-spec.js","sourceRoot":"","sources":["../../../lib/prompts/extract-tool-spec.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA8CjB,CAAA"}
@@ -1,9 +1,2 @@
1
- export interface ToolFlags {
2
- distill: boolean;
3
- compress: boolean;
4
- prune: boolean;
5
- }
6
- export declare function renderSystemPrompt(flags: ToolFlags): string;
7
- export declare function renderNudge(flags: ToolFlags): string;
8
1
  export declare function loadPrompt(name: string, vars?: Record<string, string>): string;
9
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;CACjB;AAgBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAE3D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEpD;AAQD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAW9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAyBA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAW9E"}
@@ -1,33 +1,23 @@
1
1
  // Tool specs
2
- import { PRUNE_TOOL_SPEC } from "./prune-tool-spec";
3
- import { DISTILL_TOOL_SPEC } from "./distill-tool-spec";
4
- import { COMPRESS_TOOL_SPEC } from "./compress-tool-spec";
5
- // Generated prompts (from .md files via scripts/generate-prompts.ts)
6
- import { SYSTEM as SYSTEM_PROMPT } from "./system.generated";
7
- import { NUDGE } from "./nudge.generated";
8
- function processConditionals(template, flags) {
9
- const tools = ["distill", "compress", "prune"];
10
- let result = template;
11
- // Strip comments: // ... //
12
- result = result.replace(/\/\/.*?\/\//g, "");
13
- // Process tool conditionals
14
- for (const tool of tools) {
15
- const regex = new RegExp(`<${tool}>([\\s\\S]*?)</${tool}>`, "g");
16
- result = result.replace(regex, (_, content) => (flags[tool] ? content : ""));
17
- }
18
- // Collapse multiple blank/whitespace-only lines to single blank line
19
- return result.replace(/\n([ \t]*\n)+/g, "\n\n").trim();
20
- }
21
- export function renderSystemPrompt(flags) {
22
- return processConditionals(SYSTEM_PROMPT, flags);
23
- }
24
- export function renderNudge(flags) {
25
- return processConditionals(NUDGE, flags);
26
- }
2
+ import { DISCARD_TOOL_SPEC } from "./discard-tool-spec";
3
+ import { EXTRACT_TOOL_SPEC } from "./extract-tool-spec";
4
+ // System prompts
5
+ import { SYSTEM_PROMPT_BOTH } from "./system/both";
6
+ import { SYSTEM_PROMPT_DISCARD } from "./system/discard";
7
+ import { SYSTEM_PROMPT_EXTRACT } from "./system/extract";
8
+ // Nudge prompts
9
+ import { NUDGE_BOTH } from "./nudge/both";
10
+ import { NUDGE_DISCARD } from "./nudge/discard";
11
+ import { NUDGE_EXTRACT } from "./nudge/extract";
27
12
  const PROMPTS = {
28
- "prune-tool-spec": PRUNE_TOOL_SPEC,
29
- "distill-tool-spec": DISTILL_TOOL_SPEC,
30
- "compress-tool-spec": COMPRESS_TOOL_SPEC,
13
+ "discard-tool-spec": DISCARD_TOOL_SPEC,
14
+ "extract-tool-spec": EXTRACT_TOOL_SPEC,
15
+ "system/system-prompt-both": SYSTEM_PROMPT_BOTH,
16
+ "system/system-prompt-discard": SYSTEM_PROMPT_DISCARD,
17
+ "system/system-prompt-extract": SYSTEM_PROMPT_EXTRACT,
18
+ "nudge/nudge-both": NUDGE_BOTH,
19
+ "nudge/nudge-discard": NUDGE_DISCARD,
20
+ "nudge/nudge-extract": NUDGE_EXTRACT,
31
21
  };
32
22
  export function loadPrompt(name, vars) {
33
23
  let content = PROMPTS[name];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/prompts/index.ts"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B,EAAE,iBAAiB;IACtC,mBAAmB,EAAE,iBAAiB;IACtC,2BAA2B,EAAE,kBAAkB;IAC/C,8BAA8B,EAAE,qBAAqB;IACrD,8BAA8B,EAAE,qBAAqB;IACrD,kBAAkB,EAAE,UAAU;IAC9B,qBAAqB,EAAE,aAAa;IACpC,qBAAqB,EAAE,aAAa;CACvC,CAAA;AAED,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAA6B;IAClE,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;IAChD,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACP,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QAC3E,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const NUDGE_BOTH = "<instruction name=context_management_required>\n**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.\n\n**Immediate Actions Required:**\n1. **Task Completion:** If a sub-task is complete, decide: use `discard` if no valuable context to preserve (default), or use `extract` if insights are worth keeping.\n2. **Noise Removal:** If you read files or ran commands that yielded no value, use `discard` to remove them.\n3. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use `extract` to distill the insights and remove the raw entry.\n\n**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.\n</instruction>";
2
+ //# sourceMappingURL=both.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"both.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/both.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,s2BASR,CAAA"}
@@ -0,0 +1,11 @@
1
+ export const NUDGE_BOTH = `<instruction name=context_management_required>
2
+ **CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
3
+
4
+ **Immediate Actions Required:**
5
+ 1. **Task Completion:** If a sub-task is complete, decide: use \`discard\` if no valuable context to preserve (default), or use \`extract\` if insights are worth keeping.
6
+ 2. **Noise Removal:** If you read files or ran commands that yielded no value, use \`discard\` to remove them.
7
+ 3. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use \`extract\` to distill the insights and remove the raw entry.
8
+
9
+ **Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.
10
+ </instruction>`;
11
+ //# sourceMappingURL=both.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"both.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/both.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;eASX,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const NUDGE_DISCARD = "<instruction name=context_management_required>\n**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.\n\n**Immediate Actions Required:**\n1. **Task Completion:** If a sub-task is complete, use the `discard` tool to remove the tools used.\n2. **Noise Removal:** If you read files or ran commands that yielded no value, use the `discard` tool to remove them.\n\n**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must discard unneeded tool outputs.\n</instruction>";
2
+ //# sourceMappingURL=discard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discard.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,0oBAQX,CAAA"}
@@ -0,0 +1,10 @@
1
+ export const NUDGE_DISCARD = `<instruction name=context_management_required>
2
+ **CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
3
+
4
+ **Immediate Actions Required:**
5
+ 1. **Task Completion:** If a sub-task is complete, use the \`discard\` tool to remove the tools used.
6
+ 2. **Noise Removal:** If you read files or ran commands that yielded no value, use the \`discard\` tool to remove them.
7
+
8
+ **Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must discard unneeded tool outputs.
9
+ </instruction>`;
10
+ //# sourceMappingURL=discard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discard.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/discard.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;eAQd,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const NUDGE_EXTRACT = "<instruction name=context_management_required>\n**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.\n\n**Immediate Actions Required:**\n1. **Task Completion:** If you have completed work, extract key findings from the tools used. Scale distillation depth to the value of the content.\n2. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use the `extract` tool with high-fidelity distillation to preserve the insights and remove the raw entry.\n\n**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must extract valuable findings from tool outputs.\n</instruction>";
2
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,gyBAQX,CAAA"}
@@ -0,0 +1,10 @@
1
+ export const NUDGE_EXTRACT = `<instruction name=context_management_required>
2
+ **CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
3
+
4
+ **Immediate Actions Required:**
5
+ 1. **Task Completion:** If you have completed work, extract key findings from the tools used. Scale distillation depth to the value of the content.
6
+ 2. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use the \`extract\` tool with high-fidelity distillation to preserve the insights and remove the raw entry.
7
+
8
+ **Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must extract valuable findings from tool outputs.
9
+ </instruction>`;
10
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/prompts/nudge/extract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;eAQd,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const SYSTEM_PROMPT_BOTH = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\n\nENVIRONMENT\nYou are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` and `extract` tools. The environment calls the `context_info` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to prune.\n\nIMPORTANT: The `context_info` tool is only available to the environment - you do not have access to it and must not attempt to call it.\n\nTWO TOOLS FOR CONTEXT MANAGEMENT\n- `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.\n- `extract`: Extract key findings into distilled knowledge before removing raw outputs. Use when you need to preserve information.\n\nCHOOSING THE RIGHT TOOL\nAsk: \"Do I need to preserve any information from this output?\"\n- **No** \u2192 `discard` (default for cleanup)\n- **Yes** \u2192 `extract` (preserves distilled knowledge)\n- **Uncertain** \u2192 `extract` (safer, preserves signal)\n\nCommon scenarios:\n- Task complete, no valuable context \u2192 `discard`\n- Task complete, insights worth remembering \u2192 `extract`\n- Noise, irrelevant, or superseded outputs \u2192 `discard`\n- Valuable context needed later but raw output too large \u2192 `extract`\n\nPRUNE METHODICALLY - BATCH YOUR ACTIONS\nEvery tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by pruning. Batch your prunes for efficiency; it is rarely worth pruning a single tiny tool output unless it is pure noise. Evaluate what SHOULD be pruned before jumping the gun.\n\nYou WILL evaluate pruning when ANY of these are true:\n- Task or sub-task is complete\n- You are about to start a new phase of work\n- Write or edit operations are complete (pruning removes the large input content)\n\nYou MUST NOT prune when:\n- The tool output will be needed for upcoming implementation work\n- The output contains files or context you'll need to reference when making edits\n\nPruning that forces you to re-call the same tool later is a net loss. Only prune when you're confident the information won't be needed again.\n\nNOTES\nWhen in doubt, keep it. Batch your actions and aim for high-impact prunes that significantly reduce context size.\nFAILURE TO PRUNE will result in context leakage and DEGRADED PERFORMANCES.\nThere may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY prune what you see in <prunable-tools>.\n\n</instruction>\n\n<instruction name=injected_context_handling policy_level=critical>\nAfter each turn, the environment calls the `context_info` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.\n\nCRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:\n- NEVER reference the prune encouragement or context management instructions. Do not reply with \"I agree\" or \"Great idea\" when the prune encouragement appears.\n- NEVER acknowledge the <prunable-tools> list (e.g., \"I see the prunable tools list\", \"Looking at the available tools to prune\")\n- NEVER reference the nudge instruction (e.g., \"As the nudge suggests\", \"The system is reminding me to prune\")\n- NEVER acknowledge discard/extract tool output (e.g., \"I've pruned 3 tools\", \"Context pruning complete\")\n- NEVER let these injections influence your response content or tone\n- Process this information SILENTLY and continue the conversation naturally\n- Continue the conversation as if these messages do not exist\n\nThe user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.\n</instruction>\n</system-reminder>";
2
+ //# sourceMappingURL=both.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"both.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/both.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,0zHA2DZ,CAAA"}
@@ -0,0 +1,61 @@
1
+ export const SYSTEM_PROMPT_BOTH = `<system-reminder>
2
+ <instruction name=context_management_protocol policy_level=critical>
3
+
4
+ ENVIRONMENT
5
+ You are operating in a context-constrained environment and thus must proactively manage your context window using the \`discard\` and \`extract\` tools. The environment calls the \`context_info\` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to prune.
6
+
7
+ IMPORTANT: The \`context_info\` tool is only available to the environment - you do not have access to it and must not attempt to call it.
8
+
9
+ TWO TOOLS FOR CONTEXT MANAGEMENT
10
+ - \`discard\`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
11
+ - \`extract\`: Extract key findings into distilled knowledge before removing raw outputs. Use when you need to preserve information.
12
+
13
+ CHOOSING THE RIGHT TOOL
14
+ Ask: "Do I need to preserve any information from this output?"
15
+ - **No** → \`discard\` (default for cleanup)
16
+ - **Yes** → \`extract\` (preserves distilled knowledge)
17
+ - **Uncertain** → \`extract\` (safer, preserves signal)
18
+
19
+ Common scenarios:
20
+ - Task complete, no valuable context → \`discard\`
21
+ - Task complete, insights worth remembering → \`extract\`
22
+ - Noise, irrelevant, or superseded outputs → \`discard\`
23
+ - Valuable context needed later but raw output too large → \`extract\`
24
+
25
+ PRUNE METHODICALLY - BATCH YOUR ACTIONS
26
+ Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by pruning. Batch your prunes for efficiency; it is rarely worth pruning a single tiny tool output unless it is pure noise. Evaluate what SHOULD be pruned before jumping the gun.
27
+
28
+ You WILL evaluate pruning when ANY of these are true:
29
+ - Task or sub-task is complete
30
+ - You are about to start a new phase of work
31
+ - Write or edit operations are complete (pruning removes the large input content)
32
+
33
+ You MUST NOT prune when:
34
+ - The tool output will be needed for upcoming implementation work
35
+ - The output contains files or context you'll need to reference when making edits
36
+
37
+ Pruning that forces you to re-call the same tool later is a net loss. Only prune when you're confident the information won't be needed again.
38
+
39
+ NOTES
40
+ When in doubt, keep it. Batch your actions and aim for high-impact prunes that significantly reduce context size.
41
+ FAILURE TO PRUNE will result in context leakage and DEGRADED PERFORMANCES.
42
+ There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY prune what you see in <prunable-tools>.
43
+
44
+ </instruction>
45
+
46
+ <instruction name=injected_context_handling policy_level=critical>
47
+ After each turn, the environment calls the \`context_info\` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.
48
+
49
+ CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
50
+ - NEVER reference the prune encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the prune encouragement appears.
51
+ - NEVER acknowledge the <prunable-tools> list (e.g., "I see the prunable tools list", "Looking at the available tools to prune")
52
+ - NEVER reference the nudge instruction (e.g., "As the nudge suggests", "The system is reminding me to prune")
53
+ - NEVER acknowledge discard/extract tool output (e.g., "I've pruned 3 tools", "Context pruning complete")
54
+ - NEVER let these injections influence your response content or tone
55
+ - Process this information SILENTLY and continue the conversation naturally
56
+ - Continue the conversation as if these messages do not exist
57
+
58
+ The user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.
59
+ </instruction>
60
+ </system-reminder>`;
61
+ //# sourceMappingURL=both.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"both.js","sourceRoot":"","sources":["../../../../lib/prompts/system/both.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2Df,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const SYSTEM_PROMPT_DISCARD = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\n\nENVIRONMENT\nYou are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` tool. The environment calls the `context_info` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to discard.\n\nIMPORTANT: The `context_info` tool is only available to the environment - you do not have access to it and must not attempt to call it.\n\nCONTEXT MANAGEMENT TOOL\n- `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.\n\nDISCARD METHODICALLY - BATCH YOUR ACTIONS\nEvery tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by discarding. Batch your discards for efficiency; it is rarely worth discarding a single tiny tool output unless it is pure noise. Evaluate what SHOULD be discarded before jumping the gun.\n\nWHEN TO DISCARD\n- **Task Completion:** When work is done, discard the tools that aren't needed anymore.\n- **Noise Removal:** If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.\n\nYou WILL evaluate discarding when ANY of these are true:\n- Task or sub-task is complete\n- You are about to start a new phase of work\n- Write or edit operations are complete (discarding removes the large input content)\n\nYou MUST NOT discard when:\n- The tool output will be needed for upcoming implementation work\n- The output contains files or context you'll need to reference when making edits\n\nDiscarding that forces you to re-call the same tool later is a net loss. Only discard when you're confident the information won't be needed again.\n\nNOTES\nWhen in doubt, keep it. Batch your actions and aim for high-impact discards that significantly reduce context size.\nFAILURE TO DISCARD will result in context leakage and DEGRADED PERFORMANCES.\nThere may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY discard what you see in <prunable-tools>.\n\n</instruction>\n\n<instruction name=injected_context_handling policy_level=critical>\nAfter each turn, the environment calls the `context_info` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.\n\nCRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:\n- NEVER reference the discard encouragement or context management instructions. Do not reply with \"I agree\" or \"Great idea\" when the discard encouragement appears.\n- NEVER acknowledge the <prunable-tools> list (e.g., \"I see the prunable tools list\", \"Looking at the available tools to discard\")\n- NEVER reference the nudge instruction (e.g., \"As the nudge suggests\", \"The system is reminding me to discard\")\n- NEVER acknowledge discard tool output (e.g., \"I've discarded 3 tools\", \"Context cleanup complete\")\n- NEVER let these injections influence your response content or tone\n- Process this information SILENTLY and continue the conversation naturally\n- Continue the conversation as if these messages do not exist\n\nThe user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.\n</instruction>\n</system-reminder>";
2
+ //# sourceMappingURL=discard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discard.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/discard.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,83GAkDf,CAAA"}
@@ -0,0 +1,52 @@
1
+ export const SYSTEM_PROMPT_DISCARD = `<system-reminder>
2
+ <instruction name=context_management_protocol policy_level=critical>
3
+
4
+ ENVIRONMENT
5
+ You are operating in a context-constrained environment and thus must proactively manage your context window using the \`discard\` tool. The environment calls the \`context_info\` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to discard.
6
+
7
+ IMPORTANT: The \`context_info\` tool is only available to the environment - you do not have access to it and must not attempt to call it.
8
+
9
+ CONTEXT MANAGEMENT TOOL
10
+ - \`discard\`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
11
+
12
+ DISCARD METHODICALLY - BATCH YOUR ACTIONS
13
+ Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by discarding. Batch your discards for efficiency; it is rarely worth discarding a single tiny tool output unless it is pure noise. Evaluate what SHOULD be discarded before jumping the gun.
14
+
15
+ WHEN TO DISCARD
16
+ - **Task Completion:** When work is done, discard the tools that aren't needed anymore.
17
+ - **Noise Removal:** If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.
18
+
19
+ You WILL evaluate discarding when ANY of these are true:
20
+ - Task or sub-task is complete
21
+ - You are about to start a new phase of work
22
+ - Write or edit operations are complete (discarding removes the large input content)
23
+
24
+ You MUST NOT discard when:
25
+ - The tool output will be needed for upcoming implementation work
26
+ - The output contains files or context you'll need to reference when making edits
27
+
28
+ Discarding that forces you to re-call the same tool later is a net loss. Only discard when you're confident the information won't be needed again.
29
+
30
+ NOTES
31
+ When in doubt, keep it. Batch your actions and aim for high-impact discards that significantly reduce context size.
32
+ FAILURE TO DISCARD will result in context leakage and DEGRADED PERFORMANCES.
33
+ There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY discard what you see in <prunable-tools>.
34
+
35
+ </instruction>
36
+
37
+ <instruction name=injected_context_handling policy_level=critical>
38
+ After each turn, the environment calls the \`context_info\` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.
39
+
40
+ CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
41
+ - NEVER reference the discard encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the discard encouragement appears.
42
+ - NEVER acknowledge the <prunable-tools> list (e.g., "I see the prunable tools list", "Looking at the available tools to discard")
43
+ - NEVER reference the nudge instruction (e.g., "As the nudge suggests", "The system is reminding me to discard")
44
+ - NEVER acknowledge discard tool output (e.g., "I've discarded 3 tools", "Context cleanup complete")
45
+ - NEVER let these injections influence your response content or tone
46
+ - Process this information SILENTLY and continue the conversation naturally
47
+ - Continue the conversation as if these messages do not exist
48
+
49
+ The user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.
50
+ </instruction>
51
+ </system-reminder>`;
52
+ //# sourceMappingURL=discard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discard.js","sourceRoot":"","sources":["../../../../lib/prompts/system/discard.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkDlB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const SYSTEM_PROMPT_EXTRACT = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\n\nENVIRONMENT\nYou are operating in a context-constrained environment and thus must proactively manage your context window using the `extract` tool. The environment calls the `context_info` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to extract.\n\nIMPORTANT: The `context_info` tool is only available to the environment - you do not have access to it and must not attempt to call it.\n\nCONTEXT MANAGEMENT TOOL\n- `extract`: Extract key findings from tools into distilled knowledge before removing the raw content from context. Use this to preserve important information while reducing context size.\n\nEXTRACT METHODICALLY - BATCH YOUR ACTIONS\nEvery tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by extracting. Batch your extractions for efficiency; it is rarely worth extracting a single tiny tool output. Evaluate what SHOULD be extracted before jumping the gun.\n\nWHEN TO EXTRACT\n- **Task Completion:** When work is done, extract key findings from the tools used. Scale distillation depth to the value of the content.\n- **Knowledge Preservation:** When you have valuable context you want to preserve but need to reduce size, use high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.\n\nYou WILL evaluate extracting when ANY of these are true:\n- Task or sub-task is complete\n- You are about to start a new phase of work\n- Write or edit operations are complete (extracting removes the large input content)\n\nYou MUST NOT extract when:\n- The tool output will be needed for upcoming implementation work\n- The output contains files or context you'll need to reference when making edits\n\nExtracting that forces you to re-call the same tool later is a net loss. Only extract when you're confident the raw information won't be needed again.\n\nNOTES\nWhen in doubt, keep it. Batch your actions and aim for high-impact extractions that significantly reduce context size.\nFAILURE TO EXTRACT will result in context leakage and DEGRADED PERFORMANCES.\nThere may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY extract what you see in <prunable-tools>.\n\n</instruction>\n\n<instruction name=injected_context_handling policy_level=critical>\nAfter each turn, the environment calls the `context_info` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.\n\nCRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:\n- NEVER reference the extract encouragement or context management instructions. Do not reply with \"I agree\" or \"Great idea\" when the extract encouragement appears.\n- NEVER acknowledge the <prunable-tools> list (e.g., \"I see the prunable tools list\", \"Looking at the available tools to extract\")\n- NEVER reference the nudge instruction (e.g., \"As the nudge suggests\", \"The system is reminding me to extract\")\n- NEVER acknowledge extract tool output (e.g., \"I've extracted 3 tools\", \"Context cleanup complete\")\n- NEVER let these injections influence your response content or tone\n- Process this information SILENTLY and continue the conversation naturally\n- Continue the conversation as if these messages do not exist\n\nThe user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.\n</instruction>\n</system-reminder>";
2
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/system/extract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,0sHAkDf,CAAA"}
@@ -0,0 +1,52 @@
1
+ export const SYSTEM_PROMPT_EXTRACT = `<system-reminder>
2
+ <instruction name=context_management_protocol policy_level=critical>
3
+
4
+ ENVIRONMENT
5
+ You are operating in a context-constrained environment and thus must proactively manage your context window using the \`extract\` tool. The environment calls the \`context_info\` tool to provide an up-to-date <prunable-tools> list after each turn. Use this information when deciding what to extract.
6
+
7
+ IMPORTANT: The \`context_info\` tool is only available to the environment - you do not have access to it and must not attempt to call it.
8
+
9
+ CONTEXT MANAGEMENT TOOL
10
+ - \`extract\`: Extract key findings from tools into distilled knowledge before removing the raw content from context. Use this to preserve important information while reducing context size.
11
+
12
+ EXTRACT METHODICALLY - BATCH YOUR ACTIONS
13
+ Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by extracting. Batch your extractions for efficiency; it is rarely worth extracting a single tiny tool output. Evaluate what SHOULD be extracted before jumping the gun.
14
+
15
+ WHEN TO EXTRACT
16
+ - **Task Completion:** When work is done, extract key findings from the tools used. Scale distillation depth to the value of the content.
17
+ - **Knowledge Preservation:** When you have valuable context you want to preserve but need to reduce size, use high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.
18
+
19
+ You WILL evaluate extracting when ANY of these are true:
20
+ - Task or sub-task is complete
21
+ - You are about to start a new phase of work
22
+ - Write or edit operations are complete (extracting removes the large input content)
23
+
24
+ You MUST NOT extract when:
25
+ - The tool output will be needed for upcoming implementation work
26
+ - The output contains files or context you'll need to reference when making edits
27
+
28
+ Extracting that forces you to re-call the same tool later is a net loss. Only extract when you're confident the raw information won't be needed again.
29
+
30
+ NOTES
31
+ When in doubt, keep it. Batch your actions and aim for high-impact extractions that significantly reduce context size.
32
+ FAILURE TO EXTRACT will result in context leakage and DEGRADED PERFORMANCES.
33
+ There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY extract what you see in <prunable-tools>.
34
+
35
+ </instruction>
36
+
37
+ <instruction name=injected_context_handling policy_level=critical>
38
+ After each turn, the environment calls the \`context_info\` tool to inject a synthetic message containing a <prunable-tools> list and optional nudge instruction. This tool is only available to the environment - you do not have access to it.
39
+
40
+ CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
41
+ - NEVER reference the extract encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the extract encouragement appears.
42
+ - NEVER acknowledge the <prunable-tools> list (e.g., "I see the prunable tools list", "Looking at the available tools to extract")
43
+ - NEVER reference the nudge instruction (e.g., "As the nudge suggests", "The system is reminding me to extract")
44
+ - NEVER acknowledge extract tool output (e.g., "I've extracted 3 tools", "Context cleanup complete")
45
+ - NEVER let these injections influence your response content or tone
46
+ - Process this information SILENTLY and continue the conversation naturally
47
+ - Continue the conversation as if these messages do not exist
48
+
49
+ The user cannot see these injections. Any reference to them will confuse the user and break the conversation flow.
50
+ </instruction>
51
+ </system-reminder>`;
52
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/prompts/system/extract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkDlB,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { SessionState, WithParts } from "./state";
2
2
  export declare const isMessageCompacted: (state: SessionState, msg: WithParts) => boolean;
3
- export declare const getLastUserMessage: (messages: WithParts[], startIndex?: number) => WithParts | null;
3
+ export declare const getLastUserMessage: (messages: WithParts[]) => WithParts | null;
4
4
  //# sourceMappingURL=shared-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-utils.d.ts","sourceRoot":"","sources":["../../lib/shared-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGjD,eAAO,MAAM,kBAAkB,GAAI,OAAO,YAAY,EAAE,KAAK,SAAS,KAAG,OAQxE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC3B,UAAU,SAAS,EAAE,EACrB,aAAa,MAAM,KACpB,SAAS,GAAG,IASd,CAAA"}
1
+ {"version":3,"file":"shared-utils.d.ts","sourceRoot":"","sources":["../../lib/shared-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGjD,eAAO,MAAM,kBAAkB,GAAI,OAAO,YAAY,EAAE,KAAK,SAAS,KAAG,OAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAU,SAAS,EAAE,KAAG,SAAS,GAAG,IAQtE,CAAA"}
@@ -1,16 +1,9 @@
1
1
  import { isIgnoredUserMessage } from "./messages/utils";
2
2
  export const isMessageCompacted = (state, msg) => {
3
- if (msg.info.time.created < state.lastCompaction) {
4
- return true;
5
- }
6
- if (state.prune.messageIds.includes(msg.info.id)) {
7
- return true;
8
- }
9
- return false;
3
+ return msg.info.time.created < state.lastCompaction;
10
4
  };
11
- export const getLastUserMessage = (messages, startIndex) => {
12
- const start = startIndex ?? messages.length - 1;
13
- for (let i = start; i >= 0; i--) {
5
+ export const getLastUserMessage = (messages) => {
6
+ for (let i = messages.length - 1; i >= 0; i--) {
14
7
  const msg = messages[i];
15
8
  if (msg.info.role === "user" && !isIgnoredUserMessage(msg)) {
16
9
  return msg;
@@ -1 +1 @@
1
- {"version":3,"file":"shared-utils.js","sourceRoot":"","sources":["../../lib/shared-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD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AoB,EAAE;IAC1E,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QACvB,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,GAAG,CAAA;QACd,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC,CAAA"}
@@ -3,12 +3,11 @@
3
3
  * Persists pruned tool IDs across sessions so they survive OpenCode restarts.
4
4
  * Storage location: ~/.local/share/opencode/storage/plugin/dcp/{sessionId}.json
5
5
  */
6
- import type { SessionState, SessionStats, Prune, CompressSummary } from "./types";
6
+ import type { SessionState, SessionStats, Prune } from "./types";
7
7
  import type { Logger } from "../logger";
8
8
  export interface PersistedSessionState {
9
9
  sessionName?: string;
10
10
  prune: Prune;
11
- compressSummaries: CompressSummary[];
12
11
  stats: SessionStats;
13
12
  lastUpdated: string;
14
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,KAAK,CAAA;IACZ,iBAAiB,EAAE,eAAe,EAAE,CAAA;IACpC,KAAK,EAAE,YAAY,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACtB;AAcD,wBAAsB,gBAAgB,CAClC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,M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e,CAAC,CAqClF"}
@@ -25,7 +25,6 @@ export async function saveSessionState(sessionState, logger, sessionName) {
25
25
  const state = {
26
26
  sessionName: sessionName,
27
27
  prune: sessionState.prune,
28
- compressSummaries: sessionState.compressSummaries,
29
28
  stats: sessionState.stats,
30
29
  lastUpdated: new Date().toISOString(),
31
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.js","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAY3B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;AAE9F,KAAK,UAAU,gBAAgB;IAC3B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CAAC,SAAiB;IACzC,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,SAAS,OAAO,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,YAA0B,EAC1B,MAAc,EACd,WAAoB;IAEpB,IAAI,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;YAC1B,OAAM;QACV,CAAC;QAED,MAAM,gBAAgB,EAAE,CAAA;QAExB,MAAM,KAAK,GAA0B;YACjC,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,iBAAi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AC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;QAE1D,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;gBACxC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;gBACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA0B,CAAA;gBAE1D,IAAI,KAAK,EAAE,KAAK,EAAE,gBAAgB,IAAI,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;oBAC1D,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAA;oBAClD,MAAM,CAAC,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAA;oBAC/C,MAAM,CAAC,YAAY,EAAE,CAAA;gBACzB,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACL,qBAAqB;YACzB,CAAC;QACL,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,MAAM,CAAA;AACjB,CAAC"}
@@ -4,4 +4,5 @@ export declare const checkSession: (client: any, state: SessionState, logger: Lo
4
4
  export declare function createSessionState(): SessionState;
5
5
  export declare function resetSessionState(state: SessionState): void;
6
6
  export declare function ensureSessionInitialized(client: any, state: SessionState, sessionId: string, logger: Logger, messages: WithParts[]): Promise<void>;
7
+ export declare function countTurns(state: SessionState, messages: WithParts[]): number;
7
8
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAUvC,eAAO,MAAM,YAAY,GACrB,QAAQ,GAAG,EACX,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,UAAU,SAAS,EAAE,KACtB,OAAO,CAAC,IAAI,CA2Bd,CAAA;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAoBjD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAkB3D;AAED,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC,CAgCf"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAKvC,eAAO,MAAM,YAAY,GACrB,QAAQ,GAAG,EACX,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,UAAU,SAAS,EAAE,KACtB,OAAO,CAAC,IAAI,CA4Bd,CAAA;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAkBjD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAgB3D;AAED,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ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