@bd7pil/opencode-deep-memory 0.5.2 → 0.6.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.
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15166,6 +15166,53 @@ async function writeCheckpoint(args) {
|
|
|
15166
15166
|
|
|
15167
15167
|
// src/hooks/compacting.ts
|
|
15168
15168
|
import { readFile as readFile2 } from "fs/promises";
|
|
15169
|
+
|
|
15170
|
+
// src/extract/summarize.ts
|
|
15171
|
+
var HANDOFF_PREFIX = `Another OpenCode session started by the same user was working on this task. It was compacted mid-conversation to save context space. Review the summary below to understand what happened and continue from where it left off.`;
|
|
15172
|
+
var STRUCTURED_COMPACTION_PROMPT = `You are performing a CONTEXT CHECKPOINT COMPACTION.
|
|
15173
|
+
Create a structured handoff summary for an LLM that will resume the task.
|
|
15174
|
+
|
|
15175
|
+
SUMMARY SECTIONS (include all that apply):
|
|
15176
|
+
|
|
15177
|
+
## Task Overview
|
|
15178
|
+
One sentence: what the user is building, fixing, or investigating.
|
|
15179
|
+
|
|
15180
|
+
## Current Progress
|
|
15181
|
+
### Completed
|
|
15182
|
+
- Specific changes made (file paths, functions, tests)
|
|
15183
|
+
- Commands executed and their outcomes
|
|
15184
|
+
### In Progress
|
|
15185
|
+
- What was being worked on when compaction happened
|
|
15186
|
+
- Partial edits, unresolved questions
|
|
15187
|
+
|
|
15188
|
+
## Key Technical Decisions
|
|
15189
|
+
- Decision \u2192 Reasoning (e.g., "used Map over Array for O(1) lookup")
|
|
15190
|
+
- Architecture choices and tradeoffs discussed
|
|
15191
|
+
|
|
15192
|
+
## Constraints & Requirements
|
|
15193
|
+
- User preferences (coding style, libraries, patterns)
|
|
15194
|
+
- Explicit constraints (must not, always, never)
|
|
15195
|
+
- Environment details (OS, Node version, dependencies)
|
|
15196
|
+
|
|
15197
|
+
## Files Modified or Touched
|
|
15198
|
+
- path/to/file \u2014 what changed and why
|
|
15199
|
+
|
|
15200
|
+
## Errors Encountered & Fixes
|
|
15201
|
+
- Error message \u2192 Root cause \u2192 Fix applied
|
|
15202
|
+
- Unresolved errors that need attention
|
|
15203
|
+
|
|
15204
|
+
## Next Steps
|
|
15205
|
+
- Clear, actionable items to continue the work
|
|
15206
|
+
- Dependencies: what must be done first
|
|
15207
|
+
|
|
15208
|
+
## Critical Context
|
|
15209
|
+
- Specific values, API keys (do NOT include real secrets), configuration
|
|
15210
|
+
- User's exact phrasing when it matters
|
|
15211
|
+
|
|
15212
|
+
Be concise. Prefer structured lists over prose. Focus on what the next LLM NEEDS to know to continue seamlessly.
|
|
15213
|
+
`;
|
|
15214
|
+
|
|
15215
|
+
// src/hooks/compacting.ts
|
|
15169
15216
|
function createCompactingHandler(args) {
|
|
15170
15217
|
const { client, state, projectPath, logger, tracker } = args;
|
|
15171
15218
|
return async (input, output) => {
|
|
@@ -15211,6 +15258,10 @@ function createCompactingHandler(args) {
|
|
|
15211
15258
|
logger
|
|
15212
15259
|
});
|
|
15213
15260
|
state.setPendingEnrichment(sessionID);
|
|
15261
|
+
if (capture.messageCount >= 20) {
|
|
15262
|
+
output.prompt = STRUCTURED_COMPACTION_PROMPT;
|
|
15263
|
+
}
|
|
15264
|
+
output.context.push(HANDOFF_PREFIX);
|
|
15214
15265
|
output.context.push(
|
|
15215
15266
|
`Prior conversation archived to ${checkpointPath}`
|
|
15216
15267
|
);
|