Govern a memory with a config¶
You will make a memory refuse spec nodes that were not written with its
authoring task, then watch one write get refused, fix it and succeed, and
record a validation result against the finished node. You will need the CLI
for this one. No agent prompt or portal screen sets a memory's config yet:
the portal page is open work (hadron-portal#913) and there is no MCP tool for
it. An agent that can run hadron can run every command below for you, but the
commands are the interface.
What a config is, and why a stored rule is not the same as a checked one, is in
Memory config. Read its
writer levels
section first if you are about to set --writers owner.
How this page was checked
The commands and flags below are taken from the CLI's own help and the
server's schema as merged to main. The local reviewer of this page also ran
the flow on the hosted server, with a CLI built from main, in a throwaway
memory: the previews, the three refusals, a claimed write, a broken task and
its repair, and a recorded result going stale after an edit all behaved as
written. Not run: the UNAVAILABLE preview, a refused human stamp and
removing a locked rule. Try it first in a memory you can throw away, and not
in a customer's memory.
What you need¶
- You manage the memory: you are its owner (a personal or private memory), its user owner, or an organization ADMIN or OWNER. Anyone else cannot read or change its config, and sees the same answer as for a memory that does not exist.
- A runnable task node in a memory you can read, for the authoring
procedure. Below it is
hrn:node:acme.com:kb:tasks:write-spec. A second one,hrn:node:acme.com:kb:tasks:check-spec, validates. hadronv0.61.0 or later. The config commands first shipped in v0.18.0, stating a claim with--authored-withneeds v0.40.0, recording a validation result v0.41.0 and the authoring preview v0.61.0. Runhadron --versionto see yours.
1. Make spec nodes require the task¶
hadron memory config rule add hrn:mem:acme.com:kb spec \
--author-task hrn:node:acme.com:kb:tasks:write-spec \
--validation-task hrn:node:acme.com:kb:tasks:check-spec
This creates the memory's config if it has none, and the rule for the spec
role. Check it back:
A healthy task reference prints its node URN. A reference flagged BROKEN points
at a task node that was deleted, and one flagged UNREADABLE points at a node you
may not read. All of the rule's settings are in
Memory config.
2. Ask before you write¶
Preview what a write would do, without writing anything:
With no claim, the answer is REFUSED with the code
AUTHORING_ATTESTATION_MISSING, the role, and the recovery: the task, its
current revision and the command that loads it. A PASS is a preview, never a
reservation, and never proof the task was followed. An answer of
UNAVAILABLE means you can read the memory but not write it, and it says
nothing about the memory's rules.
3. Write it, get refused, recover¶
Write the node the way you would have before the rule existed:
hadron node create -m hrn:mem:acme.com:kb --loc specs:retries --name "Retries" \
--role spec --content-file retries.md
The server refuses it with AUTHORING_ATTESTATION_MISSING and, because you can
read the task, tells you the task, its revision and how to load it. Read the
task and follow it. Then say which task and revision you wrote with:
hadron node create -m hrn:mem:acme.com:kb --loc specs:retries --name "Retries" \
--role spec --content-file retries.md \
--authored-with hrn:node:acme.com:kb:tasks:write-spec --authored-revision 7
You pass both flags or neither. The node now carries a task stamp. Read it with
hadron node get, which prints the authorship: line.
This records your claim, it does not prove it
The stamp means you reported the right task and revision. It does not show you read or followed the task. See Attested authorship.
4. When the task has moved on: a stale revision¶
Someone edits the authoring task, so its revision is now 8. Your next write
still says 7 and is refused with AUTHORING_ATTESTATION_STALE. Nothing is
written. The refusal names the current revision. Read the task again, which is
the point of the check, then retry with the new number:
hadron node authoring-check specs:retries -m hrn:mem:acme.com:kb --role spec \
--authored-with hrn:node:acme.com:kb:tasks:write-spec --authored-revision 8
hadron node update specs:retries -m hrn:mem:acme.com:kb --content-file retries.md \
--authored-with hrn:node:acme.com:kb:tasks:write-spec --authored-revision 8
A write that names a different task than the rule is refused with
AUTHORING_ATTESTATION_WRONG_TASK.
5. When you cannot read the task¶
A writer who cannot read the authoring task is refused even when the claim is exactly right, and is told only that an owner must fix access or the rule. The message names no task and no revision, and it reads the same whether the task is missing, deleted or just closed to you. Do not guess a task or a revision. Ask the memory's manager to grant you read access to the task, or to repoint the rule.
If the manager sees BROKEN in hadron memory config get, the task node was
deleted. Every write that depends on that rule is refused until they recreate
the task or point the rule at another runnable task node:
hadron memory config rule update hrn:mem:acme.com:kb spec \
--author-task hrn:node:acme.com:kb:tasks:write-spec-v2
A broken reference stops writes. That is deliberate. A validation result that is merely old or failed does not stop anything.
6. Record a validation result¶
Running the validation task is up to you or your agent: nothing runs it automatically. When you have the result, record it against the node's current revision:
hadron node validation record specs:retries -m hrn:mem:acme.com:kb \
--outcome PASS --run-id check-retries-1
The command reads the node's and the task's current revisions, so record before
either changes. The server works out who is reporting, and refuses the author the
node's stamp names (a person who wrote it as themselves, or a run of the author
task). Anyone else's report is accepted, and notes whether the author could be
compared. The --run-id makes a retry safe: the same id from
the same reporter for the same revisions is answered as a replay. Then read the
node:
validation: shows PASS for this revision. Edit the node and it becomes
STALE, because the result was for the earlier revision. The result is advice
and never blocks a write.
Put the same rules on many memories¶
If you keep a template, you can copy it into several memories at once. Pass the memories on the command line or in a file, and preview first:
The report has one entry per memory. A failure in one does not undo the ones that worked, and the command exits 1 when any entry failed. Retry only the failed ones. Bulk apply lists every case, including what not to rerun.
Undo it¶
Remove the rule and the memory is ungoverned again:
A rule that a required template locked refuses this until someone with lock
authority runs hadron memory config rule unlock.
Related¶
- Memory config: how a memory governs how it is written explains the rules, writer levels, templates and what is stored but not yet enforced.
- Attested authorship: who wrote this revision explains the stamps this page produces and what they do not prove.
- Memory config commands and Stating which task you authored with are the exact syntax.