From second-brain
Delegates knowledge bank lookups to Explore subagents with reflections-first strategy, checking /reflections/ before docs to avoid past mistakes and return structured actionable insights. Auto-triggers on service mentions or investigation requests.
npx claudepluginhub sxhmilyoyo/sundayhao-plugins --plugin second-brainThis skill uses the workspace's default tool permissions.
Latest: v2.4.0 - Structure refactoring with improved clarity and terminology. See [CHANGELOG.md](CHANGELOG.md) for details.
CHANGELOG.mdREADME.mdVERSIONreferences/examples.mdreferences/frontmatter-retrieval.mdreferences/json-schemas.mdreferences/knowledge-bank-structure.mdreferences/optimization-techniques.mdreferences/session-documentation.mdreferences/templates.mdreferences/wikilink-traversal.mdscripts/find-related.shscripts/search-by-property.shscripts/test-wikilinks.shscripts/wikilink-utils.shQueries 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.
Captures insights as markdown files, searches prior learnings, and promotes patterns to CLAUDE.md using tiered backends (local, qmd, agent-fs) for knowledge across projects.
Share bugs, ideas, or general feedback.
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" |