Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
{
"name": "claudian",
"description": "Obsidian integration for Claude Code. Auto-saves conversation notes and decisions to your Obsidian vault.",
"version": "1.0.0",
"description": "Obsidian integration for Claude Code. Auto-saves conversation notes and decisions to your Obsidian vault (田中雄一郎OS保管庫).",
"version": "1.3.0",
"author": {
"name": "YUICHIRO TANAKA"
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/claudian/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "claudian",
"version": "1.0.0",
"description": "Obsidian integration for Claude Code. Auto-saves conversation notes and decisions to your Obsidian vault.",
"version": "1.3.0",
"description": "Obsidian integration for Claude Code. Auto-saves conversation notes and decisions to your Obsidian vault (田中雄一郎OS保管庫).",
"author": {
"name": "YUICHIRO TANAKA"
}
Expand Down
145 changes: 145 additions & 0 deletions plugins/claudian/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# claudian

Obsidian integration for Claude Code. Saves conversation notes and decisions to
the Obsidian vault **田中雄一郎OS保管庫**.

## Usage

```
/claudian:save # → 00_INBOX
/claudian:save KEEP 設計方針 # → 02_KEEP
/claudian:save 公開用 記事の下書き # → 03_PUBLIC
/claudian:save アーカイブ 旧メモ # → 99_ARCHIVE
```

The `obsidian-save` skill also fires on its own when a decision is finalized or
the user says「保存して」「これでいい」.

## Vault layout

Default aliases:

| folder value | directory |
|---|---|
| inbox (default) | `00_INBOX` |
| keep | `02_KEEP` |
| public | `03_PUBLIC` |
| archive | `99_ARCHIVE` |

### 保管庫を再編したとき

The mapping is data, not code — **reorganising the vault needs no change to
this plugin**. Put the new structure in `.claudian.json` at the root of
`田中雄一郎OS保管庫`:

```json
{
"folders": {
"inbox": "10_受信",
"project": "20_進行中/2026",
"archive": null
}
}
```

- Only the aliases you list change; the rest keep their defaults.
- `null` removes an alias, so a folder that no longer exists stops being a
valid save target instead of being silently recreated.
- Values are vault-relative paths (nesting allowed). Absolute paths and `..`
are rejected.
- Because the file lives **inside the vault**, the M1 and the M5 pick up the
same reorganisation as soon as the vault syncs. A per-machine `folders`
block in `~/.claudian/config.json` also works, but the vault's file wins.

Nothing to type by hand: run the scan **on the Mac that holds the vault** and it
reads the real structure and drafts the file for you.

```bash
# 1. 下書きを表示するだけ(何も書き込まない)
node plugins/claudian/scripts/obsidian-save.mjs --scan-folders

# 2. 内容を確認してから保管庫に保存
node plugins/claudian/scripts/obsidian-save.mjs --scan-folders --write
```

The scan keeps aliases that still point at a surviving folder, gives new
folders an alias derived from their name (`20_進行中` → `進行中`,
`03_PUBLIC` → `public`), and sets `null` for aliases whose folder is gone.
`--write` preserves any other keys already in `.claudian.json`.

Check what is live at any moment:

```bash
node plugins/claudian/scripts/obsidian-save.mjs --list-folders
```

While the structure is still in flux, save straight to a directory without
registering an alias:

```bash
node plugins/claudian/scripts/obsidian-save.mjs --title "…" --content "…" --dir "30_再編中/下書き"
```

Notes are written as `YYYY-MM-DD_タイトル.md` (local date) with `date` and
`tags` frontmatter. A same-day note with the same title never overwrites the
existing one — it becomes `..._2.md`, `..._3.md`, and so on.

## Setup on each Mac

The vault path is **not** hardcoded, so the MacBook Air M1 and the MacBook Air
M5 can keep the vault in different places. The script resolves it in this
order:

1. `--vault <path>` on the command line
2. `CLAUDIAN_VAULT_ROOT` environment variable
3. `vaultRoot` in `~/.claudian/config.json` (path overridable with `CLAUDIAN_CONFIG`)
4. Auto-detection of a directory named `田中雄一郎OS保管庫` under:
`~/TANAKA-BRAIN`, `~`, `~/Documents`,
`~/Library/Mobile Documents/iCloud~md~obsidian/Documents`,
`~/Library/Mobile Documents/com~apple~CloudDocs`, `~/Dropbox`,
`~/Google Drive`, `~/obsidian`

If the vault lives in one of those places, nothing to configure. Otherwise pin
it once per machine:

```bash
mkdir -p ~/.claudian
cat > ~/.claudian/config.json <<'JSON'
{ "vaultRoot": "~/TANAKA-BRAIN/田中雄一郎OS保管庫" }
JSON
```

or:

```bash
echo 'export CLAUDIAN_VAULT_ROOT="$HOME/TANAKA-BRAIN/田中雄一郎OS保管庫"' >> ~/.zshrc
```

A different vault name can be auto-detected with `CLAUDIAN_VAULT_NAME`.

When the vault cannot be found the save **fails loudly** instead of creating a
stray directory. Pass `--create-vault` only when the vault really should be
created at that path.

## Manual invocation

```bash
node plugins/claudian/scripts/obsidian-save.mjs \
--title "タイトル" \
--content "本文" \
--folder keep \
--tags "設計,決定"
```

| flag | meaning |
|---|---|
| `--folder <alias>` | Save under a registered alias (default `inbox`). |
| `--dir <相対パス>` | Save under a literal vault subdirectory, ignoring aliases. |
| `--list-folders` | Print the live alias → directory mapping and its sources. |
| `--scan-folders` | Read the vault and print a draft `.claudian.json` for its current structure. |
| `--write` | With `--scan-folders`, save that draft into the vault. |
| `--vault <path>` | Use this vault for one run. |
| `--create-vault` | Create the vault directory if it is missing. |

The saved filename is printed to stdout; the resolved vault directory and how
it was resolved go to stderr.
15 changes: 13 additions & 2 deletions plugins/claudian/commands/save.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ allowed-tools: Bash(node:*)

Save the current conversation context or the user's specified content to the Obsidian vault using the `claudian:obsidian-save` skill.

Folder selection:
Folder selection (default aliases — the vault's own `.claudian.json` may add,
rename, or remove them):
- Default (no keyword) → inbox
- `KEEP` or `設計原本` → keep
- `公開用` → public
- `アーカイブ` → archive

If the user names a folder outside that list, or the save reports
`--folder に未登録の名前が指定されました`, run
`node "${CLAUDE_PLUGIN_ROOT}/scripts/obsidian-save.mjs" --list-folders`
and retry with a live alias, or pass a vault-relative `--dir "20_進行中/2026"`.

Generate a concise Japanese title and 2–4 relevant tags automatically.

Run:
Expand All @@ -20,11 +26,16 @@ Run:
node "${CLAUDE_PLUGIN_ROOT}/scripts/obsidian-save.mjs" \
--title "<生成した日本語タイトル>" \
--content "<保存する内容>" \
--folder <inbox|keep|public|archive> \
--folder <inbox|keep|public|archive|…> \
--tags "<タグ1,タグ2>"
```

The vault (`田中雄一郎OS保管庫`) is resolved per machine by the script itself —
never pass `--vault` unless the user gives an explicit path.

Report the result as: `保存しました:<filename>`

If the command exits non-zero, report its error message as-is instead.

Raw user request:
$ARGUMENTS
Loading