@voidwire/llm-summarize 3.5.0 → 3.7.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 (2) hide show
  1. package/index.ts +53 -51
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -36,7 +36,6 @@ export interface SessionInsights {
36
36
  patterns_used?: string[];
37
37
  preferences_expressed?: string[];
38
38
  problems_solved?: string[];
39
- tools_heavy?: string[];
40
39
  }
41
40
 
42
41
  export interface SummarizeResult {
@@ -146,55 +145,57 @@ Output valid JSON only. No markdown, no explanation.`;
146
145
  * Note: userName param kept for API compatibility but not used in insights mode
147
146
  */
148
147
  function buildInsightsPrompt(_userName?: string): string {
149
- return `You are a senior engineering manager extracting reusable insights from development sessions.
150
-
151
- You receive transcripts with clear role markers:
152
- - "User Asked:" = the human directing work (requests, approves, provides context)
153
- - "Assistant Response:" = the AI executing work (implements, builds, debugs, explains)
154
-
155
- Your job: extract what's worth remembering for future sessions.
156
-
157
- <output_schema>
158
- {
159
- "summary": "One sentence capturing what was accomplished and how",
160
- "current_focus": "What work is actively in progress — the specific task, feature, or thread (omit if session was exploratory with no clear focus)",
161
- "next_steps": ["What should happen when work resumes concrete actions, not vague intentions"],
162
- "decisions": ["Decision made with reasoning and trade-offs considered"],
163
- "patterns_used": ["Development pattern or approach, with context on why it was chosen"],
164
- "preferences_expressed": ["Preference revealed through direction or feedback"],
165
- "problems_solved": ["Problem encountered and the specific solution applied"],
166
- "tools_heavy": ["Tool used repeatedly or for critical work"]
167
- }
168
- </output_schema>
169
-
170
- <attribution_rules>
171
- - User actions: requested, approved, directed, provided, chose, preferred
172
- - Assistant actions: implemented, built, debugged, refactored, created, fixed
173
- - Never say "User implemented" or "User built" — users direct, assistants execute
174
- </attribution_rules>
175
-
176
- <quality_guidance>
177
- Extract specifics with context, not bare facts:
178
-
179
- SPARSE (avoid):
180
- - "Made a database decision"
181
- - "Fixed a bug"
182
- - "Used TypeScript"
183
-
184
- RICH (prefer):
185
- - "Chose SQLite over Postgres for single-user CLI tool — avoids server dependency"
186
- - "Fixed race condition in webhook handler by adding mutex lock — was causing duplicate events"
187
- - "Used Zod for runtime validation at API boundary — catches malformed input before it hits business logic"
188
- </quality_guidance>
189
-
190
- <rules>
191
- - Include a field ONLY when the transcript provides clear evidence
192
- - Omit empty arrays entirely
193
- - Capture the "why" when present — reasoning is more valuable than the decision alone
194
- - Technical specifics (library names, patterns, trade-offs) make insights reusable
195
- </rules>
196
-
197
- Output valid JSON only. No markdown code blocks, no explanation.`;
148
+ return `You are a session state extractor. Given a development conversation, produce a JSON snapshot of the session's current state.
149
+
150
+ <instructions>
151
+ 1. Read the conversation in the <transcript> section
152
+ 2. Ignore the <previous_state> section it is background context only, not part of this session
153
+ 3. Extract ONLY what happened in the transcript
154
+ 4. Produce a JSON object with the fields described below
155
+ </instructions>
156
+
157
+ <fields>
158
+ - summary: One sentence describing what was accomplished this session
159
+ - current_focus: The specific task or feature being worked on (omit if exploratory)
160
+ - next_steps: Array of concrete next actions. Name the specific task.
161
+ - decisions: Array of decisions made this session, each with rationale
162
+ - patterns_used: Array of techniques or approaches applied, each with context
163
+ - preferences_expressed: Array of user preferences revealed through direction or correction
164
+ - problems_solved: Array of problems encountered with root cause and fix
165
+ </fields>
166
+
167
+ Include a field only when the transcript contains clear evidence. Omit empty arrays. Every value must be a complete sentence.
168
+
169
+ <example>
170
+ <input>
171
+ <previous_state>Focus: Building authentication system</previous_state>
172
+ <transcript>
173
+ User Asked: Let's use JWT instead of sessions for auth
174
+ Assistant Response: Switched from express-session to jsonwebtoken. JWTs are stateless so we don't need Redis for session storage anymore. Updated the middleware to verify tokens on each request.
175
+ User Asked: Make sure the tokens expire after 24 hours
176
+ 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.
177
+ </transcript>
178
+ </input>
179
+ <output>
180
+ {"summary":"Implemented JWT-based authentication replacing session-based auth, with 24-hour token expiry and refresh token flow","current_focus":"Authentication system implementation","next_steps":["Test the refresh token flow with expired tokens","Add token revocation for logout"],"decisions":["Chose JWT over sessions — eliminates Redis dependency since tokens are stateless","Set 24-hour token expiry with refresh flow — balances security with user convenience"],"preferences_expressed":["User directed specific token expiry of 24 hours"]}
181
+ </output>
182
+ </example>
183
+
184
+ <example>
185
+ <input>
186
+ <previous_state>Focus: Investigating test failures</previous_state>
187
+ <transcript>
188
+ User Asked: The CI is failing on the webhook tests
189
+ Assistant Response: Found the issue — the test was using a hardcoded timestamp that expired. Changed it to use a relative timestamp. Also found that the webhook handler had a race condition where two events could arrive simultaneously and both pass the idempotency check. Added a mutex lock.
190
+ User Asked: Good catch on the race condition
191
+ </transcript>
192
+ </input>
193
+ <output>
194
+ {"summary":"Fixed CI test failure caused by hardcoded timestamp and discovered a race condition in the webhook handler","current_focus":"Webhook test failures and handler reliability","problems_solved":["Fixed expired hardcoded timestamp in webhook tests — replaced with relative timestamp calculation","Fixed race condition in webhook handler where simultaneous events bypassed idempotency check — added mutex lock"],"next_steps":["Verify CI passes with the timestamp and mutex fixes"]}
195
+ </output>
196
+ </example>
197
+
198
+ Output valid JSON only.`;
198
199
  }
199
200
 
200
201
  /**
@@ -610,7 +611,8 @@ export async function summarize(
610
611
  const apiKey = config.apiKey;
611
612
  const mode: SummarizeMode = options?.mode || "insights";
612
613
  const userName = options?.userName;
613
- const systemPrompt = options?.systemPrompt || getPromptForMode(mode, userName);
614
+ const systemPrompt =
615
+ options?.systemPrompt || getPromptForMode(mode, userName);
614
616
 
615
617
  // Validate config
616
618
  if (!provider) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/llm-summarize",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Structured session insight extraction for knowledge systems",
5
5
  "type": "module",
6
6
  "main": "./index.ts",