Find Knowledge
Purpose
Quickly locate relevant documentation, playbooks, skills, or templates within the knowledge base. Essential for answering questions, avoiding duplicate content, and building on existing knowledge.
Inputs
- •
query(required): Search terms or question - •
category(optional): Limit search to specific folder (e.g.,sales,seo,skills) - •
content_type(optional): Filter by type (playbook,skill,doc,template) - •
max_results(optional): Maximum number of results (default: 5)
Procedure
1. Prepare Search
Navigate to the KB root:
bash
cd /path/to/GTSE-AI-HUB/docs
2. Build Search Scope
Determine search path based on inputs:
- •If
categoryspecified:docs/{category}/ - •If
content_typeisskill:docs/skills/ - •If
content_typeisplaybook:docs/playbooks/or search for*playbook* - •If
content_typeistemplate:docs/templates/ - •Otherwise:
docs/
3. Execute Search
Primary search using grep (case-insensitive, with context):
bash
grep -rnil --include="*.md" "{query}" {search_path} | head -{max_results}
For multi-word queries, search each term:
bash
grep -rnil --include="*.md" -e "term1" -e "term2" {search_path}
4. Get Context for Each Match
For each matching file, extract relevant excerpt:
bash
grep -B2 -A5 -i "{query}" {file_path}
5. Extract Metadata
For each result, parse frontmatter:
bash
head -20 {file_path} | grep -E "^(title|description|parent|tags):"
6. Rank Results
Prioritize by:
- •Title matches (highest)
- •Frontmatter/description matches
- •Heading matches (## or ###)
- •Body content matches (lowest)
7. Format Output
Compile results into structured response.
Example
Query: "How do we handle customer complaints?"
Search execution:
bash
grep -rnil --include="*.md" -e "complaint" -e "customer" docs/
Output:
code
## Search Results for "customer complaints" ### 1. Customer Complaint Handling **File:** `docs/skills/handle-complaint/SKILL.md` **Type:** Skill **Excerpt:** > ## Purpose > To resolve customer complaints efficiently while maintaining brand reputation... ### 2. Customer Service Scripts **File:** `docs/customer-service/scripts.md` **Type:** Doc **Excerpt:** > ### Handling Complaints > 1. Acknowledge the issue > 2. Apologize sincerely... ### 3. Returns & RMA Process **File:** `docs/operations/returns-rma.md` **Type:** Doc **Excerpt:** > When a customer is unhappy with their order... --- *Found 3 relevant documents*
Output Format
markdown
## Search Results for "{query}"
### {n}. {title}
**File:** `{relative_path}`
**Type:** {content_type}
**Tags:** {tags if available}
**Excerpt:**
> {2-5 lines of relevant content}
---
*Found {count} relevant documents*
Advanced Search Patterns
Find all playbooks
bash
find docs -name "*playbook*" -o -path "*/playbooks/*"
Find skills by tag
bash
grep -rl "tags:.*\[.*{tag}.*\]" docs/skills/
Find recently modified
bash
find docs -name "*.md" -mtime -7 -type f
Find incomplete docs (TODO markers)
bash
grep -rn "TODO\|FIXME\|WIP\|TBD" docs/
Find by author
bash
grep -rl "authors:.*{name}" docs/
No Results Handling
If no results found:
- •Suggest related categories to explore
- •Recommend creating new content via
update-kbskill - •Offer to search with broader terms
Tips
- •Use specific terms over generic ones
- •Check both singular and plural forms
- •Search for acronyms AND full terms (e.g., "PPC" and "pay per click")
- •Look in
skills/for "how to" questions - •Look in
playbooks/for process questions