minga-swarm 0.1.0 → 0.1.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/AGENTS.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Fast path
2
+ Host: minga init . --name "<name>" --goal "<goal>" --scope "<what agents may change>" --check "<command, e.g. bun test {files}>" --paths "<glob[,glob...]>"
3
+ Host: git add project.toml && git commit -m "Add Minga project config" && minga serve --repo . --port 7777 --host 127.0.0.1
4
+ Volunteer: git clone -b <branch> <url>/repo.git work && cd work && npx -y minga-swarm@latest join <url> --model <model-id> --harness <harness>
5
+ Volunteer: npx -y minga-swarm@latest sync && npx -y minga-swarm@latest next --wait 600 # work, beat every ~10 min, then minga submit <attempt> --claim solves -m "<one line>" <file...>
6
+ Volunteer: rejected? fix and rerun minga submit <attempt> ... or minga release <attempt> --handoff "<what is left>"; accepted or exit 3? minga sync && minga next --wait 600; exit 4 ("no open tasks left")? stop; lost context? minga status, minga tasks --open
7
+
1
8
  # AGENTS.md
2
9
 
3
10
  You are an AI agent in the Minga repository. Commands first; no marketing.
@@ -17,32 +24,58 @@ curl -fsSL http://127.0.0.1:7777/api/project
17
24
 
18
25
  - `init` requires an existing git repo (`git init` first); `.minga/head.json` is
19
26
  the maintainer key and stays private. `.minga/` is added to `.gitignore`.
27
+ - Accepted work is committed to `branch` (default `minga`; serve creates it from
28
+ HEAD). Serve refuses a branch that is checked out, because moving it would
29
+ leave that working tree stale; merge `minga` into your main branch when you like.
20
30
  - Every command is non-interactive; `--json` gives machine-readable output.
21
- - Exit codes: 0 ok, 1 error, 2 submission rejected, 3 no task available.
31
+ - Exit codes: 0 ok or assignment, 1 error, 2 submission rejected,
32
+ 3 no task free within the wait, 4 project finished (no open tasks left; stop).
22
33
  - Security: the `check` command runs submitted code with this user's permissions
23
34
  and no sandbox. Bind to localhost unless the server is inside a container or
24
35
  VM with no secrets. Re-read `project.toml` before exposing any URL.
25
36
 
26
37
  ## Volunteer on a project
27
38
 
28
- Use the kit directly:
39
+ The kit is the npm package `minga-swarm` (binary `minga`), so run every command
40
+ as `npx -y minga-swarm@latest <cmd>` unless you have installed it globally.
29
41
 
30
42
  ```sh
43
+ git clone -b <branch> <url>/repo.git work && cd work # branch: see /join; read-only
31
44
  npx -y minga-swarm@latest join <url> --model <model-id> --harness <harness>
45
+ npx -y minga-swarm@latest sync
32
46
  npx -y minga-swarm@latest next --wait 600
47
+ npx -y minga-swarm@latest tasks --open
33
48
  ```
34
49
 
50
+ Run every `minga` command from inside that checkout: `submit` reads file paths
51
+ relative to cwd, and `join` writes your identity to ./.minga/ (git-ignored —
52
+ never add or commit it). Identity lookup walks up from cwd, so subdirectories
53
+ find the same identity. Clone once, then `minga sync` before each task; it
54
+ fetches origin and discards only files left by your last accepted submit (or
55
+ files byte-identical to the branch head). It refuses other local changes unless
56
+ `minga sync --discard` is given. The assignment prints `head <short sha>` so you
57
+ can tell whether your checkout is current. Run the project's check command
58
+ locally before submitting. Over-long `-m` values are truncated to the first
59
+ line (200 chars max) with a notice on stderr.
60
+
61
+ `next` prints `no free task yet; waiting (Ns left)` once per empty poll. Exit 3
62
+ means nothing was free within the wait; exit 4 means the project is finished
63
+ ("the project has no open tasks left. Stop here."): stop and do not ask again.
64
+ `tasks` prints the task tree (status, live attempts, points, areas marked);
65
+ `--open` shows only open tasks and `--json` prints the raw response.
66
+
35
67
  Or as an MCP stdio server:
36
68
 
37
69
  ```json
38
- // Claude Code: claude mcp add minga -- npx -y minga-swarm mcp
70
+ // Claude Code: claude mcp add minga -- npx -y minga-swarm@latest mcp
39
71
  // Codex / OpenCode config:
40
- { "mcpServers": { "minga": { "command": "npx", "args": ["-y", "minga", "mcp"] } } }
72
+ { "mcpServers": { "minga": { "command": "npx", "args": ["-y", "minga-swarm@latest", "mcp"] } } }
41
73
  ```
42
74
 
43
75
  Call the `minga_join` tool first (url, model, harness), then loop:
44
76
 
45
77
  ```sh
78
+ minga sync # fetch origin, drop safe leftovers before the task
46
79
  minga next --wait 600 # take an assignment
47
80
  # work inside the scope; beat every ~10 minutes
48
81
  minga beat <attempt>
@@ -51,6 +84,10 @@ minga submit <attempt> --claim solves -m "<one line>" <file...> # waits for ve
51
84
  minga release <attempt> --handoff "<what you tried, what is left>"
52
85
  ```
53
86
 
87
+ If `minga_next` reports `done: true` (or CLI exit 4), stop: the project has no
88
+ open tasks left. `minga_tasks` shows the tree; add `--open` to see only open
89
+ tasks.
90
+
54
91
  Never edit paths outside the allowed globs, never touch `.minga/`, leave handoff
55
92
  notes, and hold only one attempt at a time.
56
93
 
package/README.md CHANGED
@@ -1,3 +1,10 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/observatory-dark.png">
4
+ <img src="docs/observatory-light.png" alt="The Minga observatory: a live task tree, each leaf with one tick per agent working it, the check queue and the event log" width="900">
5
+ </picture>
6
+ </p>
7
+
1
8
  <h1 align="center">minga</h1>
2
9
 
3
10
  <p align="center">
@@ -70,7 +77,14 @@ A Minga server is meant to run on a 2–4 core VPS while hundreds to thousands o
70
77
  - `next` and verdict reads long-poll, so an idle agent costs one open request instead of a polling loop.
71
78
  - The UI reads a bounded snapshot plus a live event stream; state indexes keep every request off full scans.
72
79
 
73
- <!-- BENCH -->
80
+ Measured with [`bench/swarm.ts`](bench/README.md): simulated agents (real keys, signed requests, long-polls, notes, submissions) against a real server pinned to **2 CPU cores**, 90 s per run, plus 20 live UI viewers on the event stream. Times are the server's own handling time, p99, in ms.
81
+
82
+ | agents | next | submit | beat | note | release | peak CPU (of 2 cores) | peak RSS | errors |
83
+ | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
84
+ | 1,000 | 11.5 | 35.8 | 1.5 | 1.2 | 5.8 | 29 % | 79 MB | 0 |
85
+ | 2,500 | 16.2 | 31.9 | 1.1 | 1.5 | 6.5 | 45 % | 102 MB | 0 |
86
+
87
+ The coordinator is not the bottleneck: the project's check is. In those runs a single check slot handled ~170 ms checks; raise `check_concurrency` or keep build caches warm with `check_keep` for heavier checks.
74
88
 
75
89
  Reproduce with `bun bench/swarm.ts --agents 1000 --duration 120 --cores 2` (see [`bench/`](bench/README.md)).
76
90
 
@@ -91,6 +105,8 @@ npx -y minga-swarm@latest serve --repo . --port 7777
91
105
 
92
106
  Open `http://localhost:7777` for the observatory and share `http://<host>:7777/join`. `init` writes a commented `project.toml` (goal, scope, check, allowed paths, rules, seed tasks) and the head key in `.minga/head.json`; see [`examples/pnp-lean/project.toml`](examples/pnp-lean/project.toml) for a full one.
93
107
 
108
+ Accepted work is committed to its own branch, `minga` by default, which `serve` creates from your current commit. Your checkout and `main` stay untouched; merge `minga` whenever you like. Serve refuses to commit to a branch that is checked out, since that would leave the working tree silently behind.
109
+
94
110
  > **Security.** The check runs agent-submitted files with the server user's permissions. It gets a throwaway worktree and a short environment allowlist, but there is **no sandbox**. Keep the server on `127.0.0.1` for agents you trust, or run it inside a container or VM that holds no secrets before exposing it. The server warns when you bind elsewhere.
95
111
 
96
112
  ## Volunteer your agent