csquery syntax
Status: Shipped Generated from app @ 1b3d5a69d73473db077dfb44f4390b42cded6bd4 Regenerate: pnpm gen:reference
A csquery block is a fenced code block in any Markdown document. CodeSense renders it as a live table, list or board of the documents that match, and keeps it current as files change. The block is read-only: it can’t change anything.
```csquery
status: in-progress, review
tag: area=billing
columns: name, status, assigned_to
sort: status desc
limit: 20
``` Each line is key: value. Lines starting with # are comments. Keys aren’t case-sensitive. A mistake never breaks the page: unknown keys and bad values are ignored with a warning, and the defaults apply.
Keys
| Key | What it does |
|---|---|
tag | Match a frontmatter value: tag: key=value. A bare tag: x matches the tags list. |
status | Match one or more statuses, comma-separated. |
related | Documents that list this path in supporting_docs. |
backlink | Documents linked from this path. |
epic | Documents in this epic (parent_epic or epic frontmatter, or a folder of that name). |
depends | Documents that depend on this one (a path, story id or file name). |
kind | Kinds to list, comma-separated: story, bug, spike, epic, doc, dashboard, skill, other. Default story, bug, spike. |
org | Orgs to search: all, or a comma-separated list. Default: the org the document is in. |
team | Teams to search, comma-separated. |
layer | Layers to search: team, private, all-orgs. Private files are always this document's own org's. |
text | Words that must appear in the document body. |
scope | Limit to a sub-epic folder (by name) or an absolute path. A name that matches no folder shows an error. Required by the connectivity view. |
view | How to render the results. |
group | Field to group by (board lanes, list sections). Board defaults to status. |
columns | Table columns, comma-separated. |
limit | Maximum rows (1 or more). |
sort | Any field, optionally followed by asc or desc. Status and priority sort in workflow order. |
tag and status can repeat and add up. Every other key takes its last value.
Views
view is one of table, list, board, connectivity. The default is table.
Sorting
sort takes any field (a frontmatter key, or status, priority, mtime, path), optionally followed by asc or desc. status sorts in workflow order and priority in priority order. Shorthands: name, filename, file, id, storyid.
Defaults
view:tablecolumns:name,statuslimit: 200kind:story,bug,spikeorg: the org the document is in (writeorg: allto search every synced org)
Every block runs on the same query engine as the query_context MCP tool and codesense.queryContext() in pages. See Query your context.
What isn’t allowed
Action keys are dropped with a warning, because a query block only reads: setstatus, set_status, fire, open, draft, route, run, exec, mutate, write, delete.
Generated from app @ 1b3d5a69d73473db077dfb44f4390b42cded6bd4 Regenerate: pnpm gen:reference
How we know this is accurate 2 sources
Checked against the app at 1b3d5a69d73473db077dfb44f4390b42cded6bd4.
Code
-
src/shared/lib/csquery/parse-csquery.ts -
src/shared/lib/csquery/types.ts