The Claude Code plugin
Every agent flume starts is Claude Code with flume’s own plugin. Its
hooks are how flume knows what the agent did: that it started, that it
received its prompt, that it is asking a person something, and that it
went quiet. The same plugin, installed in your own sessions, gives you
/launch and flume’s status, message, launch and wake over MCP, and its
hooks do nothing there.
The plugin flume hands its agents
Section titled “The plugin flume hands its agents”flume writes the plugin itself, once per version of flume and binary,
under $XDG_DATA_HOME/flume/plugins/claude/<version>-<digest>, and
starts each agent with it:
claude --plugin-dir <plugin> [--settings <file>] [--resume <session>] [--model <model>] [--effort <word>] [--permission-mode <mode>] [--append-system-prompt-file <file>] '<prompt>'--settings is there only where a layer gives Claude Code’s own
settings (a program’s own
settings). It
names own-settings.json, a file beside the start’s record holding
the keys the layers resolved as one JSON object, never a file a layer
named. Claude Code lays it over the user’s, the project’s and the local
settings. Take a host that gives no own setting but its table for a
fork, whose commits and pull requests must name no one (what a commit
says about who made
it).
Each agent in the fork gets this file:
{"attribution":{"commit":"","pr":"","sessionUrl":false}}--effort is there only where a layer gives the agent an effort, one
of the pinned release’s five words, low, medium, high, xhigh
and max (the effort).
It is the session’s own level, which Claude Code reads over every
settings file’s. So Claude Code’s effortLevel setting is flume’s
effort’s: a layer’s settings that writes it is refused, and a
named file’s is left out, naming flume’s effort as its owner. Claude
Code reads one thing over --effort, CLAUDE_CODE_EFFORT_LEVEL in
its environment. An account whose env sets it outranks the layers,
and status says so on the agent’s line, naming the variable.
--resume is there only for a start that carries a spent agent’s
conversation (a conversation carried).
--append-system-prompt-file names a file beside the start’s record
holding the agent’s instructions as given, since herdr starts no
program whose arguments hold a newline.
in the place, with the agent’s environment and four variables of flume’s:
| Variable | What it holds |
|---|---|
FLUME_AGENT |
the agent’s identity, flume:<repository>:<place>:<stage>:<start> |
FLUME_SECRET |
a secret of this start, which every ack must carry |
FLUME_PLACE |
the place’s location |
FLUME_STAGE |
the stage’s name |
The plugin’s hooks name the binary that wrote it by its absolute path, so an agent’s hooks always match the flume that started it. Nothing needs installing for this. When the agent’s plugin is of another version than the flume reading it, status says so in the agent’s notes.
The program is claude unless the agent’s settings name another path
to Claude Code. Where that path is a nix wrapper, flume runs the program
it wraps, with the variables the wrapper sets, so herdr recognises the
agent as Claude Code. Any other program refuses the launch, since
Claude Code is the one agent program flume runs.
flume checks the plugin’s hooks against the Claude Code release its
repository pins, 2.1.322: the input each hook event hands them and how
Claude Code reads their answers. It checks there too the options the
command names, the folder-trust dialog it answers, the --settings
option, the order Claude Code reads its settings in, each key flume
reserves for another setting, effortLevel among them, and
attribution’s two texts. It checks the --effort option and its five
words there, and the variable Claude Code reads over it.
What each hook does
Section titled “What each hook does”Each hook runs flume hook <event> and always exits 0. In a session
flume did not start, one with no FLUME_AGENT and FLUME_SECRET,
every hook does nothing but SessionStart (a session of your
own).
| Hook | What flume does with it |
|---|---|
| SessionStart | the started ack: the session, its transcript, the transcript’s length when the start’s first ack came, and the plugin’s version, taken only with the start’s secret. flume takes it only where the agent’s program and environment match its start’s record, and, for a start that resumes a session, only in that session (the start check) |
| UserPromptSubmit | the received ack: a digest of the prompt the agent took, the tags Claude Code may wrap a pasted prompt in taken off and its whitespace collapsed. At the start’s first prompt it first compares the mode the session runs in with the one its start passed, and blocks the prompt where it differs (the start check) |
| PreToolUse, for Bash | the guard: refuses git push, sluice submit, and worktrunk’s wt submit and wt merge, wherever the line runs them, and records each refusal |
| PreToolUse, for AskUserQuestion and ExitPlanMode | the asking mark: the agent is asking a person, until its transcript holds the answer |
| PermissionRequest | the asking mark, for a permission prompt |
| PostToolUse | clears the asking mark once the question it marks is answered |
| Stop | the stop check, then a settle once the agent is quiet |
| StopFailure | the agent’s last words: why its turn failed, with the failure’s error and when the hook ran. A turn that failed at its account’s usage limit marks the account spent (a spent account) |
| SessionEnd | marks the agent’s session ended |
A subagent’s hooks take no ack, and the guard refuses its commands as its agent’s.
A session of your own
Section titled “A session of your own”In a session flume did not start, SessionStart runs flume inbox as
the session the multiplexer names, the pane it runs in under herdr, and
never as FLUME_RECIPIENT or a role’s address, so your session never
collects a role’s ends. The inbox confirms on receipt each end it hands
over, since the hook gives the agent its words whole: an end handed to
your pane before and never confirmed is handed again here, and
delivered. Where the inbox holds anything, the hook gives it to the
agent as the session’s added context: each end it collected,
and each place waiting on your session with its question, the
question’s key, whether its agent is kept open and until when, and the
three ways on:
- answer it naming the key, by
flume retry <place> --stage <stage> --answers <key> --words "<answer>", or, while its agent is kept open,flume message <place> --answers <key> "<answer>"; - hold the move with your words,
flume hold <place> "<words>" --waiting --for <time>; - or leave it, and once the place stalls the answerer behind its stream has it.
A place that waits on another move, a retry, its submission or a done, is given that move’s own command in place of the answer. For one place waiting on its question, the agent reads:
flume, at this session's start: what waits on it, herdr:w1-3@/tmp/herdr.sock, from `flume inbox`.
change--plan (one of two designs), in the stream east, waits on a retry of construct since 1793287841.Its stop-short stage/construct/1/ended-short needs an answer: Which design does the brief mean?Its agent is kept open for the answer until 1793291441.Ways on:- answer it, naming its key: flume retry change--plan --stage construct --answers stage/construct/1/ended-short --words "<answer>" or, while its agent is kept open: flume message change--plan --answers stage/construct/1/ended-short "<answer>"- hold the move with your words, saying who has it: flume hold change--plan "<words>" --waiting --for <time>- leave it: once it stalls, the answerer behind its stream has it.Where nothing waits, under the printed command, which names no session, or where flume cannot be reached, it gives nothing. It holds up the start no longer than its 20 seconds’ timeout.
Beside the command hooks the plugin carries one hooks module,
hooks/flume.ts, which pins the place’s line under the prompt (the
status line) and holds the deliver part (the
deliver part).
The guard. flume submits the place once its last stage delivers,
so an agent never submits, merges or pushes its branch itself. The
guard reads the shell line as the commands it runs, after &&, in a
pipeline, in bash -c or behind env, and refuses with words telling
the agent to commit and leave the rest to flume. git merge stays
allowed, since a conflict’s fix merges the base into the place’s
branch. Status lists each refused act under the place’s
refused_acts.
The stop check. When the agent is about to go quiet, the Stop hook
asks flume whether the stage’s deliverable exists. It may be missing
while the agent has no background work running and no question open.
Then the hook blocks the stop with words naming the deliverable, each
declared thing with no line in made.jsonl, and the way to stop short.
Otherwise it asks flume host on its socket to settle the place, and
starts no process. flume host waits up to sixty seconds for the agent
to be quiet and then moves the place on. Where no flume host answers,
the next settle moves the place. A conversation stage is never sent
back.
The status line
Section titled “The status line”Every agent flume starts shows its place’s line under its prompt, so a pane says which place it serves and where that place stands:
⚠ flume: change--parser · change@2 · code 1/2 · run 1 · tasks 0/3 · workingThe line holds the place, <kind>--<name>; its kind and version; the
current stage, with a repeating stage’s group, code 1/2 for the
first of two; run <n>, how many times that stage started; tasks <t>/<n>, the change’s tasks ticked at the place’s head; and the
place’s state in words. A part the place has none of is left out: a
fix has no tasks, and a landed place shows only fix--parser · fix@1 · landed. Claude Code 2.1.322 draws it on the row under the prompt’s
input, with a ⚠ and the plugin’s name before it.
The state is the first that holds of these:
| State | When |
|---|---|
being made |
a launch is making the place |
landed, dropped, done |
the place’s work is over |
stalled |
the place waited on its caller under no hold’s words past its stall bound |
hibernating |
the stage’s kind hibernates it, and its agent was ended with its session kept, idle or at its caller’s word; a message, flume resume or its answer resumes it |
held |
a hold stops the place’s next stage or its submission |
waiting on an answer |
the stage stopped short and needs an answer, or found work |
asking |
the agent shows a dialog of Claude Code’s before its prompt, or, once started, asks a person a question |
lost, never begun, not ready, refused, stopped |
the stage’s agent stopped with nothing delivered, its prompt never began, the place’s readiness failed, the stage was refused, or its caller stopped the agent |
past its bound, submission refused |
the place went back more times than its kind allows, or the merge queue refused its submission |
landing refused |
the forge refused the landing of the place’s submission, which the merge queue holds, and the place waits on its caller with the forge’s words |
waiting on done |
the last stage of a kind that does not land delivered |
waiting on its session |
a lost conversation’s retry, or a start that carries a conversation, waits while a process runs that conversation, or while flume cannot read whether one does |
waiting for room |
the stage waits for room on the host, its stream or its pool |
starting |
the agent is opened and has not said it started |
stuck |
the agent is quiet past its stage’s limit with nothing delivered |
in conversation, working |
the agent works, in a conversation stage or any other |
submitted |
flume submitted the place, and no settle has read the merge queue’s outcome yet |
A session that outlived its start, such as a repetition’s earlier agent
still open, shows the place’s current stage with
· this session is not its agent at the end of the line.
How it is drawn. The plugin’s hooks module runs flume hook status-line
at the session’s start, after each tool call and at each turn’s end.
It runs it again every ten seconds, so a hold, a stall or a stop-short
shows while the agent sits idle. It pins the line the hook prints as the plugin’s own
status line, and removes it where the hook prints nothing. The clock
runs in Claude Code’s own process and ends with the session.
What it reads. The hook reads the place’s held state, the change at
the place’s head and the agent’s own record, and nothing else. It calls
no terminal and no merge queue, settles nothing, writes nothing and
starts nothing. So submitted can stand for up to a settle after the
merge queue lands the place; flume status gives the merge queue’s own
record at once. The words are the ones flume status --line prints for
the place.
Beside your own. The line is the plugin’s, one among the plugins’
lines Claude Code pins under the prompt. A status line your settings or
the repository give stays the session’s own, and another plugin’s
pinned line stays beside flume’s, with nothing to set. In a session
flume did not start, one with no FLUME_PLACE and FLUME_AGENT, the
module pins nothing and runs nothing.
flume checks the module against the engine the pinned Claude Code writes, so a release that changes it fails flume’s own checks first.
The account’s usage windows
Section titled “The account’s usage windows”Claude Code hands its plugins the usage windows each response reports:
how much of the account’s 5-hour and 7-day windows is used, and when
each resets. In every session flume starts, the plugin’s module passes
each report whose windows moved to flume hook usage, which keeps it
beside the start’s record and has flume take it as the reading of the
account the start runs under (an account’s
reading). A
most-left pool chooses by those readings, and a pool’s threshold
holds an account near its limit.
What it passes. The module passes a report only where the windows moved and it holds one. A session off a subscription, or before its first response, reports none, and passes nothing, so a reading kept stands. It runs the hook and goes on, never waiting on it, so Claude Code’s measuring is never held; a run that fails changes nothing, and the next report is passed as it comes.
What the hook keeps. The hook reads each window’s kind,
percentUsed and resetsAt as the pinned release gives them, a use
past 100 read as 100. A report with a window in no such form keeps
nothing. It records the report with the time it took it, and flume
writes it into the account’s document beside its spent time, with the
agent’s identity and its session. A report taken no later than the
reading kept changes nothing. A start under no pool keeps the report
beside its record and writes no account’s document. The hook prints
nothing and always exits 0. In a session flume did not start it reads
nothing and writes nothing.
flume asks Claude Code and its maker nothing for it, reads no sign-in and fetches nothing: the windows are what the session’s own responses reported.
Each account’s configuration home
Section titled “Each account’s configuration home”Claude Code keeps its settings, its plugins and its sign-in in its
configuration home, the folder CLAUDE_CONFIG_DIR names. A pool’s
account whose env gives CLAUDE_CONFIG_DIR is a home of its own, and
flume’s configuration is what says which homes those are. Status gives
each account’s home as home at host.pools[].accounts[], its ~
and variables read against your login environment as a start reads
them, and the person’s form names it under the account’s line:
flume status --json | jq '.status.host.pools[].accounts[] | {name, home}'A tool that installs something into every account’s Claude Code, a
plugin or a setting, reads the homes there. An account whose env
gives no CLAUDE_CONFIG_DIR gives null: its agents run Claude Code’s
own default home. One whose value names a variable your login
environment lacks gives null with home_unread, saying which. The
home is the one value of an account’s variables status gives:
CLAUDE_CONFIG_DIR and every other variable stay <set> in an agent’s
settings and in the host’s configuration values. flume writes nothing
in a home, and whether the folder exists is for the installing tool to
find.
Prompt delivery
Section titled “Prompt delivery”Keys typed into a pane prove nothing about what the agent took, so flume reads the agent’s own word:
- flume starts the agent and waits for its started ack, under the identity and secret flume gave it. herdr’s own reading that the agent is ready does not count, since herdr reads a first run’s setup screens as ready. While Claude Code shows a dialog of its own, such as its approval of a repository’s MCP servers, the place waits on a person to answer it, and status gives the dialog’s words.
- It sends the stage’s prompt once the agent waits and is asking nothing, clearing anything typed in its input first.
- It waits up to sixty seconds for the received ack, whose digest must match the prompt sent.
- When none comes, flume clears the input and sends the prompt once more. When the second sending is not received either, the stage is never begun, and status says so. An agent that acks its start or its prompt after that goes on, and its stage is begun after all.
Under the printed command, the prompt rides in the command line, and its one sending counts from the started ack. A prompt that is a slash command fires no UserPromptSubmit hook, so flume reads it as received from the transcript instead.
Text left typed in a pane is never a stage’s state. A flume message,
your words to a place’s agent, reaches it the same way: as a prompt the
agent says it received, or not at all. flume holds a message while the
agent works and sends it once the agent waits, for up to ten minutes or
the --within you give. It refuses a message, with nothing typed, when
no agent is live or the agent is asking a person a question. A message
never starts, ends or moves a stage.
A notice of an end, and a message to a role’s address, reach a session only at its wait too, never while it works: at its wait the session takes every end and message pending for it as one prompt, in the order they were recorded, each with how to confirm it (ends).
The deliver part
Section titled “The deliver part”The plugin’s hooks module holds a deliver part: in a session whose
environment names FLUME_PLACE, FLUME_AGENT and FLUME_DELIVER, it
runs flume hook deliver at the session’s start and at each turn’s
end, and every ten seconds while no turn runs, one run at a time, and
submits what it prints as your own words, a turn of its own once the
session is idle, leaving the prompt box as you left it. What it prints
is flume’s take for the agent: a message to its place waiting on its
start, else, for a role’s run, every end and message pending at its
address, recorded handed as it is taken. Where the agent’s program
takes words so, flume types nothing into its pane.
flume sets FLUME_DELIVER only where the agent’s profile offers the
part. Claude Code’s profile offers it on the release flume pins,
2.1.322, which runs a plugin’s hooks module in an interactive session;
so the plugin takes every batch and message for a Claude Code agent,
and the multiplexer types none into its pane. Outside such a session
the part registers no clock and runs nothing.
How flume reads an agent
Section titled “How flume reads an agent”flume status gives the current agent’s state, read when asked:
| State | Under herdr |
|---|---|
working |
herdr reads it working |
waiting |
herdr reads it idle or done |
asking |
herdr reads it blocked and the plugin left the asking mark |
stopped |
its pane is gone, or herdr lists no agent in it with the shell in front, or its session ended |
unknown |
flume cannot read it, as under the printed command |
with started, asking and own_work, whether background shells or
tasks the transcript shows are still running. Each start reads only its
own part of the transcript, what follows the length its first started
ack recorded. So a carried agent never reads the spent agent’s turns,
background tasks or last words as its own. A stage whose agent
stopped with nothing delivered is lost; one quiet past the stage’s
quiet limit with nothing delivered is stuck, and flume ends its
stage short in its own words, needing an answer, with one notice that
names flume retry <place>; and one working past it is said to be.
flume ends none of these agents: a retry or a drop is yours.
A conversation carried
Section titled “A conversation carried”The start after a spent agent carries its conversation where Claude
Code can find it under the account chosen (a spent
account). Claude Code
keeps a session’s transcript at
<home>/projects/<folder>/<session>.jsonl, <home> its configuration
home, and --resume <session> looks for the session under that home’s
projects folder alone.
So at the start after a spent agent, flume reads the transcript that
agent’s started ack named. It looks for the file of the same folder and
name under the chosen account’s projects, <home> its
CLAUDE_CONFIG_DIR, or ~/.claude where the account sets none. It
compares the two by device and inode. Where they are one file, as when
the two homes share their projects folder by a link, flume starts
Claude Code with --resume <session>, and the session goes on under
the same id. A copy of the transcript is another file, so a copy
carries nothing. flume only reads: it writes, links and copies nothing
in either home.
Where they are not one file, the start is afresh and status gives why,
naming CLAUDE_CONFIG_DIR and no path:
| Why | When |
|---|---|
its conversation is not known: the agent that stopped never said it started, so no configuration home (CLAUDE_CONFIG_DIR) is known to hold it |
the spent agent wrote no started ack, or one naming no session |
its conversation’s transcript, in the stopped account’s configuration home (CLAUDE_CONFIG_DIR), cannot be read |
the spent agent’s transcript is gone or unreadable |
the chosen account’s configuration home (CLAUDE_CONFIG_DIR) does not reach its conversation: its projects folder is not the stopped account’s |
the chosen account’s projects holds another file of that name, or none |
The carried agent’s SessionStart hook compares the session it runs in with the one its start’s record names. One that came up in another session acks nothing and records that it began in another conversation, naming no session. flume then ends it once it is quiet and starts the stage afresh. A session Claude Code cannot find ends the program before any hook runs, and flume reads that start as a carried start that did not begin, and starts the stage afresh as well.
flume checks the option text of --resume and --fork-session, where
2.1.322 keeps its projects folder, and its words for a session it
cannot find, against the release its repository pins. flume never
passes --fork-session, so a resumed session keeps its id.
In your own sessions
Section titled “In your own sessions”For /launch and status in your own Claude Code sessions, add flume’s
marketplace and install the plugin from it:
/plugin marketplace add boomdrivedev/flume#release/plugin install flume@flumeThe release branch holds each release’s commit, so the plugin carries
the release’s version: /plugin marketplace update flume, then
/plugin update flume@flume, takes a new one.
/launch <brief>chooses a kind and a name with you, runsflume launch --kind <kind> --name <name> --brief "<brief>" --jsonin the repository, and reports the place, its branch, and whether its first stage started, waits for room or is held. It passes--baseonly when you name a base other than the default branch.- The
flumeMCP server runsflume mcpand serves four tools:status, which answers asflume status --jsondoes and settles nothing; andmessage,launchandwake, each run as the command line runs the same words, every default, check and refusal the command’s, its answer the command’s JSON. A launch takes no file over MCP: its brief is text. Run from a role’s run, a launch naming no recipient reports to the run’s address, so a role’s session launches its projects as places from its tools (a message to a role).
The launching session is the place’s recipient unless the launch names another, so under herdr each end of its stages reaches that session’s pane as a notice.