/ai-knowledge:kb-init [auto=on|off] [agents=off]from ai-knowledge
Sets up a team knowledge base as Claude Code rules with auto-capture and AGENTS.md pointer for multi-agent compatibility. Detects and redirects to migration for legacy 1.x knowledge bases.
Ships in ai-knowledge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Read kb-format.md first. It defines the layout, the files, the checks and the auto-capture setting used below.
Arguments (may be empty): $ARGUMENTS
Auto-capture is on by default: /kb-init turns it on for this developer in this project without asking. auto=off keeps it off, and auto=on turns it back on after an earlier auto=off. agents=off leaves the AGENTS.md section out (kb-format.md, The AGENTS.md pointer). Ignore any other text.
Look for a 1.x knowledge base as kb-format.md describes. If there is one, create nothing, change no setting, and say:
This project has a 1.x knowledge base (the CLAUDE.md table and
docs/kb/). Run/kb-migrateto move it to the new layout, or/kb-migrate --dry-runto preview the plan first. Setting up the new layout next to the old one would split the knowledge base in two. At the end of the migration,/kb-migrateturns on auto-capture for you unless you passauto=off.
Then stop.
If .claude/rules/kb/_index.md exists, the knowledge base is already set up: go to Step 4.
Note any other .md files already under .claude/rules/kb/ or .claude/kb/, and run the git check from kb-format.md.
Get today's date once (kb-format.md, Dates). Create only files that don't exist, and never overwrite one.
.claude/rules/kb/_index.md from the template in kb-format.md, with - None yet. as the list. If articles already exist (added by hand, for example), list every scoped article under .claude/rules/kb/ and every on-demand article under .claude/kb/ instead, one line each from the article's title, tags and paths.
.claude/kb/README.md from the template in kb-format.md.
.claude/kb/_log.md as kb-format.md describes, with this entry:
## [{date}] init | Knowledge base set up
- Created: {the files created in this run}
AGENTS.md: add the pointer section from kb-format.md, creating the file if needed, unless the arguments include agents=off. This is the one file outside .claude/ that /kb-init writes, and only between its marker comments.
Don't create _global-learnings.md yet. /kb-learn and /kb-add create it with the first cross-cutting rule, so an empty placeholder doesn't load into every session.
Don't add anything to CLAUDE.md. Claude Code loads _index.md and the scoped articles without being told to.
Don't ask. With auto=off, set it off; otherwise set it on (kb-format.md, Auto-capture). Off still writes the false setting in a git repository, so a later /kb-init keeps that choice and reports it clearly. Go to Step 5.
Don't redo the setup. Only create .claude/kb/README.md or .claude/kb/_log.md if one is missing, as Step 2 describes.
Bring the AGENTS.md pointer up to date (kb-format.md, The AGENTS.md pointer): add it if it's missing, replace it if it differs from the template, and remove it with agents=off.
Read the current auto-capture state and where it comes from (kb-format.md, Auto-capture). Don't ask:
auto=on or auto=off, apply it./kb-init or /kb-migrate here, as when a teammate clones a project that already has a knowledge base), turn it on.If the AI_KNOWLEDGE_AUTO_CAPTURE environment variable decides the state, say that changing the project setting won't take effect until the variable is removed, and say where it's probably set (the shell, or the env block of a settings file).
Show:
AGENTS.md section: added, updated, already current, or removed, and that it lets Codex, Cursor and other agents that read AGENTS.md use the knowledge base (/kb-init agents=off removes it);/clear. If it was just turned on, follow auto-capture for the rest of this session too, as kb-format.md says. If it's off, mention /kb-init auto=on; if it's on, mention /kb-init auto=off;_index.md; on-demand ones only from the index. Claude names each scoped or on-demand article it loads in a one-line notice;/kb-add <note, path or URL> adds knowledge; /kb-add --absorb reviews CLAUDE.md and docs/ for content that belongs here/kb-learn reviews the conversation and saves what it taught/kb-discover [paths] writes down conventions found in the code/kb-query <question> answers from the knowledge base, and /kb-query list shows what's in it/kb-prune cleans it up.claude/rules/kb/, .claude/kb/ and AGENTS.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub charlesjones-dev/ai-agent-plugins --plugin ai-knowledge7 skills in this plugin
/kb-addAdd knowledge to the team knowledge base from a note, project files or folders, another repo, a URL, or the project's own CLAUDE.md and docs/. Distills it into articles, picks how each one loads, records where it came from, and shows every draft before writing./kb-discoverRead the source code to find knowledge nobody wrote down (architecture, naming, API contracts, data models, error handling, configuration, testing patterns) and save it as knowledge base articles scoped to the code they describe. Shows each draft before writing./kb-learnSaves team knowledge (corrections, rules, decisions, codebase gotchas) to the project's knowledge base in .claude/rules/kb/. Invoke it yourself in only two cases: (1) your context holds the instruction 'ai-knowledge auto-capture is on for this project' and such a learning just came up; pass `auto` and the learning. (2) The user explicitly asks you to save or add something to the knowledge base, KB or team rules; pass `auto` and that thing. A user stating a rule, convention or correction is not a request to save it: without the auto-capture instruction, don't invoke this skill for it. Typed as /kb-learn, it reviews the whole conversation and asks before saving./kb-migrateMove a 1.x knowledge base (the CLAUDE.md Knowledge Base table and docs/kb/) to Claude Code rules: pinned articles load every session, scoped ones when Claude touches matching files, and the rest through a short index. Shows the plan and asks first, supports --dry-run, is safe to re-run, turns on auto-capture, which replaces /kb-auto, unless you pass auto=off, and adds a short AGENTS.md section so Codex and Cursor read the knowledge base (agents=off to skip). It also finds references to renamed or removed marketplace commands in the knowledge base, CLAUDE.md, AGENTS.md, .gitignore and docs/, and proposes fixes. On a 2.x knowledge base it checks and repairs the format and runs the same command check, so running it again after a marketplace update catches newly stale references./kb-pruneClean up the team knowledge base: find duplicates, contradictions, broken links, stale articles, scoped globs that match nothing and pinned articles that cost too much context, then merge, fix or remove with your approval. Also removes a single article, or sorts articles into category folders./kb-queryAnswer a question from the team knowledge base with cited articles and offer to file the answer back as an article. Also searches by keyword or tag:name and lists every article with how it loads.Other plugins' skills for the same job