ghostbrain/docs/query syntax

query syntax

the recommended way to query ghostbrain is to ask it a question. operators exist for when you already know the shape of the answer — they narrow the search before the language model ever sees it, which is faster and cheaper than reranking.

plain english

just type. ghostbrain extracts entities (people, projects, dates, source apps) and runs a hybrid lexical + semantic search across the matching corpora.

? what did marie say about the q3 launch
? meetings about pricing this week
? who was upset about the migration
? the figma file someone shared in the team channel last month

under the hood every query goes through three phases: extract (find named entities and constraints), retrieve (lexical + vector hits per source), rank (small reranker, then the local model writes the summary). all three run on your machine.

operators

operators look like key:value and can appear anywhere in the query. they compose with and by default.

operatormatches
from:<name>messages, prs, comments authored by a person
with:<name>threads or meetings involving a person
mentions:<name>items that name a person but weren't written by them
in:<channel>slack channels, gmail labels, notion workspaces, linear projects
source:<app>restrict to one connector. e.g. source:slack
before:<date>strict cutoff. accepts 2026-04-01, last-monday, 3w
after:<date>strict cutoff, the other way
during:<range>shorthand. during:last-week, during:apr-2026
type:<kind>narrow by item kind. type:meeting, type:thread, type:pr, type:doc
has:<feature>has:attachment, has:link, has:decision
limit:<n>cap returned items. default is 20.

date shortcuts

anything before:, after:, or during: understands:

resolving people

people names are resolved against your contacts (gmail + calendar + slack) plus any people/*.md notes you've created. from:marie matches "marie chen", "[email protected]", and her slack U07XYZ as one entity. ambiguous names will surface a picker.

tip

if you find yourself disambiguating "marie" every time, edit vault/people/marie chen.md and add the alias to frontmatter: aliases: [marie, m.chen, marie c]. ghostbrain reads its own vault too.

composing queries

operators combine with and. use | for or within one operator value, and - to negate.

# slack and gmail only
? q3 launch source:slack|gmail

# anyone but eli
? hiring debrief from:-eli

# last two weeks, with marie, in the launch channel
? blockers with:marie in:launch during:2w

getting an answer, not a list

by default ghostbrain returns ranked hits. if you want a synthesised answer instead — a paragraph with citations — prefix the query with !:

! what did we decide about pricing in march
# →
On 2026-03-14, in the #pricing slack thread, the team agreed to move
to a single $0 tier and drop the legacy "team" plan [[1]]. This was
confirmed by sam in the q1 retro doc [[2]].

[1] slack/#pricing/2026-03-14
[2] notion/q1-retro-2026

citations are always linkable. clicking jumps to the underlying source or the markdown mirror, your choice.

piping results

any query result can be redirected with >:

# dump matches into today's inbox note
? q3 launch > inbox/today.md

# synthesised summary into a project doc
! what's blocking the migration > projects/migration/blockers.md

# json on stdout (cli only)
ghostbrain search "q3 launch" --json

saved queries

pin a query with :save <name> and it shows up in the sidebar under saved. saved queries re-run on demand and can be scheduled (every monday morning, every commit, every meeting end) — see hooks.

? open prs from:me source:github :save my-open-prs

a small cookbook

# meetings on the calendar this week, with a one-line summary each
! meetings during:this-week type:meeting limit:5

# every time eli has reviewed one of my prs
? from:eli type:review mentions:me

# things i said i'd do but haven't filed in linear
! promises i made from:me has:commitment -source:linear

# the last figma link anyone shared
? figma.com has:link limit:1