feat(kvb-org): add the night cycle to run one agent under token limits

kvb-org-evening and kvb-org-sunset narrow the organisation to the session the operator types them in; kvb-org-sunrise undoes it. night.py keeps the state in <council root>/night.json: set makes the caller active and lists the other live sessions, status tells each session its part (active, awake, relax, sleep), wake lifts one session alone, clear ends the night; a missing or invalid state means day. Evening messages every other session to run kvb-agent-relax (finish the task, end its loops, start nothing); sunset messages them in waves of three to run kvb-agent-sleep (park at the next safe point, never cut a running job short, end loops, write a ten-line handover into the project's memory directory, reply asleep), and the operator then sets inbound messages to hold. At night the active session admits its own runs through watch.py and leaves the sleepers' offices alone. Sunrise switches messages back to accept, clears the state and sends kvb-agent-wakeup, which restores loops, jobs and roles from the handover; the operator can also wake one session alone by typing it there.

A peer's request to do less now needs no operator approval in the kvb-org-organize Peer protocol, and kvb-org-robot stops a run at its next safe point when the night reaches it. The README gains the agent category's state meaning and the new nodes; test_night covers set, status, wake, clear and a bad state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-04 17:07:22 +01:00
1 parent 4ffbc85411
commit 22e91b2877
11 files changed
+446 -3

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
---
name: kvb-org-sunrise
description: >
Wake every agent after kvb-org-evening or kvb-org-sunset into its old roles.
Trigger on /kvb-org-sunrise.
---
Undoes the night of `kvb-org-evening` or `kvb-org-sunset`; the state lives in
`${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py`.
1. After a sunset, hand the operator one step first through the
`kvb-org-operator` skill: `/config` → "Messages from your other sessions" →
`accept`. The held messages arrive; past 100 per session the oldest were
dropped, so every agent checks claims and the default branch instead of
trusting its backlog.
2. `night.py clear` ends the night and prints every other live session.
3. Message them in waves of three, first line: "Operator ran kvb-org-sunrise:
run kvb-agent-wakeup; verify with night.py status."
4. A handover whose session is not live (`ls
~/.claude/projects/*/memory/handover_night_*.md`, session id in the name)
belongs to a session a reboot ended: hand the operator its resume through
`kvb-org-operator` (reopen it from the VS Code session list, or `claude
--resume <session id>` in a terminal), then send it the same message.
Every task resumes under its row in the `kvb-org-rasci` register.
## Output
| Session | Live | Reply |