prizmkit 1.0.93 → 1.0.95

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.93",
3
- "bundledAt": "2026-03-22T17:12:01.644Z",
4
- "bundledFrom": "62f12ab"
2
+ "frameworkVersion": "1.0.95",
3
+ "bundledAt": "2026-03-23T08:20:36.490Z",
4
+ "bundledFrom": "8a1ccc9"
5
5
  }
@@ -328,6 +328,7 @@ if [[ -f "$SESSION_LOG" ]]; then
328
328
  FINAL_SIZE=$(wc -c < "$SESSION_LOG" 2>/dev/null | tr -d ' ')
329
329
  log_info "Session log: $FINAL_LINES lines, $((FINAL_SIZE / 1024))KB"
330
330
  fi
331
+ log_info "exit_code=$EXIT_CODE"
331
332
 
332
333
  # ── Determine session outcome from observable signals ──────────────
333
334
  PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -337,6 +337,7 @@ if [[ -f "$SESSION_LOG" ]]; then
337
337
  FINAL_SIZE=$(wc -c < "$SESSION_LOG" 2>/dev/null | tr -d ' ')
338
338
  log_info "Session log: $FINAL_LINES lines, $((FINAL_SIZE / 1024))KB"
339
339
  fi
340
+ log_info "exit_code=$EXIT_CODE"
340
341
 
341
342
  # ── Determine session outcome from observable signals ──────────────
342
343
  PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -163,6 +163,7 @@ spawn_and_wait_session() {
163
163
  local final_lines=$(wc -l < "$session_log" 2>/dev/null | tr -d ' ')
164
164
  log_info "Session log: $final_lines lines, $((final_size / 1024))KB"
165
165
  fi
166
+ log_info "exit_code=$exit_code"
166
167
 
167
168
  # ── Determine session outcome from observable signals ──────────────
168
169
  local session_status
@@ -183,6 +183,7 @@ spawn_and_wait_session() {
183
183
  local final_lines=$(wc -l < "$session_log" 2>/dev/null | tr -d ' ')
184
184
  log_info "Session log: $final_lines lines, $((final_size / 1024))KB"
185
185
  fi
186
+ log_info "exit_code=$exit_code"
186
187
 
187
188
  # ── Determine session outcome from observable signals ──────────────
188
189
  # No dependency on session-status.json — uses exit code, git commits,
@@ -272,39 +273,6 @@ sys.exit(1)
272
273
  feature_slug=""
273
274
  }
274
275
 
275
- if [[ -n "$feature_slug" ]]; then
276
- local project_root_for_summary
277
- project_root_for_summary="$(cd "$SCRIPT_DIR/.." && pwd)"
278
- local summary_path="$project_root_for_summary/.prizmkit/specs/${feature_slug}/session-summary.json"
279
- mkdir -p "$(dirname "$summary_path")"
280
- local session_start_time
281
- session_start_time=$(python3 -c "
282
- import json, sys, os
283
- p = os.path.join(sys.argv[1], 'current-session.json')
284
- if os.path.isfile(p):
285
- with open(p) as f: print(json.load(f).get('started_at', ''))
286
- else: print('')
287
- " "$STATE_DIR" 2>/dev/null) || session_start_time=""
288
- local exec_tier
289
- exec_tier=$(python3 -c "
290
- import json, sys, os
291
- p = sys.argv[1]
292
- if os.path.isfile(p):
293
- with open(p) as f: print(json.load(f).get('exec_tier', ''))
294
- else: print('')
295
- " "$session_dir/session-status.json" 2>/dev/null) || exec_tier=""
296
- cat > "$summary_path" <<SUMMARY
297
- {
298
- "feature_id": "$feature_id",
299
- "session_id": "$session_id",
300
- "status": "$session_status",
301
- "started_at": "$session_start_time",
302
- "completed_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
303
- "tier": "$exec_tier"
304
- }
305
- SUMMARY
306
- fi
307
-
308
276
  # Validate key artifacts exist after successful session
309
277
  if [[ "$session_status" == "success" && -n "$feature_slug" ]]; then
310
278
  local project_root_for_artifacts
@@ -1068,11 +1036,36 @@ os.replace(tmp, target)
1068
1036
  else
1069
1037
  log_warn "Auto-merge failed — dev branch preserved: $_DEV_BRANCH_NAME"
1070
1038
  log_warn "Merge manually: git checkout $_ORIGINAL_BRANCH && git rebase $_DEV_BRANCH_NAME"
1039
+ # branch_merge failed and left us on dev branch — checkout original and commit pipeline artifacts
1040
+ if git -C "$_proj_root" checkout "$_ORIGINAL_BRANCH" 2>/dev/null; then
1041
+ local _merge_failed_current _merge_failed_dirty
1042
+ _merge_failed_current=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
1043
+ if [[ "$_merge_failed_current" == "$_ORIGINAL_BRANCH" ]]; then
1044
+ _merge_failed_dirty=$(git -C "$_proj_root" status --porcelain 2>/dev/null || true)
1045
+ if [[ -n "$_merge_failed_dirty" ]]; then
1046
+ git -C "$_proj_root" add -A 2>/dev/null || true
1047
+ git -C "$_proj_root" commit --no-verify -m "chore: include pipeline state artifacts" 2>/dev/null || true
1048
+ fi
1049
+ fi
1050
+ fi
1071
1051
  _DEV_BRANCH_NAME=""
1072
1052
  fi
1073
1053
  elif [[ -n "$_DEV_BRANCH_NAME" ]]; then
1074
1054
  # Session failed — return to original branch, preserve dev branch for inspection
1075
- git -C "$_proj_root" checkout "$_ORIGINAL_BRANCH" 2>/dev/null || true
1055
+ if git -C "$_proj_root" checkout "$_ORIGINAL_BRANCH" 2>/dev/null; then
1056
+ # Commit any dirty pipeline state files left on the original branch
1057
+ local _failed_current _failed_dirty
1058
+ _failed_current=$(git -C "$_proj_root" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
1059
+ if [[ "$_failed_current" == "$_ORIGINAL_BRANCH" ]]; then
1060
+ _failed_dirty=$(git -C "$_proj_root" status --porcelain 2>/dev/null || true)
1061
+ if [[ -n "$_failed_dirty" ]]; then
1062
+ git -C "$_proj_root" add -A 2>/dev/null || true
1063
+ git -C "$_proj_root" commit --no-verify -m "chore: include pipeline state artifacts" 2>/dev/null || true
1064
+ fi
1065
+ fi
1066
+ else
1067
+ log_warn "Failed to checkout $_ORIGINAL_BRANCH after session failure — pipeline state may be uncommitted"
1068
+ fi
1076
1069
  log_warn "Session failed — dev branch preserved for inspection: $_DEV_BRANCH_NAME"
1077
1070
  _DEV_BRANCH_NAME=""
1078
1071
  fi
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.93",
2
+ "version": "1.0.95",
3
3
  "skills": {
4
4
  "prizm-kit": {
5
5
  "description": "Full-lifecycle dev toolkit. Covers spec-driven development, Prizm context docs, code quality, debugging, deployment, and knowledge management.",
@@ -137,6 +137,34 @@ Sediment DECISIONS and interface conventions to platform memory files. This is w
137
137
  - Feature completion with notable DECISIONS or interface conventions discovered
138
138
  - **Skip for**: trivial fixes, config changes, bug fixes with no new conventions
139
139
 
140
+ ### Write Decision Gate (mandatory before any write)
141
+
142
+ Before writing anything to memory files, apply this evaluation in order:
143
+
144
+ **Gate 1 — Importance**: Is the content worth recording? Only record:
145
+ - New feature implementations with non-obvious design choices
146
+ - Critical logic changes with lasting impact
147
+ - Interface conventions that future sessions must honor
148
+ - **Skip**: simple queries, trivial fixes, one-off config changes, content with no future impact
149
+
150
+ **Gate 2 — Dedup**: If Gate 1 passes, read the existing memory file(s) first. Compare against existing entries by core keywords, feature summary, or function signature. If a highly similar entry already exists, **skip or merge-update** it — never duplicate.
151
+
152
+ **Gate 3 — Write only if both pass**: Write to memory files only when content is both important AND non-duplicate. Do NOT write by default after every feature. Skipping is the correct outcome for routine work.
153
+
154
+ **File size monitor**: After each write, check the file's line count. If it exceeds 500 lines, trigger the compaction flow below.
155
+
156
+ ### Compaction Flow (triggered at >500 lines)
157
+
158
+ Goal: reduce file size while preserving all valuable knowledge.
159
+
160
+ Allowed operations (lossless):
161
+ - **Merge similar entries**: combine multiple updates about the same feature/topic into one comprehensive record
162
+ - **Remove stale content**: delete entries explicitly superseded, replaced, or marked as deprecated
163
+ - **Distill verbose logs**: compress long narrative descriptions into concise bullet points, preserving key code snippets, config changes, and decision rationale
164
+ - **Restructure**: reorganize headers and sections for clarity
165
+
166
+ Principle: compaction must be lossless — no valuable operational history or decision rationale may be lost.
167
+
140
168
  ### Sedimentation Rules
141
169
 
142
170
  1. **Max 3-5 entries per feature**: Only keep DECISIONS and interface conventions that genuinely affect future development
@@ -150,26 +178,30 @@ Sediment DECISIONS and interface conventions to platform memory files. This is w
150
178
  - `claude` → target: `CLAUDE.md` in project root
151
179
  - `codebuddy` → targets: BOTH `CODEBUDDY.md` in project root AND `memory/MEMORY.md` (dual-write required)
152
180
 
153
- **2b-2.** Collect sedimentation candidates:
181
+ **2b-2.** Apply the Write Decision Gate (Importance → Dedup → Write). If gate fails at any step, skip Job 3 entirely.
182
+
183
+ **2b-3.** Collect sedimentation candidates (only if gate passes):
154
184
  - From context-snapshot.md '## Implementation Log': DECISIONS and notable discoveries
155
185
  - From context-snapshot.md '## Review Notes': quality patterns, architectural observations
156
186
  - From git diff analysis: any project-level conventions established
157
187
  - Filter: only entries that answer "Would a new session benefit from knowing this decision/convention?"
158
188
 
159
- **2b-3.** Read existing memory file(s) content. Check for duplicates or near-duplicates.
189
+ **2b-4.** Read existing memory file(s) content. Check for duplicates or near-duplicates.
160
190
  - For Claude Code: read `CLAUDE.md`
161
191
  - For CodeBuddy: read BOTH `CODEBUDDY.md` AND `memory/MEMORY.md`
162
192
 
163
- **2b-4.** Append to memory file(s) using this format:
193
+ **2b-5.** Append to memory file(s) using this format:
164
194
  ```markdown
165
195
  ### F-XXX: <feature-title>
166
196
  - DECISION: <decision content> — <rationale>
167
197
  - INTERFACE: <module.function>: <convention>
168
198
  ```
169
199
 
170
- **2b-5.** For CodeBuddy platform: write identical content to BOTH `CODEBUDDY.md` AND `memory/MEMORY.md` (dual-write, both must be updated).
200
+ **2b-6.** For CodeBuddy platform: write identical content to BOTH `CODEBUDDY.md` AND `memory/MEMORY.md` (dual-write, both must be updated).
201
+
202
+ **2b-7.** After writing, check file line count. If >500 lines, run the Compaction Flow before proceeding.
171
203
 
172
- **2b-6.** If no Implementation Log or Review Notes sections exist in context-snapshot.md, still attempt to extract DECISIONS from git diff and plan.md. Skip only if no meaningful decisions were made.
204
+ **2b-8.** If no Implementation Log or Review Notes sections exist in context-snapshot.md, still attempt to extract DECISIONS from git diff and plan.md. Skip only if no meaningful decisions were made.
173
205
 
174
206
  ---
175
207
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {