Update all boot prompts of an agent team¶
After you change a shared include or a role's boot-prompt source, every agent and worker that builds on it needs a fresh compiled prompt before it sees the change. This page gets the whole team there in one pass: role agents first, then the App's workers, then a check of what each one is now served.
You will need the CLI for this one. Compiling and approving boot prompts has no MCP tool and no portal screen, and a worker session is refused (see Who may run it). You run it from a plain shell, signed in as a person who manages the Agents and the App.
What was run for this page
Checked against CLI 0.59.0. The help text of every command here was
read, and the read-only commands were run against a live team: the
team worker compile dry run, the team worker approve preview,
agent list --json, node revision list and node get --json. A QA
reader then ran the write steps (compile, approve, pointer) and both shell
loops on a disposable stack. Not run, and so not confirmed here:
--as-worker and grants, signing, the tampered case, REVISION_MISMATCH
in team worker approve --apply, exits 7 and 8, a successful
agent revision restore, --all and --only, and include order.
Which prompt a worker is served¶
A worker is served the newest approved revision of the first of these that exists:
- the worker's own compiled prompt;
- else the App install's compiled prompt for its Agent;
- else the Agent's own pointer.
A QA run on a disposable stack confirmed the install level: an unapproved
install-level compile was refused, an approved one was served at the App level,
and a read without --app still served the Agent level
(hadron-docs#843).
The order itself is the one in cor:agt:040:07, still marked Proposed.
So a change to a role agent's source reaches only the workers that have no
prompt of their own and whose App has no compiled prompt of its own for that
Agent (the install level, below). A worker that has its own source keeps its old text until
that worker is recompiled and approved. On the reading in cor:agt:040:05 (still marked Proposed), a prompt is handed
over once, when the worker binds, so a running worker would see the new text at
its next bind or shed.
A compile writes a new revision but approves nothing, and what is served is
the newest approved revision (the CLI's own wording). Between a compile and
its approval, workers keep being served the last approved revision. A node that
has never had a revision approved is refused with BOOT_PROMPT_NOT_APPROVED
instead. A compile also sets the pointer by default, which only names the node
to serve; it does not make the new text served.
Who may run it¶
Writing a boot prompt is refused for a worker session
(BOOT_PROMPT_WORKER_SESSION_REFUSED, exit 8). Run every command below from a
plain shell, signed in as a person who manages the Agent or the App. By default
the commands act as you and send no worker-session header, but the server
refuses a boot-prompt write that arrives under a worker session. The one way a
worker session may write is the batch route described next.
The batch route, for a worker acting under a grant. --as-worker on the
compile and approve commands sends the bound worker session instead of you. The
server then admits only a signed bootprompt.compile.approve grant's targets:
a new revision of an existing compiled node the grant names, never a new
node, and never a pointer. It does not fall back to you; without a usable
binding it refuses (exit 2) and sends nothing. The CLI does not check the grant,
and the server's refusals print with their codes (exit 8). This route was not
run for this page.
Signing. Where your organization requires signed boot prompts, a person
still signs each compiled prompt, and no grant covers that (signing was not
exercised for this page; the sentence is from the CLI help). See
Require signed boot prompts. Until it is
signed, a serve is refused with BOOT_PROMPT_NOT_SIGNED.
Step 1: role agents, one at a time¶
There is no team-wide command for role agents. For each one, three things happen, and each is a separate step:
hadron agent compile <agent>compiles the agent'sboot:sourceinto itsboot:compilednode. It sets the agent's pointer by default. Pass--no-set-pointerto leave the pointer alone.- You read the new text, then
hadron node approve <compiled node> --revision <N>approves exactly the revision you read. - Only if the pointer is not already on that node:
hadron agent set-boot-prompt <agent> <compiled node>.
Decide which agents the change reaches, and write their URNs to a file, one per
line. hadron agent list shows the agents you can see, which is wider than
the agents you manage and the agents the change touches, and every compile
writes a revision. Narrow the list by hand:
hadron agent list --org <org-id> --json |
jq -r '.[] | select(.bootPromptRef != null) | .urn' > candidates.txt
bootPromptRef is set on agents that already have a boot-prompt pointer. Copy
into agents.txt only the URNs your change reaches, one per line. There is no
dry run for a role-agent compile, so this list is your dry run.
Before you compile, save the text each agent in agents.txt is served now, so
you have something to compare against (node revision get may not answer, see
below). agent boot-prompt prints what a serve would give right now, which is
the approved text, not merely the latest revision:
while read -r agent; do
f="before-${agent//[^A-Za-z0-9]/_}.md"
if hadron agent boot-prompt "$agent" --json </dev/null | jq -er .text > "$f"; then
:
else
echo "no served prompt for $agent: no baseline saved" >&2; rm -f "$f"
fi
done < agents.txt
Then compile each agent in the file and keep a record of what was written.
--json prints compiledNodeRef and revision. An agent with no boot:source
is refused (exit 5), and one you do not manage is refused (exit 8); the loop
reports both and moves on:
while read -r agent; do
out=$(hadron agent compile "$agent" --json </dev/null); rc=$?
node=$(jq -r '.compiledNodeRef // empty' <<<"$out" 2>/dev/null)
if [ "$rc" -eq 0 ] && [ -n "$node" ]; then
printf '%s\t%s\t%s\n' "$agent" "$node" "$(jq -r .revision <<<"$out")"
else
echo "not compiled: $agent (exit $rc)" >&2
fi
done < agents.txt | tee compiled.tsv
Each compile sends one mutation and the CLI never retries it. A lost response
is exit 7: read the node with hadron node get <node> --json and look at its
revision before you compile that agent again.
Read what changed before you approve¶
compiled.tsv now holds a node and a revision for each agent. Read each one
before approving. hadron node revision list <compiled node> lists the node's
earlier versions, newest first, and hadron node revision get <revision-id>
shows one. The simplest comparison needs neither: diff the before-<agent>.md
you saved (the matching before-*.md file, the text served before) against the new text from
hadron node get <compiled node> --body-only, using the node in compiled.tsv.
If node revision get is refused
With CLI 0.59.0, node revision get answered "the server rejected a query
this hadron build sends — the CLI and server schema versions are out of
sync". The server had renamed an argument and the CLI's matching fix
(hadron-cli#3095)
came after that release, so you need a CLI newer than 0.59.0. node revision
list and node get were not affected.
When you are satisfied, approve each compiled revision exactly as you read it:
while IFS=$'\t' read -r agent node rev; do
hadron node approve "$node" --revision "$rev" </dev/null || echo "not approved: $agent" >&2
done < compiled.tsv
--revision refuses the approval if the node changed since you saw it. Without
it, the server approves whatever is current at that moment. A later change to
the node's title, abstract or content supersedes the approval; a change to tags,
properties, role, description, alias, loc or edges does not.
Step 2: the App's workers¶
Workers have their own commands, which work on a whole App at a time. Pass the
App with --app.
Compile. With no worker named, team worker compile is a dry run:
It lists each worker as "to compile" (toCompile in --json; a source changed, or it has no compiled
prompt yet), unchanged, or unknown, with a count at the top. Nothing is
written. RECOMPILE_AVAILABLE marks a worker whose own source, or an include
it uses, changed since its last compile. A worker with no source of its own is
skipped at --apply, which is the normal case.
Two flags change which workers are picked:
--all(not run for this page) compiles every live worker, changed or not. Use it after adding a new install-memory override, because that is the one change the staleness check cannot see.--only Iris,Theo(not run for this page) limits the run to those workers. A name that is not a live worker in the App is refused before anything is written.
After --apply, each worker is reported as compiled (with its revision and
the node approve line to run), skipped (BOOT_PROMPT_NO_SOURCE or
BOOT_PROMPT_TARGET_RETIRED), failed (with its server code) or unknown (the
response was lost; one read says whether a revision landed, and the compile is
never sent twice). The batch never approves.
Approve. team worker approve previews first:
hadron team worker approve --app acme.com:eng-team
hadron team worker approve --app acme.com:eng-team --apply
The preview lists each worker as to approve, already approved, tampered, skipped
or unknown, with the compiled node and revision. --apply approves the
to-approve workers in roster order, each pinned to the revision the preview
read. If a worker's prompt changed since, that worker is refused
REVISION_MISMATCH (exit 5): run the preview again. A refusal for one worker
does not stop the others, and an approval already made stands if a later one
fails, since each is its own transaction.
This command covers only workers with their own compiled prompt. It does not
approve a prompt at the App-install level or the Agent level; those are Step 1
and the install level below. A row marked
tampered means the server's integrity check (verifyNode) found that the
text no longer matches what was approved. It is an integrity finding to
investigate, never approved in a batch, and it makes the run exit 5. Find out who
changed it and read the current text first: approving it on its own with
node approve <node> --revision <N> accepts that text as it stands.
After each approval the command reads once what a serve would give that worker
and prints it, for example "a serve now would give rev N" or "would be refused:
BOOT_PROMPT_NOT_SIGNED". That is a snapshot, not a promise for the next bind.
Do it in this order¶
- Role agents: compile, approve, pointer.
- The App install, if you customised an Agent for the App: compile, approve.
- Workers: compile, approve.
- Sign, where your organization requires it: a person signs each compiled prompt, after the approval and before you expect a serve to succeed.
A compile resolves each include when it runs and writes the result into the compiled node, so a worker's compiled text holds the role text as it was at that compile (include order was not exercised for this page). That matters only when the worker's source includes the role's compiled node: then compiling the role first gives the worker the new text, and compiling the worker first gives it the old. A worker source that does not include the role's compiled node is unaffected by the order. Role agents first is therefore the safe order, not a rule that every worker needs it. A compile also writes a revision even when the text is unchanged, so compile only what you need: the dry run and the staleness marks exist for that.
A third level: the App install¶
hadron app agent compile <app> <agent> compiles the App's own version of
an Agent, kept in the App's install memory. Use it when you customised an
Agent for one App (Customize an installed Agent),
because the App-level prompt is served to every worker in the App that has no
prompt of its own. It sets the pointer by default and has no --no-set-pointer.
You approve it with node approve, as in Step 1.
Check what is served¶
For workers, the team worker approve --apply run already prints, per worker,
what a serve would give right after its approval. To check a worker later, or a
role agent, use agent boot-prompt below with --app; it answers per Agent, so
a worker with its own prompt is best checked from that approve line.
hadron agent boot-prompt <agent> --app <app> prints what a chat in that App
would be given now, as a first line served boot prompt: <LEVEL> <node> revision
<N> followed by the text. Compare it with what you meant to ship. Without
--app it shows only what the Agent's own pointer would serve. It binds no
worker and records nothing.
When something is wrong, the refusal is a typed code:
| Code | Means |
|---|---|
BOOT_PROMPT_NOT_SET |
No pointer names a compiled node. |
BOOT_PROMPT_NOT_APPROVED |
The newest revision is not approved. Approve it. |
BOOT_PROMPT_NOT_SIGNED |
Your organization requires signing and a person has not signed it. |
BOOT_PROMPT_TARGET_DELETED |
The pointer names a node that is gone. |
The full serve rules are in Serve a boot prompt.
Roll back¶
Three ways exist; the first two are untried for this page, so check them against
--help on your CLI before you rely on them:
- Put the previous source back, then recompile and approve. Restore the
source node's earlier revision (
hadron node revision restore), then repeat Step 1 or Step 2 for the affected agents. - Restore the Agent's earlier saved state (not run to success for this page) with
hadron agent revision restore <agent> <revision-loc>. This replaces the Agent's whole live system memory, not only the boot prompt, first saving its present state as a new revision, and can be refused when the Agent's revision slots are full (REVISION_SLOTS_EXHAUSTED). Afterwards, readagent boot-promptand do not assume the restored text is approved or signed: recompile, approve and sign where needed.agent revision list <agent>shows each saved revision's loc and how many saves are left, not its content, so you cannot read a revision before restoring it. A restore first saves the present state as a new revision, so you can restore back to it, at the cost of a save slot each time. - Clear the pointer:
hadron agent set-boot-prompt <agent> --clear. The Agent then has no boot prompt of its own, which stops serves that depended on it, so use it to stop rather than to revert.
When it goes wrong¶
The exit codes below come from the CLI help. The QA run did not provoke exits 5, 7 or 8 here, so treat them as documented, not observed.
- Compile exit 4, an include. A moved or renamed include node breaks every source that includes it. A missing and an unreadable include give the same answer. Put the node back or fix the include.
- Compile exit 2. A malformed include, or one the compile may not read.
- Compile exit 5. A retired target, a missing or invalid source, an unavailable include revision, or a conflict.
- Exit 8. A permission or grant refusal. Check who you are signed in as, and whether you are in a worker session.
- Exit 7. A lost response. Read the node with
node getand check itsrevisionbefore compiling again. - Approved, but the text is old. The approval was superseded by a change to
the node's title, abstract or content, or a worker has its own prompt. Check
agent boot-promptwith--app.
What the specs say¶
This page describes what the CLI does and must not contradict these rules (read
one with hadron spec get <citation>). Where a rule is still marked
Proposed, this page states only what the CLI did, not the rule as settled
law. The batch-grant and pointer details in the compile operation are Proposed,
and the bootprompt.compile.approve grant has no spec of its own: it is
described inside the rules on who edits and who compiles.
cor:agt:040:05: what a boot prompt is, source versus compiled node.cor:agt:040:07: pointers, in the order Worker, then AppAgent, then Agent.cor:agt:040:12: compile, and who may compile.cor:agt:040:11: who edits a boot prompt; the worker-session refusal.cor:agt:040:18: who approves a boot prompt.cor:agt:040:09withcor:dmo:130:09: approval, and signing where it is on.cor:agt:040:10: when a bind, chat or run is refused.cor:agt:040:08andcor:dmo:150:07: what a boot prompt may include.
Related¶
- How includes work: why a change to one node reaches many prompts.
- How an Agent inherits from a base
- Compile a boot prompt: the three mutations and every refusal.
- Boot-prompt pointers
- Customize an installed Agent for your App
- Require signed boot prompts