mindforge-cc 1.0.5 → 2.0.0-alpha.6

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 (119) hide show
  1. package/.agent/CLAUDE.md +83 -0
  2. package/.agent/mindforge/auto.md +22 -0
  3. package/.agent/mindforge/browse.md +26 -0
  4. package/.agent/mindforge/costs.md +11 -0
  5. package/.agent/mindforge/cross-review.md +17 -0
  6. package/.agent/mindforge/dashboard.md +98 -0
  7. package/.agent/mindforge/execute-phase.md +5 -3
  8. package/.agent/mindforge/init-project.md +12 -0
  9. package/.agent/mindforge/qa.md +16 -0
  10. package/.agent/mindforge/remember.md +14 -0
  11. package/.agent/mindforge/research.md +11 -0
  12. package/.agent/mindforge/steer.md +13 -0
  13. package/.agent/workflows/publish-release.md +36 -0
  14. package/.claude/CLAUDE.md +83 -0
  15. package/.claude/commands/mindforge/auto.md +22 -0
  16. package/.claude/commands/mindforge/browse.md +26 -0
  17. package/.claude/commands/mindforge/costs.md +11 -0
  18. package/.claude/commands/mindforge/cross-review.md +17 -0
  19. package/.claude/commands/mindforge/dashboard.md +98 -0
  20. package/.claude/commands/mindforge/execute-phase.md +5 -3
  21. package/.claude/commands/mindforge/qa.md +16 -0
  22. package/.claude/commands/mindforge/remember.md +14 -0
  23. package/.claude/commands/mindforge/research.md +11 -0
  24. package/.claude/commands/mindforge/steer.md +13 -0
  25. package/.mindforge/MINDFORGE-V2-SCHEMA.json +47 -0
  26. package/.mindforge/browser/daemon-protocol.md +24 -0
  27. package/.mindforge/browser/qa-engine.md +16 -0
  28. package/.mindforge/browser/session-manager.md +18 -0
  29. package/.mindforge/browser/visual-verify-spec.md +31 -0
  30. package/.mindforge/dashboard/api-reference.md +122 -0
  31. package/.mindforge/dashboard/dashboard-spec.md +96 -0
  32. package/.mindforge/engine/autonomous/auto-executor.md +266 -0
  33. package/.mindforge/engine/autonomous/headless-adapter.md +66 -0
  34. package/.mindforge/engine/autonomous/node-repair.md +190 -0
  35. package/.mindforge/engine/autonomous/progress-reporter.md +58 -0
  36. package/.mindforge/engine/autonomous/steering-manager.md +64 -0
  37. package/.mindforge/engine/autonomous/stuck-detector.md +89 -0
  38. package/.mindforge/memory/MEMORY-SCHEMA.md +155 -0
  39. package/.mindforge/memory/decision-library.jsonl +0 -0
  40. package/.mindforge/memory/engine/capture-protocol.md +36 -0
  41. package/.mindforge/memory/engine/global-sync-spec.md +42 -0
  42. package/.mindforge/memory/engine/retrieval-spec.md +44 -0
  43. package/.mindforge/memory/knowledge-base.jsonl +7 -0
  44. package/.mindforge/memory/pattern-library.jsonl +1 -0
  45. package/.mindforge/memory/team-preferences.jsonl +4 -0
  46. package/.mindforge/models/model-registry.md +48 -0
  47. package/.mindforge/models/model-router.md +30 -0
  48. package/.mindforge/personas/research-agent.md +24 -0
  49. package/.planning/approvals/v2-architecture-approval.json +15 -0
  50. package/.planning/browser-daemon.log +32 -0
  51. package/.planning/decisions/ADR-021-autonomy-boundary.md +17 -0
  52. package/.planning/decisions/ADR-022-node-repair-hierarchy.md +19 -0
  53. package/.planning/decisions/ADR-023-gate-3-timing.md +15 -0
  54. package/CHANGELOG.md +81 -0
  55. package/MINDFORGE.md +26 -3
  56. package/README.md +70 -18
  57. package/bin/autonomous/auto-runner.js +95 -0
  58. package/bin/autonomous/headless.js +36 -0
  59. package/bin/autonomous/progress-stream.js +49 -0
  60. package/bin/autonomous/repair-operator.js +213 -0
  61. package/bin/autonomous/steer.js +71 -0
  62. package/bin/autonomous/stuck-monitor.js +77 -0
  63. package/bin/browser/browser-daemon.js +139 -0
  64. package/bin/browser/daemon-manager.js +91 -0
  65. package/bin/browser/qa-engine.js +47 -0
  66. package/bin/browser/qa-report-writer.js +32 -0
  67. package/bin/browser/regression-writer.js +27 -0
  68. package/bin/browser/screenshot-store.js +49 -0
  69. package/bin/browser/session-manager.js +93 -0
  70. package/bin/browser/visual-verify-executor.js +89 -0
  71. package/bin/change-classifier.js +86 -0
  72. package/bin/dashboard/api-router.js +198 -0
  73. package/bin/dashboard/approval-handler.js +134 -0
  74. package/bin/dashboard/frontend/index.html +511 -0
  75. package/bin/dashboard/metrics-aggregator.js +296 -0
  76. package/bin/dashboard/server.js +135 -0
  77. package/bin/dashboard/sse-bridge.js +178 -0
  78. package/bin/dashboard/team-tracker.js +0 -0
  79. package/bin/governance/approve.js +60 -0
  80. package/bin/install.js +4 -4
  81. package/bin/installer-core.js +91 -35
  82. package/bin/memory/cli.js +99 -0
  83. package/bin/memory/global-sync.js +107 -0
  84. package/bin/memory/knowledge-capture.js +278 -0
  85. package/bin/memory/knowledge-indexer.js +172 -0
  86. package/bin/memory/knowledge-store.js +319 -0
  87. package/bin/memory/session-memory-loader.js +137 -0
  88. package/bin/migrations/0.1.0-to-0.5.0.js +2 -3
  89. package/bin/migrations/0.5.0-to-0.6.0.js +1 -1
  90. package/bin/migrations/0.6.0-to-1.0.0.js +3 -3
  91. package/bin/migrations/migrate.js +15 -11
  92. package/bin/mindforge-cli.js +87 -0
  93. package/bin/models/anthropic-provider.js +77 -0
  94. package/bin/models/cost-tracker.js +118 -0
  95. package/bin/models/gemini-provider.js +79 -0
  96. package/bin/models/model-client.js +98 -0
  97. package/bin/models/model-router.js +111 -0
  98. package/bin/models/openai-provider.js +78 -0
  99. package/bin/research/research-engine.js +115 -0
  100. package/bin/review/cross-review-engine.js +81 -0
  101. package/bin/review/finding-synthesizer.js +116 -0
  102. package/bin/review/review-report-writer.js +49 -0
  103. package/bin/updater/self-update.js +13 -13
  104. package/bin/wizard/setup-wizard.js +5 -1
  105. package/docs/adr/ADR-024-browser-localhost-only.md +17 -0
  106. package/docs/adr/ADR-025-visual-verify-failure-treatment.md +19 -0
  107. package/docs/adr/ADR-026-session-persistence-security.md +20 -0
  108. package/docs/architecture/README.md +6 -2
  109. package/docs/ci-cd.md +92 -0
  110. package/docs/commands-reference.md +1 -0
  111. package/docs/feature-dashboard.md +52 -0
  112. package/docs/publishing-guide.md +43 -0
  113. package/docs/reference/commands.md +17 -2
  114. package/docs/reference/sdk-api.md +6 -1
  115. package/docs/testing-current-version.md +130 -0
  116. package/docs/user-guide.md +115 -9
  117. package/docs/usp-features.md +70 -8
  118. package/docs/workflow-atlas.md +57 -0
  119. package/package.json +7 -3
@@ -0,0 +1,98 @@
1
+ # MindForge v2 — Dashboard Command
2
+ # Usage: /mindforge:dashboard [--port 7339] [--open] [--stop] [--status]
3
+ # Version: v2.0.0-alpha.5
4
+
5
+ ## Purpose
6
+ Start the MindForge real-time web dashboard — a live observability UI for the
7
+ entire team. Shows execution progress, quality metrics, pending approvals,
8
+ knowledge graph, and team activity without requiring CLI access.
9
+
10
+ ## Design
11
+ The dashboard is a localhost-only web server:
12
+ - No build step — single HTML file, no bundler, no npm packages on client
13
+ - No authentication — binding to 127.0.0.1 is the security model
14
+ - Live updates via Server-Sent Events — no WebSocket library needed
15
+ - Designed for screensharing at standups, not external access
16
+
17
+ ## Usage
18
+
19
+ ### Start the dashboard
20
+ ```
21
+ /mindforge:dashboard
22
+ → Dashboard running at: http://localhost:7339
23
+ → Press CTRL+C to stop (or /mindforge:dashboard --stop)
24
+ ```
25
+
26
+ ### Start and open in browser
27
+ ```
28
+ /mindforge:dashboard --open
29
+ → Opens http://localhost:7339 in your default browser
30
+ ```
31
+
32
+ ### Custom port
33
+ ```
34
+ /mindforge:dashboard --port 7340
35
+ → Useful if 7339 is already in use
36
+ ```
37
+
38
+ ### Stop the dashboard
39
+ ```
40
+ /mindforge:dashboard --stop
41
+ → Finds the running dashboard process (from PID file) and sends SIGTERM
42
+ ```
43
+
44
+ ### Check dashboard status
45
+ ```
46
+ /mindforge:dashboard --status
47
+ → Checks if dashboard is running, shows port and PID
48
+ → Also shows: http://localhost:7339/api/status
49
+ ```
50
+
51
+ ## Dashboard pages
52
+
53
+ ### Activity (default)
54
+ - Phase name, auto mode status (RUNNING/PAUSED/ESCALATED/IDLE)
55
+ - Wave progress bar (tasks completed / total)
56
+ - Live AUDIT event feed with color-coded event types
57
+ - Steering input: send guidance to auto mode without touching the CLI
58
+
59
+ ### Quality Metrics
60
+ - Session quality score trend (last 20 sessions)
61
+ - Verify pass rate over time
62
+ - Security findings by severity (CRITICAL/HIGH/MEDIUM/LOW)
63
+ - Cost per session trend
64
+
65
+ ### Approvals
66
+ - All pending Tier 2/3 governance requests
67
+ - [Approve] and [Reject] buttons — no CLI needed for approval
68
+ - Tier, phase/plan, description, time since requested, expiry warning
69
+ - Recent approval history
70
+
71
+ ### Knowledge
72
+ - Search the knowledge graph from the browser
73
+ - Entries filtered by confidence, type, tags
74
+ - Color-coded by knowledge type
75
+
76
+ ### Team
77
+ - Active developers (by git email, from AUDIT.jsonl)
78
+ - What each person is working on (last task)
79
+ - File conflict warnings (two developers recently touching the same file)
80
+
81
+ ## Security rules
82
+ 1. Never expose the dashboard on 0.0.0.0 — localhost only
83
+ 2. Never forward the port externally (no ngrok, no port forwarding)
84
+ 3. For remote team visibility: screenshare your browser instead
85
+ 4. The dashboard shows project details including code patterns and decisions
86
+
87
+ ## Integration with auto mode
88
+ When `/mindforge:auto` is running and the dashboard is open:
89
+ - Activity feed updates live as tasks complete
90
+ - Wave progress bar advances in real-time
91
+ - Any escalations appear immediately with red indicator
92
+ - The Steering input is active — inject guidance without a second terminal
93
+
94
+ ## AUDIT entry
95
+ ```json
96
+ { "event": "dashboard_started", "port": 7339, "pid": 12345 }
97
+ { "event": "dashboard_stopped", "pid": 12345 }
98
+ ```
@@ -76,9 +76,11 @@ Write to console:
76
76
  For each plan in the wave:
77
77
  1. Load context package (per `context-injector.md`)
78
78
  2. Execute the plan instructions
79
- 3. Run `<verify>` — capture exact output
80
- 4. If verify PASSES:
81
- - Write SUMMARY-[N]-[M].md
79
+ - Run `<verify>` — capture exact output
80
+ - If verify PASSES:
81
+ - Run `<verify-visual>` via `visual-verify-executor.js`
82
+ - If visual verify FAILS: stop and report (treat as verify failure)
83
+ - Write SUMMARY-[N]-[M].md
82
84
  - Execute commit: `git add [files] && git commit -m "[type]([scope]): [task name]"`
83
85
  - Capture git SHA
84
86
  - Write AUDIT entry for task completion
@@ -0,0 +1,16 @@
1
+ # /mindforge:qa
2
+
3
+ ## Usage
4
+ `@mindforge qa [--phase N] [--auto]`
5
+
6
+ ## Description
7
+ Runs systematic visual QA on UI surfaces changed in the current phase.
8
+ Analyzes git diff to find pages, navigates to them, and looks for errors.
9
+
10
+ ## Options
11
+ - `--phase N`: Target specific phase for reporting (defaults to current).
12
+ - `--auto`: Automatically run after successful wave execution if configured.
13
+
14
+ ## Output
15
+ - `QA-REPORT-[N].md`: Found bugs with screenshots.
16
+ - `tests/regression/*.test.ts`: Playwright tests to prevent bug recurrence.
@@ -0,0 +1,14 @@
1
+ # /mindforge:remember
2
+
3
+ Manage the MindForge long-term memory (knowledge graph).
4
+
5
+ ## Usage
6
+
7
+ - `/mindforge:remember --add "Your knowledge content"`: Manually add an entry.
8
+ - `/mindforge:remember --search "your query"`: Search the knowledge base.
9
+ - `/mindforge:remember --stats`: View memory statistics.
10
+ - `/mindforge:remember --promote "id"`: Promote a project entry to global memory.
11
+
12
+ ## Description
13
+
14
+ MindForge capture, stores, and retrieves knowledge (architectural decisions, code patterns, team preferences) across all sessions and projects. This command allows for manual management and querying of this data.
@@ -0,0 +1,11 @@
1
+ # MindForge v2 — Research Command
2
+ # Usage: /mindforge:research [topic] [--type general|library|codebase|compliance] [--url URL]
3
+
4
+ ## Purpose
5
+ Deep research using Gemini 1.5 Pro's 1-million-token context window.
6
+ Incorporate local code context and remote documentation simultaneously.
7
+
8
+ ## Capabilities
9
+ - Ingest full library documentation.
10
+ - Codebase-wide architectural analysis.
11
+ - Regulatory compliance audits.
@@ -0,0 +1,13 @@
1
+ # /mindforge:steer "[instruction]"
2
+
3
+ **Purpose**: Injects mid-execution guidance into the running autonomous engine.
4
+ Steering guidance is applied at the next task boundary to course-correct the agent.
5
+
6
+ ## Usage
7
+ - `/mindforge:steer "Use the new logger in all created files"`
8
+ - `/mindforge:steer --task 3-05 "This plan is too broad, focus on login only"`
9
+ - `/mindforge:steer --cancel` (Clears the steering queue)
10
+
11
+ ## Precedence
12
+ - Steering instructions take precedence over the original `PLAN-N-MM.md` actions.
13
+ - Steering cannot override core security constraints or governance gates.
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "MindForge v2 Autonomous Engine Schema",
4
+ "description": "Schema for HANDOFF.json and auto-state.json in v2.0.0-alpha.1",
5
+ "type": "object",
6
+ "properties": {
7
+ "schema_version": { "type": "string", "const": "2.0.0" },
8
+ "auto_mode_active": { "type": "boolean" },
9
+ "phase": { "type": "integer" },
10
+ "wave_current": { "type": "integer" },
11
+ "tasks_completed": { "type": "integer" },
12
+ "PLANNER_MODEL": { "type": "string" },
13
+ "EXECUTOR_MODEL": { "type": "string" },
14
+ "REVIEWER_MODEL": { "type": "string" },
15
+ "SECURITY_MODEL": { "type": "string" },
16
+ "RESEARCH_MODEL": { "type": "string" },
17
+ "QA_MODEL": { "type": "string" },
18
+ "DEBUG_MODEL": { "type": "string" },
19
+ "QUICK_MODEL": { "type": "string" },
20
+ "MODEL_COST_WARN_USD": { "type": "number" },
21
+ "MODEL_COST_HARD_LIMIT_USD": { "type": "number" },
22
+ "MODEL_PREFER_CHEAP_BELOW_DIFFICULTY": { "type": "number" },
23
+ "REQUIRE_CROSS_REVIEW": { "type": "boolean" },
24
+ "status": {
25
+ "type": "string",
26
+ "enum": ["idle", "running", "paused", "completed", "escalated", "timeout"]
27
+ },
28
+ "governance": {
29
+ "type": "object",
30
+ "properties": {
31
+ "tier1_auto_approve": { "type": "boolean" },
32
+ "tier2_auto_approve": { "type": "boolean" },
33
+ "tier3_require_human": { "type": "boolean", "const": true }
34
+ }
35
+ },
36
+ "browser": {
37
+ "type": "object",
38
+ "properties": {
39
+ "port": { "type": "integer", "default": 7338 },
40
+ "headless": { "type": "boolean", "default": true },
41
+ "dev_server_url": { "type": "string" },
42
+ "auto_qa": { "type": "boolean", "default": true }
43
+ }
44
+ }
45
+ },
46
+ "required": ["schema_version", "auto_mode_active", "status"]
47
+ }
@@ -0,0 +1,24 @@
1
+ # MindForge v2 — Browser Daemon Protocol
2
+
3
+ ## Overview
4
+ Small, long-lived Node.js process that manages a Chromium instance via Playwright.
5
+
6
+ ## HTTP API (localhost:7338)
7
+
8
+ | Method | Path | Body | Response |
9
+ |---|---|---|---|
10
+ | GET | /status | - | { alive: bool, sessions: string[], uptime: sec } |
11
+ | POST | /navigate | { url, session, wait_for } | { success: bool, status_code: int, load_time_ms: int } |
12
+ | POST | /click | { selector, text, session } | { success: bool, element_found: bool } |
13
+ | POST | /type | { selector, text, session } | { success: bool } |
14
+ | POST | /screenshot | { session } | { success: bool, screenshot_b64: string } |
15
+ | POST | /evaluate | { script, session } | { success: bool, result: any } |
16
+ | POST | /assert | { type, selector, expected_text, session } | { passed: bool, actual_text: string, error: string } |
17
+ | POST | /session/save | { name } | { success: bool, path: string } |
18
+ | POST | /session/load | { name } | { success: bool, cookies: int } |
19
+ | DELETE | /session/:name | - | { success: bool } |
20
+
21
+ ## State Management
22
+ - Sessions are stored in `.mindforge/browser/sessions/` as JSON.
23
+ - Multiple named sessions can be active (different BrowserContexts).
24
+ - SIGTERM saves all active sessions if --save-on-exit is passed.
@@ -0,0 +1,16 @@
1
+ # MindForge v2 — QA Engine
2
+
3
+ ## Purpose
4
+ Systematic post-phase visual QA.
5
+ Analyzes git diff, extracts UI surfaces (pages, routes), and runs tests.
6
+
7
+ ## Test Strategy
8
+ For each page found:
9
+ 1. Load page -> check for JS errors.
10
+ 2. Verify main content visibility.
11
+ 3. Test authentication redirects.
12
+ 4. Document any rendering or logic bugs.
13
+
14
+ ## Outputs
15
+ - `QA-REPORT-[N].md`: Detailed phase report.
16
+ - `tests/regression/*.test.ts`: Playwright tests for every bug found.
@@ -0,0 +1,18 @@
1
+ # MindForge v2 — Browser Session Manager
2
+
3
+ ## Principles
4
+ 1. **Persistence**: Cookies and localStorage must survive between MindForge waves.
5
+ 2. **Isolation**: Named sessions (admin, user, guest) prevent state leaking.
6
+ 3. **Security**: Session files are GITIGNORED. Never commit auth tokens.
7
+
8
+ ## Methods
9
+
10
+ ### 1. Sequential Manual Logins
11
+ Agent navigates to /login, types credentials, and calls `/session/save name`.
12
+
13
+ ### 2. External Import
14
+ Import cookies from your real browser (Chrome, Arc, Brave, Edge).
15
+ `/mindforge:browse --import-session admin --from chrome`
16
+
17
+ ### 3. Programmatic (CI)
18
+ Sessions can be pre-seeded by writing `.mindforge/browser/sessions/name.json` directly from CI secrets.
@@ -0,0 +1,31 @@
1
+ # MindForge v2 — <verify-visual> Specification
2
+
3
+ ## Overview
4
+ `<verify-visual>` is an optional field in PLAN task XML.
5
+ It runs AFTER `<verify>` (unit/integration tests) passes.
6
+ It confirms the UI looks and behaves correctly via browser automation.
7
+
8
+ ## Syntax
9
+ ```xml
10
+ <verify-visual session="user">
11
+ navigate: /dashboard
12
+ wait: networkidle
13
+ assert-visible: h1 "My Projects"
14
+ screenshot: dashboard.png
15
+ click: "#create-btn"
16
+ assert-visible: .modal
17
+ </verify-visual>
18
+ ```
19
+
20
+ ## Directives
21
+ | Directive | Description |
22
+ |---|---|
23
+ | `navigate: /path` | Navigate to URL (relative to DEV_SERVER_URL) |
24
+ | `wait: N` | Wait N ms or 'networkidle' |
25
+ | `assert-visible: sel ["text"]` | Assert element is visible |
26
+ | `assert-url: /path` | Assert current URL |
27
+ | `screenshot: name.png` | Capture screenshot |
28
+ | `click: selector` | Click element |
29
+ | `type: sel "text"` | Type into field |
30
+ | `evaluate: js` | Evaluate JS expression |
31
+ | `press: Key` | Press keyboard key |
@@ -0,0 +1,122 @@
1
+ # MindForge Dashboard API Reference
2
+
3
+ ## Base URL: http://localhost:7339
4
+
5
+ ## GET /api/status
6
+ Current execution state.
7
+ ```json
8
+ {
9
+ "project_name": "saas-app",
10
+ "phase": 3,
11
+ "phase_description": "Authentication System",
12
+ "auto_mode": true,
13
+ "auto_status": "running|paused|escalated|idle",
14
+ "current_task": "Plan 3-05 — JWT middleware",
15
+ "wave_current": 2,
16
+ "wave_total": 3,
17
+ "tasks_completed": 5,
18
+ "tasks_total": 8,
19
+ "elapsed_ms": 1083000,
20
+ "node_repairs": 1,
21
+ "escalations": 0,
22
+ "last_commit": "abc1234",
23
+ "last_event_at": "ISO-8601"
24
+ }
25
+ ```
26
+
27
+ ## GET /api/audit?limit=50&offset=0&event=task_completed
28
+ Recent AUDIT.jsonl entries (newest first).
29
+ Query params: limit (default 50, max 200), offset, event (filter by event type)
30
+
31
+ ## GET /api/metrics
32
+ Session quality and cost summary.
33
+ ```json
34
+ {
35
+ "sessions": [{ "id": "...", "quality_score": 0.87, "cost_usd": 0.42, "verify_pass_rate": 0.95 }],
36
+ "avg_quality": 0.85,
37
+ "avg_cost_usd": 0.38,
38
+ "security_findings": { "CRITICAL": 0, "HIGH": 2, "MEDIUM": 5, "LOW": 8 },
39
+ "node_repair_rate": 0.08
40
+ }
41
+ ```
42
+
43
+ ## GET /api/approvals
44
+ Pending governance approvals.
45
+ ```json
46
+ {
47
+ "pending": [
48
+ {
49
+ "id": "uuid",
50
+ "tier": 2,
51
+ "phase": 3,
52
+ "plan": "04",
53
+ "description": "Add user RBAC model",
54
+ "requested_at": "ISO-8601",
55
+ "expires_at": "ISO-8601",
56
+ "hours_remaining": 21.3,
57
+ "diff_preview": "src/models/user.ts +48 lines..."
58
+ }
59
+ ],
60
+ "approved": [...],
61
+ "rejected": [...],
62
+ "expired": [...]
63
+ }
64
+ ```
65
+
66
+ ## POST /api/approve/:id
67
+ ```json
68
+ Request: { "decision": "approve|reject", "comment": "optional", "approver": "email" }
69
+ Response: { "success": true, "decision": "approve", "approval_id": "uuid" }
70
+ ```
71
+
72
+ ## GET /api/team
73
+ Active developer activity.
74
+ ```json
75
+ {
76
+ "active": [
77
+ { "email": "john@company.com", "current_task": "Plan 3-05", "last_seen_mins": 0 }
78
+ ],
79
+ "conflicts": [
80
+ { "file": "src/auth/session.ts", "developers": ["john@...", "jane@..."] }
81
+ ]
82
+ }
83
+ ```
84
+
85
+ ## GET /api/memory?q=jwt&limit=10
86
+ Knowledge base query.
87
+ ```json
88
+ {
89
+ "entries": [
90
+ { "id": "kb-uuid", "type": "architectural_decision", "topic": "JWT tokens", "confidence": 0.90 }
91
+ ],
92
+ "total": 47
93
+ }
94
+ ```
95
+
96
+ ## GET /api/costs?window=7d
97
+ Cost summary from token-usage.jsonl.
98
+ ```json
99
+ {
100
+ "total_usd": 3.84,
101
+ "today_usd": 1.21,
102
+ "by_model": { "claude-sonnet-4-6": 1.92, "gpt-4o": 0.98 },
103
+ "daily_limit_usd": 10.00,
104
+ "limit_used_pct": 12.1
105
+ }
106
+ ```
107
+
108
+ ## POST /api/steer
109
+ Inject steering guidance (requires auto mode running).
110
+ ```json
111
+ Request: { "instruction": "Use Redis for session storage", "priority": "normal" }
112
+ Response: { "success": true, "queued": true }
113
+ ```
114
+
115
+ ## GET /events
116
+ SSE stream. Events emitted:
117
+ - `audit:new` — new AUDIT.jsonl entry
118
+ - `status:update` — auto-state.json changed
119
+ - `approval:new` — new approval request
120
+ - `approval:resolved` — approval approved or rejected
121
+ - `conflict:detected` — two developers touching same file
122
+ - `ping` — keepalive every 15 seconds
@@ -0,0 +1,96 @@
1
+ # MindForge v2 — Dashboard Specification
2
+
3
+ ## Overview
4
+
5
+ The MindForge dashboard is a real-time web UI that reflects the live state of
6
+ the MindForge agent and all project artifacts. It serves as the team's window
7
+ into what the agent is doing — designed for standup visibility, not agent control
8
+ (though it does support approval actions for Tier 2/3 governance).
9
+
10
+ ## Architecture
11
+
12
+ ```
13
+ Browser clients
14
+ ↑ SSE (push) ↑ REST (pull on load)
15
+ │ │
16
+ bin/dashboard/server.js (Express.js, localhost:7339)
17
+ │ │
18
+ sse-bridge.js api-router.js
19
+ │ (tails files) │ (reads files)
20
+ │ │
21
+ AUDIT.jsonl HANDOFF.json
22
+ auto-state.json session-quality.jsonl
23
+ APPROVAL-*.json token-usage.jsonl
24
+ HANDOFF.json knowledge-base.jsonl
25
+ TEAM-STATE.jsonl .planning/phases/
26
+ ```
27
+
28
+ ## Port and binding
29
+
30
+ - **Port:** 7339 (Dashboard = 7337+2, after SSE at 7337 and Browser Daemon at 7338)
31
+ - **Binding:** 127.0.0.1 ONLY — never 0.0.0.0 (ADR-017 policy)
32
+ - **Protocol:** HTTP/1.1 with SSE for live events
33
+ - **Process lifecycle:**
34
+ - Started by: `/mindforge:dashboard` command or `bin/dashboard/server.js`
35
+ - Stopped by: `CTRL+C`, `/mindforge:dashboard --stop`, or SIGTERM
36
+ - Auto-stop: when MindForge session ends (watches for HANDOFF.json inactivity)
37
+
38
+ ## Dashboard pages (5 tabs)
39
+
40
+ ### Page 1 — Live Activity (default view)
41
+ Shows real-time execution state:
42
+ - Project name and current phase description
43
+ - Auto mode status indicator (RUNNING/PAUSED/ESCALATED/IDLE)
44
+ - Wave progress bar (current wave / total waves)
45
+ - Current task name and elapsed time
46
+ - Live AUDIT event feed (last 50 events, newest at top)
47
+ - Steering input box (sends to steering queue if auto mode active)
48
+
49
+ ### Page 2 — Quality Metrics
50
+ Charts powered by session-quality.jsonl and token-usage.jsonl:
51
+ - Session quality score trend (last 20 sessions, sparkline)
52
+ - Verify pass rate over time (last 20 sessions)
53
+ - Security findings by severity (bar chart: CRITICAL/HIGH/MEDIUM/LOW)
54
+ - Token cost per session trend
55
+ - Node repair frequency (auto mode health signal)
56
+
57
+ ### Page 3 — Pending Approvals
58
+ Governance queue visible to the whole team:
59
+ - Shows all APPROVAL-*.json files with status: pending
60
+ - For each: tier, phase/plan, change description, time since requested, expiry
61
+ - [Approve] and [Reject] buttons that call POST /api/approve/:id
62
+ - Expired approvals shown separately with red indicator
63
+
64
+ ### Page 4 — Knowledge Graph
65
+ Visual representation of the knowledge base:
66
+ - Force-directed graph: nodes = knowledge entries, edges = ADR links
67
+ - Color by type: blue=decision, green=preference, red=bug_pattern, yellow=domain
68
+ - Node size = confidence × 30px radius
69
+ - Click node → side panel with full content
70
+ - Filter by type, tags, or confidence threshold
71
+
72
+ ### Page 5 — Team Activity
73
+ Multi-developer visibility:
74
+ - Active developers (git email → last AUDIT event timestamp)
75
+ - What each developer is working on (last task from AUDIT.jsonl)
76
+ - File conflict detection (two developers recently touching the same file)
77
+ - Session history (list of sessions, quality scores, costs)
78
+
79
+ ## Security model
80
+
81
+ 1. Localhost-only binding (127.0.0.1) — consistent with all MindForge servers
82
+ 2. No authentication — local dev tool, not exposed to network
83
+ 3. CORS policy: only allow requests from localhost
84
+ 4. Approval actions (POST /api/approve/:id) require the approval file to exist
85
+ in `.planning/approvals/` — cannot fabricate approvals from browser
86
+ 5. Steering (POST /api/steer) only works when auto-state.json shows `status: running`
87
+ 6. All file reads are restricted to `.planning/` and `.mindforge/` directories —
88
+ no arbitrary filesystem access from the API
89
+
90
+ ## SCREENSHARE MODE (recommended team use)
91
+ The dashboard is designed to be screenshared during standups:
92
+ - Product managers see live progress without CLI access
93
+ - Designers see when their UI implementation tasks are running
94
+ - Stakeholders see real estimates of completion time
95
+ - On-call engineers see security findings as they're detected
96
+ Never expose the dashboard URL externally — it contains project details.