kw-init

A setup command for a project knowledge base, which is a structured collection of notes and research that an assistant can search and maintain. It can either connect the project to an existing shared knowledge base or create a new one.

In plain words
What is it for?
Use it when starting a knowledge-base workspace or linking a project to an existing one, including its notes, papers, indexes, and configuration.
Why use it?
It avoids setting up folders and configuration by hand and lets multiple projects use the same stored knowledge when needed.

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/chenpg2/kw-engine/kw-init
Any agent
npx skills add chenpg2/kw-engine --skill kw-init
Clone the repo
git clone --depth 1 https://github.com/chenpg2/kw-engine

Made for: Claude Code, Codex.

Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 843 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.00035 $0.00843
Opus 5 $0.00017 $0.00421
Sonnet 5 $0.00007 $0.00169
Haiku 4.5 $0.00003 $0.00084

Measured 2d ago against content hash 27060cd8941a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kw-init 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 2d ago.

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.

skills/kw-init/SKILL.md · 109 lines

How it starts

The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Two modes:

If a shared knowledge base already exists (e.g. ~/Downloads/soft/knowledge_wiki/memory/), link this project to it instead of creating a new one:

kw link ~/Downloads/soft/knowledge_wiki/memory/

This creates .kw/config.yaml with paths.memory pointing to the shared library. All kw commands (search, verify, status, etc.) now use the shared knowledge.

Mode 2: Create a new knowledge base from scratch

Run this once in any repo to set up a fresh, empty knowledge engine.

What it creates

<project-root>/
├── .kw/
│   └── config.yaml          # Engine config (model routing, fetch policy)
├── memory/
│   ├── SCHEMA.md            # Data structure contract
│   ├── index.json           # Central index (starts empty)
│   ├── papers/              # L1 faithful readings
│   ├── principles/          # L2 abstract principles
│   ├── synthesis/           # L3 design-space, contradictions, gaps
│   └── golden/              # Exemplar records for quality reference
├── paper/                   # Raw PDFs (gitignored)
├── process/
│   ├── extract-template.md  # L1 extraction rubric
│   └── distill-rubric.md    # L2 distillation rubric
└── problems/                # Use-case pointers

Procedure

  1. Check if memory/SCHEMA.md already exists. If yes, report "Already initialized" and STOP.
  2. Create the directory structure above.
  3. Write .kw/config.yaml from the template below.
  4. Write memory/SCHEMA.md from the kw-engine package's canonical schema.
  5. Write memory/index.json with the empty initial state.
  6. Write process/extract-template.md and process/distill-rubric.md.
  7. Add paper/*.pdf and .kw/index.db to .gitignore if not already present.
  8. Report: "Knowledge engine initialized. Run /kw to start ingesting papers."

Config template (.kw/config.yaml)

version: 1

paths:
  papers_src: paper/
  memory: memory/
  index: memory/index.json
  process: process/
  problems: problems/
  logs: .kw/logs/

loop1:
  synthesize_after_n_papers: 5

process_versions:
  extract_template: extract-template@v1
  distill_rubric: distill-rubric@v1

model_routing:
  kw-fetcher: sonnet
  kw-reader: sonnet
  kw-distiller: opus
  kw-synthesizer: opus
  kw-verifier: sonnet

fetch:
  fallback_order: [with_fallback, arxiv, biorxiv, medrxiv, pubmed, crossref, openalex, semantic, curl_oa]
  validate:
    magic_bytes: "%PDF-"
    min_bytes: 10240
    max_bytes: 52428800
  scihub: false
  paywalled_via_browse: true
  idempotent: true

active_expansion:
  enabled: false

Read the full file on GitHub · 109 lines

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. 2d ago First seen · 109 lines · 35 tokens per session scan A 27060cd8941a

Subscribe to this mod's changes

kw-init is a skill published in the GitHub repository chenpg2/kw-engine (11 stars, last pushed 2mo ago), licensed MIT. It adds 35 tokens to every session and 843 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

paper-deep-reader

Skill "paper-deep-reader" from Linwei-Chen/paper-deep-reader-skill, covering paper deep reader, 1. 路由交付模式, 2. 按需加载参考材料, 3. 先读懂,再写报告 and 4. 强制执行双层讲解.

Linwei-Chen/paper-deep-reader-skill · 181 tokens

Datacore Methodology

Core knowledge management principles — capture, journal, learn, compound.

datacore-one/datacore-mcp · 18 tokens

PBE Extractor

Extract invariant principles from any text — find the ideas that survive rephrasing.

live-neon/skills · 21 tokens

wiki-lint

Run a deterministic, read-only health check on an Obsidian wiki. Use for lint, vault health check, audit wiki health, find orphans, find dead links, frontmatter audit, provenance audit, or wiki audit. Reports graph, link, frontmatter, provenance-ledger, empty-section, and stale-index findings; it does not reason…

AgriciDaniel/claude-obsidian · 79 tokens

a-evolve

Apply A-Evolve's agentic evolution methodology to improve AI agent performance across runs. Use when the user wants to diagnose agent failures, generate targeted skills from error patterns, evolve system prompts, or accumulate episodic knowledge. Works standalone or inside AutoResearchClaw pipelines. Triggers on…

aiming-lab/AutoResearchClaw · 100 tokens

mermaid-visualizer

Transform text content into professional Mermaid diagrams for presentations and documentation. Use when users ask to visualize concepts, create flowcharts, or make diagrams from text. Supports process flows, system architectures, comparisons, mindmaps, and more with built-in syntax error prevention.

breferrari/obsidian-mind · 57 tokens