{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-other-knowledge-base-search-dfb5e4e3ef3d","title":"Knowledge Base Search for Local Content Verification","summary":"Search a local knowledge base to find verifiable content and return exact source locations with citations (file path + page\/paragraph\/section) for audit, compliance, or review.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-knowledge-base-search-dfb5e4e3ef3d","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-knowledge-base-search-dfb5e4e3ef3d","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-knowledge-base-search-dfb5e4e3ef3d.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-knowledge-base-search-dfb5e4e3ef3d\/download","category":{"slug":"content-editorial","name":"Content & Editorial"},"editor_note":"Ensure the knowledge base root path is set to `.\/kb\/` and that index files (filename, content, vector, or PageIndex) are available for search. If indices are missing or corrupted, fall back to direct file scanning and report the need for re-indexing.","instructions":"---\nname: knowledge-base-search\ndescription: Search and locate relevant content within a local knowledge base (files, indices, or PageIndex). Use when you need verifiable citations (file + page\/paragraph) to support answers from local sources.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# Knowledge Base Search\n\n## When to Use\n- You need to find specific facts, definitions, or procedures from a local knowledge base and return the exact source location.\n- You must provide traceable citations (file path + page\/paragraph\/section) for audit, compliance, or review.\n- You need to verify the original wording of a claim in the source document (quote-level validation).\n- You want to compare how multiple local documents discuss the same topic and identify differences.\n- You need to assemble supporting snippets for a report, FAQ, or internal knowledge response using only local materials.\n\n## Key Features\n- Supports multiple retrieval approaches: direct file search, index-based search, and PageIndex-style location mapping.\n- Query strategy guidance: keyword splitting, synonym expansion, and optional filters (time range, file type, tags).\n- Relevance-oriented result ranking and filtering to keep the most supportive evidence first.\n- Outputs verifiable hit snippets with precise citation locations (file + page\/paragraph\/section when available).\n- Enforces local-only boundaries: searches only within authorized directories and does not modify source content.\n\n## Dependencies\n- `glob` (>= 10.0.0): file path pattern matching\n- `grep` (>= 3.11): in-file text searching\n- Local knowledge base index files (one or more of: filename index, content index, vector index, PageIndex mapping)\n- `assets\/hit_list_template.csv`: standardized hit list output template\n- Optional reference: `references\/guide.md` (output formats, checklists, inspection points)\n\n## Example Usage\nThe following example demonstrates an end-to-end local search workflow and produces a CSV hit list compatible with `assets\/hit_list_template.csv`.\n\n### Inputs\n- Knowledge base root: `.\/kb\/`\n- Query: `How do we rotate API keys?`\n- Filters: file types `md,pdf`, time range `2024-01-01..2026-12-31`\n\n### Steps\n1. **Confirm index and scope**\n   - Ensure the search scope is limited to authorized paths (e.g., `.\/kb\/`).\n   - Identify available indices:\n     - filename\/content index (fast keyword search)\n     - vector index (semantic retrieval)\n     - PageIndex mapping (page\/paragraph location resolution)\n\n2. **Build the query**\n   - Keywords: `rotate`, `API key`, `key rotation`\n   - Synonyms\/variants: `credential rotation`, `token rotation`, `regenerate key`\n   - Filters:\n     - file type: `*.md`, `*.pdf`\n     - time range: `2024-01-01..2026-12-31` (if metadata exists)\n\n3. **Execute search (local-only)**\n   - Path discovery (example):\n     - `glob(\".\/kb\/**\/*.md\")`\n     - `glob(\".\/kb\/**\/*.pdf\")`\n   - Content search (example):\n     - `grep -RIn \"API key\\|key rotation\\|rotate\" .\/kb\/`\n\n4. **Filter and rank results**\n   - Keep hits that directly answer the question (procedure, policy, steps, constraints).\n   - Rank by:\n     - term proximity (e.g., \u201crotate\u201d near \u201cAPI key\u201d)\n     - section relevance (e.g., \u201cSecurity\u201d, \u201cCredentials\u201d, \u201cOperations\u201d)\n     - coverage (hits that include prerequisites + steps + verification)\n\n5. **Output citations and hit list**\n   - For each hit, output:\n     - `file_path`\n     - `location` (page number for PDFs; heading\/paragraph index for Markdown; PageIndex if available)\n     - `snippet` (verbatim excerpt supporting the conclusion)\n     - `notes` (why it is relevant; any assumptions)\n   - Save as `hit_list.csv` using `assets\/hit_list_template.csv` columns.\n\n### Example Output (CSV rows)\n```csv\nfile_path,location,snippet,relevance_score,notes\nkb\/security\/credential_policy.pdf,page 12,\"API keys must be rotated every 90 days... Rotation requires...\",0.92,\"Direct policy + rotation interval + procedure reference.\"\nkb\/runbooks\/api_key_rotation.md,section 'Procedure' \u00b63,\"To rotate an API key: (1) create a new key... (2) update services... (3) revoke old key...\",0.89,\"Step-by-step operational runbook.\"\nkb\/audit\/controls.md,heading 'Key Management' \u00b62,\"Evidence of rotation includes change tickets and key revocation logs...\",0.81,\"Provides verification\/evidence requirements.\"\n```\n\n## Implementation Details\n### Retrieval Workflow\n1. **Index confirmation**\n   - Determine knowledge base root paths and last update time (if available).\n   - Detect which indices exist:\n     - filename index: quick narrowing by file names\n     - content index: inverted index \/ grep-like scanning\n     - vector index: semantic similarity retrieval\n     - PageIndex: mapping from document offsets to page\/paragraph identifiers\n\n2. **Query strategy**\n   - Tokenize the question into:\n     - core entities (e.g., \u201cAPI key\u201d)\n     - actions (e.g., \u201crotate\u201d, \u201crevoke\u201d, \u201cregenerate\u201d)\n     - constraints (e.g., \u201cevery 90 days\u201d, \u201capproval required\u201d)\n   - Expand with synonyms and variants.\n   - Apply filters when metadata exists:\n     - time range\n     - file type\n     - tags\/collections\n\n3. **Result filtering and ranking**\n   - Remove low-signal hits (navigation, boilerplate, unrelated mentions).\n   - Rank by a weighted score (example):\n     - **Keyword match** (exact phrase > partial): 0.45\n     - **Proximity** (terms close together): 0.20\n     - **Section importance** (titles like \u201cProcedure\/Policy\u201d): 0.20\n     - **Coverage** (answers include steps + constraints + verification): 0.15\n   - Keep the original text snippet verbatim for verification.\n\n4. **Citation and location resolution**\n   - Markdown\/text:\n     - use heading + paragraph index (or line range) as the primary locator\n   - PDF:\n     - use page number; optionally include bounding text around the hit\n   - PageIndex (if present):\n     - map internal offsets to stable `page\/paragraph` identifiers\n\n### Constraints and Limitations\n- Search only within user-authorized local directories.\n- Do not modify source documents.\n- Do not execute scripts or arbitrary code.\n- Do not access network resources or external APIs.\n- If indices are missing\/corrupted, fall back to direct file scanning; if scanning is not possible, report the limitation and required remediation (re-indexing).","use_cases":["Find specific facts or procedures from a local knowledge base.","Provide traceable citations for audit or compliance purposes.","Verify the exact wording of a claim in the source document.","Compare how multiple documents discuss the same topic.","Assemble supporting snippets for a report, FAQ, or internal knowledge response using only local materials."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Other\/knowledge-base-search\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-26","created_at":"2026-11-24T15:09:41.000000Z","updated_at":"2026-11-26T09:25:02.000000Z","seo_title":"Knowledge Base Search for Local Content Verification","seo_description":"Find verifiable content in a local knowledge base with citations for audit and compliance.","seo_keywords":["local knowledge base search","verifiable content citation","audit compliant search","document verification tool","source citation retrieval"]}}