Skip to content

Commit e715b44

Browse files
feat(ai-knowledge): structured dynamic context loading, /kb-upgrade, /kb-load (v1.4.0)
Fix dynamic KB loading by replacing vague "When to Load" free-text with structured scope-glob + keyword format for efficient pattern matching. - Standardize "When to Load" column: `src/api/**` — api, rest, middleware - Support scope arrays in frontmatter for multi-pattern matching - Rewrite CLAUDE.md preamble with 4-point matching instructions - Add loading notifications (📖 Loading KB: filename.md) - Add Scope column to _index.md All Pages table - Add /kb-upgrade: comprehensive KB upgrade replacing /kb-obsidian - Add /kb-load: manually load KB articles mid-conversation - Add "When to Load" refresh to /kb-organize - Remove /kb-obsidian (absorbed into /kb-upgrade) - Update all 10 table-writing skills with structured format instructions
1 parent b4349a9 commit e715b44

20 files changed

Lines changed: 710 additions & 411 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 3 additions & 3 deletions
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.3.3",
9+
"version": "2.3.4",
1010
"pluginRoot": "./plugins"
1111
},
1212
"plugins": [
@@ -272,8 +272,8 @@
272272
{
273273
"name": "ai-knowledge",
274274
"source": "./plugins/ai-knowledge",
275-
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, Obsidian-compatible knowledge graph, harvest cross-repo and web documentation, discover implicit knowledge from source code, and dynamically reference institutional knowledge in CLAUDE.md",
276-
"version": "1.3.0",
275+
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, Obsidian-compatible knowledge graph, structured dynamic context loading, harvest cross-repo and web documentation, discover implicit knowledge from source code, and institutional knowledge in CLAUDE.md",
276+
"version": "1.4.0",
277277
"keywords": [
278278
"ai",
279279
"knowledge-base",

CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [2.3.4] - 2026-04-06
11+
12+
### Added
13+
14+
#### AI-Knowledge Plugin (v1.4.0)
15+
16+
- `/kb-upgrade` - Comprehensive KB upgrade command (replaces `/kb-obsidian`)
17+
- Absorbs all `/kb-obsidian` functionality (Related body links, global learnings migration, index/log creation, folder reorganization)
18+
- Standardizes "When to Load" column from vague free-text to structured `scope-globs — keywords` format for efficient dynamic context loading
19+
- Updates CLAUDE.md preamble with explicit 4-point matching instructions (pinned, scope patterns, keywords, _index.md fallback)
20+
- Adds loading notification directive — Claude now tells users when loading KB files (e.g., `📖 Loading KB: api-conventions.md`)
21+
- Adds Scope column to `_index.md` All Pages table for routing context
22+
- Suggests scope patterns for KB files with empty/missing scope
23+
- Re-runnable and idempotent — safe to run after plugin updates or any time to verify KB health
24+
25+
- `/kb-load` - Manually load KB articles into the current conversation
26+
- Accepts filename, topic name, or tag filter (e.g., `/kb-load api-conventions`, `/kb-load tag:testing`)
27+
- Interactive picker when no argument provided
28+
- Offers to follow `related` cross-references one level deep
29+
- Displays `📖 Loading KB:` notifications consistent with automatic loading
30+
- Use when Claude hasn't automatically loaded a KB file you need mid-conversation
31+
32+
### Changed
33+
34+
#### AI-Knowledge Plugin (v1.4.0)
35+
36+
- **Structured "When to Load" format** — All KB commands now generate structured loading criteria: backtick-wrapped scope globs + topic keywords (e.g., `` `src/api/**`, `*.controller.ts` — api, rest, middleware ``). This replaces vague free-text like "When working in packages/api/" and enables efficient dynamic context matching.
37+
- **`scope` field supports arrays** — The frontmatter `scope` field now accepts both a single string (`scope: "src/api/**"`) and an array of strings (`scope: ["src/api/**", "*.controller.ts"]`) for matching multiple file patterns.
38+
- **CLAUDE.md preamble improved** — The Knowledge Base section preamble now includes explicit instructions for how Claude should match scope patterns, keywords, and pinned entries, plus a loading notification directive.
39+
- **`_index.md` includes Scope column** — The All Pages table now has a Scope column showing each article's file path matching patterns.
40+
- **`kb-organize` refreshes "When to Load"** — Reorganizing files now also regenerates the "When to Load" column values from frontmatter.
41+
42+
### Removed
43+
44+
- `/kb-obsidian` — All functionality absorbed into `/kb-upgrade`
45+
1046
## [2.3.3] - 2026-04-05
1147

1248
### Added

README.md

Lines changed: 2 additions & 2 deletions
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.3.3-blue.svg)](https://github.com/charlesjones-dev/claude-code-plugins-dev/releases)
3+
[![Version](https://img.shields.io/badge/version-2.3.4-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,7 +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 with Obsidian compatibility | `/kb-init`, `/kb-learn`, `/kb-add`, `/kb-query`, `/kb-import`, `/kb-ingest`, `/kb-harvest`, `/kb-discover`, `/kb-absorb`, `/kb-remove`, `/kb-list`, `/kb-search`, `/kb-prune`, `/kb-auto`, `/kb-organize`, `/kb-obsidian` | - |
30+
| [ai-knowledge](plugins/ai-knowledge/) | AI-powered knowledge base management with Obsidian compatibility | `/kb-init`, `/kb-learn`, `/kb-add`, `/kb-query`, `/kb-import`, `/kb-ingest`, `/kb-harvest`, `/kb-discover`, `/kb-absorb`, `/kb-remove`, `/kb-load`, `/kb-list`, `/kb-search`, `/kb-prune`, `/kb-auto`, `/kb-organize`, `/kb-upgrade` | - |
3131
| [ai-modernize](plugins/ai-modernize/) | AI-powered codebase modernization assessment for technical debt | `/modernize-audit`, `/modernize-scan` | `modernize-auditor` |
3232
| [ai-writing](plugins/ai-writing/) | AI-powered writing quality tools for natural-sounding text | `/writing-humanize` | - |
3333

plugins/ai-knowledge/.claude-plugin/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ai-knowledge",
3-
"version": "1.3.0",
4-
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, Obsidian-compatible knowledge graph, and dynamically reference institutional knowledge in CLAUDE.md",
3+
"version": "1.4.0",
4+
"description": "AI-powered knowledge base management - Capture conversation learnings, maintain topic-specific KB files, Obsidian-compatible knowledge graph, structured dynamic context loading, and institutional knowledge in CLAUDE.md",
55
"author": {
66
"name": "Charles Jones",
77
"url": "https://charlesjones.dev"

plugins/ai-knowledge/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ Inspired by Karpathy's [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914
2828
| `/kb-discover` | Analyze source code to extract implicit knowledge into KB articles |
2929
| `/kb-absorb` | Migrate existing CLAUDE.md sections and docs/ content into the KB |
3030
| `/kb-remove` | Remove a KB file and its CLAUDE.md reference |
31+
| `/kb-load` | Manually load a KB file into context by name, topic, or tag |
3132
| `/kb-list` | List all registered KB files with status, tags, dates, and cross-references |
3233
| `/kb-search` | Search across KB files by keyword, topic, or tag (`tag:security`) |
3334
| `/kb-prune` | Interactive cleanup: stale refs, duplicates, merges, frontmatter health |
3435
| `/kb-query` | Query the KB and synthesize answers (optionally filed back as articles) |
3536
| `/kb-auto` | Toggle automatic knowledge capture at end of conversations |
3637
| `/kb-organize` | Reorganize flat KB files into category folders |
37-
| `/kb-obsidian` | One-time upgrade for Obsidian compatibility, index, log, and folders |
38+
| `/kb-upgrade` | Upgrade KB to latest practices: Obsidian compat, structured loading, preamble, index |
3839

3940
## Getting Started
4041

@@ -50,7 +51,7 @@ Inspired by Karpathy's [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914
5051

5152
6. Periodically run `/kb-prune` to keep the knowledge base organized.
5253

53-
7. Run `/kb-obsidian` to make an existing KB Obsidian-compatible, then open `docs/kb/` as an Obsidian vault.
54+
7. Run `/kb-upgrade` to bring your KB up to latest practices (Obsidian compatibility, structured loading, etc.).
5455

5556
## How It Works
5657

@@ -61,9 +62,9 @@ The Knowledge Base table in CLAUDE.md tells Claude Code which KB files to read b
6162

6263
| Topic | File | When to Load |
6364
|-------|------|--------------|
64-
| API Conventions | docs/kb/api-conventions.md | When working in packages/api/ |
65+
| API Conventions | docs/kb/api-conventions.md | `packages/api/**`, `*.controller.ts` — api, rest |
6566
| Auth Rules | docs/kb/auth.md | Always (pinned) |
66-
| React Patterns | docs/kb/frontend/react-patterns.md | When working in packages/web/ |
67+
| React Patterns | docs/kb/frontend/react-patterns.md | `packages/web/**` — react, frontend, components |
6768
```
6869

6970
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.
@@ -79,7 +80,9 @@ related: [[api-conventions]] # Cross-references to other KB files
7980
created: 2026-04-02 # Date the file was created
8081
last-updated: 2026-04-02 # Date the file was last modified
8182
pinned: false # If true, always loaded regardless of context
82-
scope: "packages/api/**" # Optional glob pattern for auto-matching
83+
scope: # Optional glob pattern(s) for auto-matching
84+
- "packages/api/**"
85+
- "*.controller.ts"
8386
---
8487
```
8588

@@ -100,6 +103,6 @@ This is required because Obsidian does not parse frontmatter values as navigable
100103

101104
## Plugin Details
102105

103-
- **Version**: 1.3.0
106+
- **Version**: 1.4.0
104107
- **Author**: [Charles Jones](https://charlesjones.dev)
105108
- **License**: MIT

plugins/ai-knowledge/skills/kb-absorb/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ For each approved migration:
119119
created: {today's date}
120120
last-updated: {today's date}
121121
pinned: false
122-
scope: "{glob pattern if applicable}"
122+
scope: ["{glob patterns if applicable}"] # String or array
123123
---
124124
```
125125
2. Write the content, reformatted for KB style (concise, imperative, actionable rules).
126126
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.
127-
4. Add a reference row to the CLAUDE.md Knowledge Base table.
127+
4. Add a reference row to the CLAUDE.md Knowledge Base table. Format the "When to Load" column using the structured format: `` `scope-glob1`, `scope-glob2` — tag1, tag2 ``. Derive scope from the content's directory affinity and keywords from tags. For pinned files, use `Always (pinned)`.
128128
5. Remove the section from CLAUDE.md.
129129
6. If the removed section contained anything cross-cutting, add a brief reference in its place: `> See docs/kb/{file}.md for {topic} details.`
130130

131131
#### 4b: Absorbing docs/ Files
132132

133133
1. If the file is already well-structured, move it to `docs/kb/` and add frontmatter.
134134
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.
135-
3. Add a reference row to the CLAUDE.md Knowledge Base table.
135+
3. Add a reference row to the CLAUDE.md Knowledge Base table. Format the "When to Load" column using the structured format: `` `scope-glob1`, `scope-glob2` — tag1, tag2 ``. Derive scope from the content's directory affinity and keywords from tags. For pinned files, use `Always (pinned)`.
136136

137137
#### 4c: Cross-References
138138

plugins/ai-knowledge/skills/kb-add/SKILL.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ related: [[other-kb-file]] # Optional: cross-references to related K
1919
created: YYYY-MM-DD # Required: date created
2020
last-updated: YYYY-MM-DD # Required: date last modified (update on every write)
2121
pinned: false # Optional: true = always loaded. Default false
22-
scope: "src/api/**" # Optional: glob pattern for auto-matching
22+
scope: "src/api/**" # Optional: glob pattern(s) for auto-matching. String or array.
2323
---
2424
```
2525

@@ -72,13 +72,17 @@ If saving to a new KB file, gather metadata:
7272
- Header: "KB Tags"
7373
- Options: "Use suggested" | "Let me adjust" (free-text follow-up)
7474

75-
**When to Load**: Ask about the loading context:
76-
- Question: "When should Claude Code load this knowledge?"
75+
**When to Load**: Determine the scope patterns and keywords for the loading context:
76+
1. **Infer scope patterns** from the learning content. If the learning relates to specific directories or file types, suggest glob patterns (e.g., `src/api/**`, `*.controller.ts`).
77+
2. **Use the file's tags as keywords**.
78+
3. Present the suggested "When to Load" value in the structured format: `` `glob1`, `glob2` — keyword1, keyword2 ``.
79+
80+
- Question: "Suggested loading context: {formatted When to Load value}. Adjust or confirm?"
7781
- Header: "Loading Context"
7882
- Options:
79-
- Suggested context based on the learning content (e.g., "When working in `src/api/`")
83+
- "Use suggested" (show the formatted value)
8084
- "Always load (pinned)" (for critical knowledge)
81-
- "Custom context" (free-text)
85+
- "Let me adjust" (free-text)
8286

8387
### Step 5: Write the Learning
8488

@@ -100,7 +104,7 @@ If saving to a new KB file, gather metadata:
100104
created: {today's date}
101105
last-updated: {today's date}
102106
pinned: {true if user selected "Always load", else false}
103-
scope: "{glob pattern if applicable}"
107+
scope: ["{glob patterns if applicable}"] # String or array
104108
---
105109

106110
# {Topic Name}
@@ -119,6 +123,7 @@ If saving to a new KB file, gather metadata:
119123
2. Update the CLAUDE.md Knowledge Base table:
120124
- Remove placeholder row if present.
121125
- Add new row with Topic, File path, and When to Load (use "Always (pinned)" if pinned).
126+
- Format the "When to Load" column using the structured format: `` `scope-glob1`, `scope-glob2` — tag1, tag2 ``. Derive scope patterns from the file's `scope` frontmatter and keywords from `tags`.
122127
- Keep table sorted alphabetically by Topic.
123128
3. Add reverse cross-references: if the new file relates to existing KB files, add `[[new-file]]` to those files' `related` frontmatter, update their `## Related` body section to match, and update their `last-updated`.
124129

plugins/ai-knowledge/skills/kb-discover/SKILL.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ related: [[other-kb-file]] # Optional: cross-references to relat
2424
created: YYYY-MM-DD # Required: date created
2525
last-updated: YYYY-MM-DD # Required: date last modified
2626
pinned: false # Optional: true = always loaded. Default false
27-
scope: "src/api/**" # Optional: glob pattern for auto-matching
27+
scope: # Optional: glob pattern(s) for auto-matching. String or array.
28+
- "src/api/**"
29+
- "src/middleware/**"
2830
discovered-from: "src/api/, src/models/" # Required for discovered content: directories/files analyzed
2931
---
3032
```
@@ -183,7 +185,7 @@ Group the extracted knowledge into proposed KB articles. Each article should cov
183185
For each proposed article, prepare:
184186
- Suggested file path under `docs/kb/`
185187
- Topic name for the CLAUDE.md table
186-
- "When to Load" context
188+
- "When to Load" value (structured format: `` `scope-globs` — keywords ``)
187189
- Tags
188190
- The distilled rules/conventions (imperative voice, concise)
189191
- Which source directories/files the knowledge came from (`discovered-from`)
@@ -203,7 +205,7 @@ Tech stack: TypeScript, Express, Prisma, Jest
203205
204206
### 1. API Conventions
205207
→ docs/kb/api-conventions.md
206-
→ When to Load: "Working in src/api/ or src/routes/"
208+
→ When to Load: `src/api/**`, `src/routes/**` — api, rest, conventions, express
207209
→ Tags: [api, rest, conventions, express]
208210
→ Discovered from: src/api/, src/middleware/
209211
Key findings:
@@ -215,7 +217,7 @@ Tech stack: TypeScript, Express, Prisma, Jest
215217
216218
### 2. Data Model Patterns
217219
→ docs/kb/data-model-patterns.md
218-
→ When to Load: "Working with Prisma models or database"
220+
→ When to Load: `src/models/**`, `prisma/**` — database, prisma, models, data
219221
→ Tags: [database, prisma, models, data]
220222
→ Discovered from: src/models/, prisma/schema.prisma
221223
Key findings:
@@ -226,7 +228,7 @@ Tech stack: TypeScript, Express, Prisma, Jest
226228
227229
### 3. Testing Strategy
228230
→ docs/kb/testing-strategy.md
229-
→ When to Load: "Writing or modifying tests"
231+
→ When to Load: `tests/**`, `*.test.ts`, `*.spec.ts` — testing, jest, fixtures
230232
→ Tags: [testing, jest, fixtures]
231233
→ Discovered from: tests/, src/__tests__/
232234
Key findings:
@@ -291,6 +293,7 @@ When appending, also present the diff (new content being added) to the user via
291293

292294
1. **Remove placeholder row** if present ("_No entries yet_").
293295
2. **Add or update rows** with Topic, File path, and When to Load.
296+
- Format the "When to Load" column using the structured format: `` `scope-glob1`, `scope-glob2` — tag1, tag2 ``. Use the `scope` patterns from frontmatter and `tags` as keywords. Pinned files use `Always (pinned)`.
294297
3. **Deduplicate**: If a row for the same file exists, update it.
295298
4. **Sort alphabetically** by Topic.
296299

0 commit comments

Comments
 (0)