UNRELEASED DEVELOPMENT SNAPSHOT · READ-ONLY EXCERPT
hooks/shared/session-digest/run.sh
This is the cited technical source at local revision 275a354, inspected on 22 September 2026. It differs from the public release. This reference publishes only the cited sections, not an installable release or the development branch.
Line numbers refer to the complete recorded file. Uncited lines are omitted. Full-file SHA-256: 4cf8a65b86206a4c23da5c6072ae2a58cdcba39ddd6a2a7a1e1a2fc30452f22f.
1
#!/usr/bin/env bash2
# session-digest — Lintel SessionStart hook (v4.8, ADR-0002)3
# Injects a compact memory digest into a fresh Claude Code session.4
# Fail-open: any error or empty digest → exit 0 with no output (never blocks a session).6
set -uo pipefail8
LINTEL_HOME="${LINTEL_HOME:-$HOME/.lintel}"10
# Operator override11
[ -f "$LINTEL_HOME/.digest-disabled" ] && exit 012
[ -n "${NO_DIGEST:-}" ] && exit 014
# Repo root (for tasks/, docs/). Outside a repo → still emit profile/jobs.15
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"… omitted uncited lines …
21
[ -f "$1" ] || return 022
grep -E "^[[:space:]]*$2:" "$1" 2>/dev/null | head -1 \23
| sed -E "s/^[[:space:]]*$2:[[:space:]]*//; s/[[:space:]]*#.*$//" | tr -d '"' | tr -d "'" \24
| sed 's/[[:space:]]*$//'25
}27
# ── gather (each section optional) ───────────────────────────────────────────28
lines=""29
add() { lines="${lines}$1"$'\n'; }31
# Identity from profile (+ optional compliance.mode via pack-resolver)32
pack="$(_yaml "$PROFILE" active_pack)"; pack="${pack:-_default}"33
mode="$(_yaml "$PROFILE" default_mode)"; mode="${mode:-internal-tool}"34
role="$(_yaml "$PROFILE" role_active)"; role="${role:-none}"35
compliance=""36
# Source order (ADR-0008 security): own tree (plugin cache / installed copy) FIRST —37
# auto-registration means this hook runs in EVERY repo, including untrusted ones;38
# never execute repo-supplied code from a SessionStart hook.39
_resolver="$(dirname "${BASH_SOURCE[0]}")/../../../lib/pack-resolver.sh"40
[ -f "$_resolver" ] || _resolver="$LINTEL_HOME/lib/pack-resolver.sh"41
if [ -f "$_resolver" ]; then42
compliance="$( ( source "$_resolver" 2>/dev/null && resolve_pack_field compliance.mode 2>/dev/null ) | tr -d '[:space:]' )"43
fi44
[ -n "$compliance" ] && compliance=" · compliance: $compliance"45
add "Pack: ${pack} · mode: ${mode} · role: ${role}${compliance}"