claudemd-cli 0.12.0 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,73 @@ All notable changes to the `claudemd` plugin. This changelog tracks plugin artif
8
8
  - **Canonical spec version source**: `spec/CLAUDE.md` top-line title (`# AI-CODING-SPEC vX.Y.Z — Core`) + `spec/CLAUDE-changelog.md` top `##` entry.
9
9
  - **Plugin semver vs spec semver** are independent: plugin patch (0.2.0 → 0.2.1) may ship when spec is unchanged (this release); plugin minor (0.1.9 → 0.2.0) ships when spec minor updates (v0.2.0 shipped spec v6.10.0).
10
10
 
11
+ ## [0.13.0] - 2026-05-11
12
+
13
+ **Minor — feat: `memory-coverage-scan` Stop hook closes the §11 auto-memory observation gap.**
14
+
15
+ Inverse twin of v0.11.0's `memory-prompt-hint`. The hint hook covers proactive READ-side ("your prompt matches memory you haven't Read"); this new hook covers reactive WRITE-side ("you produced lesson/decision tokens this session but called `mem_save` zero times — review whether anything warrants persistence"). Both fire on the §11 surface and close the cite/save bracket on MEMORY.md lifecycle observability.
16
+
17
+ ### Background
18
+
19
+ P2 audit (this session's earlier turn) flagged the "该存的没存" observation gap: `memory-prompt-hint` 30d=4 hits and `mem-audit` 30d=3 warns gave no read on whether the agent *should have saved* memory it didn't. Without a session-end coverage scan, that question can't be measured — only inferred from absence. Adding the hook converts the unobservable into a logged `coverage-advisory` rule-hits row.
20
+
21
+ ### What changed
22
+
23
+ - **New hook** `hooks/memory-coverage-scan.sh` (~90 LOC). Stop event; opt-in `MEMORY_COVERAGE_SCAN=1` (default OFF per behavior-layer hook convention — same as `transcript-vocab-scan` / `transcript-structure-scan`).
24
+ - **Detection**: extracts all assistant text from session transcript; line-counts case-insensitive matches against:
25
+ - **Lesson tokens**: `lesson | gotcha | non-obvious | turns out | 踩坑 | 原因是 | 原来如此 | 学到 | 不该 | 下次`
26
+ - **Decision tokens**: `non-default | chose .* over | 因为.*所以 | 选 .* 不选 | 非默认`
27
+ - **Offset**: counts `mem_save` tool_use names (MCP shape) and Bash invocations of `claude-mem-lite save` / `mem save`. Fires when `total >= MEMORY_COVERAGE_THRESHOLD` (default 3) AND `mem_saves == 0`.
28
+ - **Per-session dedup**: state sentinel `~/.claude/.claudemd-state/mem-coverage-<sid>.ts` — at most one advisory per `session_id` (Stop fires multiple times per session naturally).
29
+ - **Schema additive**: new event `coverage-advisory`; new spec section `§11-mem-coverage` in `docs/RULE-HITS-SCHEMA.md`. Contract test (`tests/hooks/contract.test.sh`) DOCUMENTED array extended.
30
+ - **Registry sync**: 15 → 16 hooks. `scripts/lib/hook-registry.js` adds entry; `tests/scripts/{install,hook-registry}.test.js` count pin moved; `tests/integration/full-lifecycle.test.sh` MCOUNT + regex group moved; `README.md` hook count + name list updated (also catches up `session-extended-read` which was missing from the README since v0.10.1); `commands/claudemd-toggle.md` valid-name list extended.
31
+ - **Kill-switch**: `DISABLE_MEMORY_COVERAGE_HOOK=1` (and the global `DISABLE_CLAUDEMD_HOOKS=1`).
32
+ - **Threshold override**: `MEMORY_COVERAGE_THRESHOLD=<N>` env (default 3).
33
+
34
+ ### Why minor (not patch)
35
+
36
+ New hook = new contract surface (rule-hits emits `coverage-advisory` rows, schema documents `§11-mem-coverage`). Per `feedback_claudemd_spec_single_source_of_truth.md` § "Plugin semver vs spec semver are independent": plugin minor when feature adds; spec stays at v6.11.14 (no rule change, this is observability instrumentation for existing §11 Auto-memory triggers).
37
+
38
+ ### Tests
39
+
40
+ - New `tests/hooks/memory-coverage-scan.test.sh`: 12 cases — 3+ lesson tokens (advisory), 3+ 中文 decision tokens, below-threshold silence, mem_save tool_use offsets, claude-mem-lite Bash offsets, opt-in OFF silence, kill-switch silence, per-session dedup, missing transcript fail-open, threshold-override silence, no assistant text silence, telemetry shape (`extra.total = lesson + decision`).
41
+ - Updated `tests/hooks/contract.test.sh`: `coverage-advisory:memory-coverage-scan` in DOCUMENTED array; B/C invariants auto-verify via grep.
42
+ - Updated `tests/scripts/install.test.js` + `tests/scripts/hook-registry.test.js`: count pin 15 → 16.
43
+ - Updated `tests/integration/full-lifecycle.test.sh`: MCOUNT + settings-eviction regex.
44
+
45
+ ### Operator notes
46
+
47
+ Hook ships default-OFF for ≥30 days FP signal collection before flipping default-ON, mirroring the `transcript-*-scan` precedent. Enable per project via:
48
+ ```
49
+ export MEMORY_COVERAGE_SCAN=1
50
+ ```
51
+ Lower threshold for high-signal projects: `MEMORY_COVERAGE_THRESHOLD=2`.
52
+
53
+ ## [0.12.1] - 2026-05-11
54
+
55
+ **Patch — refactor: AI-CODING-SPEC v6.11.13 → v6.11.14 extended compression (audit-driven trim).**
56
+
57
+ Spec audit (user request `分析一下我们的CLAUDE.md...能不能精炼和压缩`) surfaced two structural redundancies in `CLAUDE-extended.md` — §11-EXT was 6 sibling sub-sections covering overlapping topics, and Appendix B carried 4 examples (B.3–B.6) whose normative content already lived in §10-R / §2-EXT / §2.S. No HARD rule add/remove/downgrade; no behavior change.
58
+
59
+ ### What changed
60
+
61
+ - **Spec v6.11.13 → v6.11.14** (patch — content reorg + redundancy removal, identical rule semantics).
62
+ - **§11-EXT consolidated** in `spec/CLAUDE-extended.md`: 4 sub-sections (`Session maintenance heuristics` + `Execution heuristics (CC-borrowed)` + `Memory-system routing` + `Auto-memory decision tree`) merged into 2 (`§11-EXT Session heuristics (advisory)` + `§11-EXT Memory operations`); `MEMORY-tag-syntax` folded into Memory operations as a subsection; `macOS shell portability` replaced with one-paragraph cross-ref pointer to `feedback_macos_shell_portability.md` + `feedback_hook_platform_lib_source.md` memory anchors.
63
+ - **Appendix B trimmed**: B.1 (`[AUTH REQUIRED]` format) + B.2 (evidence valid/invalid) retained as canonical reuse-cases; B.3 (L3 summary formats) + B.4 (EMERGENCY incident report) + B.5 (auto-decision one-liners) + B.6 (L3 spec example) removed.
64
+ - **Version pins synced**: `spec/CLAUDE.md` header, `spec/CLAUDE-changelog.md` top entry, `tests/scripts/spec-structure.test.js` assertions, `README.md` (2 occurrences). Plugin manifest `description` fields kept at `v6.11` per the major.minor-only versioning policy (set in v0.2.1).
65
+
66
+ ### Why patch (not minor)
67
+
68
+ §13 META: patch = wording / clarification / identical behavior. No rule added or relaxed. Pure content reorganization + redundancy removal; agent behavior unchanged. §13.2 budget cost: 0.
69
+
70
+ ### Tests
71
+
72
+ - `tests/scripts/spec-structure.test.js` version pins bumped: still asserts core header + changelog top entry shape unchanged; A14 `§11-EXT` anchor still present in extended; A15 `[tag1, tag2]` literal still present (now inside `§11-EXT Memory operations § MEMORY.md tag syntax` subsection).
73
+
74
+ ### Sizing
75
+
76
+ Live numbers in `spec/CLAUDE-extended.md §Recent changes` Sizing line. Single post-edit `wc -c` per `feedback_spec_sizing_recursive_rewrite.md` option 1 (±20B drift envelope).
77
+
11
78
  ## [0.12.0] - 2026-05-11
12
79
 
13
80
  **Minor — feat: `/claudemd-analyze` spec ↔ implementation coherence audit.** Borrowed from github/spec-kit's `/analyze` pattern, scoped to claudemd's three highest-value drift surfaces. Read-only by default; `--strict` flag exits non-zero on CRITICAL/HIGH for pre-tag ship gate.
package/README.md CHANGED
@@ -58,10 +58,10 @@ Verify in one command (Linux): `node --version && jq --version && gh --version &
58
58
 
59
59
  | Layer | Contents |
60
60
  |---|---|
61
- | 14 shell hooks | `banned-vocab-check` · `pre-bash-safety-check` · `ship-baseline-check` · `residue-audit` · `memory-read-check` · `memory-prompt-hint` · `sandbox-disposal-check` · `session-start-check` · `session-summary` · `session-end-check` · `transcript-vocab-scan` · `transcript-structure-scan` · `version-sync` · `mem-audit` |
61
+ | 16 shell hooks | `banned-vocab-check` · `pre-bash-safety-check` · `ship-baseline-check` · `residue-audit` · `memory-read-check` · `memory-prompt-hint` · `memory-coverage-scan` · `sandbox-disposal-check` · `session-start-check` · `session-extended-read` · `session-summary` · `session-end-check` · `transcript-vocab-scan` · `transcript-structure-scan` · `version-sync` · `mem-audit` |
62
62
  | 10 slash commands | `/claudemd-status` · `/claudemd-update` · `/claudemd-audit` · `/claudemd-toggle` · `/claudemd-doctor` · `/claudemd-analyze` · `/claudemd-uninstall` · `/claudemd-rules` · `/claudemd-clean-residue` · `/claudemd-sparkline` |
63
63
  | 1 standalone CLI | `claudemd-cli lint` · `claudemd-cli audit` ([npm: `claudemd-cli`](https://www.npmjs.com/package/claudemd-cli)) |
64
- | Spec v6.11.13 | `~/.claude/CLAUDE.md` · `CLAUDE-extended.md` · `CLAUDE-changelog.md` (backup-before-overwrite) |
64
+ | Spec v6.11.14 | `~/.claude/CLAUDE.md` · `CLAUDE-extended.md` · `CLAUDE-changelog.md` (backup-before-overwrite) |
65
65
 
66
66
  Install moves any existing `~/.claude/CLAUDE*.md` to `~/.claude/backup-<ISO>/` (last 5 kept automatically). Uninstall offers `keep / restore / delete`; `delete` requires an extra confirmation.
67
67
 
@@ -179,6 +179,7 @@ export DISABLE_TRANSCRIPT_STRUCTURE_SCAN_HOOK=1 # v0.9.10+ — Stop §10 four-s
179
179
  export DISABLE_MEM_AUDIT_HOOK=1 # v0.9.4+ — Stop Why:-less citation advisory
180
180
  export DISABLE_SESSION_END_CHECK_HOOK=1 # v0.9.27+ — SessionEnd §11-session-exit mid-SPINE check
181
181
  export DISABLE_SESSION_EXTENDED_READ_HOOK=1 # v0.10.1+ — PreToolUse:Read §13.1-extended-read denominator signal
182
+ export DISABLE_MEMORY_COVERAGE_HOOK=1 # v0.13.0+ — Stop §11-mem-coverage advisory (opt-in via MEMORY_COVERAGE_SCAN=1)
182
183
  ```
183
184
 
184
185
  **2a. Per-sub-feature** (v0.4.0+). Sub-flags inside an enabled hook, named without the `_HOOK` suffix:
@@ -305,7 +306,7 @@ claudemd/
305
306
  ├── commands/ # 9 slash-command markdown files
306
307
  ├── bin/ # standalone CLI entrypoint (claudemd-lint.js → `npx claudemd-cli` on npmjs.org)
307
308
  ├── scripts/ # 10 Node.js management scripts + scripts/lib/ (single-source registry, lint, etc.)
308
- ├── spec/ # shipped v6.11.13 CLAUDE*.md trio + hard-rules.json manifest
309
+ ├── spec/ # shipped v6.11.14 CLAUDE*.md trio + hard-rules.json manifest
309
310
  ├── tests/ # hook shell tests + Node.js tests + integration + fixtures
310
311
  ├── docs/ # ADDING-NEW-HOOK.md + RULE-HITS-SCHEMA.md + superpowers/
311
312
  └── .github/workflows/ # ci.yml (ubuntu+macOS × node 20) + npm-publish.yml (tag-triggered)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudemd-cli",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Standalone CLI for §10-V banned-vocab + transcript scanning. Companion to the claudemd Claude Code plugin (github.com/sdsrss/claudemd) for use in git pre-commit hooks, GitHub Actions, and other agents.",
5
5
  "type": "module",
6
6
  "bin": {