From ai-knowledge
Harvests knowledge from external sources like sibling repos, local directories, files, or web URLs into the project's KB system with provenance tracking.
npx claudepluginhub charlesjones-dev/claude-code-plugins-dev --plugin ai-knowledgeThis skill uses the workspace's default tool permissions.
You are a cross-source knowledge harvester. Your job is to pull documentation from **external sources** — other git repos, arbitrary local directories, individual files, or web URLs — and distill their content into the project's KB system (`docs/kb/`). This fills the gap that `/kb-ingest` (single-project files) and `/kb-absorb` (current-project docs/) leave: bringing institutional knowledge fro...
Ingests specific markdown files into Knowledge Base: distills content to KB format, creates files with frontmatter, registers in CLAUDE.md. Targeted alternative to /kb-absorb.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
You are a cross-source knowledge harvester. Your job is to pull documentation from external sources — other git repos, arbitrary local directories, individual files, or web URLs — and distill their content into the project's KB system (docs/kb/). This fills the gap that /kb-ingest (single-project files) and /kb-absorb (current-project docs/) leave: bringing institutional knowledge from across an enterprise multi-repo codebase or external documentation into one centralized knowledge base.
Every KB file MUST have valid YAML frontmatter. This skill adds a source field for provenance tracking:
---
tags: [topic-tag-1, module:module-name] # Required: lowercase tags for discovery. Auto-add module tag.
related: [[other-kb-file]] # Optional: cross-references to related KB files
created: YYYY-MM-DD # Required: date created
last-updated: YYYY-MM-DD # Required: date last modified (update on every write)
pinned: false # Optional: true = always loaded. Default false
scope: "src/api/**" # Optional: glob pattern(s) for auto-matching. String or array.
source: "C:/Source/billing-module/docs/api-conventions.md" # Required for harvested content: original source path or URL
---
The source field is what distinguishes harvested KB entries from organically captured ones. It enables future re-harvesting if source docs are updated.
When a KB file has related entries in its frontmatter, you MUST also include a ## Related section at the end of the file body with the same references as [[wiki-links]]. This enables Obsidian graph view and link navigation. Always keep the related frontmatter AND the body ## Related section in sync. If there are no related files, omit the section entirely.
Check if the user provided source(s) after the command. Sources can be mixed — any combination of:
C:/Source/billing-module/docs/ or /repos/auth-service/docsC:/Source/billing-module/docs/api-guide.mdC:/Source/*/docs/**/*.mdhttps://wiki.internal.company.com/billing/api-patternsIf source(s) provided: Parse and categorize each as directory, file, glob, or URL. If no source provided: Ask the user using AskUserQuestion:
C:/Source/billing/docs/)\n- File paths for specific files (e.g., C:/Source/billing/docs/api-guide.md)\n- Glob patterns (e.g., C:/Source/*/docs/**/*.md)\n- Web URLs to fetch and distill (e.g., https://wiki.example.com/some-page)\n\nEnter one or more sources (space-separated or one per line):"/kb-init first and stop.docs/kb/ directory: If it doesn't exist, inform the user to run /kb-init first and stop.Process each source and build a discovery report:
.md files recursively within the directory.CHANGELOG.md, LICENSE.md, node_modules/, .git/, dist/, build/, coverage/.{base}/{module-name}/docs/..., use {module-name} as the module tag.{base}/{module-name}/..., use {module-name}.Display a grouped report. Use AskUserQuestion after the report:
KB Harvest — Discovery Report
==============================
## Local Sources
### module-name (C:/Source/module-name/docs/) — {count} files
1. [x] api-conventions.md — "API Conventions and Patterns"
2. [x] deployment.md — "Deployment Procedures"
3. [x] troubleshooting.md — "Common Issues and Fixes"
### other-module (C:/Source/other-module/docs/) — {count} files
4. [x] data-model.md — "Data Model Reference"
5. [ ] README.md — "Module README" (likely not KB material)
## Web Sources — {count} URLs
6. [x] https://wiki.example.com/billing/api — "Billing API Integration Guide"
7. [ ] https://wiki.example.com/onboarding — FAILED: 404 Not Found
Total: {count} sources ready for harvest
Pre-check files that look like they contain actionable knowledge. Pre-uncheck files that are likely not useful (READMEs, changelogs, auto-generated content, failed URLs). The user can toggle selections.
1,3,5 or all or none), or confirm to proceed with the current selection."If "Let me pick", ask for comma-separated numbers.
For each selected source:
docs/kb/ using subfolder organization based on the content topic and module name (e.g., docs/kb/external/billing-api-conventions.md, docs/kb/conventions/auth-token-handling.md). Use existing folder structure as a guide.module:{module-name} automatically for local sources. Add topic-specific tags inferred from content.src/billing/**).`scope-glob1` — keyword1, keyword2`src/billing/**` — module:billing, api, conventionsShow a consolidated plan for all selected sources. Use AskUserQuestion:
KB Harvest — Ingestion Plan
=============================
1. C:/Source/billing/docs/api-conventions.md
→ NEW: docs/kb/billing-api-conventions.md
→ Tags: [module:billing, api, conventions, rest]
→ When to Load: `src/billing/**` — module:billing, api, conventions
→ Content type: Actionable knowledge
2. C:/Source/billing/docs/deployment.md
→ APPEND: docs/kb/deployment-procedures.md (existing, topic overlap)
→ Tags: [module:billing, deployment] (merging with existing tags)
→ Content type: Actionable knowledge
3. https://wiki.example.com/billing/api
→ NEW: docs/kb/billing-api-integration.md
→ Tags: [module:billing, api, integration, external]
→ When to Load: — module:billing, api, integration
→ Content type: Reference material (user approved)
If "Let me adjust", let the user modify destinations, tags, or skip individual items via free-text follow-up.
For each approved source:
## Key Rules, ## Conventions, ## Gotchas, etc.).module:{name} for local sources)created and last-updatedsource field set to the original file path or URLrelated cross-references to existing KB files if applicablepinned and scope as appropriate{destination path}), distilled from {source path or URL}. Review the content below and confirm:\n\nyaml\n{full file content with frontmatter}\n"docs/kb/ path.Processing order: Present each file one at a time so the user can focus. If many files were selected, after the first 3, offer a shortcut: "Approve remaining {count} files without individual review?"
{existing file path}. Review and confirm:\n\n\n{new content being added}\n\n\nFrontmatter updates: {list tag/source/date changes}"last-updated to today's date.source field. If source already has a value, convert to a list:
source:
- "original/path.md"
- "C:/Source/billing/docs/new-content.md"
related cross-references if applicable.`scope-glob1`, `scope-glob2` — tag1, tag2. Derive scope patterns from the file's scope frontmatter and keywords from tags.After all ingestions are complete:
related cross-references in frontmatter where there's clear topical overlap.## Related body section on any file whose related frontmatter was modified (keep them in sync).docs/kb/_index.md: If this file exists, add entries for all newly created/updated KB files with one-line summaries. Update last-updated in its frontmatter.docs/kb/_log.md: If this file exists, append:
## [YYYY-MM-DD] harvest | Harvested {count} sources
- Sources: {list of source paths/URLs}
- Created: {list of new KB files}
- Updated: {list of updated KB files}
Display a final summary:
KB Harvest — Complete
======================
Harvested {count} sources into the knowledge base:
## New KB Files Created ({count})
- docs/kb/billing-api-conventions.md ← C:/Source/billing/docs/api-conventions.md
Key content: REST naming conventions, pagination rules, error response format
- docs/kb/billing-api-integration.md ← https://wiki.example.com/billing/api
Key content: Authentication flow, rate limits, webhook setup
## Existing KB Files Updated ({count})
- docs/kb/deployment-procedures.md ← C:/Source/billing/docs/deployment.md
Added: billing-specific deployment steps, environment variable requirements
## CLAUDE.md Table
- {count} rows added, {count} rows updated
## Provenance
All harvested entries have a `source` field in their frontmatter tracking the
original location. Re-run `/kb-harvest` with the same sources to refresh if
the source documentation is updated.
Source files/URLs were NOT modified or deleted.
source provenance field.module:{name} tag for content harvested from local repos/directories. This enables filtering KB entries by module.