Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs(eval): P4 sealed design on BEAM (pressure gate on BEAM-500K sealed, core gate on BEAM-100k sealed, report-only slice), power and cost at the $2,500 cap; BEAM development results and the two faults that invalidated earlier B runs

garrytan2c6268352fd0
diff --git a/docs/eval/CORE_MEMORY_PREREGISTRATION.md b/docs/eval/CORE_MEMORY_PREREGISTRATION.md
index fcbc6fd42f..40578dcd38 100644
--- a/docs/eval/CORE_MEMORY_PREREGISTRATION.md
+++ b/docs/eval/CORE_MEMORY_PREREGISTRATION.md
@@ -4,169 +4,193 @@ This file fixes the arms, metrics and pass bars for the always-loaded core
memory tier and the save-before-compaction path
([guide](../guides/core-memory.md)) before any sealed result exists. The
defaults these features ship with follow the sealed verdicts below; nothing in
-this file changes after the first sealed run.
+this file changes after the first sealed run. Changes made before that run are
+listed in the change log at the end, each with its date and reason.
## Question
Does an agent that loses its context to compaction answer later questions
better when (a) it is told to save what matters before compaction and can save
-several facts in one call, and (b) a small owner-designated profile is loaded in
-every session?
-
-## Benchmark
-
-- **E1, streaming LongMemEval-S with forced compaction.** The agent reads each
- question's history session by session as a live conversation, with a 32k
- token context window (a 128k slice runs as a secondary check), so compaction
- fires several times per question. It answers the question at the end from
- its context plus whatever it saved in gbrain.
-- The streaming agent loop, splits, judge prompt and judge model come from the
- shared held-out harness (gbrain-evals `p0-heldout-harness`, inspected at
- `2ab6eff`). At that commit the agent-compaction scenario is scheduled for the
- harness's milestone M2 and LongMemEval-S has no held-out portion (all 500
- questions are development data). The sealed source for E1 is therefore
- named by the harness custodian with M2 and recorded here, with the harness
- commit, before any sealed cell runs. Until then E1 runs on development data
- only and sets no default.
-- Every arm gets the same question-blind profile page (who the user is, built
- from the first session only, never from the question). Only arms C and D mark
- it as core.
+several facts in one call, and (b) a small owner-designated page of standing
+preferences and instructions is loaded in every session?
+
+## Benchmark and sealed sources
+
+The sealed sources come from the shared held-out splits (gbrain-evals
+`p0-heldout-harness`, `eval/decisions/splits/`, inspected at `9c7a3da`):
+
+- **Pressure gate (E1): BEAM-500K sealed, all 24 conversations** (480
+ questions, two of each of BEAM's ten question types per conversation),
+ reserved for this decision on 2026-10-04. Each conversation is about 500k
+ tokens, so a 32k-token window compacts it 30 to 70 times.
+- **Core gate (E1-core): BEAM-100k sealed, all 14 conversations**,
+ `preference_following` and `instruction_following` questions (56
+ questions). The reservation was added on 2026-10-05 in
+ `capy/p4-streaming-harness` `cd85997`; the custodian carries it into the
+ split file before the run.
+- LongMemEval-S is development data only (all 500 questions); its results
+ never move a bar. BEAM-1M sealed stays in the custodian's reserve.
## Harness
gbrain-evals `eval/runner/p4-stream/` (branch `capy/p4-streaming-harness`,
-`4c98318` at preregistration; the sealed run pins its own commit here first):
-
-- Each cell (question × arm × model) gets a fresh PGLite brain built by the
- arm's gbrain build, served as `gbrain serve --surface starter` over stdio.
- The agent sees the starter tools and the first 2,048 characters of the
- server instructions (Claude Code's per-server cap).
-- Haystack sessions stream in date order. A session's turns up to its last
- user message are replayed as history; the last user message is a live turn
- with a 700-token reply cap. Before each live turn the build's real
- `gbrain hook user-prompt` runs against a Claude Code-shaped transcript and
- its `additionalContext` is injected as a system reminder.
+`8cfae29` at this revision; the sealed run pins its own commit here first):
+
+- One stream per conversation and arm. Each stream gets a fresh PGLite brain
+ built by the arm's gbrain build, served as `gbrain serve --surface starter`
+ over stdio. The agent sees the starter tools and the first 2,048 characters
+ of the server instructions (Claude Code's per-server cap).
+- Sessions stream in order. A session's turns up to its last user message
+ are replayed as history; the last user message is a live turn with a
+ 700-token reply cap. A tool call cut off at that cap arrives with empty
+ arguments, so that step is reissued with an 8,192-token cap (both calls are
+ billed to the stream; the count is reported). Before each live turn the
+ build's real `gbrain hook user-prompt` runs against a Claude Code-shaped
+ transcript and its `additionalContext` is injected as a system reminder.
- When the next session would pass 95% of the window, `gbrain hook compact`
runs, the model summarizes the conversation (2,500-token cap), a
`compact_boundary` line is written, the history is replaced by the summary,
and `gbrain hook session-start` (source `compact`) is injected.
-- The question is a final live turn; its answer is judged 10 times with the
- LongMemEval judge prompt and `gpt-4o-2024-08-06`.
+- Every question of the conversation is asked from the same end state as a
+ final live turn. Answers are judged 10 times with the BEAM rubric and
+ `gpt-4.1-mini`.
+- Every arm gets the same question-blind standing-preferences page, written
+ by `gpt-4.1-mini` from the whole conversation without seeing any question.
+ Only arm C marks it core, so C − A′ measures always-loaded delivery against
+ retrieval of the same page.
## Arms
| Arm | gbrain build | What the agent gets |
|---|---|---|
-| A | master `6622a119e` | Baseline. |
-| A′ | gbrain#6025 head `5c82936a2` | Baseline with the MCP instructions reordered so prompt-critical clauses start under the 2,048-char cap (built from that PR's commit, per the custodian's direction; master once it merges). |
-| B | A′ merged with this PR (`73bd681cb`); `memory.core.enabled=false`, `memory.pressure.enabled=true`, `memory.pressure.context_window` = the window | Notice at 80% fill; `remember` with `items`. |
-| C | same build; `memory.core.enabled=true`, `memory.pressure.enabled=false` | The profile page is core and loaded every session. |
-| D | same build; pressure on, core on, `memory.core.remote_edit=notify` | Both, with remote edits to core allowed. |
+| A′ | master at the sealed run (contains gbrain#6025, the MCP instructions reordered under the 2,048-char cap; development used that PR's head `5c82936a2`) | Baseline. |
+| B | final head of this PR; `memory.core.enabled=false`, `memory.pressure.enabled=true`, `memory.pressure.context_window` = the window | Growth-aware save notice before compaction; `remember` with `items`. |
+| C | same build; `memory.core.enabled=true`, `memory.pressure.enabled=false` | The standing-preferences page is core and loaded every session. |
+
+Arm A (master before #6025) and arm D (both features, remote core edits
+allowed) ran in early development only and are not part of the sealed run.
## Models
The newest frontier model of each family, per the gbrain eval model rules
-(checked 2026-10-04): claude-sonnet-5-5, claude-opus-5-5, gpt-6.1-sol and
-claude-fable-5-1, each on the same fixed slice of the sealed source (drawn by
-the harness seed before any run; size set with the sealed source so the
-budget below holds). claude-sonnet-5-5, the model most users run, is reported
-first.
-
-Change log: the first draft named gpt-6-luna (full split) and
-claude-sonnet-5-5 (150-question slice). It was revised on 2026-10-04, before
-any cell ran, to follow the eval model rules (newest model of each family);
-the budget is re-estimated with the slice size.
+(checked 2026-10-05): claude-sonnet-5-5 (the gate model, the model most users
+run, reported first), claude-opus-5-5, gpt-6.1-sol and claude-fable-5-1. A
+model at 100% on every arm is reported as a ceiling and counts neither way.
## Metrics
-- Judged accuracy, 10 judge passes per answer, reported as mean ± SD, overall
- and per LongMemEval question category.
-- Evidence-saved rate: share of non-abstention questions where the agent saved
- at least one fact (`remember`) while a gold evidence session was live. Also
- reported: whether `recall` with the question as query returns one of those
- facts in its top five.
-- Cost per question (agent, gbrain's own provider calls, profile page), from
- the budget ledger.
-- Pressure notice fire rate (questions where it fired at least once) and miss
- rate (compaction segments with no notice before the compaction).
+- Judged accuracy, 10 judge passes per answer, overall and per BEAM question
+ type.
+- Evidence-saved rate: share of questions where the agent saved at least one
+ fact (`remember`) while a gold evidence session was live.
+- Cost per question and cost per correct answer (agent, gbrain's own provider
+ calls, standing-preferences page; stream cost shared evenly across the
+ conversation's questions), from the budget ledger.
+- Pressure notice fire rate and miss rate (compaction segments with no notice
+ before the compaction); `remember` tool errors; cut-off tool calls.
+
+## Pass bars (sealed sources)
-## Pass bars (sealed source, paired bootstrap 95% CI over questions)
+Differences are paired by question; confidence intervals are 95% cluster
+bootstrap intervals that resample whole conversations.
- **Pressure notice stays on by default** if, on claude-sonnet-5-5, B − A′ ≥
- +3.0 accuracy points with the CI lower bound above 0, no question category
- drops by more than 2.0 points, cost per question rises by at most 25%, and
- B − A′ is not negative on any other model. A model at 100% on every arm is
- reported as a ceiling and does not count either way. Otherwise
- `memory.pressure.enabled` ships `false`.
-- **Core delivery stays on by default** if C − A′ ≥ 0 on every model and no
- category drops by more than 2.0 points. Otherwise `memory.core.enabled`
- ships `false`.
-- D is reported but does not gate a default.
-
-## Power (measured on development data before any sealed cell)
-
-The 20-question claude-sonnet-5-5 pilot
-(`docs/eval/decisions/p4-stream-dev-pilot/`) measured a per-question SD of
-0.40 (B − A′) and 0.51 (C − A′). Detecting +3.0 points at 80% power with the
-95% CI excluding zero needs about 1,380 (B) and 2,270 (C) questions per model,
-more than LongMemEval-S holds. The sealed slice size, source and budget are
-decided by the custodian and the user from these numbers and recorded here
-before any sealed cell runs.
-
-## Sealed design (written 2026-10-05, before any sealed cell)
+ +3.0 accuracy points with the CI lower bound above 0, and no question type's
+ CI lies entirely below −2.0 points. Cost: pending the user's answer, either
+ the original "cost per question rises by at most 25%" or "cost per correct
+ answer no higher than A′'s". Otherwise `memory.pressure.enabled` ships
+ `false`.
+- **Core delivery stays on by default** if C − A′ ≥ 0 on every model that is
+ not at ceiling, and neither category's CI lies entirely below −2.0 points.
+ Otherwise `memory.core.enabled` ships `false`.
+- The report-only models decide nothing for the pressure gate; a negative
+ B − A′ on one of them is reported next to the verdict.
+
+## Development results (set no default)
+
+Recorded in `docs/eval/decisions/p4-stream-dev-pilot/`. On BEAM-500K
+development conversation `500k-10` with claude-sonnet-5-5 and the corrected
+harness, B scored 58.0% against A′'s 46.8% (+11.2 points, question bootstrap
+95% CI [−2.8, +27.0], per-question SD 0.35), at $0.73 against $0.45 per
+question ($1.26 against $0.97 per correct answer). The same conversation
+scored A′ 60.7% in an earlier run, so a single conversation moves about ±14
+points from run to run. On BEAM-100k development conversation `100k-1`, C
+scored 54.4% against A′'s 35.7%; on the four preference and instruction
+questions C answered all four, A′ two and a half.
+
+## Power and cost (computed before any sealed cell)
+
+- With the development SD of 0.35 and no clustering, 480 questions detect
+ +4.5 points at 80% power with the CI excluding zero; between-conversation
+ correlation widens that by √(1 + 19ρ) for an intraclass correlation ρ (one
+ development conversation cannot estimate ρ). Detecting +3.0 points at 80%
+ power needs about 1,070 questions, about 54 conversations, more than
+ BEAM-500K sealed holds. The gate keeps the +3.0 bar; an effect between
+ +3.0 and about +5 points will often fail it.
+- The smallest design that reaches the +3.0 bar at 80% power adds BEAM-1M
+ sealed (24 conversations; 48 in total, 960 questions, +3.2 points at ρ = 0)
+ on claude-sonnet-5-5 only, at about $1,800 for A′ and B, with no
+ report-only slice. It needs the custodian to release BEAM-1M from reserve;
+ it is not the design below.
+- Measured stream cost on development (claude-sonnet-5-5, judge included):
+ about $25 per BEAM-500K conversation for A′ and B together, about $3.30 per
+ BEAM-100k conversation for A′ and C together. Other models scale by their
+ token prices: claude-opus-5-5 ×2, gpt-6.1-sol ×1, claude-fable-5-1 ×5.
+
+## Sealed design (rewritten 2026-10-05, before any sealed cell)
Budget: the eval cap is $2,500 (raised from $1,400 on 2026-10-05 with Garry's
-approval, relayed by the custodian), dev spend included; about $205 is spent on
-development runs.
-
-**Pressure gate (decides `memory.pressure.enabled`).**
-- Gate model: claude-sonnet-5-5. Arms A′ and B; B is this PR's build with the
- growth-aware trigger, merged with the A′ build.
-- n = 200 questions, window 32k, judge 10x. With the development SD of 0.69,
- 200 questions detect an effect of +13.6 points at 80% power with the 95% CI
- excluding zero; the development effect was +50.0 [+20.0, +75.0].
-- Source: named by the custodian before the run (proposed: 200 LongMemEval-S
- questions drawn by the custodian's seed from the 480 that never ran through
- this harness; the 20 development questions are excluded).
-- Pass bar: B − A′ ≥ +3.0 points with the CI lower bound above 0 and no
- question category below −2.0 points. Cost: the development run cost +72% per
- question, so the original "cost ≤ +25%" criterion is replaced, pending the
- user's confirmation, by "cost per correct answer no higher than A′'s"
- (development: $3.83 for B against $6.68 for A′).
-- Estimated cost: about $920.
-
-**Report-only slice (decides nothing).** claude-opus-5-5, gpt-6.1-sol and
-claude-fable-5-1, arms A′ and B, on the first 25 of the 200 sealed questions.
-Estimated cost: about $860. Reported after the gate model, with ceilings
-called out.
-
-**Core gate (decides `memory.core.enabled`).** LongMemEval-S cannot exercise
-core (see Power). The gate moves to BEAM-100k `preference_following` and
-`instruction_following` questions on the 14 sealed conversations (56
-questions, clustered by conversation): every arm gets the same question-blind
-page of standing preferences and instructions, written by a fixed model from
-the whole conversation without seeing any question; only arm C marks it core,
-so C − A′ measures always-loaded delivery against retrieval of the same page.
-Pass bar: C − A′ ≥ 0 and neither category below −2.0 points. This arm runs
-only after the harness supports BEAM (one stream per conversation, all its
-questions asked at the end, BEAM rubric judge) and a development check on the
-6 development conversations (about $30) shows the arms run as intended.
-Estimated sealed cost: about $80.
+approval, relayed by the custodian), development spend included; about $310
+is spent on development runs.
+
+| Cell | Source | Models | Arms | Estimated cost |
+|---|---|---|---|---|
+| Pressure gate | BEAM-500K sealed, 24 conversations, 480 questions | claude-sonnet-5-5 | A′, B | about $610 |
+| Core gate | BEAM-100k sealed, 14 conversations, 56 preference and instruction questions | all four | A′, C | about $410 |
+| Pressure report-only slice | the first 4 BEAM-500K sealed conversations by the harness seed | claude-opus-5-5, gpt-6.1-sol, claude-fable-5-1 | A′, B | about $800 |
+
+Total about $1,820, leaving about $370 of the cap for overruns (compaction
+counts, and so stream cost, varied by 2× between development runs). Window
+32k, judge 10×, reply cap 700 with the cut-off tool call reissue.
E2 (live delivery, $4 cap) and E3 (latency) run as specified below.
## Procedure
-1. Iterate only on the dev split (this thread). Dev results never move a bar.
-2. The custodian runs the sealed split once per arm and model at the final PR
+1. Iterate only on development data (this thread). Development results never
+ move a bar.
+2. The custodian runs each sealed cell once per arm and model at the final PR
head, and records the verdicts with the run receipts in gbrain-evals.
-3. The verdicts above set the shipped defaults; a failed bar flips the default
- off in the same PR before merge.
+3. The verdicts above set the shipped defaults; a failed bar flips the
+ default off in the same PR before merge.
## Budget
-Hard cap $1,400 for all E1 runs, dev and sealed; the sealed slice size is chosen
-so the four-model estimate fits it. The live
-delivery check (E2) is capped at $4. Latency check (E3): session-start p95 under
+Hard cap $2,500 for all E1 runs, development and sealed. The live delivery
+check (E2) is capped at $4. Latency check (E3): session-start p95 under
1,500 ms with a full 4,000-char core, and non-core `put_page` overhead under
5 ms.
+
+## Change log (all before any sealed cell)
+
+- 2026-10-04: models moved from gpt-6-luna (full split) and
+ claude-sonnet-5-5 (150-question slice) to the newest model of each family,
+ per the gbrain eval model rules.
+- 2026-10-05: the sealed source moved from LongMemEval-S to BEAM, because
+ LongMemEval-S has no held-out portion and almost no question whose only
+ evidence is the first session (core cannot move there). The custodian named
+ BEAM-500K sealed for the pressure gate; BEAM-100k sealed was unreserved and
+ now carries the core gate. Arm D left the sealed run.
+- 2026-10-05: the per-category guard changed from "no category drops by more
+ than 2.0 points" to "no category's CI lies entirely below −2.0 points". With
+ 48 questions per BEAM question type (28 per core category) the point
+ estimate's standard error is about 5 points, so the old guard would fail by
+ chance on most runs.
+- 2026-10-05: development found two harness and product faults that made
+ every earlier B measurement invalid: `remember` with `items` still required
+ top-level provenance (fixed in this PR), and the 700-token reply cap cut off
+ long batched `remember` calls, which then arrived with empty arguments
+ (harness fixed by reissuing the step; gbrain now names that cause in its
+ error). Only results from the corrected harness and build count as
+ development evidence.
+- 2026-10-05: the cost criterion is pending the user's answer (see Pass bars).
diff --git a/docs/eval/decisions/p4-stream-dev-pilot/README.md b/docs/eval/decisions/p4-stream-dev-pilot/README.md
index 072779ef2d..7852524d3c 100644
--- a/docs/eval/decisions/p4-stream-dev-pilot/README.md
+++ b/docs/eval/decisions/p4-stream-dev-pilot/README.md
@@ -40,6 +40,61 @@ reach the automatic compaction point) reaches 72% of segments; the agent saves
three times as many facts, a fact from a gold evidence session in 56% of
questions, and answers 15 of 20 correctly against A′'s 5.
+## Two faults that invalidated earlier B results
+
+Every B result above, and the first BEAM B results below, ran with two faults:
+
+- `remember` with `items` still required top-level provenance, so a batch
+ whose items carried their own provenance was refused (277 of 336 `remember`
+ calls in one BEAM stream). Fixed in this PR: provenance may be given per
+ item.
+- The harness capped every live reply at 700 output tokens. A batched
+ `remember` call longer than that is cut off, and the API delivers the tool
+ call with empty arguments (`fact must be a non-empty string`; 182 of 245
+ calls after the provenance fix). The harness now reissues a cut-off tool
+ call with an 8,192-token cap and counts it (gbrain-evals `8cfae29`);
+ gbrain's error for an argument-less `remember` names that cause.
+
+The LongMemEval-S B numbers above (including the +50.0-point growth-trigger
+result) were measured with both faults and are not evidence for or against
+the feature.
+
+## BEAM development results (claude-sonnet-5-5, judge `gpt-4.1-mini` 10x)
+
+One stream per conversation; all 20 questions are asked from the same end
+state. Only the last two rows of the first table share the corrected harness
+and build.
+
+BEAM-500K `500k-10`:
+
+| Arm (build) | Accuracy | $ per question | Compactions | Facts saved | `remember` errors | Cut-off tool calls |
+|---|---|---|---|---|---|---|
+| A′ (`5c82936a2`) | 60.7% | 0.49 | 33 | 11 | 0 | not counted |
+| C (`73bd681cb`) | 57.3% | 0.52 | 37 | 13 | 0 | not counted |
+| B, growth trigger (`cd613d775`) | 80.7% | 0.93 | 66 | 162 | not counted | not counted |
+| B, compact receipts (`1dab44d69`) | 61.0% | 0.88 | 63 | 148 | 277 | not counted |
+| B, provenance fix (`349642275`) | 64.9% | 0.86 | 67 | 170 | 182 | not counted |
+| A′, corrected harness (`5c82936a2`) | 46.8% | 0.45 | 33 | 10 | 0 | 1 |
+| B, corrected harness (`349642275`) | 58.0% | 0.73 | 62 | 252 | 0 | 57 |
+
+With the corrected harness, B − A′ is +11.2 points (question bootstrap 95% CI
+[−2.8, +27.0], per-question SD 0.35, 45% of questions discordant). B costs
+62% more per question and $1.26 against $0.97 per correct answer. A′ scored
+60.7% and 46.8% on the same conversation in two runs, so one conversation
+moves about ±14 points between runs: this sizes the sealed run and shows
+plausible signal, nothing more. Core cannot move on this conversation:
+A′ already answers every preference question.
+
+BEAM-100k `100k-1` (core check):
+
+| Arm (build) | Accuracy | $ per question | Preference following | Instruction following |
+|---|---|---|---|---|
+| A′ (`5c82936a2`) | 35.7% | 0.11 | 0.75 | 0.50 |
+| C (`349642275`) | 54.4% | 0.10 | 1.00 | 1.00 |
+
+Two questions per category, so this only shows the arm runs as intended and
+the signal is plausible.
+
## Core on LongMemEval-S
The profile page comes from the first session only. In 11 of 500 LongMemEval-S
@@ -58,7 +113,7 @@ questions (40 each per size) test exactly that.
| claude-fable-5-1 | 8.61 (one cell) |
| gpt-6.1-sol | 0.85 (one cell) |
-## Power
+## Power (LongMemEval-S; superseded by the BEAM design in the preregistration)
With the measured per-question SD, a +3.0-point effect at 80% power with the
95% CI excluding zero needs about 1,380 questions per model for B − A′ and
@@ -69,4 +124,4 @@ $40,000; on claude-sonnet-5-5 alone about $5,200. The $1,400 cap buys about
28 questions across three arms and four models, where the 95% CI half-width is
about ±15 points.
-Spend for this pilot, the growth-trigger arm, the cost probes and the smoke runs: about $190 (plus $14.95 for the LME-S retrieval guardrail in `p4-dev-2026-10-04`).
+Development spend through the BEAM runs: about $294 on the streaming harness, plus $14.95 for the LME-S retrieval guardrail in `p4-dev-2026-10-04` (about $310 in total, from the budget ledger). The sealed design and its power are in the [preregistration](../../CORE_MEMORY_PREREGISTRATION.md).