kg-init

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

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 commands/ethics03/kgskill/kg-init
Clone the repo
git clone --depth 1 https://github.com/Ethics03/kgskill
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. 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.00012 $0.00674
Opus 5 $0.00006 $0.00337
Sonnet 5 $0.00002 $0.00135
Haiku 4.5 $0.00001 $0.00067

Measured 2d ago against content hash f2b32355f289, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

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. 2d 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 4mo ago), licensed MIT. It adds 12 tokens to every session and 674 once invoked, about $0.0001 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.