@voidwire/llm-summarize 3.9.4 → 3.10.1
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/index.ts +49 -26
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -28,13 +28,16 @@ export interface SessionInsights {
|
|
|
28
28
|
// Optional fields populated by custom prompts (e.g., Lore injection)
|
|
29
29
|
extractions?: Extraction[];
|
|
30
30
|
keywords?: string[];
|
|
31
|
-
// Insights mode fields
|
|
31
|
+
// Insights mode fields (delta extraction)
|
|
32
32
|
current_focus?: string;
|
|
33
33
|
next_steps?: string[];
|
|
34
34
|
decisions?: string[];
|
|
35
|
+
corrections?: string[];
|
|
36
|
+
validated?: string[];
|
|
37
|
+
problems_solved?: string[];
|
|
38
|
+
// Legacy fields — kept for backward compatibility with existing session JSONL data
|
|
35
39
|
patterns_used?: string[];
|
|
36
40
|
preferences_expressed?: string[];
|
|
37
|
-
problems_solved?: string[];
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export interface SummarizeResult {
|
|
@@ -83,53 +86,73 @@ Output JSON only: {"summary": "One sentence summary"}`;
|
|
|
83
86
|
* Note: userName param kept for API compatibility but not used in insights mode
|
|
84
87
|
*/
|
|
85
88
|
function buildInsightsPrompt(_userName?: string): string {
|
|
86
|
-
return `You are a session
|
|
89
|
+
return `You are a session delta extractor. Given a development conversation and the previous state snapshot, extract ONLY what is NEW since the last snapshot.
|
|
87
90
|
|
|
88
91
|
<instructions>
|
|
89
|
-
1. Read the
|
|
90
|
-
2.
|
|
91
|
-
3. Extract ONLY
|
|
92
|
-
4.
|
|
92
|
+
1. Read the <previous_state> section — this is what was already known
|
|
93
|
+
2. Read the <transcript> section — this is what happened since
|
|
94
|
+
3. Extract ONLY new information not already captured in previous_state
|
|
95
|
+
4. Skip any lines containing markers (📁 CAPTURE, 📚 TEACH, 👤 OBSERVE, 🗣️, ─── REFLECT) — these are handled by a separate system
|
|
96
|
+
5. Focus on: what decisions were made, what changed direction, what the user corrected, what approach was validated
|
|
97
|
+
6. Produce a JSON delta object
|
|
93
98
|
</instructions>
|
|
94
99
|
|
|
95
100
|
<fields>
|
|
96
|
-
- summary: One sentence
|
|
97
|
-
- current_focus: The specific task or
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
- problems_solved:
|
|
101
|
+
- summary: One sentence — what CHANGED since last snapshot, not a re-summary of the whole session
|
|
102
|
+
- current_focus: The specific task or topic right now (omit if unchanged from previous_state)
|
|
103
|
+
- decisions: New decisions only — include the rationale ("X because Y"). Skip if already in previous_state.
|
|
104
|
+
- corrections: Things the user pushed back on or redirected. Quote their words when possible.
|
|
105
|
+
- validated: Approaches the user approved or confirmed worked. Only when non-obvious.
|
|
106
|
+
- next_steps: Concrete next actions that emerged THIS turn. Name specifics.
|
|
107
|
+
- problems_solved: New problems with root cause and fix. Skip re-statements.
|
|
103
108
|
</fields>
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
<rules>
|
|
111
|
+
- If nothing meaningful changed since previous_state, return {"summary": "continuation", "current_focus": "unchanged"}
|
|
112
|
+
- NEVER repeat information from previous_state — this is a delta, not a snapshot
|
|
113
|
+
- NEVER copy text from the examples below into your output — examples show structure only, your content must come exclusively from the transcript
|
|
114
|
+
- "User clarified X" is NOT a correction — only record corrections when the user explicitly redirects, rejects, or changes direction
|
|
115
|
+
- Every field value must be specific enough to be useful 6 months from now without context
|
|
116
|
+
- If no approaches were validated this turn, omit the validated field entirely
|
|
117
|
+
</rules>
|
|
106
118
|
|
|
107
119
|
<example>
|
|
108
120
|
<input>
|
|
109
|
-
<previous_state>
|
|
121
|
+
<previous_state>
|
|
122
|
+
## Context
|
|
123
|
+
- **Focus:** Spaceship navigation module
|
|
124
|
+
- Chose warp drive over hyperspace — fewer dimensional side effects
|
|
125
|
+
## Next
|
|
126
|
+
- Test warp field calculations
|
|
127
|
+
</previous_state>
|
|
110
128
|
<transcript>
|
|
111
|
-
User
|
|
112
|
-
Assistant
|
|
113
|
-
User
|
|
114
|
-
Assistant Response: Set expiresIn to 24h in the sign options. Also added a refresh token flow so users don't get logged out mid-work.
|
|
129
|
+
User: Actually let's use hyperspace after all — the crew is more familiar with it and we already have the motivator installed
|
|
130
|
+
Assistant: Switched back to hyperspace engine with the existing motivator. Removed the warp field generator.
|
|
131
|
+
User: Good. And set the jump cooldown to 8 parsecs not the default 24.
|
|
115
132
|
</transcript>
|
|
116
133
|
</input>
|
|
117
134
|
<output>
|
|
118
|
-
{"summary":"
|
|
135
|
+
{"summary":"Reversed warp drive decision back to hyperspace — crew familiarity and existing motivator hardware","current_focus":"Hyperspace navigation","decisions":["Reverted to hyperspace engine — crew familiarity outweighs warp drive benefits, motivator already installed"],"corrections":["User reversed the warp drive decision after initial implementation — crew constraints weren't considered"],"next_steps":["Configure 8-parsec jump cooldown","Remove warp field generator dependencies"]}
|
|
119
136
|
</output>
|
|
120
137
|
</example>
|
|
121
138
|
|
|
122
139
|
<example>
|
|
123
140
|
<input>
|
|
124
|
-
<previous_state>
|
|
141
|
+
<previous_state>
|
|
142
|
+
## Context
|
|
143
|
+
- **Focus:** Debugging potion brewing test failures
|
|
144
|
+
- Fixed expired ingredient timestamp in tests
|
|
145
|
+
## Next
|
|
146
|
+
- Verify cauldron CI passes
|
|
147
|
+
</previous_state>
|
|
125
148
|
<transcript>
|
|
126
|
-
User
|
|
127
|
-
Assistant
|
|
128
|
-
User
|
|
149
|
+
User: CI is green now. Let's move on to the invisibility cloak renderer.
|
|
150
|
+
Assistant: Starting on the cloak renderer. I'll use a phase-shift approach with mithril threading.
|
|
151
|
+
User: Sounds good.
|
|
129
152
|
</transcript>
|
|
130
153
|
</input>
|
|
131
154
|
<output>
|
|
132
|
-
{"summary":"
|
|
155
|
+
{"summary":"Potion CI fixed, pivoted to invisibility cloak renderer","current_focus":"Invisibility cloak renderer implementation","validated":["Phase-shift rendering with mithril threading — user approved the approach"],"next_steps":["Implement phase-shift cloak renderer with mithril threading"]}
|
|
133
156
|
</output>
|
|
134
157
|
</example>
|
|
135
158
|
|