メインコンテンツへスキップ

AFS

Search and query

Choose list, typed collection query, or provider-defined free-text search by their different contracts.

Do not use list, query, and search as names for the same feature. They solve different problems and make different promises.

Evidence: packages/core/src/capabilities/collection-query.ts, docs/guides/collection-query.md, AFSModule.search / query in type.ts, and CLI runs on arc 2.0.0-beta.28.

Three contracts

OperationUse it forDo not assume
listEnumerating paths or entries under a pathA relevance-ranked result set, or a provider-independent data query language
queryA typed collection specification at the standard /.actions/query actionClient-side fallback when a provider has not declared the capability
searchProvider-defined free-text retrieval returned in a shared result envelopeUniversal full-text coverage, semantic retrieval, a shared index, or one ranking algorithm

list — best-effort enumeration

list is the filesystem-style directory walk. Unsupported options may be ignored or marked (for example order-by ignored metadata). It is the right tool for "what children exist here?"

bash
arc afs ls /modules/project

search — provider-defined free text

bash
arc afs search <path> <query>

Verified sample on a local fs:// mount (arc 2.0.0-beta.28):

bash
arc afs search /modules/project RELEASING
text
/modules/project/CLAUDE.md
/modules/project/README.md
/modules/project/RELEASING.md
…

RuleDetail
OwnershipThe provider owns what it searches, how it indexes, and how it ranks
EnvelopeARC returns matches in AFSSearchResult and can merge searchable providers under the requested path
No global promiseMerging results is not a global FTS index or semantic search product
VisibilityOn visibility: "meta" mounts, search is denied

Document search expectations in the provider's docs, not by copying behavior observed on a different provider.

query — optional and strict

Collection query is the typed action at /.actions/query (entries mode and aggregate mode). Philosophy is declare ⇒ execute the whole spec. Malformed specs and unsupported blocks are AFS_VALIDATION_ERROR (or equivalent). There is no silent client-side degradation to "sort of query via list".

Probe before relying on it: read <mount>/.meta/.capabilities (or root capabilities) and look for the standard action with name === "query" and pathTemplate === "/.actions/query". Provider-local dialects (for example table-scoped query paths) are not this contract.

Verified on beta.28 against an fs:// project mount that does not offer collection query on this surface:

bash
arc afs exec /.actions/query --args '{"path":"/modules/project","limit":2}'
text
ERROR: Collection query is not available on this surface

Exit code observed: 5. That failure is the correct signal—not a partial list of files.

When a provider does declare query, a consumer issues a typed spec (fields such as path, doc, where, orderBy, limit/offset or cursor, count, groupBy, optional aggregate ops). Full field vocabulary and provider implementation checklist live in ARC's internal guide docs/guides/collection-query.md and packages/core/src/capabilities/collection-query.ts.

Choosing among the three

GoalPrefer
Browse a treelist
Find free-text matches the provider knows how to findsearch (after checking capability)
Server-side typed filter / order / count / aggregate over a record collectionquery (only if declared)
"Search everything on the machine like a desktop FTS product"Out of contract for AFS as a whole

Product narrative caution

A future document library or NAS-oriented product may still layer catalogs, selected full-text collections, and richer indexes as separate product choices. Those choices are not automatic consequences of using AFS paths.