Skip to content

Commit 3af56ba

Browse files
feat(ai-knowledge): add knowledge base management plugin (v2.3.0)
New plugin with 10 skills for capturing and organizing institutional knowledge from Claude Code conversations into topic-specific KB files with YAML frontmatter, cross-references, tags, and pinned entries. Skills: /kb-init, /kb-learn, /kb-add, /kb-import, /kb-absorb, /kb-remove, /kb-list, /kb-search, /kb-prune, /kb-auto
1 parent ebeb8ee commit 3af56ba

16 files changed

Lines changed: 1302 additions & 2 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"metadata": {
88
"description": "A curated list of custom Claude Code plugins, agents, and skills for developers.",
9-
"version": "2.2.2",
9+
"version": "2.3.0",
1010
"pluginRoot": "./plugins"
1111
},
1212
"plugins": [
@@ -268,6 +268,29 @@
268268
"url": "https://charlesjones.dev"
269269
},
270270
"repository": "https://github.com/charlesjones-dev/claude-code-plugins-dev"
271+
},
272+
{
273+
"name": "ai-knowledge",
274+
"source": "./plugins/ai-knowledge",
275+
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, and dynamically reference institutional knowledge in CLAUDE.md",
276+
"version": "1.0.0",
277+
"keywords": [
278+
"ai",
279+
"knowledge-base",
280+
"learnings",
281+
"institutional-knowledge",
282+
"claude-md",
283+
"documentation",
284+
"best-practices",
285+
"lessons-learned",
286+
"kb",
287+
"productivity"
288+
],
289+
"author": {
290+
"name": "Charles Jones",
291+
"url": "https://charlesjones.dev"
292+
},
293+
"repository": "https://github.com/charlesjones-dev/claude-code-plugins-dev"
271294
}
272295
]
273296
}

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.3.0] - 2026-04-02
11+
12+
### Added
13+
14+
#### AI-Knowledge Plugin (v1.0.0) - NEW PLUGIN
15+
16+
- **New plugin for knowledge base management** - Capture conversation learnings, maintain topic-specific KB files, and dynamically reference institutional knowledge in CLAUDE.md
17+
- `/kb-init` - Initialize the Knowledge Base section in CLAUDE.md and create `docs/kb/` directory (idempotent)
18+
- `/kb-learn` - Analyze conversation to extract learnings, best practices, and institutional knowledge into KB files
19+
- `/kb-add` - Quickly add a learning or rule to the KB with interactive location picker
20+
- `/kb-import` - Register existing KB files in CLAUDE.md (accepts file path or scans for unregistered files, adds missing frontmatter)
21+
- `/kb-list` - List all registered KB files with status, tags, dates, pinned status, and cross-references
22+
- `/kb-search` - Search across KB files by keyword, topic, or tag (`tag:security`)
23+
- `/kb-prune` - Interactive cleanup: stale refs, duplicates, merges, frontmatter health, cross-reference integrity
24+
- `/kb-auto` - Toggle automatic knowledge capture at end of conversations (per-project)
25+
- `/kb-absorb` - Migrate existing CLAUDE.md sections and docs/ content into the KB system with interactive approval
26+
- `/kb-remove` - Remove a KB file and its CLAUDE.md reference (accepts optional path or interactive selection)
27+
- All KB files use YAML frontmatter with `tags`, `related`, `created`, `last-updated`, `pinned`, and `scope` fields
28+
- Cross-references between KB files via `related: [[other-file]]` frontmatter for linked knowledge loading
29+
- Pinned KB files (`pinned: true`) are always loaded regardless of work context
30+
1031
## [2.2.2] - 2026-03-31
1132

1233
### Fixed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Claude Code Plugins for Developers
22

3-
[![Version](https://img.shields.io/badge/version-2.2.2-blue.svg)](https://github.com/charlesjones-dev/claude-code-plugins-dev/releases)
3+
[![Version](https://img.shields.io/badge/version-2.3.0-blue.svg)](https://github.com/charlesjones-dev/claude-code-plugins-dev/releases)
44
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
55
[![GitHub Issues](https://img.shields.io/github/issues/charlesjones-dev/claude-code-plugins-dev.svg)](https://github.com/charlesjones-dev/claude-code-plugins-dev/issues)
66
[![GitHub Stars](https://img.shields.io/github/stars/charlesjones-dev/claude-code-plugins-dev.svg)](https://github.com/charlesjones-dev/claude-code-plugins-dev/stargazers)
@@ -27,6 +27,7 @@ This Claude Code plugin marketplace provides plugins that extend Claude Code's c
2727
| [ai-statusline](plugins/ai-statusline/) | AI-powered status line customization with progress bars | `/statusline-wizard`, `/statusline-edit` | - |
2828
| [ai-workflow](plugins/ai-workflow/) | AI-powered development workflow automation | `/workflow-plan-phases`, `/workflow-implement-phases`, `/workflow-preflight`, `/workflow-ship`, `/workflow-principles` | - |
2929
| [ai-compliance](plugins/ai-compliance/) | AI-powered license compliance auditing and attribution generation | `/compliance-license-audit`, `/compliance-notice-generate` | - |
30+
| [ai-knowledge](plugins/ai-knowledge/) | AI-powered knowledge base management for conversation learnings | `/kb-init`, `/kb-learn`, `/kb-add`, `/kb-import`, `/kb-absorb`, `/kb-remove`, `/kb-list`, `/kb-search`, `/kb-prune`, `/kb-auto` | - |
3031
| [ai-modernize](plugins/ai-modernize/) | AI-powered codebase modernization assessment for technical debt | `/modernize-audit`, `/modernize-scan` | `modernize-auditor` |
3132
| [ai-writing](plugins/ai-writing/) | AI-powered writing quality tools for natural-sounding text | `/writing-humanize` | - |
3233

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "ai-knowledge",
3+
"version": "1.0.0",
4+
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, and dynamically reference institutional knowledge in CLAUDE.md",
5+
"author": {
6+
"name": "Charles Jones",
7+
"url": "https://charlesjones.dev"
8+
},
9+
"repository": "https://github.com/charlesjones-dev/claude-code-plugins-dev",
10+
"license": "MIT",
11+
"keywords": [
12+
"knowledge-base",
13+
"learnings",
14+
"institutional-knowledge",
15+
"claude-md",
16+
"documentation",
17+
"best-practices",
18+
"lessons-learned",
19+
"kb",
20+
"productivity"
21+
]
22+
}

plugins/ai-knowledge/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Charles Jones
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

plugins/ai-knowledge/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# AI Knowledge Plugin
2+
3+
AI-powered knowledge base management for Claude Code. Capture conversation learnings, maintain topic-specific KB files, and dynamically reference institutional knowledge in CLAUDE.md.
4+
5+
## Overview
6+
7+
Over time, you accumulate project-specific knowledge during Claude Code conversations: things that didn't work, best practices, client requirements, and codebase gotchas. This plugin captures that knowledge so future sessions benefit from it automatically.
8+
9+
Knowledge is stored in two layers:
10+
- **KB files** (`docs/kb/*.md`): Topic-specific knowledge loaded contextually when working in relevant areas
11+
- **Global Learnings** (in CLAUDE.md): Cross-cutting rules that apply everywhere
12+
13+
## Commands
14+
15+
| Command | Description |
16+
|---------|-------------|
17+
| `/kb-init` | Initialize the KB section in CLAUDE.md and create `docs/kb/` directory |
18+
| `/kb-learn` | Analyze the current conversation and extract learnings to KB files |
19+
| `/kb-add` | Quickly add a learning or rule with interactive location picker |
20+
| `/kb-import` | Register existing KB files in CLAUDE.md (adds missing frontmatter) |
21+
| `/kb-absorb` | Migrate existing CLAUDE.md sections and docs/ content into the KB |
22+
| `/kb-remove` | Remove a KB file and its CLAUDE.md reference |
23+
| `/kb-list` | List all registered KB files with status, tags, dates, and cross-references |
24+
| `/kb-search` | Search across KB files by keyword, topic, or tag (`tag:security`) |
25+
| `/kb-prune` | Interactive cleanup: stale refs, duplicates, merges, frontmatter health |
26+
| `/kb-auto` | Toggle automatic knowledge capture at end of conversations |
27+
28+
## Getting Started
29+
30+
1. Run `/kb-init` in your project to set up the Knowledge Base section in CLAUDE.md and create the `docs/kb/` directory.
31+
32+
2. If you have existing documentation in CLAUDE.md or `docs/`, run `/kb-absorb` to organize it into the KB.
33+
34+
3. Optionally run `/kb-auto` to enable automatic learning capture -- Claude will offer to save learnings when conversations wrap up.
35+
36+
4. At the end of productive conversations, run `/kb-learn` to capture learnings (or let auto-capture prompt you).
37+
38+
5. Use `/kb-add` to quickly save a one-off rule or note without full conversation analysis.
39+
40+
6. Periodically run `/kb-prune` to keep the knowledge base organized.
41+
42+
## How It Works
43+
44+
The Knowledge Base table in CLAUDE.md tells Claude Code which KB files to read based on what you're working on:
45+
46+
```markdown
47+
## Knowledge Base
48+
49+
| Topic | File | When to Load |
50+
|-------|------|--------------|
51+
| API Conventions | docs/kb/api-conventions.md | When working in packages/api/ |
52+
| Auth Rules | docs/kb/auth.md | Always (pinned) |
53+
| React Patterns | docs/kb/frontend/react-patterns.md | When working in packages/web/ |
54+
```
55+
56+
When Claude Code starts a conversation and reads CLAUDE.md, it knows to load the relevant KB files based on the task context. Pinned files are always loaded.
57+
58+
## KB File Frontmatter
59+
60+
Every KB file uses YAML frontmatter for metadata, search, and cross-referencing:
61+
62+
```yaml
63+
---
64+
tags: [api, auth, security] # Cross-cutting topic tags for discovery
65+
related: [[api-conventions]] # Cross-references to other KB files
66+
created: 2026-04-02 # Date the file was created
67+
last-updated: 2026-04-02 # Date the file was last modified
68+
pinned: false # If true, always loaded regardless of context
69+
scope: "packages/api/**" # Optional glob pattern for auto-matching
70+
---
71+
```
72+
73+
Cross-references (`related`) create a knowledge graph -- when Claude loads one KB file and sees related references, it knows to also consult the linked files for full context.
74+
75+
## Plugin Details
76+
77+
- **Version**: 1.0.0
78+
- **Author**: [Charles Jones](https://charlesjones.dev)
79+
- **License**: MIT
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
name: kb-absorb
3+
description: "Analyze existing CLAUDE.md and docs/ content to identify knowledge that can be organized into the KB system. Interactive migration with user approval."
4+
disable-model-invocation: true
5+
---
6+
7+
# Knowledge Base Absorb
8+
9+
You are a knowledge base migration specialist. Your job is to analyze a project's existing documentation — CLAUDE.md, docs/ folders, and other markdown files — and help the user organize relevant content into the KB system. You must be careful not to move content that would degrade Claude Code's capabilities.
10+
11+
## Instructions
12+
13+
**CRITICAL**: This command MUST NOT accept any arguments. Ignore any text provided after the command.
14+
15+
### Phase 1: Discovery
16+
17+
Scan the project for existing documentation sources:
18+
19+
#### 1a: Analyze CLAUDE.md
20+
21+
1. Read the project's `CLAUDE.md` file.
22+
2. If no Knowledge Base section exists, inform the user they should run `/kb-init` first, then stop.
23+
3. Parse CLAUDE.md into logical sections. For each section, classify it as:
24+
- **CORE** — Essential for Claude Code's baseline behavior (e.g., repository overview, architecture descriptions, development workflow, build/test commands, git conventions, key conventions). These MUST stay in CLAUDE.md.
25+
- **KB-CANDIDATE** — Topic-specific knowledge that could live in a KB file and be loaded contextually (e.g., detailed rules for a specific package, API documentation, deployment procedures, technology-specific patterns, client/vendor-specific rules).
26+
- **REDUNDANT** — Content that duplicates what's already in KB files or is outdated.
27+
28+
**CRITICAL**: Err on the side of keeping content in CLAUDE.md. Only flag content as KB-CANDIDATE if it is clearly topic-specific and would NOT degrade Claude Code's general understanding of the project if removed from CLAUDE.md. When in doubt, classify as CORE.
29+
30+
#### 1b: Scan docs/ Directory
31+
32+
1. Glob for all `.md` files under `docs/` (excluding `docs/kb/` which is already the KB).
33+
2. For each file found, read it and classify as:
34+
- **KB-CANDIDATE** — Contains rules, conventions, guides, or institutional knowledge that Claude Code should know about when working in a specific context.
35+
- **REFERENCE-ONLY** — Human-facing documentation (tutorials, onboarding guides, API references) that doesn't need to be in the KB but could be referenced.
36+
- **SKIP** — Build artifacts, auto-generated docs, or content not relevant to the KB.
37+
38+
#### 1c: Scan for Other Documentation
39+
40+
Check for documentation in common locations:
41+
- `*.md` files in the project root (besides CLAUDE.md and README.md)
42+
- `.github/` directory (CONTRIBUTING.md, pull request templates, issue templates)
43+
- `CONTRIBUTING.md`, `ARCHITECTURE.md`, `DECISIONS.md`, `ADR/` (Architecture Decision Records)
44+
45+
Classify each the same way as in 1b.
46+
47+
### Phase 2: Present Findings
48+
49+
Display a comprehensive report organized by source:
50+
51+
```
52+
Documentation Analysis
53+
======================
54+
55+
## CLAUDE.md Sections
56+
57+
### Can be moved to KB ({count})
58+
These sections are topic-specific and could be loaded contextually:
59+
60+
1. "{Section heading}" (lines {start}-{end})
61+
→ Suggested KB file: docs/kb/{suggested-path}.md
62+
→ When to load: {context}
63+
Reason: {why this is topic-specific, not core}
64+
65+
### Should stay in CLAUDE.md ({count})
66+
These sections are essential for Claude Code's baseline understanding:
67+
- "{Section heading}" — {brief reason}
68+
69+
### Possibly redundant ({count})
70+
- "{Section heading}" — {why it might be redundant}
71+
72+
## docs/ Files ({count} found)
73+
74+
### Can be absorbed into KB ({count})
75+
1. docs/guides/api-guide.md
76+
→ Suggested KB file: docs/kb/api-guide.md
77+
→ When to load: {context}
78+
79+
### Reference only ({count})
80+
- docs/onboarding.md — Human-facing, not needed in KB
81+
82+
### Skipped ({count})
83+
- docs/auto-generated/ — Auto-generated content
84+
85+
## Other Documentation ({count} found)
86+
{Similar breakdown}
87+
```
88+
89+
### Phase 3: User Approval
90+
91+
Present the migration plan and ask for approval. Use AskUserQuestion:
92+
93+
- Question: "Here's what I found. How would you like to proceed?"
94+
- Options: "Migrate all candidates" | "Let me review each one" | "Cancel"
95+
- Header: "KB Absorb Plan"
96+
97+
If "Let me review each one", present each candidate individually:
98+
- Show the content that would be moved/absorbed
99+
- Show the suggested KB file destination
100+
- Options: "Move to KB" | "Keep where it is" | "Different location" | "Skip"
101+
102+
For CLAUDE.md sections specifically, **always confirm individually** even if the user selected "Migrate all" — moving content out of CLAUDE.md is high-impact and warrants per-section approval.
103+
104+
### Phase 4: Execute Migration
105+
106+
For each approved migration:
107+
108+
#### 4a: Moving CLAUDE.md Sections to KB
109+
110+
1. Create the KB file with proper frontmatter:
111+
```yaml
112+
---
113+
tags: [{inferred tags}]
114+
related: [{cross-references to related KB files if any}]
115+
created: {today's date}
116+
last-updated: {today's date}
117+
pinned: false
118+
scope: "{glob pattern if applicable}"
119+
---
120+
```
121+
2. Write the content, reformatted for KB style (concise, imperative, actionable rules).
122+
3. **Do NOT simply copy-paste** — distill the content into KB format. Long prose should become concise rules. Remove filler and context that only matters for human reading.
123+
4. Add a reference row to the CLAUDE.md Knowledge Base table.
124+
5. Remove the section from CLAUDE.md.
125+
6. If the removed section contained anything cross-cutting, add a brief reference in its place: `> See docs/kb/{file}.md for {topic} details.`
126+
127+
#### 4b: Absorbing docs/ Files
128+
129+
1. If the file is already well-structured, move it to `docs/kb/` and add frontmatter.
130+
2. If the file needs reformatting, create a new KB file with distilled content. Do NOT delete the original — inform the user they can remove it manually if desired.
131+
3. Add a reference row to the CLAUDE.md Knowledge Base table.
132+
133+
#### 4c: Cross-References
134+
135+
After all migrations, scan the newly created KB files for related topics and add `related` cross-references in frontmatter where appropriate.
136+
137+
### Phase 5: Confirmation
138+
139+
Display a summary:
140+
- Sections moved from CLAUDE.md to KB files
141+
- docs/ files absorbed into KB
142+
- New KB files created
143+
- CLAUDE.md table entries added
144+
- Estimated token savings in CLAUDE.md (rough line count reduction)
145+
- Reminder: "Review the changes and verify Claude Code still has the context it needs. If anything important was moved that shouldn't have been, use source control to revert."

0 commit comments

Comments
 (0)