claude-flow 3.56.10 → 3.57.1

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 (46) hide show
  1. package/.claude/proven-config.json +1 -1
  2. package/README.md +12 -3
  3. package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
  4. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
  5. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
  6. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +17 -1
  7. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -1
  8. package/node_modules/@claude-flow/security/dist/policy/engine.js +99 -24
  9. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -1
  10. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +14 -1
  11. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -1
  12. package/node_modules/@claude-flow/security/dist/policy/types.js +3 -1
  13. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -1
  14. package/package.json +2 -2
  15. package/v3/@claude-flow/cli/README.md +173 -62
  16. package/v3/@claude-flow/cli/catalog-manifest.json +5 -5
  17. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +8 -2
  18. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +95 -18
  19. package/v3/@claude-flow/cli/dist/src/commands/policy.js +6 -1
  20. package/v3/@claude-flow/cli/dist/src/index.js +5 -5
  21. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +4 -58
  22. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +1 -1
  23. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +30 -5
  24. package/v3/@claude-flow/cli/dist/src/mcp-tools/metaharness-tools.js +1 -1
  25. package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +20 -50
  26. package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.js +5 -3
  27. package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +80 -33
  28. package/v3/@claude-flow/cli/dist/src/memory/stats-file-lock.d.ts +7 -0
  29. package/v3/@claude-flow/cli/dist/src/memory/stats-file-lock.js +53 -0
  30. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +113 -113
  31. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +193 -193
  32. package/v3/@claude-flow/cli/dist/src/services/distill-oracle.d.ts +1 -1
  33. package/v3/@claude-flow/cli/dist/src/services/distill-oracle.js +2 -2
  34. package/v3/@claude-flow/cli/dist/src/services/policy-anchor-log.d.ts +13 -0
  35. package/v3/@claude-flow/cli/dist/src/services/policy-anchor-log.js +242 -0
  36. package/v3/@claude-flow/cli/dist/src/services/policy-archive-scan.d.ts +7 -0
  37. package/v3/@claude-flow/cli/dist/src/services/policy-archive-scan.js +50 -0
  38. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.d.ts +14 -8
  39. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.js +356 -40
  40. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-audit.d.ts +22 -0
  41. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-audit.js +260 -0
  42. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-record.d.ts +3 -0
  43. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-record.js +22 -0
  44. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +1 -0
  45. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +261 -40
  46. package/v3/@claude-flow/cli/package.json +3 -3
@@ -1,22 +1,90 @@
1
1
  <div align="center">
2
2
 
3
- [![Ruflo Banner](ruflo/assets/ruflo-small.jpeg)](https://cognitum.one/agentic-engineering)
3
+ <a href="https://cognitum.one/agentic-engineering"><img src="ruflo/assets/ruflo-neon-flicker.gif" alt="Ruflo animated neon sign" width="100%"></a>
4
+
5
+ **An agent meta-harness for Claude Code and Codex.**
4
6
 
5
7
  <!-- Try Ruflo — the 3 badges first-time visitors actually act on -->
6
8
  [![npm version (ruflo)](https://img.shields.io/npm/v/ruflo?label=npx%20ruflo&style=for-the-badge&logo=npm&color=cb3837)](https://www.npmjs.com/package/ruflo)
7
9
  [![MIT License](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](https://opensource.org/licenses/MIT)
8
10
  [![Star on GitHub](https://img.shields.io/github/stars/ruvnet/claude-flow?style=for-the-badge&logo=github&color=gold)](https://github.com/ruvnet/claude-flow)
9
11
 
10
- <!-- Ecosystem strip (collapsed visually with flat-square) -->
11
- [![🕸️ RuVector Agentic DB](https://img.shields.io/badge/RuVector_Agentic-DB-06b6d4?style=flat-square&logoColor=white&logo=graphql)](https://github.com/ruvnet/ruvector)
12
- [![Ecosystem downloads](https://img.shields.io/badge/ecosystem%20downloads-8.1M%2B-blue?style=flat-square&logo=npm)](https://github.com/ruvnet/ruflo/blob/main/data/clone-data.proof.json)
13
- [![Git clones (14d)](https://img.shields.io/badge/git%20clones%2014d-106k-blueviolet?style=flat-square&logo=github)](https://github.com/ruvnet/ruflo/blob/main/data/clone-data.ledger.json)
14
- [![Claude Code](https://img.shields.io/badge/Claude%20Code-Plugin-D97757?style=flat-square&logoColor=white&logo=anthropic)](https://github.com/ruvnet/claude-flow)
15
- [![Codex Plugin](https://img.shields.io/badge/Codex-Plugin-412991?style=flat-square&logoColor=white&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0yMi4yODIgOS44MjFhNS45ODUgNS45ODUgMCAwIDAtLjUxNi00LjkxIDYuMDQ2IDYuMDQ2IDAgMCAwLTYuNTEtMi45QTYuMDY1IDYuMDY1IDAgMCAwIDQuOTgxIDQuMThhNS45ODUgNS45ODUgMCAwIDAtMy45OTggMi45IDYuMDQ2IDYuMDQ2IDAgMCAwIC43NDMgNy4wOTcgNS45OCA1Ljk4IDAgMCAwIC41MSA0LjkxMSA2LjA1MSA2LjA1MSAwIDAgMCA2LjUxNSAyLjlBNS45ODUgNS45ODUgMCAwIDAgMTMuMjYgMjRhNi4wNTYgNi4wNTYgMCAwIDAgNS43NzItNC4yMDYgNS45OSA1Ljk5IDAgMCAwIDMuOTk4LTIuOSA2LjA1NiA2LjA1NiAwIDAgMC0uNzQ3LTcuMDczek0xMy4yNiAyMi40M2E0LjQ3NiA0LjQ3NiAwIDAgMS0yLjg3Ni0xLjA0bC4xNDItLjA4IDQuNzc4LTIuNzU4YS43OTUuNzk1IDAgMCAwIC4zOTMtLjY4MXYtNi43MzdsMi4wMiAxLjE2OGEuMDcxLjA3MSAwIDAgMSAuMDM4LjA1MnY1LjU4M2E0LjUwNCA0LjUwNCAwIDAgMS00LjQ5NSA0LjQ5NHpNMy42IDE4LjMwNGE0LjQ3IDQuNDcgMCAwIDEtLjUzNS0zLjAxNGwuMTQyLjA4NSA0Ljc4MyAyLjc1OWEuNzcxLjc3MSAwIDAgMCAuNzgxIDBsNS44NDMtMy4zNjl2Mi4zMzJhLjA4LjA4IDAgMCAxLS4wMzMuMDYyTDkuNzQgMTkuOTVhNC41IDQuNSAwIDAgMS02LjE0LTEuNjQ2ek0yLjM0IDcuODk2YTQuNDg1IDQuNDg1IDAgMCAxIDIuMzY2LTEuOTczVjExLjZhLjc2Ni43NjYgMCAwIDAgLjM4OC42NzdsNS44MTUgMy4zNTQtMi4wMiAxLjE2OGEuMDc2LjA3NiAwIDAgMS0uMDcyIDBsLTQuODMtMi43ODZBNC41MDQgNC41MDQgMCAwIDEgMi4zNCA3Ljg3MnptMTYuNTk3IDMuODU1LTUuODMzLTMuMzg3IDIuMDE2LTEuMTY1YS4wNzYuMDc2IDAgMCAxIC4wNzEgMGw0LjgzIDIuNzkxYTQuNDk0IDQuNDk0IDAgMCAxLS42NzYgOC4xMDR2LTUuNjc3YS43OS43OSAwIDAgMC0uNDA3LS42Njd6bTIuMDEtMy4wMjMtLjE0MS0uMDg1LTQuNzc0LTIuNzgyYS43NzYuNzc2IDAgMCAwLS43ODUgMEw5LjQwOSA5LjIzVjYuODk3YS4wNjYuMDY2IDAgMCAxIC4wMjgtLjA2Mmw0LjgzLTIuNzg3YTQuNDk5IDQuNDk5IDAgMCAxIDYuNjggNC42NnpNOC4zMDcgMTIuODYzbC0yLjAyLTEuMTY0YS4wOC4wOCAwIDAgMS0uMDM4LS4wNTdWNi4wNzRhNC40OTkgNC40OTkgMCAwIDEgNy4zNzYtMy40NTRsLS4xNDIuMDgtNC43NzggMi43NThhLjc5NS43OTUgMCAwIDAtLjM5My42ODJ6bTEuMDk3LTIuMzY2IDIuNjAyLTEuNSAyLjYwNyAxLjV2Mi45OTlsLTIuNTk3IDEuNS0yLjYwNy0xLjVaIi8%2BPC9zdmc%2B)](https://www.npmjs.com/package/@claude-flow/codex)
12
+ <p align="center">
13
+ <a href="docs/harness-origins.md"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/e69e4b95aa08d65ea0f7715489bbf8e62a83a0d2/docs/assets/readme/badges/first-commit.svg" width="300" height="76" alt="Claude Flow lineage: first commit June 2, 2025 by rUv; inspect the evidence"></a>
14
+ <a href="data/npm-downloads.latest.json"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/275aff65a198af758923669acff36f03d1f41623/docs/assets/readme/badges/downloads.svg" width="300" height="76" alt="Illustrative download counter starts at 98,000,000 and adds varied amounts each second in a 30 second loop. Verified dataset: 97,022,120 download events."></a>
15
+ <br>
16
+ <a href="https://github.com/ruvnet/claude-flow"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/claude.svg" width="300" height="76" alt="Claude Code plugin"></a>
17
+ <a href="https://www.npmjs.com/package/@claude-flow/codex"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/codex.svg" width="300" height="76" alt="Codex plugin"></a>
18
+ </p>
19
+
20
+ </div>
21
+
22
+ <a id="start-here"></a>
23
+
24
+ ## <img src="docs/assets/readme/icons/terminal.svg" width="32" height="32" alt=""> Get started with Ruflo
25
+
26
+ <img src="docs/assets/readme/icons/plugins.svg" width="28" height="28" alt=""> **Start in Claude Code** with core tools, the visual console and runtime mods. Requires Claude Code **2.1.287 or later**. Run inside Claude Code:
27
+
28
+ ```text
29
+ /plugin marketplace add ruvnet/ruflo
30
+ /plugin install ruflo-core@ruflo
31
+ /plugin install ruflo-console@ruflo
32
+ /plugin install ruflo-mods@ruflo
33
+ /reload-plugins
34
+ /ruflo
35
+ ```
36
+
37
+ **Core** provides foundation tools. **Console** opens the agent cockpit. **Mods** add routing and policy enforcement inside Claude Code. Mods run with your account's permissions; review their code before installing.
38
+
39
+ <img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> **Using Codex or another MCP enabled tool?** Use NPX for Ruflo project setup and connect your client to the Ruflo MCP server. Run the setup wizard in your project terminal:
40
+
41
+ ```bash
42
+ npx ruflo@latest init wizard
43
+ ```
44
+
45
+ For clients that support local stdio MCP servers, configure **command** `npx` and **arguments** `["-y", "ruflo@latest", "mcp", "start"]`. The equivalent server command is:
46
+
47
+ ```bash
48
+ npx -y ruflo@latest mcp start
49
+ ```
50
+
51
+ MCP exposes Ruflo tools to your client. The console and mods above are Claude Code integrations; hook support depends on the client.
52
+
53
+ <img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> **Prefer a plain terminal? Optional.** The console also runs on its own, with no Claude Code: `npx ruflo tui` (add `--plain` to print one frame for scripts). It shows Overview, Cost, Swarm, Events and Missions, plus an optional AI page. [Terminal UI guide](docs/USERGUIDE.md#terminal-ui-optional)
54
+
55
+ <p align="center"><img src="docs/assets/ruflo-tui-compact.svg" width="640" alt="Looping recording of the optional ruflo terminal UI with its pictures: Overview in the Classic BBS look, the Orbital look with its moving globe, and the Swarm graph, in a sample project"></p>
56
+
57
+ [Compare install paths](#quick-start) · [Open the console](#console-walkthrough) · [User guide](docs/USERGUIDE.md)
58
+
59
+ <div align="center">
60
+
61
+
62
+ ### Optional: ruOS Desktop
63
+
64
+ <a href="https://ruos.cognitum.one"><img src="ruflo/assets/ruos-animated.svg" alt="ruOS — A desktop that runs itself" width="100%"></a>
65
+
66
+ **Connect ruOS to ChatGPT or Claude via MCP:**
67
+
68
+ ```text
69
+ https://ruos.cognitum.one/mcp
70
+ ```
71
+
72
+
73
+
74
+ <!-- RuVector promo -->
75
+ <a href="https://github.com/ruvnet/ruvector"><img src="docs/assets/readme/ruvector-promo-depth.svg" width="100%" alt="RuVector: Give your agents memory. Local vector search, persistent context, graph relationships and feedback learning. Explore RuVector."></a>
76
+
77
+ ```bash
78
+ npx ruvector
79
+ ```
80
+
81
+
82
+
16
83
 
17
84
  # Ruflo
18
85
 
19
- **An agent meta-harness for Claude Code and Codex.**
86
+ [English](README.md) · [简体中文](README.zh-CN.md)
87
+
20
88
 
21
89
  [![RuFlo Explained — build an AI team that plans, remembers, tests, and improves](docs/assets/ruflo-explained/ch14.jpg)](docs/ruflo-explained.md)
22
90
 
@@ -29,16 +97,27 @@ A 14-chapter guide: from the basic idea to a first useful task, then memory, age
29
97
 
30
98
  One `npx ruflo init` gives Claude Code a nervous system: agents self-organize into swarms, learn from every task, remember across sessions, and — with federation — securely talk to agents on other machines without leaking data. You keep writing code. Ruflo handles the coordination.
31
99
 
32
- ```
33
- Self-Learning / Self-Optimizing Agent Architecture
100
+ <p align="center"><img src="docs/assets/readme/learning-cinematic-compact.svg" width="100%" alt="Ruflo trajectory learning: branching memory paths, outcome feedback, contrastive AI and local learning. No LLM required for local vector retrieval and contrastive updates; agent execution may still use an LLM."></p>
34
101
 
35
- User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Providers
36
- ^ |
37
- +---- Learning Loop <-------+
38
- ```
102
+ <sub>Conceptual learning loop. Local vector retrieval and contrastive updates can run without an LLM; embeddings and configured learning modules are still required. See the <a href="v3/@claude-flow/cli/src/services/ruvector-training.ts">RuVector training integration</a> and <a href="v3/@claude-flow/neural/src/modes/balanced.ts">trajectory contrastive learning</a>.</sub>
103
+
104
+ <details>
105
+ <summary>Architecture in text</summary>
106
+
107
+ User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM providers. Memory feeds useful experience back into routing. This is a conceptual flow, not a live execution trace.
108
+
109
+ </details>
39
110
 
40
111
  > **New to Ruflo?** You don't need to learn 314 MCP tools or 26 CLI commands. After `init`, just use Claude Code normally — the hooks system automatically routes tasks, learns from successful patterns, and coordinates agents in the background.
41
112
 
113
+ ### An origin you can inspect
114
+
115
+ [![Claude Flow to Ruflo: founding idea on June 2, 2025, orchestration source on June 10, and the continuing Ruflo lineage.](docs/assets/readme/harness-origins.svg)](docs/harness-origins.md)
116
+
117
+ **Built by [Reuven Cohen (rUv)](https://github.com/ruvnet), originally as Claude Flow.** The [first commit, June 2, 2025](https://github.com/ruvnet/ruflo/commit/7c1f9402d70e7af56c01a879073cbac92564dc4e), describes a code orchestration layer for recursive agent cycles: Claude writes, edits, tests and improves. The [June 10 source snapshot](https://github.com/ruvnet/ruflo/tree/dba545f012ea92a2375a26332bbf3797495e93c9) adds orchestration, task scheduling, memory and terminal modules.
118
+
119
+ A harness is the workbench around the model: it organizes tasks, carries context between steps and helps check results. **This establishes Ruflo's lineage, not a universal first across every Claude Code tool.** [See the illustrated explainer, exact commits and earlier ecosystem context](docs/harness-origins.md).
120
+
42
121
  <details>
43
122
  <summary><strong>📖 Background — where the name comes from</strong></summary>
44
123
 
@@ -48,10 +127,52 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov
48
127
 
49
128
  ---
50
129
 
51
- ![Ruflo Plugins](./ruflo-plugins.gif)
130
+ <p align="center"><img src="docs/assets/readme/console.svg" alt="Mission control: inspect agent work" width="100%"></p>
131
+
132
+ <p align="center"><a href="https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg"><img src="docs/assets/ruflo-console-theme-compact.svg" width="100%" alt="Ruflo Orbital theme: animated boot checks, block logo, menu icons, rotating globe, swarm routing, six color palettes and responsive Theme Studio"></a></p>
133
+
134
+ [Open animated demo](https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg) · [Theme Studio guide](plugins/ruflo-console/README.md) · [Workflow demo](docs/assets/ruflo-console-workflows.svg)
135
+
136
+ <img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Your agent cockpit.** Track workflows, agents, models, tokens and cost beside Claude Code. The 38 second animation shows **Orbital and Theme Studio** through actual renderer frames, including boot checks, six palettes, customization, saved themes, JSON import and resizing. This compact 3.84 MB SVG retains all 456 frames. Native host and AI provider execution are not demonstrated.
137
+
138
+ <img src="docs/assets/readme/console-icon-inspect.svg" width="28" height="28" alt=""> **Inspect any run.** Open agent logs and results, search, triage failures, replay and compare. Start with `npx ruflo init`, restart Claude Code, then `/ruflo`. [Full console tour](docs/assets/ruflo-console-walkthrough-wide.gif).
139
+
140
+ <img src="docs/assets/readme/console-icon-control.svg" width="28" height="28" alt=""> **Let Claude drive. You set the limits.** Enable **Settings → Claude control** to navigate and run console actions. Choose `read`, `write`, `manage` or `full`, with `ask` or `auto` approval. The current default is **read + ask**; raising the level is your choice. Actions above your permission level are refused, and network, spending and destructive actions require confirmation even in `auto`. Review the live action log or press **Take back control** to stop Claude control. [Details](v3/docs/adr/ADR-444-claude-controls-the-console.md).
141
+
142
+ <a id="console-walkthrough"></a>
143
+
144
+ ### One task: create a mission with Claude
145
+
146
+ <img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Watch the recorded console session below.** Claude creates a mission, opens the Learning and Security pages, and reports its actions in Overview.
147
+
148
+ 1. **Set the boundary.** Install the console using the commands below, open `/ruflo`, then choose **Settings → Claude control → write + ask**.
149
+ 2. **Give a concrete request.** Try: “Create a mission to add a dark mode toggle. Show me the mission and its status.”
150
+ 3. **Approve creation.** Claude opens Missions and sets the goal. Confirm the pending create action in the console.
151
+ 4. **Verify the result.** Check that Missions contains the goal and Overview records the action. Creating a mission does not mean the feature has been implemented.
152
+ 5. **Keep control.** **Take back control** pauses Claude's console tools. A later call should be refused until you restore control.
153
+
154
+ **What the recording demonstrates:** a real Claude Haiku session with `write + auto`, mission creation, page navigation, a refused swarm stop, and control being taken back. The steps above use `ask` so you approve creation yourself. The linked workflow animation uses sample data, while the theme demo replays renderer frames. Neither is evidence of completed swarm work or memory recall.
155
+
156
+ [Implementation and recorded test findings](v3/docs/adr/ADR-444-claude-controls-the-console.md) · [Reproduction script](plugins/ruflo-console/scripts/e2e-control.sh)
157
+
158
+ <p align="center"><img src="docs/assets/ruflo-console-claude-control.gif" alt="Claude Code with the ruflo console beside it: Claude sets a mission goal, creates the mission and opens the Learning, Security and Overview pages through the console tools; the Claude control dashboard logs each action; swarm-stop is refused because it needs the full level; the person clicks Take back control and the next request is refused"></p>
159
+
160
+
161
+ **Install the mods from the ruflo marketplace** (Claude Code 2.1.287 or later; mods run with your account's permissions and are not sandboxed, so read the code first):
162
+
163
+ ```text
164
+ /plugin marketplace add ruvnet/ruflo
165
+ /plugin install ruflo-console@ruflo
166
+ /plugin install ruflo-mods@ruflo
167
+ /reload-plugins
168
+ ```
169
+
170
+ `ruflo-console` is the cockpit above, `ruflo-mods` routes prompts and enforces policy in-process, `ruflo-swarm` shows the swarm in a pane, and `ruflo-ruos` adds the ruOS status segment. Open `/plugin` to confirm they appear in the active mods line. Inside the console, `/ruflo market` is the Plugin Catalog: every ruflo plugin, mod and skill with what it ships, and buttons to install, enable, disable and update (each asks first).
52
171
 
53
172
  ## Quick Start
54
173
 
174
+ <p align="center"><img src="docs/assets/readme/quick-start.svg" alt="Start building with Ruflo" width="100%"></p>
175
+
55
176
  There are **two different install paths** with very different surface areas. Pick based on what you need (#1744):
56
177
 
57
178
  | | **Claude Code Plugin** | **CLI install (`npx ruflo init`)** |
@@ -162,7 +283,7 @@ This adds slash commands and agent definitions. `ruflo-core` (installed above) d
162
283
 
163
284
  </details>
164
285
 
165
- ### CLI Install
286
+ ### <img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> CLI Install
166
287
 
167
288
  **macOS / Linux / WSL / Git-Bash:**
168
289
 
@@ -186,68 +307,50 @@ npm install -g ruflo@latest
186
307
 
187
308
  > 💡 **Windows users:** the `curl ... | bash` form needs a POSIX shell (Git-Bash, WSL, MSYS). The `npx ruflo@latest init wizard` line works natively in PowerShell and cmd. If you hit an `'bash' is not recognized` error, use the `npx` line instead — both end up running the same init flow.
188
309
 
189
- ### MCP Server
310
+ ### <img src="docs/assets/readme/icons/network.svg" width="28" height="28" alt=""> MCP Server
190
311
 
191
312
  ```bash
192
313
  # Add Ruflo as an MCP server in Claude Code
193
314
  claude mcp add claude-flow -- npx ruflo@latest mcp start
194
315
  ```
195
316
 
196
- #### HTTP transport security
317
+ ---
197
318
 
198
- `ruflo mcp start -t http` exposes every registered tool over HTTP (`/rpc`, `/mcp`, `/ws`). The default `stdio` transport is not affected.
319
+ ## What You Get
199
320
 
200
- | Setting | Effect |
201
- |---|---|
202
- | `RUFLO_MCP_HTTP_TOKEN=<token>` | Require `Authorization: Bearer <token>` on every request. Failure is a bare `401`. The token is compared in constant time and is never logged. Prefer this over `--auth-token`, which is visible in `ps`. |
203
- | `--auth-token-file <path>` | Read the token from a file (one line). Takes precedence over the env var. |
204
- | `--auth-token <token>` | Same, on the command line (visible in argv; highest precedence). |
205
- | `RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1` | Allow an unauthenticated bind to a non-loopback `--host`. Only for a trusted network boundary or an authenticating reverse proxy. |
321
+ <p align="center"><img src="docs/assets/readme/capabilities.svg" alt="Your agent toolkit" width="100%"></p>
206
322
 
207
- A token must be 16-512 printable ASCII characters (no spaces). `GET /health` stays public and returns only `{"status":"ok"}` when a token is set. Tokens are supported for `-t http` only; `-t websocket` rejects one.
323
+ <table>
324
+ <tr><td width="50%"><a href="plugins/ruflo-swarm/README.md"><img src="docs/assets/readme/card-swarm.svg" width="100%" alt="Agent teams"></a></td><td width="50%"><a href="plugins/ruflo-rag-memory/README.md"><img src="docs/assets/readme/card-memory.svg" width="100%" alt="Persistent memory"></a></td></tr>
325
+ <tr><td width="50%"><a href="plugins/ruflo-intelligence/README.md"><img src="docs/assets/readme/card-learning.svg" width="100%" alt="Learning loops"></a></td><td width="50%"><a href="plugins/ruflo-security-audit/README.md"><img src="docs/assets/readme/card-security.svg" width="100%" alt="Security controls"></a></td></tr>
326
+ <tr><td width="50%"><a href="https://ruvnet.github.io/ruflo"><img src="docs/assets/readme/card-plugins.svg" width="100%" alt="Plugin marketplace"></a></td><td width="50%"><a href="plugins/ruflo-ruvllm/README.md"><img src="docs/assets/readme/card-routing.svg" width="100%" alt="Models and routing"></a></td></tr>
327
+ </table>
208
328
 
209
- | `--host` | no token | token set |
210
- |---|---|---|
211
- | `localhost`, `127.0.0.1`, `::1` | starts, **unauthenticated** | starts, token required |
212
- | anything else (`0.0.0.0`, `::`, a LAN IP, `127.0.0.2`, `[::1]`, `LOCALHOST`) | **refuses to start** unless `RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1` | starts, token required |
329
+ | Capability | Description |
330
+ |------------|-------------|
331
+ | <img src="docs/assets/readme/icons/agents.svg" width="28" height="28" alt=""> **100+ Agents** | Specialized agents for coding, testing, security, docs, architecture |
332
+ | <img src="docs/assets/readme/icons/network.svg" width="28" height="28" alt=""> **Comms Layer** | Zero-trust federation — agents across machines/orgs discover, authenticate, and exchange work securely |
333
+ | <img src="docs/assets/readme/icons/swarm.svg" width="28" height="28" alt=""> **Swarm Coordination** | Hierarchical, mesh, and adaptive topologies with consensus |
334
+ | <img src="docs/assets/readme/icons/learning.svg" width="28" height="28" alt=""> **Self-Learning** | SONA neural patterns, ReasoningBank, trajectory learning |
335
+ | <img src="docs/assets/readme/icons/memory.svg" width="28" height="28" alt=""> **Vector Memory** | HNSW-indexed AgentDB — measured ~1.9x faster at N=20k, ~3.2x–4.7x at N=5k vs brute force (recall@10 ~0.99); ANN wins above the crossover, ties/loses at small N. See [audit](docs/reviews/intelligence-system-audit-2026-05-29.md) + [`scripts/benchmark-intelligence.mjs`](scripts/benchmark-intelligence.mjs) |
336
+ | <img src="docs/assets/readme/icons/workers.svg" width="28" height="28" alt=""> **Background Workers** | 12 auto-triggered workers (audit, optimize, testgaps, etc.) |
337
+ | <img src="docs/assets/readme/icons/plugins.svg" width="28" height="28" alt=""> **Plugin Marketplace** | 33 native Claude Code plugins + 21 npm plugins |
338
+ | <img src="docs/assets/readme/icons/routing.svg" width="28" height="28" alt=""> **Multi-Provider** | Claude, GPT, Gemini, Cohere, Ollama with smart routing |
339
+ | <img src="docs/assets/readme/icons/security.svg" width="28" height="28" alt=""> **Security** | AIDefence, input validation, CVE remediation, path traversal prevention |
340
+ | <img src="docs/assets/readme/icons/federation.svg" width="28" height="28" alt=""> **Agent Federation** | Cross-installation agent collaboration with zero-trust security |
341
+ | <img src="docs/assets/readme/icons/audit.svg" width="28" height="28" alt=""> **[MetaHarness](docs/metaharness-user-guide.md)** | Audit your AI agent setup before you ship. Grade readiness (1-100), scan tool configs for security issues, snapshot the whole project to catch regressions over time, and find templates that match your repo. `ruflo eject` turns a ruflo project into a standalone agent toolkit with its own name. [Full guide](docs/metaharness-user-guide.md). |
213
342
 
214
- Without a token, a loopback server is still unauthenticated: any process on the machine, and any web page that can reach it via DNS rebinding, can call tools. Set `RUFLO_MCP_HTTP_TOKEN` whenever the HTTP transport is used.
343
+ ### <img src="docs/assets/readme/icons/learning.svg" width="28" height="28" alt=""> Learning from experience
215
344
 
216
- **Upgrading:** binding off loopback (for example `--host 0.0.0.0` in Docker) now needs a token or the opt-out above; otherwise the server exits with an error.
345
+ <p align="center"><img src="docs/assets/readme/learning-flow.svg" width="100%" alt="Recall, execute, evaluate, store, adapt and reuse: an illustrative agent learning cycle."></p>
217
346
 
218
- ---
219
-
220
- ## What You Get
221
-
222
- | Capability | Description |
223
- |------------|-------------|
224
- | 🤖 **100+ Agents** | Specialized agents for coding, testing, security, docs, architecture |
225
- | 📡 **Comms Layer** | Zero-trust federation — agents across machines/orgs discover, authenticate, and exchange work securely |
226
- | 🐝 **Swarm Coordination** | Hierarchical, mesh, and adaptive topologies with consensus |
227
- | 🧠 **Self-Learning** | SONA neural patterns, ReasoningBank, trajectory learning |
228
- | 💾 **Vector Memory** | HNSW-indexed AgentDB — measured ~1.9x faster at N=20k, ~3.2x–4.7x at N=5k vs brute force (recall@10 ~0.99); ANN wins above the crossover, ties/loses at small N. See [audit](docs/reviews/intelligence-system-audit-2026-05-29.md) + [`scripts/benchmark-intelligence.mjs`](scripts/benchmark-intelligence.mjs) |
229
- | ⚡ **Background Workers** | 12 auto-triggered workers (audit, optimize, testgaps, etc.) |
230
- | 🧩 **Plugin Marketplace** | 33 native Claude Code plugins + 21 npm plugins |
231
- | 🔌 **Multi-Provider** | Claude, GPT, Gemini, Cohere, Ollama with smart routing |
232
- | 🛡️ **Security** | AIDefence, input validation, CVE remediation, path traversal prevention |
233
- | 🌐 **Agent Federation** | Cross-installation agent collaboration with zero-trust security |
234
- | 🔬 **[MetaHarness](docs/metaharness-user-guide.md)** | Audit your AI agent setup before you ship. Grade readiness (1-100), scan tool configs for security issues, snapshot the whole project to catch regressions over time, and find templates that match your repo. `ruflo eject` turns a ruflo project into a standalone agent toolkit with its own name. [Full guide](docs/metaharness-user-guide.md). |
347
+ Useful trajectories and task feedback can inform future work. Results depend on the configured memory, learning components and quality of feedback. [Learning plugin](plugins/ruflo-intelligence/README.md).
235
348
 
236
349
  ### Agent Federation — Slack for Agents
237
350
 
238
- ```
239
- Your Agent --> [ Remove secrets ] --> [ Sign message ] --> [ Encrypted channel ]
240
- Emails, SSNs, Proves it came No one reads it
241
- keys stripped from you in transit
242
- |
243
- v
244
- Their Agent <-- [ Block attacks ] <-- [ Check identity ] <------+
245
- Stops prompt Rejects forgeries
246
- injection
247
-
248
- Audit trail on both sides.
249
- Trust builds over time. Bad behavior = instant downgrade.
250
- ```
351
+ <p align="center"><img src="docs/assets/readme/federation.svg" alt="Connected intelligence across machines" width="100%"></p>
352
+
353
+ <p align="center"><img src="docs/assets/readme/federation-flow.svg" width="100%" alt="Outbound agent, data filtering, signing and encryption, identity verification, input checks and receiving agent."></p>
251
354
 
252
355
  Slack gave teams channels. Federation gives agents the same thing — **shared workspaces across trust boundaries**, where agents on different machines, orgs, or cloud regions can discover each other, prove who they are, and collaborate on tasks.
253
356
 
@@ -349,6 +452,8 @@ User --> Claude Code / CLI
349
452
 
350
453
  ## Documentation
351
454
 
455
+ <p align="center"><img src="docs/assets/readme/documentation.svg" alt="Guides, architecture and verification" width="100%"></p>
456
+
352
457
  Four docs for four audiences:
353
458
 
354
459
  | Doc | When to read it |
@@ -379,6 +484,8 @@ User Guide section index:
379
484
 
380
485
  ## Support
381
486
 
487
+ <p align="center"><img src="docs/assets/readme/support.svg" alt="Build with the Ruflo community" width="100%"></p>
488
+
382
489
  | Resource | Link |
383
490
  |----------|------|
384
491
  | Documentation | [User Guide](docs/USERGUIDE.md) |
@@ -387,6 +494,10 @@ User Guide section index:
387
494
  | Community | [Agentics Foundation Discord](https://discord.com/invite/dfxmpwkG2D) |
388
495
  | Powered by | [Cognitum.one](https://cognitum.one) |
389
496
 
497
+ <p align="center"><img src="docs/assets/readme/signal-divider.svg" alt="Ruflo" width="100%"></p>
498
+
390
499
  ## License
391
500
 
392
501
  MIT - [RuvNet](https://github.com/ruvnet)
502
+
503
+ <a href="https://cognitum.one"><img src="docs/assets/readme/cognitum-banner-v2.svg" width="100%" alt="Cognitum One: Ambient Intelligence at the edge of the Physical World. Explore cognitum.one."></a>
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generation": 6,
4
- "generatedAt": "2026-09-17T21:28:47.530Z",
5
- "gitSha": "702d1461",
3
+ "generation": 7,
4
+ "generatedAt": "2026-10-19T16:47:16.220Z",
5
+ "gitSha": "aedd3d53",
6
6
  "catalog": {
7
- "agents": 167,
8
- "tools": 418,
7
+ "agents": 176,
8
+ "tools": 423,
9
9
  "skills": 34
10
10
  },
11
11
  "benchmark": null
@@ -1247,12 +1247,18 @@ const statusCommand = {
1247
1247
  // its real consent state into daemon-state.json — prefer that when it
1248
1248
  // is the one running.
1249
1249
  let aiWorkersEnabled = status.config.aiWorkersEnabled;
1250
+ // #4238: same for the TTL — a daemon started with `--ttl 0` must not be
1251
+ // reported with this process's 12h default.
1252
+ let ttlMs = status.config.ttlMs;
1250
1253
  if (bgRunning) {
1251
1254
  try {
1252
1255
  const st = JSON.parse(fs.readFileSync(join(projectRoot, '.claude-flow', 'daemon-state.json'), 'utf-8'));
1253
1256
  if (typeof st?.config?.aiWorkersEnabled === 'boolean') {
1254
1257
  aiWorkersEnabled = st.config.aiWorkersEnabled;
1255
1258
  }
1259
+ if (typeof st?.config?.ttlMs === 'number' && Number.isFinite(st.config.ttlMs)) {
1260
+ ttlMs = st.config.ttlMs;
1261
+ }
1256
1262
  }
1257
1263
  catch { /* no/partial state — fall back to in-process config */ }
1258
1264
  }
@@ -1265,8 +1271,8 @@ const statusCommand = {
1265
1271
  `Status: ${statusIcon} ${statusText}${mode}`,
1266
1272
  `PID: ${displayPid}`,
1267
1273
  status.startedAt ? `Started: ${status.startedAt.toISOString()}` : '',
1268
- status.config.ttlMs > 0
1269
- ? `TTL: ${Math.round(status.config.ttlMs / 3600000)}h (self-shutdown)`
1274
+ ttlMs > 0
1275
+ ? `TTL: ${Math.round(ttlMs / 3600000)}h (self-shutdown)`
1270
1276
  : `TTL: ${output.dim('off (runs until stopped)')}`,
1271
1277
  // #2661: surface the AI-consent gate so "why is audit local-only?"
1272
1278
  // is answerable from `daemon status` alone.
@@ -2515,6 +2515,12 @@ export const doctorCommand = {
2515
2515
  name: 'doctor',
2516
2516
  description: 'System diagnostics and health checks',
2517
2517
  options: [
2518
+ {
2519
+ name: 'json',
2520
+ description: 'Emit versioned JSON health checks (cannot be combined with repair flags)',
2521
+ type: 'boolean',
2522
+ default: false
2523
+ },
2518
2524
  {
2519
2525
  name: 'fix',
2520
2526
  short: 'f',
@@ -2561,6 +2567,7 @@ export const doctorCommand = {
2561
2567
  }
2562
2568
  ],
2563
2569
  examples: [
2570
+ { command: 'claude-flow doctor --json -c node', description: 'Emit machine-readable health checks' },
2564
2571
  { command: 'claude-flow doctor', description: 'Run full health check' },
2565
2572
  { command: 'claude-flow doctor --fix', description: 'Print suggested fix commands (does not auto-apply)' },
2566
2573
  { command: 'claude-flow doctor --install', description: 'Auto-install missing dependencies' },
@@ -2575,6 +2582,21 @@ export const doctorCommand = {
2575
2582
  const verbose = ctx.flags.verbose;
2576
2583
  // Parser camelCases kebab-case flag names — read via `fixHandles`, not `['fix-handles']`.
2577
2584
  const fixHandles = ctx.flags.fixHandles;
2585
+ const json = ctx.flags.json;
2586
+ const reportError = (message) => {
2587
+ if (json)
2588
+ output.writeln(JSON.stringify({ schemaVersion: 1, checks: [], error: message }));
2589
+ else
2590
+ output.printError(message);
2591
+ return { success: false, exitCode: 1, message };
2592
+ };
2593
+ if (json && (showFix || autoInstall || fixHandles)) {
2594
+ return reportError('--json cannot be combined with --fix, --install, or --fix-handles');
2595
+ }
2596
+ // Reuse the same callable for anonymous checks so their IDs do not depend
2597
+ // on display names or on whether the full or component suite was selected.
2598
+ const helperCheck = () => checkHelperIntegrity();
2599
+ const nativeAddonCheck = () => checkNativeAddonHeaders();
2578
2600
  // #2677: `--component memory` now runs the whole memory-health suite,
2579
2601
  // not just the existence check. Values can be a single check or an
2580
2602
  // array — expanded at execution time. Stuinfla's report showed the
@@ -2592,7 +2614,7 @@ export const doctorCommand = {
2592
2614
  'browser': checkAgentBrowserVersion,
2593
2615
  'config': checkConfigFile,
2594
2616
  'stale-settings': checkStaleSettingsNpx, // #2448
2595
- 'helpers': () => checkHelperIntegrity(), // #3565
2617
+ 'helpers': helperCheck, // #3565
2596
2618
  'daemon': checkDaemonStatus,
2597
2619
  get memory() {
2598
2620
  return [
@@ -2608,7 +2630,7 @@ export const doctorCommand = {
2608
2630
  ];
2609
2631
  },
2610
2632
  'memory-package': checkMemoryPackageVersion, // #3392
2611
- 'native-addon': () => checkNativeAddonHeaders(), // #4055
2633
+ 'native-addon': nativeAddonCheck, // #4055
2612
2634
  'learning': checkLearningBridge, // #2545
2613
2635
  'learning-bridge': checkLearningBridge, // #2545
2614
2636
  'api': checkApiKeys,
@@ -2634,8 +2656,7 @@ export const doctorCommand = {
2634
2656
  };
2635
2657
  if (component !== undefined && !Object.hasOwn(componentMap, component)) {
2636
2658
  const message = `Unknown doctor component: ${JSON.stringify(component)}. Valid components: ${Object.keys(componentMap).join(', ')}`;
2637
- output.printError(message);
2638
- return { success: false, exitCode: 1, message };
2659
+ return reportError(message);
2639
2660
  }
2640
2661
  // Early-return short-circuit: `--fix-handles` is a targeted mitigation, not
2641
2662
  // part of the health-check flow. Runs, reports, exits.
@@ -2699,12 +2720,15 @@ export const doctorCommand = {
2699
2720
  output.writeln(output.dim('Upstream tracking: https://github.com/anthropics/claude-code/issues/67888'));
2700
2721
  return { success: true };
2701
2722
  }
2702
- output.writeln();
2703
- output.writeln(output.bold('RuFlo Doctor'));
2704
- output.writeln(output.dim('System diagnostics and health check'));
2705
- output.writeln(output.dim('─'.repeat(50)));
2706
- output.writeln();
2707
- const nativeAgentDbChecks = (await existingNativeAgentDbPaths())
2723
+ if (!json) {
2724
+ output.writeln();
2725
+ output.writeln(output.bold('RuFlo Doctor'));
2726
+ output.writeln(output.dim('System diagnostics and health check'));
2727
+ output.writeln(output.dim('─'.repeat(50)));
2728
+ output.writeln();
2729
+ }
2730
+ const nativeAgentDbPaths = await existingNativeAgentDbPaths();
2731
+ const nativeAgentDbChecks = nativeAgentDbPaths
2708
2732
  .map((dbPath) => () => checkNativeAgentDbStructuralIntegrity(dbPath));
2709
2733
  const allChecks = [
2710
2734
  checkVersionFreshness,
@@ -2716,7 +2740,7 @@ export const doctorCommand = {
2716
2740
  checkGitRepo,
2717
2741
  checkConfigFile,
2718
2742
  checkStaleSettingsNpx, // #2448/#2677 — runaway `npx @latest` in settings
2719
- () => checkHelperIntegrity(), // #3565 — installed signed helpers vs manifest
2743
+ helperCheck, // #3565 — installed signed helpers vs manifest
2720
2744
  checkDaemonStatus,
2721
2745
  checkMemoryDatabase,
2722
2746
  checkMemoryStructuralIntegrity, // #2737 — bounded, native quick_check on every default run
@@ -2724,7 +2748,7 @@ export const doctorCommand = {
2724
2748
  checkMemoryPersistenceDriver, // #2968/#3321 — read-only native capability probe
2725
2749
  checkLearningBridge, // #2545 — can the auto-memory hook actually load @claude-flow/memory?
2726
2750
  checkMemoryPackageVersion, // #3392 — loaded @claude-flow/memory must satisfy the CLI's declared range
2727
- () => checkNativeAddonHeaders(), // #4055 — better-sqlite3 built against Node 24.19+ headers on 24.19-24.21
2751
+ nativeAddonCheck, // #4055 — better-sqlite3 built against Node 24.19+ headers on 24.19-24.21
2728
2752
  checkApiKeys,
2729
2753
  checkMcpServers,
2730
2754
  checkMcpSchemaOverhead, // #2726 — fixed tools/list prompt cost
@@ -2747,21 +2771,59 @@ export const doctorCommand = {
2747
2771
  const entry = componentMap[component];
2748
2772
  checksToRun = Array.isArray(entry) ? entry : [entry];
2749
2773
  }
2774
+ // These are API identifiers: keep them stable even when user-facing names
2775
+ // change. Grouped components have a distinct ID for each individual check.
2776
+ const checkIds = new Map([
2777
+ [checkVersionFreshness, 'version'], [checkNodeVersion, 'node'],
2778
+ [checkNpmVersion, 'npm'], [checkClaudeCode, 'claude'],
2779
+ [checkAgentBrowserVersion, 'browser'], [checkGit, 'git'],
2780
+ [checkGitRepo, 'git-repo'], [checkConfigFile, 'config'],
2781
+ [checkStaleSettingsNpx, 'stale-settings'], [helperCheck, 'helpers'],
2782
+ [checkDaemonStatus, 'daemon'], [checkMemoryDatabase, 'memory-presence'],
2783
+ [checkMemoryStructuralIntegrity, 'memory-structural'],
2784
+ [checkMemoryIntegrity, 'memory-integrity'],
2785
+ [checkMemoryPersistenceDriver, 'memory-driver'],
2786
+ [checkMemoryPackageVersion, 'memory-package'],
2787
+ [checkMemoryContent, 'memory-content'],
2788
+ [checkMemoryEmbeddingCoverage, 'memory-embeddings'],
2789
+ [checkMemoryReflexionCoverage, 'memory-reflexion'],
2790
+ [checkMemoryCritiqueCoverage, 'memory-critique'],
2791
+ [checkLearningBridge, 'learning'], [nativeAddonCheck, 'native-addon'],
2792
+ [checkApiKeys, 'api'], [checkMcpServers, 'mcp'],
2793
+ [checkMcpSchemaOverhead, 'mcp-overhead'], [checkAIDefence, 'aidefence'],
2794
+ [checkDiskSpace, 'disk'], [checkBuildTools, 'typescript'],
2795
+ [checkAgenticFlow, 'agentic-flow'], [checkEncryptionAtRest, 'encryption'],
2796
+ [checkFederationBreaker, 'federation'], [checkMetaharness, 'metaharness'],
2797
+ [checkMetaharnessDeclaredPackages, 'metaharness-packages'],
2798
+ [checkMetaharnessIntegration, 'metaharness-integration'],
2799
+ [checkFunnel, 'funnel'], [checkProxySponsoredConsent, 'proxy-consent'],
2800
+ [checkProxyBinary, 'proxy-binary'], [checkProxyProcess, 'proxy-process'],
2801
+ [checkProxyBindAddress, 'proxy-bind'], [checkAuth, 'auth'],
2802
+ [checkTypesafeRouter, 'typesafe'], [checkMods, 'mods'],
2803
+ ]);
2804
+ nativeAgentDbChecks.forEach((check, index) => {
2805
+ // The path distinguishes simultaneous authority files; normalize separators.
2806
+ checkIds.set(check, `memory-native:${nativeAgentDbPaths[index].replace(/\\/g, '/')}`);
2807
+ });
2808
+ if (json && checksToRun.some(check => !checkIds.has(check))) {
2809
+ return reportError('Doctor check is missing a stable JSON ID');
2810
+ }
2750
2811
  const results = [];
2751
2812
  const fixes = [];
2752
2813
  // OPTIMIZATION: Run all checks in parallel for 3-5x faster execution
2753
- const spinner = output.createSpinner({ text: 'Running health checks in parallel...', spinner: 'dots' });
2754
- spinner.start();
2814
+ const spinner = json ? undefined : output.createSpinner({ text: 'Running health checks in parallel...', spinner: 'dots' });
2815
+ spinner?.start();
2755
2816
  try {
2756
2817
  // Execute all checks concurrently
2757
2818
  const checkResults = await Promise.allSettled(checksToRun.map(check => check()));
2758
- spinner.stop();
2819
+ spinner?.stop();
2759
2820
  // Process results in order
2760
2821
  for (const settledResult of checkResults) {
2761
2822
  if (settledResult.status === 'fulfilled') {
2762
2823
  const result = settledResult.value;
2763
2824
  results.push(result);
2764
- output.writeln(formatCheck(result));
2825
+ if (!json)
2826
+ output.writeln(formatCheck(result));
2765
2827
  if (result.fix && (result.status === 'fail' || result.status === 'warn')) {
2766
2828
  fixes.push(`${result.name}: ${result.fix}`);
2767
2829
  }
@@ -2773,12 +2835,15 @@ export const doctorCommand = {
2773
2835
  message: settledResult.reason?.message || 'Unknown error'
2774
2836
  };
2775
2837
  results.push(errorResult);
2776
- output.writeln(formatCheck(errorResult));
2838
+ if (!json)
2839
+ output.writeln(formatCheck(errorResult));
2777
2840
  }
2778
2841
  }
2779
2842
  }
2780
2843
  catch (error) {
2781
- spinner.stop();
2844
+ spinner?.stop();
2845
+ if (json)
2846
+ return reportError(`Failed to run health checks: ${error instanceof Error ? error.message : String(error)}`);
2782
2847
  output.writeln(output.error('Failed to run health checks'));
2783
2848
  }
2784
2849
  // #2545: --fix / --install can actually repair the Learning Bridge by
@@ -2827,6 +2892,18 @@ export const doctorCommand = {
2827
2892
  const passed = results.filter(r => r.status === 'pass').length;
2828
2893
  const warnings = results.filter(r => r.status === 'warn').length;
2829
2894
  const failed = results.filter(r => r.status === 'fail').length;
2895
+ if (json) {
2896
+ const checks = results.map((result, index) => ({
2897
+ id: checkIds.get(checksToRun[index]),
2898
+ status: result.status,
2899
+ name: result.name,
2900
+ detail: result.message,
2901
+ ...(result.fix ? { fix: result.fix } : {}),
2902
+ }));
2903
+ const data = { schemaVersion: 1, checks };
2904
+ output.writeln(JSON.stringify(data));
2905
+ return { success: failed === 0, exitCode: failed > 0 ? 1 : 0, data };
2906
+ }
2830
2907
  output.writeln();
2831
2908
  output.writeln(output.dim('─'.repeat(50)));
2832
2909
  output.writeln();
@@ -30,6 +30,7 @@ export const policyCommand = {
30
30
  { name: 'mode', type: 'string', description: 'Policy mode: legacy | observe | enforce' },
31
31
  { name: 'project-root', type: 'string', description: 'Project root containing .claude-flow/policy' },
32
32
  { name: 'establish-anchor', type: 'boolean', description: 'verify: explicitly anchor a ledger that has receipts but no anchor (interactive, logged with user and time)' },
33
+ { name: 'full', type: 'boolean', description: 'verify: additionally replay the archived receipts (receipts.ledger.jsonl) to verify the complete historical chain, not just the retained hot tail' },
33
34
  ],
34
35
  async action(context) {
35
36
  const args = context.args ?? [];
@@ -93,9 +94,13 @@ export const policyCommand = {
93
94
  }
94
95
  if (operation === 'verify') {
95
96
  const establishAnchor = flags['establish-anchor'] === true || flags.establishAnchor === true;
97
+ const full = flags.full === true;
96
98
  if (establishAnchor)
97
99
  requireInteractiveAdministrator();
98
- const ledger = await verifyPolicyLedger(root, { establishAnchor });
100
+ const ledger = await verifyPolicyLedger(root, { establishAnchor, full });
101
+ if (ledger.error === 'receipt-key-id-mismatch') {
102
+ output.printError('Restore the original CLAUDE_FLOW_POLICY_KEY_ID for this ledger; do not rewrite or re-sign historical receipts.');
103
+ }
99
104
  const result = print({ ...ledger, anchors: anchorPosture(root), scope: LEDGER_TRUST_SCOPE });
100
105
  return ledger.valid ? result : { ...result, success: false, exitCode: 1 };
101
106
  }