Design 36: the plugin's session-start and Stop hooks beside the guard, and the waits mirror in the agent's home (ADR 0489, ADR 0490) #462

Merged
mesh-tools merged 3 commits from design/36-wait-list-hooks into main 2026-10-21 17:53:42 +00:00
@@ -157,6 +157,16 @@ does the job, or with the rule that a missing tool is created in its owning modu
managed directory, so a session cannot change it, judges with the machines and replaced commands the module
last asked of the controller, and records every refusal and every operator's override in the module's state.
**The wait list and the Stop hook** (ADR 0489, ADR 0490). Beside the guard the plugin carries two more of the
module's own commands as hooks. At every session start the session-start hook prints the session's id and every
open wait on the machine by the name it is kept under, with the call that takes a name back after a /clear (which
gives a session a new id). At every stop the Stop hook reads the session's waits, which `claude_code_wait` keeps
in the module's state under the session's name (who@node) and mirrors into the agent's home, and refuses the stop
while a wait is within its bound and nothing follows it, or past its bound and not yet told to the operator; it
lets the stop through silently when there are no waits, says so on the screen when the list cannot be read, and
refuses the same stop at most three times. Like the guard, both hooks ship in the plugin only: the hook
registration tools refuse a hook at mesh or node scope (issue 340).
## 4. The mesh MCP server
> **Revised 2026-10-03, building it.** The vendor's managed-settings key for tool servers refuses any
@@ -405,6 +415,7 @@ the helper of §9 where that is an agent account):
| `rules/<name>.md` | one personal rule each |
| `skills/<name>/`, `commands/<name>.md`, `agents/<name>.md` | the operator's own skills, commands and subagents at the operator scope, under their own names; and the home-scope items where the home is an agent account's own |
| `hooks/` | nothing: a hook is the terminal's, in the managed settings. The directory is kept empty |
| `nox-mesh/waits/<session-id>.json`, `nox-mesh/waits/_index.json` | the module's own mirror (ADR 0489, ADR 0490): per Claude Code session id, the open waits of every name bound to that id; and the machine's open names, written whole by `claude_code_wait` and read by the plugin's session-start and Stop hooks; rebuilt from the module's state, never a person's |
| `output-styles/<name>.md`, `keybindings.json` | the operator's output styles and keybindings at the operator scope |
| `settings.json` | the operator's registered settings, preference keys only, with the keys the program itself writes on a person's choice (the model, the spinner, the drafts, the other preferences the vendor's own commands set) taken over into the registration when the program changes them, so a choice made in one session follows the operator. A key that decides what runs (`hooks`, `permissions`, `mcpServers`, `env`, `apiKeyHelper`, `statusLine`, `autoMode`, any key not on the list) is never taken over: changed on disk, it is written back on the look that finds it. `autoMode` is a permission rule, so it lives in the managed settings at the terminal |