Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs(get): section/grep in the tool reference, memory boundaries and key files; regenerate tool catalog, operation manifest and the --tools-json golden (#7180)

garrytanfdd1e9ed9bbe
diff --git a/docs/TOOL_CATALOG.md b/docs/TOOL_CATALOG.md
index f999fc141d..51c334ad7a 100644
--- a/docs/TOOL_CATALOG.md
+++ b/docs/TOOL_CATALOG.md
@@ -178,7 +178,7 @@ Every non-localOnly operation on the MCP surface: 157 tools across 25 areas. **S
| `edit_page` | Change part of a page: prefer this over put_page for small changes. | write | yes | |
| `fetch` | Fetch the full text of one search result by its opaque, source-qualified `id` (OpenAI deep-research contract: the search/fetch pair). | read | | |
| `get_chunks` | Return a page's indexed content chunks (the units search ranks), in chunk_index order, 50 at a time by default. | read | | |
-| `get_page` | Read a page by slug. | read | yes | |
+| `get_page` | Read a page; `section` or `grep` reads one part. | read | yes | |
| `get_page_upload` | An upload's state and next_part, to resume after a lost reply. | write | | |
| `get_raw_data` | Retrieve raw data for a page. | read | | |
| `get_versions` | Page version history, newest snapshot first: metadata only (id, snapshot_at, title, type, tags, frontmatter) for the newest 20 versions by default. | read | | |
diff --git a/docs/architecture/key-files/belief-ledger.md b/docs/architecture/key-files/belief-ledger.md
index d9c0dd3d9b..06e00f0578 100644
--- a/docs/architecture/key-files/belief-ledger.md
+++ b/docs/architecture/key-files/belief-ledger.md
@@ -18,7 +18,7 @@ Design: [BELIEF_LEDGER.md](../../designs/BELIEF_LEDGER.md). Operator surface: `g
- `src/core/belief/page-at-time.ts` — W2 page-at-time (BELIEF_LEDGER.md section 10): `readPageAtTime` replays a slug's page events of every lifetime into validity intervals under the section 5.3 visibility rule (a straddling write refuses `known_as_of_unproven`), refuses `coverage_from` / `coverage_gap` from `coverageAt`, and pairs each closed interval with the preimage version the next transition wrote (by revision, in order); the open head reads the live page. A body no version holds is disclosed (`body_reason`), never borrowed. Purge-redacted events carry no revision, so a purged lifetime splits only on slug and deleted state. `remoteMayRead` applies history.ts's remote rule per interval.
- `src/core/belief/preimages.ts` — the preimage invariant (BELIEF_LEDGER.md section 14 item 8): a revision-moving publication leaves a version of its `revision_before`. `missingPreimages` is the in-batch check `finalizeBeliefEvents` runs under `NODE_ENV=test` (off with `GBRAIN_BELIEF_PREIMAGE_CHECK=0`); `preimageGaps` is doctor's production scan (large and segmented pages exempt).
- `src/core/belief/changes.ts` — W4 weekly change diff (BELIEF_LEDGER.md section 15): `beliefChanges` reads the window through `readBeliefHistory` (`recordedAfter`/`recordedUntil`, then `subjectKeys` up to `since` for each subject's value before), nets each subject end to end, reads a subject with no earlier event from the page body at `since` (`before_known: false` when no body answers), lists a page created in the window with its creation body's fence rows, flags a `dream`-inferred link end `upper_bound`, and skips backfill and baseline events. Remote callers get world fence rows only where `remoteMayRead` passes. Served by `delta {beliefs: true}` and `gbrain beliefs changes`.
-- `src/core/ops/known-as-of.ts` — the op surface: `get_page {known_as_of}` and `get_versions {known_as_of, diff, source_id}` (full surface only). One target source (explicit, ambient, or the only granted source whose ledger names the slug); remote callers get only readable intervals of a page visible now at their trust floor, with sanitized bodies. `parseKnownAsOf` refuses a bare date `clock_mismatch`.
+- `src/core/ops/known-as-of.ts` — the op surface: `get_page {known_as_of}` and `get_versions {known_as_of, diff, source_id}` (full surface only). One target source (explicit, ambient, or the only granted source whose ledger names the slug); remote callers get only readable intervals of a page visible now at their trust floor, with sanitized bodies. `parseKnownAsOf` refuses a bare date `clock_mismatch`. Window selectors, `section`, `grep` and `context` do not combine with known_as_of (`invalid_params`).
- `src/core/engine-sql/pages.ts` `updateSlug` — versions the page before the move (the move advances the revision), so page-at-time has the body from before a rename.
- `src/commands/beliefs.ts` — `gbrain beliefs enable|disable|status|changes|reconcile|backfill|replay-purges` (`--json`); an unknown source is `invalid_params`. Only `changes` routes on a thin client: `thin-client-routing.ts` calls the host's `delta {beliefs: true}` (so it lists the remote world view) and refuses `--source`; every other subcommand is host-only.
- `src/commands/doctor/checks/belief-ledger.ts` — doctor `belief_ledger_coverage`: intervals and certification, baseline progress, drift (sampled; complete under `--tier deep`), orphan lifetimes, unmarked publications, and a restore whose purge replay was partial, unavailable or unverified (`ask_user`). `--fix` reconciles and fills marks; a brain without coverage is information with an `ask_user` enable.
diff --git a/docs/architecture/key-files/core-services-2-continued.md b/docs/architecture/key-files/core-services-2-continued.md
index 0cbd6801a1..4b34b3635b 100644
--- a/docs/architecture/key-files/core-services-2-continued.md
+++ b/docs/architecture/key-files/core-services-2-continued.md
@@ -4,6 +4,8 @@
Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG.
The page-state concurrency foundation under `src/core/page-state/` and the shared progressive-batch primitive.
+- `src/core/ops/get-page-slice.ts` — get_page `section` / `grep` / `context` (#7180), params `GET_PAGE_SLICE_PARAMS` (full surface only; the get_page description names them on starter, and dispatch accepts them there). `ops/get-page-body.ts` routes a slice here: `parseSliceRequest` makes it a window-mode request carrying `slice`, and `readPartialBody`, after authorization and the quarantine `body_omitted` check, passes its read document's `stream()` (the inline bytes, or `SegmentedDocument.stream()` one segment at a time) with the window's metadata and size. Both scan the read projection line by line, so a segmented page is never held whole (memory: the returned text, one segment, at most `context` paragraphs; a line over 1 MiB is scanned in pieces). `readSection`: the first ATX heading (`HEADING`, outside `FENCE` blocks, as the outline sees them) whose whitespace-folded text equals the request case-insensitively (a leading `##` is ignored), down to the next heading of the same or higher level or the timeline separator; returns `section {heading, level, heading_path, line_start, line_end, text}` and stops reading at the section's end; a miss is `invalid_params` naming up to 20 headings with `detail.total_headings` and an outline fix. `readGrep`: blank-line paragraphs with a line containing the literal term (case-insensitive, no regex), `context` paragraphs either side (default 1, clamped to 5), windows that overlap or touch merged; `grep {term, context, total_matches, returned_matches, omitted_matches, blocks[{line_start, line_end, match_starts, text}]}`. Caps: 50 matching paragraphs and `SLICE_MAX_CHARS` (100,000), fewer when the egress cap is smaller (`sliceCharBudget`); `truncated` says a cap was hit, and a cut section adds `omitted_chars` and a `next` window read. Line numbers are the read view's, the ones `body: 'window'` `lines` reads back. A slice with a selector, include_content, content_only, `view: markdown`, a body other than auto/window, or known_as_of is `invalid_params`. Every get_page shape (whole, content_only, partial, slice) carries `chars`, the characters of page text it holds (`projectGetPage`, `readPartialBody`). Test: `test/get-page-slices.test.ts` (both engines).
+
- `src/core/page-state/` — Canonical page concurrency foundation shared by both engines. `schema.ts` (migration 150) adds source incarnation UUIDs, logical page revisions, text-projection revisions, and persistent guards for absent pages. `guards.ts` locks sorted sources then page identities in an existing transaction; a transaction or savepoint never re-acquires a key it holds, which covers absent pages because the only pages INSERT runs after `putPage` takes the same guard (`test/e2e/page-guards-postgres.test.ts`); callers lock sources before authority/request/fact rows. `snapshot.ts` computes the normalized body/timeline fingerprints only for a page with fact withdrawals, page-subject purges or a source '*' purge marker (they feed only the withdrawal overlay), as `page-snapshot-batch.ts` does. `snapshot.ts` reads page/tags/withdrawals in one MVCC statement and applies withdrawals using database-normalized text. `transactions.ts` makes helper transaction APIs compose through savepoints. `versions.ts` records the complete canonical snapshot; `rename-alias.ts` records `slug_aliases(old -> new)` inside both engines' `updateSlug` transaction, repoints aliases that named the old slug and drops one spelled like the new slug; `moveSlugBindings` moves the page's facts (`entity_slug`, `source_markdown_slug`) and `page_aliases` in the same transaction, letting a purged page's leftovers at the new slug yield (`test/rename-slug-alias.test.ts`); `movePageIdReferences` (#5431) moves the page-id-keyed rows of a stale rename row onto the surviving row (`links` from/to/origin, `timeline_entries` page and event, `page_versions`), dropping stale-side duplicates on the `links` composite key and the timeline dedup indexes (`test/rename-slug-alias.test.ts`); `materialize.ts` persists only verified canonical overlay bytes without another logical revision. `types.ts` defines revision preconditions: no revision is create-only (an existing page refuses `revision_required`, #5385, its own code since the omission is the caller's and not a race), a stale revision or a page another writer created where an internal writer asserted none (`expectedRevision: null`) is `revision_conflict`, explicit force overwrites. Plain legacy `putPage` calls keep compatibility until their owning operation adopts the managed write protocol. `projection-schema.ts` (migration 153) invalidates unverified prior projections once and queues durable work; `projections.ts` rebuilds Markdown without a worktree/provider and installs only matching canonical revisions. Embedding installs also compare exact chunk identities/text. Source importers seal code/image projections; all read arms hide unsealed projections.
- `src/core/page-state/projections.ts` — `sealPageTextProjection` and `sealImportedPage` write the page keyword vector through `pageSearchVectorSql` (`fts-language.ts`: title weight A, sanitized timeline weight C, both through `gbrain_fts_input`), the same expression `search-vector-backfill.ts` uses. Captures canonical revision, source incarnation, page identity, the complete raw chunk inventory and resolved indexing inputs before preparing derived work. Embedding reads require a current text seal; healing/rebuild capture can explicitly include unsealed pages. Projection installation compares its originating seal, chunk identities/text/source/completion state, chunker version and indexing context (including stored corpus generation) under the page guard before replacing any row. A same-revision re-chunk may replace the snapshot it actually captured; a delayed older installation cannot discard newer chunks or vectors. Rebuild also rechecks its queued job before capture so a completed job from an old listing stays completed. Chunkless healing sanitizes complete body/timeline fences before splitting, preserving withdrawn history in direct page reads while excluding it from retrieval. Tests: `page-projection-origin.test.ts`, `page-projection-vector-preservation.test.ts` (PGLite and isolated Postgres), `embed-stale-chunkless-pages.serial.test.ts` (public healing entry). Shared `markdown-chunks.ts` and `code-chunks.ts` preserve fenced code and source-language metadata. A preserving rebuild keeps a vector only when its `content_chunks.embedding_input_hash` (`src/core/embedding-input-hash.ts`) equals one recomputed from the current page, or, with no recorded hash, when the page is non-contextual and the legacy model/text-hash checks pass; a contextual chunk without provenance is nulled once. `installPageEmbeddings` records the hash in the vector's UPDATE (the plain re-embed tier by default, or the caller's `built` tier and corpus generation), and returns `{ installed, complete }`: it matches each offered vector to the page's current chunk by source and exact text (not index) and writes it only when its input hash for the captured context is one the current context accepts, in batched `jsonb_to_recordset` UPDATEs, so a page that changed under the provider call keeps the vectors of its unchanged chunks; the embedding signature is stamped only when `complete` (same chunk sequence, nothing dropped). A preserving rebuild likewise keys kept vectors by chunk content, so a top insert shifts vectors with their chunks (tests: `page-embedding-content-validity.test.ts`). Also `stampEmbeddingInputs` does the same for full imports. `resealSafeChunks` re-seals a page below the safe-chunk fence from its unchanged body with no canonical write; `projectionBelowSafeFence` is its predicate. Tests add `projection-embedding-input-hash.test.ts` and `safe-chunk-reseal.test.ts`. It replaces outgoing code edges without deleting incoming edges to retained chunks and clears backfill watermarks. Failed jobs rotate with a retained diagnostic; successful drain refreshes planner statistics. `rebuildPendingPageProjections(engine, limit, { deadlineMs, now, notAfter, retryCooldown, onFailure })` (#5401) checks an injectable clock between pages, bounds a run to rows queued at or before its start (`notAfter`, cast from text in SQL so microseconds survive the driver), applies the 30 s `rebuild_failed` cooldown for the resident, and treats a lock or snapshot error as that page's failure instead of aborting the batch; `projectionBacklog` returns counts only (pending, failed, oldest age) for the drain command and the resident's `projection_status` IPC reply. A same-revision conflict throws `PageProjectionConflictError` naming the fields that changed (`text_projection_revision`, `chunk_digest`, `indexing_context`), the slug and source; `retryProjectionConflict(attempt)` re-runs an attempt that captures a fresh snapshot at most three more times with jitter, then rethrows (`page_projection_conflict` on the wire). Tests: `page-projection-origin.test.ts` (resident rebuild race, two-writer progress, exhausted-retry CLI/JSON output).
diff --git a/docs/architecture/key-files/core-services-2.md b/docs/architecture/key-files/core-services-2.md
index 2576ab87b6..8a4c39bc46 100644
--- a/docs/architecture/key-files/core-services-2.md
+++ b/docs/architecture/key-files/core-services-2.md
@@ -42,8 +42,8 @@ Fact and page purge modules (`src/core/facts/purge*.ts`, `deletion-inventory.ts`
- `src/core/ops/links.ts` — the link-domain op module (`add_link`, `remove_link`, `get_links`, `get_backlinks`, `list_link_sources`, `traverse_graph`); `get_backlinks`' `type`/`group`/`limit`/`cursor` live in `backlinks-paged.ts`. Three load-bearing behaviors. (1) Pack vocabulary at the write surface: an EXPLICIT `link_type` on `add_link` must be declared by the active schema pack when one resolves (`schema-pack/write-vocabulary.ts`; no resolvable pack = no enforcement; omitted/empty link_type is the untyped-edge default and stays unchecked; the check runs before the dry-run return so dry runs preview the rejection). (2) `traverse_graph` output shape: trusted local no-filter callers (`ctx.remote === false`, no `link_type`/`direction`) keep the legacy `GraphNode[]` shape that `gbrain graph` renders; remote callers default to `direction: 'both'` and always receive explicit `GraphPath[]` edges, so a page whose typed edges are all inbound does not read as edge absence. An explicit `direction` param wins for every caller. Depth: default 5 (`DEFAULT_TRAVERSE_DEPTH`), except a remote call that let direction default to `both` ALSO defaults depth to `REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH` (2) — bidirectional path enumeration is combinatorial on entity hubs and this is the per-agent-turn path; a `link_type`-only remote call still takes both/2; an explicit depth is honored up to `TRAVERSE_DEPTH_CAP` (10, clamped with a warn). The edge walk runs through `engine.traversePathsDetailed`, and a hit on `TRAVERSE_PATH_ROW_CAP` (`engine-constants.ts`) surfaces as a stderr warn naming the cap (shallowest edges kept) — the `GraphPath[]` wire shape stays unchanged. Pinned by `test/traverse-graph-op-default.test.ts` + `test/traverse-paths-row-cap.test.ts`. (3) Link-read source scope: the three read ops take `source_id` (`parseSourceIdParam`, `__all__` admitted) and `all_sources` (equivalent to `__all__`; both together is `invalid_params`). `resolveLinkReadScope` composes `federatedSearchScope` (grant check, #5081 admission, unqualified no-grant widening to `localFederatedSourceIds`; a grant never widens), then `assertExplicitSourceLive` (so an archived source outside the caller's admission answers `permission_denied`, not `unknown_source`), then `linkReadScopeOpts` (remote scalar promoted to `sourceIds[]` for the engine's all-endpoints branch), then `readPolicyOpts`. A trusted local unqualified read that comes back as the federated `sourceIds[]` runs the scalar read once per federated source (set order, resolved source first) and merges de-duplicated on link identity, keeping the scalar branch's cross-source far endpoints; `traverse_graph` walks the federated set in one query because its scalar walk already scopes every node. A trusted local unqualified link read that returns nothing prints a stderr rerun hint naming sources outside the read that hold links for the slug (quiet under `json`, never for remote callers). CLI names: `links` (alias `get_links`), `backlinks`, `graph`. (4) Row paging (#6876): rows are keyset-paged by `ops/link-paging.ts` (cap after the source/identity merge; see its header). Pinned by `test/link-read-paging.test.ts`. Pinned by `test/federated-link-reads-5827.test.ts`, `test/link-reads-thin-client-5827.serial.test.ts` and `test/e2e/federated-link-reads-postgres.test.ts`. `traverse_graph` `hops` (1-3 `{link_type, toward}`) runs a typed chain through `runRelationalChain` under the op's read scope, returns `{anchor, answers, paths, diagnostics}` with evidence edges (remote context sanitized), refuses `hops` combined with `depth`/`link_type`/`direction` and bad hops as `invalid_params` naming the parameter path, and emits a `relational_chain` notice with the next call when the chain finds nothing. Pinned by `test/traverse-graph-hops.test.ts`.
-- `src/core/ops/pages.ts` — page operations share source validation and the persistence coordinator. Replacements require `expected_revision` or explicit `force`; omitted preconditions permit creation only. The put_page description keeps `Keep a request_id UUID; retry with identical arguments` within its 1,460-character schema budget (pinned by `test/mcp-schema-budget.test.ts` minimum guidance; the description and the content param both keep the get_page include_content:true read that `test/mcp-tool-defs.test.ts` pins). `get_page` and `fetch` use `page-state/snapshot.ts` for exact/alias resolution, content, tags, revision and withdrawal overlays in one SQL snapshot; fuzzy fallback uses a short repeatable-read transaction with the same visibility and source ceilings. `get_page` `content_only` (`ops/get-page-projection.ts`) returns slug, source_id, type, title, revision, tags and content (keys pinned by `test/get-page-content-roundtrip-2225.test.ts`). A put_page `revision_conflict` (`ops/put-page-revision-source.ts`) whose expected_revision is the current revision of the same slug in another source the caller may read (grant via `federatedSearchScope`, private pages excluded for untrusted readers) names that source and gets a re-read fix; otherwise the refusal is unchanged. `get_page` adds `file_held` when sync holds the page's newer file (`persistence/held-reads.ts`; path for trusted local callers only). Missing migration dependencies and connection errors propagate. Capture freezes target/type/timestamp/provenance before admission and resolves same-ID replay first. `persistence/links-preparation.ts` prepares trusted automatic graph reconciliation outside locks, then installs it with canonical projections and the receipt; delayed oneshot reconciliation validates its originating revision. `persistence/page-advisories.ts` prepares bounded, content-free lint findings. Tests cover source/alias ownership, concurrent graph replacements, stale delayed reconciliation, private fences and durable retries. `list_pages` passes `listColumnsOnly` so `engine-sql/pages.ts:listPages` projects identity, type, title and dates without reading page bodies or frontmatter (`list-pages-columns-5154.test.ts`). `delete_page` accepts a strict boolean `purge` only from trusted local callers. Immediate purge uses the same durable journal, observed revision (or explicit `force`), stored/current authority and exact request-ID replay as other page mutations. Owner preparation resolves the recorded file from a coherent snapshot, including tombstones; file removal precedes hard deletion and receipt commitment in the guarded publication transaction. Failed publication preserves the prior active row or existing tombstone and never overwrites unexpected file bytes. The receipt reports the actual filesystem/database persistence outcome and warns that repository history, synced copies, exports and derived artifacts may retain content. The `gbrain delete <slug> --purge` flag derives from the operation contract. `list_pages` probes `limit + 1` rows: a local CLI caller gets a stderr truncation notice; every dispatched caller gets `_meta.pagination` (`truncated`, `limit`, `clamped_from?`, `next?`) and a remote caller whose page was truncated also gets the model-visible `listing_truncated` notice whose `fix.mcp` is the next-page call (`ops/list-pages-pagination.ts`; `next` is the `updated_asc` keyset or an offset). Test: `test/list-pages-truncation.test.ts`. An `updated_after` the database cannot cast (SQLSTATE 22007/22008, the shared `isDatetimeInputError` in `core/utils.ts` that the hybrid lexical arms also use) is `invalid_params` with a read-only list_pages fix, never echoing the value; other SQLSTATEs pass through (`test/list-pages-timestamp-input.test.ts`). put_page (dry runs included) refuses a new `.md`/`.mdx`-suffixed slug (`persistence/suffixed-slug.ts`). #6212: `delete_page` and `restore_page` (dry runs included) go through `persistence/page-mutations.ts:validateMutationSlug`, which admits a legacy stored slug (`ops/context.ts:isLegacyStoredPageSlug`: refused by today's grammar, still accepted by `validateSlug`) only when an existing row in the target source holds it; every other operation keeps `validatePageSlug`, and remote purge stays denied by `assertPurgeParams`. Large pages: `get_page` resolves its body mode first (`parseBodyRequest`, `src/core/ops/get-page-body.ts`) and returns `readPartialBody` for none/outline/window/auto-above-256 KB, `assertFullReadFits` guarding whole remote reads; `fetch` of a page over the inline size returns `fetchWindowResult` (window around the id's chunk anchor, `metadata.next_id`); remote `put_page` runs `assertLargePageAdmission` before queueing. A committed segmented write's outcome records `searchable` (`true`, `'pending'` when its projection runs after commit, `false` when quarantined); `persistence/searchable.ts:liveSearchable` re-reads a pending one whenever the receipt is served (the put_page reply in `page-mutations.ts`, `get_write_request`) and adds `searchable_retry_after_ms` and a `searchable_fix` that reads the receipt again (`test/large-pages/segmented-create-searchable.test.ts`).
-- `src/core/ops/get-page-body.ts` — get_page's body modes (`auto|full|none|outline|window`, selectors `lines`/`bytes`/`around_chunk_id`/`cursor`, `view: read|markdown`). `parseBodyRequest` fixes precedence (explicit body; include_content/content_only → full; a selector → window; the thin client and the local CLI → full; else auto) and rejects conflicting selectors. `readPartialBody` never fills compiled_truth/timeline/content: it slices the read projection (`readPageDocument`) or, for `view: markdown`, the round-trip markdown with its sha256; a window is re-measured as the final encoded frame and shrunk until it fits `resultByteCap`. `around_chunk_id` uses the stored span (`anchor: stored_span`), a unique text match (`located`), or returns the chunk alone (`chunk_only`). Cursors are revision-bound; a stale one is `revision_changed` with a same-offset fix. `readFetchWindow` / `fetchWindowResult` serve fetch's windowed shape; `LARGE_PAGES_CAPABILITY` is advertised by `get_brain_identity`. A segmented page (Wave B PR 2, spec 7.2) is never read whole: `full` is `page_body_segmented` for local and MCP callers alike with `segmentedReadFix` (`body: 'auto'`, argv and mcp; local `gbrain get` with no `--body` streams it instead), and `page_too_large_for_inline` only for gbrain's thin client, its paging signal (`segmentedFullReadError`); `grammar_diagnostics` on it is `line_grammar: { state: 'skipped', reason: 'page_body_segmented' }` (`segmentedGrammarSkip`, line-grammar-report.ts); window byte offsets are coordinates of the view's `size.total_bytes`, never `body_bytes`, and an offset past the end is an empty window on both storages; `auto` is the outline plus the first window, and `segmentedWindows` cuts every window, outline page and `around_chunk_id` from `page-window/segmented.ts`. A segmented `around_chunk_id` resolves only from the chunk's live occurrence and segment-relative span (a retired occurrence is `revision_changed`; no text match), and `body: 'none'` reports stored sums plus the tail digest without chunk counts.
+- `src/core/ops/pages.ts` — page operations share source validation and the persistence coordinator. Replacements require `expected_revision` or explicit `force`; omitted preconditions permit creation only. The put_page description keeps `Keep a request_id UUID; retry with identical arguments` within its 1,460-character schema budget (pinned by `test/mcp-schema-budget.test.ts` minimum guidance; the description and the content param both keep the get_page include_content:true read that `test/mcp-tool-defs.test.ts` pins). `get_page` and `fetch` use `page-state/snapshot.ts` for exact/alias resolution, content, tags, revision and withdrawal overlays in one SQL snapshot; fuzzy fallback uses a short repeatable-read transaction with the same visibility and source ceilings. `get_page` `content_only` (`ops/get-page-projection.ts`) returns slug, source_id, type, title, revision, tags, content and chars (keys pinned by `test/get-page-content-roundtrip-2225.test.ts`). A put_page `revision_conflict` (`ops/put-page-revision-source.ts`) whose expected_revision is the current revision of the same slug in another source the caller may read (grant via `federatedSearchScope`, private pages excluded for untrusted readers) names that source and gets a re-read fix; otherwise the refusal is unchanged. `get_page` adds `file_held` when sync holds the page's newer file (`persistence/held-reads.ts`; path for trusted local callers only). Missing migration dependencies and connection errors propagate. Capture freezes target/type/timestamp/provenance before admission and resolves same-ID replay first. `persistence/links-preparation.ts` prepares trusted automatic graph reconciliation outside locks, then installs it with canonical projections and the receipt; delayed oneshot reconciliation validates its originating revision. `persistence/page-advisories.ts` prepares bounded, content-free lint findings. Tests cover source/alias ownership, concurrent graph replacements, stale delayed reconciliation, private fences and durable retries. `list_pages` passes `listColumnsOnly` so `engine-sql/pages.ts:listPages` projects identity, type, title and dates without reading page bodies or frontmatter (`list-pages-columns-5154.test.ts`). `delete_page` accepts a strict boolean `purge` only from trusted local callers. Immediate purge uses the same durable journal, observed revision (or explicit `force`), stored/current authority and exact request-ID replay as other page mutations. Owner preparation resolves the recorded file from a coherent snapshot, including tombstones; file removal precedes hard deletion and receipt commitment in the guarded publication transaction. Failed publication preserves the prior active row or existing tombstone and never overwrites unexpected file bytes. The receipt reports the actual filesystem/database persistence outcome and warns that repository history, synced copies, exports and derived artifacts may retain content. The `gbrain delete <slug> --purge` flag derives from the operation contract. `list_pages` probes `limit + 1` rows: a local CLI caller gets a stderr truncation notice; every dispatched caller gets `_meta.pagination` (`truncated`, `limit`, `clamped_from?`, `next?`) and a remote caller whose page was truncated also gets the model-visible `listing_truncated` notice whose `fix.mcp` is the next-page call (`ops/list-pages-pagination.ts`; `next` is the `updated_asc` keyset or an offset). Test: `test/list-pages-truncation.test.ts`. An `updated_after` the database cannot cast (SQLSTATE 22007/22008, the shared `isDatetimeInputError` in `core/utils.ts` that the hybrid lexical arms also use) is `invalid_params` with a read-only list_pages fix, never echoing the value; other SQLSTATEs pass through (`test/list-pages-timestamp-input.test.ts`). put_page (dry runs included) refuses a new `.md`/`.mdx`-suffixed slug (`persistence/suffixed-slug.ts`). #6212: `delete_page` and `restore_page` (dry runs included) go through `persistence/page-mutations.ts:validateMutationSlug`, which admits a legacy stored slug (`ops/context.ts:isLegacyStoredPageSlug`: refused by today's grammar, still accepted by `validateSlug`) only when an existing row in the target source holds it; every other operation keeps `validatePageSlug`, and remote purge stays denied by `assertPurgeParams`. Large pages: `get_page` resolves its body mode first (`parseBodyRequest`, `src/core/ops/get-page-body.ts`) and returns `readPartialBody` for none/outline/window/auto-above-256 KB, `assertFullReadFits` guarding whole remote reads; `fetch` of a page over the inline size returns `fetchWindowResult` (window around the id's chunk anchor, `metadata.next_id`); remote `put_page` runs `assertLargePageAdmission` before queueing. A committed segmented write's outcome records `searchable` (`true`, `'pending'` when its projection runs after commit, `false` when quarantined); `persistence/searchable.ts:liveSearchable` re-reads a pending one whenever the receipt is served (the put_page reply in `page-mutations.ts`, `get_write_request`) and adds `searchable_retry_after_ms` and a `searchable_fix` that reads the receipt again (`test/large-pages/segmented-create-searchable.test.ts`).
+- `src/core/ops/get-page-body.ts` — get_page's body modes (`auto|full|none|outline|window`, selectors `lines`/`bytes`/`around_chunk_id`/`cursor`, `view: read|markdown`). `parseBodyRequest` fixes precedence (explicit body; include_content/content_only → full; a selector → window; the thin client and the local CLI → full; else auto) and rejects conflicting selectors. `readPartialBody` never fills compiled_truth/timeline/content: it slices the read projection (`readPageDocument`) or, for `view: markdown`, the round-trip markdown with its sha256; a window is re-measured as the final encoded frame and shrunk until it fits `resultByteCap`. `around_chunk_id` uses the stored span (`anchor: stored_span`), a unique text match (`located`), or returns the chunk alone (`chunk_only`). Cursors are revision-bound; a stale one is `revision_changed` with a same-offset fix. `readFetchWindow` / `fetchWindowResult` serve fetch's windowed shape; `LARGE_PAGES_CAPABILITY` is advertised by `get_brain_identity`. A segmented page (Wave B PR 2, spec 7.2) is never read whole: `full` is `page_body_segmented` for local and MCP callers alike with `segmentedReadFix` (`body: 'auto'`, argv and mcp; local `gbrain get` with no `--body` streams it instead), and `page_too_large_for_inline` only for gbrain's thin client, its paging signal (`segmentedFullReadError`); `grammar_diagnostics` on it is `line_grammar: { state: 'skipped', reason: 'page_body_segmented' }` (`segmentedGrammarSkip`, line-grammar-report.ts); window byte offsets are coordinates of the view's `size.total_bytes`, never `body_bytes`, and an offset past the end is an empty window on both storages; `auto` is the outline plus the first window, and `segmentedWindows` cuts every window, outline page and `around_chunk_id` from `page-window/segmented.ts`. A segmented `around_chunk_id` resolves only from the chunk's live occurrence and segment-relative span (a retired occurrence is `revision_changed`; no text match), and `body: 'none'` reports stored sums plus the tail digest without chunk counts. `section`/`grep`: `ops/get-page-slice.ts` ([continued](core-services-2-continued.md)).
- `src/core/persistence/large-page-guard.ts` — put_page against a page over 256 KB: `assertLargePageAdmission` (remote, before queueing) refuses `force` without `expected_revision` (`revision_required`) and content under half the stored body (`page_shrink_refused`) unless `allow_shrink`; `assertLargePageReplacement` re-checks the parsed body against the locked snapshot in preparation (`page-prepare.ts`).
- `src/core/ops/page-edit.ts` — the `edit_page` operation (write scope, starter surface, client slug-fence allowlist): validates edits and the optional `within` range (full surface only), then submits through `submitPageMutation` like put_page; matching and the diff live in `persistence/page-edit.ts`.
diff --git a/docs/architecture/key-files/entrypoints-and-docs.md b/docs/architecture/key-files/entrypoints-and-docs.md
index 2c9c164b04..13f4a7f29d 100644
--- a/docs/architecture/key-files/entrypoints-and-docs.md
+++ b/docs/architecture/key-files/entrypoints-and-docs.md
@@ -117,7 +117,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/assets/wasm/` — 37 tree-sitter grammar WASMs + tree-sitter runtime. Committed to the repo so `bun --compile` embeds them deterministically via `import path from ... with { type: 'file' }`. The CI guard `scripts/check-wasm-embedded.sh` requires semantic TypeScript and Bash case-statement symbols in the compiled binary. Bash uses the official tree-sitter-bash v0.23.3 ABI-14 release asset, pinned by checksum in `scripts/vendor-bash-wasm.sh`; `src/assets/wasm/README.md` records provenance. Code chunker version 7 invalidates old content hashes; `gbrain sync --source <id> --full` revisits affected history in active repositories. `tree-sitter-sql.wasm` (DerekStride/tree-sitter-sql @ c2e1e08db1ea20dc23bdb8d228a81a8756e9c450, built with [email protected] --abi 14) adds SQL coverage at 11 MB — larger than peers because the grammar covers PostgreSQL + MySQL + SQLite + T-SQL basics (40 MB generated parser.c); the compiled binary grows ~6%.
- `src/cli.ts` — the entry point (`bun src/cli.ts`, the `gbrain` bin, the compiled binary): Bun floor, signal handlers and stdout delivery, then either the engine-free fast path (`cliFastPath`: `--version`, `version`, bare `gbrain`, `--help`, `-h`, after global-flag parsing and `runCliPreflight`) or a dynamic import of the dispatcher, `src/cli/main.ts` `runCli()`. Its static imports are paid by every invocation and stay light: the dispatcher's graph (every operation and command module) loads only for real commands, so `--version` and top-level help skip it. The top-level help text is `src/cli/top-help.ts`, shared by both paths. Pinned by `test/cli-fast-path.test.ts` (fast-path branches, output parity, and import-graph bounds for the entry and the dispatcher).
-- `src/cli/main.ts` — the dispatcher (moved out of `src/cli.ts`; tests import its helpers from here). It keeps three graphs off every command: `completeEngineStartup` asks `migrate-pending.ts` (generated latest version) before loading `migrate.ts` and its ~220 migration modules, `thin-client-upgrade-prompt.ts` takes `compareVersions` from `migration-ledger.ts` instead of the upgrade orchestrator registry, and `mcp-client.ts` loads the MCP HTTP client SDK on the first remote call. Generic thin-client mutation failures use the shared persistence reporter, retaining request IDs and typed JSON receipts while preserving SIGINT exit 130. `test/thin-client-write-errors.serial.test.ts` exercises real CLI timeout, cancellation, pending and conflict paths against a loopback MCP fixture. No-DB fallbacks announce themselves on stderr instead of degrading silently. `dream` dispatch binds the caught engine-connect error and emits `[dream] WARNING: could not connect to DB (...)` before falling through to filesystem-only phases; the `runDream(null, ...)` no-DB fallback is preserved (pinned by `test/cli-dream-engine-warn.test.ts`, 2 subprocess cases against good + bad DATABASE_URL). `doctor` dispatch does the same: when `connectEngine` OR the DB-backed `runDoctor` run throws, it emits `[doctor] DB-backed doctor run failed (...) — falling back to filesystem-only checks`, scrubbing the error message through BOTH `url-redact.ts:redactUrlsInText` and `redact-connection-info.ts:redactConnectionInfo` first, because doctor output is exactly what users paste into issues and CI logs (pinned by the fallback case in `test/doctor-minions-check.test.ts`: stderr note present, credentials absent, stdout stays parseable `--json`). `main()` opens with `await runCliPreflight()` (core/cli-preflight.ts: cwd-.env quarantine -> `~/.gbrain/.env` -> guardrails loader) before `parseGlobalFlags`; the former inline #3688 guardrails block lives in the preflight module. `get_page` output renders through `src/cli/page-render.ts`: a partial response prints only what it carries plus a stderr note, and a thin-client `gbrain get` refused with `page_too_large_for_inline` pages the round-trip markdown to its end (`readWholePageMarkdown`, size + sha256 checked, restarts if the page changes) before printing.
+- `src/cli/main.ts` — the dispatcher (moved out of `src/cli.ts`; tests import its helpers from here). It keeps three graphs off every command: `completeEngineStartup` asks `migrate-pending.ts` (generated latest version) before loading `migrate.ts` and its ~220 migration modules, `thin-client-upgrade-prompt.ts` takes `compareVersions` from `migration-ledger.ts` instead of the upgrade orchestrator registry, and `mcp-client.ts` loads the MCP HTTP client SDK on the first remote call. Generic thin-client mutation failures use the shared persistence reporter, retaining request IDs and typed JSON receipts while preserving SIGINT exit 130. `test/thin-client-write-errors.serial.test.ts` exercises real CLI timeout, cancellation, pending and conflict paths against a loopback MCP fixture. No-DB fallbacks announce themselves on stderr instead of degrading silently. `dream` dispatch binds the caught engine-connect error and emits `[dream] WARNING: could not connect to DB (...)` before falling through to filesystem-only phases; the `runDream(null, ...)` no-DB fallback is preserved (pinned by `test/cli-dream-engine-warn.test.ts`, 2 subprocess cases against good + bad DATABASE_URL). `doctor` dispatch does the same: when `connectEngine` OR the DB-backed `runDoctor` run throws, it emits `[doctor] DB-backed doctor run failed (...) — falling back to filesystem-only checks`, scrubbing the error message through BOTH `url-redact.ts:redactUrlsInText` and `redact-connection-info.ts:redactConnectionInfo` first, because doctor output is exactly what users paste into issues and CI logs (pinned by the fallback case in `test/doctor-minions-check.test.ts`: stderr note present, credentials absent, stdout stays parseable `--json`). `main()` opens with `await runCliPreflight()` (core/cli-preflight.ts: cwd-.env quarantine -> `~/.gbrain/.env` -> guardrails loader) before `parseGlobalFlags`; the former inline #3688 guardrails block lives in the preflight module. `get_page` output renders through `src/cli/page-render.ts`: a partial response prints only what it carries plus a stderr note (a `--section` read prints the section text, a `--grep` read each block under `-- lines a-b (match at …)`, with the heading path or match counts on stderr), and a thin-client `gbrain get` refused with `page_too_large_for_inline` pages the round-trip markdown to its end (`readWholePageMarkdown`, size + sha256 checked, restarts if the page changes) before printing.
`connectEngine` is the thin-client backstop: on a config with `remote_mcp` and no `database_url` it refuses the dispatched command through `refuseThinClient` instead of building an engine, so a command without its own route never dies with "No database URL" or reads an empty in-memory PGLite. Handlers that already route over MCP (salience, anomalies, graph-query, whoknows, founder, and every recall form except an in-process `--query`/`--budget-tokens` call) run engine-free from `prepareConnectedDispatch`. Pinned by `test/thin-client-connect-engine-guard.test.ts`. The host connect itself is `connectEngineForServe(hooks, {probeOnly})` in `src/core/engine-connect.ts`: throw-only (`no_brain`, `requires_local_engine`, repair refusals), it records the engine's config through `ENGINE_CONNECT_HOOKS` and disconnects an engine whose startup fails after the connect; `connectEngine` wraps it with the CLI exits (`exitOnRepairFailed`), and the status-only serve call sites pass it directly (`test/engine-connect.test.ts`).
Size ceiling (`src/cli/main.ts`): `scripts/module-size-limits.tsv` (per-change raise history: `git log -p` on that file). The ceiling covers `handleCliOnly`'s explicit ordered pipeline (`@cliPipelineStage` functions: thin-client guard, deferred-persistence routing, subcommand and help routes, read-only timeout path, sync watchdog and delegation, connectEngine terminator with degraded-serve recovery, teardown), thin-client routing and refusal, help and self-help text, strict flag parsing and process-exit teardown. Per-command dispatch (pre- and post-connect) lives in the command table (entry below), not in `src/cli/main.ts`.
diff --git a/docs/architecture/key-files/quarantine.md b/docs/architecture/key-files/quarantine.md
index 916b51ab18..1eaab82091 100644
--- a/docs/architecture/key-files/quarantine.md
+++ b/docs/architecture/key-files/quarantine.md
@@ -38,4 +38,4 @@ gets no body (fetch: empty `text`) unless it holds `admin` and passes
Test: `test/quarantine-read-write-surface.test.ts`.
- `src/core/quarantine-override.ts` — #6259 (fix wave 12): the `quarantine_override` frontmatter key `gbrain quarantine clear --force` records: `{ binding, cleared_at }`, where `binding` is a sha256 over the classifier's inputs (title, type, body) as the gate canonicalizes them (`quarantineOverrideFor`). `assessImportSanity` (`import-screen.ts`) wraps its verdict in `withQuarantineOverride`, which removes the junk-pattern, literal and markup-flag outcomes while the binding is current (size outcomes stay). `importFromContent` calls `stripGateOwnedMarkers` (`import-screen.ts`, `GATE_OWNED_FRONTMATTER_KEYS`): every writer loses `quarantine`, `content_flag`, `embed_skip`, `atoms_scan_hash` and `quarantine_override` unless an owner-tier path passes `preserveGateMarkers: true` (`importFromFile`, managed sync and file import, reindex, file repair, reconcile, the cycle derivers and their `managed_maintenance_page` intents, `quarantine clear/scan` and the owner-internal `managed_quarantine_clear` put_page kind); local put_page, connectors and ingest lanes do not. A preserving path keeps its own override only while current, and a current override drops classifier markers the content still carries. Fix wave 13: a preserving call that carries a `writeGate` (unmanaged sync/import via `ownerSourceGateInput`, managed sync and file import via `ownerGateInput`) keeps the override only when the gate's tier is owner-tier (`OWNER_TIER_FLOOR`); file repair and reconcile pass the source's owner tier as `overrideTier` for the same rule; an unreadable tier fails closed. Paths that pass neither (the cycle derivers, `quarantine clear`) are unchanged. Tests: `test/quarantine-override-tier.test.ts`, `test/quarantine-override-repair-reconcile.test.ts`. `opts.remote` keeps only its fence-merge/hidden-row meaning. Tests: `test/gate-marker-strip.test.ts`. For a stripped write the classifier would hide or markup-flag, `carryStoredQuarantineOverride` reads the stored override and keeps it when it still binds (so a remote tag edit does not re-hide the page); a clean remote write reads nothing extra (#6007 statement budget). Company-brain inspection refuses files carrying it (`hidden_input`). Doctor's quarantine row names `clear <slug> --force` and `content_sanity.disabled_patterns`.
-- `src/core/ops/get-page-projection.ts` — `projectGetPage` shapes the get_page response from the reader-visible body (#2225 `content`, content_only round-trip fields, `timeline_entries`, `file_held`). #6259: `quarantinedView` decides whether a quarantined page's body is withheld (`body_omitted` for an untrusted reader without `admin` + `include_quarantined`); a withheld body empties compiled_truth and timeline and drops `content`.
+- `src/core/ops/get-page-projection.ts` — `projectGetPage` shapes the get_page response from the reader-visible body (#2225 `content`, content_only round-trip fields, `timeline_entries`, `file_held`, and `chars`: the characters of compiled_truth, timeline and `content` it returns). #6259: `quarantinedView` decides whether a quarantined page's body is withheld (`body_omitted` for an untrusted reader without `admin` + `include_quarantined`); a withheld body empties compiled_truth and timeline and drops `content`.
diff --git a/docs/guides/memory-boundaries.md b/docs/guides/memory-boundaries.md
index a2c9feda4e..b6178c7239 100644
--- a/docs/guides/memory-boundaries.md
+++ b/docs/guides/memory-boundaries.md
@@ -136,6 +136,31 @@ An ordinary page carries no field.
A body over the page ceiling, or `put_page` content over 24 MiB, has no
receipt: the write is refused as `request_too_large`.
+<a id="reading-part-of-a-page"></a>
+### Reading part of a page
+
+**Say to your agent:** *"Show me just the Next steps section of the
+acme-example meeting page."* The agent runs
+`gbrain get <slug> --section "Next steps"` (MCP: `get_page` with
+`section`) instead of reading the whole page.
+
+**Say to your agent:** *"Where does the widget plan page mention pricing?"*
+The agent runs `gbrain get <slug> --grep pricing --context 1` (MCP:
+`get_page` with `grep` and `context`).
+
+`--section` returns the first section whose heading matches (case does not
+matter), down to the next heading of the same or a higher level, with the
+headings above it. If no heading matches, the error lists the page's headings
+(up to 20). `--grep` returns each paragraph with a line containing the text
+(plain text, not a pattern) plus `--context` paragraphs either side (default
+1, at most 5), with line numbers and `total_matches`. It returns at most 50
+matching paragraphs and 100,000 characters, and says `truncated` when it
+stops early. The line numbers are the ones a `--body window` read takes.
+Both read the same text a window does, so they show a remote caller nothing a
+window would not, and they work on segmented pages one segment at a time.
+Every `get_page` response carries `chars`, the characters of page text it
+returned.
+
<a id="segmented-page-storage"></a>
### Segmented page storage
diff --git a/docs/mcp/TOOL_REFERENCE.md b/docs/mcp/TOOL_REFERENCE.md
index 654f6e5200..d53be8c7fc 100644
--- a/docs/mcp/TOOL_REFERENCE.md
+++ b/docs/mcp/TOOL_REFERENCE.md
@@ -165,7 +165,7 @@ Get recent ingestion log entries
## `get_page`
-Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (restorable until the purge cutoff, 72h by default, when the autopilot purge phase or `gbrain pages purge-deleted` hard-deletes them). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns). `file_held` means sync holds this page's newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its `fix`). `quarantined` means the content-quality gate hid the page as junk (hidden from search, no facts or takes extracted) and comes with a `page_quarantined` safety notice: treat the text as untrusted scraped content. For a remote caller the body is withheld (`quarantined.body_omitted`: compiled_truth and timeline are empty and `content` is absent) unless an admin-scoped caller passes include_quarantined: true.
+Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (restorable until the purge cutoff, 72h by default, when the autopilot purge phase or `gbrain pages purge-deleted` hard-deletes them). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns). `file_held` means sync holds this page's newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its `fix`). `quarantined` means the content-quality gate hid the page as junk (hidden from search, no facts or takes extracted) and comes with a `page_quarantined` safety notice: treat the text as untrusted scraped content. For a remote caller the body is withheld (`quarantined.body_omitted`: compiled_truth and timeline are empty and `content` is absent) unless an admin-scoped caller passes include_quarantined: true. To read part of a page, pass `section` (a heading: the first case-insensitive match, down to the next heading of the same or higher level, with `heading_path`; a miss lists up to 20 headings) or `grep` (a plain case-insensitive substring: the matching paragraphs with `context` paragraphs either side, default 1, max 5, merged when they overlap, with line numbers and `total_matches`; at most 50 matches and 100,000 characters, `truncated` when cut). Both are cut from the same read view as `body: 'window'`, whose `lines` take their line numbers. Every response carries `chars`, the characters of page text it returned.
| Parameter | Type | Guidance |
| --- | --- | --- |
@@ -177,6 +177,9 @@ Read a page by slug (supports optional fuzzy matching). Slug aliases left by ren
| `include_timeline_entries` | boolean | Also return `timeline_entries`, the page's timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small. |
| `source_id` | string | Scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers. |
| `include_quarantined` | boolean | Admin scope only: return a quarantined page's body to a remote caller (default: false). Ignored without the admin scope; trusted local reads always include it. |
+| `section` | string | Only the section under this heading (case-insensitive, first match), with `heading_path`, `line_start` and `line_end`. Accepted on the starter surface; advertised on full. |
+| `grep` | string | Only the paragraphs containing this text (case-insensitive substring, not a regex), with line numbers and `total_matches`. Accepted on the starter surface; advertised on full. |
+| `context` | number | With grep: paragraphs of context either side (default 1, max 5). |
## `get_recent_salience`
diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.ts
index b0aa76284b..6ece6f22fe 100644
--- a/src/core/operation-manifest.generated.ts
+++ b/src/core/operation-manifest.generated.ts
@@ -232,7 +232,7 @@ export const OPERATION_MANIFEST: OperationMeta[] = [
"outputRedaction": {
"exempt": "explicit page read by slug/id; governed by page visibility, not output redaction (CEO-17 raw-read exception)"
},
- "description": "Read a page by slug. To edit: include_content:true, send `content` to put_page; or edit_page. >256 KB: outline+window, then `next`.",
+ "description": "Read a page; `section` or `grep` reads one part. Edit: include_content:true, `content` to put_page, or edit_page. >256 KB: outline+window, then `next`.",
"params": {
"slug": {
"type": "string",
@@ -241,15 +241,15 @@ export const OPERATION_MANIFEST: OperationMeta[] = [
},
"fuzzy": {
"type": "boolean",
- "description": "Fuzzy slug match."
+ "description": "Fuzzy match."
},
"include_content": {
"type": "boolean",
- "description": "Markdown + revision, to edit."
+ "description": "Markdown + revision."
},
"content_only": {
"type": "boolean",
- "description": "Round-trip fields only."
+ "description": "Round-trip fields."
},
"body": {
"type": "string",
@@ -327,13 +327,28 @@ export const OPERATION_MANIFEST: OperationMeta[] = [
"description": "Outline next_from_index.",
"fullSurfaceOnly": true
},
+ "section": {
+ "type": "string",
+ "description": "Only the section under this heading (case-insensitive, first match), with its heading_path.",
+ "fullSurfaceOnly": true
+ },
+ "grep": {
+ "type": "string",
+ "description": "Only the paragraphs containing this text (case-insensitive substring, not a regex), with line numbers and total_matches.",
+ "fullSurfaceOnly": true
+ },
+ "context": {
+ "type": "number",
+ "description": "With grep: paragraphs of context either side (default 1, max 5).",
+ "fullSurfaceOnly": true
+ },
"include_deleted": {
"type": "boolean",
"description": "Soft-deleted too."
},
"include_timeline_entries": {
"type": "boolean",
- "description": "Timeline rows too."
+ "description": "Timeline rows."
},
"grammar_diagnostics": {
"type": "boolean",
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index fc9e438d91..7277f576fc 100644
--- a/test/fixtures/goldens/cli/tools-json.json
+++ b/test/fixtures/goldens/cli/tools-json.json
@@ -2,8 +2,8 @@
"golden": {
"exitCode": 0,
"stderr": "",
- "stdoutBytes": 252798,
- "stdoutSha256": "71b348f0e16ec33eeb7b856a2fa24821a5f971503416d541e00226572381ab56",
+ "stdoutBytes": 253412,
+ "stdoutSha256": "b9e70ca5be2a182ffcd38f87706591de3229831a3fe4222d0b7833caa495b027",
"toolNames": [
"remember",
"entity",
@@ -410,7 +410,7 @@
"scope": "write"
},
{
- "description": "Read a page by slug. To edit: include_content:true, send `content` to put_page; or edit_page. >256 KB: outline+window, then `next`.",
+ "description": "Read a page; `section` or `grep` reads one part. Edit: include_content:true, `content` to put_page, or edit_page. >256 KB: outline+window, then `next`.",
"idempotent": true,
"local_only": false,
"mutating": false,
@@ -420,10 +420,12 @@
"body": "string?",
"bytes": "object?",
"content_only": "boolean?",
+ "context": "number?",
"context_lines": "number?",
"cursor": "string?",
"fuzzy": "boolean?",
"grammar_diagnostics": "boolean?",
+ "grep": "string?",
"include_content": "boolean?",
"include_deleted": "boolean?",
"include_quarantined": "boolean?",
@@ -433,6 +435,7 @@
"max_bytes": "number?",
"min_trust": "string?",
"outline_from": "number?",
+ "section": "string?",
"slug": "string",
"source_id": "string?",
"view": "string?"
@@ -473,9 +476,13 @@
"type": "object"
},
"content_only": {
- "description": "Round-trip fields only.",
+ "description": "Round-trip fields.",
"type": "boolean"
},
+ "context": {
+ "description": "With grep: paragraphs of context either side (default 1, max 5).",
+ "type": "number"
+ },
"context_lines": {
"description": "Lines around around_chunk_id (20).",
"type": "number"
@@ -485,15 +492,19 @@
"type": "string"
},
"fuzzy": {
- "description": "Fuzzy slug match.",
+ "description": "Fuzzy match.",
"type": "boolean"
},
"grammar_diagnostics": {
"description": "Also return every line-grammar finding for the page.",
"type": "boolean"
},
+ "grep": {
+ "description": "Only the paragraphs containing this text (case-insensitive substring, not a regex), with line numbers and total_matches.",
+ "type": "string"
+ },
"include_content": {
- "description": "Markdown + revision, to edit.",
+ "description": "Markdown + revision.",
"type": "boolean"
},
"include_deleted": {
@@ -505,7 +516,7 @@
"type": "boolean"
},
"include_timeline_entries": {
- "description": "Timeline rows too.",
+ "description": "Timeline rows.",
"type": "boolean"
},
"known_as_of": {
@@ -549,6 +560,10 @@
"description": "Outline next_from_index.",
"type": "number"
},
+ "section": {
+ "description": "Only the section under this heading (case-insensitive, first match), with its heading_path.",
+ "type": "string"
+ },
"slug": {
"description": "Page slug.",
"type": "string"