/second-brain:knowledge-bank-lookupfrom second-brain
Delegates knowledge bank lookups to Explore subagents with a reflections-first strategy, checking /reflections/ before documentation to extract past failures and proven approaches. Automatically triggers on service mentions or investigation requests.
Ships in second-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Latest: v2.4.0 - Structure refactoring with improved clarity and terminology. See CHANGELOG.md for details.
This skill triggers automatically when Claude detects patterns listed in Trigger Detection. No manual invocation needed.
/second-brain:knowledge-bank-lookupSkill({ skill: "second-brain:knowledge-bank-lookup" })| Setting | Value | Effect |
|---|---|---|
user-invocable | true | Visible in slash menu, Skill tool allowed |
context | fork | Runs in isolated subagent (Explore agent) |
agent | Explore | Uses Explore agent optimized for codebase research |
See references/examples.md for detailed integration examples.
This skill enables efficient lookup of service documentation, architectural patterns, best practices, and reflections from the knowledge bank by delegating research to specialized subagents. Rather than consuming main agent context with large documentation reads, subagents perform deep analysis and return only distilled, actionable insights.
Key Benefits:
Knowledge bank path is dynamically resolved via common utilities.
Setup: skills/common/setup_kb_path.sh --configure
Verify: skills/common/setup_kb_path.sh --show
Usage in Scripts: source skills/common/get_kb_path.sh && KB_PATH=$(get_kb_path)
See skills/common/README.md for details.
Automatically invoke knowledge bank lookup when detecting:
Choose lookup type based on trigger context:
| Type | When to Use | Context Budget | Model |
|---|---|---|---|
| Quick | Service mention, component reference | ~900 lines → 300 returned | haiku |
| Standard | Investigation, implementation planning | ~1950 lines → 600 returned | sonnet |
| Deep | Architectural decisions, cross-service | ~7300 lines → 1500 returned | sonnet |
Base Path: Dynamically resolved via common utilities (see Configuration)
Total: 172 markdown files across 4 projects ([project-a], [project-b], CC, [project-c])
Key Directories:
projects/{service}/ - Service-specific documentation (concepts, components, best-practices)_index/ - Maps of Content (MOCs) for efficient navigationreflections/ - Process reflections (⚠️ CHECK FIRST before technical docs)manual/ - Documentation and integration manualsrules/ - Cross-project process rulesSee references/knowledge-bank-structure.md for detailed structure.
All workflows follow this pattern:
When: Service mention, simple component reference
Workflow: Check 3-5 recent reflections → Read MOC → 2-3 docs → 1-hop WikiLinks (2-3 additional docs)
Invocation: See Quick Lookup Template
When: Investigation mode, implementation planning, best practice queries
Workflow: Search reflections for topic → Read MOC → 5-7 docs → 1-2 hop WikiLinks (5-7 additional docs)
Invocation: See Standard Lookup Template
When: Major refactoring, architectural decisions, cross-service analysis
Workflow: Comprehensive reflection analysis → All MOCs → 10+ docs → Full DFS (up to 20 docs, 3 hops)
Invocation: See Deep Lookup Template
When: User mentions Claude Code, CC, hooks, subagents, AI agent patterns
Note: No CC MOC exists yet; navigate directly to /knowledge-bank/projects/cc/
Workflow: Check CC-related reflections → Navigate to project files → Synthesize meta-pattern insights
Index or MOC-First: Start with the best available navigation entry point
_meta/index.md: Auto-generated catalog of all KB documents — always available, covers every project_index/: Human-curated, deeper context — available for [project-a] and [project-b]_meta/index.md to find relevant documentsReflections-First: Check /reflections/ BEFORE technical documentation
Documents are interconnected using Obsidian WikiLinks ([[Document Name]]). The skill uses Depth-First Search (DFS) to traverse these connections, ensuring comprehensive coverage of related knowledge.
Key Concepts:
See references/wikilink-traversal.md for complete details.
Documents use LLM-optimized frontmatter properties (type, status, complexity, relevance-to) for efficient filtering without reading full content.
Key Concepts:
related-concepts, related-components propertiessuperseded-by chains to find current docsSee references/frontmatter-retrieval.md for complete details.
For follow-up queries, reference previous lookup context so subagent can reuse cached data:
See references/optimization-techniques.md for details.
Include in subagent prompts:
Subagents return JSON with:
| Field | Description |
|---|---|
executive_summary | Key findings and recommended action |
reflection_insights | Past mistakes, proven approaches, workflow gotchas |
relevant_patterns | Technical patterns with gotchas |
related_concepts | Prerequisites and alternatives |
linked_concepts | Concepts discovered through WikiLink traversal |
best_practices | Reusable methodologies |
cross_references | Follow-up topics |
link_traversal | WikiLink traversal statistics |
metadata | Analysis depth, document counts, limitations |
See references/json-schemas.md for complete schema.
After presenting lookup results, if the synthesis is high-value (cross-cutting insight, novel connection, or actionable recommendation), offer to file it as a KB document:
executive_summary → Overview sectionrelevant_patterns → Patterns sectionbest_practices → Best Practices sectionreflection_insights → Lessons Learned sectionskills/kb-ingest/SKILL.md):
session-recap/references/search_cross_references.sh)source-type: synthesis, query: "{original query}", synthesized-from: [list of source doc paths]source skills/common/generate_index.sh && generate_index "$KB_PATH"
source skills/common/obsidian_helpers.sh && append_kb_log "$KB_PATH" "query-writeback" "kb-lookup" "Filed synthesis: [doc title]"
When NOT to write back: Simple lookups, single-document answers, or when the synthesis doesn't add value beyond what's already in the referenced docs.
After completing a lookup, the main agent SHOULD log the query to _meta/log.md for audit trail:
source skills/common/obsidian_helpers.sh
append_kb_log "$KB_PATH" "query" "kb-lookup" "[lookup-type] query for [topic] — [N] docs consulted"
This is lightweight (single line append) and enables the lint operation to track KB usage patterns.
| Practice | Rationale |
|---|---|
| Always check reflections first | Learn from past mistakes before technical docs |
| Use MOC-first navigation | 94% context reduction vs reading all documents |
| Specify JSON output format | Ensures structured, parseable responses |
| Include user context | Improves relevance of findings |
| Choose appropriate lookup type | Don't use Deep for simple queries |
| Integrate insights naturally | Present as main agent knowledge, not "I looked this up" |
CHANGELOG.md (opens in a new tab)README.md (opens in a new tab)VERSION (opens in a new tab)references/examples.md (opens in a new tab)references/frontmatter-retrieval.md (opens in a new tab)references/json-schemas.md (opens in a new tab)references/knowledge-bank-structure.md (opens in a new tab)references/optimization-techniques.md (opens in a new tab)references/session-documentation.md (opens in a new tab)references/templates.md (opens in a new tab)references/wikilink-traversal.md (opens in a new tab)scripts/find-related.sh (opens in a new tab)scripts/search-by-property.sh (opens in a new tab)scripts/test-wikilinks.sh (opens in a new tab)scripts/wikilink-utils.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Explore), in the backgroundOther plugins' skills for the same job
npx claudepluginhub sxhmilyoyo/sundayhao-plugins --plugin second-brain6 skills in this plugin
/kb-ingestIngest external sources into the knowledge bank through interactive study or quick filing. Two modes — Quick (summarize → file) and Study (theme-by-theme deep dive with online research and personal notes → multi-layer KB output → optional blog/slack synthesis). Triggers on "ingest this", "study this article", "add to knowledge bank", "learn from this", "process this article", "take notes on this", "what are the key takeaways", "break this down for me", or when user provides external reference material for long-term retention. Also use when user says "let's go through this", wants to deeply engage with a source document, or shares an article/gist/doc and asks about its content./kb-lintHealth-check the knowledge bank for orphan documents, stale content, broken WikiLinks, index drift, and missing frontmatter. Generates a severity-graded report. Use this skill whenever the user mentions lint, health check, KB maintenance, stale docs, broken links, orphan pages, missing references, knowledge bank quality, or hasn't run a check in a while. Also trigger when the user asks "what's not cross-referenced?", "are there any dead links?", or expresses concern about KB quality./session-managerSet the current session's name, project, tags, or summary on its session note. Use when the user names, tags, or summarizes this session, sets its project, or mentions in passing what this session has been about./session-recapDocument Claude Code sessions by extracting knowledge into cross-referenced documentation. Triggers on "recap the session", "summarize the work", or after significant code changes./wdymFrom-zero decode of this session's agent work for the person supervising it. Use when the person does not follow something the agent said or showed ('wdym', 'what do you mean'), wants it from zero ('like I have no context', 'from scratch'), asks what a word, step or output of this session means or why the agent did it that way, asks for proof ('how did you verify', 'prove it'), or says 'wdym debrief'. An explanation for an audience other than the person belongs to the eli5 skill; a pure visual request belongs to show-me.