@imunitic/synapse 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/synapse-claude.md CHANGED
@@ -3,9 +3,9 @@
3
3
  The user keeps a permanent, curated knowledge base — **Synapse Vault** —
4
4
  as a memory system separate from and complementary to the `~/.claude`
5
5
  auto-memory system: use the Vault for durable, browsable
6
- knowledge-base notes, not for session bookkeeping. It's an Obsidian vault,
7
- running headless at login with the Local REST API plugin installed see
8
- "Reading and writing the vault" below for how to reach it. A SessionStart hook
6
+ knowledge-base notes, not for session bookkeeping. Reach it through the
7
+ `synapse` CLI's `vault-*` subcommands, never a raw file edit or an MCP tool
8
+ call — see "Reading and writing the vault" below for why. A SessionStart hook
9
9
  already injects the vault's `Index.md` at the start of every session, so
10
10
  you shouldn't need to go read it yourself. Don't re-read it reflexively,
11
11
  but do treat its injected contents as live information, not background
@@ -94,39 +94,37 @@ a real yes/no answer, not a formality to wave past.
94
94
 
95
95
  ## Reading and writing the vault
96
96
 
97
- Obsidian runs headless at login (via a startup plugin) with the Claude
98
- vault already open, and the Local REST API plugin is installed there —
99
- this is the only valid way to reach the vault, for reads *and* for
100
- writes, and it always targets whichever vault is currently open in the
101
- running Obsidian instance, not a hardcoded path. The `obsidian` MCP
102
- server wraps that REST API. Do not resolve or care about
103
- `$OBSIDIAN_VAULT_DIR` (see `~/.claude/synapse.conf`) unless the MCP tools
104
- are erroring or unavailable and you must fall back to grepping files on
105
- disk directly — that path variable matters only for that fallback case,
106
- since the vault is also reachable as plain files on disk at that
107
- location.
108
-
109
- **Every write to a note goes through `mcp__obsidian__vault_write` or
110
- `vault_patch`. Never the `Write`/`Edit` tools on the on-disk path** not
111
- for a one-line change, and least of all when those tools are already in
112
- hand from editing code earlier in the same turn, because that proximity
113
- is precisely what causes this to be violated. The vault being an ordinary
114
- directory means the wrong path *works*: Obsidian's file watcher
115
- converges, the auto-commit hook matches `Write|Edit` as well as the MCP
116
- tools, and nothing visibly breakswhich is why the habit never
117
- self-corrects on its own. The reason is not a failure mode to dodge; it
118
- is that an invariant upheld only when convenient is worth nothing.
119
- Nothing else in the system can rely on it, and every note then has to be
120
- re-checked by hand instead of trusted. Synapse's own tooling holds this
121
- line `synapse write-node` curls the same REST API rather than
122
- writing files directly so agent writes have no reason to differ.
123
-
124
- If a project's `.claude.json` `mcpServers.obsidian` entry ever diverges
125
- from the user-scoped one (e.g. points at the wrong vault path via a stdio
126
- `obsidian-mcp` package instead of the REST API), that's a bug in that
127
- project's config, not a Synapse Vault routing choice — fix it by removing
128
- the project-level override so the correct user-scoped REST API server
129
- applies.
97
+ The vault is reached through the `synapse` CLI `synapse vault-read`/`vault-write`/`vault-list`/
98
+ `vault-search`/`vault-search-text`/`vault-doc-map`/`vault-patch` for reads *and* for writes, never
99
+ by resolving a vault path or calling an `mcp__obsidian__*` tool directly. Which concrete store the
100
+ CLI talks to (today, an Obsidian vault via its Local REST API; potentially a plain-disk vault later)
101
+ is resolved once, inside the compiled binary, from `SYNAPSE_VAULT_STORE`/`SYNAPSE_VAULT_DIR` — never
102
+ something a skill or an agent turn needs to know or branch on. Today that means Obsidian running
103
+ headless at login (via a startup plugin) with the Local REST API plugin installed, and the CLI
104
+ reaching it over that REST API; a future disk-backed vault would need no change to any skill or to
105
+ this document.
106
+
107
+ **Every write to a note goes through `synapse vault-write` or `vault-patch`. Never the `Write`/`Edit`
108
+ tools on the on-disk path, and never a raw `mcp__obsidian__*` tool call either** — not for a one-line
109
+ change, and least of all when `Write`/`Edit` are already in hand from editing code earlier in the
110
+ same turn, because that proximity is precisely what causes this to be violated. The vault being an
111
+ ordinary directory means the wrong path *works*: Obsidian's file watcher converges, the auto-commit
112
+ hook matches `Write|Edit`/`Bash` running `vault-write`/`vault-patch` as well as the MCP tools, and
113
+ nothing visibly breaks — which is why the habit never self-corrects on its own. The reason is not a
114
+ failure mode to dodge; it is that an invariant upheld only when convenient is worth nothing. Nothing
115
+ else in the system can rely on it, and every note then has to be re-checked by hand instead of
116
+ trusted. Synapse's own tooling holds this line `synapse write-node` goes through the same `Store`
117
+ abstraction the CLI does, rather than writing files directly so agent writes have no reason to
118
+ differ. If the CLI itself ever fails (not installed, no vault configured), that's a real precondition
119
+ failure to report and stop on, never a reason to fall back to a raw file edit.
120
+
121
+ The `obsidian` MCP server (wrapping the same Local REST API) still exists and is still the right
122
+ tool for a command that hasn't been migrated onto the CLI's `vault-*` subcommands yet (`/synapse-vault-tidy`, as of
123
+ this writing — it needs whole-vault link/backlink data the CLI doesn't expose). If a project's
124
+ `.claude.json` `mcpServers.obsidian` entry ever diverges from the user-scoped one (e.g. points at the
125
+ wrong vault path via a stdio `obsidian-mcp` package instead of the REST API), that's a bug in that
126
+ project's config, not a Synapse Vault routing choice fix it by removing the project-level override
127
+ so the correct user-scoped REST API server applies.
130
128
 
131
129
  - You may create and edit notes in this vault **without asking for
132
130
  permission first**, as long as each note is placed in the folder
@@ -188,7 +186,7 @@ applies.
188
186
  `/synapse-note --task` (or compile one from a `Ready` design note with
189
187
  `/synapse-task-note`), and make every status transition, checklist edit,
190
188
  or `## Notes` append only through the `synapse-task` skill's own
191
- procedure — never a bare `vault_write`/`vault_patch` on a task note, not
189
+ procedure — never a bare `vault-write`/`vault-patch` on a task note, not
192
190
  even mid-session, not even for a quick update. Bypassing the command/skill
193
191
  doesn't just risk drifting from the checklist-items-plus-`## Notes`
194
192
  skeleton every other task note shares — the skill is also where the
@@ -200,17 +198,19 @@ applies.
200
198
 
201
199
  ## Searching notes
202
200
 
203
- Prefer the `mcp__obsidian__` MCP tools over raw file grepping — they're
204
- live against the running vault and don't require re-deriving paths:
205
-
206
- - `mcp__obsidian__search_simple` — full-text search with relevance scoring
207
- and match context, for "does a note about X already exist" checks.
208
- - `mcp__obsidian__search_query` — JsonLogic queries over note metadata
209
- (frontmatter fields, tags, links, backlinks, path globs) when you need a
210
- structured filter rather than free text, e.g. finding all notes with a
211
- given `task_id` or `status`.
212
- - `mcp__obsidian__vault_list` / `vault_read` for direct navigation when you
213
- already know roughly where something is.
201
+ Prefer `synapse vault-search-text`/`vault-search` over raw file grepping — they read the vault
202
+ directly and don't require re-deriving paths:
203
+
204
+ - `synapse vault-search-text <query>` — full-text search with relevance scoring and match context,
205
+ for "does a note about X already exist" checks.
206
+ - `synapse vault-search --fields <f1,f2,...>` — JsonLogic queries over note metadata (frontmatter
207
+ fields, tags, content, path globs not `links`/`backlinks`, which no CLI subcommand exposes yet)
208
+ when you need a structured filter rather than free text, e.g. finding all notes with a given
209
+ `task_id` or `status`. `--fields` projects exactly the columns needed back in the same call, so a
210
+ follow-up read is rarely necessary.
211
+ - `synapse vault-list` / `vault-read` for direct navigation when you already know roughly where
212
+ something is. `synapse vault-doc-map <path>` lists a note's heading paths, block ids, and
213
+ frontmatter keys, for picking a real `vault-patch` target instead of guessing one.
214
214
 
215
215
  # Git commits
216
216
 
@@ -1,5 +1,5 @@
1
1
  # Copy this to ~/.claude/synapse.conf and edit the path for this machine.
2
- OBSIDIAN_VAULT_DIR="$HOME/Obsidian/YourVault"
2
+ SYNAPSE_VAULT_DIR="$HOME/Obsidian/YourVault"
3
3
 
4
4
  # Where Synapse clones/builds tree-sitter grammars (shared across every
5
5
  # project -- not per-repo). Safe to leave at the default.