Memory config: how a memory governs how it is written¶
A memory can insist that certain kinds of node are written the same way every time: through a named procedure, by a named group of people, and with a record of which procedure was used. Its config is where that insistence lives. You set it once for the memory; after that, anyone or anything writing to the memory is held to it, and a writer who falls short is told exactly what to do next.
The config is set from the CLI today. The portal does not manage it yet (hadron-portal#913 is open), and no MCP tool changes it. The task steps are in Govern a memory with a config; this page is the picture behind them.
The reason to have one is integrity. A memory is only as trustworthy as the route its content took, and a config makes the right route the one the server checks for. It does not make the content correct: see what a config does not do.
What is in a config¶
A memory has at most one config, and it holds rules. Each rule governs
one role, the label a node carries to say what kind of node it is (spec,
task, runbook). A memory that has never had a rule reads as an empty config.
The first rule you write creates it.
A role is written in lower-case letters, digits and dashes, with dots between
segments, 1 to 64 characters long: spec, or spec.rule. The dots make a
family. spec.rule is a sub-role of spec.
A rule can carry:
| Setting | What it does |
|---|---|
| Author task | The runnable task a writer must have used to write nodes of this role. A write has to say which task, and which revision of it. |
| Validation task | The runnable task that checks nodes of this role. |
| Description node | A node documenting the role. Documentation only: if it is deleted the rule is unaffected. |
| Writers | Who may write nodes of this role: all, admin or owner. |
| Validate by | Whether an agent or the platform is meant to run the validation task. |
| Strict sub-roles | Whether the role's undeclared sub-roles are refused. |
| Enabled | Whether the rule applies at all. |
Task and description references are stored by node, so moving the node does not break the rule.
A config is stored, then enforced. Every setting can be stored as soon as
you set it, even one whose enforcement has not shipped. Storing a setting is
therefore not evidence it is enforced; the table in
what is built lists what does
something today. The author task and the writer level are enforced when a node
is written. The validation task is used to record results, and validate by is
stored but nothing yet acts on it.
Roles and their families¶
A node's role picks its rule by nearest declared ancestor. If spec.rule
has a rule, a spec.rule node follows it. If it does not, the node follows the
rule for spec. A rule need not carry any task: it can exist only to
declare a sub-role.
Strict sub-roles sits on the parent rule and governs only that role's
family. With it off, an undeclared spec.foo falls back to the spec
rule. With it on, an undeclared spec.foo is refused, so only declared
sub-roles can exist. Roles outside the family, such as runbook, are
unaffected either way.
Who may write: the three levels¶
The writers setting is a second gate on top of write access to the memory.
It never grants access the memory does not already give. It is judged against
the role a node has before the write and the role it will have after, so
creating, changing and clearing a role all need the level. A write below the
level is refused with ROLE_WRITER_LEVEL_REQUIRED.
all: anyone who may write the memory.admin: the owning organization's ADMINs and OWNERs, and the owning user.owner: the owning party more broadly. That is the owning user, the owning organization's contributors, ADMINs and OWNERs, a platform admin, and an App that carries one of the owner's Agents.
An App publisher writes at owner level
The last owner case is a consequence worth planning around. It is judged
from live rows at the moment of the write: the App is active, and has an
installed Agent that is not deleted and belongs to the owning organization
(or, for a user-owned memory, to the owning user). The App itself may belong
to a different organization, and one such Agent is enough. The App still
needs write access to the memory, which the owner controls.
So someone outside the owning organization who can drive an App that
carries the owner's Agent writes at owner level through that App. A
headless run is judged as its App, never as the person who started it.
A share grantee, a subscriber organization and an App that carries only
other organizations' Agents are not in the owner level.
Templates: reusable rulebooks, copied¶
A template is a reusable set of rules. It has exactly one owner: the Hadron server, an organization, a user or an App. Applying a template copies its rules into a memory's config. The copy is never a live link, so changing or deleting the template later does not change memories it was applied to. A rule remembers which template it came from, for provenance only.
Two flags change how a template behaves:
- Required. Rules copied from a required template are locked. A locked rule refuses every ordinary edit and delete, for every caller, until someone with lock authority unlocks it. That is an organization ADMIN or OWNER, or the manager of a personal or private memory, or of a memory that belongs to no organization. Unlocking is a deliberate step that records who took it. A required template also overwrites a rule the memory already had, where an ordinary template leaves an existing rule alone.
- Org default. An organization's template can be marked to apply to every new knowledge or group memory the organization creates, once, at creation. A default rule whose reference was deleted, is unreadable to the organization or is not a task never fails the creation. In an ordinary default the rule is skipped and listed for the memory's managers. In a required default the rule is planted anyway, locked and broken, so writes of that role are refused until a manager repoints it (hadron-server#3426). Only the organization's own new knowledge and group memories get defaults. Cloning, Apps and agents do not, and a default is a starting configuration, not a boundary.
The apply report says, per rule, whether it was applied, replaced, or skipped because the memory already had one or because the rule was locked. A skip is part of the report, not a failure. Cloning a memory carries its rulebook with it.
Copying a memory copies its rules, but only a clone¶
A config is stored with the memory, not inside its notes, so what a copy does with it depends on how you copy. A clone brings the rules with it, including locked ones, so the copy is governed the way the original was. Exporting the notes to files, syncing with a git repository, extracting a branch or merging one memory into another does not carry the config. A backup made by export or git is a backup of the content only.
A clone can also arrive with a rule that now refuses everything. A task the cloner cannot read is cleared from the rule, and the rule stays required, so writes are refused until a manager repoints it. That is deliberate: a copy should never end up quietly more open than the original. The exact behaviour is in the CLI reference.
The six rulings that shape the contract¶
These were settled by the product owner (hadron-server#1325). They are named H1 to H6 in the engineering record. Each describes behavior you will meet.
- H1: rows declare sub-roles. A rule can exist only to declare a sub-role, and strictness sits on the parent. See roles and their families.
- H2: store everything before enforcing it. No setting is refused because its enforcement has not shipped. There is no "not yet enforced" error.
- H3: personal and private memories answer to the owner alone. For these, managing the config is the memory's strict owner only. Organization admins are not admitted, although they can do other things to such a memory.
- H4: one config per memory, and only its managers read it. The config and its templates are read through the API only by the people who manage them. Being able to read the memory is not enough, and to everyone else the config looks like a memory that does not exist. Enforcement is unaffected, because the server reads the config itself for every writer. A writer from outside learns what they need from the refusal, not from the config: see When a write is refused.
- H5: a broken reference fails closed. If a rule's task reference is broken (the task node or its memory was deleted), every operation that relies on that rule is refused until a manager points the rule at a working task. A broken configuration is treated as a compromised one. This is different from a validation result that is merely stale or failed, which stays advisory: see content validation.
- H6: server-owned templates need the server's own record. Creating a template owned by the server refuses with a typed error when this server has no record of itself, rather than creating a template that points nowhere.
Content validation¶
A rule can name a validation task. It is a different thing from the validation a server does to check that a write is well-formed.
- Platform validation is the server checking a request: a malformed role, a stale revision, a missing field. It runs on every write and refuses bad input.
- Content validation asks whether what the content says is any good, judged by a task, ideally in a context separate from the author's. Its result is an advisory note bound to one exact revision of one node, and it never blocks a write.
The rule's validate by setting names who is meant to run it: an agent, in
a separate context from the author, or the platform, asynchronously. Those
two modes are the design. Nothing runs validation yet. The setting is stored
and the server acts on nothing in it. What is built is the recording side:
a validation task's result can be filed against one exact revision, with the
reporter worked out by the server. The author the node's stamp names is
refused as reporter: a person who wrote it as themselves, or a run of its
author task. Anyone else's report is accepted, and it records whether the
author could be compared (CHECKED) or not (AUTHOR_UNKNOWN, for example when
the node has no stamp).
A PASS, FAIL or ERROR therefore exists only if something recorded one.
Attested authorship describes the
stamp and how a result goes stale.
What it does not do¶
- A config does not prove content follows a procedure. The author-task check compares what the writer says against the rule. It catches forgetting and out-of-date procedures. It does not catch a writer who reports a task they did not follow.
- A stored rule is not an enforced rule. Check the built and not-built lists before relying on a setting.
- A config does not retroactively invalidate anything. Content written before a rule existed keeps what it had, and an older revision keeps the stamp it was written with.
Related¶
- Attested authorship: who wrote this revision is the stamp a governed write leaves, and the list of what is built.
- Govern a memory with a config walks through setting a rule, a refused write and its recovery.
- Memory config commands is the exact syntax of every flag.
- Understanding memory explains what a memory and a node are.