synabun 2026.4.21 → 2026.4.25-beta.2
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/CHANGELOG.md +175 -881
- package/README.md +1 -1
- package/hooks/claude-code/prompt-submit.mjs +39 -18
- package/hooks/claude-code/session-start.mjs +10 -3
- package/hooks/claude-code/shared.mjs +39 -2
- package/hooks/claude-code/stop.mjs +33 -6
- package/mcp-server/src/index.ts +9 -1
- package/mcp-server/src/services/neural-interface.ts +42 -14
- package/mcp-server/src/services/profiles.ts +8 -7
- package/mcp-server/src/tools/browser-advanced.ts +12 -10
- package/mcp-server/src/tools/browser-interact.ts +39 -38
- package/mcp-server/src/tools/browser-navigate.ts +12 -4
- package/mcp-server/src/tools/loop.ts +7 -3
- package/mcp-server/src/tools/profile.ts +19 -1
- package/neural-interface/lib/loop-logger.js +103 -0
- package/neural-interface/lib/mcp-installer.js +109 -0
- package/neural-interface/lib/plugin-installer.js +264 -0
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/shared/api.js +66 -17
- package/neural-interface/public/shared/cdx/cdx-icons.js +5 -4
- package/neural-interface/public/shared/cdx/cdx-panel.js +117 -14
- package/neural-interface/public/shared/cdx/cdx-render.js +170 -43
- package/neural-interface/public/shared/cdx/cdx-styles.js +55 -10
- package/neural-interface/public/shared/cdx/cdx-tabs.js +394 -72
- package/neural-interface/public/shared/cli-status.js +157 -0
- package/neural-interface/public/shared/constants.js +3 -2
- package/neural-interface/public/shared/html-shell.js +32 -11
- package/neural-interface/public/shared/ocp/ocp-panel.js +127 -28
- package/neural-interface/public/shared/ocp/ocp-render.js +52 -44
- package/neural-interface/public/shared/ocp/ocp-styles.js +33 -0
- package/neural-interface/public/shared/ocp/ocp-tabs.js +693 -82
- package/neural-interface/public/shared/styles.css +635 -0
- package/neural-interface/public/shared/ui-automation-studio.js +38 -12
- package/neural-interface/public/shared/ui-claude-panel.js +322 -15
- package/neural-interface/public/shared/ui-file-explorer.js +38 -18
- package/neural-interface/public/shared/ui-menubar.js +34 -10
- package/neural-interface/public/shared/ui-navbar.js +8 -6
- package/neural-interface/public/shared/ui-schedules-studio.js +1464 -0
- package/neural-interface/public/shared/ui-settings.js +274 -50
- package/neural-interface/public/shared/ui-sidepanel-layout.js +18 -7
- package/neural-interface/public/shared/ui-sidepanel-tray.js +287 -0
- package/neural-interface/public/shared/ui-sync.js +9 -5
- package/neural-interface/public/shared/ui-terminal.js +76 -27
- package/neural-interface/public/shared/ui-tool-updates.js +49 -15
- package/neural-interface/public/shared/ui-tutorial-steps.js +4 -2
- package/neural-interface/public/shared/ui-tutorial.js +24 -18
- package/neural-interface/public/shared/ui-whiteboard.js +79 -31
- package/neural-interface/public/shared/vterm-buffer.js +9 -8
- package/neural-interface/public/variant/2d/main.js +9 -7
- package/neural-interface/public/variant/3d/main.js +10 -8
- package/neural-interface/server.js +1292 -255
- package/package.json +1 -1
- package/skills/leonardo/SKILL.md +5 -1
- package/skills/leonardo/modules/image-prompter.md +5 -1
- package/skills/leonardo/modules/video-prompter.md +5 -1
- package/skills/synabun/SKILL.md +44 -26
- package/skills/synabun/modules/audit.md +40 -36
- package/skills/synabun/modules/changelog.md +22 -18
- package/skills/synabun/modules/memorize.md +19 -15
- package/skills/synabun/modules/schedule.md +285 -0
- package/CLAUDE.md +0 -217
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Schedule Wizard — AI-Driven Schedule Creation
|
|
2
|
+
|
|
3
|
+
You are now in **schedule wizard mode**. Your job is to walk the user through creating a new SynaBun schedule end-to-end via interactive option cards, then create the underlying loop-template (if needed) and the schedule itself via REST. The Schedules Studio refreshes automatically through WebSocket sync — no manual reload needed.
|
|
4
|
+
|
|
5
|
+
**Input hint**: $ARGUMENTS (optional free-text describing the goal — may be empty)
|
|
6
|
+
|
|
7
|
+
## CRITICAL: Tool Quirks
|
|
8
|
+
|
|
9
|
+
- All SynaBun MCP calls **sequentially** (never parallel — one failure cascades).
|
|
10
|
+
- `remember` accepts `tags` and `importance` directly and returns the full UUID.
|
|
11
|
+
- `reflect` requires the **FULL UUID**.
|
|
12
|
+
- Make every interactive prompt an **interactive option card**, NEVER plain text. The Claude sidepanel renders plain-text choices as static markdown.
|
|
13
|
+
|
|
14
|
+
## Runtime Compatibility — Interactive Choice Prompt
|
|
15
|
+
|
|
16
|
+
- **Claude Code (REQUIRED path):** `AskUserQuestion` is a deferred tool. Before the first prompt, call `ToolSearch` with query `select:AskUserQuestion` to load it. Then call `AskUserQuestion` with 2-4 options per question, max 4 questions per turn.
|
|
17
|
+
- **OpenCode (REQUIRED path):** call the native `question` tool.
|
|
18
|
+
- **Codex (REQUIRED path):** call `request_user_input`.
|
|
19
|
+
- Never write the choices as plain text.
|
|
20
|
+
|
|
21
|
+
## API Endpoints (use `Bash` curl)
|
|
22
|
+
|
|
23
|
+
Base URL: `http://localhost:3344`
|
|
24
|
+
|
|
25
|
+
| Endpoint | Method | Purpose |
|
|
26
|
+
|----------|--------|---------|
|
|
27
|
+
| `/api/loop/templates` | GET | List existing templates |
|
|
28
|
+
| `/api/loop/templates` | POST | Create new template |
|
|
29
|
+
| `/api/schedules` | GET | List existing schedules (avoid duplicates) |
|
|
30
|
+
| `/api/schedules` | POST | Create schedule |
|
|
31
|
+
| `/api/schedule-groups` | GET | List groups |
|
|
32
|
+
| `/api/schedule-groups` | POST | Create group |
|
|
33
|
+
|
|
34
|
+
All bodies are JSON. All responses are JSON.
|
|
35
|
+
|
|
36
|
+
### Template payload (POST `/api/loop/templates`)
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"name": "Morning Native Post",
|
|
41
|
+
"description": "Twitter daily content publisher",
|
|
42
|
+
"task": "<full task instructions for the AI to run on every schedule fire>",
|
|
43
|
+
"iterations": 50,
|
|
44
|
+
"maxMinutes": 120,
|
|
45
|
+
"usesBrowser": true,
|
|
46
|
+
"icon": "twitter",
|
|
47
|
+
"category": "social",
|
|
48
|
+
"profile": "claude-code",
|
|
49
|
+
"model": "claude-sonnet-4-6",
|
|
50
|
+
"effort": "off",
|
|
51
|
+
"mcpProfile": "full"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Returned object includes `id` — capture it for the schedule.
|
|
56
|
+
|
|
57
|
+
### Schedule payload (POST `/api/schedules`)
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"name": "Morning Native Post",
|
|
62
|
+
"templateId": "<id from template POST>",
|
|
63
|
+
"cron": "0 8 * * *",
|
|
64
|
+
"timezone": "America/Sao_Paulo",
|
|
65
|
+
"enabled": true,
|
|
66
|
+
"groupId": null,
|
|
67
|
+
"profile": "claude-code",
|
|
68
|
+
"model": "claude-sonnet-4-6",
|
|
69
|
+
"effort": "off",
|
|
70
|
+
"usesBrowser": true,
|
|
71
|
+
"dayThemes": {}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`profile`, `model`, `effort`, `usesBrowser` on the schedule are **launch overrides** — set only when the user wants them different from the template defaults; otherwise omit (or null).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Phase 0 — Boot
|
|
80
|
+
|
|
81
|
+
Execute sequentially:
|
|
82
|
+
|
|
83
|
+
1. `recall` query `"schedule loop template platform cadence"` with `limit: 5`. Surface relevant prior schedule patterns for context.
|
|
84
|
+
2. `Bash`: `curl -s http://localhost:3344/api/loop/templates` → cache as `$TEMPLATES`.
|
|
85
|
+
3. `Bash`: `curl -s http://localhost:3344/api/schedule-groups` → cache as `$GROUPS`.
|
|
86
|
+
4. `Bash`: `curl -s http://localhost:3344/api/schedules` → cache as `$SCHEDULES` (just for awareness, avoid creating obvious duplicates).
|
|
87
|
+
5. Detect timezone — `Bash`: `readlink /etc/localtime | sed -E 's|.*/zoneinfo/||'` to get the IANA name. Fall back to `America/Sao_Paulo` only if detection fails.
|
|
88
|
+
|
|
89
|
+
Brief one-line greeting to the user: "Schedule Wizard — let's build this in 5 quick steps."
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 1 — Goal Capture
|
|
94
|
+
|
|
95
|
+
Use ONE interactive choice prompt with ONE question:
|
|
96
|
+
|
|
97
|
+
- **Question**: "What should this schedule do?"
|
|
98
|
+
- **Header**: "Goal"
|
|
99
|
+
- **Options** (multiSelect: false):
|
|
100
|
+
- **Social posting** — "Post to a social platform on a recurring cadence"
|
|
101
|
+
- **Lead miner** — "Scrape / discover leads or signals on a schedule"
|
|
102
|
+
- **Content publisher** — "Generate and publish content on a cadence"
|
|
103
|
+
- **Custom** — "Something else — describe in Other"
|
|
104
|
+
|
|
105
|
+
If user picks "Other", capture free text as the goal description.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Phase 2 — Template Match or Create
|
|
110
|
+
|
|
111
|
+
Fuzzy-match the goal against `$TEMPLATES` by name + description + task.
|
|
112
|
+
|
|
113
|
+
### If a strong match exists (>1 candidate)
|
|
114
|
+
|
|
115
|
+
Interactive choice prompt:
|
|
116
|
+
- **Question**: "Use an existing automation or create a new one?"
|
|
117
|
+
- **Header**: "Template"
|
|
118
|
+
- **Options** (multiSelect: false):
|
|
119
|
+
- **Use `<best match name>`** — "Reuse this existing automation, adjust only the schedule"
|
|
120
|
+
- **Use `<second match name>`** — (only if exists) "Reuse this existing automation"
|
|
121
|
+
- **Create new** — "Build a new automation tailored to your goal"
|
|
122
|
+
|
|
123
|
+
### If creating new (or no match)
|
|
124
|
+
|
|
125
|
+
Interactive choice prompt with TWO questions in one card:
|
|
126
|
+
- Q1 **Platform** (header "Platform"):
|
|
127
|
+
- Twitter / Facebook / LinkedIn / Instagram / Custom (Other)
|
|
128
|
+
- Q2 **Browser** (header "Browser") — multiSelect false:
|
|
129
|
+
- **Yes** — "This automation needs the SynaBun browser session"
|
|
130
|
+
- **No** — "Headless / pure-LLM task, no browser"
|
|
131
|
+
|
|
132
|
+
Then internally draft the `task` field — a complete instruction block for the loop AI. Include:
|
|
133
|
+
- Goal sentence
|
|
134
|
+
- Platform context
|
|
135
|
+
- Output rules (formatting, language matching, link placement)
|
|
136
|
+
- Memory storage block telling the loop AI to call `remember` with a sensible category + tags after each iteration
|
|
137
|
+
|
|
138
|
+
Build `description`, `name`, `icon` (twitter/facebook/linkedin/instagram/sparkle), `category` (social / leads / content / custom).
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Phase 3 — Cadence
|
|
143
|
+
|
|
144
|
+
Interactive choice prompt:
|
|
145
|
+
- **Question**: "How often should it run?"
|
|
146
|
+
- **Header**: "Cadence"
|
|
147
|
+
- **Options** (multiSelect: false):
|
|
148
|
+
- **Every 3 hours** — "0 */3 * * * — light cadence"
|
|
149
|
+
- **3× daily** — "0 9,14,19 * * * — morning, afternoon, evening"
|
|
150
|
+
- **Once daily morning** — "0 9 * * * — every day at 9am"
|
|
151
|
+
- **Custom cron** — "I'll type the 5-field expression in Other"
|
|
152
|
+
|
|
153
|
+
If "Other" / Custom → validate it has 5 whitespace-separated fields. Re-prompt if invalid.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Phase 4 — Runtime Overrides
|
|
158
|
+
|
|
159
|
+
Interactive choice prompt with TWO questions in one card:
|
|
160
|
+
- Q1 **CLI profile** (header "CLI"):
|
|
161
|
+
- **Claude Code** (Recommended, first option, label appended " (Recommended)")
|
|
162
|
+
- **Codex CLI**
|
|
163
|
+
- **Gemini CLI**
|
|
164
|
+
- **OpenCode CLI**
|
|
165
|
+
- Q2 **Effort** (header "Think"):
|
|
166
|
+
- **Off** (Recommended)
|
|
167
|
+
- **Low** / **Medium** / **High**
|
|
168
|
+
|
|
169
|
+
Pick a sensible default model based on profile: claude-code → `claude-sonnet-4-6`; codex → `gpt-5.4-mini`; gemini → `gemini-2.5-pro`; opencode → leave null (uses last-used).
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Phase 5 — Group Assignment
|
|
174
|
+
|
|
175
|
+
Build options list dynamically from `$GROUPS`. Always include "Ungrouped" and "Create new group".
|
|
176
|
+
|
|
177
|
+
Interactive choice prompt:
|
|
178
|
+
- **Question**: "Which group should this schedule live in?"
|
|
179
|
+
- **Header**: "Group"
|
|
180
|
+
- **Options** (multiSelect: false): 2-4 entries (truncate group list if needed; offer "More..." if >2 existing groups would push over 4):
|
|
181
|
+
- **Ungrouped**
|
|
182
|
+
- **`<existing group 1>`**
|
|
183
|
+
- **`<existing group 2>`** (if exists)
|
|
184
|
+
- **Create new group**
|
|
185
|
+
|
|
186
|
+
If "Create new group", ask another single-question card for group name (free text via Other) and pick a default color (`#4fc3f7`). Then `Bash` curl POST `/api/schedule-groups` with `{ name, color }`. Capture returned `id` as `$GROUP_ID`.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Phase 6 — Confirm Summary
|
|
191
|
+
|
|
192
|
+
Render summary in the question text of an interactive choice prompt. Use markdown line breaks via `\n`:
|
|
193
|
+
|
|
194
|
+
- **Question** (insert line breaks via newlines):
|
|
195
|
+
```
|
|
196
|
+
Ready to create:
|
|
197
|
+
|
|
198
|
+
Name: <name>
|
|
199
|
+
Template: <template name> (<new|existing>)
|
|
200
|
+
Cron: <expr> (<human description>)
|
|
201
|
+
Group: <group name>
|
|
202
|
+
CLI: <profile> · Model: <model> · Think: <effort>
|
|
203
|
+
Browser: <yes|no>
|
|
204
|
+
|
|
205
|
+
Confirm?
|
|
206
|
+
```
|
|
207
|
+
- **Header**: "Confirm"
|
|
208
|
+
- **Options** (multiSelect: false):
|
|
209
|
+
- **Create it** (first, " (Recommended)")
|
|
210
|
+
- **Edit name** — "Re-prompt for name only"
|
|
211
|
+
- **Edit cron** — "Re-prompt for cron only"
|
|
212
|
+
- **Cancel** — "Abort wizard"
|
|
213
|
+
|
|
214
|
+
If "Edit name" or "Edit cron" → ask single open question (Other) for that field, then re-render summary.
|
|
215
|
+
|
|
216
|
+
If "Cancel" → stop wizard, tell user nothing was created.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Phase 7 — Execute
|
|
221
|
+
|
|
222
|
+
Sequentially:
|
|
223
|
+
|
|
224
|
+
### 7a. Create template (only if new)
|
|
225
|
+
|
|
226
|
+
`Bash`:
|
|
227
|
+
```bash
|
|
228
|
+
curl -s -X POST http://localhost:3344/api/loop/templates \
|
|
229
|
+
-H 'Content-Type: application/json' \
|
|
230
|
+
-d '<template JSON>'
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Parse response, capture `id` as `$TEMPLATE_ID`. If response is non-2xx or contains `error`, abort and show error via interactive prompt with retry / cancel options.
|
|
234
|
+
|
|
235
|
+
### 7b. Create schedule
|
|
236
|
+
|
|
237
|
+
`Bash`:
|
|
238
|
+
```bash
|
|
239
|
+
curl -s -X POST http://localhost:3344/api/schedules \
|
|
240
|
+
-H 'Content-Type: application/json' \
|
|
241
|
+
-d '<schedule JSON with templateId=$TEMPLATE_ID, groupId=$GROUP_ID>'
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Same error handling.
|
|
245
|
+
|
|
246
|
+
### 7c. Persist context to memory
|
|
247
|
+
|
|
248
|
+
`remember` with:
|
|
249
|
+
- `category`: `schedules` (use `category` tool action `create` with parent `synabun` if missing).
|
|
250
|
+
- `project`: `synabun`
|
|
251
|
+
- `importance`: 6
|
|
252
|
+
- `tags`: `["schedule", "<platform>", "wizard-created"]`
|
|
253
|
+
- `content`: 4-6 line summary (name, template id, schedule id, cron, group, runtime overrides, creation date).
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Phase 8 — Done
|
|
258
|
+
|
|
259
|
+
One-line success message:
|
|
260
|
+
|
|
261
|
+
> ✓ Schedule **`<name>`** created. The Schedules Studio refreshed automatically — switch to the studio window to see it.
|
|
262
|
+
|
|
263
|
+
If the studio is not currently open, also note: "Open Automations → Schedules to view."
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Failure Handling
|
|
268
|
+
|
|
269
|
+
- Any HTTP non-2xx → present interactive choice prompt:
|
|
270
|
+
- **Retry** — "Re-send the same payload"
|
|
271
|
+
- **Edit and retry** — "Open the failed payload for adjustment"
|
|
272
|
+
- **Cancel** — "Abort wizard"
|
|
273
|
+
- Validation errors (e.g., bad cron) → re-prompt the relevant phase, do not advance.
|
|
274
|
+
- Network failure → say "Neural Interface unreachable on `:3344` — is the dev server running?" and exit.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Guidelines
|
|
279
|
+
|
|
280
|
+
- **Maximum 7 interactive prompts total** across all phases. Combine where possible (e.g., Platform + Browser in one card).
|
|
281
|
+
- **Default to "Recommended" first option** in every multi-choice question. Append " (Recommended)" to the first label.
|
|
282
|
+
- **Never invent template fields**. Only the keys listed in the API section above are accepted by the server.
|
|
283
|
+
- **Always quote IDs in JSON** (they are strings).
|
|
284
|
+
- **Timezones** are IANA names. Do not pass abbreviations like "EST".
|
|
285
|
+
- **Stop hooks** — emit only one tool block per turn that contains an interactive question. Do NOT chain `Bash` or `Write` after `AskUserQuestion` in the same turn — wait for the user's answer first.
|
package/CLAUDE.md
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
## Memory Ruleset
|
|
4
|
-
|
|
5
|
-
> Portable ruleset — copy into any project's `CLAUDE.md`. Copy button in Neural Interface: Settings > Connections > Claude Code > Copy Ruleset.
|
|
6
|
-
|
|
7
|
-
### Tools
|
|
8
|
-
|
|
9
|
-
| Tool | Purpose |
|
|
10
|
-
|------|---------|
|
|
11
|
-
| `remember` | Store memory (content, category, project, tags, importance, related_files) |
|
|
12
|
-
| `recall` | Semantic search across memories |
|
|
13
|
-
| `forget` / `restore` | Trash / restore a memory by ID |
|
|
14
|
-
| `reflect` | Update existing memory (importance, tags, content, category) |
|
|
15
|
-
| `memories` | List recent or stats (recent, by-category, by-project) |
|
|
16
|
-
| `sync` | Detect stale memories (file content changed) |
|
|
17
|
-
| `category_create/update/delete/list` | Manage category hierarchy |
|
|
18
|
-
|
|
19
|
-
### Auto-Recall
|
|
20
|
-
|
|
21
|
-
- Session start: `recall` current project context
|
|
22
|
-
- Topic mentioned: `recall` what you know
|
|
23
|
-
- Before decisions: `recall` past decisions
|
|
24
|
-
- Debugging: `recall` similar bugs
|
|
25
|
-
|
|
26
|
-
### Auto-Remember (MANDATORY)
|
|
27
|
-
|
|
28
|
-
After ANY task (bug fix, feature, refactor, config change, investigation, architecture decision), MUST `remember` BEFORE responding.
|
|
29
|
-
|
|
30
|
-
**Steps:**
|
|
31
|
-
1. `remember` — what + why + how, appropriate category, set project, related_files, importance (5=routine, 6-7=significant, 8+=critical), and 3-5 tags
|
|
32
|
-
|
|
33
|
-
`remember` now returns the full UUID and accepts all fields (tags, importance) directly. No need to recall+reflect afterward.
|
|
34
|
-
|
|
35
|
-
**NOT triggered by:** Simple Q&A, file reads with no findings, trivial typos.
|
|
36
|
-
|
|
37
|
-
**Importance:** 1-2=trivial, 3-4=low, 5=normal, 6-7=significant, 8-9=critical, 10=foundational. User says "remember this" → 8+. Architecture decisions → 8+. API quirks → 6+.
|
|
38
|
-
|
|
39
|
-
### Response Ordering (IMPORTANT)
|
|
40
|
-
|
|
41
|
-
When finishing a task, structure your response as:
|
|
42
|
-
1. Call `remember` (and any other memory tools) **FIRST**
|
|
43
|
-
2. Write your completion summary / final message **LAST**
|
|
44
|
-
|
|
45
|
-
Tool call results appear above text within a single response, so the summary naturally ends up at the bottom where the user sees it. This prevents memory tool calls from burying your completion message under noise.
|
|
46
|
-
|
|
47
|
-
**Never** write your summary first and then call memory tools — the stop hook will block you, forcing a new response of memory tool calls that pushes your summary off-screen.
|
|
48
|
-
|
|
49
|
-
### Category Selection
|
|
50
|
-
|
|
51
|
-
1. Match existing child → use it
|
|
52
|
-
2. Parent fits but no child → `category_create` child → use it
|
|
53
|
-
3. Nothing fits → `category_create` parent + child → use it
|
|
54
|
-
|
|
55
|
-
Never store directly in parent categories.
|
|
56
|
-
|
|
57
|
-
### Tool Quirks
|
|
58
|
-
|
|
59
|
-
- `remember` returns the full UUID and accepts tags + importance directly.
|
|
60
|
-
- `reflect` requires FULL UUID — use the one returned by `remember`, or `recall` to find existing memories.
|
|
61
|
-
- Sequential MCP calls only — never parallel.
|
|
62
|
-
|
|
63
|
-
### Browser Sessions
|
|
64
|
-
|
|
65
|
-
- When starting a browser session, **always create a new tab** — never reuse or navigate an existing tab. Existing tabs may contain the user's active work, unsaved state, or authenticated sessions that must not be disrupted.
|
|
66
|
-
|
|
67
|
-
### Plan Mode (MANDATORY)
|
|
68
|
-
|
|
69
|
-
**CRITICAL**: Plan mode = research and planning ONLY. Do NOT use Edit, Write, or NotebookEdit. Read files, search code, investigate — then present the plan. Do NOT implement until the user approves and you exit plan mode.
|
|
70
|
-
|
|
71
|
-
When you need clarification or have questions:
|
|
72
|
-
- **ALWAYS** use `AskUserQuestion` to present options — never write questions as plain text
|
|
73
|
-
- Load the tool via `ToolSearch` first if its schema is not yet available
|
|
74
|
-
- Structure as distinct choices (2-4 options per question, max 4 questions)
|
|
75
|
-
- Use for approach clarification BEFORE finalizing the plan
|
|
76
|
-
- Use `ExitPlanMode` (not AskUserQuestion) for final plan approval
|
|
77
|
-
|
|
78
|
-
### Multi-Select Questions
|
|
79
|
-
|
|
80
|
-
When using `AskUserQuestion`, set `multiSelect: true` when options are NOT mutually exclusive — i.e., the user could reasonably want more than one. Examples: selecting multiple features, tags, effects, or follow-up actions. Keep single-select (default) for inherently exclusive choices (one model, one style, one dimension).
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Coexistence with Other Tools
|
|
85
|
-
|
|
86
|
-
When running SynaBun alongside other memory or code intelligence tools (CogniLayer, mem0, etc.):
|
|
87
|
-
|
|
88
|
-
**SynaBun owns ALL memory operations:**
|
|
89
|
-
- Storing information: `remember`
|
|
90
|
-
- Searching past context: `recall`
|
|
91
|
-
- Updating memories: `reflect`
|
|
92
|
-
- Deleting/restoring: `forget` / `restore`
|
|
93
|
-
- Browsing: `memories`
|
|
94
|
-
- Stale detection: `sync`
|
|
95
|
-
- Categories: `category` (create/update/delete/list)
|
|
96
|
-
|
|
97
|
-
**Other tools** should be restricted to their non-memory capabilities only (e.g., AST-based code search, code impact analysis).
|
|
98
|
-
|
|
99
|
-
**Enforcement rule for CLAUDE.md / project instructions:**
|
|
100
|
-
```
|
|
101
|
-
For ALL memory operations (store, search, recall, update, delete), use SynaBun tools exclusively.
|
|
102
|
-
[OtherTool] is restricted to [specific use case, e.g., code_search, code_context, code_impact].
|
|
103
|
-
Never use [OtherTool] for remembering, recalling, or reflecting on past work.
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
If you notice the AI defaulting to another tool's memory features, add the enforcement rule above to your project's `CLAUDE.md`.
|
|
107
|
-
|
|
108
|
-
====================================END SYNBUN
|
|
109
|
-
|
|
110
|
-
## Architecture
|
|
111
|
-
|
|
112
|
-
Two independently running processes that share one SQLite database:
|
|
113
|
-
|
|
114
|
-
### MCP Server (`mcp-server/`)
|
|
115
|
-
TypeScript, compiles to `dist/`. Entry point: `run.mjs` → `dist/preload.js` → `dist/index.js`. Communicates with AI tools via MCP protocol (stdio or HTTP). 72 tools across 9 groups: Memory (8), Browser (39), Whiteboard (5), Cards (5), Discord (8), Leonardo (4), Git (1), Loop (1), TicTacToe (1).
|
|
116
|
-
|
|
117
|
-
- `src/index.ts` — tool registration, schema refresh, server creation
|
|
118
|
-
- `src/config.ts` — env config, project detection from `claude-code-projects.json`
|
|
119
|
-
- `src/types.ts` — `MemoryPayload` interface
|
|
120
|
-
- `src/http.ts` — HTTP MCP transport (stateless, fresh server per request)
|
|
121
|
-
- `src/services/sqlite.ts` — storage layer, vectors as Float32Array BLOBs, cosine similarity in JS
|
|
122
|
-
- `src/services/local-embeddings.ts` — Transformers.js embedding generation
|
|
123
|
-
- `src/services/categories.ts` — category CRUD, hierarchy, dynamic schema refresh
|
|
124
|
-
- `src/tools/` — one file per tool (or per tool group with a registration function)
|
|
125
|
-
|
|
126
|
-
### Neural Interface (`neural-interface/`)
|
|
127
|
-
Express server (`server.js`, ~15K lines) serving a vanilla JS + Three.js frontend. 55+ REST API endpoints. Runs on port 3344.
|
|
128
|
-
|
|
129
|
-
- `server.js` — monolithic Express server with all API routes, WebSocket, terminal (node-pty), Playwright browser management, session registry, loop orchestration
|
|
130
|
-
- `public/index.html` — 3D force-directed graph (Three.js)
|
|
131
|
-
- `public/index2d.html` — 2D canvas variant
|
|
132
|
-
- `public/onboarding.html` — first-time setup wizard
|
|
133
|
-
- `public/claude-chat.html` — standalone Claude Code chat page
|
|
134
|
-
- `public/shared/` — modular JS/CSS (~50 files): `ui-*.js` modules, `storage.js` (server-synced state), `styles.css`, `utils.js`
|
|
135
|
-
- `lib/db.js` — shared SQLite access (same DB as MCP server)
|
|
136
|
-
- `lib/session-indexer.js` — conversation session indexing
|
|
137
|
-
- `skins/` — theme system (CSS + JSON per skin)
|
|
138
|
-
- `i18n/` — internationalization (en.json)
|
|
139
|
-
- `templates/CLAUDE-template.md` — source of truth for memory rulesets injected into project CLAUDE.md files
|
|
140
|
-
|
|
141
|
-
### Hooks (`hooks/claude-code/`)
|
|
142
|
-
7 ESM (.mjs) lifecycle hooks for Claude Code, registered in `.claude/settings.json`:
|
|
143
|
-
|
|
144
|
-
| Hook | Event | Purpose |
|
|
145
|
-
|------|-------|---------|
|
|
146
|
-
| `session-start.mjs` | SessionStart | Greeting, boot sequence, compaction recovery, loop detection |
|
|
147
|
-
| `prompt-submit.mjs` | UserPromptSubmit | Tiered recall nudges, loop iteration injection |
|
|
148
|
-
| `pre-compact.mjs` | PreCompact | Transcript capture before context compaction |
|
|
149
|
-
| `stop.mjs` | Stop | Combined obligations: compaction, loops, task memory, user learning |
|
|
150
|
-
| `post-remember.mjs` | PostToolUse | Edit tracking, flag clearing, user learning |
|
|
151
|
-
| `pre-websearch.mjs` | PreToolUse | Blocks WebSearch/WebFetch during active browser sessions |
|
|
152
|
-
| `post-plan.mjs` | PostToolUse | Auto-stores plans as memories on ExitPlanMode |
|
|
153
|
-
|
|
154
|
-
`shared.mjs` contains utilities used across hooks.
|
|
155
|
-
|
|
156
|
-
### Skills (`skills/`)
|
|
157
|
-
Claude Code slash commands with `SKILL.md` entry points and `modules/` subdirectories:
|
|
158
|
-
- `synabun/` — `/synabun` command hub (brainstorm, audit, health, search)
|
|
159
|
-
- `leonardo/` — `/leonardo` master media prompter (video, image, model advisor, prompt library)
|
|
160
|
-
|
|
161
|
-
### Data Flow
|
|
162
|
-
```
|
|
163
|
-
AI tool calls remember → MCP server embeds content → SQLite stores vector + payload
|
|
164
|
-
AI tool calls recall → MCP server embeds query → cosine similarity search → re-ranked results
|
|
165
|
-
Neural Interface → reads same SQLite DB → renders 3D graph, REST API, WebSocket
|
|
166
|
-
Hooks → fire on Claude Code events → inject context, enforce memory obligations
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Shared State
|
|
170
|
-
- `data/memory.db` — single SQLite database (memories, session chunks, trash)
|
|
171
|
-
- `data/ui-state.json` — Neural Interface UI state (synced via `storage.js`)
|
|
172
|
-
- `data/pending-compact/` — per-session compaction flags
|
|
173
|
-
- `data/pending-remember/` — per-session edit tracking flags
|
|
174
|
-
- `mcp-server/data/custom-categories-{connId}.json` — per-connection category definitions
|
|
175
|
-
|
|
176
|
-
## Key Patterns
|
|
177
|
-
|
|
178
|
-
- **Category descriptions are routing instructions**: Claude reads all category descriptions from the MCP tool schema to decide where to store memories. Descriptions must be prescriptive rules, not vague labels.
|
|
179
|
-
- **Dynamic schema refresh**: Category changes trigger `refreshCategorySchemas()` → `notifications/tools/list_changed` → Claude re-fetches tool list. No restart needed.
|
|
180
|
-
- **Per-tab session isolation**: Project/model/effort state stored per-tab in sidepanel (`ui-claude-panel.js`) and per-tab via `sessionStorage` in standalone (`claude-chat.js`). Global `ui-state.json` keys are "last used" defaults only.
|
|
181
|
-
- **Browser sessions**: Playwright with persistent Chromium profiles. Multi-session isolation via dedicated browser session per automation. Leonardo tools are 100% browser-based (no API key).
|
|
182
|
-
- **Compaction chain**: PreCompact → flag → SessionStart injects → Claude remembers(conversations) → PostToolUse clears → Stop allows.
|
|
183
|
-
- **MCP calls must be sequential**: Parallel MCP tool calls can cascade failures. Always call memory tools one at a time.
|
|
184
|
-
|
|
185
|
-
## Environment
|
|
186
|
-
|
|
187
|
-
- Node.js 22.5+ required (for built-in `node:sqlite`)
|
|
188
|
-
- `.env` at project root — `SQLITE_DB_PATH`, `NEURAL_PORT` (default 3344), `DISCORD_BOT_TOKEN`, `DISCORD_GUILD_ID`
|
|
189
|
-
- CLAUDE.md is gitignored (user-local)
|
|
190
|
-
|
|
191
|
-
## Persistent Memory
|
|
192
|
-
|
|
193
|
-
### Auto-Remember (MANDATORY)
|
|
194
|
-
After ANY task (bug fix, feature, refactor, config change, investigation, architecture decision), MUST `remember` BEFORE responding.
|
|
195
|
-
|
|
196
|
-
Steps:
|
|
197
|
-
1. `remember` — what + why + how, appropriate category, set project, related_files, importance (5=routine, 6-7=significant, 8+=critical), and 3-5 tags
|
|
198
|
-
|
|
199
|
-
`remember` returns the full UUID and accepts all fields (tags, importance) directly. No need to recall+reflect afterward.
|
|
200
|
-
|
|
201
|
-
**NOT triggered by:** Simple Q&A, file reads with no findings, trivial typos.
|
|
202
|
-
|
|
203
|
-
**Importance scale:** 1-2=trivial, 3-4=low, 5=normal, 6-7=significant, 8-9=critical, 10=foundational. User says "remember this" → 8+. Architecture decisions → 8+.
|
|
204
|
-
|
|
205
|
-
### Response Ordering
|
|
206
|
-
When finishing a task: call `remember` (and any other memory tools) **FIRST**, then write your completion summary **LAST**. Never summary-then-tools — the stop hook will block you.
|
|
207
|
-
|
|
208
|
-
### Tool Quirks
|
|
209
|
-
- `remember` returns the full UUID and accepts tags + importance directly.
|
|
210
|
-
- `reflect` requires FULL UUID — use the one from `remember`, or `recall` to find existing memories.
|
|
211
|
-
- Sequential MCP calls only — never parallel.
|
|
212
|
-
|
|
213
|
-
### Plan Mode
|
|
214
|
-
When in plan mode and you need clarification:
|
|
215
|
-
- ALWAYS use `AskUserQuestion` to present options — never plain text questions
|
|
216
|
-
- Use `ExitPlanMode` for final plan approval
|
|
217
|
-
- Use `multiSelect: true` in AskUserQuestion when options aren't mutually exclusive
|