Knowledge protocol

The retrieval ladder and the writing contract an agent follows over your collections: which GNO command answers which kind of question, what each rung returns and where it stops, and when a write is an edit, a capture, or a remember.

A knowledge protocol is the routing contract between an agent and your indexed collections: which command answers which kind of question, in which order to try them, and what a write is allowed to be. This page is the generalized contract. The gno agents block carries a 1,491-character version of it into each harness's global instruction file; the gno skill carries the workflows and recipes. Everything here applies to any collection layout: the protocol names commands, never folders.

Ground rules

The retrieval ladder

Seven rungs, cheapest and most exact first. Each one is a different question shape, and each stops at a stated boundary.

Question shapeCommandReturns
1. Exact term, identifier, quote, filename, error stringgno search "<text>"BM25 hits with URIs and matching spans
2. What do we know or believe about Xgno recall "<query>" --scope <scope>Current facts only, cited, under a budget, with a receipt
3. An entity or a document you know existsgno query "<question>" --fast -n 10Hybrid ranking over documents, fast preset
4. Evidence across several documents for one goalgno context build "<goal>" --budget 12000A Context Capsule: exact spans, hashes, budget, declared gaps
5. What changed, what differs, what depends on thisgno changes, gno diff <doc>, gno impact <doc>Bounded change history and dependency projections
6. A generated factual answergno ask "<question>" --verifyA cited answer, or an abstention
7. A document you expected is missing from resultsgno query diagnose "<query>" --target <doc>The stage at which the target dropped out

1. Exact search

gno search is lexical: a term, an identifier, a quoted phrase, an error message. It runs without models and returns the matching spans with their URIs. When the wording is known, this rung settles the question and nothing further runs.

2. Recall

gno recall reads memory-managed collections only and returns current facts: a fact replaced by a supersede is excluded in the query itself. The budget defaults to 8 facts under 512 estimated tokens; each fact carries its gno:// URI, scopes, caller, session, and content hash. An empty result carries a hint naming the write path, so a fresh agent learns remember from the empty read. Recall runs the lexical leg always and adds the vector leg when the collection's embedding model is already cached; the response reports mode: lexical or hybrid with the reason, and it never downloads a model. Lexical-only recall matches every query term, so a question-shaped query can miss a fact the vector leg would find; embed the memory collection to close that gap. The full contract is on the memory page.

3. Query

gno query fuses lexical and semantic retrieval over documents. --fast skips query expansion, graph expansion, and reranking, which is the right trade when the entity or document is known and ranking quality matters less than latency. Drop --fast for a vaguer question. Structured syntax, tag, date, and author filters, backlinks, and similarity are in the query syntax reference.

4. Context build

gno context build compiles a Context Capsule for one goal: exact source spans with hashes, deduplicated under one token budget, with every retrieval gap declared in the Capsule itself. It is the handoff for a decision that rests on more than one document, and it is the input to a verified answer. See Context Capsules.

5. Changes, diff, impact

Change and dependency questions are a different shape from content questions. gno changes lists what moved in a window, gno diff shows how one document changed, and gno impact projects which documents a change may affect, all from GNO's bounded, metadata-first history. See Knowledge Delta.

6. Verified ask

gno ask --verify generates an answer against one closed Capsule and classifies each substantive claim against its supporting spans. Complete support returns the answer with citations; anything less withholds the draft and reports the failing claim. Abstention is a valid result of this rung, and an agent treats it as one.

7. Diagnose before grep

When a document you know exists is absent from results, gno query diagnose reports stage by stage whether the target appeared in lexical retrieval, vector retrieval, fusion, graph expansion, and reranking, so a candidate-generation miss is told apart from a ranking miss. Re-check the collection scope in the same step. A scoped grep or a direct file read is the fallback after that diagnosis, not before it.

The writing contract

Retrieve first. A write starts from what already exists, and the three write paths are distinct operations, chosen by what kind of thing is being written.

The thing being writtenPathHow
An existing canonical note that is wrong or incompleteeditChange the source file directly: editor, Web UI, PUT /api/docs/:id
A genuinely new note: a meeting, an idea, a sourcecapturegno capture with collection, title or path, source kind, and provenance
A standalone fact that may change laterremembergno remember "<fact>" --scope <scope>, then --add or --supersede

Configuring the protocol for your setup

The commands are fixed; the knowledge they run over is yours to shape.

Where the protocol stops