@synapse-research/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.
Files changed (207) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +124 -124
  3. package/dist/.next/app-path-routes-manifest.json +34 -34
  4. package/dist/.next/build-manifest.json +2 -2
  5. package/dist/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  6. package/dist/.next/server/app/(dashboard)/compute/page_client-reference-manifest.js +1 -1
  7. package/dist/.next/server/app/(dashboard)/project-groups/[uuid]/page_client-reference-manifest.js +1 -1
  8. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/activity/page_client-reference-manifest.js +1 -1
  9. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/dashboard/page_client-reference-manifest.js +1 -1
  10. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/documents/[documentUuid]/page_client-reference-manifest.js +1 -1
  11. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/documents/page_client-reference-manifest.js +1 -1
  12. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page_client-reference-manifest.js +1 -1
  13. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-designs/new/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-designs/page_client-reference-manifest.js +1 -1
  15. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-runs/[runUuid]/page_client-reference-manifest.js +1 -1
  16. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-runs/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiments/new/page_client-reference-manifest.js +1 -1
  18. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiments/page_client-reference-manifest.js +1 -1
  19. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/insights/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/page_client-reference-manifest.js +1 -1
  21. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/related-works/page_client-reference-manifest.js +1 -1
  22. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/research-questions/[questionUuid]/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/research-questions/page_client-reference-manifest.js +1 -1
  24. package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/settings/page_client-reference-manifest.js +1 -1
  25. package/dist/.next/server/app/(dashboard)/research-projects/new/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(dashboard)/research-projects/page_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  28. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/_not-found.html +1 -1
  30. package/dist/.next/server/app/_not-found.rsc +1 -1
  31. package/dist/.next/server/app/admin/companies/[uuid]/page_client-reference-manifest.js +1 -1
  32. package/dist/.next/server/app/admin/companies/new/page_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/admin/companies/new.html +1 -1
  34. package/dist/.next/server/app/admin/companies/new.rsc +1 -1
  35. package/dist/.next/server/app/admin/companies/page_client-reference-manifest.js +1 -1
  36. package/dist/.next/server/app/admin/companies.html +1 -1
  37. package/dist/.next/server/app/admin/companies.rsc +1 -1
  38. package/dist/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  39. package/dist/.next/server/app/admin.html +1 -1
  40. package/dist/.next/server/app/admin.rsc +1 -1
  41. package/dist/.next/server/app/api/admin/companies/[uuid]/route_client-reference-manifest.js +1 -1
  42. package/dist/.next/server/app/api/admin/companies/route_client-reference-manifest.js +1 -1
  43. package/dist/.next/server/app/api/admin/login/route_client-reference-manifest.js +1 -1
  44. package/dist/.next/server/app/api/admin/session/route_client-reference-manifest.js +1 -1
  45. package/dist/.next/server/app/api/admin/stats/route_client-reference-manifest.js +1 -1
  46. package/dist/.next/server/app/api/agents/[uuid]/route_client-reference-manifest.js +1 -1
  47. package/dist/.next/server/app/api/agents/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  48. package/dist/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  49. package/dist/.next/server/app/api/api-keys/[uuid]/route_client-reference-manifest.js +1 -1
  50. package/dist/.next/server/app/api/api-keys/route_client-reference-manifest.js +1 -1
  51. package/dist/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
  52. package/dist/.next/server/app/api/auth/check-default/route_client-reference-manifest.js +1 -1
  53. package/dist/.next/server/app/api/auth/default-login/route_client-reference-manifest.js +1 -1
  54. package/dist/.next/server/app/api/auth/identify/route_client-reference-manifest.js +1 -1
  55. package/dist/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  56. package/dist/.next/server/app/api/auth/me/route_client-reference-manifest.js +1 -1
  57. package/dist/.next/server/app/api/auth/refresh/route_client-reference-manifest.js +1 -1
  58. package/dist/.next/server/app/api/auth/session/route_client-reference-manifest.js +1 -1
  59. package/dist/.next/server/app/api/auth/sync-token/route_client-reference-manifest.js +1 -1
  60. package/dist/.next/server/app/api/comments/route_client-reference-manifest.js +1 -1
  61. package/dist/.next/server/app/api/compute-gpus/[uuid]/release/route_client-reference-manifest.js +1 -1
  62. package/dist/.next/server/app/api/compute-nodes/[uuid]/route_client-reference-manifest.js +1 -1
  63. package/dist/.next/server/app/api/compute-nodes/route_client-reference-manifest.js +1 -1
  64. package/dist/.next/server/app/api/compute-pools/[uuid]/route_client-reference-manifest.js +1 -1
  65. package/dist/.next/server/app/api/compute-pools/route_client-reference-manifest.js +1 -1
  66. package/dist/.next/server/app/api/documents/[uuid]/images/[filename]/route_client-reference-manifest.js +1 -1
  67. package/dist/.next/server/app/api/documents/[uuid]/images/route_client-reference-manifest.js +1 -1
  68. package/dist/.next/server/app/api/documents/[uuid]/route_client-reference-manifest.js +1 -1
  69. package/dist/.next/server/app/api/events/notifications/route_client-reference-manifest.js +1 -1
  70. package/dist/.next/server/app/api/events/route_client-reference-manifest.js +1 -1
  71. package/dist/.next/server/app/api/experiment-designs/[uuid]/approve/route_client-reference-manifest.js +1 -1
  72. package/dist/.next/server/app/api/experiment-designs/[uuid]/close/route_client-reference-manifest.js +1 -1
  73. package/dist/.next/server/app/api/experiment-designs/[uuid]/reject/route_client-reference-manifest.js +1 -1
  74. package/dist/.next/server/app/api/experiment-designs/[uuid]/route_client-reference-manifest.js +1 -1
  75. package/dist/.next/server/app/api/experiment-runs/[uuid]/claim/route_client-reference-manifest.js +1 -1
  76. package/dist/.next/server/app/api/experiment-runs/[uuid]/dependencies/[dependsOnRunUuid]/route_client-reference-manifest.js +1 -1
  77. package/dist/.next/server/app/api/experiment-runs/[uuid]/dependencies/route_client-reference-manifest.js +1 -1
  78. package/dist/.next/server/app/api/experiment-runs/[uuid]/evaluate-criteria/route_client-reference-manifest.js +1 -1
  79. package/dist/.next/server/app/api/experiment-runs/[uuid]/registry/route_client-reference-manifest.js +1 -1
  80. package/dist/.next/server/app/api/experiment-runs/[uuid]/release/route_client-reference-manifest.js +1 -1
  81. package/dist/.next/server/app/api/experiment-runs/[uuid]/route_client-reference-manifest.js +1 -1
  82. package/dist/.next/server/app/api/experiment-runs/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  83. package/dist/.next/server/app/api/experiments/[uuid]/complete/route_client-reference-manifest.js +1 -1
  84. package/dist/.next/server/app/api/experiments/[uuid]/progress/route_client-reference-manifest.js +1 -1
  85. package/dist/.next/server/app/api/experiments/[uuid]/request-plan/route_client-reference-manifest.js +1 -1
  86. package/dist/.next/server/app/api/experiments/[uuid]/reset/route_client-reference-manifest.js +1 -1
  87. package/dist/.next/server/app/api/experiments/[uuid]/review/route.js +1 -1
  88. package/dist/.next/server/app/api/experiments/[uuid]/review/route_client-reference-manifest.js +1 -1
  89. package/dist/.next/server/app/api/experiments/[uuid]/route_client-reference-manifest.js +1 -1
  90. package/dist/.next/server/app/api/experiments/[uuid]/start/route_client-reference-manifest.js +1 -1
  91. package/dist/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  92. package/dist/.next/server/app/api/mcp/route.js +1 -1
  93. package/dist/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -1
  94. package/dist/.next/server/app/api/me/assignments/route_client-reference-manifest.js +1 -1
  95. package/dist/.next/server/app/api/mentionables/route_client-reference-manifest.js +1 -1
  96. package/dist/.next/server/app/api/notifications/[uuid]/archive/route_client-reference-manifest.js +1 -1
  97. package/dist/.next/server/app/api/notifications/[uuid]/read/route_client-reference-manifest.js +1 -1
  98. package/dist/.next/server/app/api/notifications/preferences/route_client-reference-manifest.js +1 -1
  99. package/dist/.next/server/app/api/notifications/read-all/route_client-reference-manifest.js +1 -1
  100. package/dist/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  101. package/dist/.next/server/app/api/notifications/unread-count/route_client-reference-manifest.js +1 -1
  102. package/dist/.next/server/app/api/onboarding/status/route_client-reference-manifest.js +1 -1
  103. package/dist/.next/server/app/api/project-groups/[uuid]/dashboard/route_client-reference-manifest.js +1 -1
  104. package/dist/.next/server/app/api/project-groups/[uuid]/route_client-reference-manifest.js +1 -1
  105. package/dist/.next/server/app/api/project-groups/route_client-reference-manifest.js +1 -1
  106. package/dist/.next/server/app/api/research-projects/[uuid]/activity/route_client-reference-manifest.js +1 -1
  107. package/dist/.next/server/app/api/research-projects/[uuid]/agent-activity/route_client-reference-manifest.js +1 -1
  108. package/dist/.next/server/app/api/research-projects/[uuid]/available/route_client-reference-manifest.js +1 -1
  109. package/dist/.next/server/app/api/research-projects/[uuid]/baselines/route_client-reference-manifest.js +1 -1
  110. package/dist/.next/server/app/api/research-projects/[uuid]/documents/route_client-reference-manifest.js +1 -1
  111. package/dist/.next/server/app/api/research-projects/[uuid]/experiment-designs/[designUuid]/validate/route_client-reference-manifest.js +1 -1
  112. package/dist/.next/server/app/api/research-projects/[uuid]/experiment-designs/route_client-reference-manifest.js +1 -1
  113. package/dist/.next/server/app/api/research-projects/[uuid]/experiment-designs/summary/route_client-reference-manifest.js +1 -1
  114. package/dist/.next/server/app/api/research-projects/[uuid]/experiment-runs/dependencies/route_client-reference-manifest.js +1 -1
  115. package/dist/.next/server/app/api/research-projects/[uuid]/experiment-runs/route_client-reference-manifest.js +1 -1
  116. package/dist/.next/server/app/api/research-projects/[uuid]/experiments/route_client-reference-manifest.js +1 -1
  117. package/dist/.next/server/app/api/research-projects/[uuid]/github/branches/route_client-reference-manifest.js +1 -1
  118. package/dist/.next/server/app/api/research-projects/[uuid]/group/route_client-reference-manifest.js +1 -1
  119. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/[workUuid]/route_client-reference-manifest.js +1 -1
  120. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/auto-search/complete/route_client-reference-manifest.js +1 -1
  121. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/auto-search/route_client-reference-manifest.js +1 -1
  122. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/deep-research/complete/route_client-reference-manifest.js +1 -1
  123. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/deep-research/route_client-reference-manifest.js +1 -1
  124. package/dist/.next/server/app/api/research-projects/[uuid]/related-works/route_client-reference-manifest.js +1 -1
  125. package/dist/.next/server/app/api/research-projects/[uuid]/research-questions/route_client-reference-manifest.js +1 -1
  126. package/dist/.next/server/app/api/research-projects/[uuid]/route_client-reference-manifest.js +1 -1
  127. package/dist/.next/server/app/api/research-projects/[uuid]/synthesis/complete/route_client-reference-manifest.js +1 -1
  128. package/dist/.next/server/app/api/research-projects/[uuid]/synthesis/refresh/route_client-reference-manifest.js +1 -1
  129. package/dist/.next/server/app/api/research-projects/[uuid]/synthesis/trigger/route_client-reference-manifest.js +1 -1
  130. package/dist/.next/server/app/api/research-projects/route_client-reference-manifest.js +1 -1
  131. package/dist/.next/server/app/api/research-questions/[uuid]/claim/route_client-reference-manifest.js +1 -1
  132. package/dist/.next/server/app/api/research-questions/[uuid]/move/route_client-reference-manifest.js +1 -1
  133. package/dist/.next/server/app/api/research-questions/[uuid]/release/route_client-reference-manifest.js +1 -1
  134. package/dist/.next/server/app/api/research-questions/[uuid]/review/route_client-reference-manifest.js +1 -1
  135. package/dist/.next/server/app/api/research-questions/[uuid]/route_client-reference-manifest.js +1 -1
  136. package/dist/.next/server/app/api/sessions/[uuid]/route_client-reference-manifest.js +1 -1
  137. package/dist/.next/server/app/api/settings/integrations/route_client-reference-manifest.js +1 -1
  138. package/dist/.next/server/app/api/ssh-config/route_client-reference-manifest.js +1 -1
  139. package/dist/.next/server/app/index.html +1 -1
  140. package/dist/.next/server/app/index.rsc +1 -1
  141. package/dist/.next/server/app/login/admin/page_client-reference-manifest.js +1 -1
  142. package/dist/.next/server/app/login/admin.html +1 -1
  143. package/dist/.next/server/app/login/admin.rsc +1 -1
  144. package/dist/.next/server/app/login/callback/page_client-reference-manifest.js +1 -1
  145. package/dist/.next/server/app/login/callback.html +1 -1
  146. package/dist/.next/server/app/login/callback.rsc +1 -1
  147. package/dist/.next/server/app/login/page_client-reference-manifest.js +1 -1
  148. package/dist/.next/server/app/login/silent-refresh/page_client-reference-manifest.js +1 -1
  149. package/dist/.next/server/app/login/silent-refresh.html +1 -1
  150. package/dist/.next/server/app/login/silent-refresh.rsc +1 -1
  151. package/dist/.next/server/app/login.html +1 -1
  152. package/dist/.next/server/app/login.rsc +1 -1
  153. package/dist/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  154. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  155. package/dist/.next/server/app/research-projects/new.html +1 -1
  156. package/dist/.next/server/app/research-projects/new.rsc +1 -1
  157. package/dist/.next/server/app/research-projects.html +1 -1
  158. package/dist/.next/server/app/research-projects.rsc +1 -1
  159. package/dist/.next/server/app/settings.html +1 -1
  160. package/dist/.next/server/app/settings.rsc +1 -1
  161. package/dist/.next/server/app-paths-manifest.json +34 -34
  162. package/dist/.next/server/chunks/8499.js +1 -1
  163. package/dist/.next/server/middleware-manifest.json +1 -1
  164. package/dist/.next/server/pages/404.html +1 -1
  165. package/dist/.next/server/pages/500.html +1 -1
  166. package/dist/.next/server/server-reference-manifest.js +1 -1
  167. package/dist/.next/server/server-reference-manifest.json +1 -1
  168. package/package.json +4 -2
  169. package/dist/public/skill/SKILL.md +0 -200
  170. package/dist/public/skill/aris-synapse-sync/SKILL.md +0 -368
  171. package/dist/public/skill/package.json +0 -79
  172. package/dist/public/skill/references/00-common-tools.md +0 -253
  173. package/dist/public/skill/references/01-setup.md +0 -251
  174. package/dist/public/skill/references/02-pm-workflow.md +0 -584
  175. package/dist/public/skill/references/03-developer-workflow.md +0 -325
  176. package/dist/public/skill/references/04-admin-workflow.md +0 -328
  177. package/dist/public/skill/references/06-claude-code-agent-teams.md +0 -233
  178. package/dist/public/synapse-plugin/.claude-plugin/plugin.json +0 -20
  179. package/dist/public/synapse-plugin/.mcp.json +0 -11
  180. package/dist/public/synapse-plugin/bin/on-pre-enter-plan.sh +0 -26
  181. package/dist/public/synapse-plugin/bin/on-pre-exit-plan.sh +0 -22
  182. package/dist/public/synapse-plugin/bin/on-pre-spawn-agent.sh +0 -64
  183. package/dist/public/synapse-plugin/bin/on-session-end.sh +0 -39
  184. package/dist/public/synapse-plugin/bin/on-session-start.sh +0 -283
  185. package/dist/public/synapse-plugin/bin/on-subagent-start.sh +0 -233
  186. package/dist/public/synapse-plugin/bin/on-subagent-stop.sh +0 -80
  187. package/dist/public/synapse-plugin/bin/on-task-completed.sh +0 -66
  188. package/dist/public/synapse-plugin/bin/on-teammate-idle.sh +0 -47
  189. package/dist/public/synapse-plugin/bin/on-user-prompt.sh +0 -57
  190. package/dist/public/synapse-plugin/bin/synapse-api.sh +0 -387
  191. package/dist/public/synapse-plugin/bin/test-syntax.sh +0 -85
  192. package/dist/public/synapse-plugin/hooks/hooks.json +0 -105
  193. package/dist/public/synapse-plugin/skills/autonomy/SKILL.md +0 -140
  194. package/dist/public/synapse-plugin/skills/experiments/SKILL.md +0 -87
  195. package/dist/public/synapse-plugin/skills/research/SKILL.md +0 -58
  196. package/dist/public/synapse-plugin/skills/sessions/SKILL.md +0 -174
  197. package/dist/public/synapse-plugin/skills/setup/SKILL.md +0 -73
  198. package/dist/public/synapse-plugin/skills/synapse/SKILL.md +0 -144
  199. package/dist/public/synapse-plugin/skills/synapse/package.json +0 -49
  200. package/dist/public/synapse-plugin/skills/synapse/references/00-common-tools.md +0 -107
  201. package/dist/public/synapse-plugin/skills/synapse/references/01-setup.md +0 -112
  202. package/dist/public/synapse-plugin/skills/synapse/references/02-research-workflow.md +0 -145
  203. package/dist/public/synapse-plugin/skills/synapse/references/03-experiment-workflow.md +0 -319
  204. package/dist/public/synapse-plugin/skills/synapse/references/04-autonomous-loop.md +0 -223
  205. package/dist/public/synapse-plugin/skills/synapse/references/05-session-sub-agent.md +0 -251
  206. /package/dist/.next/static/{duLVRogIrNQ1Tarxga53z → VlyiqgSt6DSLuCX7rlcKa}/_buildManifest.js +0 -0
  207. /package/dist/.next/static/{duLVRogIrNQ1Tarxga53z → VlyiqgSt6DSLuCX7rlcKa}/_ssgManifest.js +0 -0
@@ -1,251 +0,0 @@
1
- # Plugin Hooks, Sessions, And Multi-Agent Parallel Execution
2
-
3
- This reference documents how the Synapse Claude Code plugin actually works: which hooks fire, what they do, where their state lives, and how to run multiple experiments in parallel using Task sub-agents.
4
-
5
- ---
6
-
7
- ## Plugin Layout
8
-
9
- The plugin ships under `public/synapse-plugin/` in the repo and is installed into Claude Code's plugin directory. Three things matter for day-to-day use:
10
-
11
- | Path | Purpose |
12
- |---|---|
13
- | `.claude-plugin/plugin.json` | Plugin manifest (name, version). |
14
- | `.mcp.json` | MCP server config. Streamable HTTP transport to `${SYNAPSE_URL}/api/mcp` with `Authorization: Bearer ${SYNAPSE_API_KEY}`. |
15
- | `hooks/hooks.json` | Wires Claude Code events (`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `SubagentStart`, `TeammateIdle`, `SubagentStop`, `TaskCompleted`, `SessionEnd`) to the hook scripts under `bin/`. |
16
- | `bin/on-*.sh` + `bin/synapse-api.sh` | The hook scripts themselves. `synapse-api.sh` is the shared helper: flock-guarded state read/write and MCP JSON-RPC over streamable HTTP. |
17
-
18
- Local state per project lives under `.synapse/` in the working directory.
19
-
20
- ---
21
-
22
- ## Hook Catalogue
23
-
24
- | Hook script | Claude Code event | What it does | State touched | MCP calls |
25
- |---|---|---|---|---|
26
- | `on-session-start.sh` | `SessionStart` (`startup` \| `resume` \| `compact`) | Calls `synapse_checkin`, caches owner / roles / project UUID into `state.json`, scans for pre-assigned sub-agent session files, and builds the rich `additionalContext` block that orients the agent on assignments, projects, and workflow. On `resume`, injects the existing main session UUID instead of creating a new one. | `state.json`, reads `sessions/*.json` | `synapse_checkin`, optional `synapse_session_heartbeat` |
27
- | `on-user-prompt.sh` | `UserPromptSubmit` | Fast local-only check on every user turn. Scans `.synapse/sessions/` and injects a brief reminder that sub-agent sessions are auto-managed and that experiment UUIDs should be passed in prompts. No network, stays under 100 ms. | reads `sessions/` | none |
28
- | `on-pre-enter-plan.sh` | `PreToolUse` (`EnterPlanMode`) | Injects planning-mode guidance: prefer the current Experiment pipeline (`draft → pending_review → pending_start → in_progress → completed`), plan one independent run per experiment card, do not plan to create sessions manually. | none | none |
29
- | `on-pre-exit-plan.sh` | `PreToolUse` (`ExitPlanMode`) | Reminds the agent to verify the plan is expressed as Experiment records before executing. | none | none |
30
- | `on-pre-spawn-agent.sh` | `PreToolUse` (`Task`) | Atomically writes `.synapse/pending/{name}` with the agent name and type so the `SubagentStart` hook can claim it. Skips read-only sub-agent types (Explore, Plan, etc.). Per-spawn file avoids shared-state contention. | writes `pending/{name}` | none |
31
- | `on-subagent-start.sh` | `SubagentStart` | Atomically claims the pending file via `mv`. Reuses an active session, reopens a closed one, or creates a new one via `synapse_list_sessions` / `synapse_reopen_session` / `synapse_create_session` (named by the sub-agent name). Writes `sessions/{name}.json`, stores `session_{id}` / `agent_for_session_{uuid}` / `name_for_agent_{id}` mappings in `state.json`, and injects the session UUID plus execution workflow directly into the sub-agent's context. | `state.json`, `sessions/{name}.json`, `claimed/{agent_id}` | `synapse_list_sessions`, `synapse_create_session`, `synapse_reopen_session`, `synapse_session_heartbeat` |
32
- | `on-teammate-idle.sh` | `TeammateIdle` | Sends a heartbeat so the sub-agent's Synapse session does not auto-time-out after 1 hour. Output suppressed — this fires too often to notify the user. | reads `state.json` | `synapse_session_heartbeat` |
33
- | `on-subagent-stop.sh` | `SubagentStop` | Looks up the session UUID, calls `synapse_close_session`, and cleans up `state.json` mappings, `sessions/{name}.json`, and `claimed/{agent_id}`. | deletes state entries, `sessions/{name}.json`, `claimed/{agent_id}` | `synapse_close_session` |
34
- | `on-task-completed.sh` | `TaskCompleted` | Scans the completed task's description/subject for a `synapse:experiment:<uuid>` marker. If found, injects a reminder to finalize the experiment with `synapse_submit_experiment_results` (or report progress if still running). | reads task metadata only | none |
35
- | `on-session-end.sh` | `SessionEnd` | Safety-checked cleanup. Removes `.synapse/` only when all sub-agent sessions are closed and `state.json` has no meaningful content left. Otherwise state is preserved so a resumed session reconnects to the same Synapse sessions. | deletes `.synapse/` if safe | none |
36
-
37
- ---
38
-
39
- ## Context Injection Points
40
-
41
- The plugin injects context into the model via two channels in its hook output JSON:
42
-
43
- - `systemMessage` — a toast shown to the user (not visible to the model in its system prompt).
44
- - `hookSpecificOutput.additionalContext` — prepended to the model's system context.
45
-
46
- Where context is injected:
47
-
48
- - **SessionStart**: full checkin result, pending assignments, project summaries, workflow guide, session management rules, and (on resume) the main session UUID.
49
- - **UserPromptSubmit**: short reminder listing active sub-agent sessions.
50
- - **PreToolUse (EnterPlanMode / ExitPlanMode)**: plan-mode guidance.
51
- - **PreToolUse (Task)**: reminder to pass experiment UUIDs into sub-agent prompts.
52
- - **SubagentStart**: session UUID, execution workflow, owner identity (so sub-agents can `@mention` correctly).
53
- - **TaskCompleted**: reminder to finalize a Synapse experiment if the task was linked to one.
54
-
55
- ---
56
-
57
- ## Local State Layout
58
-
59
- Per-project state under `.synapse/`:
60
-
61
- | Path | Owner | Lifecycle |
62
- |---|---|---|
63
- | `state.json` | all hooks | Flock-guarded key/value store. Owner info, agent roles, primary project UUID, and `session_{agent_id}` / `agent_for_session_{uuid}` / `name_for_agent_{id}` / `session_{name}` mappings. |
64
- | `pending/{name}` | `on-pre-spawn-agent.sh` → `on-subagent-start.sh` | Written just before `Task` runs, atomically claimed by `mv` when the sub-agent actually starts. |
65
- | `claimed/{agent_id}` | `on-subagent-start.sh` → `on-subagent-stop.sh` | Marker of which pending entry was claimed. Deleted on stop. |
66
- | `sessions/{name}.json` | `on-subagent-start.sh` → `on-subagent-stop.sh` | Per-sub-agent session metadata: `sessionUuid`, `agentId`, `agentName`, `agentType`, `sessionAction` (`created` / `reused` / `reopened`), `createdAt`. Read by idle/stop/user-prompt hooks. |
67
-
68
- `on-session-end.sh` only wipes `.synapse/` if everything inside is either closed or empty.
69
-
70
- ---
71
-
72
- ## MCP Connection Session vs Synapse Agent Session
73
-
74
- These are two different things.
75
-
76
- - **MCP connection session** — the HTTP-streamable session on `/api/mcp`. Identified by the `mcp-session-id` header, auto-renewed on every request, expires after 30 minutes of inactivity. Handled transparently by the plugin; you never touch it.
77
- - **Synapse agent session** — a durable record in Synapse of which agent is working on what. Drives the green / yellow / grey indicators on the Settings page and the activity stream. Created/closed by plugin hooks, or explicitly via `synapse_create_session` / `synapse_close_session` for direct (non-sub-agent) work.
78
-
79
- ---
80
-
81
- ## Session Status Lifecycle
82
-
83
- ```text
84
- active ——(no heartbeat 1h)——> inactive ——(heartbeat)——> active
85
- \ \
86
- \—— close ——> closed ——(reopen)——> active
87
- ```
88
-
89
- | Status | Meaning |
90
- |---|---|
91
- | `active` | Agent is working. Green indicator. |
92
- | `inactive` | No heartbeat in over an hour. Yellow indicator. |
93
- | `closed` | Session ended. Grey indicator. Reusable via `synapse_reopen_session`. |
94
-
95
- ---
96
-
97
- ## Session Tools
98
-
99
- | Tool | Purpose |
100
- |---|---|
101
- | `synapse_list_sessions` | List sessions for the current agent. |
102
- | `synapse_get_session` | Read one session's details. |
103
- | `synapse_create_session` | Create a named session — usually only needed for direct work, not sub-agents. |
104
- | `synapse_close_session` | Close a session. |
105
- | `synapse_reopen_session` | Reopen a closed session instead of creating a duplicate with the same name. |
106
- | `synapse_session_heartbeat` | Keep a session active. Hooks already send heartbeats automatically via `TeammateIdle`. |
107
-
108
- ---
109
-
110
- ## Running Multiple Experiments In Parallel
111
-
112
- The main agent **orchestrates**. Sub-agents **execute**. This is the recommended pattern whenever there is more than one `pending_start` experiment that can run concurrently.
113
-
114
- ### Architecture
115
-
116
- ```text
117
- Main agent (Claude Code)
118
- ├── spawn Task → sub-agent A → Synapse session A → Experiment X
119
- ├── spawn Task → sub-agent B → Synapse session B → Experiment Y
120
- └── spawn Task → sub-agent C → Synapse session C → Experiment Z
121
-
122
- All session creation / heartbeats / closes are handled by the plugin hooks.
123
- ```
124
-
125
- Tool availability still depends on the Synapse roles attached to the API key. The sub-agent inherits the same MCP config the main agent uses (see **Project-Level MCP** below), but the roles it can exercise are determined by whichever API key is configured in `.mcp.json`.
126
-
127
- ### Main agent: dispatch
128
-
129
- ```text
130
- # 1. Refresh and list what needs to run
131
- synapse_checkin()
132
- synapse_get_assigned_experiments({ researchProjectUuid, statuses: ["pending_start"] })
133
-
134
- # 2. Inspect each candidate
135
- synapse_get_experiment({ experimentUuid })
136
-
137
- # 3. For each experiment, spawn a Task sub-agent with the experiment UUID in the prompt.
138
- # The SubagentStart hook auto-creates/reuses a Synapse session and injects the
139
- # execution workflow. The main agent does not call synapse_create_session.
140
- Task({
141
- subagent_type: "general-purpose",
142
- name: "training-worker-1",
143
- prompt: "Your Synapse experiment UUID: <experiment-uuid>. Run the experiment end to end following the experiments skill."
144
- })
145
- ```
146
-
147
- ### Sub-agent: execute
148
-
149
- Each sub-agent follows the full execution checklist in **[03-experiment-workflow.md](03-experiment-workflow.md)**:
150
-
151
- ```text
152
- synapse_start_experiment({ experimentUuid })
153
- synapse_list_compute_nodes({ researchProjectUuid, onlyAvailable: true }) # if needed
154
- synapse_reserve_gpus({ experimentUuid, gpuUuids }) # if needed
155
- synapse_get_node_access_bundle({ experimentUuid, nodeUuid }) # write PEM, chmod 600, SSH
156
- # run in tmux with python -u
157
- synapse_report_experiment_progress({ experimentUuid, message, phase, liveStatus })
158
- synapse_submit_experiment_results({ experimentUuid, outcome, experimentResults })
159
- synapse_save_experiment_report({ experimentUuid, title, content }) # if the flow needs it
160
- ```
161
-
162
- ### Planning / revision sub-agent
163
-
164
- A sub-agent can also be used for plan authoring or reviewer-driven revision:
165
-
166
- ```text
167
- synapse_get_experiment({ experimentUuid })
168
- synapse_get_comments({ targetType: "experiment", targetUuid: experimentUuid })
169
- synapse_update_experiment_status({ experimentUuid, status: "draft", liveStatus: "writing" })
170
- synapse_update_experiment_plan({ experimentUuid, description: "## Objective\n\n..." })
171
- synapse_update_experiment_status({ experimentUuid, status: "pending_review" })
172
- ```
173
-
174
- ### Main agent: monitor and continue
175
-
176
- The main agent does not block on any individual sub-agent. It polls Synapse:
177
-
178
- ```text
179
- synapse_get_assigned_experiments({
180
- researchProjectUuid,
181
- statuses: ["in_progress", "completed"]
182
- })
183
-
184
- # For any experiment still in_progress, read its latest state:
185
- synapse_get_experiment({ experimentUuid })
186
-
187
- # Once all have completed, synthesize and propose follow-ups:
188
- synapse_save_project_synthesis({ researchProjectUuid, title, content })
189
- synapse_propose_experiment({ researchProjectUuid, title, description })
190
- ```
191
-
192
- ### Sequential multi-experiment sub-agent
193
-
194
- One sub-agent can also handle multiple experiments in order when dependencies matter:
195
-
196
- ```text
197
- Task({
198
- subagent_type: "general-purpose",
199
- name: "sequential-worker",
200
- prompt: """
201
- Synapse experiments, in order (each depends on the previous):
202
- 1. <experiment-uuid-1> — baseline evaluation
203
- 2. <experiment-uuid-2> — ablation built on #1's results
204
-
205
- For each: start_experiment → run → report_progress → submit_results.
206
- """
207
- })
208
- ```
209
-
210
- ---
211
-
212
- ## Project-Level MCP For Sub-Agents
213
-
214
- Sub-agents only inherit Synapse MCP access if the MCP server is configured at the project level. Put `.mcp.json` at the project root (the plugin bundle ships the template at `public/synapse-plugin/.mcp.json`). User-level-only MCP configs will not reach Task sub-agents.
215
-
216
- ```json
217
- {
218
- "mcpServers": {
219
- "synapse": {
220
- "type": "http",
221
- "url": "<BASE_URL>/api/mcp",
222
- "headers": {
223
- "Authorization": "Bearer syn_xxxxxxxxxxxx"
224
- }
225
- }
226
- }
227
- }
228
- ```
229
-
230
- ---
231
-
232
- ## Tips
233
-
234
- - **Descriptive sub-agent names** — use `training-worker`, `eval-worker`, `exp-ablation-3` rather than `agent-1`. The name becomes the Synapse session name and is reused on respawn.
235
- - **Session reuse is automatic** — respawn with the same name and `on-subagent-start.sh` will reuse/reopen the existing session rather than create a duplicate.
236
- - **Heartbeats are automatic** — `TeammateIdle` sends them. You do not need to call `synapse_session_heartbeat` manually.
237
- - **Main agent never SSHs** — it orchestrates and monitors. All remote work belongs in sub-agents.
238
- - **Pass UUIDs, not workflow** — the `SubagentStart` hook already injects the experiment workflow. The main agent's sub-agent prompt only needs the experiment UUID plus a one-line intent.
239
-
240
- ---
241
-
242
- ## Troubleshooting
243
-
244
- | Symptom | Likely cause / fix |
245
- |---|---|
246
- | Sub-agent cannot see Synapse tools | MCP is user-level only. Move `.mcp.json` to the project root. |
247
- | Sub-agent session shown as `inactive` | Heartbeat has not fired for 1 h; sub-agent probably crashed. Respawn with the same name — `SubagentStart` will reopen the existing session. |
248
- | Duplicate sessions appear with similar names | A previous sub-agent stopped without the `SubagentStop` hook firing (hard crash). Close stale sessions with `synapse_close_session`, then respawn. |
249
- | Main agent did not receive checkin context | `SessionStart` hook failed; check `SYNAPSE_URL` and `SYNAPSE_API_KEY` in the environment. Recover by calling `synapse_checkin()` manually. |
250
- | Experiment stuck in `in_progress` | Sub-agent died before `synapse_submit_experiment_results`. Either respawn the sub-agent with the same experiment UUID (it will resume), or close it out with `synapse_submit_experiment_results({ outcome: "failure", experimentResults: { error: "..." } })`. |
251
- | `.synapse/` not cleaned up at session end | Deliberate — cleanup only happens when all sessions are closed and `state.json` is empty. Preserves state across resumed sessions. |