---
title: Namespaces and sharing
description: Use namespaces, roles and scoped credentials to give each AI agent access to the shared memories it needs.
seo:
  title: Access controls for shared agent memory
lastModified: '2026-12-06T05:01:52.000Z'
---

A namespace is the unit of isolation and sharing inside an org. Every read is scoped to `(org, namespace)`, every
grant names one, and every per-namespace setting (conflict policy, retention, retrieval defaults, reranker) lives on
its row in `loom.namespaces`. The identity model is in
[identities and namespaces](/docs/concepts/identities-and-namespaces).

## Registering a namespace

`namespace.register` creates the registry row and makes the caller its admin. Any principal may call it (viewer);
re-registering an existing namespace needs admin. A name with no row that already holds data or a live grant is
refused unless the caller is already its admin ([what a new name may
claim](/docs/architecture/security#what-a-new-name-may-claim)). With `LOOM_NAMESPACE_AUTOREGISTER_ENABLED` on
(default), a first write into a namespace with no row registers it, with the token subject as owner (no owner when
the name is already in use or the token is of another org, as a platform administrator's is) and `retention_days = 0`.
That owner may complete the registration while nobody else holds a live grant on the name.

Re-registering is a partial update: an omitted field keeps its stored value. `tags` is replaced whole. For
`conflict_threshold`, `capture_generation_io` and `coverage_sweep`, omitted keeps the stored choice and an explicit
`null` returns to the server default. The namespace's **Settings** in the [dashboard](/docs/features/dashboard) set
`proposal_policy`, `coverage_sweep` and `curator_mode` too.

| Field                                                           | What it controls                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `kind`                                                          | `memory`, `code` (one indexed repo and branch; read-only reference data) or `bench` (a throwaway harness namespace the GC erases once idle). Omitted on a fresh row, the name decides: a `LOOM_NAMESPACE_BENCH_PREFIXES` prefix is `bench`, anything else `memory`, as on a first write.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `visibility`, `join_policy`, `requires_approval`                | Who can find and join it: `private` (members only) or `public` (listed by `namespace.browse`); `join_policy` `open`, `approval`, `closed` or `inherit`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `default_conflict_policy`                                       | `auto_reinforce` (default), `manual_review`, `newest_wins` or `append_only` — how a write is judged against its peers. See [conflicts and refusal](/docs/features/memory/conflicts-and-refusal).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `conflict_threshold`                                            | The cosine at which a close write is a conflict; an explicit `null` inherits `LOOM_CONFLICT_THRESHOLD`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `proposal_policy`                                               | The graded-run thresholds for facts on trial: pass counts mark one ready for a person to review, and under an owner-set `auto`, `run.grade` rejects one at `reject_after_fails` failed graded runs. No policy accepts one: a human administrator who is not its proposer does. See [writing memory](/docs/features/memory/writing).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `retrieval_defaults`                                            | What an unpinned `memory.search` runs with (`search_mode`, `top_k`, `min_similarity`, `floor_mode`, `recency_pool_weight`, …); `{}` clears it. See [search and ask](/docs/features/memory/search-and-ask).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `rerank_endpoint`, `classify_endpoint`                          | Optional reranker (a builtin or a `LOOM_RERANK_ENDPOINTS_JSON` name, never a URL) and classifier URL (https at a public address, or a host `LOOM_MEMORY_CLASSIFY_PRIVATE_HOSTS` names; at a `LOOM_INFERENCE_GATEWAY_HOSTS` host while the gateway is required; at a listed gateway host, https at the default port even while it is not), with their prompt templates. Both fail open, except that a gateway refusal of the call's identity fails the write.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `retention_days`, `warm_days`, `tag_registry`                   | Namespace retention and tiering, and per-type retention / dedup thresholds. `0` keeps forever. See [retention and erasure](/docs/features/memory/retention-and-erasure).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `conversation_logging_enabled`, `capture_generation_io`         | Consent for storing transcripts, and for sending prompt and completion text to Langfuse. Both opt-in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `consolidation_enabled`, `daily_cost_cap_usd`, `coverage_sweep` | Background consolidation, the namespace's upstream spend cap, and the extraction coverage sweep.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `curator_mode`                                                  | Whether the curator's scheduled pass reads the namespace: `off` (the default), `findings`, which reports what `curator.status` reports and calls no model, or `assist`, which also asks a model whether each pending proposal fits the namespace's guide. In this mode the curator sends content of this namespace to the deployment's model provider: the namespace's guide and the text of each pending proposal of its shared scope that is not marked `high`, cut to 2,000 characters. Only a shared memory namespace takes `findings` or `assist`: a person's own namespace and a namespace of another kind take `off`. A pass also needs the deployment's own switch: `curator.status` lists [what the curator needs](/docs/architecture/curator#what-the-curator-needs) in the namespace, whether each is met and who can change it. See [the namespace's mode](/docs/architecture/curator#the-namespaces-mode). |

```python
from loom import Agent

async with Agent(org="acme", namespace="eng-tooling", agent="setup") as agent:
    await agent.namespaces.register(
        owner_email="platform@acme.example",
        description="Shared memory for the build tooling agents",
        visibility="public",
        default_conflict_policy="newest_wins",
        retrieval_defaults={"search_mode": "hybrid", "top_k": 8},
    )
    # Fields the SDK method does not take go through Agent.call:
    await agent.call(
        "namespace.register",
        owner_email="platform@acme.example",
        join_policy="approval",
        daily_cost_cap_usd=5.0,
    )
```

`namespace.delete` (admin) marks the row inactive and stops accepting writes; it does not
touch the data. To remove the data, run an erasure first
(`erasure.request(scope_type="namespace")`, see
[retention and erasure](/docs/features/memory/retention-and-erasure)). `namespace.register` with
`active=true` reactivates it.

## Membership and grants

A grant gives a subject (a person's login handle, the verified email of an SSO or linked
account, or a service account `sa:<name>`) a role on one namespace: `viewer` reads,
`writer` writes, `admin` manages grants and settings. The token carries the org and the
namespaces it may reach; the grant table decides the role. A platform admin reaches
every standard namespace without either ([the gate](/docs/architecture/security#the-gate)).

| Operation                                                            | Role      | Does                                                                                                                                                   |
| -------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `grants.create`                                                      | admin     | Grant a role. A create below the subject's current role is refused with 409 `GRANT_WOULD_DOWNGRADE` unless `replace=true`.                             |
| `grants.list`                                                        | viewer    | Who has access, at which role, and any `pending_role`.                                                                                                 |
| `grants.revoke`                                                      | admin     | Remove a grant.                                                                                                                                        |
| `grants.approve`                                                     | admin     | Approve or reject a pending request, optionally with a different role.                                                                                 |
| `grants.pending_for_me`                                              | viewer    | Every pending request in the namespaces the caller administers, org-wide.                                                                              |
| `namespace.browse`                                                   | viewer    | Public namespaces in the org, never a collection (`closed` ones only with `include_closed`).                                                           |
| `namespace.join`                                                     | viewer    | Self-join a public namespace. `viewer` is granted at once; a `writer` or `admin` request always lands pending, with no access until an admin approves. |
| `namespace.leave`, `namespace.cancel_request`, `namespace.mark_seen` | viewer    | Drop one's own grant, withdraw a pending request, acknowledge an invitation.                                                                           |
| `namespace.list_mine`                                                | viewer    | The namespaces the caller belongs to, each with its `kind` (`collection` for a collection) and `title`.                                                |
| `namespace.list`                                                     | org admin | Every namespace in the org.                                                                                                                            |

Minting tokens, service accounts, read scopes and restricted namespaces are covered in
the [tokens and grants guide](/docs/guides/tokens-and-grants).

## Sharing facts across agents and namespaces

For repository agents that share reviewed team rules, see the [repository sharing exercise](/docs/use-cases/agent-memory#share-memory-across-repositories).

Inside a namespace every writer's rows are visible to every reader by default
(`agent="*"`). Crossing a boundary is always a copy with lineage, never a shared row:

| Operation              | Role                 | Does                                                                                                                                                                      |
| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `memory.promote`       | admin                | Copy a private memory into the namespace's shared layer (`loom.shared`), readable with `memory.search(scope="shared")`. Reversible for `reversible_for_days` (default 7). |
| `memory.demote`        | admin                | Tombstone the shared copy and its embedding; `was_reversible` says whether it was inside the window.                                                                      |
| `memory.copy_to`       | writer on the target | Self-service copy of a memory you can read into a namespace you can write, by key. Non-destructive; the target is re-embedded by its own embedder.                        |
| `memory.cross_promote` | admin on both ends   | The operator form, addressed by memory id, with `cross_promoted_from_*` lineage on the target.                                                                            |

`memory.copy_to` reads the source row by key and records the caller as the copy's actor, so it needs a signed-in
caller: with `LOOM_AUTH_REQUIRED=true` and a token that reads the source and writes the target. The stock single-user
stack refuses it. The Python SDK reaches it through `agent.client`:

```python
from loom import Agent
from loom.errors import NotFound

async with Agent(org="acme", namespace="support", agent="triage-bot") as agent:
    try:
        result = await agent.client.memory.copy_to(
            from_org="acme",
            from_namespace="support",
            memory_key="customer/4812/plan",
            to_namespace="billing",
            rationale="Billing checks invoices against this plan.",
        )
    except NotFound:
        ...  # no live row under that key in the source namespace
    else:
        print(result["copied"], result["target_key"])  # True customer/4812/plan
```

The copy keeps the source key unless `target_key` names another, and it is namespace-owned in the target
(`target_agent="-"`) unless you name an agent. `from_agent="*"` (the default) copies the most recently written row
for the key. The rationale is not stored as text: the audit row keeps its SHA-256 and length.

Copies are not atomic across namespaces: a copy that fails
halfway leaves the source intact and the target without the row. The learnings queue
(`learnings.*`), which proposes rows worth promoting, is covered in
[procedures and learnings](/docs/features/memory/procedures-and-learnings).

### Copy rules

A copy rule is a namespace's saved criteria for copying memories into it from another
namespace of the same org. It is stored in the namespace it writes into, so that
namespace's viewers see what feeds it and its administrators can delete it. A stored rule
copies nothing: it records a source, conditions and an owner. A preview shows what it
would propose, and its owner runs it to propose each new match for another administrator
to decide.

| Operation                 | Role   | Does                                                                                    |
| ------------------------- | ------ | --------------------------------------------------------------------------------------- |
| `memory.copy_rule.set`    | writer | Save a rule, or replace your own. The whole rule is sent each time.                     |
| `memory.copy_rule.list`   | viewer | List the namespace's rules, or the one named by `rule_id`.                              |
| `memory.copy_rule.delete` | writer | Delete a rule: its owner, or an administrator of the namespace. No memory is deleted.   |
| `memory.copy_rule.run`    | writer | Preview what a rule would propose, memory by memory. With `dry_run: false`, propose it. |

A rule stores:

- `rule_id`: lowercase letters, digits, `_` and `-`, at most 64 characters.
- `from_namespace`: the source, which the person saving the rule must be able to read. A
  rule keeps its source; to read another namespace, delete the rule and save a new one.
- `conditions`: `memory_type`, `key_prefix`, `tags_all`, `tags_any`, `pinned` and
  `verified` select memories, and `updated_within_days` and `agent` narrow the selection.
  All of them must hold, a rule needs at least one of the first six, and an unknown
  condition is refused.
- `enabled`: false unless the save says true, so a new rule is paused.
- `revision`: counted from 1, raised each time the conditions change.
- `owner`: the subject of the person who saved it.

Only a signed-in person saves a rule. A service account is refused, and so is every
caller on a deployment with sign-in off. A service account that administers the
namespace can list and delete rules. Another writer cannot replace or delete a rule they
do not own, and a namespace holds at most 100 rules.

`memory.copy_rule.list` shows each rule's source name, conditions and owner to every
viewer of the destination namespace, including viewers who cannot read the source.
Choose a source name and conditions you are willing to show them.

```console
$ loom call memory.copy_rule.set --namespace team-support rule_id=runbooks \
    from_namespace=alice-notes conditions:='{"tags_all": ["runbook"], "verified": true}'
$ loom call memory.copy_rule.list --namespace team-support
$ loom call memory.copy_rule.run --namespace team-support rule_id=runbooks
$ loom call memory.copy_rule.delete --namespace team-support rule_id=runbooks
```

The typed calls take the same fields. In Python:

```python
from loom import Agent

async with Agent(org="acme", namespace="team-support", agent="alice") as agent:
    saved = await agent.client.memory.copy_rule_set(
        {
            "rule_id": "runbooks",
            "from_namespace": "alice-notes",
            "conditions": {"tags_all": ["runbook"], "verified": True},
        }
    )
    print(saved["rule"]["revision"], saved["rule"]["enabled"])  # 1 False
```

In TypeScript:

```ts
const saved = await client.memory.copyRuleSet({
  org: "acme",
  namespace: "team-support",
  rule_id: "runbooks",
  from_namespace: "alice-notes",
  conditions: { tags_all: ["runbook"], verified: true },
});
console.log(saved.rule.revision, saved.rule.enabled); // 1 false
```

#### What a condition selects

A memory is selected when it meets every condition the rule states. Any writer of the
source namespace can make a memory meet a condition, except `verified`:

| Condition             | A memory meets it when                                                           | Who can make it so                                                 |
| --------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `memory_type`         | Its type equals the value.                                                       | The writer who saves it.                                           |
| `key_prefix`          | Its key starts with the value.                                                   | The writer who saves it.                                           |
| `tags_all`            | It carries every tag listed.                                                     | Any writer of the source.                                          |
| `tags_any`            | It carries at least one tag listed.                                              | Any writer of the source.                                          |
| `pinned`              | It is pinned.                                                                    | Any writer of the source.                                          |
| `verified`            | A person verified its current text, and that person is not the one who wrote it. | A person who writes to the source, other than the memory's writer. |
| `updated_within_days` | It was last updated at most that many days ago.                                  | Any writer of the source, by saving it again.                      |
| `agent`               | It is filed under that agent label.                                              | The writer who saves it, who chooses the label.                    |

An edit ends a verification, since the verification names the text that was verified. A
match selects a memory for a proposal: it approves nothing in the destination.

#### Preview a rule

`memory.copy_rule.run` evaluates a rule and, by default, writes no memory. A writer of the
destination who can read the source calls it; a caller who cannot read the source is
refused with no count. A paused rule previews like an enabled one. The answer counts the
memories the rule selects (`matched`, at most 1000, with `truncated: true` when more
match) and lists each one that is not already copied with a `status` and a `reason`:

| `status`      | `reason`           | Meaning                                                                                      |
| ------------- | ------------------ | -------------------------------------------------------------------------------------------- |
| `would_apply` |                    | A run would propose this memory to the destination.                                          |
| `noop`        | `pending`          | The destination holds this memory as a proposal nobody has decided yet.                      |
| `noop`        | `deferred`         | The rule already holds 25 undecided proposals. A run after some are decided proposes it.     |
| `noop`        | `stopped_matching` | The destination holds a copy the rule proposed, and the rule no longer selects its source.   |
| `noop`        | `diverged`         | The destination holds a copy, and the source or the copy changed since. The copy is kept.    |
| `refused`     | `collision`        | Another memory in the destination, or an earlier memory of this preview, holds the same key. |
| `refused`     | `removed`          | Someone deleted the copy from the destination, and the source has not changed since.         |
| `refused`     | `rejected`         | A reviewer rejected this text in the destination.                                            |
| `refused`     | `pending_review`   | The source memory is itself a proposal, or a rejected one.                                   |
| `refused`     | `not_served`       | The source memory is superseded, conflicted, a duplicate, expired or not active.             |
| `refused`     | `sensitive`        | The source memory is graded `high`.                                                          |
| `refused`     | `redacted`         | The source memory is redacted.                                                               |
| `refused`     | `type_not_copied`  | The source memory is a `profile` or a `definition`.                                          |
| `refused`     | `is_a_copy`        | The source memory is itself a copy from another namespace.                                   |

A memory the destination already holds an unchanged copy of is counted in `already_copied`
and not listed. A copy made with `memory.copy_to` counts as the rule's own. The answer
holds keys, ids and content hashes of source memories, and no memory text. `pending` is
the number of the rule's proposals nobody has decided yet.

A rule never reads a deleted memory, a memory filed under a user (`user_id` other than
`-`), or a memory outside the caller's read scope. None of them is counted.

```console
$ loom copy-rule run runbooks --namespace team-support
$ loom call memory.copy_rule.run --namespace team-support rule_id=runbooks limit=20
```

`loom copy-rule run` prints the counts, one line a memory and the rule's `revision`.

#### Run a rule

The rule's owner runs it with `dry_run: false` and the `revision` the preview answered.
Each `would_apply` memory is written to the destination as a proposal, and the answer
reports it as `applied` with the copy's id in `target_memory_id`.

```console
$ loom copy-rule run runbooks --namespace team-support --apply --revision 1
```

In Python:

```python
preview = await agent.client.memory.copy_rule_run({"rule_id": "runbooks"})
ran = await agent.client.memory.copy_rule_run(
    {"rule_id": "runbooks", "dry_run": False, "revision": preview["revision"]}
)
print(ran["applied"], ran["pending"])
```

A run is refused before any memory is read when:

- The caller is not a signed-in person, or is not the rule's owner (403). Another
  administrator previews the rule and decides what it proposed.
- `revision` is missing (422) or is not the rule's revision (409). The owner previews the
  changed rule and runs that revision.
- The rule is paused (409). Save it with `enabled: true` first.
- The rule selects more than 1000 memories (422, `reason: rule_too_wide`). Narrow the
  conditions: a run never covers a part of what a rule selects.

A rule holds at most 25 undecided proposals. A run writes up to that bound in key order
and reports the rest as `noop` with `deferred`; run the rule again after a reviewer has
decided some. One run of a rule writes at a time: a run sent while another is writing
answers 503 `OVERLOADED` and writes nothing, so send it again once the first has answered.

One memory's refusal does not fail the run. A memory whose source changed between the
evaluation and the write is `refused` with `changed`, a text on the destination's
blacklist is `refused` with `blacklisted`, a locked key is `refused` with `held`, and a
write that failed for another reason is `failed` with the error code. A later run tries a
`failed` memory again.

#### Decide what a rule proposed

A proposal a rule wrote names the rule's owner as its writer, so the owner cannot accept
it, and neither can a service account. Another administrator of the destination reads the
proposals and decides each one with `memory.proposal_decide`, by the content hash they
read (see [proposals](/docs/features/memory/writing#proposals)). Until then search and recall do not
serve the copy. A viewer of the destination can read an undecided proposal by its key or
in the proposals listing, so a rule's owner chooses a source whose text the destination's
viewers may see.

A run does not propose a memory again when its copy was removed or rejected and the source
has not changed since. An edited source is proposed again, unless the new text is one that
was deleted from the destination. When the rule stops selecting a source, the accepted
copy stays and the next evaluation reports it as `stopped_matching`: a rule proposes
copies and never deletes one.

#### Remove what a rule copied

Every copy a rule proposed carries the origin `copy_rule:<rule_id>@<revision>` in
`source_trace`, which only the server writes: a request whose `source_trace` starts with
`copy_rule:` is refused. A copy keeps the origin until a member writes at its key:
`memory.set` stores its caller's trace in its place, and `memory.update` drops it when it
stores other text. Such a copy, and a row restored from a snapshot, are the destination's
own and carry no origin. To remove the copies one revision made, an administrator deletes
by that origin. The call previews by default and deletes with `dry_run:=false`:

```console
$ loom call memory.apply --namespace team-support agent=- action=delete \
    reason="remove what revision 1 of the runbooks rule copied" \
    target:='{"filter": {"source_trace": "copy_rule:runbooks@1"}}'
```

Removing a copy does not undo what an agent read while it was served. An erasure of the
source namespace deletes the rule and leaves the copies: a copy is the destination's
memory, and the destination's own deletion or erasure removes it.

Agents read the rules with `memory.copy_rule.list` and preview one with
`memory.copy_rule.run` through `loom_op`. `set` and `delete` are not on MCP.

In the dashboard, the **Copy rules** tab of Memories lists the namespace's rules with what
each selects, in words, its owner and its revision. A writer signed in as a person adds a
rule there, its owner revises, enables and pauses it, and its owner or an administrator of
the namespace deletes it ([Copy rules](/docs/features/dashboard#copy-rules)). A writer previews a rule
from its row: the dialog shows the counts, each listed memory's outcome in words, and who
reads a proposal before it is decided, which is everyone who can read the destination,
with a way to see who that is. The rule's owner runs the previewed revision from the same
dialog, and **Past runs** lists the namespace's previews and runs of the last 90 days. A
proposal is decided in the Review queue, not on this page.

[Copy rules](/docs/architecture/copy-rules) describes the checks, the evaluation, the table
and erasure.

## A namespace a team shares

A team that keeps its conventions, decisions and runbooks in one namespace registers it
once, picks the conflict policy that fits several writers, and grants each member a role:

```python
from loom import Agent

async with Agent(org="acme", namespace="platform-team", agent="setup") as agent:
    await agent.namespaces.register(
        owner_email="platform@acme.example",
        description="Conventions, decisions and runbooks of the platform team",
        default_conflict_policy="newest_wins",
    )
    for subject in ("dev-one@acme.example", "dev-two@acme.example"):
        await agent.grants.create(subject, "writer")
```

What its members can then count on:

- **Whose row a write is.** Over MCP a row's `agent` defaults to the slug of the client's
  name (`Claude Code` writes as `claude-code`, `Cursor` as `cursor`), and its `user_id`
  and `session_id` to `-`. The person is the row's `actor`: `human:<subject>`, or
  `process:<subject>` for a service account. Two people on one client who save one key
  therefore write one row, the later save a new version of it, and one key saved from two
  clients is a row for each.
- **`newest_wins` serves the latest write of a key.** A write for a key retires every
  older live row of that key, whoever wrote it, so the two clients above leave one served
  row. Under the default `auto_reinforce` both rows stay and are served as peers
  ([namespace conflict policy](/docs/features/memory/conflicts-and-refusal#namespace-conflict-policy)).
- **A kind is a tag.** A row's kind is its `kind:<name>` tag, such as `kind:decision` or
  `kind:runbook`. A search's `tags` filter serves only the named kinds, and `kinds_first`
  puts them ahead of the rest ([kinds](/docs/features/memory/search-and-ask#kinds)).
- **A later settings change is another `namespace.register`.** It needs admin and
  `owner_email` again, and it replaces the namespace's `tags` whole: send back the tags
  `namespace.get` returns, with the change
  ([registering a namespace](#registering-a-namespace)).
- **A member's sessions start with its guide and its pinned rows,** in whichever of the
  member's namespaces the session runs, once the member has taken the namespace up
  ([below](#what-a-session-is-given-from-other-namespaces)). Pinning a row
  (`memory.pin`) is what puts it in front of every member.

Two figures say whether the team uses it, and both need `viewer`. The writers and new
memories of each week come from [`insights.query`](/docs/reference/operations/insights#insightsquery)
over the `memory` table:

```python
from loom import Agent

WRITERS_BY_WEEK = """
SELECT toStartOfWeek(created_at, 1) AS week, uniqExact(actor) AS writers, count() AS memories
FROM memory
WHERE status IN ('active', 'conflicted')
GROUP BY week
ORDER BY week DESC
"""

async with Agent(org="acme", namespace="platform-team", agent="report") as agent:
    result = await agent.call("insights.query", sql=WRITERS_BY_WEEK)
    for week, writers, memories in result["rows"]:
        print(week, writers, memories)
```

A row counts in the week of its first write (`created_at`), under the `actor` of its
current version, and an accepted proposal keeps its proposer as `actor`.

The share of proposals the team accepts comes from the audit trail. An administrator's
`memory.proposal_decide` leaves one `memory.proposal_accept` or `memory.proposal_reject`
row for each proposal it decides, and the owner's automatic policy, which only rejects,
one `memory.proposal_reject` row for each proposal it rejects
([reading the trail](/docs/features/observability/audit#reading-the-trail)):

```python
from datetime import UTC, datetime, timedelta

from loom import Agent


async def decided(agent: Agent, event_type: str, since: datetime) -> int:
    count, cursor = 0, None
    while True:
        page = await agent.audit.list(event_type=event_type, since=since, limit=500, cursor=cursor)
        count += len(page["rows"])
        cursor = page.get("next_cursor")
        if not cursor:
            return count


async with Agent(org="acme", namespace="platform-team", agent="report") as agent:
    since = datetime.now(UTC) - timedelta(days=30)
    accepted = await decided(agent, "memory.proposal_accept", since)
    rejected = await decided(agent, "memory.proposal_reject", since)
    if accepted + rejected:
        print(f"{accepted} of {accepted + rejected} proposals accepted")
```

### What a session is given from other namespaces

`context.pack`, in every mode, carries an `other_namespaces` section ahead of the pack's
own sections, after the [skills it lists](/docs/features/skills#what-a-session-is-listed): the guide and
the pinned rows of the caller's other memory namespaces, so a session that runs in a
member's own namespace starts with the team's standing rules without asking for them.

- **Which namespaces.** The ones an `all_mine` memory search of the caller reads, other
  than the pack's own, that the caller has taken up. A namespace is taken up when the
  caller's token names it, when the caller holds a live grant they made themselves
  (they registered or joined it), or when they hold a grant someone else made and have
  opened the namespace since: in the dashboard, or with `namespace.mark_seen`. A client
  token that reads through its creator takes up what its creator did, restricted
  namespaces excepted. A grant alone is its sender's act and puts nothing in a session;
  it still lets the member read the namespace by naming it.
- **How many.** The first three, in the search's order (a scoped token's namespace
  order, otherwise by name), that have a guide or a pinned row. One the pack read and
  found with neither takes none of the three places and is not named. The pack reads
  the namespaces three at a time and stops at three found or nine read, so the section
  serves none after the ninth. The rest, which are the ones after the third that have a
  guide or a pinned row and the ones not read, are named on a last line, the first five
  by name: `(2 more: team-data, team-web; ask with namespace=team-data)`.
- **What of each.** Its guide as one item, `- [guide:<namespace>/<revision> by=<writer>]
  <summary>` with the text indented under it, then its pinned rows, newest first, at most
  five: `- [memory:<namespace>/<key> by=<writer> date=<day>] <text>`.
- **What is never served.** A row that is not pinned, a duplicate, superseded or
  proposed row, a high-sensitivity row, a transcript row, a row of a type an unfiltered
  search leaves out (session replays, profiles, reflections), and a row outside the
  request's read scope. A pack that names a `user_id` is served each guide and, of the
  pinned rows, only the ones filed under that user: none a teammate pinned under another
  user or under no user. A token narrowed to one user or session gets no section at all.
  When one of the section's reads fails the section is left out, the rest of the pack is
  served, and `degraded` names `other_namespaces_dropped`.
- **Its size.** 400 tokens (1,600 characters) in every mode, split evenly between the
  namespaces served. A guide takes at most half of its namespace's share; a cut one ends
  with `(full text: namespace.guide_get namespace=<namespace>)`. A pinned row that does
  not fit in what is left of the share is not served, nor are the rows after it, and
  `section_meta.other_namespaces.pins_cut` names the namespace. One namespace's share
  holds five rows of a line each beside its guide; with three namespaces that each have
  a guide, a share holds about two. `section_token_budgets` changes the size:
  `{"other_namespaces": 800}`.
- **It costs the session's own context nothing.** The section is served on top of the
  pack's `token_budget`, so every other section is the same bytes with and without it
  ([`context.pack`](/docs/features/unified-search#contextpack) has the arithmetic and its two
  exceptions).
- **It changes only when its sources do.** Its bytes move when someone pins, unpins or
  rewrites a pinned row, saves a guide, or the reader takes up another namespace, so it
  sits in the pack's stable prefix.
- **A served row is recorded under its own namespace** in the served counters and the
  read receipts. A guide is no memory row and has neither.

## Reading a namespace's health

| Operation                                                                        | Answers                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`namespace.inventory`](/docs/reference/operations/namespace#namespaceinventory) | What the namespace holds and who appears in it: live counts and newest write for memories, records, documents, runs and integrations; the member count; the agents, authors and subjects observed on memory rows; whether a real model and embedder serve the process that answered.                                                                                                                                                                                       |
| [`namespace.worklist`](/docs/reference/operations/namespace#namespaceworklist)   | The live memories that wait for a person's decision, by kind (conflicts, proposals, then stale verifications), each kind's most served key first, with the kind's whole count and the operation that settles it ([below](#the-worklist)).                                                                                                                                                                                                                                  |
| `namespace.summary`                                                              | Counts by memory type, top entities, recent writes and recalls, distinct agents, last activity.                                                                                                                                                                                                                                                                                                                                                                            |
| `namespace.validate`                                                             | An integrity report: stuck conflicts, low-confidence rows, rows still waiting for an embedding. Run it after a batch of writes or when a recall looks wrong.                                                                                                                                                                                                                                                                                                               |
| `namespace.audit`                                                                | Whether the namespace is used as a memory or as an object store: exact-key reads against searches, hash-shaped keys, double-encoded or oversized values, leases stored as memories, version churn. It also names the deployment's own state (kind `system_state`: missing telemetry, an indexing backlog), and skips the ledger checks rather than report them clean when the ledger recorded none of the calls behind the window's writes. Each finding carries a remedy. |
| `memory.inspect`                                                                 | One user, agent or session: its own rows apart from the rest of the namespace, its calls in a window, and the guide, categories and extraction policy that create its memories ([below](#inspecting-one-user-agent-or-session)).                                                                                                                                                                                                                                           |
| `namespace.tune`                                                                 | Drafts of changes to the extraction rules, categories and guide that create the namespace's memories and to the chunking and extractor settings for its documents, each with its evidence and the write that would apply it; nothing is applied ([below](#drafting-changes-to-how-memories-are-made)).                                                                                                                                                                     |
| `namespace.taxonomy`                                                             | The live vocabulary: top tags, entities, memory types and communities.                                                                                                                                                                                                                                                                                                                                                                                                     |
| `agents.connected`                                                               | The agents active in a window (default 24 hours): last and first seen, ops, namespaces touched and cost per agent. Answers "is my client actually talking to Loom?"                                                                                                                                                                                                                                                                                                        |

`namespace.inventory` keeps each population apart. `members` counts the grant holders: the
people holding an active grant, not a pending request, a group, an agent or a service
account (`grants.list` on the namespace, and on each ancestor of a collection, lists their
grants). A token whose own claims name the namespace reads it without a grant and is never
counted; a collection counts the grant holders of its ancestors too, since a parent's
grant reaches every child. A grant to `everyone`, a group or an agent (every end user
signed in under it) anywhere on that lineage, or a code namespace readable by the whole
org, leaves the count `complete: false`, since their members are not listed. `agents`,
`authors` (the `actor` that wrote a row) and `subjects` (the `user_id` a row belongs to,
never the unset `-`) are identities observed on live memory rows, not a directory. A
personal collection's owner holds no grant, so its members are not counted (`total` is
null). A section that failed, or that the caller may not read, says so with `complete:
false` and a reason: the integrations count is for namespace admins, and under a read
scope bound to one user (`read_scope=own_user` or `own_session`, or a token pinned to a
user) the memory and run counts and the observed agents, authors and subjects are that
user's, documents and members are counted namespace-wide as `knowledge.*` and
`grants.list` read them, and records (one per key, whoever wrote it last) and integrations
are not counted.

Every `namespace.audit` and `namespace.validate` finding carries the same evidence fields,
so the CLI, the dashboard and an MCP client read one shape:

| Field                              | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `kind`                             | `contract_violation` when a stored value breaks a declared invariant or attestation; `usage_heuristic` when a pattern usually costs recall or storage but a legitimate design can match it. A heuristic hit is a warning, not proof of misuse. `system_state` when the finding is about the deployment, not the writer: an indexing backlog (`index_backlog`) or writes the ledger did not record (`telemetry_unavailable`, which skips the ledger checks rather than report them clean). These are `namespace.audit` findings; `namespace.validate`'s `unembedded` check is a `contract_violation` and counts every row past its grace with no vector, held model calls included. |
| `rule_version`, `source_op`        | The rule's version (raised when its predicate or built-in threshold changes, so two reports are compared only at the same version; a setting or request input the rule reads, such as `confidence_floor` or the value size advisory, is not versioned) and the operation that computed it.                                                                                                                                                                                                                                                                                                                                                                                         |
| `window_seconds`                   | The ledger window a usage rule counted over; null for a rule that reads current state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `population`, `count`              | The denominator of `share` (the rows or calls the finding is measured against, which may include rows the rule leaves out by design), and how many matched. `namespace.validate` checks report a count with no denominator and leave `population` null, as does an audit finding whose summary read was skipped.                                                                                                                                                                                                                                                                                                                                                                   |
| `sample_limit`, `samples_complete` | The sample cap, and whether the samples list every match: false when the cap cut them or they cannot name every match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `evidence`                         | The live revision of each row a sample names (below). Never the value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `exceptions`, `uncertainty`        | What the rule leaves out by design, and why a hit may still be correct.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

Each `evidence` entry is the live revision of a row a sample names, read once the checks
have run: `memory_key`, `memory_id`, `version`, `content_sha256` (the hash `memory.get`
serves; empty for a high-sensitivity row, for a value longer than
`LOOM_NAMESPACE_REPORT_HASH_MAX_BYTES` (64 KiB;
[configuration](/docs/reference/configuration)), or for a row that changed while the
report read it), the identity columns, `memory_type`, `source_class` and `updated_at`. A
sample names its row by `memory_id`, or by its identity columns when it comes from the
embedding table, and a key held under several identities cites only the one that
matched. A row revised after the checks ran is cited at its newer revision; its
`updated_at` is then at or after the report's `computed_at` or `checked_at` (whole
seconds). A write that changes only a row's status can keep its `updated_at`, so the
comparison is a hint, not proof. A sample that names no single row (an `exact_key_store`
hot key, a `version_churn` key) and a row no longer live (an orphan vector) have no
entry, nor, under the Postgres authority, a row the authority no longer serves at the
version read ([storage authority](/docs/architecture/storage-authority)).

The report's `coverage` lists the rules that ran (`rules_run`) and those that could not
(`rules_skipped`, also in `skipped` with the reason). Both name the evidence read
(`evidence`) and, for `namespace.audit`, its summary reads, which most findings are
measured against, and under the Postgres authority `projection`, the wait for ClickHouse
to publish what the namespace committed
([storage authority](/docs/architecture/storage-authority)). `complete` is false when
any of them was skipped.

`loom audit-namespace` runs `namespace.audit` from the shell; the
[optimize a namespace guide](/docs/guides/optimize-namespace) turns its findings into a
reviewed rework plan. Vocabulary is registered with `namespace.register_category`,
`namespace.list_categories`, `namespace.search_categories` (categories) and
`namespace.register_ontology`, `namespace.list_ontology` (entity types and relation verbs
for the [entity graph](/docs/features/entity-graph)).

Category search compares only vectors from the query's embedding model with the same
dimension as the query vector. After changing models, re-register a category to make
it searchable with that model.

Snapshots and point-in-time rollback (`namespace.snapshot`, `namespace.restore`,
`namespace.rollback`) are covered in
[history and provenance](/docs/features/memory/history-and-provenance).

### The worklist

`namespace.worklist` (viewer) lists the live memories of one namespace that wait for a
person's decision, in sections called kinds: `conflict` (rows marked `conflicted`),
`proposal` (rows written with `proposed`) and `stale_verification` (active or conflicted
rows someone verified, whose content changed after the verification or whose stored
content hash cannot confirm it). The first two are the two counts of the Review queue
badge. A kind carries its whole count (`total`), `truncated` when it holds more rows than
`limit` lists (10 per kind by default, at most 100), why its rows wait (`reason`), and
the operation and role that settle one (`settle_op`, `settle_role`). An item names one
row by its key, id, version and identity columns, with `source_class`, `sensitivity` and
`updated_at`, and never carries its value. Under every kind it also carries who verified
the row and when (`verified_by`, `verified_at`): empty and null when nobody did. A key
with several live copies lists each copy.

An admin settles a conflict or a proposal. A writer settles a stale verification with
[`memory.verify`](/docs/features/memory/history-and-provenance#attestation-memoryverify): verifying
again stands behind the content as it is, `revoke=true` withdraws the verification, and
either way the row leaves the kind. One row stays listed after it is verified again: a
row whose stored content hash is unset while the verified hash still matches its value
answers `changed=false` to the actor who verified it; a revoke, or another actor's
verification, settles it. A conflicted row with a stale verification is one item under
each of the two kinds. A proposal is never listed as a stale verification, and neither
is a row whose verification was revoked.

Inside a kind the order is `served_count`, most first, then the oldest write.
`served_count` is the number of retrieval reads that returned any live copy of the row's
key in the namespace over `window_days` UTC days, today included (30 by default, 1 to
90); the copies of a key share it. `served_agents` is the distinct agents among those
reads and `last_served_at` the newest. The count holds reads by a named agent or
consumer. It leaves out key lookups (`memory.get`, `memory.bulk_get`, `memory.list`),
dashboard and assistant reads, evaluation reads (`memory.search` with `auto_touch:
false`, `memory.ask` with `reinforce: false`), benchmark runs and reads that name neither
an agent nor a consumer; the answer says so in `served_covers`. A read returns a proposal
only when it asks for proposals (`include_proposed`), so a proposal's count is 0 until
such a read returns it, or a read returns a fact another identity wrote under its key.
`served_recorded: false` says the namespace recorded no served read in the window: every
count is 0 and the order is by last write. `used_count` and `harm_count` are the row's
own all-time totals.

```bash
loom call namespace.worklist namespace=<ns> limit:=5
```

The call writes nothing. A token whose read scope is narrower than the namespace is
refused (403 `AUTH_INSUFFICIENT`): the served counts have no user or session to narrow
by. Under the Postgres authority it reads at the published barrier, as the inventory does
([storage authority](/docs/architecture/storage-authority)).

## Inspecting one user, agent or session

`memory.inspect` (viewer) takes `subject` (`user`, `agent` or `session`) and `id`, the
`user_id`, agent name or `session_id` to look at; the unset `-` and `*` name no one and
are refused. It changes nothing it reads and gives no recall credit. Like
`memory.list`, it writes one exposure-ledger row for the rows it lists.

- **`own`**: the live rows whose identity names the subject. For an agent, the rows
  written under its name; the name says which agent a row is from and is not a read
  boundary. For a user, the rows filed under that `user_id`, whoever wrote them: what a
  token pinned to the user (`read_scope: own_user`) reads. For a session, the rows
  written in that `session_id` by any user; a token pinned to one user and the session
  (`read_scope: own_session`) reads that user's part.
- **`others`**: every other live row of the namespace. A member reads these as well, so
  `own` alone never stands for everything a user, agent or session can read. Neither
  view counts the promoted rows (`memory.promote`), which a search serves to every
  agent as well.
- Each view's `definition` says in plain words which rows it holds; its `refs` lists
  the exact column it means, and the read scope and op where the definition names one.
- Each view counts its rows by type, status and source class, lists its top tags and the
  registered categories its rows are filed under, and its newest rows (`sample_limit`,
  default 10) with `memory_id`, `version`, the `content_sha256` `memory.get` serves,
  `actor`, `sensitivity`, the number of versions the history holds (the entity
  tagger's re-emits included, which `memory.history` leaves out) and a 200-character
  excerpt. A high-sensitivity row has neither the excerpt nor the hash; a value
  larger than `namespace_report_hash_max_bytes` (0 cites none) and a row revised
  between the listing and the citation read have no hash. `complete` is false when
  the listing holds fewer rows than the view, the view's counts could not be read, or,
  under the Postgres authority, ClickHouse could not be shown to hold what the
  namespace committed: the wait ran out or Postgres did not answer (`skipped` names
  `projection`).
- **`activity`**: the calls the ledger files under the subject per operation in
  `window_seconds` (default 7 days), attempted and succeeded, without worker rows or the
  calls of the dashboard, the assistant and the command line's inspection commands. The ledger files a call under the `agent`,
  `user_id` and `session_id` its arguments name, or the user and session a narrowed token
  is pinned to, so a call made by anyone that names the subject is counted, and a served
  `memory.inspect`, which names none, is not. A call shows that a tool ran, not that its
  result reached a model. `gap` says when the ledger keeps fewer days than the window (the
  namespace's own `retention_days`, else the deployment's).
- **`settings`**: the guide's revision and summary, the number of registered categories,
  and the operator extraction policy only for an org admin
  (`extraction_policy_unavailable` says why it is missing). Extraction instructions are
  sent per request; no user, agent or session setting stores them, and
  `extraction_instructions_refs` names the op and argument that carry them.
- A section that cannot be read is listed in `skipped`; a skipped section is not an empty
  one. A token narrowed below the namespace (`read_scope`) cannot call it.

## Drafting changes to how memories are made

`namespace.tune` (viewer) reads the namespace's audit, its tags and key layout, its
registered categories, its guide and, for an org admin, the operator extraction policy in
force, and drafts changes to the settings that create its memories. It reads the whole
namespace, not one user, agent or session (`memory.inspect` shows one), applies nothing
and calls no model. Each proposal names:

- **`target`**: the setting it changes. `extraction_instructions.request` (the
  instructions a `memory.set_from_messages` request sends; no user, agent or session
  setting stores them), `namespace.category`, `namespace.guide`, or for documents
  `settings.knowledge_chunking` and `settings.document_extractors_json`
  ([below](#document-drafts)). Extraction rules are
  never drafted as the operator extraction policy: a policy in force overrides every
  other instruction and turns off extraction's recovery passes, so a style rule there
  would cost facts the namespace keeps today. A rule whose exact text the policy in force
  contains is not drafted again.
- **`current`** and **`proposed`**: the setting's value now and the value it would set,
  with `current_revision` for the guide.
- **`evidence`**: the audit findings it answers (`finding_codes`), how many rows support
  it (the first `sample_limit` cited by `memory_id`, `version` and the `content_sha256`
  `memory.get` serves, one from each finding in turn), and how many it must keep working
  for (`counter_count`: at least the rows of the smallest population the checks read that
  none of them flagged, or the tagged rows another category already holds; null when that
  count could not be read, and for a guide, which changes no stored row).
- **`affected_agents`**: the writers the change shapes, at most 20, with
  `affected_agents_total`: for extraction instructions, the agents whose rows extraction
  wrote; for a category or the guide, every agent that wrote live rows;
  `affected_agents_total` is null when the namespace's writers could not be read.
- **`effect`** (`future`) and **`historical`**: a setting shapes the memories written
  after it changes; reworking stored rows (`memory.move`, `memory.assign_category`) is a
  separate action with its own approval.
- **`apply`**: the ordinary write, its arguments (`args_complete: false` when they are a
  part to merge into each request), the role it needs and its guard.
  `namespace.guide_set` refuses a guide that moved past `expected_revision`;
  `namespace.register_category` has no revision check, so the categories are read again
  just before applying.
- **`refs`**: each exact name the draft's text says in plain words, for a caller that
  acts on it. A setting is named as it is changed: `settings.set <field>` when it changes
  live, its `LOOM_` variable when only the environment sets it. A `skipped` reason about a
  setting, a lost capability, a finding or an error code, or one that tells the reader to
  act, names the exact names in parentheses; the `projection:` line and the `audit.<check>`
  lines carry their source's text as it is.

The drafts come from fixed rules: an extraction rule per writer-side audit finding
(double-encoded values, JSON-prefix excerpts, oversized values, episodic blobs,
coordination state, hand-rolled index rows), drafted only when `memory.set_from_messages`'
extraction writes into the namespace (rows with its source trace) and at least one of the
finding's cited rows came from it, since the instructions reach nothing else; a finding
none of whose cited rows extraction wrote, a finding the audit cited no live row of, or a
namespace extraction writes nothing into, drafts nothing and is named in `skipped`. Its
affected agents are the agents whose rows extraction wrote, it cites the flagged rows
extraction wrote, and the flagged counts cover every writer. A key's layout is the
writer's (extracted keys are sanitized), so no rule is drafted for it. Then a category per
tag on at least `min_rows` live rows with no category of its name, and a guide listing the
key prefixes and tags (or the prefixes an existing guide leaves out) on at least
`min_rows` rows; none in a personal collection (`col-me-…`), which takes no guide. A tag
or prefix that is not a plain name is never drafted, so text stored in rows cannot steer a
target or an argument; neither is a `<prefix>:` tag (`source:`, `speaker:`, `agent:`),
which says where a row came from, not what it is about. A check the audit could not run is
listed in `skipped` as `audit.<check>`. A token narrowed below the namespace
(`read_scope`) cannot call it.

### Document drafts

The settings that cut and extract documents are the deployment's, the only place they
live: a document draft's `scope` is every namespace of the deployment, its evidence is
this namespace's, and its `apply` names how the setting is changed (`via`).

- **Chunk size and stride** (`settings.knowledge_chunking`): up to
  `namespace_tune_document_sample` live documents (default 50, picked by a hash of their
  `source_uri`) are cut again in process at the current `knowledge_chunk_size` and
  `knowledge_chunk_stride`, each by the chunker its write path uses: a text document's
  text, an ingested document's stored artifact, until 8 MiB of text and artifact is
  loaded; a document past that, a text over 2,000,000 characters or an artifact over 8
  MiB counts as `unread`, and `load_cap` states the total. Nothing is written, no model
  is called and no text is returned. `chunking` reports the cut: chunk count, characters
  per chunk, the sections the size cuts into more chunks than their structure makes
  (`sections_cut`), the largest embedding input in tokens and how many inputs are over
  the embedder's limit (null when its provider states none Loom checks). A size is
  drafted when an input is over the limit (the largest smaller size that fits, down to
  200), or when more than a quarter of the sampled sections are cut over at least five
  documents and the limit is known (the smallest larger size, up to four times the
  current, that keeps three quarters whole within it); each candidate size is tried
  once, nearest first, and the stride keeps its ratio to the size. `preview` holds the
  sample cut at both values. `apply` is `settings.set` (`POST /v1/admin/settings.set`, a
  platform admin) with `expected`, and `apply_also` sets the stride. A sample that
  breaks neither rule drafts nothing, and stands as the evidence. So does a
  `knowledge_chunk_size` of 0 or less, which cuts no window (a text document is one
  chunk, an ingested one a chunk per block), and a `knowledge_chunk_stride` of 0 or
  less, which windows no section or block longer than the size: no size is drafted for
  either.
- **Extractor routes** (`settings.document_extractors_json`): a format whose sources'
  current job failed `format_unavailable`, or whose published extractions are
  incomplete, is routed to a configured extractor that declares it in its capabilities.
  The service a source goes to now is read as ingest reads it, from its format and media
  type; the draft adds a route for the format itself, which wins over a media-type
  route, so it takes every source of the format. Of the services that declare the format
  (for incomplete extractions, those that did not make them), the route goes to one its
  sources already work on (extracted whole, or failed sources whose service declares the
  format now), else one its media-type routes reach, else any, a service that did not
  make its incomplete extractions first within each. A route can still move sources that
  extract whole on another service, and its rationale names them; a route that does not
  answer the incomplete extractions says so in `skipped`. The draft names the service by
  the setting holding its URL, never the URL, which can carry a credential, so
  `args_complete` is false; `via` is `environment`, in force once each server and worker
  restarts. A format no configured extractor declares drafts nothing and is named in
  `skipped` (`extractor.<format>`), as are failed sources whose service declares the
  format now, which are ingested again instead.

Decision extraction (`loom decisions extract` and the source sync's mining) builds its
prompt from fixed text and takes no instructions from a request, a namespace or an org,
so no instruction is drafted for it; `skipped` says so when the namespace has documents.
Stored documents keep their chunks and extraction: cutting or extracting them again is a
separate action (`historical`).

## A namespace's guide

A namespace's guide is a Markdown README for it: what the namespace holds, its key
layout, what each tag means and which ops to call. Agents read it before their first
write and update it when they change one of those conventions; people read the same
text. It holds conventions about the data, never the facts themselves, which stay in
memory where search and erasure cover them.

| Operation                 | Role   | Does                                                                                                                          |
| ------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `namespace.guide_get`     | viewer | The current guide (or a past `revision`): its text, one-line summary, revision, writer and note.                              |
| `namespace.guide_set`     | writer | Writes the next revision when `expected_revision` is the current one; otherwise refuses with the current guide to merge into. |
| `namespace.guide_history` | viewer | The newest revisions with their summary, note, writer and length.                                                             |

Every save names the revision it was made from. Of two agents editing from one revision,
the first save lands and the second is answered `conflict: true` with the guide as it
now stands; the agent merges its change into that text and saves again with the returned
revision. The server never merges the text itself. A retry of a save that landed finds
its own text current and writes nothing. A save that leaves out `summary` keeps the
current one, and an empty `content` clears the guide. An end user's personal collection
(`col-me-…`) takes no guide. Every revision is kept, so `namespace.guide_get` with a
`revision` reads any of them.

The guide reaches agents without being asked for:

- **At session start,** `context.pack` renders a `namespace_guide` section: the guide's
  revision, writer and summary, then its text cut to the section budget. The budget is
  200 tokens in every mode, which is 800 characters with that head line counted. A guide
  that does not fit is cut there, and its head line then names `namespace.guide_get`,
  which returns the whole text. A call raises the budget with `section_token_budgets`:
  `{"namespace_guide": 600}` allows 2,400 characters. The `loom_context_pack` tool takes
  the field without listing it. The text is recalled data, escaped and indented under one
  item like any other writer's text.
- **At session start in a member's other namespaces,** the pack's `other_namespaces`
  section carries the guide of each namespace the member has taken up
  ([what a session is given from other namespaces](#what-a-session-is-given-from-other-namespaces)).
- **In the directory,** each `namespace.browse` row of a public namespace carries its
  `guide_revision` and `guide_summary`, and `query` also matches the guide's summary,
  so an agent looking through many public namespaces finds the one whose guide
  describes what it needs. A private row shows no guide to someone who is not a member,
  and a restricted row shows none at all.
- **`namespace.get`** carries `guide_revision` and `guide_summary`.

The MCP primer (the `initialize` instructions and `loom_activate`) holds no guide: an MCP
session reads it in a pack or with `namespace.guide_get`.

Reading a guide takes read access to its namespace, since a public row's visibility
widens no read: `namespace.browse` shows the org each public namespace's summary, and
the whole guide is for its members (`namespace.join`). In the dashboard, the Memories
page header has a **Guide** button beside **Add memory**, described by the guide's
revision and summary; on a namespace with no guide it opens a writer straight into the
editor. A first guide, from there or from Namespaces in your org, starts on an outline
of what a newcomer asks (what the namespace holds, its keys, its tags, how to use it)
that cannot be saved unchanged. Namespaces in your org shows a public namespace's guide
summary under its description; for a namespace you belong to, the summary opens the
guide, or the **Guide** menu item where no summary is shown. A writer edits it from
either place, saving from the revision they opened, as an agent does. A namespace
erasure deletes every revision of its guide.

## The mentor

`mentor.brief` returns advice for one agent with the evidence behind it: its calls over a window (default 7 days),
the planes the namespace offers, and each hint with the counts that fired it. The calls and the exact-key read counts
leave out a coding-agent plugin's read of a repository's test cost row (key `repo:<id>/test-cost/pytest`), which its
prompt hook sends under the session's agent; the ladder below counts it, as a row the ledger records under the agent.
`context.pack` renders up to three hints at session start, and a successful response carries at most one (`hint` on
MCP, `X-Loom-Hint` on HTTP), capped by `LOOM_MENTOR_MAX_HINTS_PER_SESSION`.
`loom mentor --org … --namespace … --agent …` prints the whole brief. See the
[mentor ops](/docs/reference/operations/mentor).

A brief's `usage_evidence` lists what the agent's use of Loom shows, one rung each, with
who recorded it (`server`: Loom saw it; `client`: a caller reported it, unverified). The
rungs are read at each brief, not from the cached profile, over the window the brief
reports. Those read from the call ledger
(`attempt`, `success`, `committed_write`, `returned_hit` and the `memory.outcome` labels)
count the rows it records under the agent, which is the agent a call's body names (for a
call by key, the row's writer, whoever calls): a call whose body names no agent (a read by
id, an MCP `memory.update`, the Python SDK's `memory.update` by default) or that reads
across agents and is recorded under `*` (`memory.search` and `memory.ask` from the SDKs,
MCP's cross-agent reads, a `memory.outcome` that names no agent) is not counted. The
ladder uses none of the profile's counts, so it answers when the mentor is off too; a
brief about no agent in particular has no ladder.

| Rung                  | Source   | Counts                                                                                                                                                                                                                                                                                              |
| --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `attempt`             | `server` | calls made, answered or not; not the dashboard's or the assistant's, a brief, or the verdict a deferred `memory.ask` leaves                                                                                                                                                                         |
| `success`             | `server` | those that returned without an error; a read that found nothing counts                                                                                                                                                                                                                              |
| `committed_write`     | `server` | `memory.set` calls that stored a row: not a no-op, a dry run or a replay                                                                                                                                                                                                                            |
| `indexed_write`       | `server` | memories first created in the window (one per user, session and key), by any write op, with a vector from the current embedder, in a served status and not expired                                                                                                                                  |
| `returned_hit`        | `server` | a `memory.search` or `memory.ask` that did not abstain, a `search.query` with a memory, document or conversation hit, a get that found its key                                                                                                                                                      |
| `client_acknowledged` | `client` | distinct memory keys the agent reported relying on: `run.complete` `memories_used` and a `memory.outcome` by id that said `used` or `positive` and landed on a row; not a label by key (recorded under the row writer's agent), the Python SDK's `outcome` calls (no agent) or `memory.outcome_run` |
| `task_outcome`        | `client` | the agent's runs graded `pass` or `fail` (`run.grade`), as the grader reported it                                                                                                                                                                                                                   |

A returned hit does not show that the answer reached the model or changed its work.
`ledger_from` is the agent's oldest ledger row in the window, and `ledger_retention_days`
how long the configured retention keeps the namespace's ledger rows (0: until deleted); a
window longer than that leaves the rungs read from the ledger covering less than it names.

[`mentor.guide`](/docs/reference/operations/mentor#mentorguide) returns how to use Loom, written for a model: the
`loom` skill in `skills/loom/`, as `part` `skill` (the loop and the rules), `reference` (every plane with its ops) or
`all`. It is the same for every caller, so any viewer token may read it, including one narrowed to a user, and an end user's over HTTP.

## Throwaway namespaces

Benchmarks and harnesses write into namespaces under the prefixes in
`LOOM_NAMESPACE_BENCH_PREFIXES`; auto-register stamps them `kind = bench`. The
`namespace_gc` worker purges bench namespaces with live memory and no write for
`LOOM_NAMESPACE_GC_IDLE_HOURS` (default 24) through one list-scoped erasure saga per
batch. `loom namespaces-gc --org <org>` lists candidates, and `--erase` purges them by
hand; `loom namespaces-adopt` gives namespaces that hold memory but no registry row an
owner row.

## Settings

| Setting                                                        | Effect                                                                                  |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `LOOM_NAMESPACE_AUTOREGISTER_ENABLED`                          | First write registers the namespace.                                                    |
| `LOOM_NAMESPACE_BENCH_PREFIXES`, `LOOM_NAMESPACE_GC_*`         | Which namespaces are throwaway, and when the GC erases them.                            |
| `LOOM_MENTOR_TTL_SECONDS`, `LOOM_MENTOR_MAX_HINTS_PER_SESSION` | Mentor cache and the per-session cap on per-call hints; a TTL of 0 disables the mentor. |
| `LOOM_CONFLICT_THRESHOLD`                                      | The deployment conflict threshold a namespace inherits.                                 |

See [configuration: namespace registration and GC](/docs/reference/configuration#namespace-registration-and-gc)
and [configuration: context](/docs/reference/configuration#context).

## Limits

- A namespace name is 1–128 characters; kebab-case is recommended.
- `namespace.delete` is a soft delete. It never removes memory; an erasure does.
- Changing `default_conflict_policy` or `retrieval_defaults` changes how later writes and
  searches behave; rows already stored are not re-judged.
- `memory.promote` shares within one namespace. Another namespace sees a fact only
  through a copy (`memory.copy_to`, `memory.cross_promote`), which does not follow later
  edits of the source.

## Related

- [Identities and namespaces](/docs/concepts/identities-and-namespaces) — the model.
- [Tokens and grants](/docs/guides/tokens-and-grants) — minting and scoping access.
- [The dashboard](/docs/features/dashboard) — Namespaces in your org, Settings and the admin drawer.
- [Security architecture](/docs/architecture/security) — how a request is authorized.
- [Operations reference: namespace](/docs/reference/operations#namespace),
  [grants](/docs/reference/operations#grants), [mentor](/docs/reference/operations#mentor),
  [agents](/docs/reference/operations#agents).
