Imprevista

Deploy Log

← Back to Deploy Log
|Sports Dashboard|DEPLOYED

Visibility fix: inject full inventory TL;DR into SessionStart context

Problem: The existing SessionStart hook printed only a source count summary. Sessions still grepped the codebase to find data sources instead of reading the inventory, because the inventory itself wasn't in their initial context —

Problem: The existing SessionStart hook printed only a source count summary. Sessions still grepped the codebase to find data sources instead of reading the inventory, because the inventory itself wasn't in their initial context — just a reference to it. Reference-to-a-file is easy to skip.

Fix: expand scripts/inventory-session-preamble.mjs to render the FULL TL;DR table (one row per source, 24 rows) plus per-source gotchas, hard rules, and the named anti-pattern that forced this change, all inline in the hook's additionalContext output. Every new session now sees the complete inventory map as system context from message 1. No tool call required for the top-level data-existence lookup.

The table columns: Source / Kind / Freshness / Storage / Last update. Storage shows Supabase tables with row counts (or '?' when DB isn't introspected) and filesystem dirs with file counts + sizes. ~7.6KB / 83 lines of additionalContext per session — acceptable one-time cost for the information density.

Also updated CLAUDE.md to point at the injected block as the first-action source of truth. The 5-step lookup workflow now starts with 'scan the injected block' instead of 'cat data/INVENTORY.md'. Named anti-pattern section added with the exact find+grep command that caused the 2026-04-15 failure.

Decision record saved as docs/specs/inventory-gate-hook.md — the PreToolUse hook spec we designed but deliberately did NOT ship. See §17 D1 for full reasoning. Summary: the hook has real friction/maintenance risks that we'd pay immediately, while the visibility fix has none. Start cheap, escalate only if visibility fails. Spec is ready to build as a v2 second layer if the failure mode recurs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files Changed

Commit:b48f0b6