Repository navigation
mentor.brief reports what the agent's use of Loom shows, from a call made to a graded run - #172
Merged
Merged
Conversation
zlareb1
force-pushed
the
feat/i160-evidence
branch
2 times, most recently
from
November 1, 2026 19:58
bd77d79 to
3541f1f
Compare
zlareb1
force-pushed
the
feat/i160-evidence
branch
from
November 1, 2026 23:35
c16ed88 to
6320cf3
Compare
…tcome, with the ledger's retention Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e mentor's own calls, and counts distinct reported keys Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…d search records its hits on the ledger Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ead is a returned hit; chunk ids are not memory keys Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… hit; a replayed set is no committed write; indexed means servable Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ped; bulk and by-id reads are tested as hits Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s name the sections they leave out Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t the current embedder's vectors; unattributed calls are named Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… agent; retention is the configured one; by-id reads are not found reads Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ent; a missing aggregate row is a failed read Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ts are recorded Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… the test mints with the fixture Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… is resolved inside its read Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… acknowledgments; the docs show the ladder as a table Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…er records recorded; stale wording fixed Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…pe the ledger rule to the ledger rungs Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…els resolve without FINAL; a landed by-key label is tested Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…read is None; graded runs are a filtered count Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…come labels use the counted-call rule Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…tover evidence names follow UsageRung Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/i160-evidence
branch
from
November 2, 2026 00:30
c2d7f17 to
d25324a
Compare
…nly when there are labels Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…l line says what the ladder counts Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ger calls Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…d comment Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…eader and the rung docstring say usage evidence Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…counts Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…loom.memory The embedding row's created_at is its version's write, so a revision of an old key passed the window filter. The key set skips granule pruning, which cost 1.2 GiB for 300,000 keys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Matching on the key alone counted one user's old embedded row for another user's new key, and counted a key that several users created once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s leave out Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #160
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
mentor.briefreports ausage_evidenceladder for the agent's use of Loom in the window: calls made, calls that succeeded,memory.setwrites that stored a row, written rows with a vector from the current embedder, reads that answered, distinct memory keys the agent reported relying on, and graded runs (the last two marked as a caller's report, not verified). It also gives the agent's oldest ledger row in the window and how long the ledger keeps the namespace's calls.Why
Issue 160 asks that an explanation of agent usage keep apart a tool attempt, a successful read, a committed write, an indexed write, a returned hit, an explicit client acknowledgment and a task outcome, and say "not observed in this window" when that is all the evidence supports. Today
mentor.briefreports calls per operation and hint adoption (a hinted op called later in the session). A call count alone cannot tell a read that answered from one that missed, or a write that stored nothing from one that did, and a client's report of what it relied on reads the same as something the server saw.Each count needs the result column that shows it (
out_noop = 'false',out_abstain = 'false', a hit, a found key), so a call that records no result, such as an idempotent replay, is an attempt and nothing more. Each rung ofMentorBriefOutput.usage_evidencecarriescount(None when the read failed),source(server: Loom saw it;client: a caller reported it, unverified) and ameaningthat says what the count is and what it does not show:attempt-—memory.get_by_id, an MCPmemory.updatethat names none, and the Python SDK'smemory.updateby default — and any call that reads across agents,agent: *— the SDKs' default formemory.searchandmemory.ask,memory.outcome's default, and how the MCP transport sendsmemory.search,memory.list,memory.history,memory.relatedandmemory.search_traceunless another agent is named. A brief is about one agent's rows) (loom.agent_events,kind = 'request': not thememory.ask.consistencyverdict a deferred ask leaves under the asking agent); the dashboard's traffic (consumer = 'loom-ui') andmentor.brief(ledgered under the agent it names) left outsuccesssuccess = 1; a read that found nothing countscommitted_writememory.setcalls whose row saysout_noop = 'false': not a restated memory merged into the one Loom had or a dry run (both answernooptrue), and not an idempotent replay (HTTP or MCP), whose row records no result. The other write ops do not say on the ledger whether they stored a row (memory.updateanswersupdated: falsefor a missing key, abulk_setmay merge every entry), so they are not counted here rather than counted as storedindexed_writeuser_id,session_idand key, the memory's identity), by any write op, with a vector from the current embedder (embedding_model= the embedder's model,embedding_dim > 0), a served status (served_status_sql), not pastexpires_at. When a key was first created is read fromloom.memory, which carriescreated_atforward across versions (an embedding row'screated_atis its own version's write, so a revision of an old key is not counted)returned_hitmemory.search/memory.askcalls that recordedout_abstain = 'false',search.querycalls with a hit (out_section_hits, below), andmemory.getormemory.bulk_getcalls under the agent that found their key (out_found,out_found_n; a delete answersfoundtoo, and is not a read)client_acknowledgedrun.completememories_used(which keeps only keys a live row answers;chunk:ids, which name a passage, left out) and its successfulmemory.outcomelabels by id withoutcomeusedorpositivethat landed on a row (out_recorded = 'true', a field the ledger now records), resolved to the row's key. A label by key is not counted: it resolves under the row writer'sagent, so the ledger records it under the writer whoever gave it. Nor are the Python SDK'soutcomeandoutcome_by_key(no agent, recorded under*) ormemory.outcome_run(no agent field);source: clienttask_outcomerun.gradepassorfail, fromagent_runs.grade);source: client, since the grade is the grader's report and Loom checks no task itselfsearch.query(loom_searchover MCP) answers with a hit list per plane and no top-levelabstain, so its ledger row now recordsout_section_hits, the hits across its memory, document and conversation sections (a section that abstained keeps its below-threshold hits as evidence and is not counted; the profile section, which falls back to matching by meaning and answers nearly any query, and the tracker's duplicate-check verdict, which answers whether a defect is filed rather than what is remembered, are not counted) (server/observability/event_args.py::_read_outcome_columns). A build one release older writes neither new field (out_section_hits,out_recorded), so itssearch.querycalls count as attempts but not as returned hits, and itsmemory.outcomelabels are not acknowledgments: until it is replaced, and then for one window, while its rows are still inside it.The ladder is read at each brief, after the profile and not from it, over the window the brief reports (a cached profile keeps the window it was read over), so it answers when the mentor is off too: the profile is warmed by the agent's own calls, so a count cached from the first call of a session would miss everything after it.
ledger_fromis the agent's oldest ledger row in the window, of any kind (one scan computes it with the counts, each count carrying its own condition), andledger_retention_dayshow long the configured retention keeps the namespace's ledger rows: the namespace's ownretention_dayswhen it sets one, elseLOOM_RETENTION_AGENT_EVENTS_DAYS(0: until deleted). It is the configuration, which the table's TTL takes on at the next retention reconcile, not the TTL read back from the table. A window longer than the retention leaves the rungs read from the ledger (attempt,success,committed_write,returned_hit) covering less than it names; the CLI table says how many days the ledger keeps when it keeps fewer than all.Scope and risk
(org, namespace, agent)(the call ledger's and the embedding table's sort-key prefix) or(org, namespace). None replaces an existing read. The memory keys the runs reported (_CREDITED_KEYS) are one SQL fragment shared with the profile's existing credited-keys read.loom.memoryas anINset of(user_id, session_id, memory_key)withuse_index_for_in_with_subqueries = 0: pruning the embedding table's granules by a set of 300,000 keys took 1.23 GiB and about 2 s, while the(org, namespace, agent)prefix alone reads 626,000 rows in 94 MiB and about 250 ms (system.query_log, 300,000 memory and embedding rows under the briefed agent; about 95 ms once warm).memory_id IN (the labelled ids from the agent's ledger slice), with noFINAL(a memory's key never changes across versions). With no labels theINset is empty and ClickHouse reads noloom.memorygranules: on a namespace of 300,000 memory rows and 300,000 call rows, all under the briefed agent, the statement read 300,020 rows (the agent's ledger slice and its runs; 293 KiB) in 16 ms at the median (system.query_log; the first, cold one 229 ms).skipped(calls,indexed_writes,reported_keys,graded_runs,retention), and the rest of the brief still answers.Compatibility, rollout and rollback
search.queryrow gainsargs['out_section_hits'], and a result that answersrecorded(memory.outcome, among others) gainsargs['out_recorded'].MentorBriefOutputgainsusage_evidence[]ofUsageRung(named apart fromhints[].evidence, the counts a rule fired on) (rung,count,source,meaning),ledger_fromandledger_retention_days. No input changes.loom-mentorskill reference namesusage_evidence; both plugin manifests go to 1.2.2. The plugin evals grade theloom-memorywrite guidance only, which this does not change.Tests
tests/unit/test_event_args.py): an outcome records whether its label landed (out_recorded); a sectioned search records its hits across sections, zero when it found none or its memory section abstained, the profile and tracker sections not counted, and nothing for a result with no sections.tests/unit/test_mentor.py): the ladder in order with each rung's count and source (attempt, success, committed write, indexed write, returned hit), the client's report and the graded runs markedclientand read live rather than from the cached profile, and the ladder's rows in the CLI table; the namespace's retention winning over the ledger default, and the default shown when it sets none; a failed read leaving its rungs uncounted and named inskippedwhile the other reads answer (the fullskippedlist asserted), a failed retention read leaving the retention unknown, the ladder counting the cached profile's window when the brief asks for another, an embedder that fails leaving onlyindexed_writeuncounted, a brief about no agent in particular having no ladder, the indexed-writes statement run on clickhouse-local against the real tables (an old key revised today not counted, one user's new key that is not embedded yet not counting another user's old embedded row under the same key, and three users who each created the same key counted as three), and the ladder answering when the mentor is off.tests/integration/test_mentor_evidence.py, private ClickHouse and server): an agent writes a fact and retries the write with the sameIdempotency-Key(answered as a replay), restates it under another key (a no-op), dry-runs a third write, reads the fact and a missing key, bulk-reads both, reads the fact by id (recorded under no agent, so not counted), runs amemory.searchthat abstains, asearch.querywith a hit and amemory.ask, amemory.searchacross agents (agent: *, recorded under*, so not counted), and over MCP aloom_memory_get, aloom_searchand, with a token, aloom_memory_updatethat names no agent (recorded under none, so not counted), writes and deletes a scratch row (the delete answersfoundand is not a hit), completes a run reporting the fact as relied on, has a grader pass the run, stores a second fact and labels itusedthroughmemory.outcomeby its id, a third and labels itpositiveby key (recorded under the writer, not counted), and labels a key that holds no row (recorded: false, not counted); a dashboard read under the agent's name, a failedmemory.ask.consistencyverdict row and the briefs the test polls with are left out. The brief counts 22 attempts and 22 successes, four committed writes (not the replay), three indexed writes (the deleted row no longer counts), six returned hits (seven when the ask answered), two keys acknowledged by the client, one graded run, aledger_from, and a known retention.tests/analyzer) runs the five new statements (mentor_evidencecase).make format lint typecheck, the unit tests named above and the generator checks.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked each rung's predicate against the ledger columns the transports write, and the integration run against a live server.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited. (No migration.)loom-mentorskill reference changes; both manifests go to 1.2.2.)npm --prefix frontend run build) and its tests pass, iffrontend/changed. (No frontend change.)docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code