eminiar 0.11.0 → 0.12.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/hooks/hooks.json CHANGED
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "PreToolUse": [
18
18
  {
19
- "matcher": "Bash|Read|Edit|MultiEdit|Write|Grep|Glob|WebFetch|WebSearch|Agent|Task",
19
+ "matcher": "^(Bash|Read|Edit|MultiEdit|Write|Grep|Glob|WebFetch|WebSearch|Agent|Task|mcp__.*__em_swarm)$",
20
20
  "hooks": [
21
21
  { "type": "command", "command": "\"${CLAUDE_PLUGIN_ROOT}/bin/em-hook\"", "timeout": 5 }
22
22
  ]
@@ -41,6 +41,14 @@
41
41
  ]
42
42
  }
43
43
  ],
44
+ "SubagentStart": [
45
+ {
46
+ "matcher": "^swarm-",
47
+ "hooks": [
48
+ { "type": "command", "command": "\"${CLAUDE_PLUGIN_ROOT}/bin/em-hook\"", "timeout": 10 }
49
+ ]
50
+ }
51
+ ],
44
52
  "SubagentStop": [
45
53
  {
46
54
  "hooks": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eminiar",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Local-first context, memory and knowledge-graph plugin for Claude Code and Cursor. Sandboxed execution, FTS5 + vector search, session continuity, and a code graph — nothing leaves your machine.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: em-swarm
3
+ description: Coordinate an eminiar agent swarm from the main session — start a run of a swarm defined in .eminiar/swarm.yaml, plan small tasks, fan out worker subagents (swarm-<swarm>-<role>) in parallel, watch the task board, review the results and finish the run with a memory. Use when the user asks to run a swarm, use the X swarm, fan out workers, or parallelise a review across roles.
4
+ user-invocable: true
5
+ argument-hint: <swarm> <goal>
6
+ allowed-tools: mcp__plugin_eminiar_eminiar__em_swarm, mcp__plugin_eminiar_eminiar__em_recall, mcp__plugin_eminiar_eminiar__em_history, mcp__plugin_eminiar_eminiar__em_graph_impact, mcp__plugin_eminiar_eminiar__em_architecture, mcp__plugin_eminiar_eminiar__em_symbols, mcp__plugin_eminiar_eminiar__em_remember, Agent
7
+ ---
8
+
9
+ Arguments: $ARGUMENTS (first word: the swarm; the rest: the goal)
10
+
11
+ You are the **coordinator**. Subagents cannot spawn subagents, so only you plan, spawn and
12
+ review; workers are leaves that claim tasks and report back through `em_swarm`.
13
+
14
+ **Use a swarm when** the goal splits into 3 or more pieces of work that can run independently
15
+ (separate files or modules), or when you want several reviewers to look at the same change
16
+ from different angles at once.
17
+
18
+ **Skip it when** the change is a single-file edit, a quick fix, or tightly coupled sequential
19
+ work where each step needs the previous step's exact output. Do the work directly instead.
20
+
21
+ ## 0. Check the swarm exists
22
+
23
+ Call `em_swarm {action:"list"}`. If it says swarms are opt-in or disabled, stop and tell the user
24
+ how to opt in: `eminiar swarm init` (starter `.eminiar/swarm.yaml` plus generated agents), the
25
+ "Create starter swarm.yaml" button on the dashboard's Swarms tab (`eminiar ui`), or writing the
26
+ file by hand (https://github.com/rydn/eminiar/blob/main/docs/swarms.md). Do not improvise a swarm with ad-hoc subagents. If the file has
27
+ validation errors, show them and stop. If it says the call was not stamped by eminiar's hook,
28
+ stop and tell the user to run `eminiar upgrade` (or `eminiar install`) and check `/hooks`:
29
+ without the stamp every change is refused. If no swarm was named, pick the one whose description
30
+ fits the goal and say which.
31
+
32
+ ## 1. Start the run
33
+
34
+ `em_swarm {action:"start", swarm, goal}` returns your brief: the topology's rules, the roles with
35
+ their `subagent_type`, model and `count`, the capacity (`max_agents`), the swarm's own
36
+ instructions, and what eminiar knows (memories, bug-prone files, hot files, project brief).
37
+ Read it before planning. Check `em_recall` / `em_architecture` / `em_graph_impact` for anything
38
+ the brief leaves open.
39
+
40
+ If it warns that the swarm already has an active run in this session, either finish the old run
41
+ (`em_swarm {action:"finish", run, status:"cancelled"}`) or pass `run` on every later call: while
42
+ several runs are active, calls without `run` are refused with the list of runs.
43
+
44
+ ## 2. Plan small tasks
45
+
46
+ `em_swarm {action:"plan", tasks:[{key, title, detail, role, deps, files}]}`
47
+
48
+ - One task = what one worker can finish in one go. Name the files it touches in `files`.
49
+ - Only those six keys; put anything else in `detail` (other keys are refused).
50
+ - `role` must be a role of the swarm. `deps` take task ids or the `key` of an earlier task in the
51
+ same call. Avoid two parallel tasks editing the same file.
52
+ - Hierarchical: you assign every task to a role. Mesh: seed tasks; workers claim any.
53
+ Pipeline: a stage opens only when every task of the earlier stages is done. In every topology
54
+ workers may plan follow-up tasks (a reviewer adds fixes for the coder).
55
+
56
+ ## 3. Spawn workers
57
+
58
+ For each claimable task (the plan reply lists them), call the **Agent** tool with
59
+ `subagent_type: "swarm-<swarm>-<role>"` and a prompt that names the task as **"task #N"** plus
60
+ anything the worker needs beyond the task text. The worker claims that task itself as its first
61
+ step; eminiar briefs it with the project knowledge when it starts and with the task when it
62
+ claims.
63
+
64
+ - Use `run_in_background: true` to run independent tasks in parallel.
65
+ - `max_agents` caps the swarm's running workers across all its runs, and `count` caps each role.
66
+ eminiar denies spawns over capacity; if that happens, wait for a worker to finish or release a
67
+ stuck one (step 4).
68
+ - Spawn a task only once its deps are done.
69
+
70
+ ## 4. Watch
71
+
72
+ `em_swarm {action:"status"}` starts with the next step, then shows tasks by status, workers,
73
+ blackboard keys and recent events. For long runs, run `eminiar swarm watch` under the
74
+ **Monitor** tool. Its first line is `swarm.snapshot` (or `swarm.finished` if the run is already
75
+ closed); after that it prints one JSON line per change: `swarm.changed` while work is in flight,
76
+ `swarm.idle` when no worker is running and no task is active except ones held by quiet workers
77
+ (`stale_held`), which means it is your turn, and `swarm.finished` at the end. Workers' tool calls
78
+ never produce a line. Read shared findings with `em_swarm {action:"read"}`. Spawn the next
79
+ workers as deps complete.
80
+
81
+ A task line flagged **holder quiet Nm** belongs to a worker silent for 15 minutes or more,
82
+ usually one that crashed. Free it with `em_swarm {action:"release", agent}` (with no `agent`,
83
+ every quiet worker is released); the task goes back to pending, so spawn a new worker for it.
84
+
85
+ ## 5. Review
86
+
87
+ - Read every result. A task flagged **auto-closed** was closed from the worker's last message
88
+ because it never reported: check that the work is really done.
89
+ - Reopen unfinished work with `em_swarm {action:"update", task, status:"pending"}` or plan
90
+ follow-up tasks; `blocked` tasks need an answer or a re-plan.
91
+ - If the swarm has a reviewer role, run it **last**, on the full diff, as an adversarial
92
+ review. Turn each confirmed finding into a task and repeat until none are left.
93
+ - Run the tests yourself before you call the goal met.
94
+
95
+ ## 6. Finish
96
+
97
+ `em_swarm {action:"finish", status:"done"|"failed"|"cancelled", summary, remember:true}` closes
98
+ the run and its running workers, and writes the outcome as a memory (`swarm/run-<date>-<slug>`). Record durable decisions
99
+ and constraints the run produced with `em_remember`. Then report to the user: what changed,
100
+ which files, what was verified, and anything left open.