Regression suites
A regression suite is a named, versioned set of cases that a change to a namespace's memory must not break. A suite belongs to one namespace.
A regression suite is a named, versioned set of cases that a change to a namespace’s
memory must not break. A suite belongs to one namespace. It names the memory keys and key
prefixes it covers and holds the cases: a prompt, and what the answer to it must do. Loom
stores the suite. The job that asks the prompts and grades the answers runs outside Loom
and fetches the suite with knowledge.suites.get.
Only an administrator of the namespace reads or publishes a suite, so the agents under test cannot read the expected answers:
- The three operations need the
adminrole on the namespace. A writer, a viewer and a token narrowed to one user or session are refused. - None of them is an MCP tool, under any toolset, and a call through
loom_opis refused withOP_NOT_ON_MCP. An agent that runs on its developer’s administrator token does not pull a case into its context that way. - Case text is in no memory row, embedding or search index. Search, recall, context packs and exports do not return it.
A token with admin on every namespace (*) reads the cases of every suite of its org.
The operations are
knowledge.suites.publish,
knowledge.suites.get and
knowledge.suites.list. They
are experimental. Regression suites in the
architecture section describes the design.
What a suite holds
| Field | Meaning |
|---|---|
suite |
The name: lower-case letters, digits, _, . and -, at most 64 characters. |
memory_keys |
Exact memory keys the suite covers, at most 200. |
memory_key_prefixes |
Prefixes of memory keys the suite covers, at most 50. A key that starts with a prefix is covered. |
cases |
At most 200 cases. A suite that covers a key holds at least one. |
revision |
Counts from 1. Each publish that changes the suite writes the next revision; a revision is frozen. |
A memory key is covered by at most one suite of its namespace. A publish whose keys or prefixes overlap another suite’s current revision is refused with 409, and the message names the key or prefix and the other suite. A namespace holds at most 200 suites, retired ones included.
A case:
| Field | Meaning |
|---|---|
case_id |
The case’s id in its suite: letters, digits, _, ., : and -, at most 128 characters. Unique in a revision. |
kind |
expect: the answer must show expectation. decline: the agent must decline. must_not_state: the answer must not say withdrawn. |
prompt |
What the job asks the agent, at most 4,000 characters. |
expectation |
The expected behaviour, or the rubric a grader follows, at most 4,000 characters. Required for expect. |
withdrawn |
The statement the answer must not make, at most 2,000 characters. Required for must_not_state and refused on the other kinds. |
origin |
The runs the case was written from: at most 8 entries of namespace and run_id. |
Keep a case’s id when you reword the case: the id is what ties a result on one revision
to a result on the next. An id that starts with draft- is kept for ids the server
issues, so a publish cannot add a case under one. A revision names at most 16 distinct
origin namespaces.
Maintain a suite from a file
A maintainer keeps each suite as a JSON file and publishes it with loom call. The file
is the body of knowledge.suites.publish without org and namespace, which loom call
fills from the session or from --org and --namespace.
Create a suite by publishing a file with expected_revision 0:
{
"suite": "finance",
"expected_revision": 0,
"memory_keys": ["billing/refund-window"],
"memory_key_prefixes": ["billing/plans/"],
"cases": [
{
"case_id": "refund-window",
"kind": "expect",
"prompt": "How long does a customer have to ask for a refund?",
"expectation": "Thirty days from delivery."
},
{
"case_id": "old-refund-window",
"kind": "must_not_state",
"prompt": "Is the refund window fourteen days?",
"withdrawn": "The refund window is fourteen days."
}
]
}
To change a suite, fetch its current revision into a file, edit the file and publish it:
$ loom call knowledge.suites.get suite=finance | jq '{suite: "finance", expected_revision: .revision, memory_keys, memory_key_prefixes, cases}' > suite.json
$ loom call knowledge.suites.publish --data @suite.json | jq -e '.conflict | not'
expected_revision in the file says which revision the file was written on. A publish
answers 200 with one of three outcomes, so a job checks the answer and not only the exit
status of loom call:
| Answer | Meaning |
|---|---|
written: true |
The file is now revision revision. |
written: false |
The file is the current revision already. Nothing was written, and revision is the current one. |
written: false, conflict: true |
Someone published after expected_revision and the file differs from the current revision. Fetch, merge and retry. |
The order of memory_keys, memory_key_prefixes and cases is not part of a revision:
keys and prefixes are stored sorted and without duplicates, and cases sorted by id.
A publish that is refused writes nothing:
| Status | When |
|---|---|
| 422 | Two cases share an id; a case lacks the field its kind needs, or has withdrawn on another kind; the first revision covers nothing; a suite that covers a key has no case; a new case id starts with draft-; an origin entry is added to a case already stored; the namespace is a personal collection. |
| 409 | The selection overlaps another suite’s, or the namespace already holds 200 suites. |
| 503 | Another publish to the namespace’s suites is being saved, or a rolling upgrade is not finished (rule 86). Retry after retry_after_s. |
knowledge.suites.get with revision set reads a past revision, and
knowledge.suites.list lists every suite of the namespace with what it covers and its
number of cases by kind, without case text or ids.
Retire a suite
A suite is not deleted. Publish it with both memory_keys and memory_key_prefixes
empty and it covers nothing: its keys are free for another suite, and its cases may stay
in the file or be removed. Its revisions stay readable.
Origin runs
origin records which runs a case came from. The server sets it when a case id is first
published and keeps it from then on: a later publish may leave the entries out but
cannot add one to a stored case. knowledge.suites.get serves an entry only to a caller
who holds viewer on the entry’s namespace, and only while the run still exists, and
leaves the others out without a marker. Publishing a file as get served it therefore
loses no stored entry and, with nothing else changed, writes nothing.
What others can see
The audit log is read by every reader of the namespace. Each publish is recorded there with the suite’s name, the revision, the number of keys, prefixes and cases by kind, and the length and a keyed hash of the cases, never a case’s id or text. A suite’s name must therefore not carry an expectation.
Storage and erasure
Every revision stays stored, with its case text, until the namespace is erased: a namespace erasure deletes the namespace’s suites. A user’s erasure does not reach a suite, because a case belongs to the namespace and names no user. Do not put a person’s data in a case.