diff --git a/.claude/audits/BUGS-FOUND.md b/.claude/audits/BUGS-FOUND.md index 6fd3c6a..e95c6a6 100644 --- a/.claude/audits/BUGS-FOUND.md +++ b/.claude/audits/BUGS-FOUND.md @@ -7,5 +7,6 @@ - hooks/session-start.sh:200-217 + lib/detect-plugins.sh:49-52 (`detect_uiux_pro_max`) — the banner "ALWAYS ON" row and the ui-ux-pro-max toggle row read user-scope settings.json / plugin cache, not the effective profile (`profile.sh current --plain`, BDR-134 single source of truth): a dev or minimal project shows ui-ux-pro-max on; pr-review-toolkit on in max/audit is not shown. Severity: low (banner only). Discovered while: code-clean 2026-11-09 (phase 5 sweep). Not fixed. - hooks/session-start.sh:177-183 + agents/plugin-advisor.md:193,197,211,226,233,263 vs doctor.sh:520-526 — passive-cost constants disagree (banner/advisor: gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300; doctor dropped gstack/context7/graphify 2026-09-28 as double counting, ui-ux-pro-max 670); agents/status-reporter.md:26-30 names doctor as source of truth. Severity: low (estimates). Discovered while: code-clean 2026-11-09. Not fixed. - hooks/session-start.sh:404-408 (`_digest_journal`) — greps `^- ` without skipping HTML comments; templates/memory/journal.md:19-21 holds `- ` bullets inside ``, so a template-born project prints "- journal: " in the session digest until its first journal write. Fix template and digest together. Severity: low. Discovered while: code-clean 2026-11-09 (phase 4 sweep). Not fixed. + FIXED 2026-11-09 (/hotfix, bugfix/digest-journal-comment): the digest skips HTML comment blocks (opener anchored at line start, CommonMark rule; an inline ` blocks (opener anchored line start, END guard), SD18 3 checks; challenge MAJOR x2 (unanchored opener) folded; template untouched; security PASS. diff --git a/.claude/tasks/contracts/2026-11-09-digest-journal-comment-1810.md b/.claude/tasks/contracts/2026-11-09-digest-journal-comment-1810.md new file mode 100644 index 0000000..f2e6601 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-09-digest-journal-comment-1810.md @@ -0,0 +1,22 @@ +# CONTRACT — digest-journal-comment +- date: 2026-11-09 | flow: hotfix | branch: bugfix/digest-journal-comment +- status: active + +## REQUEST (verbatim — IMMUTABLE) +G3 from .claude/audits/BUGS-FOUND.md (code-clean 2026-11-09): hooks/session-start.sh:404-408 `_digest_journal` greps `^- ` without skipping HTML comments; templates/memory/journal.md:19-21 holds `- ` bullets inside ``, so a project born from the template prints "- journal: " in the session digest until its first journal write. Fix in the digest (skip lines inside `` blocks) so the template stays byte-identical (it is copied by onboarder/init-project and memory.sh upgrade). Regression test in lib/tests/session-digest.test.sh with a fixture journal built from templates/memory/journal.md: digest prints no journal line (or the real last entry once one exists). Mark the BUGS-FOUND entry FIXED. make test needs GATES_TIMEOUT=600 + PATH=$HOME/.bun/bin:$PATH. + +## CLARIFICATIONS +Q: oracle 2 "shellcheck clean"? / A: corrected to `shellcheck -S warning` (orchestrator, 2026-11-09): develop already exits 1 on info notes (SC1091); the new SC2016 info is the intended literal backticks of SD18-inline-marker. + +## ACCEPTANCE CRITERIA +1. Symptom gone: a project whose journal.md is a byte copy of templates/memory/journal.md gets no `- journal:` line in the digest; once a real entry is appended after the comment, the digest shows that entry; the template is unchanged. + CHECK: cd /home/bchanot/Documents/claude && git diff --quiet develop -- templates/memory/journal.md && make test suite=lib/tests/session-digest.test.sh 2>&1 | tail -1 | grep -q 'all suites green' && grep -q 'SD18' lib/tests/session-digest.test.sh && echo SYMPTOM-GONE + EXPECT: SYMPTOM-GONE + EVIDENCE: MET exit=0 marker-found :: SYMPTOM-GONE +2. Build/tests green (full suite, GATES_TIMEOUT=600, bun on PATH); shellcheck clean on hooks/session-start.sh and lib/tests/session-digest.test.sh. + CHECK: cd /home/bchanot/Documents/claude && shellcheck -S warning hooks/session-start.sh lib/tests/session-digest.test.sh && make test 2>&1 | tail -1 | grep -q 'all suites green' && echo GREEN + EXPECT: GREEN + EVIDENCE: MET exit=0 marker-found :: GREEN + +## FILE SCOPE +hooks/session-start.sh (`_digest_journal` only), lib/tests/session-digest.test.sh (new SD18 case); bookkeeping: .claude/audits/BUGS-FOUND.md (FIXED line) diff --git a/.claude/tasks/plans/2026-11-09-digest-journal-comment-1810.md b/.claude/tasks/plans/2026-11-09-digest-journal-comment-1810.md new file mode 100644 index 0000000..d30ca18 --- /dev/null +++ b/.claude/tasks/plans/2026-11-09-digest-journal-comment-1810.md @@ -0,0 +1,43 @@ +# FIX — digest-journal-comment (/hotfix, 2026-11-09) + +Contract: .claude/tasks/contracts/2026-11-09-digest-journal-comment-1810.md + +## Root cause +hooks/session-start.sh `_digest_journal`: +```bash +last=$(grep '^- ' "$1/.claude/memory/journal.md" | tail -1) +``` +picks the last `- ` line of the file, including the example bullets inside the template's HTML comment (templates/memory/journal.md:14-22: ``). `memory.sh journal` appends real entries AFTER that comment, so the bug shows only until the first write. + +## Edit 1 — hooks/session-start.sh `_digest_journal` +Replace the grep line with an awk that tracks HTML comment BLOCKS (r2 after challenge: opener anchored to line start, CommonMark rule; an inline `/ { c = 0 } + END { if (!c) print l }' "$1/.claude/memory/journal.md") +``` +A block opens only on a line that starts with `` opens and closes on the same line. An unclosed block at EOF prints nothing (END guard). `[ -n "$last" ] && echo …` unchanged: empty → no journal line. Missing file: awk prints an error to stderr and nothing to stdout, same as grep did (the hook runs with stderr not shown in the digest; unchanged behavior). + +## Edit 2 — lib/tests/session-digest.test.sh new case SD18 (before SD15, which must stay last) +```bash +# SD18: a journal born from the template prints no journal line (the +# example bullets sit in an HTML comment); a real entry appended after the +# comment is the one shown (G3, code-clean 2026-11-09) +p=$(mkproj sd18) +cp "$ROOT/templates/memory/journal.md" "$p/.claude/memory/journal.md" +check SD18-template-no-journal "$(run "$p" "$WORK/startup.json" | digest | grep -c '^- journal:')" 0 +printf '\n## 2026-11-09\n\n- real entry\n' >> "$p/.claude/memory/journal.md" +check SD18-real-entry "$(run "$p" "$WORK/startup.json" | digest | grep '^- journal:')" '- journal: real entry' +printf -- '- note on ``: everything after is comment and END prints nothing (no stale line). +- Inline `/ { c = 0 } + END { if (!c) print l }' "$1/.claude/memory/journal.md") [ -n "$last" ] && echo "- journal: ${last#- }" } diff --git a/lib/tests/session-digest.test.sh b/lib/tests/session-digest.test.sh index cc835e8..5ea2e61 100644 --- a/lib/tests/session-digest.test.sh +++ b/lib/tests/session-digest.test.sh @@ -254,6 +254,17 @@ check SD17-before-digest "$(printf '%s\n' "$out17" \ | grep -n -e '^memory feedback' -e '^memory digest' | cut -d: -f2 \ | tr '\n' ' ')" "memory feedback memory digest " +# SD18: a journal born from the template prints no journal line (the +# example bullets sit in an HTML comment); a real entry appended after the +# comment is the one shown (G3, code-clean 2026-11-09) +p=$(mkproj sd18) +cp "$ROOT/templates/memory/journal.md" "$p/.claude/memory/journal.md" +check SD18-template-no-journal "$(run "$p" "$WORK/startup.json" | digest | grep -c '^- journal:')" 0 +printf '\n## 2026-11-09\n\n- real entry\n' >> "$p/.claude/memory/journal.md" +check SD18-real-entry "$(run "$p" "$WORK/startup.json" | digest | grep '^- journal:')" '- journal: real entry' +printf -- '- note on `