@evomap/evolver 1.89.3 → 1.89.4

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 (104) hide show
  1. package/.cursor/BUGBOT.md +182 -0
  2. package/.env.example +68 -0
  3. package/.git-commit-guard-token +1 -0
  4. package/.github/CODEOWNERS +63 -0
  5. package/.github/ISSUE_TEMPLATE/good_first_issue.md +23 -0
  6. package/.github/pull_request_template.md +45 -0
  7. package/.github/workflows/test.yml +75 -0
  8. package/CHANGELOG.md +1237 -0
  9. package/README.md +86 -528
  10. package/README.public.md +569 -0
  11. package/SECURITY.md +108 -0
  12. package/assets/gep/events.jsonl +3 -0
  13. package/examples/atp-consumer-quickstart.md +100 -0
  14. package/examples/hello-world.md +38 -0
  15. package/index.js +30 -1
  16. package/package.json +6 -17
  17. package/proxy-package.json +39 -0
  18. package/public.manifest.json +143 -0
  19. package/src/config.js +23 -0
  20. package/src/evolve/guards.js +721 -1
  21. package/src/evolve/pipeline/collect.js +1283 -1
  22. package/src/evolve/pipeline/dispatch.js +421 -1
  23. package/src/evolve/pipeline/enrich.js +440 -1
  24. package/src/evolve/pipeline/hub.js +319 -1
  25. package/src/evolve/pipeline/select.js +274 -1
  26. package/src/evolve/pipeline/signals.js +206 -1
  27. package/src/evolve/utils.js +264 -1
  28. package/src/evolve.js +350 -1
  29. package/src/experiment/agentRunner.js +229 -0
  30. package/src/experiment/cli.js +159 -0
  31. package/src/experiment/comparison.js +233 -0
  32. package/src/experiment/metrics.js +75 -0
  33. package/src/forceUpdate.js +147 -59
  34. package/src/gep/a2aProtocol.js +4455 -1
  35. package/src/gep/antiAbuseTelemetry.js +233 -0
  36. package/src/gep/autoDistillConv.js +205 -1
  37. package/src/gep/autoDistillLlm.js +315 -1
  38. package/src/gep/candidateEval.js +92 -1
  39. package/src/gep/candidates.js +198 -1
  40. package/src/gep/contentHash.js +30 -1
  41. package/src/gep/conversationSniffer.js +266 -1
  42. package/src/gep/crypto.js +89 -1
  43. package/src/gep/curriculum.js +163 -1
  44. package/src/gep/deviceId.js +218 -1
  45. package/src/gep/envFingerprint.js +118 -1
  46. package/src/gep/epigenetics.js +31 -1
  47. package/src/gep/execBridge.js +711 -1
  48. package/src/gep/explore.js +289 -1
  49. package/src/gep/hash.js +15 -1
  50. package/src/gep/hubFetch.js +359 -1
  51. package/src/gep/hubReview.js +207 -1
  52. package/src/gep/hubSearch.js +526 -1
  53. package/src/gep/hubVerify.js +306 -1
  54. package/src/gep/learningSignals.js +89 -1
  55. package/src/gep/memoryGraph.js +1374 -1
  56. package/src/gep/memoryGraphAdapter.js +203 -1
  57. package/src/gep/mutation.js +203 -1
  58. package/src/gep/narrativeMemory.js +108 -1
  59. package/src/gep/openPRRegistry.js +205 -1
  60. package/src/gep/personality.js +423 -1
  61. package/src/gep/policyCheck.js +599 -1
  62. package/src/gep/prompt.js +836 -1
  63. package/src/gep/recallInject.js +409 -1
  64. package/src/gep/recallVerifier.js +318 -1
  65. package/src/gep/reflection.js +177 -1
  66. package/src/gep/sanitize.js +9 -0
  67. package/src/gep/selector.js +602 -1
  68. package/src/gep/skillDistiller.js +1294 -1
  69. package/src/gep/solidify.js +1699 -1
  70. package/src/gep/strategy.js +136 -1
  71. package/src/gep/tokenSavings.js +88 -1
  72. package/src/gep/validator/sandboxExecutor.js +29 -1
  73. package/src/gep/workspaceKeychain.js +174 -1
  74. package/src/proxy/extensions/traceControl.js +99 -1
  75. package/src/proxy/index.js +10 -1
  76. package/src/proxy/inject.js +52 -1
  77. package/src/proxy/lifecycle/manager.js +19 -0
  78. package/src/proxy/mailbox/store.js +2 -1
  79. package/src/proxy/router/messages_route.js +5 -2
  80. package/src/proxy/trace/extractor.js +646 -1
  81. package/src/proxy/trace/usage.js +105 -1
  82. package/CONTRIBUTING.md +0 -19
  83. package/assets/cover.png +0 -0
  84. package/scripts/a2a_export.js +0 -63
  85. package/scripts/a2a_ingest.js +0 -79
  86. package/scripts/a2a_promote.js +0 -118
  87. package/scripts/analyze_by_skill.js +0 -121
  88. package/scripts/build_binaries.js +0 -479
  89. package/scripts/check-changelog.js +0 -166
  90. package/scripts/extract_log.js +0 -85
  91. package/scripts/generate_history.js +0 -75
  92. package/scripts/gep_append_event.js +0 -96
  93. package/scripts/gep_personality_report.js +0 -234
  94. package/scripts/human_report.js +0 -147
  95. package/scripts/recall-verify-report.js +0 -234
  96. package/scripts/recover_loop.js +0 -61
  97. package/scripts/refresh_stars_badge.js +0 -168
  98. package/scripts/seed-merchants.js +0 -91
  99. package/scripts/suggest_version.js +0 -89
  100. package/scripts/validate-modules.js +0 -38
  101. package/scripts/validate-suite.js +0 -78
  102. package/skills/index.json +0 -14
  103. /package/assets/gep/{genes.seed.json → genes.json} +0 -0
  104. /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
@@ -0,0 +1,569 @@
1
+ # 🧬 Evolver
2
+
3
+ [![GitHub stars](https://img.shields.io/badge/Stars-8.5k-2b3137?logo=github&logoColor=white)](https://github.com/EvoMap/evolver/stargazers)
4
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://opensource.org/licenses/GPL-3.0)
5
+ [![Node.js >= 18](https://img.shields.io/badge/Node.js-%3E%3D%2018-green.svg)](https://nodejs.org/)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@evomap/evolver.svg)](https://www.npmjs.com/package/@evomap/evolver)
7
+ [![arXiv](https://img.shields.io/badge/arXiv-2604.15097-b31b1b.svg)](https://arxiv.org/abs/2604.15097)
8
+
9
+ ![Evolver Cover](assets/cover.png)
10
+
11
+ **[evomap.ai](https://evomap.ai)** | [Documentation](https://evomap.ai/wiki) | [Chinese / 中文文档](README.zh-CN.md) | [Japanese / 日本語ドキュメント](README.ja-JP.md) | [Korean / 한국어 문서](README.ko-KR.md) | [GitHub](https://github.com/EvoMap/evolver) | [Releases](https://github.com/EvoMap/evolver/releases)
12
+
13
+ ---
14
+
15
+ > **Notice — Moving Toward Source-Available**
16
+ >
17
+ > Evolver has been fully open source since our first release on 2026-02-01 (initially MIT, and GPL-3.0-or-later since 2026-04-09). In March 2026, another project in the same lane released a system with strikingly similar memory / skill / evolution-asset design — without any attribution to Evolver. Full analysis: [Hermes Agent Self-Evolution vs. Evolver: A Detailed Similarity Analysis](https://evomap.ai/en/blog/hermes-agent-evolver-similarity-analysis).
18
+ >
19
+ > To protect the integrity of the work and keep investing in this direction, future Evolver releases will transition from fully open source to source-available. **Our commitment to users is unchanged**: we will keep shipping the best agent self-evolution capability in the industry — faster iteration, deeper GEP integration, stronger memory and skill systems. All already-published MIT and GPL-3.0 versions remain freely usable under their original terms. You can still `npm install @evomap/evolver` or clone this repo; nothing in your current workflow breaks.
20
+ >
21
+ > Questions or concerns: open an issue or reach us at [evomap.ai](https://evomap.ai).
22
+
23
+ ---
24
+
25
+ > **Research — The theory behind Evolver**
26
+ >
27
+ > **From Procedural Skills to Strategy Genes: Towards Experience-Driven Test-Time Evolution** · [arXiv:2604.15097](https://arxiv.org/abs/2604.15097) · [PDF](https://arxiv.org/pdf/2604.15097)
28
+ >
29
+ > Across 4,590 controlled trials on 45 scientific code-solving scenarios, the paper shows that documentation-oriented **Skill** packages provide unstable, sparse control signal, while a compact **Gene** representation delivers the strongest overall performance, stays robust under structural perturbation, and is a far better carrier for iterative experience accumulation. On CritPt, gene-evolved systems lift their paired base models from 9.1% to 18.57% and from 17.7% to 27.14%.
30
+ >
31
+ > Evolver is the open-source engine that puts this result into practice: it encodes agent experience as Genes and Capsules under the GEP protocol, not as ad hoc prompts or skill docs. If you've ever wondered *why* Evolver insists on Genes instead of longer skill docs, this is the paper to read.
32
+ >
33
+ > Want the applied version? [OpenClaw x EvoMap: CritPt Evaluation Report](https://evomap.ai/blog/openclaw-critpt-report) walks through how the same Gene-based evolution loop drives an OpenClaw agent from 9.1% to 18.57% on CritPt Physics Solver across five versions (Beta -> v2.2), with full token-cost trajectories, gene activation mapping, and the "tokens rise then fall" signature of reasoning getting compressed into reusable genes.
34
+
35
+ ---
36
+
37
+ > **"Evolution is not optional. Adapt or die."**
38
+
39
+ **Three lines**
40
+ - **What it is**: A [GEP](https://evomap.ai/wiki)-powered self-evolution engine for AI agents.
41
+ - **Pain it solves**: Turns ad hoc prompt tweaks into auditable, reusable evolution assets.
42
+ - **Use in 30 seconds**: `npm install -g @evomap/evolver`, then run `evolver` in any git repo.
43
+
44
+ ## EvoMap -- The Evolution Network
45
+
46
+ Evolver is the core engine behind **[EvoMap](https://evomap.ai)**, a network where AI agents evolve through validated collaboration. Visit [evomap.ai](https://evomap.ai) to explore the full platform -- live agent maps, evolution leaderboards, and the ecosystem that turns isolated prompt tweaks into shared, auditable intelligence.
47
+
48
+ Keywords: protocol-constrained evolution, audit trail, genes and capsules, prompt governance.
49
+
50
+ ## Choose Your Path
51
+
52
+ Evolver has one install but two usage shapes. Pick the one that matches how you plan to use it, then follow only that section.
53
+
54
+ | Path | Who it's for | Command after install | Guide |
55
+ |---|---|---|---|
56
+ | **CLI Quick Start** | You just want to use Evolver to evolve an agent / project. 99% of readers. | `evolver` | [below](#cli-quick-start) |
57
+ | **Run from Source** | You want to hack on the engine, send PRs, or run unreleased builds. | `node index.js` | [below](#run-from-source-contributors-only) |
58
+
59
+ > **For agent / skill integrations** (Codex, Claude Code skill system, custom MCP clients) see the separate [SKILL.md](SKILL.md) -- it documents the Proxy mailbox API that wraps the CLI. You still install Evolver via the CLI Quick Start below first.
60
+
61
+ ## Prerequisites
62
+
63
+ - **[Node.js](https://nodejs.org/)** >= 18
64
+ - **[Git](https://git-scm.com/)** -- Required. Evolver uses git for rollback, blast radius calculation, and solidify. Running in a non-git directory will fail with a clear error message.
65
+
66
+ ## CLI Quick Start
67
+
68
+ This is the recommended path for almost everyone.
69
+
70
+ ### 1. Install
71
+
72
+ ```bash
73
+ npm install -g @evomap/evolver
74
+ ```
75
+
76
+ Verify the CLI is on your PATH:
77
+
78
+ ```bash
79
+ evolver --help
80
+ ```
81
+
82
+ If you hit `EACCES` on Linux/macOS, configure a user-level prefix instead of using `sudo`:
83
+
84
+ ```bash
85
+ npm config set prefix ~/.npm-global
86
+ echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
87
+ source ~/.bashrc
88
+ ```
89
+
90
+ ### 2. Run it
91
+
92
+ From inside any **git-initialized** project directory:
93
+
94
+ ```bash
95
+ # Single evolution run -- scans logs, selects a Gene, outputs a GEP prompt
96
+ evolver
97
+
98
+ # Review mode -- pause before applying, wait for human confirmation
99
+ evolver --review
100
+
101
+ # Continuous loop -- runs as a background daemon
102
+ evolver --loop
103
+ ```
104
+
105
+ A "successful first run" looks like:
106
+
107
+ 1. Evolver prints a banner with the detected strategy preset (e.g. `balanced`).
108
+ 2. It scans `./memory/` (creates it if missing) for logs and signals.
109
+ 3. It selects a matching Gene / Capsule from its built-in asset pool.
110
+ 4. It prints a **GEP prompt** to stdout -- that's the artifact. Copy it into your agent, or let a host runtime (OpenClaw, Cursor hook, Claude Code hook) consume it automatically.
111
+ 5. It writes an `EvolutionEvent` into `./memory/` for audit.
112
+
113
+ If step 4 didn't appear, you're not running inside a git repo -- `cd` into one and retry. Everything else runs fully offline.
114
+
115
+ ### 3. Connect to the EvoMap network (optional)
116
+
117
+ Evolver works fully offline. Hub connection only unlocks network features (skill sharing, worker pool, evolution leaderboards).
118
+
119
+ Create a `.env` file **in the current working directory where you run `evolver`** (not in your home directory, not in the global npm install location):
120
+
121
+ ```bash
122
+ # Register at https://evomap.ai to get your Node ID
123
+ A2A_HUB_URL=https://evomap.ai
124
+ A2A_NODE_ID=your_node_id_here
125
+ ```
126
+
127
+ Evolver reads `.env` from `process.cwd()` on each run. If you run `evolver` from multiple projects, each project can have its own `.env`.
128
+
129
+ ### 4. Wire up your agent runtime (optional)
130
+
131
+ Evolver integrates with major agent runtimes through `setup-hooks`. Run it once per platform you want to wire up.
132
+
133
+ | Platform | Command | What it writes |
134
+ |---|---|---|
135
+ | [Cursor](https://cursor.com) | `evolver setup-hooks --platform=cursor` | `~/.cursor/hooks.json` + scripts in `~/.cursor/hooks/`. Restart Cursor or open a new session. Fires on `sessionStart`, `afterFileEdit`, `stop`. |
136
+ | [Claude Code](https://www.anthropic.com/claude-code) | `evolver setup-hooks --platform=claude-code` | Registers with Claude Code's hook system via `~/.claude/`. Restart the Claude Code CLI. |
137
+ | [Codex](https://github.com/openai/codex) | `evolver setup-hooks --platform=codex` | `~/.codex/hooks.json` + scripts in `~/.codex/hooks/`, enables `codex_hooks` feature in `config.toml`. Restart the Codex CLI. See [Codex caveats](#codex-caveats) below. |
138
+ | [Kiro](https://kiro.dev) | `evolver setup-hooks --platform=kiro` | Three `*.kiro.hook` files + scripts in `~/.kiro/hooks/`. Auto-discovered, no restart needed. |
139
+ | [opencode](https://opencode.ai) | `evolver setup-hooks --platform=opencode` | Plugin at `~/.opencode/plugins/evolver.js` + scripts in `~/.opencode/hooks/`. Restart opencode. |
140
+ | [OpenClaw](https://openclaw.com) | No setup needed | OpenClaw natively interprets the `sessions_spawn(...)` stdout directives Evolver emits. Just run `evolver` from inside an OpenClaw session. |
141
+
142
+ #### Codex caveats
143
+
144
+ The Codex CLI exposes `SessionStart` / `Stop` / `PostToolUse` hooks (which is
145
+ how `setup-hooks --platform=codex` wires Evolver in), but it does **not**
146
+ emit a session transcript file the way Cursor / Claude Code / opencode do.
147
+ That means `evolver --review` cannot read raw session logs on Codex.
148
+
149
+ Evolver compensates by reading, in order:
150
+
151
+ 1. `MEMORY.md` / `USER.md` in the workspace root (if you maintain them);
152
+ 2. the `<!-- evolver-evolution-memory -->` section that
153
+ `setup-hooks --platform=codex` injects into your project's
154
+ `AGENTS.md`;
155
+ 3. the tail of the local `memory_graph.jsonl` (the per-cycle outcome log
156
+ that Evolver writes itself).
157
+
158
+ If none of those have content yet, you'll see `memory_missing` /
159
+ `user_missing` / `session_logs_missing` show up as advisory signals
160
+ during the first few cycles. They will go quiet on their own as
161
+ `memory_graph.jsonl` accumulates outcomes — no manual setup required.
162
+
163
+ ## Run from Source (Contributors Only)
164
+
165
+ Skip this section entirely if you installed via `npm install -g @evomap/evolver` above. This path exists so contributors can hack on the engine.
166
+
167
+ ```bash
168
+ git clone https://github.com/EvoMap/evolver.git
169
+ cd evolver
170
+ npm install
171
+
172
+ # Then use node index.js wherever the CLI docs say evolver
173
+ node index.js # equivalent to: evolver
174
+ node index.js --review # equivalent to: evolver --review
175
+ node index.js --loop # equivalent to: evolver --loop
176
+ ```
177
+
178
+ Every `evolver <flag>` invocation in the rest of this README maps 1:1 to `node index.js <flag>` when running from source.
179
+
180
+ ## What Evolver Does (and Does Not Do)
181
+
182
+ **Evolver is a prompt generator, not a code patcher.** Each evolution cycle:
183
+
184
+ 1. Scans your `memory/` directory for runtime logs, error patterns, and signals.
185
+ 2. Selects the best-matching [Gene or Capsule](https://evomap.ai/wiki) from the local GEP asset store.
186
+ 3. Emits a strict, protocol-bound GEP prompt that guides the next evolution step.
187
+ 4. Records an auditable [EvolutionEvent](https://evomap.ai/wiki) for traceability.
188
+
189
+ **It does NOT**:
190
+ - Automatically edit your source code.
191
+ - Execute arbitrary shell commands (see [Security Model](#security-model)).
192
+ - Require an internet connection for core functionality.
193
+
194
+ ### How It Integrates with Host Runtimes
195
+
196
+ When running inside a host runtime (e.g., [OpenClaw](https://openclaw.com)), the `sessions_spawn(...)` text printed to stdout can be picked up by the host to trigger follow-up actions. **In standalone mode, these are just text output** -- nothing is executed automatically.
197
+
198
+ | Mode | Behavior |
199
+ | :--- | :--- |
200
+ | Standalone (`evolver`) | Generates prompt, prints to stdout, exits |
201
+ | Loop (`evolver --loop`) | Repeats the above in a daemon loop with adaptive sleep |
202
+ | Inside OpenClaw | Host runtime interprets stdout directives like `sessions_spawn(...)` |
203
+
204
+ > **`--loop` is not a real-time agent assistant.** Loop mode is for background self-maintenance (validator runs, worker tasks, ATP merchant auto-deliver, solidify). Its stdout is consumed by evolver itself, **not** by a running host agent, so `sessions_spawn(...)` directives produced in loop mode will not be picked up by OpenClaw / Cursor / Claude Code even if those runtimes are installed. If you want evolver to observe and advise a live agent session, call `evolver` from **inside** that agent session (OpenClaw will pick up the stdout directives on that single run). For OpenClaw specifically, also make sure `AGENT_NAME` (or `AGENT_SESSIONS_DIR`) points at the agent directory actually producing sessions under `~/.openclaw/agents/<name>/sessions/` -- otherwise evolver falls back to reading its own logs and looks like it is "cycling emptily".
205
+
206
+ ## Who This Is For / Not For
207
+
208
+ **For**
209
+ - Teams maintaining agent prompts and logs at scale
210
+ - Users who need auditable evolution traces ([Genes](https://evomap.ai/wiki), [Capsules](https://evomap.ai/wiki), [Events](https://evomap.ai/wiki))
211
+ - Environments requiring deterministic, protocol-bound changes
212
+
213
+ **Not For**
214
+ - One-off scripts without logs or history
215
+ - Projects that require free-form creative changes
216
+ - Systems that cannot tolerate protocol overhead
217
+
218
+ ## Features
219
+
220
+ - **Auto-Log Analysis**: scans memory and history files for errors and patterns.
221
+ - **Self-Repair Guidance**: emits repair-focused directives from signals.
222
+ - **[GEP Protocol](https://evomap.ai/wiki)**: standardized evolution with reusable assets.
223
+ - **Mutation + Personality Evolution**: each evolution run is gated by an explicit Mutation object and an evolvable PersonalityState.
224
+ - **Configurable Strategy Presets**: `EVOLVE_STRATEGY=balanced|innovate|harden|repair-only` controls intent balance.
225
+ - **Signal De-duplication**: prevents repair loops by detecting stagnation patterns.
226
+ - **Operations Module** (`src/ops/`): portable lifecycle, skill monitoring, cleanup, self-repair, wake triggers -- zero platform dependency.
227
+ - **Protected Source Files**: prevents autonomous agents from overwriting core evolver code.
228
+ - **[Skill Store](https://evomap.ai)**: download and share reusable skills via `evolver fetch --skill <id>`.
229
+
230
+ ## Typical Use Cases
231
+
232
+ - Harden a flaky agent loop by enforcing validation before edits
233
+ - Encode recurring fixes as reusable [Genes and Capsules](https://evomap.ai/wiki)
234
+ - Produce auditable evolution events for review or compliance
235
+
236
+ ## Anti-Examples
237
+
238
+ - Rewriting entire subsystems without signals or constraints
239
+ - Using the protocol as a generic task runner
240
+ - Producing changes without recording EvolutionEvent
241
+
242
+ ## Usage
243
+
244
+ All commands below assume you installed with `npm install -g @evomap/evolver`. If you are running from source, substitute `node index.js` for `evolver` -- they are equivalent.
245
+
246
+ ### Standard Run (Automated)
247
+ ```bash
248
+ evolver
249
+ ```
250
+
251
+ ### Review Mode (Human-in-the-Loop)
252
+ ```bash
253
+ evolver --review
254
+ ```
255
+
256
+ ### Continuous Loop
257
+ ```bash
258
+ evolver --loop
259
+ ```
260
+
261
+ ### With Strategy Preset
262
+ ```bash
263
+ EVOLVE_STRATEGY=innovate evolver --loop # maximize new features
264
+ EVOLVE_STRATEGY=harden evolver --loop # focus on stability
265
+ EVOLVE_STRATEGY=repair-only evolver --loop # emergency fix mode
266
+ ```
267
+
268
+ | Strategy | Innovate | Optimize | Repair | When to Use |
269
+ | :--- | :--- | :--- | :--- | :--- |
270
+ | `balanced` (default) | 50% | 30% | 20% | Daily operation, steady growth |
271
+ | `innovate` | 80% | 15% | 5% | System stable, ship new features fast |
272
+ | `harden` | 20% | 40% | 40% | After major changes, focus on stability |
273
+ | `repair-only` | 0% | 20% | 80% | Emergency state, all-out repair |
274
+
275
+ ### Operations (Lifecycle Management)
276
+ ```bash
277
+ node src/ops/lifecycle.js start # start evolver loop in background
278
+ node src/ops/lifecycle.js stop # graceful stop (SIGTERM -> SIGKILL)
279
+ node src/ops/lifecycle.js status # show running state
280
+ node src/ops/lifecycle.js check # health check + auto-restart if stagnant
281
+ ```
282
+
283
+ ### Skill Store
284
+ ```bash
285
+ # Download a skill from the EvoMap network
286
+ evolver fetch --skill <skill_id>
287
+
288
+ # Specify output directory
289
+ evolver fetch --skill <skill_id> --out=./my-skills/
290
+ ```
291
+
292
+ Requires `A2A_HUB_URL` to be configured. Browse available skills at [evomap.ai](https://evomap.ai).
293
+
294
+ ### Cron / External Runner Keepalive
295
+ If you run a periodic keepalive/tick from a cron/agent runner, prefer a single simple command with minimal quoting.
296
+
297
+ Recommended:
298
+
299
+ ```bash
300
+ bash -lc 'evolver --loop'
301
+ ```
302
+
303
+ Avoid composing multiple shell segments inside the cron payload (for example `...; echo EXIT:$?`) because nested quotes can break after passing through multiple serialization/escaping layers.
304
+
305
+ For process managers like pm2, the same principle applies -- wrap the command simply:
306
+
307
+ ```bash
308
+ pm2 start "bash -lc 'evolver --loop'" --name evolver --cron-restart="0 */6 * * *"
309
+ ```
310
+
311
+ ## Connecting to EvoMap Hub
312
+
313
+ Evolver can optionally connect to the [EvoMap Hub](https://evomap.ai) for network features. This is **not required** for core evolution functionality.
314
+
315
+ ### Setup
316
+
317
+ 1. Register at [evomap.ai](https://evomap.ai) and get your Node ID.
318
+ 2. Add the following to your `.env` file:
319
+
320
+ ```bash
321
+ A2A_HUB_URL=https://evomap.ai
322
+ A2A_NODE_ID=your_node_id_here
323
+ ```
324
+
325
+ ### What Hub Connection Enables
326
+
327
+ | Feature | Description |
328
+ | :--- | :--- |
329
+ | **Heartbeat** | Periodic check-in with the Hub; reports node status and receives available work |
330
+ | **Skill Store** | Download and publish reusable skills (`evolver fetch`) |
331
+ | **Worker Pool** | Accept and execute evolution tasks from the network (see [Worker Pool](#worker-pool-evomap-network)) |
332
+ | **Evolution Circle** | Collaborative evolution groups with shared context |
333
+ | **Asset Publishing** | Share your Genes and Capsules with the network |
334
+
335
+ ### How It Works
336
+
337
+ When `evolver --loop` is running with Hub configured:
338
+
339
+ 1. On startup, evolver sends a `hello` message to register with the Hub.
340
+ 2. A heartbeat is sent every 6 minutes (configurable via `HEARTBEAT_INTERVAL_MS`).
341
+ 3. The Hub responds with available work, overdue task alerts, and skill store hints.
342
+ 4. If `WORKER_ENABLED=1`, the node advertises its capabilities and picks up tasks.
343
+
344
+ Without Hub configuration, evolver runs fully offline -- all core evolution features work locally.
345
+
346
+ ## Worker Pool (EvoMap Network)
347
+
348
+ When `WORKER_ENABLED=1`, this node participates as a worker in the [EvoMap network](https://evomap.ai). It advertises its capabilities via heartbeat and picks up tasks from the network's available-work queue. Tasks are claimed atomically during solidify after a successful evolution cycle.
349
+
350
+ | Variable | Default | Description |
351
+ |----------|---------|-------------|
352
+ | `WORKER_ENABLED` | _(unset)_ | Set to `1` to enable worker pool mode |
353
+ | `WORKER_DOMAINS` | _(empty)_ | Comma-separated list of task domains this worker accepts (e.g. `repair,harden`) |
354
+ | `WORKER_MAX_LOAD` | `5` | Advertised maximum concurrent task capacity for hub-side scheduling (not a locally enforced concurrency limit) |
355
+
356
+ ```bash
357
+ WORKER_ENABLED=1 WORKER_DOMAINS=repair,harden WORKER_MAX_LOAD=3 evolver --loop
358
+ ```
359
+
360
+ ### WORKER_ENABLED vs. the Website Toggle
361
+
362
+ The [evomap.ai](https://evomap.ai) dashboard has a "Worker" toggle on the node detail page. Here is how the two relate:
363
+
364
+ | Control | Scope | What It Does |
365
+ | :--- | :--- | :--- |
366
+ | `WORKER_ENABLED=1` (env var) | **Local** | Tells your local evolver daemon to include worker metadata in heartbeats and accept tasks |
367
+ | Website toggle | **Hub-side** | Tells the Hub whether to dispatch tasks to this node |
368
+
369
+ **Both must be enabled** for your node to receive and execute tasks. If either side is off, the node will not pick up work from the network. The recommended flow:
370
+
371
+ 1. Set `WORKER_ENABLED=1` in your `.env` and start `evolver --loop`.
372
+ 2. Go to [evomap.ai](https://evomap.ai), find your node, and turn on the Worker toggle.
373
+
374
+ ## GEP Protocol (Auditable Evolution)
375
+
376
+ This repo includes a protocol-constrained prompt mode based on [GEP (Genome Evolution Protocol)](https://evomap.ai/wiki).
377
+
378
+ - **Structured runtime assets** live in `<workspace>/.evolver/gep/` by default:
379
+ - `<workspace>/.evolver/gep/genes.json`
380
+ - `<workspace>/.evolver/gep/capsules.json`
381
+ - `<workspace>/.evolver/gep/events.jsonl`
382
+ - Set `GEP_ASSETS_DIR` to place the runtime asset store elsewhere.
383
+ - **Selector** logic uses extracted signals to prefer existing Genes/Capsules and emits a JSON selector decision in the prompt.
384
+ - **Constraints**: Only the DNA emoji is allowed in documentation; all other emoji are disallowed.
385
+
386
+ ### Your local asset store is never overwritten by upgrades
387
+
388
+ `<workspace>/.evolver/gep/genes.json`, `<workspace>/.evolver/gep/capsules.json`, and `<workspace>/.evolver/gep/events.jsonl` are owned by your runtime and ignored by git. `assets/gep/` is reserved for bundled starter assets. On first run, evolver copies any legacy runtime files from `assets/gep/` into `.evolver/gep/` without deleting the originals, then seeds `genes.json` from the bundled starter genes only when no local `genes.json` exists.
389
+
390
+ If you ran an older evolver version that wiped your local assets, pull back everything you Promoted or published to the Hub with a single command:
391
+
392
+ ```bash
393
+ A2A_HUB_URL=https://evomap.ai evolver sync --scope=all --export=backup.gepx
394
+ ```
395
+
396
+ This hits `/a2a/assets/purchased` (Promoted-to-you plus self-purchased) and `/a2a/assets/published-by-me` (your own drafts and published assets), re-materializes the full payloads into `genes.json` / `capsules.json`, and packs a portable `.gepx` bundle. Previously-purchased payloads re-fetch at zero cost.
397
+
398
+ Purely local assets that were never uploaded to the Hub have no remote copy -- recover them from `.evolver/gep/`, from an older `assets/gep/` checkout, or from disk snapshots.
399
+
400
+ ## Configuration & Decoupling
401
+
402
+ Evolver is designed to be **environment-agnostic**.
403
+
404
+ ### Core Environment Variables
405
+
406
+ | Variable | Description | Default |
407
+ | :--- | :--- | :--- |
408
+ | `EVOLVE_STRATEGY` | Evolution strategy preset (`balanced` / `innovate` / `harden` / `repair-only`) | `balanced` |
409
+ | `A2A_HUB_URL` | [EvoMap Hub](https://evomap.ai) URL | _(unset, offline mode)_ |
410
+ | `A2A_NODE_ID` | Your node identity on the network | _(auto-generated from device fingerprint)_ |
411
+ | `HEARTBEAT_INTERVAL_MS` | Hub heartbeat interval | `360000` (6 min) |
412
+ | `MEMORY_DIR` | Memory files path | `./memory` |
413
+ | `EVOLVE_REPORT_TOOL` | Tool name for reporting results | `message` |
414
+
415
+ ### Local Overrides (Injection)
416
+ You can inject local preferences (e.g., using `feishu-card` instead of `message` for reports) without modifying the core code.
417
+
418
+ **Method 1: Environment Variables**
419
+ Set `EVOLVE_REPORT_TOOL` in your `.env` file:
420
+ ```bash
421
+ EVOLVE_REPORT_TOOL=feishu-card
422
+ ```
423
+
424
+ **Method 2: Dynamic Detection**
425
+ The script automatically detects if compatible local skills (like `skills/feishu-card`) exist in your workspace and upgrades its behavior accordingly.
426
+
427
+ ### Validator Role (default ON)
428
+
429
+ When connected to an [EvoMap Hub](https://evomap.ai), every evolver instance also acts as a **decentralized validator**: it periodically pulls a small batch of validation tasks assigned by the hub, runs the proposer's claimed validation commands inside the existing sandbox, and submits a `ValidationReport` back. Validators that join consensus earn credits and reputation.
430
+
431
+ | Variable | Default | Description |
432
+ |----------|---------|-------------|
433
+ | `EVOLVER_VALIDATOR_ENABLED` | _(unset = ON)_ | `0`/`false`/`off` to opt out; `1`/`true`/`on` to force on. Env always wins over hub-pushed flag and the built-in default. |
434
+ | `EVOLVER_VALIDATOR_DAEMON_INTERVAL_MS` | `60000` | Interval between validator polls when running in `--loop` / `--mad-dog` mode. |
435
+ | `EVOLVER_VALIDATOR_MAX_TASKS_PER_CYCLE` | `2` | Max tasks claimed per poll. |
436
+ | `EVOLVER_VALIDATOR_FETCH_TIMEOUT_MS` | `8000` | Timeout for the per-poll task fetch. |
437
+
438
+ Persistent flag override: when the env is unset, the runtime reads `~/.evomap/feature_flags.json`. The hub may push `feature_flag_update` events through the existing mailbox channel to flip this on for legacy installs after upgrade.
439
+
440
+ To opt out permanently:
441
+
442
+ ```bash
443
+ EVOLVER_VALIDATOR_ENABLED=0 evolver --loop
444
+ ```
445
+
446
+ ### Auto GitHub Issue Reporting
447
+
448
+ When the evolver detects persistent failures (failure loop or recurring errors with high failure ratio), it can automatically file a GitHub issue to the upstream repository with sanitized environment info and logs. All sensitive data (tokens, local paths, emails, etc.) is redacted before submission.
449
+
450
+ | Variable | Default | Description |
451
+ |----------|---------|-------------|
452
+ | `EVOLVER_AUTO_ISSUE` | `true` | Enable/disable auto issue reporting |
453
+ | `EVOLVER_ISSUE_REPO` | `EvoMap/evolver` | Target GitHub repository (owner/repo) |
454
+ | `EVOLVER_ISSUE_COOLDOWN_MS` | `86400000` (24h) | Cooldown period for the same error signature |
455
+ | `EVOLVER_ISSUE_MIN_STREAK` | `5` | Minimum consecutive failure streak to trigger |
456
+
457
+ Requires `GITHUB_TOKEN` (or `GH_TOKEN` / `GITHUB_PAT`) with `repo` scope. When no token is available, the feature is silently skipped.
458
+
459
+ ## Security Model
460
+
461
+ This section describes the execution boundaries and trust model of the Evolver.
462
+
463
+ ### What Executes and What Does Not
464
+
465
+ | Component | Behavior | Executes Shell Commands? |
466
+ | :--- | :--- | :--- |
467
+ | `src/evolve.js` | Reads logs, selects genes, builds prompts, writes artifacts | Read-only git/process queries only |
468
+ | `src/gep/prompt.js` | Assembles the GEP protocol prompt string | No (pure text generation) |
469
+ | `src/gep/selector.js` | Scores and selects Genes/Capsules by signal matching | No (pure logic) |
470
+ | `src/gep/solidify.js` | Validates patches via Gene `validation` commands | Yes (see below) |
471
+ | `index.js` (loop recovery) | Prints `sessions_spawn(...)` text to stdout on crash | No (text output only; execution depends on host runtime) |
472
+
473
+ ### Gene Validation Command Safety
474
+
475
+ `solidify.js` executes commands listed in a Gene's `validation` array. To prevent arbitrary command execution, all validation commands are gated by a safety check (`isValidationCommandAllowed`):
476
+
477
+ 1. **Prefix whitelist**: Only commands starting with `node`, `npm`, or `npx` are allowed.
478
+ 2. **No command substitution**: Backticks and `$(...)` are rejected anywhere in the command string.
479
+ 3. **No shell operators**: After stripping quoted content, `;`, `&`, `|`, `>`, `<` are rejected.
480
+ 4. **Timeout**: Each command is limited to 180 seconds.
481
+ 5. **Scoped execution**: Commands run with `cwd` set to the repository root.
482
+
483
+ ### A2A External Asset Ingestion
484
+
485
+ External Gene/Capsule assets ingested via `scripts/a2a_ingest.js` are staged in an isolated candidate zone. Promotion to local stores (`scripts/a2a_promote.js`) requires:
486
+
487
+ 1. Explicit `--validated` flag (operator must verify the asset first).
488
+ 2. For Genes: all `validation` commands are audited against the same safety check before promotion. Unsafe commands cause the promotion to be rejected.
489
+ 3. Gene promotion never overwrites an existing local Gene with the same ID.
490
+
491
+ ### `sessions_spawn` Output
492
+
493
+ The `sessions_spawn(...)` strings in `index.js` and `evolve.js` are **text output to stdout**, not direct function calls. Whether they are interpreted depends on the host runtime (e.g., OpenClaw platform). The evolver itself does not invoke `sessions_spawn` as executable code.
494
+
495
+ ## Versioning (SemVer)
496
+
497
+ MAJOR.MINOR.PATCH
498
+
499
+ - MAJOR: incompatible changes
500
+ - MINOR: backward-compatible features
501
+ - PATCH: backward-compatible bug fixes
502
+
503
+ ## Changelog
504
+
505
+ See the full release history on [GitHub Releases](https://github.com/EvoMap/evolver/releases).
506
+
507
+ ## FAQ
508
+
509
+ **Does this edit code automatically?**
510
+ No. Evolver generates a protocol-bound prompt and assets that guide evolution. It does not modify your source code directly. See [What Evolver Does (and Does Not Do)](#what-evolver-does-and-does-not-do).
511
+
512
+ **I ran `evolver --loop` but it just keeps printing text. Is it working?**
513
+ Yes. In standalone mode, evolver generates GEP prompts and prints them to stdout. If you expected it to automatically apply changes, you need a host runtime like [OpenClaw](https://openclaw.com) that interprets the output. Alternatively, use `--review` mode to manually review and apply each evolution step.
514
+
515
+ **Do I need to connect to EvoMap Hub?**
516
+ No. All core evolution features work offline. Hub connection is only needed for network features like the skill store, worker pool, and evolution leaderboards. See [Connecting to EvoMap Hub](#connecting-to-evomap-hub).
517
+
518
+ **Do I need to use all GEP assets?**
519
+ No. You can start with default Genes and extend over time.
520
+
521
+ **Is this safe in production?**
522
+ Use review mode and validation steps. Treat it as a safety-focused evolution tool, not a live patcher. See [Security Model](#security-model).
523
+
524
+ **Where should I clone this repo?**
525
+ Clone it into any directory you like. If you use [OpenClaw](https://openclaw.com), clone it into your OpenClaw workspace so the host runtime can access evolver's stdout. For standalone use, any location works.
526
+
527
+ ## Roadmap
528
+
529
+ Directional, not commitments — the live backlog lives in [GitHub Issues](https://github.com/EvoMap/evolver/issues).
530
+
531
+ - **Onboarding**: a one-minute quickstart demo and a comparison table vs. alternative agent-evolution approaches.
532
+ - **Deeper GEP integration**: richer signal extraction and Gene / Capsule selection, plus reuse analytics.
533
+ - **Memory & skills**: faster distillation of session outcomes into reusable Genes and Capsules.
534
+ - **Broader runtime coverage**: more first-class host integrations beyond Cursor / Claude Code / Codex / Kiro / opencode / OpenClaw.
535
+
536
+ ## Star History
537
+
538
+ [![Star History Chart](https://api.star-history.com/svg?repos=EvoMap/evolver&type=Date)](https://star-history.com/#EvoMap/evolver&Date)
539
+
540
+ ## Acknowledgments
541
+
542
+ - [onthebigtree](https://github.com/onthebigtree) -- Inspired the creation of evomap evolution network. Fixed three runtime and logic bugs (PR [#25](https://github.com/EvoMap/evolver/pull/25)); contributed hostname privacy hashing, portable validation paths, and dead code cleanup (PR [#26](https://github.com/EvoMap/evolver/pull/26)).
543
+ - [lichunr](https://github.com/lichunr) -- Contributed thousands of dollars in tokens for our compute network to use for free.
544
+ - [shinjiyu](https://github.com/shinjiyu) -- Submitted numerous bug reports and contributed multilingual signal extraction with snippet-carrying tags (PR [#112](https://github.com/EvoMap/evolver/pull/112)).
545
+ - [voidborne-d](https://github.com/voidborne-d) -- Hardened pre-broadcast sanitization with 11 new credential redaction patterns (PR [#107](https://github.com/EvoMap/evolver/pull/107)); added 45 tests for strategy, validationReport, and envFingerprint (PR [#139](https://github.com/EvoMap/evolver/pull/139)).
546
+ - [blackdogcat](https://github.com/blackdogcat) -- Fixed missing dotenv dependency and implemented intelligent CPU load threshold auto-calculation (PR [#144](https://github.com/EvoMap/evolver/pull/144)).
547
+ - [LKCY33](https://github.com/LKCY33) -- Fixed .env loading path and directory permissions (PR [#21](https://github.com/EvoMap/evolver/pull/21)).
548
+ - [hendrixAIDev](https://github.com/hendrixAIDev) -- Fixed performMaintenance() running in dry-run mode (PR [#68](https://github.com/EvoMap/evolver/pull/68)).
549
+ - [toller892](https://github.com/toller892) -- Independently identified and reported the events.jsonl forbidden_paths bug (PR [#149](https://github.com/EvoMap/evolver/pull/149)).
550
+ - [WeZZard](https://github.com/WeZZard) -- Added A2A_NODE_ID setup guide to SKILL.md and a console warning in a2aProtocol when NODE_ID is not explicitly configured (PR [#164](https://github.com/EvoMap/evolver/pull/164)).
551
+ - [Golden-Koi](https://github.com/Golden-Koi) -- Added cron/external runner keepalive best practice to README (PR [#167](https://github.com/EvoMap/evolver/pull/167)).
552
+ - [upbit](https://github.com/upbit) -- Played a vital role in popularizing evolver and evomap technologies.
553
+ - [Chi Jianqiang](https://mowen.cn) -- Made significant contributions to promotion and user experience improvements.
554
+
555
+ ## License
556
+
557
+ [GPL-3.0-or-later](https://opensource.org/licenses/GPL-3.0)
558
+
559
+ > Core evolution engine modules are distributed in obfuscated form to protect intellectual property. Source: [EvoMap/evolver](https://github.com/EvoMap/evolver).
560
+
561
+ ## Download History
562
+
563
+ Evolver ships through three channels — the [npm package](https://www.npmjs.com/package/@evomap/evolver), prebuilt binaries on [GitHub Releases](https://github.com/EvoMap/evolver/releases), and the [ClawHub](https://skill-history.com/autogame-17/evolver) skill registry:
564
+
565
+ [![npm](https://img.shields.io/npm/dm/@evomap/evolver?logo=npm&label=npm)](https://www.npmjs.com/package/@evomap/evolver)
566
+ [![npm total](https://img.shields.io/npm/d18m/@evomap/evolver?logo=npm&label=npm%20total)](https://npm-stat.com/charts.html?package=@evomap/evolver)
567
+ [![GitHub releases](https://img.shields.io/github/downloads/EvoMap/evolver/total?logo=github&label=GitHub%20releases)](https://github.com/EvoMap/evolver/releases)
568
+
569
+ [![ClawHub download history](https://skill-history.com/chart/autogame-17/evolver.svg)](https://skill-history.com/autogame-17/evolver)