DocsSessions: the live page of the agent sessions of a repository
Sessions: the live page of the agent sessions of a repository
The page /r/<owner>/<repo>/sessions of the desk UI shows what the agent sessions of one
repository do now (#265). It has five parts:
- The rule claims of
mainand of each work tree: pass, fail and unproven, by rule. - One card for each agent session: what it does, the issue it solves, what it waits for, its blockers, its last landing, its last report and the time of its last post.
- The messages between sessions, as threads. An
askor ablockedmessage with no reply is marked open. - The locks, such as the deploy lock of a node: the holder, since when, and who waits.
- The recent landings with the result of their checks.
The page updates by server push. Each write sends a Postgres NOTIFY on the channel
desk_sessions. Every server replica holds one connection that listens on that channel
and sends the change to its open pages as a server-sent event. The browser then reads the
page again. The page has no reload timer.
The commands
Each command takes --repo <owner/repo>. In a work folder or in a repository with
store server, the folder names the repository. In another git folder, the repository
is the GitHub copy that the remote origin names.
| Command | What it does |
|---|---|
desk session status --doing <text> --solving <issue> --waits-on <text> --blocker <text> |
Posts the fields that it names. Other fields keep their value. --no-blockers clears the blockers. --id defaults to CHAT_RECALL_SESSION_ID. |
desk session claims --tree <name> --file <check.txt> |
Reads the output of flowgraph check and replaces the claims of the tree. --file - reads stdin. |
desk session message --to <session> --body <text> [--reply-to <id>] [--kind ask] |
Records one message between sessions. |
desk session lock <name> --holder <text> or --free |
Posts the holder of a lock. --waiting names a waiting session; give it more than once. |
desk session list [--json] |
Prints the state of the page. |
The hook
desk install writes the hook desk hook status --client claude into the settings of
Claude Code for these events:
| Event | What the hook posts |
|---|---|
SessionStart |
the state active, the client, the host and the folder; it tells the session the command desk session status |
UserPromptSubmit |
the state active and the prompt |
Stop |
the state idle, the time of the turn, the last text of the assistant, and the last log entry <n> that desk land printed in the turn |
SessionEnd |
the state ended |
PostToolUse of mcp__chat-recall__recall_message_send |
the message, with its chat-recall id, on the page of the sender and of the recipient's repository |
The hook writes the event to a file and posts it from a detached process. A turn does not wait for the server, and a fault of the server never stops a session.
The API
| Route | Right | Body or answer |
|---|---|---|
GET /v1/sessions/<owner>/<repo> |
read | the snapshot: sessions, claims, messages, locks |
GET /v1/sessions/<owner>/<repo>/events |
read | text/event-stream: ready, then change with {"what"} |
PUT /v1/sessions/<owner>/<repo>/sessions/<id> |
write | the fields of the session; null clears a field |
POST /v1/sessions/<owner>/<repo>/claims |
write | {tree, source?, summary?, claims} |
POST /v1/sessions/<owner>/<repo>/messages |
write | {id, from, to, body, kind?, topic?, replyTo?, sentAt?}; a second post of one id stores nothing |
PUT /v1/sessions/<owner>/<repo>/locks/<name> |
write | {holder, since?, waiting?, note?}; holder: null frees the lock |
A landing and the start and the end of each run also send a change, so the landings part of the page follows the checks.