gbrain-query

gbrain-query is a skill for Claude Code, Codex from imphillip/gbrain-openclaw. It costs 29 tokens per session (555 once invoked), scanned A, original, MIT.

A search and question-answering tool for a knowledge base called the brain. It combines exact keyword search, meaning-based search, and structured queries such as lists, backlinks, timelines, and tags.

In plain words
What is it for?
Use it to answer questions across stored pages, find entities by name or meaning, inspect relationships and timelines, and save useful answers back to the knowledge base.
Why use it?
It helps find and combine relevant information when a single keyword search is not enough, while retaining citations to the source pages.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/imphillip/gbrain-openclaw/query
Any agent
npx skills add imphillip/gbrain-openclaw --skill query
Clone the repo
git clone --depth 1 https://github.com/imphillip/gbrain-openclaw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gbrain-query

README.md
[![agentmods](https://agentmods.dev/badge/skills/imphillip/gbrain-openclaw/query.svg)](https://agentmods.dev/skills/imphillip/gbrain-openclaw/query)
Your own site
<a href="https://agentmods.dev/skills/imphillip/gbrain-openclaw/query"><img src="https://agentmods.dev/badge/skills/imphillip/gbrain-openclaw/query.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 555 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.00555
Opus 5 $0.00015 $0.00278
Sonnet 5 $0.00006 $0.00111
Haiku 4.5 $0.00003 $0.00056

Measured 4d ago against content hash 5493b678b06a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gbrain-query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/query/SKILL.md · 69 lines

What it actually says

Query Skill

  1. FTS5 keyword searchgbrain search "<query>" — fast, exact matches. Best for: names, company names, specific terms, acronyms.

  2. Semantic vector searchgbrain query "<question>" — meaning-based. Best for: "who knows X?", "what's our thesis on Y?", conceptual or relationship questions. Requires OPENAI_API_KEY and at least one gbrain embed run.

  3. Structured queries — relational navigation.

    • gbrain list --type person --tag yc-alum
    • gbrain backlinks <slug> — who links to this page?
    • gbrain timeline <slug> — what happened with this person/company?
    • gbrain tags <slug> — what is this page tagged with?

Workflow

  1. Decompose the question into search strategies.
  2. Run FTS5 search for key terms.
  3. Run semantic query for the full question (if embeddings available).
  4. Merge and deduplicate results.
  5. For top results, gbrain get <slug> to read full pages.
  6. Synthesize answer with citations: "Jane Doe"
  7. If the answer is valuable enough to keep, consider creating a page: cat answer.md | gbrain put concepts/topic

Ranking heuristic

  • FTS5 score × 0.4 + vector similarity × 0.6 = combined score
  • Boost pages with type matching the question intent (+0.2 for person queries hitting person pages)
  • Boost pages updated recently
  • Prefer pages with richer content (longer compiled_truth)

When you don't know

Say so. "The brain doesn't have info on X" is honest and useful. Suggest enrichment: "Want me to research X and add them to the brain?"

Examples

# Find a person
gbrain search "Jane Doe"
gbrain get people/jane-doe

# Relationship question
gbrain query "who is connected to Anthropic?"

# Relational: all YC founders
gbrain list --type person --tag yc-alum

# What links to a company page?
gbrain backlinks companies/acme-corp

# Recent activity
gbrain list --limit 20  # sorted by updated_at desc
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 69 lines · 29 tokens per session scan A 5493b678b06a

Subscribe to this mod's changes

gbrain-query is a skill published in the GitHub repository imphillip/gbrain-openclaw (11 stars, last pushed 5mo ago), licensed MIT. It adds 29 tokens to every session and 555 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

my-wiki

Manage local OKF-compatible Markdown My Wiki vaults with an AI agent. Use for capturing webpages, PDFs, Office documents, notes, images, folders, and ZIP bundles as References; maintaining Reference-to-Concept evidence links; searching or answering from a vault; checking or repairing vault health; switching among…

NimaChu/my-wiki · 78 tokens

kb

Set up, evolve, or operate a hraness/kb local-first Markdown knowledge base for coding-agent memory. Use when a user asks to design KB conventions or a recurring KB ritual; search or query a KB or Obsidian vault; load or recover repository context, plans, decisions, concepts, backlinks, semantic search, or Git…

hraness/kb · 155 tokens

brain-ops

Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking. Read this before any brain interaction.

timurgaleev/memex · 42 tokens

display

Expose the organized knowledge base through a readable frontend experience. Use when a user wants to browse the knowledge base visually as a lightweight site instead of reading raw Markdown files directly. Supports building viewers for specific data paths (e.g., individual books) or the entire knowledge base.

NatsuFox/Tapestry · 56 tokens

llm-wiki

基于思源笔记的 LLM Wiki 知识库工作流。支持全自动摄入、查询知识图谱、质量检查、矛盾检测。依赖 siyuan-skill。触发词:整理笔记、处理这篇文章、知识库查询、检查知识质量、摄入文档。.

Joe-rq/siyuan-llm-wiki · 74 tokens

openclaw-enterprise-knowledge-base

Use when creating, auditing, repairing, validating, or syncing an enterprise Markdown or Obsidian knowledge base for OpenClaw agents. Applies to ontology-style wiki pages, governed business objects, hot.md startup cache, agent-safe visibility rules, OpenClaw manifests, RAG handoff, sales/support action governance, and…

X-RayLuan/awesome-ceo-stack · 78 tokens