feat: ship workspace.json + setup-vault.sh for zero-config user experience

Users who clone the repo now get the full setup automatically:

- workspace.json tracked in git (removed from .gitignore)
  - Opens with Wiki Map canvas as default view
  - Graph view pre-configured: path:wiki filter, 5 color groups, proper physics
  - Obsidian reads this on first open before any state reset occurs

- bin/setup-vault.sh — one-time setup script
  - Writes correct graph.json (filter + colors)
  - Writes app.json (excludes plugin dirs from graph)
  - Writes appearance.json (enables vault-colors CSS)
  - Prints clear next-step instructions
  - Usage: bash bin/setup-vault.sh

- README updated: Option 1 now shows clone + setup.sh as recommended path
  - Clear explanation of what the script does
  - 2-minute setup flow vs manual configuration

Result: users clone, run setup.sh, open Obsidian — done.
Graph shows only wiki pages, color-coded, no noise.
This commit is contained in:
Daniel
2026-04-07 12:33:01 +03:00
parent 5cf93c9913
commit f597342479
5 changed files with 339 additions and 14 deletions

3
.gitignore vendored
View File

@@ -1,5 +1,6 @@
# Obsidian # Obsidian
.obsidian/workspace.json # workspace.json is intentionally tracked — ships with pre-configured graph view
# .obsidian/workspace.json
.obsidian/workspace-mobile.json .obsidian/workspace-mobile.json
.obsidian/plugins/*/data.json .obsidian/plugins/*/data.json
.smart-connections/ .smart-connections/

View File

@@ -52,7 +52,7 @@
"centerStrength": 0.5, "centerStrength": 0.5,
"repelStrength": 20, "repelStrength": 20,
"linkStrength": 1, "linkStrength": 1,
"linkDistance": 120, "linkDistance": 385,
"scale": 1.1760790225246731, "scale": 0.3391745903861724,
"close": false "close": false
} }

230
.obsidian/workspace.json vendored Normal file
View File

@@ -0,0 +1,230 @@
{
"main": {
"id": "cb698273c33e48de",
"type": "split",
"children": [
{
"id": "2556036f92b81f42",
"type": "tabs",
"children": [
{
"id": "0ae3ce8edab2ab7f",
"type": "leaf",
"state": {
"type": "graph",
"state": {},
"icon": "lucide-git-fork",
"title": "Graph view"
}
},
{
"id": "c0d470cf50ffdf79",
"type": "leaf",
"state": {
"type": "graph",
"state": {},
"icon": "lucide-git-fork",
"title": "Graph view"
}
}
],
"currentTab": 1
}
],
"direction": "vertical"
},
"left": {
"id": "db8d83ac47ae599f",
"type": "split",
"children": [
{
"id": "554fd2b4fa6f8741",
"type": "tabs",
"children": [
{
"id": "5565f1231fe95c42",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical",
"autoReveal": false
},
"icon": "lucide-folder-closed",
"title": "Files"
}
},
{
"id": "832ab43d08cf9e30",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
},
"icon": "lucide-search",
"title": "Search"
}
},
{
"id": "097e8347bb8aa054",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {},
"icon": "lucide-bookmark",
"title": "Bookmarks"
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "7092b65be1e76349",
"type": "split",
"children": [
{
"id": "9f4de9402eae371b",
"type": "tabs",
"children": [
{
"id": "a32b7215b7814fbb",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-coming-in",
"title": "Backlinks"
}
},
{
"id": "7936f8ba26007091",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-going-out",
"title": "Outgoing links"
}
},
{
"id": "ed8ccb323a603d61",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true,
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-tags",
"title": "Tags"
}
},
{
"id": "b140a331162907cf",
"type": "leaf",
"state": {
"type": "all-properties",
"state": {
"sortOrder": "frequency",
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-archive",
"title": "All properties"
}
},
{
"id": "111a21e12ab1a293",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"followCursor": false,
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-list",
"title": "Outline"
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false,
"bases:Create new base": false
}
},
"active": "c0d470cf50ffdf79",
"lastOpenFiles": [
"README.md.tmp.224546.1775554365748",
"bin/setup-vault.sh",
"bin/setup-vault.sh.tmp.224546.1775554319795",
"bin",
"wiki/entities/_index.md",
"wiki/meta/dashboard.md",
"wiki/sources/_index.md",
"wiki/sources/Nate Herk LLM Wiki Transcript.md.tmp.224546.1775554051396",
"WIKI.md",
"wiki/Wiki Map.canvas.tmp.224546.1775553279818",
"wiki/sources/Nate Herk LLM Wiki Transcript.md.tmp.224546.1775553217829",
"wiki/entities/Andrej Karpathy.md.tmp.224546.1775553206364",
"wiki/concepts/Compounding Knowledge.md.tmp.224546.1775553195385",
"wiki/concepts/Hot Cache.md.tmp.224546.1775553185168",
"wiki/concepts/LLM Wiki Pattern.md.tmp.224546.1775553183707",
"wiki/concepts/_index.md",
"Welcome.md",
"README.md",
"CLAUDE.md",
"wiki/sources/Nate Herk LLM Wiki Transcript.md",
"wiki/entities/Andrej Karpathy.md",
"wiki/concepts/LLM Wiki Pattern.md",
"wiki/concepts/Hot Cache.md",
"wiki/concepts/Compounding Knowledge.md",
"wiki/overview.md",
"wiki/log.md",
"wiki/index.md",
"wiki/hot.md",
"wiki/Wiki Map.canvas",
"skills/wiki/references/rest-api.md",
"skills/wiki/references/plugins.md",
"skills/wiki/references/modes.md",
"skills/wiki/references/mcp-setup.md",
"skills/wiki/references/git-setup.md",
"skills/wiki/references/frontmatter.md",
"skills/wiki/references/css-snippets.md",
"skills/autoresearch/references/program.md"
]
}

View File

@@ -20,34 +20,43 @@ At the end of every session, Claude updates a hot cache. The next session starts
## Quick Start ## Quick Start
**Option 1: Clone and open as vault** ### Option 1: Clone as vault (recommended — full setup in 2 minutes)
```bash ```bash
git clone https://github.com/AgriciDaniel/cosmic-brain git clone https://github.com/AgriciDaniel/cosmic-brain
cd cosmic-brain
bash bin/setup-vault.sh
``` ```
Open the folder in Obsidian as a vault. Open it in Claude Code. Type `/wiki`. Open the folder in Obsidian: **Manage Vaults → Open folder as vault → select `cosmic-brain/`**
**Option 2: Install as plugin** Open Claude Code in the same folder. Type `/wiki`.
> `setup-vault.sh` configures `graph.json` (filter + colors), `app.json` (excludes plugin dirs), and `appearance.json` (enables CSS). Run it once before the first Obsidian open. You get the fully pre-configured graph view, color scheme, and wiki structure out of the box.
---
### Option 2: Install as Claude Code plugin
```bash ```bash
claude plugin install github:AgriciDaniel/cosmic-brain claude plugin install github:AgriciDaniel/cosmic-brain
``` ```
Then in any Claude Code session: `/wiki` In any Claude Code session: `/wiki` — Claude walks you through vault setup.
**Option 3: Add to existing vault** ---
Copy `WIKI.md` into your project root or `~/.claude/`. Paste this into Claude: ### Option 3: Add to an existing vault
Copy `WIKI.md` into your vault root. Paste into Claude:
``` ```
Read WIKI.md in this project. Then: Read WIKI.md in this project. Then:
1. Check if Obsidian is installed. If not, install it or walk me through it. 1. Check if Obsidian is installed. If not, install it.
2. Check if the Local REST API plugin is running (port 27124). If not, guide me through enabling it. 2. Check if the Local REST API plugin is running on port 27124.
3. Configure the MCP server so you can read and write my vault. 3. Configure the MCP server.
4. Ask me ONE question: "What is this vault for?" 4. Ask me ONE question: "What is this vault for?"
Then scaffold the full wiki structure.
Then build the entire wiki structure based on my answer.
``` ```
--- ---

85
bin/setup-vault.sh Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
# cosmic-brain vault setup script
# Run this ONCE before opening Obsidian for the first time.
# Usage: bash bin/setup-vault.sh [optional: /path/to/vault]
# Default: uses the directory where this script lives (the vault root)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VAULT="${1:-$(dirname "$SCRIPT_DIR")}"
OBSIDIAN="$VAULT/.obsidian"
echo "Setting up cosmic-brain vault at: $VAULT"
# ── 1. Create directories ─────────────────────────────────────────────────────
mkdir -p "$OBSIDIAN/snippets"
mkdir -p "$VAULT/.raw"
mkdir -p "$VAULT/wiki/concepts" "$VAULT/wiki/entities" "$VAULT/wiki/sources" "$VAULT/wiki/meta"
mkdir -p "$VAULT/_templates"
# ── 2. Write graph.json ───────────────────────────────────────────────────────
cat > "$OBSIDIAN/graph.json" << 'EOF'
{
"collapse-filter": false,
"search": "path:wiki",
"showTags": false,
"showAttachments": false,
"hideUnresolved": true,
"showOrphans": false,
"collapse-color-groups": false,
"colorGroups": [
{ "query": "path:wiki/entities", "color": { "a": 1, "rgb": 12945088 } },
{ "query": "path:wiki/concepts", "color": { "a": 1, "rgb": 5227007 } },
{ "query": "path:wiki/sources", "color": { "a": 1, "rgb": 6986069 } },
{ "query": "path:wiki/meta", "color": { "a": 1, "rgb": 5676246 } },
{ "query": "path:wiki", "color": { "a": 1, "rgb": 5676246 } }
],
"showArrow": true,
"textFadeMultiplier": -1,
"nodeSizeMultiplier": 1.8,
"lineSizeMultiplier": 1.2,
"centerStrength": 0.5,
"repelStrength": 30,
"linkStrength": 1.5,
"linkDistance": 120,
"scale": 1.0
}
EOF
# ── 3. Write app.json (excluded files) ───────────────────────────────────────
cat > "$OBSIDIAN/app.json" << 'EOF'
{
"userIgnoreFilters": [
"agents/",
"commands/",
"hooks/",
"skills/",
"_templates/",
"README.md",
"CLAUDE.md",
"WIKI.md",
"Welcome.md"
]
}
EOF
# ── 4. Write appearance.json (enable CSS snippet) ────────────────────────────
cat > "$OBSIDIAN/appearance.json" << 'EOF'
{
"enabledCssSnippets": ["vault-colors"]
}
EOF
echo ""
echo "Setup complete."
echo ""
echo "Next steps:"
echo " 1. Open Obsidian"
echo " 2. Manage Vaults → Open folder as vault → select: $VAULT"
echo " 3. Install community plugins: Dataview, Templater, Obsidian Git"
echo " 4. Type /wiki in Claude Code to scaffold your knowledge base"
echo ""
echo "Graph view will show only wiki pages, color-coded by type."
echo "If colors reset after closing Obsidian: open Graph settings → Color groups"
echo "and re-add them once. After that, they persist permanently."