Queries#
A query is a saved filter over your collection: a set of rules that decides which notes appear. Saved queries live in the Queries section of the sidebar — click one and the note list narrows to exactly the notes that match. They're FoldNotes' answer to "show me everything that's actually relevant right now" without moving or copying a single note.
Queries are the engine behind two surfaces that share the same rule model:
- Saved queries in the sidebar — filter the note list in place (this page).
- Database Views — the same rules, presented as a sortable, multi-column table.
Everything below about rules, operators, and how task rules select notes applies to both.
Creating a query#
To create a query, expand the Queries section of the sidebar — the Library on iPhone and iPad — and tap + New Query (on macOS you can also right-click the header → New Query…). The query builder opens:
- Add a rule — pick a field, an operator, and (for most fields) a value.
- Add more rules to refine — each new rule is another condition.
- Choose how the rules combine — All or Any (see below).
- Name and save — the query appears in the sidebar and syncs to your other devices.
Run a saved query any time by clicking it in the sidebar; run it from the command line with fn query run "<query name>".
How rules combine — All vs Any#
A query's rules are joined one of two ways:
- All (AND) — a note must satisfy every rule. Narrows the result. "tagged
#workand modified this week and has an overdue task." - Any (OR) — a note matching at least one rule qualifies. Widens the result. "tagged
#urgentor favourited."
Fields and operators#
Each rule targets one field. The available operators depend on the field:
| Field | What it matches | Typical operators |
|---|---|---|
| Tag | The note's tags (hierarchical) | is · is not · is under · is not under |
| Title, Content | Text in the title or body | contains · does not contain |
| Date created / modified | When the note was made or last changed | within last N days |
| Size | Note length | greater than · less than |
| Favourite / Trashed / Archived / Daily note | Note flags | is true · is false |
| Has tasks | Whether the note contains any task | is true · is false |
| Task due date | Any task's due date | is overdue · is today · is this week · is next week · before · after |
| Task priority | Any task's priority | is · is not |
| Task completion | Whether tasks are complete | is true (complete) · is false (incomplete) |
| Task project | Any task's project | is · is not · is under · is not under · is none |
| Task context | Any task's context | is · is not · contains · does not contain · is none |
"is under" is the hierarchy operator: Task Project is under work matches work and every sub-project (work/marketing, work/marketing/launch), with the / boundary preventing work from matching workshop. Tags use it too.
How task rules select notes#
This is the part worth understanding, because it's the usual source of "why is this note here — or missing?" questions.
A query returns notes, not tasks. So a task-based rule asks a question about a note's tasks and includes the note if the answer is yes. Two consequences follow:
A rule matches a note if any single task qualifies#
Task Context is sarah returns every note that has at least one task tagged sarah — even if the note's other tasks aren't. To narrow it, add rules: Task Context is sarah and Task Completion is false → notes with an unfinished sarah task.
Negative task rules only consider notes that have tasks#
Task Project is not alpha means "the note has a task, and none of them is in alpha." A note with no tasks at all — a recipe, a journal entry, a reference page — is neither "in alpha" nor "not in alpha"; it's simply out of scope for a task question, so it's excluded from both the positive and the negative form.
This applies to every negative task operator: is not, does not contain, and is not under. (Positive operators are naturally fine — a note with no tasks can't match "has a task in alpha".)
Finding unassigned tasks — "is none"#
Use is none to find tasks that were never given a project or context:
Task Project is none— notes containing a task with no project (neither an inlineproject:token nor one inherited from the note's project tag).Task Context is none— notes containing a task with no context.
These are the query equivalent of the Task Board's (No Project) / (No Context) filters. Because "is none" is a positive "has a task like this" question, task-less notes are correctly excluded.
A few useful queries
- My inbox —
Task Context is meandTask Completion is false: every unfinished task assigned to you, wherever it lives. - Triage pile —
Task Context is noneandHas tasks is true: tasks you've captured but not yet classified. - Client review —
Task Project is under acmeandTask Due date is this week: everything for a client, across its sub-projects, due soon. - Stale work —
Has tasks is trueandDate modifiednot within last 30 days: notes with tasks you haven't touched in a month.
Running queries everywhere#
- Sidebar — saved queries sync across your devices: build one anywhere and it's saved to the rest. (Database Views are the exception — their filter rules are edited on macOS only.)
- Command line —
fn query run "<query name>"executes a saved query and prints the matching notes (--jsonfor scripting).fn query listshows what's available. - AI integration — the MCP server exposes
list_queriesandrun_query, so an assistant can run your saved queries too.
See also#
- Database Views — the same query rules, shown as a sortable table with columns.
- Tasks — task syntax, projects, and contexts.
- Task Board — a live kanban of the same task data (macOS).