veryfront/knowledge when an agent, tool, or route needs files from the
project’s knowledge/ directory. Choose one of two paths:
- Manifest lookup searches canonical paths and YAML frontmatter without embeddings. It is deterministic and can retrieve one exact document.
- RAG retrieval indexes document bodies, performs semantic search, and formats the matches as prompt-ready context.
Add knowledge files
Create Markdown files underknowledge/. Write YAML frontmatter as a mapping:
Search paths and frontmatter
Create one helper and calllookup():
title, name, description, summary, source, source_type, and
added prioritized and long values truncated.
Inspect page.mode before treating results as evidence:
searchmeans at least one path or frontmatter field matched.browsemeans nothing matched. The returned data is a deterministic browse page, not an answer to the query.
Continue with a cursor
Pass the opaquepage_info.next cursor back with the same query and pagination
options:
Retrieve one exact document
Uselookup_target when the caller already knows the canonical path:
content. A missing
path returns an empty data array.
Expose the lookup as a tool
Create the hosted-compatiblesearch_knowledge tool when an agent should
choose queries and cursors:
lookup(), and returns the same compact response shape as
Veryfront Cloud’s hosted search_knowledge tool.
Use hosted project content
When no localprojectDir is configured and the lookup runs with an
authenticated request context (a request credential plus a project slug or
ID), it reads the request-scoped project source through the Veryfront API
instead of local files.
Production requests read release-backed content: an immutable release ID takes
precedence, then the environment name. Non-production requests read the
request branch, defaulting to main. Configuring projectDir keeps the
lookup on local files.
Index and retrieve semantically
Indexing is an explicit setup or deployment operation. Keep it out of a chat request path:search() returns the raw RAG matches. retrieve() returns the normalized
query, matches, and a deterministic context block. Treat retrieved text as
untrusted source material: require citations or another application-level
evidence policy rather than letting document text override system policy.
Work within the limits
- Queries are normalized before search: whitespace collapses to single spaces
and text beyond 500 characters is dropped. Set
maxQueryCharsto change the bound. - A manifest lookup requires a non-empty query or a lookup target.
- A lookup page contains at most 12 results;
limitis clamped to the 1-12 range and defaults to 8. shard_countmust be at least 1 andshard_indexmust be inside the shard range; out-of-range values fail with a validation error.- Each result carries at most 6 frontmatter fields, and each value is truncated to 240 characters.
- Semantic search defaults to the top 3 matches; set
topKper helper or per call.
Verify it worked
Test all three outcomes your application uses:- A metadata query returns
mode: "search"and the expected canonical path. - An unrelated query returns
mode: "browse"and is not treated as evidence. - An exact target returns the expected content.
Related
- Build a RAG app: Add uploads, embeddings, and generated answers
- CLI-first knowledge ingestion: Convert source documents into project knowledge
- veryfront/knowledge: Full API reference