/aios:close-sessionfrom aios
End-of-session capture that auto-detects vault vs project context, appends to daily notes or writes a local session report for consolidation by /close-day.
Ships in aios. Installing the plugin adds it to Claude Code.
You are running a session capture. This command auto-detects where you're running and behaves accordingly:
~/aios or Obsidian MCP is available → append a session block to today's daily note/close-day to pick upBefore executing: Read
USER.md→## Command personalizations→### /close-sessionfor any user overrides.
When finishing a focused work session — agent session, dev session, ad-hoc spawn. Lightweight capture that bridges back to the daily note + project notes. Feeds the next /close-day. Run it whenever the work has a clear stopping point.
--auto mode (used by the Glass "Close all" button)When invoked as /close-session --auto (the Glass Close-all broadcast fires this in each selected session), run with no prompts so the session self-closes cleanly and returns to idle (which is what lets the button's optional "kill after" fire safely — only after the capture is done):
{HH:MM} | {topic}) — do NOT ask to confirm it.aios-note-append; Mode B writes its per-session report; the commit is aios-commit.--auto, DEFER all observed-context routing to /close-day (single-writer) — do NOT run the direct Tier A writes in steps 6–7. A broadcast can close several vault sessions at once, and the daily-note lock does not protect the observed files (session-insights.md, patterns.md, preferences.md, business.md, antifragile.md) — those steps read-scan-edit-write, so two parallel closes clobber each other (last-writer-wins). Instead, capture each observation as a candidate in the block — Tier A → **Observed (Tier A candidates):**, Tier B → **Observed (Tier B candidates):** — commit only the block, and let /close-day route them as the sole writer. Nothing is lost: routing moves from per-session to the consolidator, exactly as Mode B workers already defer via their reports. This is why parallel closing can't "make a mess" — under a broadcast there is exactly one observed-context writer (close-day), so no clobber, no trip, and no staleness (close-day always routes). (Interactive single /close-session still writes Tier A inline — no concurrency there → no race → immediate value.)--auto exists to honor.--auto is the mode that needs it. A machine-fired close can arrive repeatedly — a retrying bus, a double-clicked button, a broadcast that overlaps its own previous run. Run the gate; if this session already stamped a block and the vault HEAD has not moved, skip the append and finish rather than adding a near-identical block. Under --auto that skip is a normal, successful outcome — report it and go idle, do not treat it as an error. (Measured 2026-08-12: one bus request delivered --auto four times in twelve minutes to two different sessions.)The rest of this command is the interactive (manual /close-session) flow. Under --auto, skip each input-waiting step, run each capture/route/commit step.
Run pwd to check the current working directory.
~/aios (or any path containing /obsidian) OR the mcp__obsidian__read_note tool is available → Mode AAnnounce the detected mode: "Detected: vault session — writing to daily note" or "Detected: project terminal ({project name}) — writing session report"
Goal: Append a structured session block to today's daily note so /close-day has structured input. Takes under 60 seconds.
Truth-surface reconcile (ship-time truth-flip — see CLAUDE.md § Discipline). For everything this session shipped, verify its truth surface already flipped: keyed items (grep the key's definition — a live type: roadmap file, searching the working vault and never 00 - notes/logs/, since snapshots carry the same frontmatter; CLAUDE.md § Ship-time truth-flip, rule 1) show ✅ + their declared ledger: row appended; unkeyed items show done at their project note. Any miss → flip it now and note the miss in the session block. Close-session is the backstop, never the primary.
Read today's daily note from 01 - calendar/{YYYY-MM}/{today YYYY-MM-DD}.md
Read 00 - notes/context/observed/session-insights.md — check current content for snapshotting
Infer a session label from the conversation: current time (HH:MM) + a 2–4 word topic. Present it to the user for confirmation: "Session label: {HH:MM} | {Topic} — correct, or adjust?"
Wait for user response on label
4.5. Idempotency gate — has THIS session already closed with no work since? Mode B has had an idempotency rule from the start ("If the same session runs /close-session twice on one date, overwrite its own file"); Mode A had none, and its per-day multi-block design is exactly what makes the gap invisible — the note cannot tell a second session (legitimate, wants its own block) from the same session firing twice (a duplicate), because ## Session — {HH:MM} carries no session identity.
That is not hypothetical. On 2026-08-12 a misbehaving command-bus request delivered /aios:close-session --auto to one session four times in twelve minutes. Four blocks would have meant four copies of the same wins in the daily note and four copies of the same Tier A/Tier B candidates for /close-day to route into observed context — the consolidator amplifying noise it was built to reduce. A consumer must not be corruptible by a misbehaving producer, so the gate lives here rather than only in whatever surface glitched.
NOTE="$HOME/aios/vault/01 - calendar/{YYYY-MM}/{YYYY-MM-DD}.md"
SID="${CLAUDE_CODE_SESSION_ID:-unknown}"
# Did this session already stamp a block on this note?
PRIOR=$(grep -o "<!-- close-session: ${SID} @ [0-9a-f]* -->" "$NOTE" 2>/dev/null | tail -1)
STAMPED=$(printf '%s' "$PRIOR" | sed -E 's/.* @ ([0-9a-f]*) -->/\1/')
# Did THIS SESSION do non-close work since that stamp?
# · own commits = carry `AIOS-Session: $SID` (stamped by aios-commit)
# · own close = subject starts "session: " — bookkeeping, never "work"
if [ -n "$STAMPED" ]; then
RANGE=$(git -C "$HOME/aios" log --format='%H' "${STAMPED}..HEAD" 2>/dev/null)
# ⚠️ `printf | while read`, NEVER `for c in $RANGE` — the session shell is zsh, which does
# NOT word-split an unquoted expansion, so the loop body would receive the ENTIRE newline-
# separated list as ONE value, every `git log -1` would fail, MINE would stay 0, and the gate
# would answer SKIP — losing a legitimate second close. Same bug class as /aios:update Step 2.
# Counting via command substitution (not a bare `while` pipeline) because a piped `while` runs
# in a SUBSHELL, so `MINE=$((MINE+1))` inside one is discarded on exit.
ANYTAG=$(printf '%s\n' "$RANGE" | while IFS= read -r c; do
[ -n "$c" ] || continue
git -C "$HOME/aios" log -1 --format='%B' "$c" 2>/dev/null | grep -q '^AIOS-Session: ' && echo x
done | grep -c .)
MINE=$(printf '%s\n' "$RANGE" | while IFS= read -r c; do
[ -n "$c" ] || continue
B=$(git -C "$HOME/aios" log -1 --format='%B' "$c" 2>/dev/null)
printf '%s' "$B" | grep -q "^AIOS-Session: ${SID}$" || continue # not mine → ignore
printf '%s' "$B" | head -1 | grep -qE '^session: ' && continue # my own close → not work
echo x
done | grep -c .)
# `-ge 1`, NOT `-eq 1`: ANYTAG is a COUNT of tagged commits, not a boolean. The degrade
# branch below is for "provenance is unknowable", which is ANYTAG == 0 and nothing else.
# With `-eq 1` any range holding TWO OR MORE tagged commits — the normal case in an
# active vault — fell through to the coarse rule and counted a PEER session's commit as
# work of mine, which is the exact bug the trailer was introduced to kill. Measured
# 2026-09-05: ANYTAG=4, MINE=0 (a true duplicate) and the fallback answered WORK=1 → append.
# `unknown` is not a session identity. aios-commit omits the trailer when
# CLAUDE_CODE_SESSION_ID is empty, so a session running without one can never
# match a trailer whose value is `unknown`: on the precise path MINE is 0 by construction,
# and once such a session had stamped once, any tagged peer commit made every
# later close of it SKIP — the one outcome this gate must never produce. Its
# provenance is unknowable, so it takes the coarse rule, exactly like a range
# with no trailers at all. `tests/close-session-idempotency.test.sh` (17-18).
if [ "$SID" != unknown ] && [ "$ANYTAG" -ge 1 ]; then
WORK=$MINE # precise path
else
# No commit in range carries a trailer → this vault predates the stamping,
# so provenance is unknowable. Degrade to the old coarse rule, which errs
# toward APPEND. Never toward skipping: a duplicate block is recoverable,
# a missing one is lost work.
WORK=$(printf '%s\n' "$RANGE" | while IFS= read -r c; do [ -n "$c" ] && git -C "$HOME/aios" log -1 --format=%s "$c"; done | grep -cvE '^session: ')
fi
fi
# Did that previous close FINISH? The block lands at step 5 and is committed there, but
# the observed-context routing (steps 6-10) comes after it. A close interrupted in between
# leaves a stamp and no routing, and a re-run with no new commits would read it as a
# duplicate and skip the very steps that never ran. So a close records its end: step 10b
# appends a done marker naming the same vault hash as its stamp (under --auto the block
# carries it). OWED lists every stamp of this session on this note with no marker — not only
# the latest: a later close that finished must not hide an earlier one that did not.
OWED=$(grep -o "<!-- close-session: ${SID} @ [0-9a-f]* -->" "$NOTE" 2>/dev/null \
| sed -E 's/.* @ ([0-9a-f]*) -->/\1/' | while IFS= read -r h; do
[ -n "$h" ] || continue
grep -qF "<!-- close-session-done: ${SID} @ ${h} -->" "$NOTE" 2>/dev/null || echo "$h"
done)
if [ -z "$STAMPED" ]; then
CLOSE=first
elif [ "$WORK" -ge 1 ]; then
CLOSE=second
elif [ -z "$OWED" ]; then
CLOSE=duplicate
else
CLOSE=resume
fi
echo "close-session gate: $CLOSE"
echo "close-session owed: $(printf '%s' "$OWED" | tr '\n' ' ')"
Why this needed provenance rather than a better heuristic. The first version counted every commit whose subject was not
session:-prefixed — which correctly ignored this command's bookkeeping but counted other sessions' work as mine. In a vault written by several sessions at once that is not an edge case: measured 2026-08-13, one session had 10 non-close commits since its stamp and only 1 was its own. A spurious re-fire would then append a duplicate on the strength of a peer's commit. Git cannot tell sessions apart on its own — same author, same committer — soaios-commitnow stamps anAIOS-Session:trailer and this reads it. Record provenance; do not infer it from a naming convention.
duplicate — a prior stamp, $WORK is 0, and that close finished. Nothing but this command's own commits have landed. Commits are not the only work, though: $WORK cannot see what this session did and did not commit — a decision, a learning, a finished task, a file edited but left for another commit. So before skipping, read your own conversation since that close. If it holds any such work, treat this as second. Only when it holds nothing but close requests is this a duplicate: skip the append, skip every step below, and say so plainly ("already closed at {HH:MM}; no work since — not duplicating"). Under --auto this is the normal outcome of a re-fire and must not read as an error. Do not use uncommitted vault changes as the signal: in a vault written by several sessions they are usually someone else's, and counting them brings back the duplicates this gate exists to stop.resume — a prior stamp, $WORK is 0, and no done marker: the previous close wrote its block and stopped before the end. Run the same conversation check first: if this session did work since that close, treat this as second. A new block records that work, and steps 6-10 then route everything this session holds, including the unfinished close's share. Otherwise, do not append a second block (it is already there, committed). Skip 4.7 and 5 and continue from step 6 with what this session holds; step 10b then records the end. Under --auto, write nothing and no marker. What a resume owes is the inline routing of steps 6-10, which --auto never does. A marker written without that routing would tell the next close it ran. Report "the close at {HH:MM} is unfinished — its routing waits for an interactive /close-session" and finish. Every --auto re-fire lands here again and writes nothing, until an interactive close resumes it.second — a prior stamp and $WORK ≥ 1 → real work landed since. This is a legitimate second close: proceed and append a new block. A long session that closes at noon, works on, and closes again at 18:00 is a case the gate must never block.first — no prior stamp → first close today for this session. Proceed.Owed closes. close-session owed: lists every earlier close of this session on this note that never recorded its end. A close that appends a block takes over that debt, so the next close does not mistake it for paid. An interactive close's steps 6-10 already route everything the session holds, and 10b writes one done marker per owed hash besides its own. An --auto close puts the whole session's observations in its Tier A candidates, not only those since the last close (/close-day routes them), and its block carries one done marker per owed hash besides its own. While anything is owed, the gate never answers duplicate.
Why non-close commits and not the raw HEAD. The first version of this gate compared the stamped hash directly against the current
HEAD, and it was inert — it could never once fire. Appending a block commits it (aios-note-append→aios-commit), soHEADadvances on every close, while the stamp can only record the value from before that commit.stamped == HEADwas therefore unsatisfiable by construction, the "HEAD moved → real work" branch always won, and the gate always appended. Measured on a live note: all four stamps differed fromHEAD. Excludingsession:-prefixed commits is what makes the two sides comparable — it asks "did anything happen other than me writing this block", which is the actual question. (SIDfalls back tounknownrather than failing: a session with no id still gets a block, degrading to always-append, because a missing block is worse than a duplicated one.)The lesson generalises past this gate: a comparison is only a check if both outcomes are reachable. When you write one, prove the equal branch can happen —
tests/close-session-idempotency.test.shasserts exactly that, and it fails against the original logic.
Stamp the block you are about to write — immediately under its ## Session — heading, so the next invocation can find it:
## Session — {HH:MM} | {Topic}
<!-- close-session: {SID} @ {VHEAD} -->
Under --auto, add the done marker on the next line, <!-- close-session-done: {SID} @ {VHEAD} -->, with the same {VHEAD}: under --auto the block is the whole close. Add one more such line for each hash in close-session owed: (see Owed closes above).
An HTML comment renders invisibly in Obsidian and in every markdown preview, so the note stays clean for the human while carrying the identity the machine needs.
4.7. Ask before you write — under --auto nobody is there to answer, so skip the question in a and the offer in b2 — but still run b's scan: if agents shipped anything, list each item in **Comprehension:** as un-grasped with an **Open threads:** thread tagged task. Writing "All operator-authored" there without the scan would erase real comprehension debt. The block written in step 5 is committed by the helper the moment it lands, and the helper only appends — it cannot amend a block afterwards. So every answer the block needs from the operator is gathered now, before step 5, and steps 8 and 9 only verify it landed — they never ask again, write a second block, or reopen the first.
a. Most useful. If the session was substantive (>30 min, meaningful work), ask "What was most useful for you in this session?" and keep the verbatim answer for the block's **Most useful:** field.
b. Comprehension (CLAUDE.md § VI → "Comprehension debt"). Scan this session for changes the operator did not author themselves: commits by spawned workers / other agent sessions, files written by background subagents, anything /aios:update or an autonomous loop changed. If there are none, skip this step silently (the operator authored everything → no debt to surface). If there are:
b1. Recap first — bullet the surface area. Lead with a tight enumerated list of everything that shipped this session — one line per item: what shipped · what it does · where it lives (file / PR / repo / URL). This recap is mandatory and comes before the offer. The operator can't ask about what they don't know shipped — an offer with no list is the exact failure mode ("you don't know what you don't know"). Group by surface if it's a lot (vault / canonical / site / external).
b2. Then offer, don't quiz:
"☝️ That's everything that shipped this session. Want me to walk you through any of it? The bar isn't reading every line — it's that you understand what shipped well enough to defend, debug, or decide on it later. Anything you'd like me to explain?"
Format choice. If the recap holds a release, a refactor, or 4+ agent-authored items, add: "Walk you through it here, or build an explainer?" An explainer is the explainer agent (agents/aios/communication/explainer.md) run on the recap list: one discardable HTML walk in 03 - export/explainers/. Three items or fewer, or one small change → just talk. Under --auto, never build one: add explainer available: /agent explainer <range or subject> as an Open threads thread tagged task instead.
Walk through whatever the operator asks about (the why + failure modes, not a line reading). What they decline to grasp goes into the session block's **Comprehension:** field and an **Open threads:** thread tagged task — marked un-grasped, not done — so /close-day can resurface it. The debt is the operator's (they're the one who owns the system in a room); your job is to keep it low, never to wave agent output through on their behalf. Full mechanism: the comprehension-debt skill.
c. Model-switch check (SETUP Hook F) — no question, so it runs under --auto too: UV_CACHE_DIR="$HOME/aios/.aios-run/uv-cache" uv run ~/aios/hooks/pipeline/model-switch-log.py --report --session "$CLAUDE_CODE_SESSION_ID". Empty output means this session ran on the model it asked for, or Hook F is not wired: say nothing. A line means part of this session ran on another model, usually after a flagged message: add **Model:** finished on {to} (asked for {requested}) to the session block (after **Comprehension:**) before step 5 appends it, so /close-day and whoever reads the work later know which model wrote it.
Append the session block via the race-safe helper — never write the note directly (a concurrent Close-all broadcast fires several vault sessions at once; a direct read-append-write would clobber). Write the block (format below) to a temp file, then:
~/aios/hooks/vault/aios-note-append \
--note "$HOME/aios/vault/01 - calendar/{YYYY-MM}/{YYYY-MM-DD}.md" \
--before "## Close of Day" \
--create-if-missing \
-m "session: {HH:MM} {Topic}" \
--block-file /tmp/aios-session-block.$$.md \
$([ "${AIOS_CLOSE_SESSION_NO_PUSH:-}" = "1" ] && echo --no-push)
--create-if-missing is for the first close of a day nobody has opened yet: the helper creates today's note under the same lock instead of failing, so two sessions closing at once can never both create it and erase each other's block. Never create the note yourself first; that is exactly the race the flag closes.
The helper takes a per-file lock + merge-appends: under the lock it re-reads the latest note and inserts the block before ## Close of Day (or at the end if that marker is absent — omit --before then), then commits the note via aios-commit. So N sessions closing at once each land their block in turn — ordered, zero clobber, all visible immediately. (Then rm the temp block file.)
AIOS_CLOSE_SESSION_NO_PUSH=1— set it once, it covers EVERY push this command makesSet this before invoking
/close-sessionfrom any automated wrapper (a cron, a scheduled agent) that already does its own controlled end-of-run push. Leave it unset for interactive use: the flag defaults to unset everywhere, so every push happens exactly as before unless an operator's own automation opts in.Why it is worth a flag at all.
aios-commitreleases its lock before pushing (deliberately — a slow network call must not make peers wait), so two pushes genuinely race. And a rejected push does not self-heal: it prints "the remote has diverged. Pull/rebase, then push" and stops, which is correct for a human at a terminal and useless inside a cron, where nobody reads it. The vault then sits committed-but-unpushed until someone notices.This command pushes from FOUR places, and the flag must reach all four — step 5's
aios-note-append, step 10'saios-commit(Mode A), step 10b's done marker, and Mode B's report commit. Covering only one is worse than covering none: the wrapper's author sets the variable, believes the race is handled, and still hits it at the next site.tests/close-session-nopush.test.shcounts push sites against guards, so a push site added later without the guard fails the build rather than silently escaping the flag.
Update session-insights.md (observation buffer — not a log):
Scan existing entries first:
Then add new pattern-level observations from this session to Emerging. Every new entry declares its class on the line under its title — the two classes have opposite disposition rules (CLAUDE.md § Observed Context Rules):
### {title}
`class: method` · `first-seen: {today}` · `route: antifragile.md`
behavioural (about the operator) → date + evidence + route: target. Waits for a second independent sighting. Unchanged.method (about the system — a command, hook, agent behaviour, process) → do not park it to wait. A second sighting would mean the fix never landed, not that the finding is confirmed. State a rule general enough to fire outside this incident, then dispose of it in this same close: route (a new class → antifragile.md or the right observed file), fold (sharpens an entry that already exists → merge, delete the buffer entry), or drop (an existing rule covered it; applying that rule harder was the answer → delete). Most fold or drop, and that is success.route: target has no exit condition; do not write one.method entry whose fix belongs in the framework, not the vault (a command, hook, agent or doc every operator runs) → offer once: "This looks like a framework issue — want /agent aios-feedback to draft it for upstream?" Skip the offer under --auto. The offer is all this step does; filing stays inside the agent's own confirm-gated flow.Snapshot session-insights only if the document actually changed (not every session)
Cap: Emerging ≤10, Reinforced ≤5. Adding forces reviewing. If Emerging is over cap, the cause is almost always undisposed method entries — sweep those for fold/drop before considering whether anything behavioural is stale. Raising the cap does not hold: method intake scales with sessions-per-day while the promotion rule does not.
Session summaries (what happened, wins) belong in the daily note block above — session-insights holds only distilled observations.
Update observed context files when warranted — same rules as close-day. Scan the session for:
patterns.mdpreferences.mdbusiness.mdantifragile.md
Snapshot before editing and set the edited file's updated: frontmatter to today (the snapshot-and-stamp rule — CLAUDE.md § Session End; the staleness alarm reads that stamp). Not every session produces observations — but never skip this check for speed. The observed context is the compound value of the vault.Tier B files (growth / profile / ecosystem) — capture candidates, do NOT write directly. These files live one synthesis layer above session-insights — observations about the operator (not about work mechanics). A single session lacks the cross-session view needed to clear the substance bar (timeline + uniqueness + evidence + essentiality tests). Instead:
**Observed (Tier B candidates):** — e.g. "possible growth edge: re-secuenciar > apurar el cierre, 3rd instance this month". One line each. Date + evidence. No write to growth/profile/ecosystem.md./close-day runs the digest across all sessions, the daily note, and recent antifragile/session-insights, then writes to Tier B files when the substance bar passes (see /close-day § Tier B observation pass for the bar + per-file feed-in sources).Comprehension ledger — verify, don't ask again. The recap and the offer ran at step 4.7, before the block was written, and their outcome is already in the block: the **Comprehension:** field, and an **Open threads:** thread tagged task for anything the operator declined to walk through (marked un-grasped, not done). This step only confirms both are there. Never repeat the recap or the offer here — the block is committed, the helper only appends, and an answer given now would have nowhere to go. If nothing agent-authored shipped, the field reads "All operator-authored".
Self-update verification — before commit, walk the CLAUDE.md Session End rules to confirm step 7 wasn't skipped. The compounding promise of the AI-OS lives in routing, not logging.
updated: to today (per CLAUDE.md → "Session End → Snapshot before editing, stamp after")session-insights.md per CLAUDE.md → "Self-Update → Observed Context Rules" — Emerging / Reinforced / Routed lifecycle; ≤10 Emerging, ≤5 Reinforcedantifragile.md if the user corrected me OR I caught my own system-level mistake (per CLAUDE.md mandatory triggers)**Most useful:** fieldIf any unchecked, complete it now before commit. Under --auto, every observed-context item above — session-insights.md, the other observed files, and antifragile.md — is satisfied by the candidates captured in the block's **Observed (Tier A candidates):** field (§ Non-interactive mode defers every Tier A write to /close-day, the single writer); snapshotting and stamping apply only to files actually edited, which under --auto is none. Writing the observed files directly would reintroduce the parallel-close race that mode exists to avoid.
Logging is not routing (interactive closes; under --auto the captured candidates are the routing, and /close-day completes it). Don't commit until each insight from this session lives in session-insights.md (or routed onward to its target observed file). The daily-note "What I learned" is a holding cell, not a destination. The AI-OS compounds on routing — capture-only is stranded.
Commit any observed-context you touched via aios-commit (the note block was already committed by aios-note-append in step 5). NEVER git add -A — in a concurrently-written vault it sweeps other sessions' + the human's in-flight files into your commit (scrambled attribution). Commit only the paths you changed:
~/aios/hooks/vault/aios-commit -m "session: {date} {topic}" \
$([ "${AIOS_CLOSE_SESSION_NO_PUSH:-}" = "1" ] && echo --no-push) -- \
"vault/00 - notes/context/observed/session-insights.md" {any other files you edited}
The --no-push opt-out applies here too — this is the command's second push site, and a wrapper that set the flag for step 5 expects it to hold for the whole run (see the box at step 5).
aios-commit stages ONLY the given paths via a throwaway index (working tree untouched), self-scans for secrets, and pushes with defer-on-offline. It is the one sanctioned commit path — it replaces git add -A everywhere.
10b. Record that this close finished (interactive closes only — an --auto close carries the marker in its block, and an --auto resume writes none). Write <!-- close-session-done: {SID} @ {VHEAD} --> to a temp file, with the same {VHEAD} as this close's stamp, plus one such line for each hash the gate listed in close-session owed: (this close routed their share too). Then append the file through the same helper:
~/aios/hooks/vault/aios-note-append \
--note "$HOME/aios/vault/01 - calendar/{YYYY-MM}/{YYYY-MM-DD}.md" \
--before "## Close of Day" \
-m "session: {HH:MM} {Topic} — done" \
--block-file /tmp/aios-session-done.$$.md \
$([ "${AIOS_CLOSE_SESSION_NO_PUSH:-}" = "1" ] && echo --no-push)
Its subject starts with session: , so the gate never counts it as work. It goes last because it is the gate's evidence that steps 6-10 ran: written earlier, an interrupted close would read as finished, and the next run would skip what never happened.
Append this to the daily note:
---
## Session — {HH:MM} | {Topic}
<!-- close-session: {CLAUDE_CODE_SESSION_ID} @ {vault HEAD at close} -->
> {One sentence characterization — not a summary, a frame. What was this session really about?}
**Wins:**
- {Binary deliverables — shipped/decided/unblocked, not "worked on"}
**Learned:**
- {Pattern-level insight, not task-level}
**Most useful:** {User's verbatim answer to "What was most useful for you in this session?" One line, in their words. Write "None — not asked" when the question was not asked (a quick session with no substantive work, or `--auto`). The field is always present: `/close-day` parses the block.}
**Open threads:**
- {thread} _(task | follow-up | note)_ — {What this session leaves open, one bullet each. **Plain bullets, never `- [ ]` checkboxes** (#337): a checkbox makes every leftover a task the operator never set, and `/today` used to carry them as such. `task` only when the operator has to do it; `follow-up` when another session or project picks it up (name it); `note` for a fact, an observation or an FYI. `/close-day` triages every thread (carry, route or drop). An un-grasped comprehension item is a real `task`. Write "None" if the session closed cleanly. Don't fabricate threads to fill the field.}
**Comprehension:** {Of the agent-authored changes this session (work the operator didn't write themselves), what the operator now understands well enough to own — and what they declined to walk through (rolls forward as comprehension debt, not done). Write "All operator-authored" if nothing was agent-shipped this session. The bar is understanding (defend/debug/decide), not line-by-line reading. Don't fabricate. See the `comprehension-debt` skill.}
**Observed (Tier A candidates):**
- {**Under `--auto` only** (deferred routing — see § Non-interactive `--auto` mode): one-line captures of Tier A observations this session would otherwise have written inline — session-insights entries, confirmed patterns, preferences, business/venture insights, antifragile corrections. `/close-day` routes these as the single writer (Tier A → the target file, snapshot first). Format: `{observation} → {target file} _(evidence)_`. Interactive closes write Tier A inline and put "Routed inline" here. Write "None" when nothing surfaced. Don't fabricate.}
**Observed (Tier B candidates):**
- {One-line capture of any growth / profile / ecosystem candidates surfaced this session — observations about the OPERATOR (not work mechanics). Write "None" when nothing surfaced. Don't fabricate to fill it. Examples: "possible growth edge: re-secuenciar > apurar (3rd instance this month)" / "ecosystem shift: {a collaborator} is now in advisor-grade orbit, not weekly-collab" / "profile signal: integrative work AND presentation work compound together, naming the integrative posture as identity-level" — these become feed-in for /close-day's Tier B digest later, which decides whether they pass the substance bar to write.}
**Energy:** {One honest word — sharp, scattered, fading, deep flow}
After writing the session block, scan the conversation for discoveries worth filing as permanent pages — analyses, comparisons, connections, research, frameworks, or insights that would be valuable in 3 months. These shouldn't disappear into chat history.
Prompt the user:
📄 **Worth filing?** This session produced {N} insights that could be permanent pages:
- "{insight title}" → `reflections/{slug}.md`
- "{insight title}" → `ideas/{slug}.md`
File them now, or skip?
If yes → write the pages (with [[wiki-links]], proper frontmatter, source attribution to this session), update the relevant _index.md. If no → move on. If the session was purely operational (commits, fixes, task management) with no reusable discoveries, skip the prompt silently.
Rule: This is Karpathy's key insight — good answers compound when filed. Chat history doesn't. The LLM does the bookkeeping; the human just says "yes, file it."
Goal: Write a structured session report to the single canonical harvest dir ~/aios/.claude/ (NOT the current repo's .claude/). /close-day scans that one dir and routes content to the vault — so a session in any repo lands where close-day looks, with zero dependency on the repo being registered in USER.md's Dev-projects table. (This is the seam-2 fix: an unregistered repo's report used to be written in-repo and never harvested — stranding it. One canonical dir dissolves that.)
package.json name, or CLAUDE.md title, or folder name)~/aios/.claude/session-report-{YYYY-MM-DD}-{project}-{session}.md — {project} is a filesystem-safe slug of the repo name (from step 1), {session} is $CLAUDE_AGENT_NAME (fallback: a short session-id or pid if unset). Both suffixes are load-bearing at a shared dir: {project} keeps two different repos' sessions from colliding in the one harvest dir, and {session} keeps a Close-all broadcast's N workers in the same repo from clobbering each other. Write it to ~/aios/.claude/ even though the session runs in another repo — that's the whole point: one dir close-day always scans, no registration needed. (~/aios/.claude/ is fully gitignored, so the report never leaks into any repo's git.) Then commit your session's own scoped work via ~/aios/hooks/vault/aios-commit -m "..." $([ "${AIOS_CLOSE_SESSION_NO_PUSH:-}" = "1" ] && echo --no-push) -- <paths> (never git add -A). The --no-push opt-out applies here too — Mode B is the third and last push site, and an automated wrapper is more likely to run in this mode than in Mode A, not less.~/aios/.claude/session-report-{date}-{project}-{session}.md. /close-day will pick it up tonight."---
project: {project name from repo}
date: {YYYY-MM-DD}
duration: {estimated hours}
---
## Blocked on me
<!-- FIRST, always: only what the OPERATOR must do for this work to continue — a decision,
a login, an approval, a review. Not what someone else owes, not your own open questions.
Write "Nothing — carry on." when there is nothing. The reader acts on this section first,
so it is never buried under what shipped. -->
## What shipped
- {completed items — be specific}
## Decisions
- {decisions made, with rationale}
## Pendientes
| # | Pendiente | Prioridad |
|---|-----------|-----------|
| 1 | {task} | Alta/Media/Baja |
## Notes
{Free context — insights, problems found, patterns noticed, blockers}
## Most useful
{User's verbatim answer to "What was most useful for you in this session?" One line, in their words. Write "None — not asked" when the question was not asked.}
## Observed
<!-- Optional: patterns, preferences, or growth edges noticed about the user during this session.
/close-day routes these to the appropriate observed context file.
Leave empty if nothing significant was observed. -->
## Observed (Tier B candidates)
<!-- Optional: one-line captures of growth / profile / ecosystem candidates surfaced this session —
observations about the OPERATOR, not about work mechanics. Single sessions lack the cross-session
view to clear the substance bar, so we capture here and /close-day decides whether to write to
growth.md / profile.md / ecosystem.md via its Tier B digest pass.
Write "None" when nothing surfaced. Don't fabricate. Examples:
- "possible growth edge: re-secuenciar > apurar (3rd instance this month)"
- "ecosystem shift: {person} now in advisor-grade orbit, not weekly-collab" -->
## Comprehension
<!-- Of the changes shipped this session the operator did NOT author (agent / subagent / loop / aios:update output):
what they understand well enough to own, and what's still un-grasped (carries forward as comprehension debt).
Write "All operator-authored" if nothing was agent-shipped. The bar is understanding (defend/debug/decide), not
line-by-line reading. See the comprehension-debt skill. Skip the offer silently if the operator authored everything. -->
## Project Note Updates
{Proposed changes to the vault project note. /close-day applies these.}
### Current State
{What changed — replaces or complements the Current State section in the project note. Only include what's new or different.}
### To-Dos
{Mark completed items and add new ones. Use the same tiers as the project note: High Priority, Normal, Ideas.}
- [x] {completed items from this session}
- [ ] {new items discovered during this session}
### Session Notes Entry
{Ready-to-insert entry for the ## Session Notes section of the project note. Written in English.}
### {YYYY-MM-DD} — {brief session title}
{Substance of the session — what was done, key decisions, outcomes. Not a transcript.}
- [ ] {follow-up tasks}
~/aios/.claude/ — never the running repo's .claude/. That single location is what makes harvest coverage complete: close-day scans it and nothing strands, regardless of which repo the session ran in.-{project}-{session} suffix. {project} prevents two different repos colliding in the shared dir; {session} lets a Close-all broadcast fire N workers in the same repo without clobbering. If the same session runs /close-session twice on one date, overwrite its own file.~/aios/.claude/ is already fully gitignored in the vault (.claude/ line in .gitignore), so no per-repo .gitignore entry is needed anymore.## Observed is optional but valuable. If you noticed a genuine pattern, preference, or growth edge during the session, write it. /close-day routes it to the right observed context file. Don't force it — not every session produces an observation. But don't skip it just because you're in a standalone terminal — those observations would otherwise be lost.comprehension-debt skill./close-day parses it. Don't skip sections, but write "None" for fields that genuinely have no content (open threads when the session closed cleanly, wins on a pure-thinking session, most useful when the question wasn't asked). Fabricated content is worse than honest emptiness — it pollutes downstream pipelines (/today carries, observed-context patterns, Google Tasks).- [ ] task in its project note with a [[link]] to the note holding the plan — /today reads tasks, not documents (see /close-day § Partial work never closes as done).## Session — heading. Mode B: overwrites the same file.[[wiki-links]] for all project names, venture names, and context file references./close-day does the synthesis.What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub the-aios/aios --plugin aios27 commands in this plugin
/7plan/7plan — Weekly Strategic PlanWeekly strategic plan across all ventures based on what's most alive right now/agent/agent — Wear a Temporary Hat (+ Schedule)Load an agent's expertise into the current session (temporary hat), list agents, or schedule agents/challenge/challenge — Steel ManSteel-man — argue against your current thinking on a topic using vault evidence/close-day/close-day — End of Day ReviewEnd-of-day review — capture what shipped, what grew, and what carries forward/cold-start-interview/cold-start-interview — First Session After You Clone AIOSFirst-touch interview for a freshly-cloned AIOS vault. Walks the new operator through USER.md, declared context, bundle install choices, MCP setup, and optional Anthropic plugins. Run once, immediately after `git clone`./collaborate/collaborate — Scaffold a Collaboration SpaceScaffold a shared Collaboration Space (collab folder + first project) and create a router project note in the personal vault. Substrate-pluggable — any substrate with an active adapter and MCP/CLI on the machine can host a space. Subcommands for add-project, status, dry-run.Other plugins' commands for the same job