3 Commits

Author SHA1 Message Date
Claude 44a6e04c2f fix(scripts): bootstrap-maturity.sh preserves existing JSONL maturity + compact output
The JSONL branch of bootstrap-maturity.sh had two bugs:

1. Detection wrong: `jq -e '.maturity' <file>` only inspects the first
   object in a JSONL stream, so files where a later line is missing the
   field silently skipped.
2. Output wrong: default `jq` pretty-prints its output, producing
   multi-line objects that break JSONL consumers. The unconditional
   `. + {"maturity": "provisional"}` also overwrote existing maturity
   values (e.g. "stable" → "provisional").

Fix:

- Count missing lines with `jq -c 'select(has("maturity") | not)'`
  (per-line stream semantics).
- Transform with `jq -c 'if has("maturity") then . else . +
  {"maturity": "provisional"} end'` so existing values are preserved
  and output stays valid compact JSONL.
- Add bats coverage for preservation, compact output, and idempotency.
2026-04-17 02:54:22 +00:00
Boden Fuller 1234ff75a3 fix(hooks+cli): harvest remediation — 10 fixes across hooks, CLI, scripts (na-oh2)
Wave 1 — Hook hardening:
- research-loop-detector: early exit for neutral tools before git rev-parse
- commit-review-gate: capture git diff once (4→2 calls, TOCTOU fix)
- task-validation-gate: extract validate_restricted_cmd to hook-helpers.sh,
  pre-validate assertion regex, fix || && precedence bug
- session-start: clear .intent-echo-fired on new session
- go-vet-post-edit: assertion density → additionalContext JSON

Wave 2 — Go + scripts:
- inject_learnings: single-read + parseFrontmatterFromContent + atomicWriteFile
  (eliminates double-read race in applyConfidenceDecayMarkdown)
- rpi_phased: pass actual phaseStart time to handleBudgetTimeout
  (fixes time_boxed StartedAt/DurationSeconds inaccuracy)
- bootstrap-maturity.sh: add .jsonl support with jq maturity injection
- inject.go: add non-verbose quality gate summary to stderr
2026-03-03 18:07:04 -05:00
Boden Fuller 0cd80a2eb7 fix(cli): repair flywheel signal chain — confidence decay, close-loop order, glob errors (na-pkg W1)
Wave 1 of flywheel signal repair epic (na-pkg):

- na-pkg.1: Fix confidence decay to process .md learnings (was skipping all non-.jsonl)
  Add applyConfidenceDecayMarkdown() that reads/writes YAML frontmatter
- na-pkg.2: Reorder close-loop so citation feedback runs before maturity transitions
  Ensures cited learnings get reward_count bump before promotion evaluation
- na-pkg.3: Fix GlobLearningFiles to return errors instead of silently swallowing them
- na-pkg.5: Add bootstrap-maturity.sh migration script for existing learnings

All 19 packages pass. 9 new test functions covering decay, ordering, and glob.
2026-03-03 14:45:15 -05:00