claude-flow 2.5.0-alpha.141 → 2.7.0-alpha

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 (149) hide show
  1. package/.claude/agents/reasoning/README.md +171 -0
  2. package/.claude/agents/reasoning/agent.md +816 -0
  3. package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
  4. package/.claude/agents/reasoning/goal-planner.md +73 -0
  5. package/.claude/commands/coordination/README.md +9 -0
  6. package/.claude/commands/memory/README.md +9 -0
  7. package/.claude/settings.json +3 -3
  8. package/.claude/sparc-modes.json +108 -0
  9. package/README.md +1 -6
  10. package/bin/claude-flow +1 -1
  11. package/dist/src/cli/command-registry.js +70 -6
  12. package/dist/src/cli/command-registry.js.map +1 -1
  13. package/dist/src/cli/help-formatter.js +0 -3
  14. package/dist/src/cli/help-formatter.js.map +1 -1
  15. package/dist/src/cli/help-text.js +53 -5
  16. package/dist/src/cli/help-text.js.map +1 -1
  17. package/dist/src/cli/simple-cli.js +182 -172
  18. package/dist/src/cli/simple-cli.js.map +1 -1
  19. package/dist/src/cli/simple-commands/agent-booster.js +415 -0
  20. package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
  21. package/dist/src/cli/simple-commands/agent.js +856 -13
  22. package/dist/src/cli/simple-commands/agent.js.map +1 -1
  23. package/dist/src/cli/simple-commands/env-template.js +180 -0
  24. package/dist/src/cli/simple-commands/env-template.js.map +1 -0
  25. package/dist/src/cli/simple-commands/init/help.js +23 -0
  26. package/dist/src/cli/simple-commands/init/help.js.map +1 -1
  27. package/dist/src/cli/simple-commands/init/index.js +63 -0
  28. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  29. package/dist/src/cli/simple-commands/memory.js +307 -16
  30. package/dist/src/cli/simple-commands/memory.js.map +1 -1
  31. package/dist/src/cli/simple-commands/proxy.js +304 -0
  32. package/dist/src/cli/simple-commands/proxy.js.map +1 -0
  33. package/dist/src/cli/simple-commands/sparc.js +16 -19
  34. package/dist/src/cli/simple-commands/sparc.js.map +1 -1
  35. package/dist/src/cli/validation-helper.js.map +1 -1
  36. package/dist/src/core/version.js +1 -1
  37. package/dist/src/execution/agent-executor.js +181 -0
  38. package/dist/src/execution/agent-executor.js.map +1 -0
  39. package/dist/src/execution/index.js +12 -0
  40. package/dist/src/execution/index.js.map +1 -0
  41. package/dist/src/execution/provider-manager.js +110 -0
  42. package/dist/src/execution/provider-manager.js.map +1 -0
  43. package/dist/src/hooks/redaction-hook.js +89 -0
  44. package/dist/src/hooks/redaction-hook.js.map +1 -0
  45. package/dist/src/memory/swarm-memory.js +340 -421
  46. package/dist/src/memory/swarm-memory.js.map +1 -1
  47. package/dist/src/utils/key-redactor.js +108 -0
  48. package/dist/src/utils/key-redactor.js.map +1 -0
  49. package/dist/src/utils/metrics-reader.js +37 -39
  50. package/dist/src/utils/metrics-reader.js.map +1 -1
  51. package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
  52. package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
  53. package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
  54. package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
  55. package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
  56. package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
  57. package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
  58. package/docs/COMMIT_SUMMARY.md +247 -0
  59. package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
  60. package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
  61. package/docs/ENV-SETUP-GUIDE.md +270 -0
  62. package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
  63. package/docs/FINAL_VALIDATION_REPORT.md +165 -0
  64. package/docs/HOOKS-V2-MODIFICATION.md +146 -0
  65. package/docs/INDEX.md +568 -0
  66. package/docs/INTEGRATION_COMPLETE.md +414 -0
  67. package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
  68. package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
  69. package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
  70. package/docs/README.md +35 -0
  71. package/docs/REASONING-AGENTS.md +482 -0
  72. package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
  73. package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
  74. package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
  75. package/docs/REASONINGBANK-BENCHMARK.md +396 -0
  76. package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
  77. package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
  78. package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
  79. package/docs/REASONINGBANK-DEMO.md +419 -0
  80. package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
  81. package/docs/REASONINGBANK-VALIDATION.md +532 -0
  82. package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
  83. package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
  84. package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
  85. package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
  86. package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
  87. package/docs/api/API_DOCUMENTATION.md +721 -0
  88. package/docs/architecture/ARCHITECTURE.md +1690 -0
  89. package/docs/ci-cd/README.md +368 -0
  90. package/docs/development/DEPLOYMENT.md +2348 -0
  91. package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
  92. package/docs/development/build-analysis-report.md +252 -0
  93. package/docs/development/pair-optimization.md +156 -0
  94. package/docs/development/token-tracking-status.md +103 -0
  95. package/docs/development/training-pipeline-demo.md +163 -0
  96. package/docs/development/training-pipeline-real-only.md +196 -0
  97. package/docs/epic-sdk-integration.md +1269 -0
  98. package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
  99. package/docs/experimental/computational_verification.py +436 -0
  100. package/docs/experimental/novel_approaches.md +560 -0
  101. package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
  102. package/docs/experimental/riemann_proof_attempt.md +124 -0
  103. package/docs/experimental/riemann_synthesis.md +277 -0
  104. package/docs/experimental/verification_results.json +12 -0
  105. package/docs/experimental/visualization_insights.md +720 -0
  106. package/docs/guides/USER_GUIDE.md +1138 -0
  107. package/docs/guides/token-tracking-guide.md +291 -0
  108. package/docs/reference/AGENTS.md +1011 -0
  109. package/docs/reference/MCP_TOOLS.md +2188 -0
  110. package/docs/reference/SPARC.md +717 -0
  111. package/docs/reference/SWARM.md +2000 -0
  112. package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
  113. package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
  114. package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
  115. package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
  116. package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
  117. package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
  118. package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
  119. package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
  120. package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
  121. package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
  122. package/docs/sdk/epic-sdk-integration.md +1269 -0
  123. package/docs/setup/remote-setup.md +93 -0
  124. package/docs/validation/final-validation-summary.md +220 -0
  125. package/docs/validation/verification-integration.md +190 -0
  126. package/docs/validation/verification-validation.md +349 -0
  127. package/docs/wiki/background-commands.md +1213 -0
  128. package/docs/wiki/session-persistence.md +342 -0
  129. package/docs/wiki/stream-chain-command.md +537 -0
  130. package/package.json +4 -2
  131. package/src/cli/command-registry.js +70 -5
  132. package/src/cli/help-text.js +26 -5
  133. package/src/cli/simple-cli.ts +18 -7
  134. package/src/cli/simple-commands/agent-booster.js +515 -0
  135. package/src/cli/simple-commands/agent.js +1001 -12
  136. package/src/cli/simple-commands/agent.ts +137 -0
  137. package/src/cli/simple-commands/config.ts +127 -0
  138. package/src/cli/simple-commands/env-template.js +190 -0
  139. package/src/cli/simple-commands/init/help.js +23 -0
  140. package/src/cli/simple-commands/init/index.js +84 -6
  141. package/src/cli/simple-commands/memory.js +363 -16
  142. package/src/cli/simple-commands/proxy.js +384 -0
  143. package/src/cli/simple-commands/sparc.js +16 -19
  144. package/src/execution/agent-executor.ts +306 -0
  145. package/src/execution/index.ts +19 -0
  146. package/src/execution/provider-manager.ts +187 -0
  147. package/src/hooks/redaction-hook.ts +115 -0
  148. package/src/utils/key-redactor.js +178 -0
  149. package/src/utils/key-redactor.ts +184 -0
@@ -0,0 +1,342 @@
1
+ # Session Persistence in Claude Code
2
+
3
+ ## Overview
4
+
5
+ Claude Code provides sophisticated session persistence that goes beyond simple conversation history. It maintains complete development environment state including background processes, file contexts, permissions, and working directories.
6
+
7
+ ## Session Commands
8
+
9
+ ### Core Commands
10
+
11
+ | Command | Description | Example |
12
+ |---------|-------------|---------|
13
+ | `claude --continue` | Continue the most recent conversation | `claude --continue` |
14
+ | `claude --resume` | Resume a specific session (interactive selection) | `claude --resume` |
15
+ | `claude --resume <id>` | Resume a specific session by ID | `claude --resume abc123-def456` |
16
+ | `claude --session-id <uuid>` | Start with a specific session ID | `claude --session-id my-custom-id` |
17
+
18
+ ## What Gets Persisted
19
+
20
+ ### 1. Conversation History
21
+ - **Full message history** between user and Claude
22
+ - **Tool call records** with parameters and responses
23
+ - **Context from previous interactions**
24
+ - **File references and modifications**
25
+
26
+ ### 2. Background Processes
27
+
28
+ Background tasks started with `run_in_background: true` persist across sessions:
29
+
30
+ ```bash
31
+ # Example: Server started in one session
32
+ python3 -m http.server 8080 # bash_3
33
+
34
+ # After --continue or --resume:
35
+ # - Process still running
36
+ # - Shell ID preserved (bash_3)
37
+ # - Can check output with BashOutput tool
38
+ # - Can kill with KillBash tool
39
+ ```
40
+
41
+ **Verified Test Results:**
42
+ - Background processes continue running after session ends
43
+ - Shell IDs (bash_1, bash_2, etc.) are preserved
44
+ - Output buffers maintained for incremental reading
45
+ - Process state tracked (running/completed/killed)
46
+
47
+ ### 3. File Context
48
+
49
+ Claude remembers which files have been accessed:
50
+
51
+ ```bash
52
+ # Files read with Read tool
53
+ # Files edited with Edit tool
54
+ # Files created with Write tool
55
+ # All remembered across sessions
56
+ ```
57
+
58
+ **Test Example:**
59
+ ```bash
60
+ # Session 1: Create a marker file
61
+ claude> Write test-session-marker.txt
62
+
63
+ # Session 2: Claude knows about the file without re-reading
64
+ claude --continue
65
+ claude> "What's in test-session-marker.txt?"
66
+ # Claude can reference it from memory
67
+ ```
68
+
69
+ ### 4. Working Directory Context
70
+
71
+ ```bash
72
+ # Current working directory preserved
73
+ # Environment state maintained
74
+ # Path contexts remembered
75
+ ```
76
+
77
+ ### 5. Tool Permissions
78
+
79
+ Permissions granted in one session carry over:
80
+
81
+ ```bash
82
+ # First session: Approve Bash tool for git commands
83
+ # Subsequent sessions: No re-approval needed for same patterns
84
+ ```
85
+
86
+ ## Incremental Output Tracking
87
+
88
+ The `BashOutput` tool maintains read positions:
89
+
90
+ ```bash
91
+ # First check of bash_6
92
+ BashOutput(bash_6) → Shows lines 1-10
93
+
94
+ # Second check (even after session resume)
95
+ BashOutput(bash_6) → Shows only NEW lines 11-20
96
+
97
+ # Prevents duplicate output display
98
+ ```
99
+
100
+ ## Session Storage
101
+
102
+ ### Location
103
+ Sessions are stored locally on the machine (exact path varies by OS):
104
+ - Likely in `~/.config/claude/` or similar
105
+ - Each session has a unique identifier
106
+ - Automatic cleanup of old sessions
107
+
108
+ ### Session Structure
109
+ ```javascript
110
+ {
111
+ "sessionId": "abc123-def456",
112
+ "startTime": "2025-08-11T22:00:00Z",
113
+ "lastActive": "2025-08-11T22:27:00Z",
114
+ "messages": [...],
115
+ "backgroundTasks": {
116
+ "bash_3": {
117
+ "command": "python3 -m http.server 8080",
118
+ "status": "running",
119
+ "pid": 295416,
120
+ "outputPosition": 1234
121
+ }
122
+ },
123
+ "fileContext": {
124
+ "read": ["file1.txt", "file2.js"],
125
+ "modified": ["config.json"],
126
+ "created": ["test-marker.txt"]
127
+ },
128
+ "permissions": {
129
+ "approvedTools": ["Bash(git:*)", "Edit"],
130
+ "directories": ["/workspaces/project"]
131
+ }
132
+ }
133
+ ```
134
+
135
+ ## Practical Examples
136
+
137
+ ### Example 1: Development Server Management
138
+
139
+ ```bash
140
+ # Monday: Start development
141
+ claude
142
+ > Start npm run dev in background
143
+ > Start docker-compose up in background
144
+ > Work on features...
145
+ > Exit (servers keep running)
146
+
147
+ # Tuesday: Continue work
148
+ claude --continue
149
+ > Check status of npm run dev # Still running!
150
+ > Show docker logs # Can see all output
151
+ > Continue development...
152
+ ```
153
+
154
+ ### Example 2: Long-Running Build
155
+
156
+ ```bash
157
+ # Start a long build
158
+ claude
159
+ > Run build script in background
160
+ > Exit for lunch
161
+
162
+ # Return and check progress
163
+ claude --continue
164
+ > Check build output # See what happened while away
165
+ > Build completed? Check exit code
166
+ ```
167
+
168
+ ### Example 3: Debug Session
169
+
170
+ ```bash
171
+ # Complex debugging session
172
+ claude
173
+ > Set up monitoring in background
174
+ > Create test files
175
+ > Run diagnostics
176
+ > [System crash/need to leave]
177
+
178
+ # Resume exactly where left off
179
+ claude --resume
180
+ > All background monitors still running
181
+ > Test files still in context
182
+ > Continue debugging from exact point
183
+ ```
184
+
185
+ ## Best Practices
186
+
187
+ ### 1. Session Management
188
+
189
+ **DO:**
190
+ - Use `--continue` for same-day work continuity
191
+ - Use `--resume` when you need a specific past session
192
+ - Name sessions meaningfully with `--session-id`
193
+ - Clean up background tasks before extended breaks
194
+
195
+ **DON'T:**
196
+ - Leave unnecessary background tasks running for days
197
+ - Rely on sessions older than a week (may be cleaned up)
198
+ - Assume background processes survive system reboots
199
+
200
+ ### 2. Background Task Management
201
+
202
+ ```bash
203
+ # Before ending a session, check background tasks
204
+ /bashes # List all background tasks
205
+
206
+ # Clean up if needed
207
+ "Kill all background tasks except the dev server"
208
+
209
+ # Or selectively
210
+ "Kill bash_1 and bash_2 but keep bash_3"
211
+ ```
212
+
213
+ ### 3. Context Preservation
214
+
215
+ ```bash
216
+ # Create a session marker for complex work
217
+ "Create SESSION_NOTES.md with current context"
218
+
219
+ # Helps both you and Claude remember the context
220
+ "Update SESSION_NOTES.md with progress"
221
+ ```
222
+
223
+ ## Limitations
224
+
225
+ ### 1. System Boundaries
226
+ - Sessions are **local to the machine**
227
+ - Don't survive system reboots
228
+ - Can't transfer between machines
229
+
230
+ ### 2. Process Limitations
231
+ - Background processes may be killed by OS for resources
232
+ - Very long-idle processes may timeout
233
+ - Output buffers have size limits
234
+
235
+ ### 3. Security Boundaries
236
+ - File permissions re-checked on resume
237
+ - New sensitive operations require re-approval
238
+ - Directory access validated each session
239
+
240
+ ## Advanced Features
241
+
242
+ ### Session Branching
243
+
244
+ You can resume the same session multiple times:
245
+
246
+ ```bash
247
+ # Original work
248
+ claude --session-id project-main
249
+
250
+ # Branch 1: Try approach A
251
+ claude --resume project-main
252
+ # Work on approach A
253
+
254
+ # Branch 2: Try approach B
255
+ claude --resume project-main
256
+ # Work on approach B
257
+ # Both branches have the same starting context
258
+ ```
259
+
260
+ ### Partial Recovery
261
+
262
+ Even if a session is partially corrupted:
263
+ - Conversation history usually recoverable
264
+ - File context often intact
265
+ - Background tasks may need restart
266
+
267
+ ### Auto-Cleanup
268
+
269
+ Claude Code automatically manages sessions:
270
+ - Old sessions pruned after time limit
271
+ - Configurable retention period
272
+ - Automatic compression for large sessions
273
+
274
+ ## Troubleshooting
275
+
276
+ ### Issue: Background task not found after resume
277
+
278
+ ```bash
279
+ # Check if process still exists
280
+ ps aux | grep <command>
281
+
282
+ # If process died, restart it
283
+ "Restart the dev server that was in bash_3"
284
+ ```
285
+
286
+ ### Issue: Session won't resume
287
+
288
+ ```bash
289
+ # Try continue instead
290
+ claude --continue
291
+
292
+ # List recent sessions
293
+ claude --resume # Interactive selection
294
+
295
+ # Start fresh if needed
296
+ claude # New session
297
+ ```
298
+
299
+ ### Issue: Permissions not remembered
300
+
301
+ ```bash
302
+ # Permissions may expire for security
303
+ # Simply re-approve when prompted
304
+ # Or use --dangerously-skip-permissions for development
305
+ ```
306
+
307
+ ## Verification Tests
308
+
309
+ The following features have been tested and verified:
310
+
311
+ ✅ **Background Task Persistence**
312
+ - Started `python3 -m http.server 8080` as bash_3
313
+ - Session continued, server still running
314
+ - Process verified with `ps aux`
315
+
316
+ ✅ **Shell ID Preservation**
317
+ - Background task IDs (bash_1, bash_2, etc.) maintained
318
+ - Can reference same IDs after resume
319
+
320
+ ✅ **Incremental Output**
321
+ - BashOutput only returns new output since last check
322
+ - Position markers maintained across sessions
323
+
324
+ ✅ **File Context Memory**
325
+ - Files created/edited in session remembered
326
+ - No need to re-read files after resume
327
+
328
+ ✅ **Multiple Background Tasks**
329
+ - Can run multiple background processes
330
+ - All tracked independently
331
+ - Each maintains its own state
332
+
333
+ ## Related Documentation
334
+
335
+ - [Background Commands Guide](./background-commands.md)
336
+ - [Claude Code CLI Reference](https://docs.anthropic.com/claude-code/cli)
337
+ - [MCP Tools Documentation](./mcp-tools.md)
338
+
339
+ ---
340
+
341
+ *Last updated: August 2025*
342
+ *Verified with Claude Code latest version*