AO Search as an Upstream CASS Wrapper¶
Date: 2026-03-22
Issue: ag-6qk
Status: approved implementation plan
Problem¶
ao search currently presents itself as CASS-backed session-history search, but the shipped implementation is a repo-local AO search path over forged sessions and nearby .agents/ artifacts. That creates three product problems:
- AO is reimplementing session-history search instead of delegating to the upstream tool that already owns it.
- Known chat history can be indexed and searchable in
casswhile remaining undiscoverable throughao search. - Help text and docs blur two distinct concerns:
- session-history search
- curated repo-local AO memory retrieval
Product Decision¶
ao search becomes a broker command.
- Upstream
cassis the source of truth for session-history indexing and search. - AO keeps a repo-local search path for
.agents/artifacts because those are AO-native memory surfaces, not raw session history. ao lookupremains the primary command for curated knowledge retrieval by relevance.
In short:
cassanswers: "What happened in chat history for this workspace?"ao lookupanswers: "What durable knowledge artifacts should I load?"ao searchbrokers across those surfaces without reimplementing raw session-history search.
Backend Contract¶
ao search supports three backends:
cass- Upstream session-history search via
cass search - Workspace-scoped with
--workspace <cwd> - AO normalizes output into the existing
searchResultschema local- Repo-local AO search over forged sessions and adjacent
.agents/surfaces - This remains in-process and AO-owned
smart-connections- Optional semantic-first search when
--use-scis requested - Falls back to the selected non-SC backend chain
Default Behavior¶
Default mode is auto.
auto means:
- If
--use-scis set and Smart Connections is available, try it first. - If upstream
cassis available onPATH, query it for workspace-scoped session history. - If repo-local AO search data exists, query AO local memory surfaces too.
- Normalize, merge, deduplicate, sort, and return one unified result set.
This keeps session-history discovery tied to the real upstream tool while preserving AO-native memory retrieval in the same command surface.
Explicit Modes¶
Add one explicit mode and redefine one existing flag:
--cass- Force upstream
cassonly - Error if
cassis unavailable --local- Force repo-local AO search only
--cass and --local are mutually exclusive.
Output Contract¶
AO preserves the existing outward result shape:
[
{
"path": "/abs/path",
"score": 12.34,
"context": "snippet",
"type": "session"
}
]
Normalization rules:
- Upstream
casshits map fromsource_path,score, andsnippet/content. - AO local hits keep their current path/context/type behavior.
- Multiple
casshits from the samesource_pathcollapse to the best-scoring hit for that file. - Type classification remains AO-owned:
sessionfor upstreamcasstranscript hits- path-derived AO types for local artifacts (
learning,pattern,finding,research,decision,session,knowledge)
Help and Docs Contract¶
Help text and docs must say exactly this:
ao searchis a wrapper over upstreamcassfor session history when available.ao searchalso searches repo-local AO memory surfaces in auto mode.- Raw global/session history is owned by
cass, not AO's local grep implementation. ao lookupis still the better fit when the user specifically wants curated learnings/patterns/findings.
Non-Goals¶
This change does not:
- vendor or embed the
cassimplementation into AO - recreate
cassranking/indexing logic inside AO - add global reindexing logic to AO
- replace
ao lookup
TDD Plan¶
Write failing tests first for:
- auto mode calls upstream
casswhen available - auto mode falls back to repo-local AO search when
cassis unavailable --cassrequires upstreamcass--localskips upstreamcass- upstream
casshits are normalized and deduplicated by source path - help text/CLI docs reflect wrapper behavior instead of claiming built-in CASS-only search
Acceptance Criteria¶
ao searchuses upstreamcass searchfor workspace-scoped session-history results whencassis installed.ao searchstill returns useful repo-local results whencassis unavailable.ao search --help,README.md, anddocs/reference.mdmatch the shipped behavior.- AO no longer claims to own raw session-history search semantics that belong to upstream
cass. - Known workspace chat history discoverable through
cassbecomes discoverable through the supportedao searchpath.