---
name: session-ritual
description: >
  Runs the fixed open and close of a working session against the obligation
  ledger. Fire on: "open the session", "open", "start the session", "start the
  day", "what's due", "where are we", "catch me up", "close the session",
  "close", "wrap up", "that's it for today", "write the handoff", or the first
  working message of a new conversation in this project. NOT for: answering a
  single quick question mid-session, capturing one decision or task (use
  capture), deciding whether an action needs approval (use approval-lattice),
  or long-term planning and goal setting.
---

# Session ritual

Two fixed procedures. The full text is in `ritual/OPEN.md` and
`ritual/CLOSE.md`; this is the working checklist.

## Open

1. **Read, in order.** Run `scripts/open.sql` if you have a database tool;
   otherwise ask the founder to run it and paste the three results.
   - `v_due_for_check` (limit 30)
   - `v_next_up` (limit 15)
   - health counters — none in v1, skip
   - latest `session_handoffs`: `in_flight`, `do_not`, `measured` only
   - doctrine laws newer than the version on the handoff's first notes line
2. **Verify live state** for any row you are about to act on. Mark anything
   you could not check as "unverified".
3. **System-owned due rows:** act on each (within the lattice) or propose a
   re-date with a reason. None left untouched.
4. **Founder-owned due rows:** one grouped list — decisions waiting, things
   only the founder can do, waiting on others. Once, not scattered.
5. **Offer 2–3 ways to spend the session**, one line each with why-now and
   rough time. Recommend one. Stop and let the founder choose.

Keep the whole open to one screen. Respect every `do_not` from the handoff.

## During the session

- Keep a running mental list of every ledger row touched, every ruling, every
  thing shipped and every thing started. The close needs all of it.
- Capture proposals (see the capture skill) go into that list too.

## Close

Produce one filled-in `scripts/close.sql`, wrapped in `begin; ... commit;`:

1. **Touched threads:** each one `UPDATE`d to closed (with `resolved_in` for
   events) or re-dated (new `next_check_at`, confirmed `owner`, reason).
2. **Events:** one `INSERT` row each for `shipped`, `ruling`, `learning`
   (born closed). Anything started gets its own open `open_thread` row.
3. **Handoff:** one `INSERT` with `measured`, `ruled`, `in_flight`, `do_not`
   all non-empty ("none" is allowed, empty is not). `hypothesised` holds
   beliefs. `notes_markdown` starts with `doctrine: vN`, deltas only.
4. **Loop 2:** for each step done by hand that has been done before, one
   `INSERT` into `tasks` titled `Automate: ...`, owner `system`. No prose.
5. **Standing rule query** at the end must return zero rows.

Above the SQL, three lines: closed, re-dated, in flight. Then hand it over.
Running it is the founder's action unless the doctrine says otherwise.

## Session labels

Use a label the founder will recognise later, such as the date plus a word:
`2026-03-14 morning`. Use the same label in every row of the close.

## Failure modes to avoid

- Opening with a long recap instead of the due list.
- Closing with a summary paragraph and no SQL.
- Closing a row as done because it was discussed, not because it was done.
- Re-dating everything by 7 days to make the due list empty.
- Forgetting the handoff's `do_not` from last time.
