@sparkleideas/claude-flow-patch 3.1.0-alpha.44.patch.10 → 3.1.0-alpha.44.patch.11
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/CLAUDE.md +87 -8
- package/README.md +156 -4
- package/check-patches.sh +90 -16
- package/lib/categories.json +3 -1
- package/lib/common.py +15 -0
- package/package.json +6 -3
- package/patch/010-CF-001-doctor-yaml/sentinel +1 -1
- package/patch/020-CF-002-config-export-yaml/README.md +1 -1
- package/patch/020-CF-002-config-export-yaml/fix.py +3 -43
- package/patch/060-DM-004-worker-stubs/README.md +35 -0
- package/patch/060-DM-004-worker-stubs/fix.py +83 -0
- package/patch/{070-DM-005-consolidation-worker-stub → 060-DM-004-worker-stubs}/sentinel +1 -0
- package/patch/320-SG-004-wizard-parity/fix.py +1 -1
- package/patch/340-SG-006-wizard-capture/README.md +29 -0
- package/patch/340-SG-006-wizard-capture/fix.py +23 -0
- package/patch/340-SG-006-wizard-capture/sentinel +2 -0
- package/patch/350-WM-001-memory-wiring/README.md +50 -0
- package/patch/350-WM-001-memory-wiring/fix.py +385 -0
- package/patch/350-WM-001-memory-wiring/sentinel +3 -0
- package/patch/360-WM-002-config-respect/README.md +31 -0
- package/patch/360-WM-002-config-respect/fix.py +37 -0
- package/patch/360-WM-002-config-respect/sentinel +3 -0
- package/patch/370-WM-003-auto-memory-bridge/README.md +37 -0
- package/patch/370-WM-003-auto-memory-bridge/fix.py +261 -0
- package/patch/370-WM-003-auto-memory-bridge/sentinel +6 -0
- package/patch/380-CF-003-doctor-native-deps/README.md +46 -0
- package/patch/380-CF-003-doctor-native-deps/fix.py +157 -0
- package/patch/380-CF-003-doctor-native-deps/sentinel +4 -0
- package/patch/385-SG-007-init-shallow-copy/README.md +25 -0
- package/patch/385-SG-007-init-shallow-copy/fix.py +44 -0
- package/patch/385-SG-007-init-shallow-copy/sentinel +3 -0
- package/patch/390-WM-004-source-hook-fail-loud/README.md +33 -0
- package/patch/390-WM-004-source-hook-fail-loud/fix.py +164 -0
- package/patch/390-WM-004-source-hook-fail-loud/sentinel +2 -0
- package/patch/420-CF-004-config-export-json/README.md +24 -0
- package/patch/420-CF-004-config-export-json/fix.py +24 -0
- package/patch/420-CF-004-config-export-json/sentinel +2 -0
- package/patch/440-SG-008-init-config-json/README.md +21 -0
- package/patch/440-SG-008-init-config-json/fix.py +116 -0
- package/patch/440-SG-008-init-config-json/sentinel +2 -0
- package/patch/450-CF-006-config-yaml-to-json/README.md +42 -0
- package/patch/450-CF-006-config-yaml-to-json/fix.py +138 -0
- package/patch/450-CF-006-config-yaml-to-json/sentinel +7 -0
- package/patch/480-DOC-001-readme-docs/README.md +52 -0
- package/patch/480-DOC-001-readme-docs/fix.py +273 -0
- package/patch/480-DOC-001-readme-docs/sentinel +11 -0
- package/patch/490-SG-009-remove-v3-mode/README.md +47 -0
- package/patch/490-SG-009-remove-v3-mode/fix.py +204 -0
- package/patch/490-SG-009-remove-v3-mode/sentinel +8 -0
- package/patch/500-CF-009-minimal-v3-defaults/README.md +25 -0
- package/patch/500-CF-009-minimal-v3-defaults/fix.py +32 -0
- package/patch/500-CF-009-minimal-v3-defaults/sentinel +2 -0
- package/patch/530-WM-007-wire-dead-config-keys/README.md +49 -0
- package/patch/530-WM-007-wire-dead-config-keys/fix.py +254 -0
- package/patch/530-WM-007-wire-dead-config-keys/sentinel +15 -0
- package/patch/540-SG-010-init-cli-options/README.md +47 -0
- package/patch/540-SG-010-init-cli-options/fix.py +418 -0
- package/patch/540-SG-010-init-cli-options/sentinel +19 -0
- package/patch/550-SG-011-topology-hierarchical-refs/README.md +34 -0
- package/patch/550-SG-011-topology-hierarchical-refs/fix.py +28 -0
- package/patch/550-SG-011-topology-hierarchical-refs/sentinel +5 -0
- package/patch/560-WM-008-agentdb-v3-upgrade/README.md +57 -0
- package/patch/560-WM-008-agentdb-v3-upgrade/fix.py +257 -0
- package/patch/560-WM-008-agentdb-v3-upgrade/fix.sh +49 -0
- package/patch/560-WM-008-agentdb-v3-upgrade/sentinel +13 -0
- package/patch/570-WM-009-agentdb-learning-loop/README.md +35 -0
- package/patch/570-WM-009-agentdb-learning-loop/fix.py +141 -0
- package/patch/570-WM-009-agentdb-learning-loop/sentinel +3 -0
- package/patch/580-WM-010-witness-chain-verify/README.md +33 -0
- package/patch/580-WM-010-witness-chain-verify/fix.py +45 -0
- package/patch/580-WM-010-witness-chain-verify/sentinel +1 -0
- package/patch/590-WM-011-reasoning-bank-controller/README.md +34 -0
- package/patch/590-WM-011-reasoning-bank-controller/fix.py +381 -0
- package/patch/590-WM-011-reasoning-bank-controller/sentinel +4 -0
- package/patch/060-DM-004-preload-worker-stub/README.md +0 -11
- package/patch/060-DM-004-preload-worker-stub/fix.py +0 -34
- package/patch/060-DM-004-preload-worker-stub/sentinel +0 -1
- package/patch/070-DM-005-consolidation-worker-stub/README.md +0 -11
- package/patch/070-DM-005-consolidation-worker-stub/fix.py +0 -46
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# SG-010: Add CLI options to init for all config.json settings
|
|
2
|
+
# GitHub: #1205
|
|
3
|
+
|
|
4
|
+
# ── Op a: Add 13 option declarations after --dual ──
|
|
5
|
+
patch("SG-010a: add 13 config option declarations to initCommand",
|
|
6
|
+
INIT_CMD,
|
|
7
|
+
""" {
|
|
8
|
+
name: 'dual',
|
|
9
|
+
description: 'Initialize for both Claude Code and OpenAI Codex',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
examples: [""",
|
|
15
|
+
""" {
|
|
16
|
+
name: 'dual',
|
|
17
|
+
description: 'Initialize for both Claude Code and OpenAI Codex',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'cache-size',
|
|
23
|
+
description: 'Memory/embedding LRU cache size',
|
|
24
|
+
type: 'number',
|
|
25
|
+
default: 256,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'coordination-strategy',
|
|
29
|
+
description: 'Swarm coordination strategy',
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 'consensus',
|
|
32
|
+
choices: ['consensus', 'round-robin', 'priority'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'auto-scale',
|
|
36
|
+
description: 'Enable swarm auto-scaling',
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
default: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'mcp-port',
|
|
42
|
+
description: 'MCP server port',
|
|
43
|
+
type: 'number',
|
|
44
|
+
default: 3000,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'mcp-auto-start',
|
|
48
|
+
description: 'Auto-start MCP server',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'memory-backend',
|
|
54
|
+
description: 'Memory storage backend',
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: 'hybrid',
|
|
57
|
+
choices: ['hybrid', 'sqlite', 'agentdb', 'sqljs', 'memory'],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'neural',
|
|
61
|
+
description: 'Enable neural learning (SONA + ReasoningBank)',
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'sona-mode',
|
|
67
|
+
description: 'SONA learning mode',
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: 'balanced',
|
|
70
|
+
choices: ['balanced', 'aggressive', 'conservative'],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'confidence-decay-rate',
|
|
74
|
+
description: 'SONA confidence decay rate',
|
|
75
|
+
type: 'number',
|
|
76
|
+
default: 0.005,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'consolidation-threshold',
|
|
80
|
+
description: 'Memory consolidation threshold',
|
|
81
|
+
type: 'number',
|
|
82
|
+
default: 10,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'page-rank-damping',
|
|
86
|
+
description: 'Knowledge graph PageRank damping factor',
|
|
87
|
+
type: 'number',
|
|
88
|
+
default: 0.85,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'max-memory-nodes',
|
|
92
|
+
description: 'Maximum knowledge graph nodes',
|
|
93
|
+
type: 'number',
|
|
94
|
+
default: 5000,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'similarity-threshold',
|
|
98
|
+
description: 'Memory graph similarity threshold',
|
|
99
|
+
type: 'number',
|
|
100
|
+
default: 0.8,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
examples: [""")
|
|
104
|
+
|
|
105
|
+
# ── Op b: Wire CLI flags into options object ──
|
|
106
|
+
patch("SG-010b: wire CLI flags into options.runtime and options.mcp",
|
|
107
|
+
INIT_CMD,
|
|
108
|
+
""" // Handle --skip-claude and --only-claude flags
|
|
109
|
+
if (skipClaude) {""",
|
|
110
|
+
""" // SG-010b: Wire CLI flags into options.runtime/options.mcp
|
|
111
|
+
if (ctx.flags.cacheSize != null) options.runtime.cacheSize = ctx.flags.cacheSize;
|
|
112
|
+
if (ctx.flags.coordinationStrategy) options.runtime.coordinationStrategy = ctx.flags.coordinationStrategy;
|
|
113
|
+
if (ctx.flags.autoScale != null) options.runtime.autoScale = ctx.flags.autoScale;
|
|
114
|
+
if (ctx.flags.memoryBackend) options.runtime.memoryBackend = ctx.flags.memoryBackend;
|
|
115
|
+
if (ctx.flags.neural != null) options.runtime.enableNeural = ctx.flags.neural;
|
|
116
|
+
if (ctx.flags.sonaMode) options.runtime.sonaMode = ctx.flags.sonaMode;
|
|
117
|
+
if (ctx.flags.confidenceDecayRate != null) options.runtime.confidenceDecayRate = ctx.flags.confidenceDecayRate;
|
|
118
|
+
if (ctx.flags.consolidationThreshold != null) options.runtime.consolidationThreshold = ctx.flags.consolidationThreshold;
|
|
119
|
+
if (ctx.flags.pageRankDamping != null) options.runtime.pageRankDamping = ctx.flags.pageRankDamping;
|
|
120
|
+
if (ctx.flags.maxMemoryNodes != null) options.runtime.maxMemoryNodes = ctx.flags.maxMemoryNodes;
|
|
121
|
+
if (ctx.flags.similarityThreshold != null) options.runtime.similarityThreshold = ctx.flags.similarityThreshold;
|
|
122
|
+
if (ctx.flags.mcpPort != null) options.mcp.port = ctx.flags.mcpPort;
|
|
123
|
+
if (ctx.flags.mcpAutoStart != null) options.mcp.autoStart = ctx.flags.mcpAutoStart;
|
|
124
|
+
// Handle --skip-claude and --only-claude flags
|
|
125
|
+
if (skipClaude) {""")
|
|
126
|
+
|
|
127
|
+
# ── Op c: Wire options into executor config.json template + fix cacheSize ──
|
|
128
|
+
patch("SG-010c: wire options into config.json template, fix cacheSize 100→256",
|
|
129
|
+
EXECUTOR,
|
|
130
|
+
""" const configJson = {
|
|
131
|
+
version: '3.0.0',
|
|
132
|
+
swarm: {
|
|
133
|
+
topology: options.runtime.topology || 'hierarchical-mesh',
|
|
134
|
+
maxAgents: options.runtime.maxAgents || 15,
|
|
135
|
+
autoScale: true,
|
|
136
|
+
coordinationStrategy: 'consensus',
|
|
137
|
+
},
|
|
138
|
+
memory: {
|
|
139
|
+
backend: options.runtime.memoryBackend || 'hybrid',
|
|
140
|
+
enableHNSW: options.runtime.enableHNSW !== false,
|
|
141
|
+
cacheSize: 100,
|
|
142
|
+
learningBridge: {
|
|
143
|
+
enabled: !!(options.runtime.enableLearningBridge ?? options.runtime.enableNeural),
|
|
144
|
+
sonaMode: 'balanced',
|
|
145
|
+
confidenceDecayRate: 0.005,
|
|
146
|
+
accessBoostAmount: 0.03,
|
|
147
|
+
consolidationThreshold: 10,
|
|
148
|
+
},
|
|
149
|
+
memoryGraph: {
|
|
150
|
+
enabled: !!(options.runtime.enableMemoryGraph ?? true),
|
|
151
|
+
pageRankDamping: 0.85,
|
|
152
|
+
maxNodes: 5000,
|
|
153
|
+
similarityThreshold: 0.8,
|
|
154
|
+
},
|
|
155
|
+
agentScopes: {
|
|
156
|
+
enabled: !!(options.runtime.enableAgentScopes ?? true),
|
|
157
|
+
defaultScope: 'project',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
neural: {
|
|
161
|
+
enabled: !!options.runtime.enableNeural,
|
|
162
|
+
modelPath: '.claude-flow/neural',
|
|
163
|
+
},
|
|
164
|
+
hooks: {
|
|
165
|
+
enabled: true,
|
|
166
|
+
autoExecute: true,
|
|
167
|
+
},
|
|
168
|
+
mcp: {
|
|
169
|
+
autoStart: options.mcp.autoStart !== false,
|
|
170
|
+
port: options.mcp.port || 3000,
|
|
171
|
+
},
|
|
172
|
+
};""",
|
|
173
|
+
""" // SG-010c: Wire options into config.json template (all keys now configurable via CLI)
|
|
174
|
+
const configJson = {
|
|
175
|
+
version: '3.0.0',
|
|
176
|
+
swarm: {
|
|
177
|
+
topology: options.runtime.topology || 'hierarchical-mesh',
|
|
178
|
+
maxAgents: options.runtime.maxAgents || 15,
|
|
179
|
+
autoScale: options.runtime.autoScale !== false,
|
|
180
|
+
coordinationStrategy: options.runtime.coordinationStrategy || 'consensus',
|
|
181
|
+
},
|
|
182
|
+
memory: {
|
|
183
|
+
backend: options.runtime.memoryBackend || 'hybrid',
|
|
184
|
+
enableHNSW: options.runtime.enableHNSW !== false,
|
|
185
|
+
cacheSize: options.runtime.cacheSize || 256,
|
|
186
|
+
learningBridge: {
|
|
187
|
+
enabled: !!(options.runtime.enableLearningBridge ?? options.runtime.enableNeural),
|
|
188
|
+
sonaMode: options.runtime.sonaMode || 'balanced',
|
|
189
|
+
confidenceDecayRate: options.runtime.confidenceDecayRate ?? 0.005,
|
|
190
|
+
accessBoostAmount: 0.03,
|
|
191
|
+
consolidationThreshold: options.runtime.consolidationThreshold ?? 10,
|
|
192
|
+
},
|
|
193
|
+
memoryGraph: {
|
|
194
|
+
enabled: !!(options.runtime.enableMemoryGraph ?? true),
|
|
195
|
+
pageRankDamping: options.runtime.pageRankDamping ?? 0.85,
|
|
196
|
+
maxNodes: options.runtime.maxMemoryNodes ?? 5000,
|
|
197
|
+
similarityThreshold: options.runtime.similarityThreshold ?? 0.8,
|
|
198
|
+
},
|
|
199
|
+
agentScopes: {
|
|
200
|
+
enabled: !!(options.runtime.enableAgentScopes ?? true),
|
|
201
|
+
defaultScope: options.runtime.defaultScope || 'project',
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
neural: {
|
|
205
|
+
enabled: !!options.runtime.enableNeural,
|
|
206
|
+
modelPath: options.runtime.modelPath || '.claude-flow/neural',
|
|
207
|
+
},
|
|
208
|
+
hooks: {
|
|
209
|
+
enabled: options.hooks?.enabled !== false,
|
|
210
|
+
autoExecute: options.hooks?.autoExecute !== false,
|
|
211
|
+
},
|
|
212
|
+
mcp: {
|
|
213
|
+
autoStart: options.mcp.autoStart !== false,
|
|
214
|
+
port: options.mcp.port || 3000,
|
|
215
|
+
},
|
|
216
|
+
};""")
|
|
217
|
+
|
|
218
|
+
# ── Op d: Add CLI examples ──
|
|
219
|
+
patch("SG-010d: add CLI examples for new options",
|
|
220
|
+
INIT_CMD,
|
|
221
|
+
""" { command: 'claude-flow init --dual', description: 'Initialize for both Claude Code and Codex' },
|
|
222
|
+
],
|
|
223
|
+
action: initAction,""",
|
|
224
|
+
""" { command: 'claude-flow init --dual', description: 'Initialize for both Claude Code and Codex' },
|
|
225
|
+
{ command: 'claude-flow init --cache-size 512', description: 'Initialize with larger cache' },
|
|
226
|
+
{ command: 'claude-flow init --memory-backend agentdb', description: 'Use AgentDB backend' },
|
|
227
|
+
{ command: 'claude-flow init --mcp-port 4000', description: 'Set MCP server port' },
|
|
228
|
+
],
|
|
229
|
+
action: initAction,""")
|
|
230
|
+
|
|
231
|
+
# ── Op e: Add 7 option declarations after --similarity-threshold ──
|
|
232
|
+
patch("SG-010e: add 7 more config option declarations (topology thru access-boost-amount)",
|
|
233
|
+
INIT_CMD,
|
|
234
|
+
""" {
|
|
235
|
+
name: 'similarity-threshold',
|
|
236
|
+
description: 'Memory graph similarity threshold',
|
|
237
|
+
type: 'number',
|
|
238
|
+
default: 0.8,
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
examples: [""",
|
|
242
|
+
""" {
|
|
243
|
+
name: 'similarity-threshold',
|
|
244
|
+
description: 'Memory graph similarity threshold',
|
|
245
|
+
type: 'number',
|
|
246
|
+
default: 0.8,
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'topology',
|
|
250
|
+
description: 'Swarm topology',
|
|
251
|
+
type: 'string',
|
|
252
|
+
default: 'hierarchical-mesh',
|
|
253
|
+
choices: ['hierarchical-mesh', 'hierarchical', 'mesh', 'ring', 'star'],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'max-agents',
|
|
257
|
+
description: 'Maximum concurrent agents',
|
|
258
|
+
type: 'number',
|
|
259
|
+
default: 15,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'enable-hnsw',
|
|
263
|
+
description: 'Enable HNSW vector indexing',
|
|
264
|
+
type: 'boolean',
|
|
265
|
+
default: true,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'model-path',
|
|
269
|
+
description: 'Neural model storage path',
|
|
270
|
+
type: 'string',
|
|
271
|
+
default: '.claude-flow/neural',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: 'hooks',
|
|
275
|
+
description: 'Enable hooks system',
|
|
276
|
+
type: 'boolean',
|
|
277
|
+
default: true,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: 'auto-execute',
|
|
281
|
+
description: 'Auto-execute hooks',
|
|
282
|
+
type: 'boolean',
|
|
283
|
+
default: true,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: 'access-boost-amount',
|
|
287
|
+
description: 'SONA access boost amount',
|
|
288
|
+
type: 'number',
|
|
289
|
+
default: 0.03,
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
examples: [""")
|
|
293
|
+
|
|
294
|
+
# ── Op f: Wire 7 new flags into options ──
|
|
295
|
+
# NOTE: old_string includes "if (skipClaude) {" to consume SG-010b's preserved comment+code
|
|
296
|
+
# and the new_string tags the comment with "(SG-010f)" so SG-010b's old_string no longer matches.
|
|
297
|
+
patch("SG-010f: wire 7 new CLI flags into options",
|
|
298
|
+
INIT_CMD,
|
|
299
|
+
""" if (ctx.flags.mcpAutoStart != null) options.mcp.autoStart = ctx.flags.mcpAutoStart;
|
|
300
|
+
// Handle --skip-claude and --only-claude flags
|
|
301
|
+
if (skipClaude) {""",
|
|
302
|
+
""" if (ctx.flags.mcpAutoStart != null) options.mcp.autoStart = ctx.flags.mcpAutoStart;
|
|
303
|
+
if (ctx.flags.topology) options.runtime.topology = ctx.flags.topology;
|
|
304
|
+
if (ctx.flags.maxAgents != null) options.runtime.maxAgents = ctx.flags.maxAgents;
|
|
305
|
+
if (ctx.flags.enableHnsw != null) options.runtime.enableHNSW = ctx.flags.enableHnsw;
|
|
306
|
+
if (ctx.flags.modelPath) options.runtime.modelPath = ctx.flags.modelPath;
|
|
307
|
+
if (ctx.flags.hooks != null) options.hooks.enabled = ctx.flags.hooks;
|
|
308
|
+
if (ctx.flags.autoExecute != null) options.hooks.autoExecute = ctx.flags.autoExecute;
|
|
309
|
+
if (ctx.flags.accessBoostAmount != null) options.runtime.accessBoostAmount = ctx.flags.accessBoostAmount;
|
|
310
|
+
// Handle --skip-claude and --only-claude flags (SG-010f)
|
|
311
|
+
if (skipClaude) {""")
|
|
312
|
+
|
|
313
|
+
# ── Op g: Wire new keys into executor config.json template (3 sub-patches) ──
|
|
314
|
+
patch("SG-010g1: wire accessBoostAmount from options into config.json template",
|
|
315
|
+
EXECUTOR,
|
|
316
|
+
""" accessBoostAmount: 0.03,""",
|
|
317
|
+
""" accessBoostAmount: options.runtime.accessBoostAmount ?? 0.03,""")
|
|
318
|
+
|
|
319
|
+
patch("SG-010g2: wire hooks.enabled and autoExecute from options into config.json template",
|
|
320
|
+
EXECUTOR,
|
|
321
|
+
""" hooks: {
|
|
322
|
+
enabled: true,
|
|
323
|
+
autoExecute: true,
|
|
324
|
+
},""",
|
|
325
|
+
""" hooks: {
|
|
326
|
+
enabled: options.hooks?.enabled !== false,
|
|
327
|
+
autoExecute: options.hooks?.autoExecute !== false,
|
|
328
|
+
},""")
|
|
329
|
+
|
|
330
|
+
patch("SG-010g3: wire modelPath from options into config.json template",
|
|
331
|
+
EXECUTOR,
|
|
332
|
+
""" modelPath: '.claude-flow/neural',""",
|
|
333
|
+
""" modelPath: options.runtime.modelPath || '.claude-flow/neural',""")
|
|
334
|
+
|
|
335
|
+
# ── Op h: Add 2 CLI examples ──
|
|
336
|
+
patch("SG-010h: add CLI examples for topology and hooks options",
|
|
337
|
+
INIT_CMD,
|
|
338
|
+
""" { command: 'claude-flow init --mcp-port 4000', description: 'Set MCP server port' },
|
|
339
|
+
],
|
|
340
|
+
action: initAction,""",
|
|
341
|
+
""" { command: 'claude-flow init --mcp-port 4000', description: 'Set MCP server port' },
|
|
342
|
+
{ command: 'claude-flow init --topology mesh --max-agents 8', description: 'Use mesh topology' },
|
|
343
|
+
{ command: 'claude-flow init --no-hooks', description: 'Initialize with hooks disabled' },
|
|
344
|
+
],
|
|
345
|
+
action: initAction,""")
|
|
346
|
+
|
|
347
|
+
# ── Op j: Deduplicate SG-010b wiring block (stale cache cleanup) ──
|
|
348
|
+
# During development, SG-010b's wiring block was duplicated multiple times
|
|
349
|
+
# in the live npx cache. This cleanup collapses N consecutive copies into 1.
|
|
350
|
+
# MUST run before ops i1-i3 so defaultScope is added to the single surviving block.
|
|
351
|
+
import re as _re
|
|
352
|
+
try:
|
|
353
|
+
with open(INIT_CMD, 'r') as _f:
|
|
354
|
+
_c = _f.read()
|
|
355
|
+
_sig = ' // SG-010b: Wire CLI flags into options.runtime/options.mcp\n'
|
|
356
|
+
_n = _c.count(_sig)
|
|
357
|
+
if _n > 1:
|
|
358
|
+
_block = (
|
|
359
|
+
r' // SG-010b: Wire CLI flags into options\.runtime/options\.mcp\n'
|
|
360
|
+
r'(?: if \(ctx\.flags\.\w+[^\n]*\n)+')
|
|
361
|
+
_dedup_pat = _re.compile(r'(' + _block + r')(?:' + _block + r')+')
|
|
362
|
+
_new_c = _dedup_pat.sub(r'\1', _c)
|
|
363
|
+
if _new_c != _c:
|
|
364
|
+
with open(INIT_CMD, 'w') as _f:
|
|
365
|
+
_f.write(_new_c)
|
|
366
|
+
_n2 = _new_c.count(_sig)
|
|
367
|
+
print(f" Applied: SG-010j: deduplicate SG-010b wiring ({_n} → {_n2})")
|
|
368
|
+
else:
|
|
369
|
+
print(f" Skipped: SG-010j: dedup regex did not match")
|
|
370
|
+
elif _n == 1:
|
|
371
|
+
print(f" Skipped: SG-010j: no duplicates found")
|
|
372
|
+
else:
|
|
373
|
+
print(f" Skipped: SG-010j: SG-010b not yet applied")
|
|
374
|
+
except Exception as _e:
|
|
375
|
+
print(f" WARN: SG-010j — {_e}")
|
|
376
|
+
|
|
377
|
+
# ── Op i: Add --default-scope CLI option, wiring, and template ──
|
|
378
|
+
|
|
379
|
+
# i1: Option declaration — after --access-boost-amount (SG-010e's last entry)
|
|
380
|
+
patch("SG-010i1: add --default-scope option declaration",
|
|
381
|
+
INIT_CMD,
|
|
382
|
+
""" {
|
|
383
|
+
name: 'access-boost-amount',
|
|
384
|
+
description: 'SONA access boost amount',
|
|
385
|
+
type: 'number',
|
|
386
|
+
default: 0.03,
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
examples: [""",
|
|
390
|
+
""" {
|
|
391
|
+
name: 'access-boost-amount',
|
|
392
|
+
description: 'SONA access boost amount',
|
|
393
|
+
type: 'number',
|
|
394
|
+
default: 0.03,
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: 'default-scope',
|
|
398
|
+
description: 'Default agent memory scope',
|
|
399
|
+
type: 'string',
|
|
400
|
+
default: 'project',
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
examples: [""")
|
|
404
|
+
|
|
405
|
+
# i2: Wire flag into options — after accessBoostAmount (SG-010f's last wiring line)
|
|
406
|
+
patch("SG-010i2: wire --default-scope flag into options",
|
|
407
|
+
INIT_CMD,
|
|
408
|
+
""" if (ctx.flags.accessBoostAmount != null) options.runtime.accessBoostAmount = ctx.flags.accessBoostAmount;
|
|
409
|
+
// Handle --skip-claude and --only-claude flags (SG-010f)""",
|
|
410
|
+
""" if (ctx.flags.accessBoostAmount != null) options.runtime.accessBoostAmount = ctx.flags.accessBoostAmount;
|
|
411
|
+
if (ctx.flags.defaultScope) options.runtime.defaultScope = ctx.flags.defaultScope;
|
|
412
|
+
// Handle --skip-claude and --only-claude flags (SG-010f)""")
|
|
413
|
+
|
|
414
|
+
# i3: Wire into executor config.json template — replace hardcoded 'project'
|
|
415
|
+
patch("SG-010i3: wire defaultScope from options into config.json template",
|
|
416
|
+
EXECUTOR,
|
|
417
|
+
""" defaultScope: 'project',""",
|
|
418
|
+
""" defaultScope: options.runtime.defaultScope || 'project',""")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
grep "name: 'cache-size'" commands/init.js
|
|
2
|
+
grep "name: 'memory-backend'" commands/init.js
|
|
3
|
+
grep "name: 'sona-mode'" commands/init.js
|
|
4
|
+
grep "SG-010b" commands/init.js
|
|
5
|
+
grep "SG-010c" init/executor.js
|
|
6
|
+
grep "cacheSize: options.runtime.cacheSize || 256" init/executor.js
|
|
7
|
+
grep "init --cache-size 512" commands/init.js
|
|
8
|
+
absent "cacheSize: 100," init/executor.js
|
|
9
|
+
grep "name: 'topology'" commands/init.js
|
|
10
|
+
grep "name: 'hooks'" commands/init.js
|
|
11
|
+
grep "options.runtime.topology" commands/init.js
|
|
12
|
+
grep "SG-010f" commands/init.js
|
|
13
|
+
grep "options.hooks?.enabled" init/executor.js
|
|
14
|
+
grep "options.runtime.modelPath" init/executor.js
|
|
15
|
+
grep "init --topology mesh" commands/init.js
|
|
16
|
+
grep "init --no-hooks" commands/init.js
|
|
17
|
+
grep "name: 'default-scope'" commands/init.js
|
|
18
|
+
grep "ctx.flags.defaultScope" commands/init.js
|
|
19
|
+
grep "options.runtime.defaultScope" init/executor.js
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SG-011: Fix stale --topology hierarchical references
|
|
2
|
+
|
|
3
|
+
**Severity**: Medium
|
|
4
|
+
**GitHub**: [#1206](https://github.com/ruvnet/claude-flow/issues/1206)
|
|
5
|
+
|
|
6
|
+
## Root Cause
|
|
7
|
+
|
|
8
|
+
SG-009 updated swarm.js, config.js, start.js, index.js, and claudemd-generator.js
|
|
9
|
+
to remove `--v3-mode` and use `hierarchical-mesh` as the default topology, but missed
|
|
10
|
+
5 occurrences of `--topology hierarchical` in init-related files:
|
|
11
|
+
|
|
12
|
+
- `commands/init.js` line 323: `--start-all` exec command
|
|
13
|
+
- `init/claudemd-generator.js` lines 91, 103: anti-drift and auto-start templates
|
|
14
|
+
- `init/executor.js` lines 1327, 1636: CAPABILITIES.md quick commands
|
|
15
|
+
|
|
16
|
+
## Fix
|
|
17
|
+
|
|
18
|
+
3 ops fix all 5 references:
|
|
19
|
+
|
|
20
|
+
| Op | File | Count | Change |
|
|
21
|
+
|----|------|-------|--------|
|
|
22
|
+
| a | commands/init.js | 1 | `--topology hierarchical 2>` → `--topology hierarchical-mesh 2>` |
|
|
23
|
+
| b | init/claudemd-generator.js | 2 | `--topology hierarchical --max-agents 8` → `--topology hierarchical-mesh --max-agents 8` |
|
|
24
|
+
| c | init/executor.js | 2 | `--topology hierarchical --max-agents 8` → `--topology hierarchical-mesh --max-agents 8` |
|
|
25
|
+
|
|
26
|
+
## Files Patched
|
|
27
|
+
|
|
28
|
+
- `commands/init.js`
|
|
29
|
+
- `init/claudemd-generator.js`
|
|
30
|
+
- `init/executor.js`
|
|
31
|
+
|
|
32
|
+
## Ops
|
|
33
|
+
|
|
34
|
+
3 ops in fix.py
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# SG-011: Fix stale --topology hierarchical references
|
|
2
|
+
# GitHub: #1206
|
|
3
|
+
|
|
4
|
+
# ── Op a: init.js --start-all exec command ──
|
|
5
|
+
patch("SG-011a: init --start-all topology hierarchical → hierarchical-mesh",
|
|
6
|
+
INIT_CMD,
|
|
7
|
+
"""execSync('npx @claude-flow/cli@latest swarm init --topology hierarchical 2>/dev/null', {
|
|
8
|
+
stdio: 'pipe',
|
|
9
|
+
cwd: ctx.cwd,
|
|
10
|
+
timeout: 30000
|
|
11
|
+
});""",
|
|
12
|
+
"""execSync('npx @claude-flow/cli@latest swarm init --topology hierarchical-mesh 2>/dev/null', {
|
|
13
|
+
stdio: 'pipe',
|
|
14
|
+
cwd: ctx.cwd,
|
|
15
|
+
timeout: 30000
|
|
16
|
+
});""")
|
|
17
|
+
|
|
18
|
+
# ── Op b: claudemd-generator.js — anti-drift + auto-start templates ──
|
|
19
|
+
patch_all("SG-011b: claudemd topology hierarchical → hierarchical-mesh",
|
|
20
|
+
CLAUDEMD_GEN,
|
|
21
|
+
"""--topology hierarchical --max-agents 8""",
|
|
22
|
+
"""--topology hierarchical-mesh --max-agents 8""")
|
|
23
|
+
|
|
24
|
+
# ── Op c: executor.js — CAPABILITIES.md quick commands ──
|
|
25
|
+
patch_all("SG-011c: CAPABILITIES.md topology hierarchical → hierarchical-mesh",
|
|
26
|
+
EXECUTOR,
|
|
27
|
+
"""swarm init --topology hierarchical --max-agents 8""",
|
|
28
|
+
"""swarm init --topology hierarchical-mesh --max-agents 8""")
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
grep "topology hierarchical-mesh 2>" commands/init.js
|
|
2
|
+
grep "topology hierarchical-mesh --max-agents 8" init/claudemd-generator.js
|
|
3
|
+
grep "topology hierarchical-mesh --max-agents 8" init/executor.js
|
|
4
|
+
absent "topology hierarchical --max-agents 8" init/claudemd-generator.js
|
|
5
|
+
absent "topology hierarchical --max-agents 8" init/executor.js
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# WM-008: Upgrade AgentDB v2 to v3 (RVF backend, self-learning, witness chain)
|
|
2
|
+
|
|
3
|
+
**Severity**: High
|
|
4
|
+
**GitHub**: [#1207](https://github.com/ruvnet/claude-flow/issues/1207)
|
|
5
|
+
|
|
6
|
+
## Root Cause
|
|
7
|
+
|
|
8
|
+
`@claude-flow/memory` depends on `agentdb@2.0.0-alpha.3.7` (37 hard deps, native
|
|
9
|
+
bindings). AgentDB v3 (`3.0.0-alpha.3`) cuts to 5 deps (zero native via sql.js WASM
|
|
10
|
+
fallback), adds unified `.rvf` single-file storage, self-learning search via
|
|
11
|
+
`SelfLearningRvfBackend`, and a SHAKE-256 witness chain for tamper detection.
|
|
12
|
+
|
|
13
|
+
Multiple packages reference agentdb v2 APIs, paths, or version strings:
|
|
14
|
+
|
|
15
|
+
- `@claude-flow/memory` — `AgentDBBackend` hardcodes `vectorBackend: 'auto'`, package.json pins v2
|
|
16
|
+
- `@claude-flow/cli` — `memory-initializer.js`, `helpers-generator.js`, `auto-memory-hook.mjs`, `executor.js` all use `.db` paths and v2 config
|
|
17
|
+
- `@claude-flow/neural` — `reasoning-bank.js` uses `vectorBackend: 'auto'`
|
|
18
|
+
- `@claude-flow/shared` — `defaults.js` missing `vectorBackend` field
|
|
19
|
+
|
|
20
|
+
## Fix
|
|
21
|
+
|
|
22
|
+
15 ops in fix.py + 1 fix.sh (package upgrade) across 8 files in 4 packages:
|
|
23
|
+
|
|
24
|
+
| Op | Package | File | Change |
|
|
25
|
+
|----|---------|------|--------|
|
|
26
|
+
| A | @claude-flow/memory | agentdb-backend.js | `vectorBackend: 'auto'` -> `'rvf'` |
|
|
27
|
+
| B | @claude-flow/memory | agentdb-backend.js | Add `save()` before `close()` in shutdown for unified mode; destroy learning backend |
|
|
28
|
+
| C | @claude-flow/memory | agentdb-backend.js | Import `SelfLearningRvfBackend` alongside AgentDB |
|
|
29
|
+
| D | @claude-flow/memory | agentdb-backend.js | Create learning backend when `config.enableLearning`; capture witness chain hash in init event |
|
|
30
|
+
| E | @claude-flow/memory | agentdb-backend.js | Add `recordFeedback()` method for self-learning |
|
|
31
|
+
| F | @claude-flow/memory | agentdb-backend.js | Add `getWitnessChain()` / `verifyWitnessChain()` methods |
|
|
32
|
+
| G | @claude-flow/cli | memory-initializer.js | `.db` -> `.rvf`, add `vectorBackend: 'rvf'` + learning config from config.json |
|
|
33
|
+
| H | @claude-flow/cli | executor.js | Add `agentdb` subsection to config.json template |
|
|
34
|
+
| I | @claude-flow/memory | package.json | Update agentdb dep `2.0.0-alpha.3.7` -> `3.0.0-alpha.3` |
|
|
35
|
+
| J | @claude-flow/memory | agentdb-backend.js | Update header comment version |
|
|
36
|
+
| K | @claude-flow/cli | helpers-generator.js | `.db` -> `.rvf` + `vectorBackend: 'rvf'` (3 HybridBackend blocks) |
|
|
37
|
+
| L | @claude-flow/cli | auto-memory-hook.mjs | `.db` -> `.rvf` + v3 config |
|
|
38
|
+
| M | @claude-flow/neural | reasoning-bank.js | `vectorBackend: 'auto'` -> `'rvf'` |
|
|
39
|
+
| N | @claude-flow/shared | defaults.js | Add `vectorBackend: 'rvf'` to agentdb defaults |
|
|
40
|
+
| O | @claude-flow/cli | executor.js | Update version table `2.0.0-alpha.3.4` -> `3.0.0-alpha.3` |
|
|
41
|
+
|
|
42
|
+
fix.sh upgrades the agentdb npm package from v2 to v3 via `npm pack` + `tar extract`.
|
|
43
|
+
|
|
44
|
+
## Files Patched
|
|
45
|
+
|
|
46
|
+
- `@claude-flow/memory` `dist/agentdb-backend.js` (ops A-F, J)
|
|
47
|
+
- `@claude-flow/memory` `package.json` (op I)
|
|
48
|
+
- `@claude-flow/cli` `memory/memory-initializer.js` (op G)
|
|
49
|
+
- `@claude-flow/cli` `init/executor.js` (ops H, O)
|
|
50
|
+
- `@claude-flow/cli` `init/helpers-generator.js` (op K)
|
|
51
|
+
- `@claude-flow/cli` `.claude/helpers/auto-memory-hook.mjs` (op L)
|
|
52
|
+
- `@claude-flow/neural` `dist/reasoning-bank.js` (op M)
|
|
53
|
+
- `@claude-flow/shared` `dist/core/config/defaults.js` (op N)
|
|
54
|
+
|
|
55
|
+
## Ops
|
|
56
|
+
|
|
57
|
+
15 ops in fix.py, 1 fix.sh
|