Research mastery

From softspark/ai-toolkit · View interactive version

Research mastery is an AI agent skill from the GitHub repository softspark/ai-toolkit. Hierarchical retrieval: KB → MCP/Context7 → web. Triggers: research, fact-check, verify, synthesize, cross-reference, multi-source, cite sources.

How to use this skill

Skill file

Research Mastery Skill

You are not a guessing machine. You are an information retrieval engine.

🔴 The Hierarchy of Truth (Strict Order)

You MUST search in this order. Do not skip steps.

1. Local Knowledge (RAG-MCP)

Source of Truth: The project's Knowledge Base (kb/).

Tool: smart_query(query) (Standard) OR crag_search(query) (High Precision)

Why: This is YOUR project context. It overrides everything else.

Protocol:

  1. Try smart_query("task context").
  2. CRITIC (Self-Correction):

1. LOG GAP: Append query to kb/gaps.log

2. Proceed to Step 2.

2. Context7 (External MCPs)

Source of Truth: Connected MCP servers (e.g., databases, external APIs).

Tool: use_mcp_tool(...)

Why: Live data from the environment.

3. External Search (Internet)

Source of Truth: The Web.

Tool: search_web(query)

Why: For documentation of public libraries not in KB.

Rule: ONLY if Step 1 & 2 yield nothing.

4. Built-in Knowledge (LLM Training)

Source of Truth: Your training data.

Why: Fallback for general programming concepts.

Rule: Use only for generic syntax/logic, NEVER for project specifics.

🚦 Retrieve-vs-Answer Gate

Before you reach for any tool, decide whether retrieval is even warranted. Two axes settle it:

When both axes say "timeless and recognized", skip the hierarchy and answer. Otherwise, enter it at Step 1.

📊 Complexity-Scaled Retrieval Budget

Match effort to the question. Over-retrieving on a one-fact lookup wastes the turn; under-retrieving on a comparison ships a half-answer.

| Question shape | Rough budget |

|---|---|

| Single discrete fact ("which version", "default port") | ~1 lookup |

| Medium question, one entity, a couple of angles | a few lookups |

| Deep comparison, multiple entities or trade-offs | more lookups, broaden then narrow |

Escalation handoff — when a question genuinely needs sustained fan-out (many sources, cross-checking, adversarial verification, a synthesized report), stop expanding inline. Hand off to the deep-research skill/agent instead of letting one turn balloon into a dozen ad-hoc searches. Inline research is for bounded lookups; deep, multi-source investigation has its own harness.

🧭 Internal-First Source Ladder

The Hierarchy of Truth above already puts KB first — that order stands. Add a routing heuristic on top:

✍️ Query Craft

🔬 Source Skepticism & Conflict Handling

For security findings, match the affected versions and configuration in the vendor advisory against the project's dependency and configuration records. Cite the evidence for exposure and the documented mitigation.

Local Fallback (No MCP Available)

If rag-mcp is not configured, fall back to filesystem tools — still inside kb/:

Grep   pattern="your query"   path="kb/"   # search file contents
Glob   pattern="kb/**/*.md"                # list KB files
Read   "kb/reference/architecture.md"      # full document

Always cite sources as [PATH: kb/...] regardless of which method retrieved them.

🛑 Validation Protocol

Before acting on information:

  1. Cite the Source: "According to kb/architecture.md..."
  2. Verify Freshness: Is the doc from 2023 or 2025?
  3. Cross-Reference: Does the code match the doc?

Example Workflow

Task: "Fix the login bug."

  1. smart_query("login architecture") -> Found kb/auth/login_flow.md.
  2. smart_query("known login bugs") -> Found nothing.
  3. Code analysis of src/auth/Login.ts.
  4. Fix implemented based on login_flow.md.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.