@imunitic/synapse 0.4.3 → 0.4.5

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.
@@ -153,7 +153,7 @@ emit into tool calls than read into a window. Never hand-author those.
153
153
 
154
154
  **Load the `synapse-orientation` skill** for how to read the vocabulary, the four questions that
155
155
  cover a tree with no grammar, and the grammar-discovery procedure. It is shared with
156
- `/synapse-rebuild`'s re-orient class, which needs the same technique.
156
+ `/synapse-rebuild-diff`'s re-orient class, which needs the same technique.
157
157
  4. **Cluster into nodes — write `manifest.tsv`, the seam.** Group what you learned into a few dozen
158
158
  readable nodes, not one per file — same density Graft aims for. A node is a subsystem or concept,
159
159
  not a file; a file may legitimately belong to more than one node's `sources` when it's genuinely
@@ -249,7 +249,7 @@ emit into tool calls than read into a window. Never hand-author those.
249
249
  **Load the `synapse-node-format` skill too, before writing the first one** — it is the
250
250
  single description of the node contract itself (summary, the crux *pointer*, `## Links`,
251
251
  `grounded_in`, what the writer adds and what it refuses), shared with the `synapse-node`
252
- skill and `/synapse-rebuild`, which write the same artifact. `synapse-node-authoring`
252
+ skill and `/synapse-rebuild-diff`, which write the same artifact. `synapse-node-authoring`
253
253
  covers *how* nodes get written; this covers *what* one is. Do not re-derive either from an
254
254
  existing node: a node you are reading may predate a change to its format.
255
255
  8. **Write `_index.bin`** — mechanics, run `synapse build-index`. It emits
@@ -105,6 +105,12 @@ const EDIT_TOOLS = new Set(["write", "edit"])
105
105
  // yet -- delivered on that session's next `chat.message`.
106
106
  const pendingNudge = new Map()
107
107
 
108
+ // sessionID -> queued `staleness` output, same reason and same delivery as
109
+ // `pendingNudge` above: `tool.execute.after` has no message `output` to push
110
+ // a part onto, so a drift/grounding warning from it would otherwise be
111
+ // silently discarded instead of just reaching the next turn late.
112
+ const pendingStaleness = new Map()
113
+
108
114
  export const Synapse = async ({ directory, client }) => {
109
115
  return {
110
116
  "chat.message": async (input, output) => {
@@ -123,6 +129,12 @@ export const Synapse = async ({ directory, client }) => {
123
129
  newParts.push(textPart(sessionID, output, `[SYNAPSE-STOP-NUDGE]\n${queuedNudge}`))
124
130
  }
125
131
 
132
+ const queuedStaleness = pendingStaleness.get(sessionID)
133
+ if (queuedStaleness) {
134
+ pendingStaleness.delete(sessionID)
135
+ newParts.push(textPart(sessionID, output, `[SYNAPSE-STALENESS]\n${queuedStaleness}`))
136
+ }
137
+
126
138
  const promptText = (output.parts || [])
127
139
  .filter((p) => p.type === "text")
128
140
  .map((p) => p.text)
@@ -136,10 +148,11 @@ export const Synapse = async ({ directory, client }) => {
136
148
  "tool.execute.after": async (input) => {
137
149
  const filePath = input.args?.filePath
138
150
  if (EDIT_TOOLS.has(input.tool) && filePath) {
139
- runHook("staleness", {
151
+ const text = runHook("staleness", {
140
152
  session_id: input.sessionID,
141
153
  tool_input: { file_path: filePath },
142
154
  })
155
+ if (text) pendingStaleness.set(input.sessionID, text)
143
156
  }
144
157
  },
145
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imunitic/synapse",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Memory for Claude Code, Codex CLI, and OpenCode: a durable markdown vault plus a per-repo code graph.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,9 +23,9 @@
23
23
  "*.conf.template"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@imunitic/synapse-darwin-arm64": "0.4.3",
27
- "@imunitic/synapse-linux-x64": "0.4.3",
28
- "@imunitic/synapse-linux-arm64": "0.4.3"
26
+ "@imunitic/synapse-darwin-arm64": "0.4.5",
27
+ "@imunitic/synapse-linux-x64": "0.4.5",
28
+ "@imunitic/synapse-linux-arm64": "0.4.5"
29
29
  },
30
30
  "license": "SEE LICENSE IN LICENSE"
31
31
  }
@@ -71,7 +71,7 @@ needs one.
71
71
  4. **Regeneration (only if step 1 or 2 found the node stale).** You re-author the prose; a script
72
72
  writes the file. **The node contract itself — frontmatter fields, the crux pointer, `## Links`,
73
73
  `grounded_in` — is the `synapse-node-format` skill**, shared with `/synapse-init` and
74
- `/synapse-rebuild`. What follows here is only what differs when *re*-authoring an existing
74
+ `/synapse-rebuild-diff`. What follows here is only what differs when *re*-authoring an existing
75
75
  node rather than writing a new one. Everything mechanical — hashes, `sources_digest`, the `## Sources` mirror,
76
76
  `built_at`, `commit`, `stale: false`, and preserving `## Notes` — belongs to
77
77
  `synapse write-node`, because a hub node's `sources` can no more be *emitted* into a tool call
@@ -105,7 +105,7 @@ needs one.
105
105
  first (exit 0 use the tags, exit 1 fall back to reading the file, exit 2 run the discovery
106
106
  procedure `/synapse-init` documents, then retry), and read the load-bearing files in full — the
107
107
  tags signal informs regrouping, it never substitutes for reading a file before rewriting its prose.
108
- If this is happening across many nodes at once, stop and run `/synapse-rebuild` instead: that is
108
+ If this is happening across many nodes at once, stop and run `/synapse-rebuild-diff` instead: that is
109
109
  the instrument for major drift, and it triages node by node rather than paying full cost for each.
110
110
  - Re-author `## Summary`, `## Crux` and `## Links` to match what the files contain now, into
111
111
  `$W/body.md`. Re-check the node's one-line `summary` as well; keep the existing one with
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: synapse-node-format
3
- description: The contract for a Synapse code-graph node — frontmatter fields, the crux pointer, `## Links`, `grounded_in`, `## Sources`, and what `synapse write-node` adds or refuses. Load before authoring or regenerating any node, whether from /synapse-init's first build, /synapse-rebuild's triage, or the synapse-node skill's lazy regeneration. Not for reading the graph (that is synapse-query) or for task notes in the vault (that is synapse-task).
3
+ description: The contract for a Synapse code-graph node — frontmatter fields, the crux pointer, `## Links`, `grounded_in`, `## Sources`, and what `synapse write-node` adds or refuses. Load before authoring or regenerating any node, whether from /synapse-init's first build, /synapse-rebuild-diff's triage, or the synapse-node skill's lazy regeneration. Not for reading the graph (that is synapse-query) or for task notes in the vault (that is synapse-task).
4
4
  ---
5
5
 
6
6
  # What a node is, and how to author one
7
7
 
8
8
  Every component that writes a node loads this: `/synapse-init` (first build), the `synapse-node`
9
- skill (Tier 2 lazy regeneration), and `/synapse-rebuild` (reseat, patch, re-orient).
9
+ skill (Tier 2 lazy regeneration), and `/synapse-rebuild-diff` (reseat, patch, re-orient).
10
10
 
11
11
  All three write the same artifact, so the format belongs in one place rather than being restated
12
12
  wherever it is used. What stays with each caller is what is genuinely specific to it — the skill's
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: synapse-orientation
3
- description: How to work out where meaning lives in a codebase you have not seen before — first mechanically, from the repo's own symbol vocabulary, and where no grammar exists, by four questions in order with the cheap commands that answer each. Includes tree-sitter grammar discovery. Use when clustering a repo into Synapse graph nodes for the first time, when re-deriving a node's premises in /synapse-rebuild's re-orient class, or any time you need to orient in an unfamiliar tree before making claims about it.
3
+ description: How to work out where meaning lives in a codebase you have not seen before — first mechanically, from the repo's own symbol vocabulary, and where no grammar exists, by four questions in order with the cheap commands that answer each. Includes tree-sitter grammar discovery. Use when clustering a repo into Synapse graph nodes for the first time, when re-deriving a node's premises in /synapse-rebuild-diff's re-orient class, or any time you need to orient in an unfamiliar tree before making claims about it.
4
4
  ---
5
5
 
6
6
  # Orienting in an unfamiliar repo
7
7
 
8
- Loaded by `/synapse-init` at its orientation step, and by `/synapse-rebuild` when a node lands in
8
+ Loaded by `/synapse-init` at its orientation step, and by `/synapse-rebuild-diff` when a node lands in
9
9
  the *re-orient* class and its premises have to be re-derived rather than patched. Useful on its own
10
10
  terms too: nothing here is Synapse-specific except what you do with the answers.
11
11