hawkeye-ai 0.1.13 → 0.2.0

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 (77) hide show
  1. package/README.md +302 -109
  2. package/dashboard/assets/index-Ci4a7w1H.css +1 -0
  3. package/dashboard/assets/index-CjUuFl4a.js +137 -0
  4. package/dashboard/index.html +2 -2
  5. package/dist/commands/agent-command.d.ts +12 -0
  6. package/dist/commands/agent-command.d.ts.map +1 -0
  7. package/dist/commands/agent-command.js +44 -0
  8. package/dist/commands/agent-command.js.map +1 -0
  9. package/dist/commands/analyze.d.ts +7 -0
  10. package/dist/commands/analyze.d.ts.map +1 -0
  11. package/dist/commands/analyze.js +207 -0
  12. package/dist/commands/analyze.js.map +1 -0
  13. package/dist/commands/autocorrect.d.ts +13 -0
  14. package/dist/commands/autocorrect.d.ts.map +1 -0
  15. package/dist/commands/autocorrect.js +173 -0
  16. package/dist/commands/autocorrect.js.map +1 -0
  17. package/dist/commands/codex-session.d.ts +27 -0
  18. package/dist/commands/codex-session.d.ts.map +1 -0
  19. package/dist/commands/codex-session.js +227 -0
  20. package/dist/commands/codex-session.js.map +1 -0
  21. package/dist/commands/daemon.d.ts +2 -0
  22. package/dist/commands/daemon.d.ts.map +1 -1
  23. package/dist/commands/daemon.js +14 -15
  24. package/dist/commands/daemon.js.map +1 -1
  25. package/dist/commands/hook-handler.d.ts.map +1 -1
  26. package/dist/commands/hook-handler.js +153 -1
  27. package/dist/commands/hook-handler.js.map +1 -1
  28. package/dist/commands/hooks.d.ts +1 -1
  29. package/dist/commands/hooks.d.ts.map +1 -1
  30. package/dist/commands/hooks.js +6 -5
  31. package/dist/commands/hooks.js.map +1 -1
  32. package/dist/commands/inspect.d.ts.map +1 -1
  33. package/dist/commands/inspect.js +11 -25
  34. package/dist/commands/inspect.js.map +1 -1
  35. package/dist/commands/memory.d.ts +9 -0
  36. package/dist/commands/memory.d.ts.map +1 -0
  37. package/dist/commands/memory.js +371 -0
  38. package/dist/commands/memory.js.map +1 -0
  39. package/dist/commands/policy.d.ts +2 -2
  40. package/dist/commands/policy.d.ts.map +1 -1
  41. package/dist/commands/policy.js +4 -2
  42. package/dist/commands/policy.js.map +1 -1
  43. package/dist/commands/record.d.ts.map +1 -1
  44. package/dist/commands/record.js +21 -0
  45. package/dist/commands/record.js.map +1 -1
  46. package/dist/commands/replay.d.ts.map +1 -1
  47. package/dist/commands/replay.js +11 -21
  48. package/dist/commands/replay.js.map +1 -1
  49. package/dist/commands/serve.d.ts.map +1 -1
  50. package/dist/commands/serve.js +1107 -6
  51. package/dist/commands/serve.js.map +1 -1
  52. package/dist/commands/stats.d.ts.map +1 -1
  53. package/dist/commands/stats.js +11 -26
  54. package/dist/commands/stats.js.map +1 -1
  55. package/dist/commands/storage-helpers.d.ts +16 -0
  56. package/dist/commands/storage-helpers.d.ts.map +1 -0
  57. package/dist/commands/storage-helpers.js +49 -0
  58. package/dist/commands/storage-helpers.js.map +1 -0
  59. package/dist/commands/swarm.d.ts +19 -0
  60. package/dist/commands/swarm.d.ts.map +1 -0
  61. package/dist/commands/swarm.js +906 -0
  62. package/dist/commands/swarm.js.map +1 -0
  63. package/dist/config.d.ts +16 -0
  64. package/dist/config.d.ts.map +1 -1
  65. package/dist/config.js +6 -0
  66. package/dist/config.js.map +1 -1
  67. package/dist/index.js +55 -36
  68. package/dist/index.js.map +1 -1
  69. package/dist/interactive.d.ts.map +1 -1
  70. package/dist/interactive.js +766 -9
  71. package/dist/interactive.js.map +1 -1
  72. package/dist/mcp/server.d.ts.map +1 -1
  73. package/dist/mcp/server.js +373 -2
  74. package/dist/mcp/server.js.map +1 -1
  75. package/package.json +12 -3
  76. package/dashboard/assets/index-CWdSsUCp.css +0 -1
  77. package/dashboard/assets/index-Dp6WbW-l.js +0 -137
package/README.md CHANGED
@@ -30,17 +30,24 @@
30
30
  Hawkeye is a **flight recorder** for AI agents. It captures every action an agent performs — terminal commands, file operations, LLM calls, API requests — and provides:
31
31
 
32
32
  - **Session recording & replay** — Full timeline of every agent action with costs and metadata
33
+ - **Time Travel Debugging** — Step-through replay with breakpoints, keyboard shortcuts, interactive SVG timeline, session forking ("replay from here")
34
+ - **Root Cause Analysis** — Automatic `hawkeye analyze` finds primary errors, causal chains, error patterns, and fix suggestions (heuristic + optional LLM)
33
35
  - **DriftDetect** — Real-time objective drift detection using heuristic + LLM scoring
34
- - **Guardrails** — File protection, command blocking, cost limits, token limits, directory scoping
36
+ - **Guardrails** — File protection, command blocking, cost limits, token limits, directory scoping, network lock, review gates
35
37
  - **Impact Preview** — Pre-execution risk analysis for every agent action (low/medium/high/critical)
36
38
  - **Live Firewall** — Real-time action stream with browser push notifications and badge counter
37
39
  - **Policy Engine** — Declarative `.hawkeye/policies.yml` for shareable, team-wide security rules
38
- - **Visual dashboard** — Mobile-responsive web UI with session explorer, drift charts, firewall, and settings management
40
+ - **Autonomous Control Layer** — Autocorrect engine that auto-rolls back files, pauses sessions, blocks failing patterns, and injects correction hints to agents via MCP
41
+ - **Memory Diff** — Cross-session agent memory tracking, hallucination detection, cumulative knowledge view
42
+ - **Live Agent Spawning** — Spawn, monitor, and control AI agents directly from the dashboard with role assignment, permission levels, and real-time session linking
43
+ - **Multi-agent Orchestration (Swarm)** — Coordinate multiple AI agents on parallel tasks with isolated worktrees, scope enforcement, dependency ordering, conflict detection, and merge strategies
44
+ - **Visual dashboard** — Mobile-responsive web UI with session explorer, drift charts, firewall, agents control room, memory viewer, and settings management
39
45
  - **Remote tasks** — Submit prompts from your phone via dashboard, with image attachments, auto-approve, and persistent agent memory
40
46
  - **Interactive TUI** — Terminal-responsive CLI with arrow-key navigation and slash commands
41
47
  - **OpenTelemetry export** — Push traces to Grafana Tempo, Jaeger, Datadog, Honeycomb
42
48
  - **Universal ingestion API** — Accept events from any source (MCP servers, custom tools)
43
- - **Multi-agent support** — Claude Code (hooks), Aider, Open Interpreter, AutoGPT, CrewAI, or any custom command
49
+ - **MCP server** — 38 tools for agent self-awareness, intelligence, and cross-session analysis
50
+ - **Multi-agent support** — Claude Code (hooks), Aider, Open Interpreter, AutoGPT, CrewAI, Codex, or any custom command
44
51
 
45
52
  ## Installation
46
53
 
@@ -149,77 +156,77 @@ Launch the interactive mode by running `hawkeye` with no subcommand:
149
156
 
150
157
  Type `/` to open the command picker with arrow-key navigation and live filtering:
151
158
 
152
- | Command | Description |
153
- | -------------- | ---------------------------------------------- |
154
- | `/new` | New session — pick agent, model, objective |
155
- | `/sessions` | List & manage recorded sessions |
156
- | `/active` | Show current recording |
157
- | `/stats` | Session statistics |
158
- | `/end` | End active sessions |
159
- | `/restart` | Restart a session (with picker) |
160
- | `/delete` | Delete a session |
161
- | `/tasks` | List, create, clear remote tasks |
162
- | `/tasks journal` | View agent memory (task history) |
163
- | `/firewall` | View recent interceptions and blocked actions |
164
- | `/policy` | Manage declarative security policies |
165
- | `/arena` | Agent Arena — pit agents against each other |
166
- | `/overnight` | Run overnight mode (guardrails + morning report)|
167
- | `/report` | Generate morning report of recent sessions |
168
- | `/remote` | Launch serve + daemon + Cloudflare tunnel |
169
- | `/remote stop` | Stop tunnel + daemon |
170
- | `/settings` | Configure DriftDetect, Guardrails, API keys |
171
- | `/serve` | Open the web dashboard |
172
- | `/mcp` | Show MCP server setup instructions |
173
- | `/revert` | Revert file changes from a session |
174
- | `/init` | Initialize Hawkeye |
175
- | `/clear` | Clear screen |
176
- | `/quit` | Exit |
159
+ | Command | Description |
160
+ | ---------------- | ------------------------------------------------ |
161
+ | `/active` | Show current recording |
162
+ | `/analyze` | Root cause analysis find why a session failed |
163
+ | `/approve` | Approve pending review gate actions |
164
+ | `/attach` | Launch agent on active session |
165
+ | `/autocorrect` | Autonomous control — auto-correct agent behavior |
166
+ | `/clear` | Clear screen |
167
+ | `/compare` | Compare sessions side by side |
168
+ | `/delete` | Delete a session |
169
+ | `/end` | End active sessions |
170
+ | `/export` | Export session as JSON |
171
+ | `/firewall` | Show recent interceptions & impact previews |
172
+ | `/init` | Initialize Hawkeye |
173
+ | `/inspect` | Detailed session inspection |
174
+ | `/kill` | Kill hawkeye background processes |
175
+ | `/mcp` | Show MCP server setup instructions |
176
+ | `/memory` | Memory diff agent memory across sessions |
177
+ | `/new` | New session (pick agent + objective) |
178
+ | `/overnight` | Run overnight mode (guardrails + morning report) |
179
+ | `/policy` | Manage security policies (init/check/show) |
180
+ | `/purge` | Delete ALL sessions (including old) |
181
+ | `/quit` | Exit |
182
+ | `/remote` | Launch serve + daemon + Cloudflare tunnel |
183
+ | `/remote stop` | Stop tunnel + daemon |
184
+ | `/replay` | Replay a session (interactive) |
185
+ | `/report` | Generate morning report |
186
+ | `/restart` | Restart a session |
187
+ | `/revert` | Revert file changes from a session |
188
+ | `/serve` | Open dashboard on :4242 |
189
+ | `/sessions` | List & manage sessions |
190
+ | `/settings` | Configure DriftDetect, Guardrails, API keys |
191
+ | `/stats` | Session or global statistics |
192
+ | `/swarm` | Multi-agent orchestration — list/show/init swarms |
193
+ | `/tasks` | List & submit remote tasks |
194
+ | `/watch` | Live event stream (tail -f style) |
177
195
 
178
196
  ## CLI Commands
179
197
 
180
- ### `hawkeye init`
181
-
182
- Initialize Hawkeye in the current directory. Creates `.hawkeye/` directory and config files.
183
-
184
- ### `hawkeye record`
198
+ ### `hawkeye analyze <session-id>`
185
199
 
186
200
  ```bash
187
- hawkeye record -o <objective> [options] -- <command...>
201
+ hawkeye analyze <session-id> # Heuristic root cause analysis
202
+ hawkeye analyze <session-id> --llm # Enhanced with LLM analysis
203
+ hawkeye analyze <session-id> --json # Machine-readable output
188
204
  ```
189
205
 
190
- | Option | Description |
191
- | ----------------- | --------------------------------------- |
192
- | `-o, --objective` | Session objective **(required)** |
193
- | `-a, --agent` | Agent name (auto-detected from command) |
194
- | `-m, --model` | Model name |
195
- | `--no-drift` | Disable DriftDetect |
196
- | `--no-guardrails` | Disable guardrails |
197
-
198
- ### `hawkeye sessions`
206
+ Automatic root cause analysis: identifies the primary error, builds the causal chain, detects error patterns, analyzes drift trajectory, and generates fix suggestions.
199
207
 
200
- ```bash
201
- hawkeye sessions [-n 10] [-s recording|completed|aborted]
202
- ```
208
+ ### `hawkeye approve`
203
209
 
204
- ### `hawkeye stats <session-id>`
210
+ Approve pending review gate actions from the CLI.
205
211
 
206
- Display statistics for a session (accepts ID prefix).
207
-
208
- ### `hawkeye replay <session-id>`
212
+ ### `hawkeye autocorrect`
209
213
 
210
214
  ```bash
211
- hawkeye replay <session-id> [--speed 2] [--no-delay]
215
+ hawkeye autocorrect enable [--dry-run] # Enable autonomous correction
216
+ hawkeye autocorrect disable # Disable autocorrect
217
+ hawkeye autocorrect status # Show current status and config
218
+ hawkeye autocorrect history # View past corrections
212
219
  ```
213
220
 
214
- Replay a session action-by-action with timing.
221
+ Autonomous control layer — Hawkeye doesn't just observe, it autonomously corrects agent behavior when drift, errors, or cost issues are detected. Actions include file rollback, session pause, hint injection to MCP-aware agents, and pattern blocking.
215
222
 
216
- ### `hawkeye serve`
223
+ ### `hawkeye compare <id1> <id2>`
217
224
 
218
225
  ```bash
219
- hawkeye serve [-p 4242]
226
+ hawkeye compare <session1> <session2>
220
227
  ```
221
228
 
222
- Launch the web dashboard on `http://localhost:4242`. Auto-reloads after `pnpm build` watches `dist/` and restarts the server when compiled files change.
229
+ Compare two sessions side by side stats, drift, cost, tokens, and actions.
223
230
 
224
231
  ### `hawkeye daemon`
225
232
 
@@ -234,29 +241,61 @@ Run the task daemon — polls `.hawkeye/tasks.json` for pending tasks and execut
234
241
  - **Context injection**: enriches prompts with git status, recent commits, and task history
235
242
  - Works with any agent CLI, not just Claude
236
243
 
237
- ### `hawkeye arena`
244
+ ### `hawkeye end`
245
+
246
+ ```bash
247
+ hawkeye end [-s <session-id>] [--all] [--status completed|aborted]
248
+ ```
249
+
250
+ ### `hawkeye export`
238
251
 
239
252
  ```bash
240
- hawkeye arena -t "Add user auth with JWT" -a claude,aider
241
- hawkeye arena -t "Fix lint errors" -a claude,codex --test "npm test"
242
- hawkeye arena --list
253
+ hawkeye export <session-id> [-f json|html] [-o report.html]
243
254
  ```
244
255
 
245
- Agent Arena — pit multiple AI agents against the same task in isolated git worktrees:
256
+ ### `hawkeye hooks`
246
257
 
247
- - Each agent gets its own branch and worktree (no conflicts)
248
- - All agents run in parallel with live terminal progress
249
- - Optional test validation (`--test "npm test"`)
250
- - Composite scoring: tests (50pts), speed (20pts), efficiency (15pts), focus (10pts), completion (5pts)
251
- - Results saved and viewable in the dashboard at `/arena`
258
+ ```bash
259
+ hawkeye hooks install [--local] [--guardrails-only]
260
+ hawkeye hooks uninstall [--local]
261
+ hawkeye hooks status
262
+ ```
252
263
 
253
- | Option | Description | Default |
254
- | -------------- | ------------------------------------------ | -------- |
255
- | `-t, --task` | The task for agents to complete | required |
256
- | `-a, --agents` | Comma-separated agent list | required |
257
- | `--test` | Test command to validate results | |
258
- | `--timeout` | Timeout per agent in seconds | `1800` |
259
- | `--list` | List past arena results | |
264
+ ### `hawkeye init`
265
+
266
+ Initialize Hawkeye in the current directory. Creates `.hawkeye/` directory and config files.
267
+
268
+ ### `hawkeye inspect <session-id>`
269
+
270
+ Detailed session inspection shows events, cost per file, drift snapshots, and guardrail violations.
271
+
272
+ ### `hawkeye mcp`
273
+
274
+ Start the MCP (Model Context Protocol) server over stdio. Agents connect automatically.
275
+
276
+ ```bash
277
+ hawkeye mcp [--db <path>]
278
+ ```
279
+
280
+ ### `hawkeye memory`
281
+
282
+ ```bash
283
+ hawkeye memory [session] # Extract memories from a session
284
+ hawkeye memory diff <s1> <s2> # Compare what agent remembers between sessions
285
+ hawkeye memory cumulative # Aggregate knowledge across all sessions
286
+ hawkeye memory hallucinations # Detect contradictions and recurring errors
287
+ ```
288
+
289
+ Cross-session agent memory tracking. Extracts structured knowledge (file patterns, error lessons, tool patterns, decisions) from session events, compares what agents learned/forgot across sessions, and detects hallucinations.
290
+
291
+ ### `hawkeye otel-export`
292
+
293
+ ```bash
294
+ hawkeye otel-export <session-id> [-o traces.json]
295
+ hawkeye otel-export <session-id> --endpoint https://tempo.example.com/v1/traces
296
+ ```
297
+
298
+ Export as OTLP JSON traces. Compatible with Grafana Tempo, Jaeger, Datadog, Honeycomb.
260
299
 
261
300
  ### `hawkeye overnight`
262
301
 
@@ -281,21 +320,6 @@ Run overnight mode — composes serve + daemon with strict guardrails for unatte
281
320
  | `--port` | Dashboard port | `4242` |
282
321
  | `--report-llm` | Run LLM post-mortem per session on shutdown| |
283
322
 
284
- ### `hawkeye report`
285
-
286
- ```bash
287
- hawkeye report [--since <iso>] [--json] [--llm] [--webhook]
288
- ```
289
-
290
- Generate a morning report of recent sessions. Aggregates stats, drift, errors, and cost per session.
291
-
292
- | Option | Description | Default |
293
- | ----------- | -------------------------------------------------------------- | ------------------------------------ |
294
- | `--since` | Report on sessions since this ISO timestamp | `overnight.json` startedAt or 8h ago |
295
- | `--json` | Output as JSON | |
296
- | `--llm` | Include LLM-powered post-mortem per session | |
297
- | `--webhook` | Fire `overnight_report` webhook with the report | |
298
-
299
323
  ### `hawkeye policy`
300
324
 
301
325
  ```bash
@@ -308,18 +332,43 @@ hawkeye policy import <file> # Import a policies.yml
308
332
 
309
333
  Declarative security policies in `.hawkeye/policies.yml` — shareable across projects and teams. The hook-handler automatically loads and merges policy rules with config.json guardrails.
310
334
 
311
- ### `hawkeye export`
335
+ ### `hawkeye record`
312
336
 
313
337
  ```bash
314
- hawkeye export <session-id> [-f json|html] [-o report.html]
338
+ hawkeye record -o <objective> [options] -- <command...>
315
339
  ```
316
340
 
317
- ### `hawkeye end`
341
+ | Option | Description |
342
+ | ----------------- | --------------------------------------- |
343
+ | `-o, --objective` | Session objective **(required)** |
344
+ | `-a, --agent` | Agent name (auto-detected from command) |
345
+ | `-m, --model` | Model name |
346
+ | `--no-drift` | Disable DriftDetect |
347
+ | `--no-guardrails` | Disable guardrails |
348
+
349
+ ### `hawkeye replay <session-id>`
318
350
 
319
351
  ```bash
320
- hawkeye end [-s <session-id>] [--all] [--status completed|aborted]
352
+ hawkeye replay <session-id> [--speed 2] [--no-delay]
321
353
  ```
322
354
 
355
+ Replay a session action-by-action with timing.
356
+
357
+ ### `hawkeye report`
358
+
359
+ ```bash
360
+ hawkeye report [--since <iso>] [--json] [--llm] [--webhook]
361
+ ```
362
+
363
+ Generate a morning report of recent sessions. Aggregates stats, drift, errors, and cost per session.
364
+
365
+ | Option | Description | Default |
366
+ | ----------- | -------------------------------------------------------------- | ------------------------------------ |
367
+ | `--since` | Report on sessions since this ISO timestamp | `overnight.json` startedAt or 8h ago |
368
+ | `--json` | Output as JSON | |
369
+ | `--llm` | Include LLM-powered post-mortem per session | |
370
+ | `--webhook` | Fire `overnight_report` webhook with the report | |
371
+
323
372
  ### `hawkeye restart`
324
373
 
325
374
  ```bash
@@ -328,31 +377,42 @@ hawkeye restart [session-id] [-o <objective>] [-a <agent>] [-m <model>]
328
377
 
329
378
  Restart a session — inherits objective, agent, and model from the original if not overridden. Interactive picker when no ID is given.
330
379
 
331
- ### `hawkeye otel-export`
380
+ ### `hawkeye revert`
332
381
 
333
382
  ```bash
334
- hawkeye otel-export <session-id> [-o traces.json]
335
- hawkeye otel-export <session-id> --endpoint https://tempo.example.com/v1/traces
383
+ hawkeye revert <session-id> <file-path>
336
384
  ```
337
385
 
338
- Export as OTLP JSON traces. Compatible with Grafana Tempo, Jaeger, Datadog, Honeycomb.
386
+ Revert a file to its pre-session state using git.
339
387
 
340
- ### `hawkeye hooks`
388
+ ### `hawkeye serve`
341
389
 
342
390
  ```bash
343
- hawkeye hooks install [--local] [--guardrails-only]
344
- hawkeye hooks uninstall [--local]
345
- hawkeye hooks status
391
+ hawkeye serve [-p 4242]
346
392
  ```
347
393
 
348
- ### `hawkeye mcp`
394
+ Launch the web dashboard on `http://localhost:4242`. Auto-reloads after `pnpm build` — watches `dist/` and restarts the server when compiled files change.
349
395
 
350
- Start the MCP (Model Context Protocol) server over stdio. Agents connect automatically.
396
+ ### `hawkeye sessions`
351
397
 
352
398
  ```bash
353
- hawkeye mcp [--db <path>]
399
+ hawkeye sessions [-n 10] [-s recording|completed|aborted]
354
400
  ```
355
401
 
402
+ ### `hawkeye stats <session-id>`
403
+
404
+ Display statistics for a session (accepts ID prefix).
405
+
406
+ ### `hawkeye swarm`
407
+
408
+ ```bash
409
+ hawkeye swarm <config.json> # Run multi-agent orchestration from config
410
+ hawkeye swarm init # Generate a template swarm config
411
+ hawkeye swarm list # List past swarm runs
412
+ ```
413
+
414
+ Coordinate multiple AI agents on parallel tasks. Each agent gets an isolated git worktree with enforced scope boundaries. Features dependency ordering (topological sort), file conflict detection, sequential/octopus merge strategies, and live terminal progress.
415
+
356
416
  Add to `.mcp.json` at project root for Claude Code:
357
417
 
358
418
  ```json
@@ -366,15 +426,16 @@ Add to `.mcp.json` at project root for Claude Code:
366
426
  }
367
427
  ```
368
428
 
369
- **27 tools** for agent self-awareness:
429
+ **38 tools** for agent self-awareness, intelligence, and control:
370
430
 
371
431
  | Category | Tools |
372
432
  |----------|-------|
373
433
  | **Observability** (9) | `list_sessions`, `get_session`, `get_session_events`, `get_session_drift`, `get_session_stats`, `get_global_stats`, `compare_sessions`, `get_violations`, `get_cost_by_file` |
374
434
  | **Self-awareness** (8) | `check_drift`, `get_objective`, `check_cost`, `check_guardrail`, `check_progress`, `log_event`, `list_changes`, `get_config` |
375
- | **Intelligence** (4) | `get_session_timeline`, `get_error_summary`, `suggest_correction`, `post_mortem` |
376
- | **Actions** (4) | `end_session`, `pause_session`, `resume_session`, `set_objective` |
435
+ | **Intelligence** (8) | `get_session_timeline`, `get_error_summary`, `suggest_correction`, `analyze_root_cause`, `post_mortem`, `memory_diff`, `check_memory`, `auto_correct` |
436
+ | **Actions** (5) | `end_session`, `pause_session`, `resume_session`, `set_objective`, `get_correction` |
377
437
  | **Cross-session** (2) | `search_events`, `revert_file` |
438
+ | **Swarm** (3) | `list_swarms`, `get_swarm`, `get_swarm_agent` |
378
439
 
379
440
  ## Dashboard
380
441
 
@@ -389,9 +450,10 @@ The web dashboard (`hawkeye serve`) is fully **mobile responsive** and provides:
389
450
 
390
451
  ### Session Detail Page
391
452
 
453
+ - **Time Travel Debugger** — Interactive SVG timeline with step-through, breakpoints, keyboard shortcuts, and session forking
392
454
  - **Drift score chart** — Line chart with warning/critical reference zones
393
455
  - **Event timeline** — Filterable, searchable list with type badges (CMD, FILE, LLM, GUARD, etc.)
394
- - **Expandable details** — Full event payload for each action
456
+ - **Expandable details** — Full event payload for each action, auto-expands during step-through
395
457
  - **Live mode** — Auto-refreshes every 3 seconds for active sessions
396
458
  - **Export** — Download session as JSON
397
459
 
@@ -404,11 +466,32 @@ The web dashboard (`hawkeye serve`) is fully **mobile responsive** and provides:
404
466
  - **Agent memory** — View/clear the persistent task journal
405
467
  - Status tracking: pending, running, completed, failed
406
468
 
469
+ ### Agents Control Room
470
+
471
+ - **Spawn agents** directly from the dashboard — choose agent CLI (claude, aider, codex), assign role (lead/worker/reviewer), set permissions (full access/supervised/default), add personality
472
+ - **Live monitoring** — Real-time output streaming, session linking with drift/cost/action stats, follow-up messages
473
+ - **Permission levels** — Full access (skip confirmation prompts), supervised (Hawkeye guardrails enforce limits), default (agent runtime defaults)
474
+ - **Persistent agents** — Agents survive server restarts via file-backed persistence (`.hawkeye/agents.json`)
475
+ - **Session integration** — Each spawned agent is automatically linked to its Hawkeye session for full observability
476
+
407
477
  ### Compare Page
408
478
 
409
479
  - Select two sessions to compare side by side
410
480
  - Stats comparison (actions, cost, tokens, drift)
411
481
 
482
+ ### Memory Page
483
+
484
+ - **Cumulative Memory** — Aggregate knowledge across all sessions (file patterns, error lessons, tool patterns, decisions)
485
+ - **Memory Diff** — Compare what an agent remembered between two sessions (learned, forgotten, retained, evolved, contradicted)
486
+ - **Hallucination Detection** — Cross-session analysis for recurring errors and contradicted facts
487
+
488
+ ### Swarm Page
489
+
490
+ - List and detail view of multi-agent orchestration runs
491
+ - Agent cards with scope display, files changed, merge status
492
+ - Conflict visualization between agents
493
+ - Real-time WebSocket updates during execution
494
+
412
495
  ### Firewall Page
413
496
 
414
497
  - **Live action stream** — Every agent action in real-time with risk classification
@@ -435,6 +518,8 @@ The web dashboard (`hawkeye serve`) is fully **mobile responsive** and provides:
435
518
  | `/api/sessions/:id/end` | POST | End a session |
436
519
  | `/api/sessions/:id/pause` | POST | Pause a session |
437
520
  | `/api/sessions/:id/resume` | POST | Resume a paused session |
521
+ | `/api/sessions/:id/fork` | POST | Fork session up to event N |
522
+ | `/api/sessions/:id/analyze` | GET | Root cause analysis |
438
523
  | `/api/compare?ids=id1,id2` | GET | Compare sessions side by side |
439
524
  | `/api/stats` | GET | Global statistics |
440
525
  | `/api/settings` | GET | Get configuration |
@@ -448,8 +533,6 @@ The web dashboard (`hawkeye serve`) is fully **mobile responsive** and provides:
448
533
  | `/api/tasks/journal` | GET | Read agent memory journal |
449
534
  | `/api/tasks/journal/clear` | POST | Clear agent memory |
450
535
  | `/api/tasks/attachments/:file` | GET | Serve task image attachments |
451
- | `/api/arenas` | GET | List arena results |
452
- | `/api/arenas/:id` | GET | Get arena details & leaderboard |
453
536
  | `/api/pending-reviews` | GET | List pending review gate items |
454
537
  | `/api/review-approve` | POST | Approve a review gate item |
455
538
  | `/api/review-deny` | POST | Deny a review gate item |
@@ -457,6 +540,25 @@ The web dashboard (`hawkeye serve`) is fully **mobile responsive** and provides:
457
540
  | `/api/policies` | POST | Save policies (server-validated) |
458
541
  | `/api/impact` | GET | Last impact preview |
459
542
  | `/api/interceptions` | GET | Recent blocks + pending reviews |
543
+ | `/api/sessions/:id/memory` | GET | Session memory items |
544
+ | `/api/sessions/:id/corrections` | GET | Session autocorrect history |
545
+ | `/api/memory/diff?a=X&b=Y` | GET | Memory diff between sessions |
546
+ | `/api/memory/cumulative` | GET | Cumulative memory across sessions|
547
+ | `/api/memory/hallucinations` | GET | Cross-session hallucination check|
548
+ | `/api/corrections` | GET | All corrections across sessions |
549
+ | `/api/active-correction` | GET | Current active correction hint |
550
+ | `/api/autocorrect` | POST | Trigger/configure autocorrect |
551
+ | `/api/agents` | GET | List live agents |
552
+ | `/api/agents/spawn` | POST | Spawn a new agent |
553
+ | `/api/agents/:id` | GET | Get agent details |
554
+ | `/api/agents/:id/stop` | POST | Stop a running agent |
555
+ | `/api/agents/:id/remove` | POST | Remove an agent |
556
+ | `/api/agents/:id/message` | POST | Send follow-up message to agent |
557
+ | `/api/agents/:id/events` | GET | Get agent's session events |
558
+ | `/api/swarms` | GET | List swarm runs |
559
+ | `/api/swarms/:id` | GET | Swarm details |
560
+ | `/api/swarms/:id/agents` | GET | Swarm agent details |
561
+ | `/api/swarms/:id/conflicts` | GET | Swarm file conflicts |
460
562
 
461
563
  ## DriftDetect
462
564
 
@@ -506,6 +608,52 @@ Guardrails are evaluated **synchronously before** events are persisted. Violatio
506
608
  | `review_gate` | Require human approval for commands | `patterns: string[]` (regex patterns) |
507
609
  | `impact_threshold`| Block actions above a risk level | `blockAbove`, `warnAbove` (low/medium/high/critical) |
508
610
 
611
+ ### Time Travel Debugging
612
+
613
+ The dashboard session replay is a full debugger for AI agent sessions:
614
+
615
+ - **Step-through controls** — Step forward/back one event at a time, play/pause with speed controls (1x–10x)
616
+ - **Breakpoints** — Click events on the interactive SVG timeline or press `B` to toggle breakpoints; playback pauses automatically at breakpoints
617
+ - **Interactive timeline** — Color-coded dots by event type, drift score overlay, right-click context menu
618
+ - **Session forking** — "Fork from here" creates a new session from any point in time, copying all events, drift snapshots, and guardrail violations up to that point
619
+ - **Keyboard shortcuts** — `←`/`→` step through, `Space` play/pause, `B` toggle breakpoint
620
+ - **Auto-expand** — Current event details expand automatically during step-through
621
+
622
+ ### Root Cause Analysis
623
+
624
+ After a session fails, run `hawkeye analyze <session>` (or click "Analyze" in the dashboard) to get:
625
+
626
+ - **Primary error** — The main failure event with context
627
+ - **Causal chain** — Backwards trace: which file edits and LLM decisions led to the error
628
+ - **Error patterns** — Repeated failures grouped and counted (e.g., "tsc failed 5x")
629
+ - **Drift analysis** — Score trend, inflection point, and what triggered the drift
630
+ - **Suggestions** — Actionable fix recommendations based on detected patterns
631
+ - **LLM enhancement** — Add `--llm` for deeper natural language analysis
632
+
633
+ ```
634
+ $ hawkeye analyze abc123
635
+
636
+ ─── Root Cause Analysis ─── session abc12345
637
+
638
+ FAILURE confidence: high
639
+
640
+ SUMMARY
641
+ Session failed due to repeated TypeScript compilation errors
642
+
643
+ PRIMARY ERROR (event #47)
644
+ tsc --noEmit → exit 1
645
+ at 14:23:05 — command
646
+
647
+ CAUSAL CHAIN
648
+ #12 ◇ LLM anthropic/claude-3.5-sonnet
649
+ #15 ● FILE Modified src/middleware.ts
650
+ #23 ○ CMD tsc --noEmit → exit 1
651
+
652
+ SUGGESTIONS
653
+ 1. TypeScript compilation failed 5 times — fix type errors
654
+ 2. Agent made multiple unsuccessful attempts
655
+ ```
656
+
509
657
  ### Impact Preview
510
658
 
511
659
  Every agent action is analyzed **before execution** via the Impact Preview engine:
@@ -540,6 +688,46 @@ rules:
540
688
 
541
689
  Manage via `hawkeye policy` CLI, dashboard Settings page, or direct YAML edit.
542
690
 
691
+ ### Autonomous Control Layer (Autocorrect)
692
+
693
+ Hawkeye doesn't just observe — it autonomously corrects agent behavior:
694
+
695
+ - **Triggers**: critical drift (< 30), declining drift trend, repeated error patterns (configurable, default 3x), cost exceeding budget threshold (85%)
696
+ - **Actions**: file rollback (`git checkout -- <file>`), session pause, hint injection to MCP-aware agents, dynamic pattern blocking, webhook notifications
697
+ - **Agent integration**: MCP-aware agents (Claude Code, Cursor) receive correction hints via `get_correction` tool with direct `agentInstructions`
698
+ - **Dry-run mode**: test corrections without executing them
699
+
700
+ ### Memory Diff
701
+
702
+ Cross-session agent memory tracking and hallucination detection:
703
+
704
+ - **7-phase extraction**: file knowledge, error lessons, corrections, tool patterns, decisions, dependency facts, API knowledge
705
+ - **Diff analysis**: learned (new), forgotten (lost), retained, evolved (updated), contradicted (conflicting)
706
+ - **Hallucination detection**: recurring errors across sessions, contradicted facts
707
+ - **Cumulative memory**: aggregated knowledge across all sessions with deduplication
708
+
709
+ ### Multi-agent Orchestration (Swarm)
710
+
711
+ Coordinate multiple AI agents on parallel tasks:
712
+
713
+ - **Isolated worktrees**: each agent gets its own git worktree — no conflicts during execution
714
+ - **Scope enforcement**: include/exclude glob patterns, enforced at prompt-level and validated post-execution
715
+ - **Dependency ordering**: topological sort (Kahn's algorithm) for task dependencies
716
+ - **Conflict detection**: file overlap detection between agents with severity scoring
717
+ - **Merge strategies**: sequential (least-conflict-first) or octopus
718
+ - **Config-driven**: JSON config files with agent personas, tasks, scopes, and timeouts
719
+
720
+ ### Live Agent Spawning
721
+
722
+ Spawn and control AI agents directly from the dashboard:
723
+
724
+ - **Role-based creation**: assign roles (lead/worker/reviewer) and custom personality
725
+ - **Permission levels**: full access (`--dangerously-skip-permissions`), supervised (Hawkeye guardrails), or default
726
+ - **Session linking**: automatic detection and linking to Hawkeye sessions for full observability
727
+ - **Live stats**: real-time drift score, cost, action count, and session info via WebSocket
728
+ - **Follow-up messages**: send additional prompts to running agents via stdin
729
+ - **Persistence**: agents survive server restarts via `.hawkeye/agents.json`
730
+
543
731
  Example configuration (via `/settings` in TUI or dashboard):
544
732
 
545
733
  ```json
@@ -644,7 +832,7 @@ For child processes, Hawkeye injects a preload ESM script via `NODE_OPTIONS="--i
644
832
 
645
833
  ### Storage
646
834
 
647
- SQLite via `better-sqlite3` with WAL mode. Four tables:
835
+ SQLite via `better-sqlite3` with WAL mode. Nine tables:
648
836
 
649
837
  | Table | Purpose |
650
838
  | ---------------------- | ------------------------------------------------------------- |
@@ -652,6 +840,11 @@ SQLite via `better-sqlite3` with WAL mode. Four tables:
652
840
  | `events` | Captured events (type, data, timestamps, token counts, costs) |
653
841
  | `drift_snapshots` | Drift score history per session |
654
842
  | `guardrail_violations` | Guardrail violation log |
843
+ | `memory_items` | Cross-session agent memory (knowledge, patterns, lessons) |
844
+ | `corrections` | Autocorrect actions (rollbacks, pauses, hints, blocks) |
845
+ | `swarms` | Swarm orchestration run metadata |
846
+ | `swarm_agents` | Per-agent state within swarm runs |
847
+ | `swarm_conflicts` | File conflicts detected between swarm agents |
655
848
 
656
849
  ## Development
657
850