kg-init

kg-init is a command for Claude Code from Ethics03/kgskill. It costs 12 tokens per session (674 once invoked), scanned A, original, MIT.

A command that creates a new Knowledge Graph: a structured collection of source material and linked notes.

In plain words
What is it for?
Use it to create the initial directory and wiki structure for a new research or knowledge-management project.
Why use it?
It sets up the folders and starter files needed to organize articles, papers, transcripts, notes, and summaries.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions AGENTS.md.

Part of the mykg plugin — 3 skills, 6 commands shipped together

Good fit Use it to create the initial directory and wiki structure for a new research or knowledge-management project.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/ethics03/kgskill/kg-init
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.

Clone the repo
git clone --depth 1 https://github.com/Ethics03/kgskill

Made for: Claude Code.

Or install mykg, the plugin that ships this one along with the rest of its 3 skills, 6 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kg-init

README.md
[![agentmods](https://agentmods.dev/badge/commands/ethics03/kgskill/kg-init/github.svg)](https://agentmods.dev/commands/ethics03/kgskill/kg-init)
Your own site
<a href="https://agentmods.dev/commands/ethics03/kgskill/kg-init"><img src="https://agentmods.dev/badge/commands/ethics03/kgskill/kg-init/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kg-init

Your own site · 80×15
<a href="https://agentmods.dev/commands/ethics03/kgskill/kg-init"><img src="https://agentmods.dev/badge/commands/ethics03/kgskill/kg-init.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 674 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00012 $0.00674
Opus 5.5 $0.00005 $0.00270
Sonnet 5.5 $0.00002 $0.00135
Haiku 4.5 $0.00001 $0.00067

Measured 1mo ago against content hash f2b32355f289, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kg-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 1mo 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.

commands/kg-init.md · 136 lines

What it actually says

Initialize a new Knowledge Graph at the path provided. If no path was given, check MYKG_PATH env var, then ~/.config/mykg/config, then default to ~/MyKG.

Steps

1. Resolve target path

Use the first available source:

  1. Argument passed to this command
  2. $MYKG_PATH environment variable
  3. Contents of ~/.config/mykg/config
  4. Default: ~/MyKG

2. Check if already exists

If the target directory contains an index.md, tell the user the KG already exists and suggest /kg-setup to reconfigure. Stop.

3. Create directory structure

Run:

mkdir -p <path>/raw/{articles,papers,transcripts,notes}
mkdir -p <path>/wiki/{entities,concepts,synthesis,comparisons}

4. Create core files

Write these four files at the target path:

index.md:

# Index

Catalog of all wiki pages. The LLM reads this first to find relevant content.

## Entities

Pages for specific entities: people, organizations, tools, places.

| Page | Summary | Sources |
|------|---------|---------|

## Concepts

Pages for ideas, topics, themes, frameworks.

| Page | Summary | Sources |
|------|---------|---------|

## Synthesis

High-level summaries and overviews.

| Page | Summary | Sources |
|------|---------|---------|

## Comparisons

Side-by-side analyses and trade-offs.

| Page | Summary | Sources |
|------|---------|---------|

## Source Summaries

| Page | Source | Date |
|------|--------|------|

## Projects

| Project | Description |
|---------|-------------|

log.md:

# Log

Chronological record of changes. Append-only.

Each entry: `## [YYYY-MM-DD] <type> | <title>`
Types: `ingest`, `query`, `lint`, `project`

---

## [<today's date>] project | Initialize KG

Created Knowledge Graph with initial structure.

- Added: [[index]]
- Added: [[log]]
- Added: [[Active]]
- Added: [[AGENTS]]

Active.md:

# Active

Current focus items and priorities.

## Focus Areas

| Priority | Area | Status | Next Step |
|----------|------|--------|-----------|

## Questions to Investigate

-

## Sources to Find

-

## Completed

| Date | Item | Notes |
|------|------|-------|

AGENTS.md: copy the full content from the AGENTS.md template in the kgskills repo at templates/kg-init/AGENTS.md if it exists, otherwise write a minimal version with structure, page types, and workflow instructions.

5. Save config

mkdir -p ~/.config/mykg
echo "<path>" > ~/.config/mykg/config

6. Report success

Tell the user the KG was created, show the path and structure, and suggest next steps: /kg-ingest <file>, /kg-project <name>.

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. 1mo ago First seen · 136 lines · 12 tokens per session scan A f2b32355f289

Subscribe to this mod's changes

kg-init is a command published in the GitHub repository Ethics03/kgskill (3 stars, last pushed 6mo ago), licensed MIT. It adds 12 tokens to every session and 674 once invoked, about $0.0000 per session on Opus 5.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.