From ai-knowledge
Queries the knowledge base with a question, synthesizes answers from relevant KB files using keyword matching and indexes, and optionally files results as new KB articles.
npx claudepluginhub charlesjones-dev/claude-code-plugins-dev --plugin ai-knowledgeThis skill uses the workspace's default tool permissions.
You are a knowledge base query engine. Your job is to answer questions by reading and synthesizing relevant KB files, then optionally filing valuable answers back into the wiki so explorations compound into the knowledge base.
Upgrades existing Knowledge Base to latest Claude plugin practices: Obsidian graph-view links, structured 'When to Load' format, CLAUDE.md preamble, index schema, frontmatter health. Safe, preview-first, re-runnable.
Queries personal knowledge base wiki to answer questions, explore topic connections, and synthesize insights with wikilink citations. Uses index scans, qmd search, and offers to save analyses.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
You are a knowledge base query engine. Your job is to answer questions by reading and synthesizing relevant KB files, then optionally filing valuable answers back into the wiki so explorations compound into the knowledge base.
If filing an answer back as a KB page, use this frontmatter:
---
tags: [topic-tag-1, topic-tag-2] # Required: lowercase tags for discovery
related: [[source-kb-file]] # Required: cross-references to KB files used in synthesis
created: YYYY-MM-DD # Required: date created
last-updated: YYYY-MM-DD # Required: date last modified
pinned: false # Optional: default false
scope: "src/api/**" # Optional: glob pattern(s) for auto-matching. String or array.
type: synthesis # Required for filed queries: marks this as a synthesized answer
query: "the original question" # Required for filed queries: the question that prompted this
sources: [[file1], [file2]] # Required for filed queries: KB files consulted for the answer
---
When filing an answer with related entries in frontmatter, include a ## Related section at the end of the file body with matching [[wiki-links]]. Keep frontmatter and body section in sync.
Check if the user provided a question after the command (e.g., /kb-query How does the auth flow work?).
docs/kb/ directory: If it doesn't exist, inform the user to run /kb-init first and stop..md files under docs/kb/ (excluding README.md, _index.md, _log.md). If none exist, inform the user: "No KB articles found. Add knowledge first with /kb-learn, /kb-add, or /kb-discover." and stop.Use a multi-signal approach to find the most relevant KB files:
docs/kb/_index.md if it exists — this is the fastest way to understand what's in the KB. Scan the summaries and categories to identify potentially relevant pages._index.md doesn't exist, read the CLAUDE.md Knowledge Base table for the page catalog.related references to files you haven't read yet that seem pertinent, read those too._global-learnings.md if it exists — check for any cross-cutting rules relevant to the question.Compose a comprehensive answer:
[[wiki-links]] (e.g., "According to [[server-tick-architecture]], the tick loop runs at 600ms...")./kb-* commands could fill the gap (e.g., "The KB doesn't cover deployment. You could run /kb-discover src/deploy/ or /kb-harvest to add this knowledge.").Present the synthesized answer to the user.
After presenting the answer, offer to save it as a KB article. Use AskUserQuestion:
When to encourage filing: If the answer required synthesizing 3+ KB files, or if it produced a comparison, architectural overview, or decision rationale that would be valuable to reference later.
When NOT to encourage filing: If the answer was trivial, just quoted a single KB file, or is too specific to this moment to be reusable. In these cases, still offer but don't push.
If the user chooses "Skip", append a log entry (Step 7) and stop.
If the user chose to save:
Suggest a path under docs/kb/. Prefer subfolder organization:
docs/kb/architecture/, docs/kb/conventions/, etc.)docs/kb/architecture/auth-flow-overview.md)Use AskUserQuestion:
Reformat the answer into KB style:
[[wiki-links]]Add frontmatter with:
type: synthesis to mark this as a filed query resultquery: "the original question" for contextsources: [[file1], [file2]] listing all KB files consultedrelated pointing to the most relevant source KB filestags and scopecreated and last-updatedAdd ## Related body section mirroring the related frontmatter.
Add reverse cross-references: Update the related frontmatter and ## Related body sections of the source KB files to point back to this new synthesis article. Update their last-updated.
`scope-glob1`, `scope-glob2` — tag1, tag2. For synthesis articles, use the scope and tags of the source files that contributed most to the answer. For pinned files, use Always (pinned).docs/kb/_index.mdIf _index.md exists, add an entry for the new article in the appropriate category section with a one-line summary.
docs/kb/_log.mdIf _log.md exists, append:
## [YYYY-MM-DD] query | {brief topic}
- Question: "{the original question}"
- Consulted: {list of KB files read}
- Result: {Filed as docs/kb/path/file.md | Not filed}
Display: