Repository navigation
Description
Part of #3640.
Context
A project inventory needs enough metadata to choose what to read next. (listDocuments, packages/core/src/lib/ops/read.ts:175-194) currently emits path/title/type/relevance/status/tags; summary, update date, deadline and source size are absent. The CLI's existing (listCommand, packages/core/src/cli/commands/list.ts:33-73) returns richer SearchResult rows, so the gap is not identical on every surface. (brainListTool, packages/ui-backend-pi/src/brain-tools.ts:225-256) has its own wrapper. The current list API has a result limit but no continuation cursor or path-prefix scope.
Pi search also drops existing core metadata in its model-visible formatting (brainSearchTool, packages/ui-backend-pi/src/brain-tools.ts:94-155). This forces extra reads for dates/status even when indexed facts already exist. Read the parent and docs/integration-contract/cli.md, docs/integration-contract/mcp.md and docs/content-index-queries.md before choosing the additive projection.
Scope
- Offer an additive bounded overview projection with summary, frontmatter update date, status, deadline and a clearly defined source-size fact/estimate, consistently available through CLI, MCP and Pi. Preserve each legacy default response.
- Add a contained path-prefix filter and paged continuation for discovery, so callers can enumerate the intended document set without a raw filesystem glob or silently stopping at a limit.
- Preserve useful existing metadata in Pi search's model-visible results under an explicit output budget.
- Reuse concrete shared operations/query results under Epic: the brain CLI and MCP server call one operations layer and one index reader #1341; do not put SQL back into CLI commands or create a second provider-resolution path.
Out of scope
Inventing project activity from directory placement, rewriting summaries/frontmatter, changing ranking or taxonomy, multi-query search and opening every file body to construct an expensive overview. Metadata helps select evidence; it does not establish current repository activity.
Acceptance criteria
- The additive projection, field provenance/nullable cases and units are documented. A frontmatter date is distinguished from filesystem mtime and actual development activity; an indexed-body estimate is never labeled as exact full-file UTF-8 size.
- Identical fixtures expose equivalent requested facts on all three surfaces; Pi search retains core-provided dates/status/summaries when requested. Legacy defaults/shapes and warnings remain compatible.
- A stable, documented ordering and scoped cursor let a fixture larger than the current limit be fully enumerated without duplicates/omissions while the index is unchanged. Changed/invalid/stale cursor behavior is explicit.
- Prefix matching respects path segments and containment/provider masks; a neighbouring prefix or unrelated file does not leak into the requested inventory.
- Whole rows, metadata, cursor and warnings fit a hard aggregate output bound, with honest continuation/omission information. Large summaries do not yield clipped invalid JSON or empty pages that cannot advance.
- Missing/stale index, unreadable or changed source-size metadata and concurrent indexing retain truthful warning/provenance behavior.
- A project-overview fixture demonstrates which reads can be avoided while preserving evidence quality. A mutation that removes required metadata or breaks paging makes the appropriate contract/runtime test fail before restoration.
Verification
Use Odysseus fixtures with the pinned 2026-07-12 date. Cover multi-page and long-field cases, unchanged legacy CLI/MCP envelopes, real MCP calls and Pi tool execution. Run focused tests with bun run test, typecheck/lint and preflight. Re-run retrieval goldens only if retrieval behavior changes; such a change needs a reviewed explanation.
Contract impact
Additive opt-in CLI/MCP/backend discovery surface and possibly supported query fields. Carry contract, update owning contract components/schema snapshots/API reports in the same CONTRACT: commit and add a minor changeset. No release milestone is assigned.
Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Verified the cited shared operations and concrete Pi adapters. The independent brief is complete; p2 reflects wanted unscheduled work. External model evidence is optional and does not block the specified keyless work.
Activity
schlessera commentedon Nov 8, 2026
Claimed as part of the #3640 epic run (claim token
c3640-ec699b9a-3643).feat/3643-overview-discovery, PR targeting the epic integration branchepic/3640-bounded-retrieval; the epic lands onmainas one batch.origin/main1619741): every code citation in this body still points at its named anchor.test(core): type the paged-listing equality check under the strict ro…
CONTRACT: feat(core, backends): paged overview discovery for list and…
Merge epic/3640-bounded-retrieval into feat/3642-bounded-read-many
schlessera commentedon Nov 8, 2026
Delivered to the epic branch (2026-11-08): #3684 merged into
epic/3640-bounded-retrievalas 2b101ab. Its ready-candidate proof passed on head ebdb875. This issue stays open until the epic lands onmain.What shipped:
brain list --path-prefix/--overview/--cursor, plus the matchingbrain_listinputs on MCP and Pi (path_prefix,overview,cursor) and thepageIndexDocumentsquery. All run one shared core operation (packages/core/src/lib/document-page.ts).{ documents, next_cursor, total, truncated?, warnings }.updated, newest first, then bypath.clipped.overviewaddssummary,updated,deadline,indexed_atandindexed_body_bytes.updatedis the frontmatter date, not the file mtime or project activity.indexed_body_bytesis an estimate of the indexed body, never the whole file's size.path_prefixmatches whole path segments.brain_searchtakesoverviewto keep status, dates and summaries under its output budget.Mutation receipts are in #3684. Follow-up: an exact full-file size would need the indexer to store a stat for markdown files. It is not filed, because the documented estimate meets the criteria.
Merge pull request #3721 from schlessera/epic/3640-bounded-retrieval