agentleFS
ravidsrkravidsrk/agent-skills/skills/knowledge-query/SKILL.md

knowledge-query

Skill1 starsChanged 21 days agoMITView on GitHub

Answer questions from a markdown knowledge base with grounded citations — keyword, semantic, and graph search; source precedence; gap flags; daily briefings; research synthesis. Use when the user asks "what do we know about X", "search my notes/brain", "who is X", "give me a briefing", "summarize what I know about Y", or needs an answer traceable to sources.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use several query shapes: exact names, distinctive phrases, synonyms, and likely folder names.

    line 85
  2. Distinctive:

    If gbrain or an MCP search tool is available:

    line 89
  3. Distinctive:

    Start with the search chunks.

    line 114
  4. Distinctive:

    Read the page's citations and timeline, not just the body.

    line 116
  5. Distinctive:

    Prefer the most recent page when two pages cover the same fact.

    line 117
  6. Distinctive:

    If you synthesize across pages, cite each one.

    line 130
  7. Distinctive:

    Put inference behind an explicit label: "Inferred from ...".

    line 132
  8. Distinctive:

    Never fill a gap with plausible-sounding detail.

    line 142

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Knowledge Query

Answer from the knowledge base, not from vibes. Every claim traces to a page; every gap is stated; every conflict is surfaced instead of silently resolved.

This skill works on a plain markdown tree ($KB_ROOT). If gbrain is installed, its hybrid search and graph queries replace the keyword layer; the answer contract stays the same.

When to use

  • "What do we know about X?"
  • "Search my notes / my brain for Y"
  • "Who is X?" / "How are A and B connected?"
  • "What happened with X?"
  • "Give me a briefing for today"
  • "Summarize what I know about Y"
  • "Research this topic using my notes plus the web"
  • Any question where an uncited answer would be untrustworthy

When NOT to use

  • The knowledge base has no relevant content and the user wants general knowledge — say so and use a web/research tool instead.
  • The user wants a creative draft, not a grounded answer.
  • The question is about a live system state that must be queried from an API, not from notes.

Setup

export KB_ROOT="${KB_ROOT:-$HOME/brain}"
rg --version

Optional gbrain:

gbrain query "what do we know about pricing?"
gbrain graph-query companies/acme --type works_at --direction in

The answer contract

  1. Grounded — answer from pages in the knowledge base, not from the model's memory.
  2. Cited — every factual claim carries [Source: <slug>, <section>, updated <date>].
  3. Gap-aware — if the base does not contain the answer, say "the knowledge base has no information on X" and name what is missing.
  4. Conflict-aware — if sources disagree, show both with citations; do not pick one silently.
  5. Freshness-aware — flag pages older than 90 days, or whose updated_at predates newer evidence.
  6. Token-aware — read search chunks first; load full pages only when needed.

Workflow

Step 1 — Decompose the question

Break it into searchable parts:

Question typeStrategy
Entity lookup ("who is Jane?")Keyword + person page + backlinks
Topic recall ("what do we know about pricing?")Keyword + concept pages + recent pages
Relationship ("how are Jane and Acme connected?")Graph/backlinks + typed links
Timeline ("what happened last month?")Date filters + meeting/timeline entries
Decision ("why did we choose X?")Meeting notes + decision records + source docs
Gap ("do we have anything on Y?")Keyword + semantic, then state the gap

Step 2 — Layer 1: keyword search

bash scripts/search.sh "pricing experiment" --limit 20
bash scripts/search.sh "Jane Doe" --type person

Use several query shapes: exact names, distinctive phrases, synonyms, and likely folder names. Search filenames and frontmatter, not just body text.

Step 3 — Layer 2: semantic search

If gbrain or an MCP search tool is available:

gbrain query "why did we choose annual-only pricing?"

Otherwise expand the keyword search with synonyms and related terms. Do not claim semantic coverage you did not run.

Step 4 — Layer 3: graph search

For relationship questions, follow links:

rg -n '\[\[people/jane-doe' "$KB_ROOT" --glob '*.md'
rg -n 'works_at|founded|invested_in|advises' "$KB_ROOT" --glob '*.md'

With gbrain:

gbrain graph-query people/jane-doe --depth 2 --direction both

Step 5 — Read the top results

  • Start with the search chunks.
  • Load the full page only when the chunk is insufficient.
  • Read the page's citations and timeline, not just the body.
  • Prefer the most recent page when two pages cover the same fact.

Step 6 — Synthesize with citations

Jane is CTO of Acme [Source: people/jane-doe, updated 2026-04-01].
The annual-only pricing experiment was approved on 2026-05-21
[Source: meetings/2026-05-21-pricing-review, Decisions section].

Rules:

  • Cite the slug and the section, not a vague "notes".
  • If you synthesize across pages, cite each one.
  • Quote exact phrasing for decisions and commitments.
  • Put inference behind an explicit label: "Inferred from ...".

Step 7 — State gaps, staleness, and conflicts

Gap: the knowledge base has no information on the enterprise contract renewal.
Stale: the pricing page was last updated 2026-01-10; newer meeting notes may supersede it.
Conflict: the 2026-03-02 note says monthly-first; the 2026-05-21 review says annual-only.

Never fill a gap with plausible-sounding detail.

Step 8 — Offer the next action

  • "Want me to capture the missing source?"
  • "Want me to reconcile the two conflicting notes?"
  • "Want the full timeline for this entity?"

Answer format

## Answer
{Direct answer in 1–3 sentences.}

## Evidence
- {Claim} [Source: {slug}, {section}, updated {date}]
- ...

## Gaps and conflicts
- {What the base does not cover}
- {Conflicting sources, with both citations}

## Suggested next step
- {Capture the missing source / reconcile / read the full page}

Daily briefing

A briefing is a query with a fixed shape:

  1. Brain pulse: new facts, contradictions, pending consolidation.
  2. Today's meetings and attendees.
  3. Active deals / projects and approaching deadlines.
  4. Open action items.
  5. Recent changes (last 24 hours).
  6. People in play.
  7. Stale pages relevant to today.

See references/briefing.md for the query list and output template.

Research and synthesis

For "research this using my notes plus the web":

  1. Query the knowledge base first.
  2. State what is already known, with citations.
  3. Fetch external sources only for what is missing or needs verification.
  4. Label external facts and their dates.
  5. Return "what is new vs what the base already knew".

See references/research.md for academic verification, strategic reading, book mirroring, and concept synthesis.

Common gotchas

GotchaFix
Answer sounds confident but has no citationTreat it as a draft; go back to search
Search returns nothing because of wordingTry synonyms, folder names, and exact phrases
Two pages disagreeShow both; do not average them
Page is staleFlag the date; prefer newer evidence
Full page is too largeRead chunks first; load sections on demand
Search hits inbox/ triage noiseFilter by type or folder; triage the inbox
External research overwrites the baseLabel external facts; capture the source separately
The base has no answerSay so explicitly; offer to capture the missing source

References

  • references/search.md — query templates, layers, ranking, token budget
  • references/citations.md — source precedence, citation format, staleness, conflicts
  • references/briefing.md — daily briefing sections and queries
  • references/research.md — external research, academic verification, strategic reading, book mirror, concept synthesis
  • scripts/search.sh — keyword search over $KB_ROOT

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.