Usage-Driven Hardening — Milestone Complete

v7.52.0 ✓ 9/9 issues closed

Milestone progress

9 / 9
PR #1378 shipped 6 (v7.51.0) PR THIS closes the remaining 3 (v7.52.0)

This PR (3 issues)

#1278 worktree-merge-verifier — warn on unmerged worktree removal PreToolUse/Bash
#1292 outputNotify() builder — 80-char line wrapping for advisories lib/output.ts
#1295 metrics-bridge — per-session ork-metrics-*.json PostToolUse/*

#1278 — worktree-merge-verifier in action

$ git worktree remove ../feat-billing-cleanup
[worktree-merge-verifier] Worktree at `../feat-billing-cleanup` is on branch `feat/billing-cleanup` with 3 unmerged commit(s) vs `main`. Removing the worktree keeps the branch, but if the branch is later deleted without a merge or push, those commits are unrecoverable. Consider `git push -u origin feat/billing-cleanup` or merging first. (Advisory — removal not blocked.)
# Squash-merged branches? detected via `git cherry` — no warning.
# Opt out: ORK_DISABLE_WORKTREE_VERIFIER=1

#1295 — metrics-bridge output

Written to .claude/state/ork-metrics-{session_id}.json. Flat JSON for easy jq. Atomic writes, 1 MB cap.

{ "session_id": "orchestkit-feat-hardening-apr17-1234", "started_at": "2026-04-17T20:15:00.123Z", "updated_at": "2026-04-17T22:48:12.981Z", "edits": 47, "test_runs": 12, "commits": 9, "bash_calls": 86, "agent_spawns": 4 }

Analytics pipeline: jq '.edits / (.test_runs|tonumber) as $ratio | select($ratio > 5)' surfaces sessions with edit-to-test ratios above 5 (candidates for the pre-commit-test-gate advisory).

#1292 — outputNotify() line wrapping

Before: each advisory hook invents its own format. After: uniform prefix + 80-char wrap + indent.

BEFORE — ad-hoc
[thrash-detector] You've edited the same file(s) repeatedly in the last 10 edit events: auth.py: 4 edits. This pattern often signals a test-edit or formatter-edit loop. Consider a different approach.
AFTER — outputNotify()
[thrash-detector] You've edited the same file(s) repeatedly
                  in the last 10 edit events: auth.py: 4
                  edits. This pattern often signals a
                  test-edit or formatter-edit loop. Consider
                  a different approach.

Migration of existing hooks is additive and deferred — keeps this PR focused. Hooks that stick with their current format still work; new hooks use the builder from day one.

Hook totals after merge

bundle exports 207 → 209
hooks.json entries 177 → 178
async hooks 74 → 75
global / agent / skill 111 / 45 / 22

Test deltas 3 files

split-bundles total 207 → 209
async-registry count 74 → 75
dispatcher-registry count 74 → 75
output-notify tests (new) +12 passing

Next up after this merges

With Usage-Driven Hardening closed, the next recommended target is Memory System Hardening — 6 issues, 1 high-priority (#1139 auto-persist high-confidence decisions). Dovetails with Opus 4.7's better filesystem-memory reads. Tight scope per issue, similar bundle pattern.