Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Wrap?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/brkomir-wrap)
---
name: wrap
description: End-of-session checklist. Use at session end to verify nothing is left hanging and all decisions are persisted.
---
# Wrap — Session End
**The core, paid on every invocation and compaction carry.** Each step's full prior text moved, with the copy's edits, to `references/full-text-{preamble,0-1,2-6,7,8-12}.md` under `## Step N`, beside the older notes those point to. This core wins a disagreement; **READ IT** marks a step whose full-text section holds an instrument it cannot run without. **Appending:** DIRECTIVE + TELL + the number the action needs go here, in the owning step (a new section is the last resort); the why goes to the reference in the SAME commit; a correction REPLACES the sentence; incidents never go into a step. A budget test holds the core to a byte ceiling.
## When to Use
End of every session, or when the user says "let's wrap up" / "that's it for now". **Not typed by the owner this turn** (after a recovery, or on an earlier "as recommended") ⇒ the first line quotes the owner's authorizing words with their time (a standing cadence the owner ratified, `review-hub/SKILL.md` § Checkpoint cadence, or the `/autorun` work-order the owner armed, counts: quote that) and names the model this runs on; no such words ⇒ do not start it.
**Checkpoint mode (`/wrap --checkpoint`; `/wrap checkpoint` is an accepted alias):** same steps, same rigor, the session CONTINUES. The summary frames as **"Checkpoint complete — session still live"**, NEVER "Session closed" (Step 0 stamps `wrapping --checkpoint`; the completion stamp `wrapped --checkpoint` leaves the seat ACTIVE, never WRAPPED). **A checkpoint ends by checking the mail listener** (after Step 12 when it runs): `kill -0 "$(cat .claude/state/mail-listen-<sid8>.pid)"` fails, or the Monitor's expiry notice arrived with no re-arm since ⇒ re-arm (`python3 scripts/session-manifest.py mail-listen --poll 30`, `timeout_ms: 1800000`; a review hub adds `--rebroadcast-hours 48`) unless `.claude/state/session-standby-<sid8>` exists. A review hub also checks its poller: `pgrep -P $PPID -f '[h]ub-stale-request-poll'` empty ⇒ re-arm it as a second Monitor (`timeout_ms: 1800000`, this session's newest arm command, filters included; `/pre-compact` Step 1 shows the read), same standby exception. A live pid is a live watch: never arm a second one. A review hub (`[ -f .claude/state/review-hub-active-<sid8> ]`) ⇒ before the readout, at a checkpoint and at a plain `/wrap` alike, write the digest (`review-hub/SKILL.md` § The digest) and check the self-review trigger (§ THE HUB REVIEWS EVERYONE).
**Digest + ask is the DEFAULT (`references/modes-and-light-history.md` § Digest default): 1b-DEEP helpers read ~9 MB slices as digests and also list claims nothing backs. `--light` runs raw ~10 MB slices, `--full` raw ~2 MB.** ⛔ **Price a mode on WHOLE-RUN tokens, main agent included, never agent count; state your denominators.** ⚠️ **STATE THE TRADE in the output:** a digest keeps every word spoken and about half of tool-output text, so a fault deep inside a long output is untested; a `--light` pass saw at most ~8% of tool-result and ~17% of tool-call text. The bigger lever is scoping to the last checkpoint.
**Memefy (Step 10) runs on EVERY wrap in the source project, reversing an earlier opt-in; it makes a write-up suggestion this copy does not ship, so here Step 10 is skipped in silence.** `--memefy` is still accepted and changes nothing.
**Sonnet mode (`/wrap --sonnet`).** ONE change: the 1b-DEEP slice agents dispatch with `model: "sonnet"` (+ `effort: "medium"` on a digest pass, 2026-11-03) instead of the default `model: "opus"` (`/deep-pass` § MODEL ROUTING: one slice first, model read back, a non-Sonnet launch ends dispatching). **State it in the output, one line, with the served model per slice** — or *"--sonnet: no deep pass fired, no slice ran"* (`--light` never skips the deep pass). Without it slices run on Opus, whatever the session runs; the wrap's own steps run on the session's model: for a whole wrap on Sonnet, `/model sonnet` first (after any compaction; 2026-11-03).
## The modes COMPOSE, and all three are FLAGS — `/wrap --checkpoint --full --sonnet`
Disjoint levers (how the run ENDS — the completion stamp leaves ACTIVE, not WRAPPED; how the deep pass is SLICED; which MODEL runs the slices), so they stack. **Nothing parses any of this:** read intent over spelling in BOTH directions; `/wrap checkpoint --full` and `/wrap --checkpoint --full` are one request. `--estimate` = run `/deep-pass estimate`, STOP.
## Process
**⚠️ IRON LAW:** NO "complete" / "N/N steps ran" / "nothing hanging" claim without a COMPUTED artifact count for every ENUMERATION the summary asserts; a mandatory-fired step with no artifact is an INCOMPLETE wrap. The checkmark is a pasted command output + the Step-11 reconcile, never memory of intent. Red flags: *"the arc is in-context, the deep-pass is redundant"* (the trigger fired on a filesystem count — RUN it) · *"I persisted the high-value subset"* (a silent DROP unless each dropped block is a named dedupe with a `MEMORY:line`; state N emitted → M persisted) · *"10/10 steps ran"* (cite each step's ARTIFACT) · *"nothing hanging"* (run Step 11 BEFORE the summary) · *"Step N skips — I read the gate earlier"* (**a skip-gate reading goes stale inside the same wrap**: re-derive at the MOMENT of skipping, or just RUN it).
**Held review batch — send it NOW, before Step 0** (the coherent-batch rule's early-send case (c)): holding commits for a review ⇒ mail them all to the hub in ONE request, every sha with its refute claim; every step before the send is hub latency. Step 5e re-checks that it went.
**0. Session manifest write + prune (MANDATORY at /wrap start).** Run:
```bash
# GATE — MUST print a positive verdict; silence is NOT a pass
: "${CLAUDE_CODE_SESSION_ID:? GATE ABORT — session id unset, the gate cannot be evaluated}"
M=".claude/state/post-compact-pending-$CLAUDE_CODE_SESSION_ID"
C=".claude/state/post-compact-cleared-$CLAUDE_CODE_SESSION_ID"
if [ -f "$M" ]; then echo "🧠 MARKER PRESENT (sid=$CLAUDE_CODE_SESSION_ID): $(cat "$M")"
elif [ -f "$C" ]; then echo "⚠️ GATE UNINFORMATIVE (sid=$CLAUDE_CODE_SESSION_ID) — a recovery ran THIS session and cleared the marker at $(cat "$C"); this reading is not an independent check"
else echo "✅ GATE CLEAR (sid=$CLAUDE_CODE_SESSION_ID) — neither marker is present for THIS session (present tense: this cannot rule out a clear that left no breadcrumb)"; fi
python3 scripts/session-manifest.py write # snapshot final session state
python3 scripts/session-manifest.py prune # cleanup manifests stale >24h
python3 scripts/session-manifest.py mail-check --peek # NON-consuming surface of mid-session inbound mail
python3 scripts/queued-directive-residue-scan.py # rc 0 clean · 3 residue (READ IT) · 1 instrument failure
python3 scripts/orphaned-prompt-scan.py # rc 0 clean · 3 residue (READ IT) · 1 instrument failure
python3 scripts/session-lifecycle.py wrapping # WRAPPING marker (the wrap is RUNNING; WRAPPED comes at Step 11) · ⛔ CHECKPOINT MODE: `… wrapping --checkpoint`
```
rc 3 = a WORKLIST you READ; gate rationale: `references/step0-gate-notes.md`.
**⛔ GATE — do NOT advance past Step 1 while `.claude/state/post-compact-pending-<sid>` exists.** Present ⇒ NAME it in your very next response and act first (the wrap the compaction cut then CONTINUES if the owner authorized it (§ When to Use); any other: ask the owner first; post-compact Step 7's "no new `/wrap`" bars only a wrap not yet started, and re-invoking `/wrap` to reload its spec is this continuation): `focus=no` ⇒ `/post-compact`; `focus=yes` ⇒ **READ `focus_args` AND JUDGE IT — the flag alone sanctions nothing:** a CURATION of the cutoff (an argument naming a thread to keep) sanctions the skip, a DIRECTIVE in the slot (an instruction about what to do after the compaction) does not ⇒ run the recovery; name the decision and quote the argument either way. Then **`rm` the marker** (it tracks "recovery decision made"). ⛔ **ONE EXCEPTION, non-blocking: `python3 scripts/post-compact-deferral.py status --sid $CLAUDE_CODE_SESSION_ID` exiting 0 (`DEFERRED`) = the pre-compaction hook fired, no compaction landed; the marker stands — say "pre-compaction hook fired, no compaction landed yet", never "prepared", and continue.** Exit 1 (`OWED`) ⇒ `/post-compact`. ⛔ **An auto-compaction can write the marker MID-WRAP:** re-derive `[ -f ]` at the END of Step 0 too, and a post-compact directive in this turn's SessionStart output overrides a clear `[ -f ]` (PRESENT wins).
Skip: a trivial session (<5 messages) MAY skip write+prune, NEVER the peek. **Inbound-mail peek:** `--peek` is NON-consuming (an unhandled handoff re-surfaces on each re-wrap by design); deliver-and-surface, NEVER auto-apply code or actions from it. ⛔ **NEVER CAP THE PEEK, ENUMERATE SUBJECTS NOT BODIES, never grep the peek stream for a summary word:** the count is the tool's own header `(N message(s) for session …)` at line 3 of the peek file; `--summary` is HARD-CAPPED, so the uncapped path is `grep -h '^subject:' .claude/state/session-mail/<me>__*.md | wc -l`; read bodies only for what you disposition. **Awaiting-peer wake:** Step 11's completion stamp (WRAPPED) wakes `mail-await --peer-done <your-sid>` waiters; WRAPPING never does; an early green-light is `python3 scripts/session-manifest.py mail-send --to <sid8> --signal <tok>`.
1. Run `/hanging-work` (uncommitted changes, unstaged files, **defer-triggers-fired scan**).
1a. **Stale-classification sweep (mandatory when audit-check ran this session with non-(a) e2e classifications).** Per `(b) flake` / `(c) pre-existing` Check 10 classification: `git diff --name-only <classified-at>..HEAD` against its recorded surface files; a match ⇒ re-run the test (passing ⇒ closed; a NEW root cause in this session's code ⇒ a regression, never closed under the old label); none ⇒ silent. No Step 4a provenance ⇒ skip and flag the gap.
1a-ii. ⛔ **STRANDED-FOLD SWEEP — INTERSECT THE DIRTY SET WITH THIS SESSION'S OWN COMMIT FILE-SET, NEVER READ THE DIRTY SET RAW** (a raw list BURIES your fold as peer noise). READ IT: `scripts/session-labels.py mine` (the ONE reader: 8-hex trailer, session-URL trailer, a subject scope ENDING in the sid), never a commit range; an empty label or file list is an INSTRUMENT FAILURE, not an all-clear; `comm -12` with `git status --porcelain | LC_ALL=C cut -c4-` (cut, not awk — a skill invoked WITH arguments replaces awk's dollar-digit fields). **READ each survivor's diff for YOUR content** — never infer from the name, never clear it with `whose-edit` (blind to heredoc and `>` writes). Report the POSITIVE statement *nothing of mine is unstaged*; `/hanging-work`'s whole-tree read stays the outer net.
1b. **Compaction-boundary scan (mandatory when compact occurred this session).** Detection: a RECORD, never a phrase — `"isCompactSummary":true` or a `compact_boundary` system record in this session's transcript; fallback `grep -c '^## 20' .claude/state/compact-checkpoint-${CLAUDE_CODE_SESSION_ID%%-*}.md`, ⛔ NEVER the shared `compact-checkpoint.md`. Walk back to the prior **`/wrap` invocation** (its SKILL.md load marker / a `[wrap]` turn), never the prior `/meta learn`; none ⇒ the ENTIRE session, never "the most recent commit". Bias toward OVER-scanning + de-duping. Apply Step 2's signal patterns over the FULL pre+post window; **drive the arc enumeration from `git log --oneline <session-start>..HEAD`, NOT the compressed summary** — a captured DECISION can hide an uncaptured METHODOLOGY lesson; Steps 3 and 4 scan the same window. Skip: no such record AND this session's checkpoint file absent or empty.
1b-DEEP. **Mandatory PARALLEL-agent deep-pass for HUGE / multiday sessions — MOVED to its own skill.** ⛔ **Invoke `/deep-pass` and follow it.** **The trigger stays HERE — fire when this session compacted (a record, per 1b) AND either bound is crossed:**
```bash
TX="$HOME/.claude/projects/<project-key>/${CLAUDE_CODE_SESSION_ID}.jsonl"
TXT=/tmp/wrap-stripped-${CLAUDE_CODE_SESSION_ID}.jsonl # SESSION-SCOPED; STRIP FIRST, then measure; the scan target downstream
# ⛔ BLANK image payloads and request copies, NEVER delete the line (line numbers must hold); same rule as scripts/lib/transcript-strip.mjs
# and scripts/wrap-preflight.py — tests/transcript-strip-parity.test.ts (not in this copy) runs this block beside both; run it after any edit here.
python3 -c 'import re,sys
R=re.compile(r"^\{\"type\":\"(api-request[a-z-]*)\"")
for l in open(sys.argv[1],encoding="utf-8",errors="replace"):
m=R.match(l)
sys.stdout.write("{\"type\":\"%s\",\"stripped\":\"request copy\"}\n" % m.group(1) if m else re.sub(r"\"(data|base64)\":\"[^\"]{200,}\"","\"\\1\":\"<stripped>\"",l) if "\"type\":\"base64\"" in l else l)' "$TX" > "$TXT"
BYTES=$(wc -c < "$TXT" | tr -d ' ')
COMMITS=$(git log --oneline <session-start-sha>..HEAD | wc -l) # peer over-count only raises the fire-rate
# FIRE the parallel deep-pass if Step 1b counted a compaction record AND (BYTES > 3000000 OR COMMITS > 20)
```
Below both bounds (or no record) ⇒ the inline 1b scan suffices. Keep worked examples in the `wrap-dp-<i>` BRACKET form: `wrap-reconcile.mjs` greps the transcript this spec is loaded into.
1c. **Defer-sweep (defer-sweep 3-part test, mandatory when ≥5 defers added this session).** READ IT: enumerate `todo.txt` + the three trackers over `<session-start-sha>..HEAD` (GLOBS — rows land in `-SHARD-*.md`); <5 across the 4 files ⇒ skip silently; else the 3-part test per `references/conditional-step-bodies.md` § Step 1c.
2. ⛔ **Before EVERY `/meta` Skill call in this wrap, read the headroom:** `python3 -c 'import json,sys,time;d=json.load(open(sys.argv[1]));print(d["compact_threshold"]-d["context_tokens"] if time.time()-d["ts"]<120 else "STALE")' .claude/state/statusline-<sid8>.json`. Under 100,000 (above the largest measured rise after a `/meta` load, up to 93,303 in 4 calls) and no `## PRE-COMPACT` block in the plan since this wrap began or its last `/meta` call, whichever is later ⇒ `/pre-compact --keep-listening` first (bank only, its AUTO one-line readout; never ask the owner to `/compact`), say in one line a compaction will likely land mid-wrap, carry on at full depth. `STALE` or an error ⇒ no reading; carry on. Run `/meta learn` + the mandatory deferral sweep (every defer/post-launch/monitor mentioned this session is in todo.txt with a trigger). Skip only on a trivial session (<5 messages, no decisions). **<15-min exception:** `/meta learn` fired as an EXPLICIT Skill call within 15 min AND its output is grep-verified (L-number / commit / user_profile line, never self-attested) ⇒ skip with a one-line citation; older, pushed-back or incomplete ⇒ RE-FIRE. **The Watch-tier reconcile is NOT skippable:** a signature grep across the live `.claude/skills/meta/WATCH-TIER*.md` parts (archive excluded), per `process-learn.md` "Watch-tier auto-promote" (promote at `occurrences: 2`).
3. Run `/session-memory` to capture decisions. **<15-min exception applies** — cite the prior artifact if skipping.
3a. **Run `/decisions add`:** `DECISIONS.md` entries that shape product / pricing / vendor / strategy / public-launch / compliance, not implementation details; de-dupe against existing entries and Step 3's writes (dual-home only when business-critical); the write rule is `/decisions` Add-mode step 4 (an entry recording an owner ruling is written on disclosure; a session's own call is asked first); AFTER `/session-memory`; skip on a trivial session. Lands in Step 8's commit.
4. If expert system was modified: update `/meta` MEMORY.md + CHANGELOG.md (and the touched skill's own CHANGELOG.md).
4a. **Whether or not Step 4 held: persist every `### Memory Update` block this window's agents returned, enumerated from EVERY agent hand-back** (panels, translators, builders, consults; never deep-pass slices), never from a roster or a per-panel carry list. Instrument: `python3 scripts/wrap-memory-update-persist.py`; read every MISSING row, then `--apply`; PREFIX, NO-TITLE and NO-MEMORY by hand (NO-MEMORY: its home is meta, project-memory or a rule, or say why none); rc 2 = instrument failure, never "none"; commit before 6b. Source: `.claude/logs/subagent-dispatch.jsonl` rows whose `session` starts with your sid and `ts` ≥ the window start — the newest `/wrap` row for this sid in `.claude/logs/skill-invocations.jsonl` OLDER than this invocation's own (rows seconds apart are one wrap), else session start — de-duplicated on `agent_id`. ⚠️ Zero agents in the window while the sid has dispatch rows since session start ⇒ the floor is wrong: fall back to session start, say so. Read EVERY hand-back in each agent's full transcript (`~/.claude/projects/<project-key>/<session-uuid>/subagents/agent-<id>.jsonl` — a re-woken agent hands back more than once; the `/private/tmp` link dies at reboot). Never recall. Step 11 counts emitted vs persisted.
5. If audits were completed: verify tracker updated + report their Check 10 delta-e2e outcome (the test gate lives in `/audit-check`).
5b. **Unit-suite gate for non-audit sessions.** Session touched `src/**` or `tests/**` in SESSION-OWNED commits (1a-ii's partition — READ IT for the instrument; never a `<base>..HEAD` range or `git status`; the own set is a FLOOR, so an empty, failed or doubtful derivation RUNS the gate) AND ran **zero** `/audit-check` (instrument: `grep -c '"skill":"audit-check"' .claude/logs/skill-invocations.jsonl` for this session, NOT a `<command-name>` transcript grep — a Skill-tool call writes none) ⇒ `npm test` whole, read the pass/fail COUNTS. ⛔ The shared tree carries every seat's unsaved work: re-run each red FILE at a clean HEAD (READ IT) before naming or flagging it. At HEAD: yours ⇒ blocks Step 8, fix it; a peer's ⇒ Step 7 + flag that seat. Tree-only ⇒ re-run + Step 8's files: red ⇒ blocks Step 8; else someone's WIP. No counts ⇒ void. Skip when `/audit-check` ran, no `src`/`tests`, or trivial. Integration + e2e stay OUT.
5c. **Lint gate.** 5b's trigger (incl. run-on-doubt) ⇒ `npm run lint`, read the **ERROR** count off the run's own summary line (warnings are non-blocking); fix before Step 8. Runs regardless of `/audit-check`. Skip: no `src`/`tests`; trivial. `knip` stays warn-mode.
5d. **Translation review gate.** Session ADDED or CHANGED keys in `messages/*.json` (en or any locale) ⇒ a translation-review pass over EXACTLY the keys touched, before Step 8; READ `references/conditional-step-bodies.md` § Step 5d.
5e. ⛔ **SEND-SIDE: this step DECIDES and SENDS — judge whether the diff warrants a review, mail the hub, disclose it in the closing message; never ask.** ⛔ **HELD BATCH FIRST, outside this gate:** still holding ⇒ send it now in ONE request, every sha with its refute claim, whatever the conditions below say, and name them in the closing message; the gate covers only commits not yet judged. **Fire only when ALL three hold:** (a) a NEW behavioral mechanism shipped — a NEW `scripts/*.{py,mjs,sh}`, a `feat(` commit BY THIS SESSION (own commits, never the raw range), an edit to an ALWAYS-LOADED BEHAVIORAL SPEC (`.claude/rules/*.md`, `CLAUDE.md`, `AGENTS.md`, `.claude/orchestrator/*.md`, a wired `.claude/hooks/*.sh`), **or a diff that ADDS OR ALTERS A STEP A SKILL SPEC CALLS MANDATORY**; (b) one such commit is NOT COVERED by a `--code` this session — **coverage is per-COMMIT, never per-session**; (c) ZERO `/audit-check` ran (Check 13 covers that path). No hub live ⇒ the broadcast-then-self-run ladder (`behavioral-anti-patterns.md` #9's carve-out) — that self-run spend the owner still sees first. The `--code` commit message IS the findings record. **Skip when ANY:** only structural / copy / i18n / refactor / chore / non-always-loaded memory / docs changes (own gates: tsc, 5b, 5c, 5d, ux-copywriter); a `--code` covered EVERY qualifying commit; `/audit-check` ran; trivial. READ `references/step5e-arm-history.md`. ⛔ **THE NON-GIT ARM — `python3 scripts/non-git-writes.py` (not in this copy), whatever (a)–(c) and the skip list say** (they key on commits; a file written outside the repo is invisible to them): each EXACT path, and each POSSIBLE row whose command reads as a write, goes to the hub as a frozen dated copy plus its sha256, or gets a stated reason in the closing message; rc 2 = instrument failure, never "none".
6a. **Deploy/env drift reconcile (read-only).** `node scripts/deploy-env-drift.mjs --domain <your production domain>`; read its VERDICT TOKEN, never rc (rc=2 = failed); ⛔ empty stdout = instrument failed, not "no drift". `DEPLOY-ENV: PENDING-REDEPLOY` ⇒ name the vars in the summary; `DEPLOY-ENV: ALL-LIVE` ⇒ any row still waiting on a redeploy or env flip is STALE — re-read before quoting. Never blocks.
6. **Migration apply + notation reconcile.** Migrations created ⇒ remind about staging + prod. `node scripts/migration-notation-reconcile.mjs` (not in this copy; read-only, both DBs): backfill a 🟢 APPLIED-UNRECORDED via the `git commit --allow-empty` line it prints; surface UNAPPLIED; ⚪ SUPERSEDED ⇒ do NOT re-apply.
6b. **Memory-router auto-heal.** `node scripts/memory-tier-split.mjs --heal .claude/skills` (⛔ a PARENT of skill dirs — one skill dir reads `scanned 0`; a bare `--heal` writes tiers you do not own); read the terminal `HEAL VERDICT` line, never rc. Skip-silent ONLY on `CLEAN`; `ATTENTION` ⇒ its BROKEN / ERROR / refused / skipped-dirty rows are summary findings (BROKEN = unloadable layout). ⛔ A dropped digest row is usually a stale duplicate the re-index replaces — search the ENTRY'S IDENTITY (`git show <sha>^:<router>`), never the row's wording. ⛔ A shard ROLL is a delete+add pair — commit BOTH endpoints in the SAME turn, declared. `HEAL SKIPPED …` ⇒ ⛔ usually THIS WRAP'S OWN appends (Steps 2-4): re-run `--heal` after the Step 8 commit and after any later shard-appending commit (Step 9, Step 11), check it wrote only moved lines + refreshed index rows (`git diff -U0`), commit it; still skipped ⇒ a peer's uncommitted edit — report, never force. The summary carries the LAST run's verdict. **Then the RULES router, on each RE-run (never the first):** `git status --porcelain -- '.claude/skills/meta/RULES*.md'` must be empty (dirty ⇒ report, no apply); `node scripts/rules-tier-split.mjs --check`; skip ONLY on `disk matches the plan`; `DISK DIFFERS FROM PLAN` ⇒ `--apply`, re-`--check`, stage with the QUOTED pathspec `git add -- '.claude/skills/meta/RULES*.md'`, commit via `scripts/safe-commit.sh --staged` declaring exactly the paths `git diff --cached --name-only --no-renames` prints (both endpoints of a renamed shard, never the glob) with the derived `--add`/`--del` pair; a legitimate re-pack changes only the manifest block, the "shard N of M" headers and section placement — anything else is a finding; `⛔ CONSERVATION FAILED` or rc 1 with no token ⇒ no `--apply`, record a finding.
7. Show session summary (commits made, tests added, experts consulted, pending Check 10 failures).
7a. **Run `/me learn-session`** — user working-style preferences, de-duped against `user_profile.md` + `feedback_*.md`; auto-execute ≤30 LOC, propose larger; skip silently on zero signals or a trivial session. Lands in Step 8.
7b. **Tracker pointer-line refresh (mandatory when this session committed to `project_critical_flows.md` / `project_feature_audits.md` / `project_ops_register.md`).** `git log --name-only <session-start-sha>..HEAD` lists none ⇒ skip. Per touched tracker: `node scripts/tracker-list.mjs flows --counts` (`features` / `ops` likewise — all three) vs the pointer line in `~/.claude/projects/<project-key>/memory/MEMORY-INDEX.md` ("Critical flows tracker" / "Feature audits tracker" / "Ops register"); on a mismatch edit ONLY the "N flows: X COMPLETE / Y PENDING / Z RESEARCH_GAP / W ungated" substring, never the narrative tail (a stale "latest #N" ⇒ proposal). Skip when `MEMORY-INDEX.md` is staged by a peer.
7c. **Tracking-file sync sweep (mandatory when this session has ≥1 commit AND `BACKLOG.md` / `todo.txt` not staged by a parallel session).** Sub-checks in order (derive the set from the `**7c.` headings, never a count); READ IT for every command:
**7c.1 — BACKLOG.md archive sweep.** List P0-P2 entries in BOTH forms (`### N.` + `- **#N`; NOT a range-awk); grep session commits for `COMPLETE` / `PASS` / `shipped` / `/audit-check`; an entry's ID in a subject AND a marker ⇒ propose the archive move; auto-archive a ≤3-line move, batch-propose at ≥2 candidates or shared keywords (`references/step7-notes.md` § 7c.1 — set-equivalence caveat).
**7c.1b — Composite/rollup-entry candidate reconcile (mandatory whenever 7c runs).** For EACH rollup entry (`grep -nE "^### [0-9.]+\. " BACKLOG.md`; ⛔ DERIVE the set, never a list here) enumerate every candidate id MECHANICALLY from its CANDIDATE LIST LINES — ⛔ never every id in the body, never a range-awk (python range-parse of `### N–M.`); POSITIVE CONTROL: the same pipeline WITHOUT the list-line filter returns MORE, equal ⇒ read that entry by hand — and loop EVERY id of ALL types against its OWNING tracker's CURRENT Status (F# → feature_audits, Flow # → critical_flows, OPS # → ops_register), never this session's commits. Tracker ✅, candidate line pending ⇒ an in-place strike (`~~F#~~ ✅ … COMPLETE <date> (<commit>)`), never a whole-entry archive. Auto-fix ≤3-line edits; batch-propose at ≥3 flips or an ambiguous id.
**7c.1c — Session-touch reconcile: EVERY BACKLOG ITEM THIS SESSION TOUCHED GETS A DATED LINE. MANDATORY whenever 7c runs.** Three signals, unioned: (1) GROUND TRUTH — `scripts/session-labels.py partition --since '<session-start-date> 00:00' --path BACKLOG.md` (never a bare date; `PARTITION FAILED` is an instrument failure, never an empty partition), each hunk resolved against the entry headings in that commit's own blob (a batch heading is a RANGE); (2) this session's `/backlog` rows in `skill-invocations.jsonl`; (3) the plan's `## Backlog items` (DONE ⇒ archive, caps exempt, named in the readout; a MINE item not there is named; step7-notes § SIGNAL 3). ⛔ SIGNAL 1 SPANS THE FLEET — three buckets: MINE / ANOTHER 8-HEX SEAT / UNATTRIBUTED (another seat's URL, or absent — yours to consider, never discard). ⛔ A commit that NAMES an item is not one that CHANGES it: `git show --numstat --format='' <sha> | cut -f3 | grep -xF BACKLOG.md` empty ⇒ NO MATERIAL CHANGE, never an ADVANCE. The union is a FLOOR — add items from session knowledge, say so. ⛔ RESOLVE THE ID AGAINST ALL FOUR ENTRY FORMS (`### N.` · `- **#N ` · `- **P0 #N ` by grep; the BATCH `### N–M.` by range arithmetic, never a regex branch); run `#999` as a standing negative control every firing (both legs empty). An item resolving only in `## Archive` shipped already — record nothing unless this session RE-OPENED it. ONE `git log --no-walk` for all attribution. **Disposition per item, MANDATORY, a dated append in the entry's house form** (`✅`/`⚠️`/`❓` + what changed + date + sid): ADVANCED (what + sha) · REFUTED / RESCOPED (correct the text IN PLACE + a dated line) · BLOCKED (blocker + owner) · NO MATERIAL CHANGE (⛔ a first-class outcome, and it WRITES a `❓ NO MATERIAL CHANGE — <date>, session <sid>` line). Idempotence is RANGE-SCOPED to the entry (`grep -c "$SID8"` from the entry line to the next heading). A skip is NAMED in the output with its reason.
**7c.2 — `todo.txt` closed-entry sweep.** Per open `- [ ]` entry, grep session commits + touched files for its distinctive keywords AND completion markers; auto-mark `- [x]` when ≤2 match unambiguously, else propose.
**7c.3 — IDEAS.md capture.** Unacted "we should add X" signals from Steps 2/3 ⇒ `/ideas add <title>` rows; auto-add ≤2, propose more.
Auto-fix (cumulative): ≤5-line aggregate edit inline; larger ⇒ one proposal table. Skip: zero session commits, or `BACKLOG.md` / `IDEAS.md` / `todo.txt` staged by a peer ⇒ next `/wrap`.
7d. **Architecture-doc audit (mandatory when this session added ≥1 new meta MEMORY lesson OR ≥1 new infrastructure file in `.claude/{skills,agents,hooks,rules,commands,templates}/`, and `architecture.md` is not staged by a peer).** READ IT for the two detection greps (new `## L#` headers in meta MEMORY; `--diff-filter=A` files under those dirs) — either > 0 fires the FULL `/meta architecture-audit` (default mode, NEVER `--strict` at /wrap). **UNCONDITIONALLY, every wrap:** `node scripts/architecture-counts.mjs check` (apply `fix` for ≤5-LOC drifts inline) and `node scripts/architecture-counts.mjs conceptual-due` (surface `⚠️ CONCEPTUAL PASS DUE`; ⛔ `⛔ INSTRUMENT DARK` is a FINDING, never a pass; only a real Tier-2/3 pass bumps `last-reviewed`). ⛔ **Run `architecture-counts.mjs check` as the LAST thing before the Step-11 gate** — 7d counts skills · agents · hooks · rules · commands · templates · project-memory · maxL · RULES-rows, and Step 2's new L#, 7a's feedback file, 7f's registry and Step 9's commit all re-drift it (after `/meta learn` adds an L#, re-run `fix` and confirm `check` clean before Step 8). Tier 1 fixes land in Step 8; Tier 2/3 surface as proposals, never block. **STAGE what `fix` wrote:** `git add` EXACTLY the paths it prints under `Mutated files — now DIRTY…`, same turn (an unstaged sentinel write is an orphan); more than the count-sync in `git diff <path>` ⇒ hunk-isolate. Skip: zero new L# AND zero new infra files; `architecture.md` staged by a peer; the file absent.
7e. **Memory-distill cadence surface (fires when any `.claude/skills/*/MEMORY.md` ≥46,000 BYTES at close — BYTES, not lines).** `wc -c` each; 46,000 B warns, ~57.5 KB is a real one-Read cliff (actionable), 262,144 B hard-errors. Informational — the owner judges; `meta/MEMORY.md` is carved out. Siblings keyed the same: `check-memory-size.sh` (`SKILL_WARN_BYTES=46000` / `SKILL_CEILING_BYTES=57500`), `wrap-reconcile.mjs`'s 7e probe. Fires ⇒ READ `references/conditional-step-bodies.md` § Step 7e. Skip: nothing ≥46,000 B; a skill distilled this session and now under.
7f. **Meta-corrections registry sweep (mandatory when `python3 scripts/meta-corrections-scan.py --current 2>&1 | grep "^Total candidate events:"` returns N ≥ 1).** `/meta corrections --scan --current`, then `--add` per approved row. **Caveat — `scan=0` ≠ "no corrections":** the regex misses imperative reframes and provenance probes; if you KNOW a correction occurred (cited → owner probed → position shifted), `--add` it by hand; never widen the regex. Triage: READ `references/conditional-step-bodies.md` § Step 7f. Skip: N=0 (after the caveat); all events already registered; trivial.
7g. **Forward-list tracker-home verification (mandatory whenever the closing summary includes a "Pending / next session" / forward-pointer list).** Per item resolve a durable home (`todo.txt:N` / `BACKLOG.md` row / `project_*.md` line) by grep, never assumption; unresolved = FLOATING ⇒ create the entry FIRST (with a concrete trigger), then list it; build the list FROM the trackers. **Cross-session delivery:** an item assigned to ANOTHER session also gets a `mail-send --to <sid8|all>` at wrap (free) — a durable home is passive. *"N of M were already tracked, 1 had a gap now fixed"* is the SYMPTOM of an unverified emission — run 7g BEFORE emitting. Auto-fix: a ≤15-LOC tracker append inline (lands in Step 8); a new P-tier slot or >15 LOC ⇒ proposal. Skip: no forward list; trivial; a peer-staged tracker ⇒ create the entry, note it may defer to the NEXT wrap.
7h. **Defer-trigger reconcile sweep (when this session has ≥1 commit).** `python3 scripts/defer-trigger-scan.py` (bare is COMPLETE for commit-touches; `--run-exit-zero` when those predicates matter). ⛔ **READ LINE 1 FIRST:** `⛔ N INSTRUMENT FAILURE(S) — THIS RUN IS VOID` voids every bucket — fix and re-run, never triage (`wrap-reconcile.mjs` reads this line only for the scan it runs ITSELF). RECONCILE (`done-when` just became TRUE, box still `[ ]`): verify the deliverable yourself, flip `[ ]`→`[x]` with a one-line evidence note; an item bundling a SEPARATE deferral stays surfaced, never auto-flipped. DOABLE-NOW ⇒ a one-line COUNT only ("N defers now doable — `/triggers` for the list"); STALE (`meta:` predicate at a missing path) ⇒ open each row — one naming the printed detail as its fire is a FIRE (surface, never re-point), else fix inline (≤5 LOC); LATCHED ⇒ a one-line count ("re-key, not work"), disposition = predicate RE-KEY. ⛔ **At a RETIREMENT wrap the DOABLE-NOW count is not an owner item** — handoff broadcast or `/triggers`, never "Needs you". Edits land in Step 8 (`todo.txt`, explicit pathspec). Skip: zero commits; `todo.txt` staged by a peer; trivial. Complements `/hanging-work` Check 12; twin `/triggers`; start-side `/orient` Step 8.
8. **Commit session-touched residual files** (Commit procedure below). **Commit-only — never push `main` at wrap**; a `dev` push is Step 12's OPTIONAL last act. Scope: MINE + SHARED MEMORY files not already committed by `/audit-check`, incl. 7a's `user_profile.md` / `feedback_*.md`, 7d's Tier 1 fixes, 7f's registry entries. A plan the sync rolled has `-partN.md` files beside it (`git status --short -- 'plans/session-<sid8>-*'`): commit each in the same commit as the plan, never the plan alone. Zero residuals ⇒ silent; UNKNOWN files ⇒ proposal. ⛔ **AFTER THE RESIDUAL COMMIT, RUN THE LESSON-NUMBER CHECK AGAINST WHAT WAS COMMITTED, NOT THE WORKTREE** — READ IT: concatenate HEAD's meta `MEMORY*` files + `RETIRED.md` into `scripts/check-lesson-numbers.mjs` (a shard roll whose old-shard DELETION never reached the commit passes the bare check and the pre-push gate alike). Read the `✗` line, not only rc: `DUPLICATE L#` / `GAP-REUSE` ⇒ fix inside this wrap; `NOT read` / `not found` ⇒ the scan did not run — fix and re-run.
8a. **Late-commit review re-derivation — MANDATORY.** 5e fires once; later commits (7f's entry, Step 8, the plan write, a lesson commit) cannot be in its request. ⛔ **NOT a second `--code` pass** — one command and a classification, never a reviewer seat. **Derive, PARTITION, classify, then SEND:** boundary = the 5e request's mail timestamp or the sha it named; `git log --format='%H %h %s' <5e-request-sha>..HEAD`; `python3 scripts/session-labels.py partition --range <5e-request-sha>..HEAD` (MINE / `<sid8>` / URL-OTHER / NO-TRAILER; a failure is an instrument failure, not an empty partition); classify on what YOURS touch (`git show --numstat`), never the subject line — ⛔ the raw range is every seat's commits. **Say what the number counts:** *"N since the request; M carry this seat's trailer; R did not partition"* — the trailer records who RAN the commit, not whose WORK is in it. By what it touches: a WIRED hook / guard predicate / gate / `settings.json` ⇒ **name it to the owner**; an ALWAYS-LOADED file ⇒ **name it**; `src/`, a migration, a test ⇒ **name it**; `todo.txt` rows, `plans/` prose, a router re-index, `DECISIONS.md` ⇒ skip, said in one clause. ⛔ **JUDGE IT YOURSELF, SEND IT, SAY SO — BOTH BRANCHES DISCLOSE** (a not-sent commit is still named, with why); no hub live ⇒ `behavioral-anti-patterns.md` #9's carve-out and say which rung. Empty is the common case: "nothing since the request but records". ⚠️ **RE-RUN IT IF A LATER STEP COMMITS** (Step 9, any recovery). ⚠️ 5e did not fire (a late held-batch send is not a boundary) ⇒ skip EXPLICITLY, never invent a base.
9. **Wrap-execution lesson sweep (conditional).** After Step 8: did anything non-mechanical happen DURING this wrap (a clobber at Step 8, a defer promoted at 1c, a mid-wrap compaction + recovery, a new structural gap, a tool failing, owner friction)? No ⇒ skip silently. Yes ⇒ a TARGETED `/meta learn` over the wrap-execution window ONLY (D+I+S scoring; a RULES.md row if it qualifies; propose/apply the spec fix) in a SEPARATE small path-scoped commit. Never manufacture a lesson.
10. *(Not in this copy: the source project runs this step on every wrap, after a period as an opt-in under `/wrap --memefy`, to suggest an optional write-up command the copy does not ship. Here the step is skipped entirely and nothing is said about it (the Self-attested remainder slot does not list it); `wrap-reconcile.mjs` owes no memefy row.)*
11. **Wrap-verification — the terminal COMPLETION GATE.** AFTER Steps 0-10, immediately BEFORE the summary may say "complete". **`node scripts/wrap-reconcile.mjs`** (warn-mode): (a) **MEMORY-UPDATE DELTA** — N emitted vs M persisted; a positive delta ⇒ enumerate the emitting agents + persist each un-consumed block, or cite a per-block dedupe with a `MEMORY:line` (a recovered block: READ `references/conditional-step-bodies.md` § Step 11); (b) **DEEP-PASS check** — trigger fired, none dispatched ⇒ RUN it. **Completion stamp — after this gate, before the summary, ONLY on "wrap complete: yes":** `python3 scripts/session-lifecycle.py wrapped` (checkpoint: `wrapped --checkpoint` → ACTIVE) clears WRAPPING; plain stamps WRAPPED (the peer wake). A "no" stamps nothing: the seat stays WRAPPING, the summary says so. **Step-artifact probes:** the tool prints which steps it probes (0 `session-wrapping-<sid>`, 7d → FINDINGS when absent; 7e, 7h → PRINTED) and reports BLIND when one cannot run. Every OTHER step is SELF-ATTESTED: cite its artifact, or add a probe (the `findings[]`/`notes[]`/`blind[]` seams) in the commit that makes it mandatory. **Git-story closure:** `node scripts/git-story-closure.mjs` → `clean` / `unpushed(N)` (sanctioned default) / `dirty_mine(N)` / `dirty_unattributed(N)` / `migration_unrecorded(NNNN)` / `migration_probe_unread` (UNMEASURED, not clean — say so) / `mixed[…]` / `unknown` + `ready`; the summary names the state and an intent per non-clean component (`dirty_peer`, `no_upstream` are listed states, uncovered here); surfaces only. The tool exits 0 always — it informs, you act (escape for a later block-mode: `SKIP_WRAP_COMPLETENESS=1`). Skip: trivial.
12. **Optional `dev` push — the LAST act, after the Session Summary is out.** A session pushes `dev` ONLY here, when the owner asks, or inside the owner's `/promote`; the wrap never waits on it. **Default: skip unless needed** (under `--checkpoint` skip unless the owner asked). Push only when BOTH: this seat's commits are not on `origin/dev` (`git fetch origin && git rev-list --count origin/dev..dev`; `git merge-base --is-ancestor <sha> origin/dev` per own sha — a peer's push often carries them) AND staging needs them soon. Then `/push` in the background (D0 and the one-push lock apply); a refusal names its reason — lock or in-flight push ⇒ wait for it to land, re-check `merge-base --is-ancestor`, push again only if your shas are missing (a running push carries only what was on `dev` when it started); an open promote PR, a hold or a diverged `dev` ⇒ skip and say which. Report the landed line in one sentence when it arrives.
## Commit procedure (shared with /audit-check Post-Gate Action)
1. **Enumerate:** `git status --porcelain` (never `-uall`).
2. **Classify:** MINE (touched via Edit/Write/Bash this session — from conversation context) and SHARED MEMORY (`.claude/skills/*/MEMORY.md`, append-only) ⇒ include; PARALLEL (a concurrent session's) ⇒ exclude; UNKNOWN ⇒ ask the user before committing.
3. **Explicit file list:** `git add path/one path/two …`, MINE + SHARED MEMORY only; **never** `git add -A` / `.` / `-u` with parallel sessions active. **Pre-stage check:** `git diff --staged --name-only` first — foreign staged files ⇒ **use `scripts/safe-commit.sh`** (its gates run in the SAME PROCESS as the commit). If it REFUSES on a peer's foreign staged path: do not unstage, do not commit bare, **do not HOLD** (the worst option): gate both numstat columns by hand, commit, and say in the body that you did (`.claude/rules/bash-environment.md`).
4. **Message:** `/audit-check` post-PASS `{scope}({feature-id}): {COMPLETE summary}`; `/wrap` hygiene `{session-subject}: {one-line summary}`; never a sensitive file.
5. **Hook failure:** fix, re-stage the same files, NEW commit — never `--amend`; `--no-verify` only on the user's explicit request.
6. **Skip:** empty list ⇒ silent, no empty commits.
7. **Proactive visibility layer (HIGH overlap ONLY):** this wrap committed a shared meta/memory file a peer also committed or staged DURING the wrap, or ≥2 peer commits landed on `main` since your session-start SHA ⇒ READ `references/conditional-step-bodies.md` § Commit procedure 7 and fire the announce.
## Output
Per the Iron Law + Step 11: every `{N}` below is a PASTED command output; the `Wrap-verification` line is the computed completion proof — a wrap that cannot emit it is not complete. **`Bottom line:` FIRST, REQUIRED:** plain words only (no coined name as its subject, no unit-bearing number, closure token, sha, path or rule id — words the OWNER uses); never manufacture a claim to fill it — if closing costs nothing, say so; a sent review whose verdict has not arrived IS a cost (the closability row, `.claude/orchestrator/conventions.md`).
**Layout:** each top-level slot is a paragraph opening on its bold label, never a `- ` item (the terminal draws a list tight), a blank line between slots; sub-items 1 level deep.
```
Session Summary:
**Bottom line:** {ONE-TO-TWO plain sentences: what happened and what (if anything) needs the owner; its last clause answers the owner in the owner's words — "You can close this session now." or "Don't close yet: <the one thing still owed>." — and any later message in the same turn-chain repeats that clause. Digits.}
**Landed:** {WHAT shipped, prose + subject lines. ⛔ NO PER-SESSION COMMIT COUNT; the FLEET unpushed count below stays}
**Tests:** {N} new ({total} total)
**Feature audits this session:** {list with Check 10 e2e result}
**Expert system:** {changes if any}
**Reviews sent:** {the sha(s) mailed to the hub at 5e/8a and what each was — OR, in one clause, what you classified and judged not to warrant one, and whom you broadcast to if no hub was live. SELF-ATTESTED, never tool-computed}
**Pending:** {anything undone, incl. Check 10 failures} — ⛔ HERE AND IN THE NEXT SLOT A STEP THE OWNER PERFORMS OUTSIDE THIS TERMINAL CARRIES ITS CLICK PATH: where to go, which control, what done looks like
**Next session:** {starting point} — ⛔ IN CHECKPOINT MODE THIS SLOT IS `Next — me:` AND NAMES WORK YOU RESUME IMMEDIATELY; the next tool call is that action
**Wrap-verification (COMPUTED by wrap-reconcile.mjs):** {emitted}→{persisted} memory-blocks · deep-pass {fired?/ran?} · lifecycle {WRAPPED · ACTIVE (checkpoint) · WRAPPING (stamp withheld)} · served model(s) {SELF-ATTESTED from `toolUseResult.resolvedModel`} · under `--sonnet`, if the stop fired: {HALTED at slice N on <model> · `line region <first>-<last> unscanned` · the question put to the owner}
**Git-story closure (COMPUTED by git-story-closure.mjs):** {closure enum — pasted} · ready={true/false} (intent per non-clean component)
**Self-attested remainder (NOT tool-covered — cite the artifact per skipped/asserted step):** {per-step artifacts or skip-justifications}
{the close clause again, alone on the last line: "You can close this session now." / "Don't close yet: <the one thing still owed>." / under `--checkpoint` "Session continues: <the next action>."}
```
*(Output-line honesty: the tool computes exactly 2 enumeration probes; a typed "mandatory-step deltas: none" beside computed counts launders self-attestation. A NEW mandatory step in this spec ⇒ the same commit adds a wrap-reconcile probe OR adds it to the tool's printed UNVERIFIED list — never silently.)*
## Test gating in /wrap (revised 2026-06-09)
Heavy gating (integration + e2e + tsc) is owned by `/audit-check` (Checks 9, 10) + the pre-push hook (`references/full-text-8-12.md` § Test gating) + CI (on a PR into main or a push to main). `/wrap` stays out, with ONE exception: Step 1's `/hanging-work` runs the changed-files e2e itself (its Step 4). **The one thing `/wrap` runs is the unit suite, conditionally** (Step 5b).