Skip to content

Capture: write lasting lessons from agent sessions into the owner that serves them #2

Open
3 of 5 issues completed

Description

@lukemaj

What: Capture reads agent sessions on every machine, keeps only lessons that would change what a later agent does, and writes each one into the existing owner that will serve it.
Why: Nothing is captured yet, so later sessions relearn what earlier ones knew, serving has nothing new to deliver, and the router lacks real entries to learn from.
So what: Agents build the child Issues below in order; the user rules on blind batches of extracted items to calibrate the judge.

Outcome

On each machine, capture reads new session events through Agent Observer, extracts candidate lessons with two extractors, keeps the ones a calibrated judge grades as lasting, and classifies each into a destination owner, a serving lane and a visibility. One writer machine reflects each owner's candidates against the whole owner file, applies add, update or remove in code, and commits with receipts that make every re-confirmation of a known item a missed-serving signal.

Problem Statement

Agents relearn the same facts and procedures across sessions and machines. The knowledge exists in transcripts, but nothing turns it into short, scoped items in the places later sessions load or are served from. A naive capture keeps state (true only for one task or loop round), restates rules the session already had loaded, and writes duplicates or stale contradictions.

Solution

  1. Extract per machine. For each thread, the events since a per-thread cursor (earlier context marked as not-to-extract) go to two extractors in parallel with the same versioned contract. Each item carries its source event id, scope from metadata, and learned_from (failure, user, discovered, served_or_loaded, brief_or_parent, external).
  2. Judge blind. One judge sees both lists as A and B in random order, pairs items that state the same lesson, grades keep, state or junk, and flags unsupported. Code merges pairs into one item with found_by.
  3. Classify. Each kept item gets a destination owner, a serving lane and a visibility. Items whose moment-signalling words appear in the item become exact-key or session-start items; items without them are router (judgment) candidates. Code refuses a public destination for a private item rather than moving it.
  4. Reflect and apply on one writer. Per owner, serialized: pull, show the model the whole owner file plus its candidates, accept exactly add, update or remove, apply in code under strict rules, commit once per owner with opaque receipts, push, then delete the transit queue items.

Elon record

  • Requirements and who asked: capture runs per machine and keeps transcripts where they were recorded (user); extract, classify and shape, reflect with exactly add, update and remove (user); AI decides, code edits (user); write only to existing owners, no parallel store (user); AgentsMD rules change only through AgentsMD's own Issue and PR (user); a 4,000-character budget for preferences and persona (user); swappable models through T3 delegation (user); every re-confirmation of a known item is a missed-serving signal (user); two extractors with a judge calibrated to user rulings, then decide one or two from data (user).
  • Deleted: the earlier dated fact log and its separate data repo; a confirm action; inline item ids; a separate writer cursor and event log (commit trailers are the receipts); retrieval inside reflection (owners are small enough to read whole); every scheduler and the five-day gate; per-step cost tuning; the stale sweep (built last); a separate dedup pass; capture of parallel worker-batch threads (low yield, mostly restating the shared brief).
  • Bottleneck: the judge is uncalibrated until enough blind user rulings exist; every extractor score is measured through it.
  • Checked myself: the private design notes (capture design v2, both roasts, three gap reviews, the synthesis and the user's decision record of 2026-10-12); the capture pilot's per-extractor yield, wall time and token figures; Issues Serving: deliver stored knowledge before the agent's next decision on every host #3 and Router: a local model that matches the judge on unseen entries within one second #4 and their comments; Agent Observer Issue Combine Observer evidence across rocky, cavallo and bestia agent-observer#56.

Design review

  • Designer: Opus 5.5 (capture design v1, then v2 after the roasts).
  • Roasters: Grok 4.7 and Sol 6.1. Accepted findings are folded into v2: three actions only, no data repo, source time and scope from metadata, commit trailers as receipts, exact-text match plus evidence for removes, refuse-not-move privacy, a fixed proof table.
  • Gap reviewers: Opus, Grok and Sol at extra-high effort, merged into one synthesis. Capture corrections: drop restatements of loaded procedures, briefs and tool-enforced rules; add learned_from; require replacement evidence on the same scope instead of "older loses" by timestamp; judge each round on fresh rulings; size held-out sets from the target margin.
  • Verdict: foundation accepted by the user on 2026-10-12, with these decisions:
    • one writer machine; direct commits to project AGENTS.md only after the false-remove bar passes;
    • false-remove bar: 0 false removes on at least 50 remove-eligible cases;
    • capture prepares AgentsMD findings and the user opens the AgentsMD Issue until classify passes its bar;
    • Sol and Grok both extract, an Opus-class model judges;
    • judge bar: at least 90% agreement with user rulings on held-out items;
    • drop to one extractor if it loses 10% or less of user-confirmed lessons;
    • blind ruling batches of 20, stored as private benchmark data;
    • stop capturing parallel worker-batch threads;
    • restatements of an existing procedure or rule, items a tool already enforces or shows, task-, draft- or round-only state, and one-off trivia are not kept;
    • classify decides the serving lane by whether the moment's trigger words appear in the item; serving misses correct the classifier;
    • a missed serving counts only when the session learned the item the hard way (a failure, a user correction or rediscovery), never when it repeats a served or already-loaded rule.

Acceptance criteria

  • Every machine produces judged, classified queue items from its own sessions without copying transcripts elsewhere.
  • The judge meets the user's bar on held-out blind rulings, and the one-or-two-extractor decision is made from user-confirmed lessons.
  • Classify meets its bar with 0 private-to-public destinations.
  • The writer applies add, update and remove to existing private owners with receipts; project AGENTS.md receives direct commits only after the false-remove bar passes.
  • Items waiting for a serving owner reach the exact-key store or the router once those exist.

User stories

  1. As an agent starting work, I want lessons from earlier sessions already in the owner I load or am served from, so that I do not relearn them.
  2. As the user, I want to rule on a small blind batch instead of reviewing everything, so that the judge learns my bar without me reading every item.
  3. As the user, I want private knowledge never written to a public repository, so that capture is safe to run everywhere.
  4. As the serving system, I want every re-confirmation of a known item recorded with its moment, so that I can learn what I failed to serve.

Implementation decisions

  • No new store. A queue item is transit: it lives on the capturing machine, then in the writer's inbox, and is deleted once an owner commit carrying its key is pushed. Nothing serves from it.
  • Queue states: extracted, shaped, waiting-for-owner (trigger-keyed and router items until those owners exist), agentsmd-pending, refused (with reason). Key: machine, thread, event, index. The moment reference matches the serving log's fields so the two can be joined.
  • Owners: preferences and persona (loaded at session start, 4,000-character budget kept by rewriting; if a rewrite cannot fit, the user is told), project AGENTS.md, each project's Library, the private Great Library, the exact-key store and router entries (serving Spec Serving: deliver stored knowledge before the agent's next decision on every host #3). AgentsMD rules are proposals only.
  • Reflection rules, enforced in code: old_text must match the current file exactly; reflection cannot change the destination owner; an update or remove needs replacement evidence on the same scope; a different host or version scope is an add; each edit lands in the working tree before the next candidate is reflected; a re-confirmation is an update whose body differs only in the date stamp; every auto-loaded owner has a character budget.
  • Receipts: one opaque commit trailer per decision (key and action only, no item text). On startup the writer drops queue items whose keys are already committed. A rejected push resets, pulls and reflects the affected candidates again; never rebase.
  • Models: one T3 delegation target per step, overridable; saved task ids make runs resumable; each item records the model that actually ran.
  • Runs are manual until the proof below passes; scheduling and a quota guard are decided afterwards.

Testing decisions

  • Judge: agreement with held-out blind user rulings; held-out size chosen from the target margin.
  • Extractors: per-extractor share of distinct kept lessons, keep precision and unsupported count, on threads from days not used before.
  • Segments: segmented runs compared with whole-thread runs on the same threads.
  • Classify: about 100 user-labeled items, destination and lane scored separately.
  • Reflection: a frozen gold set built from real items and owner snapshots (paraphrase, true contradiction, scope split, late older candidate, same-run duplicate, budget rewrite that must keep every rule).
  • Apply: code tests that interrupt at every step (decide, edit, commit, push, delete) and compare final owner state and trailers with the gold.

Non-goals

Blockers

  • None. The user's rulings gate the judge bar inside the child Issues.

Required proof

  • Each child Issue's proof on its PR or Issue; the judge, classify and false-remove bars met on held-out data before any automatic write to a public repository.

Further notes

Full designs, roasts and gap reviews are kept as private design notes. Router training track: #4. Serving Spec: #3.

Sub-issues

Sub-issues

3 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. changed the title [-]Capture: extract lasting facts from yesterday's sessions into a dated fact log[/-] [+]Capture: write lasting lessons from agent sessions into the owner that serves them[/+] on Oct 12, 2026
  2. lukemaj commented on Oct 12, 2026

    @lukemaj
    ContributorAuthor

    Decision (user, 2026-10-12): no separate scheduled stale-item cleanup pass. Reflection updates or removes items on new evidence, the capture judge filters task state, and a served item found wrong is labeled wrong by the serve-outcome labeler (#15) and fixed through reflection. Revisit only if the serving log shows stale items being served.

  3. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Decision (user, 2026-10-13): capture judge v2 approved. The judge establishes four facts with evidence per item (recurred, fixed later, owner and fixability, already written down), and the user rules blind on items shown with those facts. Bar: 2 fresh rounds of 20, at least 36 of 40 agreements. Details and status are on #8. The capture build (PR #22) stays a draft until the bar is met.

  4. lukemaj commented on Oct 14, 2026

    @lukemaj
    ContributorAuthor

    Decision (user, 2026-10-14): capture works only when every link is trusted.

    ContextMD capture does not count as working until each of these is trusted, in order:

    1. Agent Observer: every session on every machine recorded completely and correctly.
    2. Preparation: the transcripts the extractors and judge read are complete and faithful.
    3. Extract.
    4. Judge.
    5. The system that decides what to add, update, remove or refresh, where, and how conflicts are resolved (Capture: reflect and apply add, update and remove on one writer #10, to be redesigned as its own step after the judge).
    6. Shaping the entry and applying it (the write step, PR feat(capture): shape-entry prompt and add-only capture apply (#9, #10) #44).

    This replaces the earlier gate that held only on the judge (#8). PR #22 and any claim that capture works wait on all six. Reviews of 1 and 2 are running now; extract is designed next.

  5. lukemaj commented on Oct 14, 2026

    @lukemaj
    ContributorAuthor

    Order agreed (user, 2026-10-14):

    1. Agent Observer records every native event: Record every native event: Grok and OpenCode assistant text, interrupts, stable message identity agent-observer#85.
    2. Agent Observer reports missing native sources: Report when an indexed event's native source is gone agent-observer#86.
      2b. When both land and Observer is confirmed working, the same three-model review (Grok xhigh, Sol xhigh, Opus medium) re-checks Observer, continued in the first review's dispatcher thread.
    3. Only then: design preparation v2 on Capture: extract and judge one machine's sessions into a local queue #7, reading from Observer (Opus designs, Sol and Grok roast, the user approves, the planner staffs the build).
    4. Then extract; its format is being designed now in a Spectrum.

    Review findings: preparation on #7 (comment of 2026-10-14); Observer in agent-observer#85 and #86.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions