agentleFS
smoketurnersmoketurner/claude-okf-kb/.claude/skills/kb-init/SKILL.md

kb-init

Skill0 starsChanged 3 days agoMITView on GitHub

Scaffold a new OKF knowledge base in the current repository that mines local Claude Code sessions for one or more source repos. Use when asked to initialize/create/set up a knowledge base, start a new "-kb" repo, or bootstrap this template. Gathers the project name and source repo paths, runs the deterministic scaffolder, verifies the bundle, and explains the first refresh.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. dimitar-radenkov/Pointframe★ 16same name
    2. jsobolewski1/fondue★ 6same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask the user with AskUserQuestion when they have not already said:

    line 26
  2. Distinctive:

    Run, from the repo root:

    line 47
  3. Distinctive:

    Do not commit unless the user asks.

    line 67
  4. Very specific:

    Run /kb-refresh for the first mining pass (with no watermarks it mines every session after the history floor.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Initialize a knowledge base

You turn the current directory into an Open Knowledge Format v0.2 bundle that /kb-refresh keeps up to date from Claude Code transcripts. The work itself is done by a deterministic script; your job is to gather correct inputs, run it, and verify the result.

1. Locate the scaffolder

The script is scripts/init.py under the plugin root when this skill runs from the installed okf-kb plugin: ${CLAUDE_PLUGIN_ROOT}. If that placeholder was not expanded to a real path (it appears literally above), this skill is running from a template checkout and the scaffolder is ./scripts/init.py in the current directory. Call the resolved path SOURCE/scripts/init.py below.

Refuse to proceed if the current directory already holds kb.config.json (it is already a knowledge base) or is not a git repository (git rev-parse --show-toplevel); tell the user to create or clone the empty target repo first.

2. Gather inputs

Ask the user with AskUserQuestion when they have not already said:

  • Project name (--name): a lowercase kebab-case slug such as vouch; and the human title (--title), such as Vouch. Default the name to the repo directory name minus a trailing -kb.
  • Source repositories (--repo, repeatable): absolute paths of the checkouts whose sessions to mine. Before asking, list candidates: ls ~/.claude/projects shows one directory per working directory Claude Code has run in, named by the path with / and . replaced by - (-Users-you-envs-git-vouch); directories containing --claude-worktrees- are worktrees of the preceding repo and are mined automatically. Offer the directories whose names contain the project name, mapped back to their real paths, and confirm each path exists. Only repos listed here are mined — a sibling that merely shares the name prefix is not.
  • History floor (--since, optional YYYY-MM-DD): sessions older than this are never mined. Suggest it when ls ~/.claude/projects/<dir>/*.jsonl | wc -l is in the hundreds, because the first refresh otherwise digests everything (which is fine, just long).

--run-dir (scratch space for digests, default /private/tmp/<name>-kb-refresh) and --base-branch (default main) rarely need changing.

3. Scaffold

Run, from the repo root:

uv run SOURCE/scripts/init.py --name <name> --title "<Title>" --repo <path> [--repo <path> ...] [--since YYYY-MM-DD]

It copies the bundle skeleton, scripts/, and the /kb-refresh skill into the repo, writes kb.config.json, .claude/settings.json (the out-of-tree directories and command allow-list the refresh needs), and .refresh/watermarks.json, stamps the docs, regenerates the eight type-directory indexes, and runs okf.py validate. In a template checkout it also removes the template-only files (template/, .claude-plugin/, this skill, the scaffolder) so what remains is a plain knowledge-base repo.

4. Verify and hand off

  • uv run scripts/okf.py validate is clean and git status shows the scaffold.
  • jq . kb.config.json lists exactly the agreed repos; .claude/settings.json grants them.
  • Install the hooks: prek install (fall back to pre-commit install if prek is absent).
  • Confirm jq, gitleaks, and uv are on PATH — refresh.py prepare needs all three. Opening the refresh PR needs either gh logged in or GITHUB_TOKEN/GH_TOKEN in the environment.

Do not commit unless the user asks. Report what was created, then tell the user:

  1. Run /kb-refresh for the first mining pass (with no watermarks it mines every session after the history floor; expect a Workflow fan-out when there are many batches, and a PR at the end).
  2. Edit the Layout scope list in AGENTS.md whenever a source repo is added to kb.config.json (bump its version and re-stamp).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.