Repository navigation
feat(knowledge): lean agent tool results and hash-prefix write fences - #196767
Conversation
OpenClaw-Publication: 9de0af9f-3960-4a5d-8bb6-729235cf33ea
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis PR reduces default Knowledge tool responses and allows revision-fenced writes using hash prefixes of at least 16 hexadecimal characters. Example: An agent lists claims connected to Garden Pilot.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: the owner-directed context reduction is useful, but the projections need correctness repairs and the patch introduces a confirmed CI failure. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Knowledge plugin receives authorized agent and operator requests, delegates reads and writes to its existing service and storage owners, and projects agent results before schema validation and JSON delivery. flowchart LR
A[Agent tools] --> B[Feature entry]
C[Operator and Control UI] --> B
B --> D[Knowledge service]
D --> E[Authorized storage]
E --> F[Complete results]
F --> G[Agent result projection]
G --> A
F --> C
Technical reviewBest possible solution: Keep the single agent adapter and shared fence comparison, while preserving uncertainty, lossless pagination, enforced response bounds, and typed regression coverage. Do we have a high-confidence way to reproduce the issue? The projection defects follow directly from the inspected source, and GitHub independently confirms the introduced unchecked-cast failure; no target code or tests were run during this read-only review. Is this the best way to solve the issue? A single projection adapter is a reasonable extension of the existing compact-search owner, and the removed compact-hit implementation avoids a competing path, but compaction must retain semantic qualifications and pagination integrity. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 47b0ce478c81. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 12:38 PM ET / 17:38 UTC. |
OpenClaw-Publication: 5e45559f-7f2d-4541-a194-dc82c1d35168
OpenClaw-Publication: aa4240cf-2d4f-43cb-a912-9d9c4e28f88f
…s in agent record reads
OpenClaw-Publication: ae107101-0dd6-4c8b-97cd-7059316a3108
OpenClaw-Publication: 9e0b2be9-7c9b-45ac-b43c-2cd3766fef8c
|
Merged via squash auto-merge.
|
…openclaw#196767) * feat(knowledge): lean agent tool results and hash-prefix write fences * fix(knowledge): address lean result review findings * test(knowledge): connections keep a null final nextOffset * feat(knowledge): lean agent tool results and hash-prefix write fences OpenClaw-Publication: 9de0af9f-3960-4a5d-8bb6-729235cf33ea * refactor(knowledge): agent tool inputs select data only; UI keeps detail operations * test(knowledge): use detail operations for complete reads * Publish openclaw/vivid-langoustine OpenClaw-Publication: 5e45559f-7f2d-4541-a194-dc82c1d35168 * fix(knowledge): satisfy lint, assertion and test-line ratchets * Publish openclaw/vivid-langoustine OpenClaw-Publication: aa4240cf-2d4f-43cb-a912-9d9c4e28f88f * fix(knowledge): keep fields, attribution doubt and exact claim windows in agent record reads * Publish openclaw/vivid-langoustine OpenClaw-Publication: ae107101-0dd6-4c8b-97cd-7059316a3108 * fix(knowledge): restart each record budget attempt from the whole body window * Publish openclaw/vivid-langoustine OpenClaw-Publication: 9e0b2be9-7c9b-45ac-b43c-2cd3766fef8c
…ontract (openclaw#195031) Merged openclaw#196767 renamed service.record to record_detail, removed the `detail` search input and retired isFullHit from the surrounding retrieval tests. The added regression block still targeted the pre-merge API, so on the main x head merge tree it failed before exercising Unicode retrieval: check-test-types reported 6 TS errors and checks-node-changed-extensions-config failed with `TypeError: f.service.record is not a function`. Port only the added regression block to current main's contract: - capture records via service.record_detail({id}, owner).record - drop `detail:"full"` from the three grep calls; service.grep now returns full hits (snippet/citation) directly, only agent.grep is compact - consume result.hits without the isFullHit type guard (2 sites) Surrounding tests and imports are intentionally untouched: the merge takes main's versions, which no longer export retrieval-hit.ts or isFullHit. Verified on the real main x head merge tree: git diff --check clean, and a standalone shipped-service harness confirms record_detail is callable, grep without `detail` yields full hits with verbatim snippet slices, and canonical NFC/NFD queries return identical hit sets. CI-identical local vitest/test-types are unavailable here because the shared node_modules symlink lacks the UI vite plugin and the workspace knowledge package; CI remains the gate.
) * fix(knowledge): page prose and claims render too light on macOS Knowledge pages forced antialiased font smoothing on the whole page, which disables macOS stem darkening for long-form reading text. Page prose and claim text now use auto smoothing; Knowledge controls keep the app's antialiased chrome. The plugin-view benchmark Knowledge fixture now answers record_detail, the operation the record page reads since #196767, so the new e2e can open a page. Co-authored-by: vyctorbrzezowski <[email protected]> * fix(knowledge): page prose and claims render too light on macOS Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 9356479c-aae4-4ebf-ab82-9d479b40f44c * test(ui): retain behavior coverage for reading fonts --------- Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: Vyctor H. Brzezowski <[email protected]>
…claw#197479) * fix(knowledge): page prose and claims render too light on macOS Knowledge pages forced antialiased font smoothing on the whole page, which disables macOS stem darkening for long-form reading text. Page prose and claim text now use auto smoothing; Knowledge controls keep the app's antialiased chrome. The plugin-view benchmark Knowledge fixture now answers record_detail, the operation the record page reads since openclaw#196767, so the new e2e can open a page. Co-authored-by: vyctorbrzezowski <[email protected]> * fix(knowledge): page prose and claims render too light on macOS Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 9356479c-aae4-4ebf-ab82-9d479b40f44c * test(ui): retain behavior coverage for reading fonts --------- Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: Vyctor H. Brzezowski <[email protected]>
Release adaptation: extract only fragment-before-decode repair and focused scan/backlink regression from openclaw#191791; retain baseline parser and unrelated test cleanup. Later openclaw#195027, openclaw#196767 and openclaw#198441 changes are unrelated and already represented by baseline parser structure; no later PR-number follow-up. (cherry picked from commit 2563438) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 7fdc9ad3b334ac08cb9a76604cfbb78ec56ef479) (cherry picked from commit af609748bca14f61086ecfa82a961787701bdfcd)
What Problem This Solves
Knowledge tool results spend most of an agent's context on data it rarely uses. In the Knowledge trial (6,800 calls, 57.8M characters), connections alone were 49% of output: full summaries of linked pages, timestamps, paths, repeated metadata and fixed explanatory messages. The tools also carried many presentation options (
view,metadataView,includeCards,includeReferences, …) that agents had to learn and that are sent with every turn.User Impact
User impact: agents get the same answers in about a third of the context, from tools with fewer parameters. Agent tool inputs now select which data to read, never how much of each record to show; there is no "full" mode. Lists return 16-character hash prefixes that fence writes directly, and write receipts carry the ontology fingerprint the next write needs. The Control UI, operator inspection and commands still receive complete responses.
Breaking for agent prompts and skills:
knowledge_recorddropsview,metadataView,includeMetadata,includeReferences,referenceOffset/Limit,evidenceLimit,maxEvidenceChars;knowledge_connectionsdropsview,includeCards,includeEndpoints;knowledge_recordsdropsincludeCards,includeEndpoints. Calls passing them fail input validation with a visible error. Bundled skills are updated.Why This Change Was Made
knowledge_recordtakesid,offset,maxChars,includeEvidence,evidenceOffsetand returns identity, full hash, body or claim text, aliases, tags, dependencies, non-empty fields, linked pages, subject hint;maxCharsbounds the whole response by shortening the text (identity and metadata are never cut). Non-high attribution confidence and its basis stay visible; claims carry an occurrence date only, never the ingestion time. Connections and records return shared list rows (tool-rows.ts): id, revision, 16-char hash; pages add title/type, claims add kind, day, comment-stripped text (truncatedpast 4,000), linked page titles and source; relationships add from/to.record_detail,connections_detailandrecords_detail(no tool). The agent tools call them with the data the agent asked for (tool-results.ts). Shared operations (grep, lookup, timeline, ontology, status, verify, writes) project forcontext.source === "tool"only.inspection.ts): under the 24 KiB response budget the body shrinks first; compact domain fields are omitted only when no body text fits beside them (omittedlistsmetadata.fields, and the publish skill says to omitfieldsso they are preserved). Each attempt restarts from the whole window, so continuations always advance or end.ontologyFingerprint; state/message only when not published; git only when not committed.knowledge_mutation/knowledge_historykeep complete receipts.expectedOntologyFingerprintis unchanged.hashMatches(hash-fence.ts) at every fence site (storage-edits, storage-lifecycle, storage-publication incl. batch edits, supersede, lifecycle, evidence-reconciliation, verification). Accepts the full hash or a lowercase hex prefix of ≥16 chars; revision must still match;ExpectedHashrejects shorter prefixes. Reasoning: the fence protects against concurrent and external edits to a record selected by ID, not against forged content; a 64-bit SHA-256 prefix makes an accidental match negligible.knowledge_verifyexpectedLinks; neighbors toknowledge_connections. Removed the oldsearch-detail.tscompact-hit path. Docs and skills (regenerated withsync-skill-references.mjs) describe the new shapes.Not changed: JSON serialization (separate core change),
expectedOntologyFingerprintoptionality (undecided), history/mutation/revision/diagnostics/attachment/attach/relink.Overlap: unpushed skill changes on
openclaw-3c9/knowledge-page-curation(516f9fb67ab6, 7241cff12d9b) edit the same skill files; expect conflicts.Evidence
This branch's projection re-run over the trial's real model-visible arm A results (sample averages scaled to arm totals; trial rows measured with the added 16-char hash; record calls measured as
includeEvidenceonly, since the other options no longer exist):Agent tool definitions (input schema + description, all Knowledge tools): 96.0k chars on main → 95.9k;
knowledge_record2,707 → 1,220,knowledge_connections1,603 → 1,226,knowledge_records1,932 → 1,618.Tests:
tool-results.test.tsdrives the registered tools through the real plugin entry andjsonResult: default shapes for every read tool and receipt; removed options rejected;*_detailUI operations still return complete shapes;maxCharsbounds page and claim responses with exact reconstruction; fences (16-char prefix accepted; 15-char, wrong, stale-revision and superseded-hash rejected; list-row prefixes fence annotate/withdraw); final page keeps its snapshot; merged IDs collapse; fields, attribution confidence and occurrence dates survive record reads; oversized fields are omitted with a terminating read; lean < 60% of complete.Runs: full
extensions/knowledgesuite 65/68 files passed (3m33s); the three failing files were tests still calling the renamed operations, fixed and re-run with claim-cards (4/4 passed, 1m27s). At 3c1b046: tool-results, inspection, records-continuation, retrieval and control-ui pass (5/5).tsgo:extensionsandtsgo:extensions:testclean; type-aware oxlint, oxfmt and the assertion-safety ratchet clean; skill sync check andgit diff --checkpass.Review: the first Astra review found six P2 issues; all fixed with regression tests. A second review of c93786b found five P2s (attribution confidence dropped,
maxCharsdescribed as a hard bound, compact domain fields dropped before the body shrank, staleviewinstructions in conventions and theknowledge_edit_bodydescription, ingestion time shown as the claim date); all fixed, with tests red before and green after. A delta review found three continuation defects in the reworked budget; fixed and covered by a regression test. The final delta review found none.CI repairs: type-aware oxlint (
require-array-sort-compare, twono-unnecessary-type-parameters), two type assertions givenSAFETYcomments, threeas anytest casts removed, and a test-line allocation for this PR's net regression-test growth (config/test-lines-allocations/196767-knowledge-lean-tool-results.txt, 645). Head c93786b passed every CI check.Not run: a live Gateway trial (the originating session reruns it on vault copies).