Query logo

Query

CommunityPopular
garrytan
query

Answer questions using the brain's knowledge with 3-layer search, synthesis, and citation propagation. Use when the user asks a question, wants a lookup, or needs information from the brain.

Overview

Publishergarrytan
Repositorygbrain
Skill namequery
Stars
30.1K
Forks
4.5K
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by garrytan on GitHub. Read the source before you install it.

Installation

Install the Query AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/garrytan/gbrain.git /tmp/gbrain
mkdir -p .claude/skills
cp -r /tmp/gbrain/plugin-variants/gbrain-coding/skills/query .claude/skills/query
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Query in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Query on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Query is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Query Skill

Answer questions using the brain's knowledge with 3-layer search and synthesis.

Memory verbs (MEMORY_VERBS v1, gbrain ≥ 0.43). When connected to a brain over MCP, prefer the seven frozen memory verbs for memory work — they carry provenance, evidence, and a server-enforced token budget:

  • recall(query | entity, budget_tokens) — the budget-packed memory read. Use it instead of bare search for "what do we know that we SAVED about X".
  • entity(name) — a zero-LLM person/company/project card (aliases, last-touched, open threads, top edges). Use it instead of get_page + get_backlinks when you just need the card.
  • synthesize(question) — the explicitly-expensive cross-page answer; the heavy version of query. Reach for it only when the answer must combine evidence across pages. Fall back to search/query/get_page when the verbs aren't on the surface (pre-0.43 servers; --surface full includes the verbs alongside every other op). See docs/protocol/MEMORY_VERBS_v1.md.

Contract

This skill guarantees:

  • Every answer is grounded in brain content (no hallucination)
  • Every claim has a citation tracing back to a specific page slug
  • Gaps are flagged explicitly ("the brain doesn't have information on X")
  • Source precedence is respected (user statements > compiled truth > timeline > external)
  • Conflicting sources are noted with both citations

Phases

  1. Decompose the question into search strategies:
    • Keyword search for specific names, dates, terms
    • Semantic query for conceptual questions
    • Structured queries (list by type, backlinks) for relational questions
  2. Execute searches:
    • Cheap-hybrid search gbrain for exact tokens / known names (search)
    • Full-hybrid search gbrain with multi-query expansion for concept questions (query)
    • List pages in gbrain by type or check backlinks for structural queries
  3. Read top results. Read the top 3-5 pages from gbrain to get full context.
  4. Synthesize answer with citations. Every claim traces back to a specific page slug.
  5. Flag gaps. If the brain doesn't have info, say "the brain doesn't have information on X" rather than hallucinating.

Anti-Patterns

  • Answering from general knowledge when the brain has relevant content
  • Hallucinating facts not in the brain
  • Silently picking one source when sources conflict
  • Loading full pages when search chunks are sufficient
  • Ignoring source precedence (user statements are highest authority)

Output Format

Answers should include:

  • Direct response to the question
  • Citations: "According to [Source: people/jane-doe, compiled truth]..."
  • Gap flags: "The brain doesn't have information on X"
  • Conflict notes when sources disagree

Quality Rules

  • Never hallucinate. Only answer from brain content.
  • Cite sources: "According to concepts/do-things-that-dont-scale..."
  • Flag stale results: if a search result shows [STALE], note that the info may be outdated
  • For "who" questions, use backlinks and typed links to find connections
  • For "what happened" questions, use timeline entries
  • For "what do we know" questions, read compiled_truth directly

Token-Budget Awareness

Search returns chunks, not full pages. Read the excerpts first before deciding whether to load a full page.

  • gbrain search / gbrain query return ranked chunks with context snippets. These are often enough to answer the question directly.
  • Only use gbrain get <slug> to load the full page when a chunk confirms the page is relevant and you need more context (e.g., compiled truth, timeline).
  • "Tell me about X" -- get the full page (the user wants the complete picture).
  • "Did anyone mention Y?" -- search results are enough (the user wants a yes/no with evidence).

Source precedence

When multiple sources provide conflicting information, follow this precedence:

  1. User's direct statements (highest authority -- what the user told you directly)
  2. Compiled truth (the brain's synthesized, cited understanding)
  3. Timeline entries (raw evidence, reverse-chronological)
  4. External sources (web search, API enrichment -- lowest authority)

When sources conflict, note the contradiction with both citations. Don't silently pick one.

Citation in Answers

When referencing brain pages in your answer, propagate inline citations:

  • Cite the page: "According to [Source: people/jane-doe, compiled truth]..."
  • When brain pages have inline [Source: ...] citations, propagate them so the user can trace facts to their origin
  • When you synthesize across multiple pages, cite all sources

Graph Traversal (v0.10.1+)

For relationship questions ("who knows who at X?", "connections between A and B", "who works at Acme?", "who attended the standup?"), use the graph layer instead of full-text search:

  • gbrain graph-query <slug> --type <link_type> --depth N --direction in|out|both
  • Available link types: attended, works_at, invested_in, founded, advises, mentions, source
  • --direction in answers "who points to X?" (e.g., who works at company X)
  • --direction out answers "what does X point to?" (default)
  • --depth N controls multi-hop traversal (default 5)

Examples:

  • "Who works at Acme?" → gbrain graph-query companies/acme --type works_at --direction in
  • "Who attended Demo Day W26?" → gbrain graph-query meetings/demo-day-w26 --type attended --direction out
  • "What companies has Emily advised?" → gbrain graph-query people/emily --type advises --direction out
  • "Who has Alice met (via meetings)?" → gbrain graph-query people/alice --type attended --depth 2

Combine with gbrain query for queries that need BOTH semantic similarity AND graph structure. Search results are ranked with a small backlink boost so well- connected entities surface higher.

Search Quality Awareness

If search results seem off (wrong results, missing known pages, irrelevant hits):

  • Run gbrain doctor --json to check index health
  • Check embedding coverage -- partial embeddings degrade hybrid search
  • Compare keyword search (gbrain search) vs hybrid search (gbrain query) for the same query to isolate whether the issue is embedding-related
  • Report search quality issues in the maintain workflow (see maintain skill)

Tools Used

  • Keyword search gbrain (search)
  • Hybrid search gbrain (query)
  • Read a page from gbrain (get_page)
  • List pages in gbrain with filters (list_pages)
  • Check backlinks in gbrain (get_backlinks)
  • Traverse the link graph in gbrain (traverse_graph)
  • View timeline entries in gbrain (get_timeline)

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Query AI skill do?

Answer questions using the brain's knowledge with 3-layer search, synthesis, and citation propagation. Use when the user asks a question, wants a lookup, or needs information from the brain.

Why use Query on TypingMind?

Because you install it once and use it with any model. Query is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Query in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/garrytan/gbrain/tree/master/plugin-variants/gbrain-coding/skills/query. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Query?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Query?

As many as you like. As long as a model supports skills, you can use Query with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Query AI skill free?

Yes. It is published on GitHub by garrytan under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇