wiki_graph_indexlisted
Install: claude install-skill Misaka16384/magi
# LLM Wiki — Graph Index Skill (wiki_graph_index)
> **CLI (read first):** This skill drives the `magi` CLI (MAGI research workspace tool, assumed installed on PATH). If unsure of your surroundings, run `magi sync` first to locate the workspace. For the full syntax of any command: `magi <command> --help`.
This skill extracts the Markdown-based knowledge graph (comprised of `[[wikilinks]]`, tags, and aliases) into a structured SQLite database (`output/graph.db`) that an AI agent can easily query using standard SQL.
## Usage
When the user asks to extract, index, or query the knowledge graph of their wiki:
### 1. Build the Graph Database
Run the deterministic graph builder to extract the graph from the markdown files:
```bash
magi graph build <TOPIC_DIR>
```
*This will parse all markdown files under `wiki/` (ignoring `_index.md`), extract frontmatter (tags, aliases) and body links, and rebuild the SQLite database located at `output/graph.db`.*
### 2. Query the Graph Database
Once built, use `magi graph query "<SQL>" --db <TOPIC_DIR>/output/graph.db` to query the knowledge graph. Fall back to a temporary Python script using the `sqlite3` module only for complex multi-step traversals that a single SQL statement cannot express. Do not use direct `sqlite3` command line execution.
The database schema is as follows:
- `nodes(id, path, title, type, category, summary, created, updated)`
- `id`: The topic-relative file path without extension, WITH the `wiki/` prefix (e.g., 'wiki/