Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/master' into capy/mpw-integration

garrytan8ec392613e55
diff --cc docs/architecture/key-files/evaluation.md
index 859978da6c,da42567da3..041e1bebb8
--- a/docs/architecture/key-files/evaluation.md
+++ b/docs/architecture/key-files/evaluation.md
@@@ -5,7 -5,7 +5,8 @@@
[Subsystem index](../KEY_FILES.md). Read only the entries relevant to your change.
Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG.
+- `scripts/eval-c2-candidate-fusion.ts` + `scripts/eval-c2-embed.py` — the C2 offline eval: a seeded synthetic fixture (40 companies; single-valued claims with changed numbers/dates, coexisting similar claims, private rows, a dense crowded slice, back-to-back corrections) replayed on PGLite through `listSupersessionCandidates` for `facts.candidate_fusion` `rrf_free` vs `interleave`, embedded once with a free local model. Reports twin recall@5, false supersession, preserved distinct claims and correct decisions per threshold, paired by probe and clustered by company (`pairedClusterStatistics`); at 0.95 the real `decideSingleFact` runs beside the replayed rule and must agree. Output: `docs/eval/decisions/c2-interleave-dev/verdict.json`.
+ - `src/eval/longmemeval/evidence-brief.ts` — experimental, eval-only evidence brief (10x memory advantage plan, wave 1 item A3). Pure: `buildBriefPrompt` (question-aware) and `buildDigestPrompt` (one session, no question) build a cheap builder's prompt over the intact delivered sessions; `parseBriefDraft` reads its JSON; `validateBrief` grounds every quote with the dream-cycle verifier (`groundSource`/`groundQuote`/`unsupportedNumericClaims`, LongMemEval `**user:**` turns via `lmeTurns`), drops ungrounded, misattributed, number-unsupported and instruction-context claims (counted in `validation.dropped`), withholds a paraphrase whose negation disagrees with its quote, appends uncited later corrections verbatim, never presents a count as complete, replaces absence wording with "no supporting evidence was returned from the searched scope" plus the searched sessions, renders claims inside sanitized `<chat_session>` blocks within a cl100k budget, and falls back to the full text when parsing or grounding fails. Pointers are UTF-16 spans into the sanitized session text with span and body SHA-256 (`verifyPointer`). Grounding is provenance, not truth. No model call, no production default. Tests: `test/evidence-brief.test.ts` (pointer round trip, adversarial fixtures, fallback).
- `src/eval/longmemeval/reader.ts` + `gateway-client.ts` — the LongMemEval answer request seam, exported as `gbrain/eval/longmemeval/reader`. `resolveReaderConfig` selects notes-first/1024 by default or the frozen direct-v3/512 baseline; `buildReaderRequest` changes only the system instruction and budget, retaining the same full-session sanitizer, evidence order and dates. `readerConfigHash` pins mode, system-prompt version/sha, requested model and token budget. `generateAnswer` reports the provider finish reason, joins every text block and keeps the call's provider-normalized `usage` (A1: `ReaderUsage` with total, uncached, cache-read and cache-write input, output and reasoning tokens; the cache counts are subsets of the total), which the command writes as `reader_usage` on every answered row (null when no reader call ran). `readerUsageFromMessage` reads the gateway adapter's `gbrain_usage` record or the Anthropic Messages convention. The command records `reader_partial_output` as a diagnostic, never a completed hypothesis, when the reader stops at the limit or returns empty/unknown completion; those failures count in the judged headline denominator and fail the run without automatic paid retries. Tests: `test/longmemeval-reader.test.ts`, `test/eval-longmemeval-reader-mode.slow.test.ts`, `test/eval-answer-packet.test.ts` (historical explicit direct baseline).