Skip to content
Loom Docs
Esc
↑↓navigate↵open⌘Jpreview
Product
View as Markdown
On this page

Knowledge reports

A knowledge report says that a memory claim or a document is incorrect or outdated, or that the namespace is missing knowledge.

A knowledge report says that a memory claim or a document is incorrect or outdated, or that the namespace is missing knowledge. Agents and clients file one with knowledge.reports.submit when they find the problem while they work. A namespace’s admins are its maintainers: they read the queue with knowledge.reports.list, take a report, ask for evidence, resolve it with the revision that corrected the target, or dismiss it with a reason. A report never edits its target; the fix is an ordinary memory or document write.

Filing a report

A report has a kind (missing, incorrect or outdated), the problem in the reporter’s words, an optional suggested correction and, except for missing knowledge, a target:

Target target_key target_version target_sha256
memory the memory key the memory version the served content hash
document the source URI the revision SHA-256 of its content

A target the reporter did not say they read is stamped with what is there at submit. Evidence is references only, gap:<id>, reflection:<id> or run:<id>, at most 20 distinct ones, never copied text. Each reference, and the report’s run_id, is checked as the caller would read what it points at (server/knowledge/app/report_refs.py): a run of the namespace, the reflection memory at that key under the report’s identity tuple, and a gap of the latest build, which only namespace admins read. A write that cites one the caller cannot read is refused as not found, and a read serves only those the caller can read then. Related reports name other report ids of the namespace, which must exist. The rules are in server/knowledge/domain/reports.py; a broken report is a 422.

The reporter is the person the token stands for, as knowledge gaps count askers (token_person and folded_person in server/knowledge/app/people.py): the token’s end user, else its creator, folded onto one spelling per person. A token no person stands behind, such as an agent’s own account, reports under its own principal. When the directory cannot be read the request is a 503 to retry, and a token tied to two accounts is a 403; neither is filed or matched under another spelling, since the report id and the reporter checks would stop matching once the person folds. Reads and evidence resolve the caller before the report, so neither answer says whether it exists; a namespace admin whose person cannot be folded still reads as a maintainer, unmatched as the reporter. The body’s user_id and agent are the identity tuple of the row, not the reporter.

The caller must be able to read the target: a memory key is read as memory.get reads it under the report’s identity tuple (readable_version in server/memory/app/handlers.py, which serves nothing of the row), a document as knowledge.get reads it. A target the caller cannot read answers 404, as a missing one does.

The report id is a hash of the org, namespace, reporter, kind, target and problem text (whitespace folded), so the same reporter filing the same problem about the same target gets the same report back, with or without an Idempotency-Key. A repeat returns the report as it stands, resolved or dismissed included: a maintainer reopens it.

Reading reports

knowledge.reports.get serves a report to its reporter and to the namespace’s admins; anyone else is answered not found. Every read checks the target again: target_changed is true when its version or hash differs from what the report holds, or it is gone. An admin who cannot read the target now sees the report with target_readable false and without the problem and the correction, since a reporter may quote the target in them; the reporter always sees their own words.

knowledge.reports.list is the admins’ queue, newest change first, filtered by state, kind, target, assignee or reporter. Its rows carry no one’s words: the problem, the correction and the reasons are read one report at a time.

Maintainers’ actions

knowledge.reports.update (admin, audited) applies one action and may link related reports:

Action From To Needs
take any but resolved or dismissed taken sets the assignee
release taken open clears the assignee
request_evidence any but resolved or dismissed needs_evidence a reason
resolve any but resolved or dismissed resolved resolution_revision
dismiss any but resolved or dismissed dismissed a reason
reopen resolved or dismissed open a reason

resolution_revision names the published revision that corrected the target, not a draft or a recommendation: for a report about a memory claim or a document, a revision number newer than the reported one and no newer than what readers are served now, so an unchanged or gone target is not resolved (dismiss it with a reason). expected_version refuses an update made from a stale read (409). A report whose target changed can still be resolved; one whose target is gone can be dismissed.

knowledge.reports.evidence lets the reporter add references to their own report; any other caller is answered not found. A report waiting for evidence goes back to taken when a maintainer holds it, else to open.

Storage

loom.knowledge_reports is a ReplacingMergeTree(version) sorted by (org, namespace, report_id): submit writes version 1 and every change the next version of the whole row, read with FINAL (server/knowledge/store/reports.py). Each change is a read, then a write, under the report’s claim (leases.holding), so two writers never both build on the same version; the second is told to retry (503). Inserts wait for the async insert, so the next read on any replica sees the change.

Every version carries the actor and source_class of the write that made it, stamped by the server from the token (writer_actor, source_class_for(default="asserted")), never from the body: a maintainer’s change names the maintainer, added evidence the reporter. With auth off the writer is the identity’s agent, or - for an update.

Read scope

A token bounded below the namespace (read_scope own_user or own_session) cannot call knowledge.reports.* (NARROW_REFUSED_PREFIXES in server/identity/domain/read_scope.py): the queue and a report hold other people’s words.

Erasure

A user erasure deletes every version of the reports the user filed, as reporter or under their user_id, by the same spellings it erases knowledge gaps with. On the reports the user maintained it clears, in every version, what names them or is their words: the assignee, the writer actor, and a reason with the reason_by that names who wrote it, which later versions carry forward under another writer. The reporter’s words stay (delete_knowledge_reports_by_user in server/erasure/store/steps_ledgers.py). A namespace erasure deletes the namespace’s reports. The residue census counts both scopes.

Each write takes the org’s durable write fence (writer_lease_name in server/knowledge/domain/reports.py), which both report erasure steps take too. Inside it, while an erasure that reaches the report’s namespace, reporter, user or maintainer is unfinished, or has finished since the request started (erasure_since, as knowledge gaps use), submit, update and evidence answer 409 ERASURE_RUNNING. An insert whose outcome is unknown, a cancelled send included, keeps the fence until its send bound passes, so an erasure step never runs before a version that may still land.

Rolling upgrades

An older build’s erasure saga has no step for loom.knowledge_reports, so no report is written while such a replica serves: while any live replica’s schema is below the migration that adds the table, or no heartbeat can be read, submit, update and evidence answer 503 (every_replica_stores_reports in server/knowledge/app/reports.py), as knowledge gaps do (rolling upgrades). Before a rollback, the operator deletes the table’s rows, and again after the first older replica serves.

Dashboard

No dashboard page serves reports: maintainers read and act on them through the API, the SDKs and loom_op (NOT_IN_DASHBOARD in server/operations/dashboard.py).

Last updated on

Was this page helpful?