#4769 "Rulings are counted where someone will read them": milestone 444
step 4 wrote system_usage_events and nothing read it.
- retrieval_telemetry gains a `system_usage` block: surfacings and opens by
source, distinct counts, and `by_system` naming the areas most shown.
There is deliberately no pull-through ratio, because rulings travel in full
in the line and opens are the exception.
- usage_for_systems (one GROUP BY) adds `usage` to the REST Systems list and
detail, and to MCP get_system. MCP list_systems is unchanged.
- The Systems UI shows a "rulings shown N×" chip.
- rulings_pre_tool, rulings_write_path and mcp_get_system are now declared
registry points; the registry guard covers their recorders.
- The Systems store merges a PATCH reply instead of replacing the row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A System's rulings (the Rulings section of its description) now reach the
work by path, not by similarity. Both PreToolUse arms resolve the files a
command or edit names to the Systems whose path_patterns cover them, and the
first touch in a session shows each area's rulings in one line; a repeat is
a one-line reference. A lookup, so no floor, no budget, no retrieval_logs row.
- services/system_rulings: parse_rulings, command_paths (reads and writes,
relative to the repo root from any cwd; flags, URLs, globs skipped),
rulings_for_paths
- /tool-rules takes root, cwd and seen_ruling_systems; /prior-art takes
seen_ruling_systems; both return ruling_system_ids
- hooks share <sid>.rulings.ids (cleared on compaction by the ledger naming
convention); the Bash hook sends the repo root and cwd
- system_usage_events (migration 0114): surfacings by source, pulls from
get_system; carried by backup (v20) through the system map
- writing-records: rulings also arrive when the area's files are touched
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>