Skip to main content
ClaudeWave
Slash Command2.4k repo starsupdated today

obsidian-init

The obsidian-init command scans an Obsidian vault's structure and generates three foundational files to enable Claude to work efficiently within it: a _CLAUDE.md operating manual documenting the vault's organization, an index.md catalog listing all notes with descriptions grouped by folder for fast reference, and a Logs/ directory with log.md pointer and today's timestamped entry. It also creates a Bases/ folder containing four premade database templates (Projects, People, Tasks, Daily) configured for either Obsidian-style or wiki-style folder structures. Use this command once when setting up a vault for Claude-assisted note management, or when onboarding Claude to an existing vault.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/eugeniughelbur/obsidian-second-brain/HEAD/commands/obsidian-init.md -o ~/.claude/commands/obsidian-init.md
Then start a new Claude Code session; the slash command loads automatically.

obsidian-init.md

Use the obsidian-second-brain skill. Execute `/obsidian-init`:

1. Call `list_files_in_vault()` to map the full vault structure
2. Spawn parallel subagents to discover vault context simultaneously:
   - **Dashboard agent**: read `Home.md` or equivalent dashboard
   - **Templates agent**: read all files in `Templates/`
   - **Boards agent**: read all files in `Boards/`
   - **Samples agent**: read one existing note per major folder to capture naming conventions and frontmatter patterns
3. Merge all agent results into a complete picture of the vault
4. Generate a complete `_CLAUDE.md` using the template in `~/.claude/skills/obsidian-second-brain/references/claude-md-template.md`, filled with real values from the vault
5. Generate `index.md` at the vault root - a catalog of all pages organized by category:
   - List every note in the vault grouped by folder (Projects, People, Ideas, etc.)
   - Include a one-line description for each note (from frontmatter or first paragraph)
   - Claude reads this file FIRST when navigating the vault - cheaper and faster than searching
   - Format: `- [[Note Name]] — brief description`
6. Initialize the vault operations log:
   - Create `Logs/` directory at the vault root
   - Write `log.md` at the vault root as a thin pointer file: explains the per-day structure, points at `Logs/`, and ships the entry template (do NOT put log entries in `log.md` itself)
   - Write today's `Logs/YYYY-MM-DD.md` with the init entry: `**HH:MM** - init | Vault initialized with _CLAUDE.md, index.md, Logs/`
   - Per-day file format: frontmatter (`type: log`, `date`, `ai-first: true`) + `**HH:MM** - action | description` entries, append-only
7. Create `Bases/` at the vault root if it does not exist. Stamp the four premade base files from `~/.claude/skills/obsidian-second-brain/references/bases/`:

   | Template | Output file | Obsidian-style folder | Wiki-style folder |
   |---|---|---|---|
   | `projects.base.template` | `Bases/Projects.base` | `Projects` | `wiki/projects` |
   | `people.base.template` | `Bases/People.base` | `People` | `wiki/entities` |
   | `tasks.base.template` | `Bases/Tasks.base` | `Tasks` | `wiki/tasks` |
   | `daily.base.template` | `Bases/Daily.base` | `Daily` | `wiki/daily` |

   Detect vault style from the folder structure discovered in step 1: if `wiki/` exists at the root, use wiki-style folder names; otherwise use obsidian-style. For each template, replace the `{{FOLDER}}` placeholder with the correct folder name, then write to `Bases/`.

   Skip any base file that already exists in `Bases/` - never overwrite.

8. Write `_CLAUDE.md`, `index.md`, root `log.md` (pointer), `Logs/YYYY-MM-DD.md` (today's entries), and any new `Bases/*.base` files
9. Confirm what was written and tell the user to restart their Claude session so the new files take effect

If `_CLAUDE.md` already exists: show a diff of what would change and ask before overwriting.
If `index.md` already exists: regenerate it (it's always a fresh catalog of current vault state).
If a monolithic `log.md` already exists with `## YYYY-MM-DD` sections: run `python ~/.claude/skills/obsidian-second-brain/scripts/migrate_log.py --vault <vault-path>` to split it into `Logs/YYYY-MM-DD.md` files. Do not overwrite manually.

---

**AI-first rule:** Every note created or updated by this command MUST follow `references/ai-first-rules.md` - `## For future Claude` preamble, rich frontmatter (`type`, `date`, `tags`, `ai-first: true`, plus type-specific fields), recency markers per external claim, mandatory `[[wikilinks]]` for every person/project/concept referenced, sources preserved verbatim with URLs inline, and confidence levels where applicable. The vault is for future-Claude retrieval - not human reading.

**Anti-fabrication:** Search exhaustively before claiming any note, person, or file is absent - false absence is the most common failure mode - and never invent facts, entities, or dates (mark unknowns as `TBD`). See the anti-fabrication and search-completeness hard rules in `references/ai-first-rules.md`.