@imunitic/synapse 0.2.11 → 0.2.13

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.
@@ -101,11 +101,11 @@ findings for the Step 6 proposal instead of a silent edit:
101
101
 
102
102
  - **Broken links** — every `vault-unresolved` row whose `source` is in scope. Before writing the
103
103
  finding, check the vault's own local git history to say *why* it's broken instead of leaving that
104
- to guesswork — the vault is usually a git repo (`db-sync` auto-commits every agent-driven edit into
105
- it, opt-in per vault, same precondition as that hook). Resolve the vault's filesystem path the same
106
- way `synapse.conf` already does (`SYNAPSE_VAULT_DIR`), skip this sub-step entirely if
107
- `{vault}/.git` doesn't exist, and never let a missing/unreachable git repo block the rest of the
108
- finding — worst case it's reported with no history context, same as today.
104
+ to guesswork — a `SYNAPSE_VAULT_STORE=git` vault has one, since every agent-driven edit commits
105
+ into it automatically. Resolve the vault's filesystem path the same way `synapse.conf` already does
106
+ (`SYNAPSE_VAULT_DIR`), skip this sub-step entirely if `{vault}/.git` doesn't exist, and never let a
107
+ missing/unreachable git repo block the rest of the finding — worst case it's reported with no
108
+ history context, same as today.
109
109
  - `git -C {vault} log --all --diff-filter=A --name-only --pretty=format: -- "**/{target}.md"` — a
110
110
  hit means a note by that exact title was created at some point (even if later renamed or
111
111
  deleted): report it as *"used to be a note — find what it's called now, or was deleted"*.
@@ -21,15 +21,6 @@
21
21
  }
22
22
  ],
23
23
  "PostToolUse": [
24
- {
25
- "matcher": "Write|Edit|Bash",
26
- "hooks": [
27
- {
28
- "type": "command",
29
- "command": "synapse-hook db-sync"
30
- }
31
- ]
32
- },
33
24
  {
34
25
  "matcher": "Write|Edit|MultiEdit",
35
26
  "hooks": [
@@ -21,15 +21,6 @@
21
21
  }
22
22
  ],
23
23
  "PostToolUse": [
24
- {
25
- "matcher": "apply_patch|Bash",
26
- "hooks": [
27
- {
28
- "type": "command",
29
- "command": "synapse-hook db-sync"
30
- }
31
- ]
32
- },
33
24
  {
34
25
  "matcher": "apply_patch",
35
26
  "hooks": [
@@ -101,11 +101,11 @@ findings for the Step 6 proposal instead of a silent edit:
101
101
 
102
102
  - **Broken links** — every `vault-unresolved` row whose `source` is in scope. Before writing the
103
103
  finding, check the vault's own local git history to say *why* it's broken instead of leaving that
104
- to guesswork — the vault is usually a git repo (a db-sync hook auto-commits every agent-driven edit
105
- into it, opt-in per vault, same precondition as that hook). Resolve the vault's filesystem path the
106
- same way its own conf file already does (`SYNAPSE_VAULT_DIR`), skip this sub-step entirely if
107
- `{vault}/.git` doesn't exist, and never let a missing/unreachable git repo block the rest of the
108
- finding — worst case it's reported with no history context, same as today.
104
+ to guesswork — a `SYNAPSE_VAULT_STORE=git` vault has one, since every agent-driven edit commits
105
+ into it automatically. Resolve the vault's filesystem path the same way its own conf file already
106
+ does (`SYNAPSE_VAULT_DIR`), skip this sub-step entirely if `{vault}/.git` doesn't exist, and never
107
+ let a missing/unreachable git repo block the rest of the finding — worst case it's reported with no
108
+ history context, same as today.
109
109
  - `git -C {vault} log --all --diff-filter=A --name-only --pretty=format: -- "**/{target}.md"` — a
110
110
  hit means a note by that exact title was created at some point (even if later renamed or
111
111
  deleted): report it as *"used to be a note — find what it's called now, or was deleted"*.
@@ -18,18 +18,11 @@
18
18
  // `tool.execute.after`'s real tool names/args, live-verified against a real
19
19
  // edit: `write` (`args.filePath`, `args.content`) and `edit` (`args.filePath`,
20
20
  // `args.oldString`, `args.newString`) -- both share `filePath`, matching
21
- // Claude Code's `Write`/`Edit` sharing `tool_input.file_path`. `db_sync.zig`
22
- // itself is a blind `git add -A && commit` against the vault's own repo, so
23
- // this plugin only needs to decide *whether* to fire it, not translate a
24
- // payload -- fired on the same write/edit tools, and on `bash` (`args.command`,
25
- // confirmed against `packages/core/src/tool/bash.ts` in the real
26
- // `sst/opencode` source) when the command actually names `synapse
27
- // vault-write`/`vault-patch` -- the CLI door skills use to reach the vault
28
- // (see `sb — Vault store backend selection`). Unlike Claude Code's/Codex's
29
- // `hooks.json`, which can only match a tool *name* and so must widen their
30
- // own matcher to `Bash` and let `db_sync.zig` filter the command text itself,
31
- // this plugin has the real args in hand before ever spawning the hook, so it
32
- // filters right here instead -- no spawn at all for an unrelated `bash` call.
21
+ // Claude Code's `Write`/`Edit` sharing `tool_input.file_path`. Fired on
22
+ // write/edit tools for `staleness` -- the vault's own version control
23
+ // (`SYNAPSE_VAULT_STORE=git`) commits from inside `synapse`'s own CLI
24
+ // (`vault-write`/`vault-patch`) itself now, needing no `PostToolUse`-style
25
+ // hook here or on any other harness.
33
26
  //
34
27
  // `stop-nudge`'s Claude Code trigger (`Stop`, once per turn) maps to
35
28
  // `session.idle` -- live-verified as firing exactly once, after every tool
@@ -108,15 +101,6 @@ async function alreadyInjected(client, sessionID) {
108
101
 
109
102
  const EDIT_TOOLS = new Set(["write", "edit"])
110
103
 
111
- // A `bash` call whose command names a `synapse vault-write`/`vault-patch`
112
- // invocation -- the substring check a real shell quoting/path prefix can't
113
- // evade in the cases that matter (`synapse vault-write ...`, `/path/to/synapse
114
- // vault-patch ...`), matching `db_sync.zig`'s own `shouldSkipBash` filter for
115
- // the harnesses that can't pre-filter on args the way this plugin can.
116
- function isVaultWriteCommand(command) {
117
- return typeof command === "string" && (command.includes("vault-write") || command.includes("vault-patch"))
118
- }
119
-
120
104
  // sessionID -> nudge text from a `stop-nudge` call that had nowhere to land
121
105
  // yet -- delivered on that session's next `chat.message`.
122
106
  const pendingNudge = new Map()
@@ -156,9 +140,6 @@ export const Synapse = async ({ directory, client }) => {
156
140
  session_id: input.sessionID,
157
141
  tool_input: { file_path: filePath },
158
142
  })
159
- runHook("db-sync", {});
160
- } else if (input.tool === "bash" && isVaultWriteCommand(input.args?.command)) {
161
- runHook("db-sync", {});
162
143
  }
163
144
  },
164
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imunitic/synapse",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Memory for Claude Code, Codex CLI, and OpenCode: a durable Obsidian vault plus a per-repo code graph.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,9 +22,9 @@
22
22
  "*.conf.template"
23
23
  ],
24
24
  "optionalDependencies": {
25
- "@imunitic/synapse-darwin-arm64": "0.2.11",
26
- "@imunitic/synapse-linux-x64": "0.2.11",
27
- "@imunitic/synapse-linux-arm64": "0.2.11"
25
+ "@imunitic/synapse-darwin-arm64": "0.2.13",
26
+ "@imunitic/synapse-linux-x64": "0.2.13",
27
+ "@imunitic/synapse-linux-arm64": "0.2.13"
28
28
  },
29
29
  "license": "SEE LICENSE IN LICENSE"
30
30
  }
@@ -90,9 +90,10 @@ verification that cannot fail in the direction you are worried about is not a ve
90
90
 
91
91
  ## If you do destroy something
92
92
 
93
- `synapse-hook db-sync` auto-commits every vault edit, so the intact version is one
94
- `git show <sha>:<path>` away in the vault's own git history. That hook is a vault-wide undo for
95
- destructive tool calls, not merely a record of intentional edits.
93
+ On a `SYNAPSE_VAULT_STORE=git` vault, every edit commits automatically, so the intact version is one
94
+ `git show <sha>:<path>` away in the vault's own git history -- a vault-wide undo for destructive tool
95
+ calls, not merely a record of intentional edits. The default `disk` backend keeps no history at all,
96
+ so this safety net only exists once that backend is chosen.
96
97
 
97
98
  ## Tagging is part of writing a note, not a separate pass
98
99
 
package/synapse-claude.md CHANGED
@@ -17,8 +17,11 @@ seeding the vault's foundational bootstrap file warrants a confirmation
17
17
  step the way an ordinary note-write doesn't.
18
18
 
19
19
  **This is a primary, load-bearing memory system, not an optional nicety.**
20
- Actively use it — don't wait to be asked. You MUST create or update a note
21
- whenever, during a session, any of the following happens. Before deciding
20
+ Actively use it — don't wait to be asked, and don't wait for a hook to
21
+ remind you either: the periodic nudge below is a backstop for a session
22
+ that runs long and drifts, not the trigger that authorizes writing in the
23
+ first place. You MUST create or update a note whenever, during a session,
24
+ any of the following happens. Before deciding
22
25
  which folder, check `Index.md`'s folder list for the matching category —
23
26
  don't rely on categories already in memory from earlier in the session,
24
27
  since a vault owner's own `Index.md` is the only authority on what exists
@@ -98,8 +101,10 @@ The vault is reached through the `synapse` CLI — `synapse vault-read`/`vault-w
98
101
  `vault-search`/`vault-search-text`/`vault-doc-map`/`vault-patch`/`vault-backlinks`/`vault-links`/
99
102
  `vault-unresolved`/`vault-orphans`/`vault-deadends`/`vault-ambiguous`/`vault-rename` — for reads
100
103
  *and* for writes, never by resolving a vault path or calling an `mcp__obsidian__*` tool directly.
101
- Which concrete store the CLI talks to (`SYNAPSE_VAULT_STORE=disk`, the default; or `obsidian`,
102
- opted into for a running Obsidian app's own live search relevance and graph data) is resolved once,
104
+ Which concrete store the CLI talks to (`SYNAPSE_VAULT_STORE=disk`, the default; `obsidian`, opted
105
+ into for a running Obsidian app's own live search relevance and graph data; or `git`, opted into for
106
+ the vault to own its own version control -- commit on every write, push/pull in the background) is
107
+ resolved once,
103
108
  inside the compiled binary, from `SYNAPSE_VAULT_STORE`/`SYNAPSE_VAULT_DIR` — never something a skill
104
109
  or an agent turn needs to know or branch on. By default that means no Obsidian dependency
105
110
  whatsoever: `read`/`write`/`list`/`search`/the link graph/rename are all plain disk I/O and direct