Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 125 additions & 67 deletions docs/architecture/curator.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/architecture/knowledge-gaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ off. It lists what users asked, so it does not honour a read-narrowed token
`knowledge.gaps.` prefix). The Library page shows a gaps tile for a namespace the viewer
administers, on a deployment that records misses.

`knowledge.gaps.draft` and the curator's [question walk](curator.md#the-question-walk)
decide whether a gap may still be drafted from through one function (`eligibility` in
`server/knowledge/app/gap_drafts.py`), so a rule added there holds for both: knowledge
gaps are on, the asker floor is the one the caller read, the namespace's capture level
is not `off`, no erasure that may have deleted a question was open at the caller's
time or has finished since, the gap is in the latest build, and enough distinct people
still asked one of its questions, counted again from the stored misses.

## Cost

- On the request's path, a miss costs the rollout gate's cached read of the live replicas
Expand Down Expand Up @@ -265,6 +273,7 @@ between.
- `server/knowledge/domain/gaps.py` (`normalize_query`, `merge_groups`)
- `server/knowledge/store/gaps.py`
- `server/knowledge/workers/knowledge_gaps.py`
- `server/knowledge/app/gap_drafts.py` (`eligibility`, `handle_gap_draft`)

## Related

Expand Down
10 changes: 6 additions & 4 deletions docs/features/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ needs a person, or **Findings and model opinions, uses a model**, under which th
also asks the deployment's model whether each pending proposal fits the namespace's
guide. Before that third mode is saved, the dialog says what is sent to the model
provider, how much the curator's share of the namespace's daily cost cap allows in 24
hours, and each thing the curator still needs, with who can change it. Saving is allowed
while some are missing. The pass runs only where the deployment's operator has turned
the curator on. On a person's own namespace the control is disabled and says why.
hours, and each thing the curator still needs, with what it is needed for and who can
change it. Saving is allowed while some are missing. The pass runs only where the
deployment's operator has turned the curator on. On a person's own namespace the control
is disabled and says why.

The dashboard's text follows the
[copy rules](../development/dashboard-design.md#rules-a-change-is-checked-against): its
Expand Down Expand Up @@ -988,7 +989,8 @@ says **Nothing to do**. Above the cards, **Scheduled pass** says
in the namespace: off, not turned on for the deployment, waiting for its first pass,
overdue, failed, or on with the time the next pass is due. Under that it lists
[what the curator still needs](../architecture/curator.md#what-the-curator-needs) in the
namespace, each with who can change it: an operator of the deployment, an org admin or a
namespace, each with what it is needed for (a pass, model opinions or a draftable
question) and who can change it: an operator of the deployment, an org admin or a
namespace admin. It shows when the newest pass ran and how it ended and, for a pass that
asked a model, how that ended, the calls it made, what they cost and what the curator
spent in 24 hours against its share of the namespace's daily cost cap. **Pass history**
Expand Down
16 changes: 8 additions & 8 deletions docs/features/runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,14 +604,14 @@ The curator's worker writes one row for each [scheduled pass](../architecture/cu
over a namespace, so the ledger shows when the curator looked and how the pass ended.
`run.list(agent="loom-curator")` lists a namespace's passes, newest first by default.

| Field | A pass's row |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `run_id` | `cur-` and the pass's start in epoch seconds. |
| `agent`, `user_id`, `session_id` | `loom-curator`, `-`, `-`: the row is the worker's, filed under no user and no session. |
| `environment`, `goal` | `worker`, `Curator pass (scheduled)`. |
| `status` | `active` while the pass runs, then `completed` or `failed`. |
| `memories_used`, `memories_written` | Empty. `run.list(memory_activity="with")` therefore leaves a pass out. |
| `metadata` | `mode`, `outcome`, `counts` and `unavailable` by section, and `duration_ms`. It holds no key, value or question. A pass in `assist` mode adds how its model calls ended, the model's [opinions](../architecture/curator.md#the-pass-row) and the proposals it has no opinion on: proposal ids and codes, no value. |
| Field | A pass's row |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run_id` | `cur-` and the pass's start in epoch seconds. |
| `agent`, `user_id`, `session_id` | `loom-curator`, `-`, `-`: the row is the worker's, filed under no user and no session. |
| `environment`, `goal` | `worker`, `Curator pass (scheduled)`. |
| `status` | `active` while the pass runs, then `completed` or `failed`. |
| `memories_used`, `memories_written` | Empty. `run.list(memory_activity="with")` therefore leaves a pass out. |
| `metadata` | `mode`, `outcome`, `counts` and `unavailable` by section, and `duration_ms`. It holds no key, value or question. A pass in `assist` mode adds how its model calls ended, the model's [opinions](../architecture/curator.md#the-pass-row) and the proposals it has no opinion on: proposal ids and codes, no value. It also adds `questions`: a count for each code of [the question walk](../architecture/curator.md#the-question-walk), and each question's code under a keyed hash of its gap's id, never the question. |

`agent` is a label any caller's `run.begin` can carry. A row is a pass when its
`run_id` has the reserved shape.
Expand Down
7 changes: 5 additions & 2 deletions docs/guides/without-the-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ neither line is printed.
Between the two the command prints one line for each thing the namespace's mode needs
that is not met, with who can change it
([what the curator needs](../architecture/curator.md#what-the-curator-needs)). A
namespace whose mode is `off` prints none, and what model opinions need is listed only in
`assist` mode, where a budget line follows the last pass:
namespace whose mode is `off` prints none, and what model opinions and a draftable
question need is listed only in `assist` mode. There a questions line follows the last
pass, with how many of the questions people keep asking a shared document could answer
and why not the others, and then a budget line:

```console
$ loom curator status --namespace support
Expand All @@ -163,6 +165,7 @@ not met: The deployment has a model provider (needed for model opinions; an oper
not met: The namespace has a guide (needed for model opinions; a namespace admin can change it)
last pass: cur-1799999940, started 2027-01-15T07:59:00.000Z, completed (ok), 1500 ms; counted proposals 2
model: no_provider; the deployment has no model provider; 0 calls, $0.0000
questions: 1 draftable (A shared document could answer it), 2 no_evidence (No shared document answers it)
budget: the curator spent $0.0000 of its $1.2500 share in 24 hours; the namespace $0.4000 of its $5.0000 daily cost cap
```

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/curator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export interface CuratorLastPass {
export interface CuratorSetup {
code: string;
title: string;
/** `pass`, or `opinions` for what the model's opinions need as well. */
/** `pass`, `opinions` for what the model's opinions need as well, or `drafts` for what a
* repeated question needs to be counted as draftable. */
needed_for: string;
met: boolean;
/** The role that can change it: `operator`, `org_admin` or `namespace_admin`. */
Expand Down
22 changes: 17 additions & 5 deletions frontend/src/components/CuratorSetup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import type { CuratorBudget, CuratorSetup } from "../api/curator";

/** What a prerequisite is needed for, by the server's code; a code this build has no words
* for is shown as it is. */
const NEEDED_FOR: Record<string, string> = {
pass: "a pass",
opinions: "model opinions",
drafts: "a draftable question",
};

/** Who can change a prerequisite, by the server's role code; a code this build has no
* words for is shown as it is. */
const CHANGED_BY: Record<string, string> = {
Expand All @@ -9,8 +17,8 @@ const CHANGED_BY: Record<string, string> = {
};

/** The prerequisites that stand in the way of what `mode` asks for: none while it is off,
* what a pass needs in any other mode, and what the model's opinions need as well in
* `assist`. */
* what a pass needs in any other mode, and what the model's opinions and a draftable
* question need as well in `assist`. */
export function unmetSetup(setup: CuratorSetup[] | undefined, mode: string | undefined): CuratorSetup[] {
if (!mode || mode === "off") return [];
return (setup ?? []).filter((s) => !s.met && (s.needed_for === "pass" || mode === "assist"));
Expand All @@ -24,8 +32,9 @@ export function curatorAllowance(budget: CuratorBudget): string {
return `The curator's model calls may spend up to $${budget.curator_cap_usd.toFixed(2)} in 24 hours, its share of this namespace's $${budget.cap_usd.toFixed(2)} daily cost cap.`;
}

/** The prerequisites that are not met, each in the server's words with who can change it.
* An empty list draws nothing. */
/** The prerequisites that are not met, each in the server's words with what it is needed
* for and who can change it: an entry a draftable question needs stops no pass and no
* opinion. An empty list draws nothing. */
export function UnmetSetup({ entries }: { entries: CuratorSetup[] }) {
if (entries.length === 0) return null;
return (
Expand All @@ -35,7 +44,10 @@ export function UnmetSetup({ entries }: { entries: CuratorSetup[] }) {
{entries.map((s) => (
<li key={s.code}>
{s.title}.{" "}
<span className="text-text-muted">{CHANGED_BY[s.changed_by] ?? s.changed_by} can change this.</span>
<span className="text-text-muted">
Needed for {NEEDED_FOR[s.needed_for] ?? s.needed_for}. {CHANGED_BY[s.changed_by] ?? s.changed_by} can
change this.
</span>
</li>
))}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/flows/NamespaceSettingsDialog.curator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ describe("NamespaceSettingsDialog curator mode", () => {
).toEqual([
"the namespace's guide;",
"the text of each pending proposal of its shared scope that is not marked high, cut to 2,000 characters.",
"Title of provider. An operator of this deployment can change this.",
"Title of guide. A namespace admin can change this.",
"Title of provider. Needed for model opinions. An operator of this deployment can change this.",
"Title of guide. Needed for model opinions. A namespace admin can change this.",
]);
expect(note()).toHaveTextContent(
"The curator's model calls may spend up to $1.25 in 24 hours, its share of this namespace's $5.00 daily cost cap.",
Expand Down
25 changes: 15 additions & 10 deletions frontend/src/views/admin/Curator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,9 @@ describe("CuratorPanel's scheduled pass", () => {
need("mode", "pass", "namespace_admin", true),
need("model_on", "opinions", "org_admin", false),
need("guide", "opinions", "namespace_admin", false),
// A role a later server names is shown by its code.
need("drafts_on", "drafts", "reviewer", false),
need("gaps_on", "drafts", "operator", false),
// A purpose and a role a later server names are shown by their codes.
need("reports_on", "reports", "reviewer", false),
];
/** Clears the panel and the read it made, for the next one in the same test. */
const again = () => {
Expand All @@ -569,22 +570,26 @@ describe("CuratorPanel's scheduled pass", () => {
.queryAllByRole("listitem")
.map((item) => item.textContent);

// Fails when a met entry is listed, when an unmet one is listed without who can change
// it, or when a mode that asks no model lists what only the opinions need.
it("lists unmet setup entries with who can change them", async () => {
// Fails when a met entry is listed, when an unmet one is listed without what it is
// needed for or who can change it, or when a mode that asks no model lists what only
// the opinions or a draftable question need.
it("lists unmet setup entries with what each is needed for and who can change it", async () => {
await show({ ...FULL, mode: "assist", state: "deployment_off", next_due_at: null, setup: SETUP });
expect(passCard().getByText("Not met yet:")).toBeInTheDocument();
expect(unmet()).toEqual([
"Title of deployment_on. An operator of this deployment can change this.",
"Title of model_on. An org admin can change this.",
"Title of guide. A namespace admin can change this.",
"Title of drafts_on. reviewer can change this.",
"Title of deployment_on. Needed for a pass. An operator of this deployment can change this.",
"Title of model_on. Needed for model opinions. An org admin can change this.",
"Title of guide. Needed for model opinions. A namespace admin can change this.",
"Title of gaps_on. Needed for a draftable question. An operator of this deployment can change this.",
"Title of reports_on. Needed for reports. reviewer can change this.",
]);
expect(passCard().queryByText(/Title of mode\./)).toBeNull();
again();
// A mode that asks no model needs what a pass needs, and nothing more.
await show({ ...FULL, mode: "findings", state: "deployment_off", next_due_at: null, setup: SETUP });
expect(unmet()).toEqual(["Title of deployment_on. An operator of this deployment can change this."]);
expect(unmet()).toEqual([
"Title of deployment_on. Needed for a pass. An operator of this deployment can change this.",
]);
again();
// Off asks for no pass, and a list with every entry met is not drawn.
await show({ ...FULL, mode: "off", state: "off", next_due_at: null, setup: SETUP });
Expand Down
3 changes: 3 additions & 0 deletions sdk/go/client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading