#(doc) describes what a field means, and #(index) makes a dimension’s values searchable. A third lever, discovery curation, narrows which models and sources agents see in the first place. This page covers what to tag, index, and curate; for how indexes are built, kept fresh, and paid for, see Performance & Cost.
You don’t have to write tags by hand: the agent documents as it builds — every field it defines gets its #(doc) and #(index) tags as part of the modeling workflow — and you can ask it to document an existing model the same way. Review its work with this page in mind; good documentation directly improves the quality of chat-based analysis downstream.
Documentation Tags
Use#(doc) tags to add human-readable descriptions to fields. Place the tag on the line before the field definition.
#(doc) descriptions carry meaning the code can’t: units, business rules, thresholds, and caveats — like the segment cutoffs above — not restatements of the field name.
Value Indexing
Use#(index) to index all distinct values from a column. This enables AI agents to find fields by searching for data values, not just field names or descriptions.
Why Value Indexing Matters
Consider a product catalog where the column is namedproduct_category but contains values like “Running Shoes” and “Athletic Apparel”. When a user asks “What are our top-selling sports gear products?”, field names and documentation alone won’t surface those products — nothing is named “sports gear”.
With value indexing, the Credible Context Engine searches the actual values: it matches the question to fields whose values fit, then helps the agent construct a query with the correct filter — finding “Running Shoes” and “Athletic Apparel” without exact string matching.
When to Use Value Indexing
Use#(index) on:
- Names and titles - Product names, customer names, program titles
- Categorical values - Status codes, types, categories
- Lookup values - Region names, department names, brand names
- Numeric fields (amounts, counts, IDs)
- Timestamps and dates
Example: Well-Documented Model
Curating Discovery
Tags improve how well agents understand what they find; discovery curation narrows what they find in the first place. By default, every model is listed and every source is directly queryable. Curation happens at two levels:export in the model itself controls which sources a file exposes, and manifest fields control which files agents land on.
export { … } — in the model
export { … } filters which sources within a file are exposed. A file with no export exposes all its top-level sources; add one to keep imported or scaffolding sources out of discovery.
export, agents discover orders but not raw_order_lines; without it, both would be listed.
explores and queryableSources — in the manifest
Add optional fields to the package manifest (publisher.json, described in Publishing) to point agents at the model files that matter:
explores — .malloy file paths (relative to the package root) whose models agents should discover and land on.
- Omit — discovery unchanged; every model and source stays listed.
- Set — listings narrow to these files, plus each file’s
export { … }closure.
queryableSources — whether non-curated sources can still be queried by name. Only applies when explores is set.
This curates discovery, not access — what is listed and queryable by name, not who may query. To restrict access by user or group, use
#(authorize) and secure givens, covered on the next page.Hiding an #(authorize)-gated source. An access gate blocks querying, not discovery, so a gated source still appears in listings to callers who can’t query it. To hide it while keeping it queryable for authorized callers, leave it out of the curated explores/export set and set queryableSources: "all". Under the default "declared", the non-curated source returns 404 by name — which blocks authorized callers too.Next Steps
Access Control
Secure your model — row, column, and source-level access rules
Context Engine Overview
Learn how metadata powers AI discovery