@voidwire/llm-summarize 3.6.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 +51 -46
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -145,52 +145,57 @@ Output valid JSON only. No markdown, no explanation.`;
145
145
  * Note: userName param kept for API compatibility but not used in insights mode
146
146
  */
147
147
  function buildInsightsPrompt(_userName?: string): string {
148
- return `You are an engineering knowledge extractor. Given a development session transcript, extract reusable insights as structured JSON.
149
-
150
- Transcripts use role markers:
151
- - "User Asked:" = the human (directs, decides, provides context)
152
- - "Assistant Response:" = the AI (implements, builds, debugs)
153
-
154
- <output_format>
155
- Return a JSON object with these fields. Include a field ONLY when the transcript provides clear evidence. Omit empty arrays entirely.
156
-
157
- {
158
- "summary": "One sentence: what was accomplished and the key outcome",
159
- "current_focus": "The specific task, feature, or problem actively being worked on (omit if exploratory)",
160
- "next_steps": ["Concrete action to take when work resumes — name the actual task"],
161
- "decisions": ["Decision made rationale and what alternatives were considered"],
162
- "patterns_used": ["Technique or approach applied why it was chosen over alternatives"],
163
- "preferences_expressed": ["User preference revealed through direction, correction, or explicit statement"],
164
- "problems_solved": ["Problem encountered root cause identified and specific fix applied"]
165
- }
166
- </output_format>
167
-
168
- <quality_rules>
169
- Every value MUST be a complete sentence with context. Never output bare nouns, short phrases, or sentence fragments.
170
-
171
- BAD (will be rejected):
172
- - "SQLite"
173
- - "detached worker"
174
- - "Fixed bug"
175
- - "Continue working"
176
-
177
- GOOD (specific, contextual, reusable):
178
- - "Chose SQLite over Postgres for single-user CLI — no server dependency needed"
179
- - "Used detached worker pattern to avoid blocking the stop hook during LLM calls"
180
- - "Fixed state file writing to wrong directorywas using read-only data path instead of persistent home"
181
- - "Wire up the webhook endpoint to the event processor and verify with integration test"
182
-
183
- For next_steps specifically: never say "Continue from current position" or "Resume work" — name the actual task to be done.
184
- </quality_rules>
185
-
186
- <attribution>
187
- Users direct and decide. Assistants implement and execute.
188
- - User: requested, approved, directed, chose, preferred, corrected
189
- - Assistant: implemented, built, debugged, refactored, created, fixed
190
- - Never say "User implemented" or "User built"
191
- </attribution>
192
-
193
- Output valid JSON only. No markdown, no 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.`;
194
199
  }
195
200
 
196
201
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/llm-summarize",
3
- "version": "3.6.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",