feat(@projects/@magic-civilization): 🔎 session bootloader leaves a verifiable trace

The hook left no trace, so 'did the bootloader fire this session?' was unverifiable. Now every fire
(a) stamps the orientation header with 'bootloader fired <UTC>' (visible in-context) and (b) appends
a line to .local/last-session-orient (gitignored breadcrumb) — so verification is one command:
cat .local/last-session-orient. Answers the 'how do I know it bootloaded?' question deterministically.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-27 06:00:28 -04:00
parent f1fda3c18a
commit 6e3d9b2fd2

View file

@ -15,12 +15,17 @@
ROOT="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
MODE="${1:-hook}"
STAMP="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
python3 - "$ROOT" "$MODE" <<'PY' 2>/dev/null || exit 0
# Breadcrumb: every fire leaves a trace so "did the bootloader run this session?" is a one-line
# check — `cat .local/last-session-orient`. Gitignored (runtime artifact, never committed).
mkdir -p "$ROOT/.local" 2>/dev/null && printf '%s\t%s\n' "$STAMP" "$MODE" >> "$ROOT/.local/last-session-orient" 2>/dev/null
python3 - "$ROOT" "$MODE" "$STAMP" <<'PY' 2>/dev/null || exit 0
import json, sys, os, subprocess
from collections import Counter
root, mode = sys.argv[1], sys.argv[2]
root, mode, stamp = sys.argv[1], sys.argv[2], sys.argv[3]
def sh(*a):
try:
@ -70,7 +75,7 @@ lines.append(
"where-code-goes → `code-layering.md` · current work → `.project/ROADMAP.md` + `.project/objectives/`."
)
body = "## 🧭 Session orientation (live snapshot)\n\n" + "\n".join(lines) + \
body = f"## 🧭 Session orientation (live snapshot · bootloader fired {stamp})\n\n" + "\n".join(lines) + \
"\n\n_Snapshot at boot — grep/read to confirm before acting (verify, don't infer)._"
if mode == "--human":