kb-wrap

A procedure for transferring recorded project decisions and lessons from a local ledger into a team knowledge base, then clearing the processed entries.

In plain words
What is it for?
Use it at the end of work, after creating a pull request, or when an unfinished ledger blocks session closure. It reads the ledger and Git history, records approved items, and reports anything left pending.
Why use it?
It preserves important reasoning even after conversation context is shortened or lost, and keeps an audit record of what was transferred.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/riemannulus/knowledge-base/kb-wrap
Any agent
npx skills add riemannulus/knowledge-base --skill kb-wrap
Clone the repo
git clone --depth 1 https://github.com/riemannulus/knowledge-base

Made for: Claude Code, Codex.

Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 700 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00100 $0.00700
Opus 5 $0.00050 $0.00350
Sonnet 5 $0.00020 $0.00140
Haiku 4.5 $0.00010 $0.00070

Measured yesterday against content hash b46bb5ec2bb3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kb-wrap scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/kb-workflow/skills/kb-wrap/SKILL.md · 37 lines

What it actually says

kb-wrap — 원장 flush (대화 회고가 아님)

이 스킬은 대화를 되짚지 않는다. 컨텍스트는 이미 compact됐을 수 있고 서브에이전트 기록은 애초에 대화에 없다. 근거는 두 가지뿐: 원장 파일git 이력.

절차

  1. 원장 읽기: .kb/ledger.jsonl (없거나 비어 있으면 3단계로).
  2. 항목별 flush (kb MCP):
    • kind=decisionrecord_decision(...), kind=learningrecord_learning(..., code_refs=항목의 code_refs). author에는 항목의 agent 값을 넘긴다 (누가 내린 결정인지 보존).
    • 응답 similar_existing 처리: 같은 주제 갱신이면 같은 제목으로 upsert, 옛 결정 대체면 supersedes 연결. 판단이 안 서면 사용자에게 물어라 — 자동 병합은 하지 않는다 (mem0/Guru 패턴: 감지는 자동, 병합은 승인).
  3. git 대조 (원장에 없는 결정 후보 탐지):
    • git log --oneline 으로 이 브랜치의 커밋을 훑고, 커밋 메시지가 암시하는 결정/삽질 중 원장·kb에 없는 것이 있으면 후보로 제시하고 확인 후 기록.
    • 이 단계는 보조다 — 커밋 메시지는 gitlog 커넥터가 어차피 인덱싱하므로 "결정의 이유"가 담긴 것만 노트로 승격할 가치가 있다.
  4. 원장 정리: flush된 항목은 .kb/flushed.jsonl에 append(감사 이력), .kb/ledger.jsonl은 비운다. kb MCP가 없어 flush를 못 했다면 원장을 지우지 말고 사용자에게 알려라 — Stop 훅이 다음 세션에서 다시 상기시킨다.
  5. 보고: 기록 N건(decision/learning 별), supersede 연결 N건, 보류 N건(사유).

훅과의 관계

  • Stop 훅: 원장에 미flush 항목이 있으면 세션 종료를 막고 이 스킬 실행을 요구한다. flush 후 원장이 비면 통과된다.
  • SessionStart 훅: 새 세션/compact 재개 시 미flush 원장이 있으면 컨텍스트에 주입된다 — 이전 세션이 죽었어도 원장부터 flush하고 시작하라.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 37 lines · 100 tokens per session scan A b46bb5ec2bb3

Subscribe to this mod's changes

kb-wrap is a skill published in the GitHub repository riemannulus/knowledge-base (1 stars, last pushed 20d ago), licensed MIT. It adds 100 tokens to every session and 700 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories