Repository navigation
Description
Part of INTENTIUS/behold#908. Ruled by the maintainer on 2026-10-23 (behold#908, comment "Design check: chant workspace and the read contract"). Refs #4359, #4360, #4365, #4366, #4367, ws-016, ws-017, ws-052.
Feature
chant search answers through the workspace read contract, and a declared workspace can be searched as one, the way chant workspace graph reads it.
Why
ws-017 chose a versioned contract with a published schema per command, a closed list of reason codes, and MCP tools that wrap the same documents. search --json (#4359, #4367) has none of that, so behold and hud would parse unschema'd CLI JSON, which is ws-017's rejected option b. Search also knows only one project. To answer over a workspace, a reader would have to run it per member and prefix ids itself, and ws-052 says a reader computes no join chant can do itself.
What to build
- A contract 1
searchdocument.search --jsonprintscontract: 1,$schema,chant, and the workspace identity when there is one (workspace: {name, root},at). Failures areerror: { code, message }with codes from the closed list (add codes as needed while contract 1 allows it, and say which), and a hint stays as an extra field. The schema goes atsrc/workspace/search.schema.json, exported like the others, as aoneOfof result and failure, with--count-by's grouped result as a branch. It extends the landed shape (matches,paths,source,explain,drift) without renaming fields. Add it to the contract table inreference/workspace-read-contract.mdxand to the reader conformance suite (@intentius/chant/workspace/conformance). chant workspace search <query> [--member <name>] [--env <name>] [--snapshot <ref>] [--explain] [--count-by ...] [--json]. It composes members the wayworkspace graphdoes: each chant member under its own toolchain (ws-021), ids<member>/<id>identical toworkspace graph's, results grouped by member, a member that can't be searched reported with a reason code and never as zero matches, and member stamps from the same rule (ws-059). Search terms evaluate per member. A path that crosses members is out of scope here, and the document says when a member was searched alone.- Two separate times. In the workspace form,
--at <rev>is the git revision, as for every contract read, and--snapshot <ref>replays a recorded lifecycle snapshot (search's current--at). Plainchant search --atkeeps its meaning for compatibility, and also accepts--snapshotas a synonym. The document says which axis answered:atis the commit andsource.snapshotthe snapshot. - One MCP API. chant's MCP server gains a
workspace-searchtool that returns the same document verbatim, besideworkspace-graph. Its description covers the grammar and points at the capability catalog once research: a semantic capability catalog for chant search, with each lexicon deriving its own facts #4361 ships.
Acceptance criteria
-
search --jsonvalidates againstsearch.schema.jsonin a test, for a result, a--count-byresult, and a refusal. Each refusal carries a code from the contract's list. - The conformance suite lists
search(andworkspace search), and chant's own reader conformance tests pass. - On a two-member workspace fixture,
chant workspace search "<q>"returns ids equal to the<member>/<id>idschant workspace graphprints for the same nodes. A test compares the two. - A member whose chant is too old, or whose read fails, is reported with a reason code. A test covers each.
-
--at <rev>searches the source at that commit, and--snapshot latestreplays the snapshot. A test shows the two are not confused, and that--atwith a snapshot ref is refused with a hint naming--snapshot. - The MCP
workspace-searchtool returns exactly the CLI document. A test compares them. - Text output without
--jsonis unchanged. - Docs:
cli/search.mdx, a newcli/workspace-search.mdx, and the contract reference. - aws-bench's chant arm does not regress (deferred to the end-of-run pass).
- Checks: core tsc,
npx tsx scripts/typecheck.ts,just lint, targeted vitest,just docs-check.
Activity
feat(mcp): behold mcp with show and shot, a thin client of the runnin…
feat(search): search joins the workspace read contract, with chant wo…
feat(search): search joins the workspace read contract, with chant wo…
lex00 commentedon Oct 23, 2026
Landed on epic/908-ask-your-agent at d239908. Part of INTENTIUS/behold#908.
Box by box:
search --jsonvalidates againstsearch.schema.jsonfor a result, a--count-byresult and refusals; every refusal carries a contract code (search-json.test.ts, search-cli.e2e.test.ts).search(run asworkspace search <query> --json, MCP toolworkspace-search); chant's reader conformance tests pass, CLI and over MCP.workspace searchids equalworkspace graph's<member>/<id>ids, and member stamps are equal too (search-cli.e2e.test.ts).member-chant-too-old; failed read ->command-failed; missing dir ->dir-missing. A test covers each.--at <rev>searches the source at that commit,--snapshot latestreplays a recorded snapshot,--at latestis refused withrevision-unknownand a hint naming--snapshot, and--snapshotwith--atgivessnapshot-at-revision.workspace-searchreturns exactly the CLI document (workspace-tools.e2e.test.ts).--jsonis unchanged (the existing text tests pass untouched).cli/search.mdx, newcli/workspace-search.mdx, the contract reference,cli/mcp.mdx, the agent-integration guide, and the boundary roster.scripts/typecheck.ts(no regressions),just lint, targeted vitest,just docs-check, docs prose lint.Reason codes added within contract 1:
query-invalid,usage-invalid,environment-unknown,snapshot-unavailable,build-failed,snapshot-at-revision,member-chant-too-old.The member fan-out is not duplicated:
readMembersin graph-cli.ts is now shared byworkspace graphandworkspace search. The MCP tool description covers the grammar; it does not point at the capability catalog yet, since #4361 has not shipped. The schema and docs give the floor as chant 0.124.46; please check that at release.Unrelated to this change:
lexicons/fountain/src/acp/acp.test.tsfails on the epic branch since #4369. Filed as #4376.