Skip to content
Back to skills

Forge Kb Learn

ASecurity

Harvest what this session (or a past one) taught into the project's knowledge base: by its bar, with evidence, corrections first; writes on its own and logs it, or proposes first. Never commits.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythongobashnodetesting

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add JZO001/forge-agent-tree --skill forge-kb-learn --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Forge Kb Learn?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Forge Kb Learn
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jzo001-forge-kb-learn/badge)](https://www.skillsdirectory.com/skills/jzo001-forge-kb-learn)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: forge-kb-learn
description: "Harvest what this session (or a past one) taught into the project's knowledge base: by its bar, with evidence, corrections first; writes on its own and logs it, or proposes first. Never commits."
argument-hint: "[propose | write [items]] [session <id>]"
allowed-tools: Read, Grep, Glob, Bash(node:*), Edit(./AGENTS.md), Edit(./CLAUDE.md), Edit(./.claude/CLAUDE.md), Edit(./AI/**)
---

# Knowledge base learning

Harvest what the work taught into the knowledge base of the project in the working directory: only what a future session could not find out from the code in five minutes, and what would save it hours (a measurement, a wall hit, an alternative rejected and why, a trap). Most sessions teach little: "nothing worth keeping" is a valid and common answer.

Arguments: `$ARGUMENTS`. `propose` lists the candidates and stops for approval, whatever the project's setting. `write` means the user approved candidates you listed earlier in this conversation (all of them, or the items named): run step 1 (without `--propose`), then go to 6 and write them. `session <id>` harvests a past session of this project instead (its id, or a transcript's path).

The script, KB below: `node "${CLAUDE_SKILL_DIR}/../../scripts/kb.mjs"`. If that path does not exist, find `scripts/kb.mjs` of the forge-agent-tree plugin with Glob. Run no command but the script, and run it alone: nothing chained before or after it.

1. Run `KB learn begin . --session ${CLAUDE_SESSION_ID}`, with `--propose` for `propose`; for `session <id>`, `--session <id> --whole` instead. It says the mode, the policy to follow, the sizes, what of the session is left to read, and the backup's stamp.
   - No knowledge base: say so, suggest the forge-kb-init skill, and stop.
   - It lists the entries the user removed since they were added (**Forgotten**): never add one of them again.
   - Without Node (the script is missing, or says Node is too old): learn from your context alone, copy each file you are about to change to `AI/.kb/backup-<YYYYMMDD-HHMMSS>/` first, and say that the guard was left out.
2. Read the policy it names, unless you read it in this session: the bar, where an entry goes, its form, and the log.
3. If it lists parts of the session to read, read them: `KB learn digest . --since <stamp> --part <n>`. With more than one part, give each to a subagent with the policy's bar, and ask for candidates with their evidence. Judge them yourself.
4. **Fix before you add:** what did the work prove wrong or out of date in the knowledge base? Each correction is a candidate of its own.
5. Weigh each candidate by the bar, with its evidence (measured: what ran and what it printed; read: which file and member; inferred: say so, and what would confirm it). Route it: the core only for what shapes every task; a topic file where the reader will stand; a code comment; the personal memory, for how one person likes to work (list it as such, do not write it); or nowhere.
6. By the mode:
   - **Writes on its own:** write each entry in the voice of its file, one topic in one place; a new topic file gets its row in the core's map. Log each write in `AI/.kb/learn-log.md` as the policy shows (newest first; a correction keeps the old text).
   - **Proposes first:** list the candidates, numbered (what, where, the evidence, what it would have saved), the corrections as their own items. Run step 8, then stop. Tell the user how to approve: run this skill again, as it was started, with `write` and the numbers to keep (none: all). This skill's permissions hold only in the turn it runs in: a plain "yes" works too, but then each write asks for permission.
   - A person's decision (a rule the user set, a "won't do") is never removed or reversed: list it for the user instead.
7. **A detector** for each entry you wrote that is about a command or the environment, as the sessions show it (a program that is missing, a form or flag a command needs, a path, a version; never a design decision). Write `AI/.kb/learn-detect.json` with Write: `{"detectors": [{"id": "pytest-via-python", "file": "AI/testing.md", "quote": "the entry's first words as written, at most 80 characters", "scope": "regex on the commands: when the rule matters", "confirm": "regex on such a command and its output: the rule held (the way it gives worked)", "contradict": "optional regex: the rule did not hold (the way it warns against worked)"}]}`. The failure that taught the rule confirms it: it is never the contradict. The patterns are case-insensitive, at most 200 characters, with no repeated group that holds a repeat. Run `KB learn detect . --answer AI/.kb/learn-detect.json`: it keeps a detector only where its confirm held in at least two of the project's sessions, and says why it left one out; the entry stays either way. Skip this step in the proposing mode's first run and without Node.
8. Run `KB learn end . --since <stamp>`. Fix what it names as an error, and run it again, once.
9. End with one short line in the user's language: what you wrote and where, or that nothing was worth keeping. Do not commit.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.