AGENT SKILL

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.

License 许可
MIT
最近更新
2026-04-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
query
tools
[ "search", "query", "get_page", "list_pages", "get_backlinks", "get_timeline" ]
version
1.0.0
mutating
false
triggers
[ "what do we know about", "tell me about", "who is", "what happened", "search for", "look up", "who knows who", "relationship between", "connections" ]
description
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.

03 SKILL.md 正文

Query Skill

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

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:
    • Keyword search gbrain for FTS matches (search) -- uses QMD BM25
    • Query gbrain for semantic+keyword via Expander expansion (query) -- Expander generates lex/vec/hyde variants, QMD handles BM25 + vector + RRF fusion
    • 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.

Search Pipeline

GBrain uses a two-tier search architecture:

  1. gbrain search -- direct keyword/BM25 search via QMD. Fast, works offline without any API keys.
  2. gbrain query -- Expander-enhanced search: the Expander generates 7 structured query variants (3 lex + 3 vec + 1 hyde), QMD runs BM25 + vector search + RRF fusion. Uses QMD local expansion by default (no API key needed). Override with GBRAIN_EXPAND_PROVIDER to use Anthropic, OpenAI, GLM, or other cloud LLMs.

The Expander defaults to QMD local expansion (1.7B GGUF model, auto-downloaded, no API key needed). Override with GBRAIN_EXPAND_PROVIDER (anthropic, openai, openrouter, custom) and GBRAIN_EXPAND_MODEL to use a cloud LLM instead. When a cloud provider is configured but the API key is missing, it falls back to QMD local.

<!-- QMD: graph-query not yet available -->

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

Tools Used

  • Keyword search gbrain (search) -- QMD BM25
  • Expander-enhanced search gbrain (query) -- Expander + QMD hybrid
  • Read a page from gbrain (get_page)
  • List pages in gbrain with filters (list_pages)
  • Check backlinks in gbrain (get_backlinks)
  • View timeline entries in gbrain (get_timeline)

04 同仓库更多 Skills

sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

webhook-transforms

Generic framework for converting external events (SMS, meetings, social mentions) into brain-ingestible signals. Define a transform function, register a webhook URL, and incoming events get processed through the brain pipeline.

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

testing

Skill validation framework. Validates every skill has SKILL.md with frontmatter, every reference exists, every env var is declared. The testing contract for the skill system itself.

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

soul-audit

6-phase interactive interview that generates the agent's identity (SOUL.md), user profile (USER.md), access control (ACCESS_POLICY.md), and operational cadence (HEARTBEAT.md). Re-runnable anytime to update any section.

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

smoke-test

Post-restart smoke tests + auto-fix for gbrain and OpenClaw environments. Tests critical services, auto-fixes known issues, extensible via user-defined test scripts in ~/.gbrain/smoke-tests.d/*.sh.

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

skillpack-check

Run `gbrain skillpack-check` to produce an agent-readable JSON health report for the gbrain install. Wraps `gbrain doctor` + `gbrain apply-migrations --list` so a host agent (your OpenClaw's morning-briefing, any OpenClaw cron) can see at a glance whether the skillpack needs attention. Use when the user asks "is gbrain healthy?", when a cron fires a morning check, or proactively when something seems off (jobs not running, brain not updating, autopilot silent).

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

skillify

The meta skill. Turn any raw feature or script into a properly-skilled, tested, resolvable, evaled unit of agent-visible capability. Use when the user says "skillify this", "is this a skill?", "make this proper", or after a new feature is built without the full skill infrastructure. Paired with `gbrain check-resolvable`, skillify gives a user-controllable equivalent of Hermes' auto-skill-creation: you build, skillify checks the checklist, check-resolvable verifies nothing is orphaned. The human keeps judgment; the tooling keeps the checklist honest.

★ 0