@dv.nghiem/flowdeck 0.3.4 → 0.3.5

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 (95) hide show
  1. package/README.md +154 -3
  2. package/dist/agents/coder.d.ts +3 -1
  3. package/dist/agents/coder.d.ts.map +1 -1
  4. package/dist/agents/design.d.ts +3 -0
  5. package/dist/agents/design.d.ts.map +1 -0
  6. package/dist/agents/index.d.ts +4 -3
  7. package/dist/agents/index.d.ts.map +1 -1
  8. package/dist/agents/orchestrator.d.ts.map +1 -1
  9. package/dist/agents/reviewer.d.ts.map +1 -1
  10. package/dist/agents/specialist.d.ts +0 -1
  11. package/dist/agents/specialist.d.ts.map +1 -1
  12. package/dist/config/index.d.ts +1 -1
  13. package/dist/config/index.d.ts.map +1 -1
  14. package/dist/config/loader.d.ts +8 -0
  15. package/dist/config/loader.d.ts.map +1 -1
  16. package/dist/config/schema.d.ts +55 -2
  17. package/dist/config/schema.d.ts.map +1 -1
  18. package/dist/dashboard/server.mjs +24 -1
  19. package/dist/dashboard/types.d.ts +72 -0
  20. package/dist/dashboard/types.d.ts.map +1 -1
  21. package/dist/hooks/guard-rails.d.ts.map +1 -1
  22. package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
  23. package/dist/hooks/tool-guard.d.ts.map +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +490 -418
  26. package/dist/services/agent-contract-registry.d.ts +32 -0
  27. package/dist/services/agent-contract-registry.d.ts.map +1 -0
  28. package/dist/services/agent-performance.d.ts +1 -1
  29. package/dist/services/agent-performance.d.ts.map +1 -1
  30. package/dist/services/agent-trace-graph.d.ts +94 -0
  31. package/dist/services/agent-trace-graph.d.ts.map +1 -0
  32. package/dist/services/agent-validator.d.ts +56 -0
  33. package/dist/services/agent-validator.d.ts.map +1 -0
  34. package/dist/services/deadlock-detector.d.ts +34 -0
  35. package/dist/services/deadlock-detector.d.ts.map +1 -0
  36. package/dist/services/delegation-budget.d.ts +54 -0
  37. package/dist/services/delegation-budget.d.ts.map +1 -0
  38. package/dist/services/governance.test.d.ts +11 -0
  39. package/dist/services/governance.test.d.ts.map +1 -0
  40. package/dist/services/index.d.ts +6 -1
  41. package/dist/services/index.d.ts.map +1 -1
  42. package/dist/services/telemetry.d.ts +1 -1
  43. package/dist/services/telemetry.d.ts.map +1 -1
  44. package/dist/services/workflow-scorecard.d.ts +76 -0
  45. package/dist/services/workflow-scorecard.d.ts.map +1 -0
  46. package/dist/tools/delegate.d.ts.map +1 -1
  47. package/dist/tools/dispatch-routing.d.ts +4 -1
  48. package/dist/tools/dispatch-routing.d.ts.map +1 -1
  49. package/dist/tools/dispatch-routing.test.d.ts +2 -0
  50. package/dist/tools/dispatch-routing.test.d.ts.map +1 -0
  51. package/dist/tools/planning-state-lib.d.ts +8 -0
  52. package/dist/tools/planning-state-lib.d.ts.map +1 -1
  53. package/dist/tools/planning-state.d.ts.map +1 -1
  54. package/dist/tools/run-pipeline.d.ts.map +1 -1
  55. package/docs/agents.md +104 -74
  56. package/docs/best-practices.md +1 -1
  57. package/docs/commands/fd-ask.md +2 -2
  58. package/docs/commands/fd-fix-bug.md +2 -2
  59. package/docs/commands/fd-new-feature.md +2 -2
  60. package/docs/commands/fd-quick.md +3 -1
  61. package/docs/commands.md +37 -7
  62. package/docs/configuration.md +76 -46
  63. package/docs/design-first-workflow.md +94 -0
  64. package/docs/feature-integration-architecture.md +3 -31
  65. package/docs/index.md +5 -2
  66. package/docs/intelligence.md +92 -1
  67. package/docs/multi-repo.md +1 -1
  68. package/docs/rules.md +1 -1
  69. package/docs/skills.md +24 -15
  70. package/docs/workflows.md +11 -6
  71. package/package.json +1 -1
  72. package/src/commands/fd-ask.md +1 -0
  73. package/src/commands/fd-design.md +64 -0
  74. package/src/commands/fd-discuss.md +2 -0
  75. package/src/commands/fd-execute.md +7 -3
  76. package/src/commands/fd-fix-bug.md +2 -2
  77. package/src/commands/fd-multi-repo.md +3 -3
  78. package/src/commands/fd-plan.md +2 -0
  79. package/src/commands/fd-quick.md +4 -1
  80. package/src/commands/fd-verify.md +6 -0
  81. package/src/rules/common/agent-orchestration.md +6 -6
  82. package/src/skills/app-shell-design/SKILL.md +31 -0
  83. package/src/skills/dashboard-design/SKILL.md +32 -0
  84. package/src/skills/decision-trace/SKILL.md +1 -1
  85. package/src/skills/design-audit/SKILL.md +37 -0
  86. package/src/skills/design-system-definition/SKILL.md +33 -0
  87. package/src/skills/frontend-handoff/SKILL.md +31 -0
  88. package/src/skills/landing-page-design/SKILL.md +32 -0
  89. package/src/skills/multi-repo/SKILL.md +3 -3
  90. package/src/skills/plan-task/SKILL.md +2 -2
  91. package/src/skills/responsive-review/SKILL.md +31 -0
  92. package/src/skills/ui-ux-planning/SKILL.md +32 -0
  93. package/src/skills/wireframe-planning/SKILL.md +30 -0
  94. package/dist/services/model-router.d.ts +0 -35
  95. package/dist/services/model-router.d.ts.map +0 -1
@@ -147,9 +147,9 @@ Each FlowDeck project stores its settings in `.planning/config.json`. This file
147
147
 
148
148
  ---
149
149
 
150
- ## flowdeck.json (Agent Model Overrides)
150
+ ## flowdeck.json (Agent and Governance Config)
151
151
 
152
- The `flowdeck.json` file lets you assign specific AI models to individual FlowDeck agents. This is useful when you want the `@planner` to use a more capable model while lighter agents like `@tester` use a faster, cheaper one.
152
+ The `flowdeck.json` file controls two things: per-agent model overrides and the governance layer. **No model is hardcoded** if an agent is not listed, it uses whatever model is currently selected in OpenCode.
153
153
 
154
154
  ### Locations
155
155
 
@@ -160,7 +160,7 @@ The `flowdeck.json` file lets you assign specific AI models to individual FlowDe
160
160
 
161
161
  Project config takes precedence over global config.
162
162
 
163
- ### Schema
163
+ ### Full schema
164
164
 
165
165
  ```json
166
166
  {
@@ -168,61 +168,91 @@ Project config takes precedence over global config.
168
168
  "<agent-name>": {
169
169
  "model": "<provider>/<model-id>"
170
170
  }
171
+ },
172
+ "designFirst": {
173
+ "enabled": true,
174
+ "enforcement": "strict",
175
+ "requireApprovalBeforeImplementation": true,
176
+ "modelOverrides": {
177
+ "design": "anthropic/claude-sonnet-4"
178
+ },
179
+ "defaultSkillsByTaskType": {
180
+ "landing-page": ["landing-page-design", "wireframe-planning", "design-system-definition", "frontend-handoff"]
181
+ }
182
+ },
183
+ "governance": {
184
+ "validator": {
185
+ "mode": "advisory"
186
+ },
187
+ "delegationBudget": {
188
+ "maxToolCalls": 200,
189
+ "maxDelegatedAgents": 30,
190
+ "maxRetries": 10,
191
+ "maxDepth": 8,
192
+ "maxSameStepRetries": 3
193
+ },
194
+ "deadlockDetection": {
195
+ "enabled": true,
196
+ "bounceThreshold": 3,
197
+ "stageStallMinutes": 30,
198
+ "autoStop": false
199
+ },
200
+ "scorecard": {
201
+ "enabled": true
202
+ }
171
203
  }
172
204
  }
173
205
  ```
174
206
 
175
- ### Supported Agents
176
-
177
- | Agent | Default Model | Override Example |
178
- |-------|--------------|-----------------|
179
- | `@architect` | `claude-opus-4-5` | `anthropic/claude-opus-4-5` |
180
- | `@build-error-resolver` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
181
- | `@code-explorer` | `claude-haiku-4-5` | `anthropic/claude-haiku-4-5` |
182
- | `@coder` | `claude-opus-4-5` | `anthropic/claude-opus-4-5` |
183
- | `@debug-specialist` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
184
- | `@discusser` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
185
- | `@doc-updater` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
186
- | `@orchestrator` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
187
- | `@plan-checker` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
188
- | `@planner` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
189
- | `@mapper` | `gemini-2.5-flash` | `google/gemini-2.5-flash` |
190
- | `@multi-repo-coordinator` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
191
- | `@orchestrator` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
192
- | `@parallel-coordinator` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
193
- | `@performance-optimizer` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
194
- | `@planner` | `claude-opus-4-5` | `anthropic/claude-opus-4-5` |
195
- | `@refactor-guide` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
196
- | `@researcher` | `gpt-4o` | `openai/gpt-4o` |
197
- | `@reviewer` | `gemini-2.5-flash` | `google/gemini-2.5-flash` |
198
- | `@security-auditor` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
199
- | `@task-splitter` | `claude-sonnet-4-5` | `anthropic/claude-sonnet-4-5` |
200
- | `@tester` | `claude-haiku-4-5` | `anthropic/claude-haiku-4-5` |
201
- | `@writer` | `claude-haiku-4-5` | `anthropic/claude-haiku-4-5` |
202
-
203
- ### Example
207
+ ### Agent model overrides
208
+
209
+ All agents default to the model currently selected in OpenCode. Only list agents you want to override:
204
210
 
205
211
  ```json
206
212
  {
207
213
  "agents": {
208
- "planner": {
209
- "model": "anthropic/claude-opus-4-5"
210
- },
211
- "orchestrator": {
212
- "model": "anthropic/claude-sonnet-4-5"
213
- },
214
- "tester": {
215
- "model": "anthropic/claude-haiku-4-5"
216
- }
214
+ "planner": { "model": "anthropic/claude-opus-4" },
215
+ "orchestrator": { "model": "anthropic/claude-sonnet-4" },
216
+ "tester": { "model": "openai/gpt-4o-mini" },
217
+ "reviewer": { "model": "google/gemini-2.5-flash" }
217
218
  }
218
219
  }
219
220
  ```
220
221
 
221
- ### Notes
222
-
223
- - If an agent is not listed in `agents`, it uses the model currently selected in OpenCode.
224
- - Only list agents you want to override — omitted agents inherit the session default.
225
- - Model strings must match the format `provider/model-id` (e.g., `anthropic/claude-sonnet-4-5`).
222
+ Model strings must use the format `provider/model-id`. Common examples:
223
+
224
+ | Provider | Example model string |
225
+ |----------|---------------------|
226
+ | Anthropic | `anthropic/claude-opus-4`, `anthropic/claude-sonnet-4`, `anthropic/claude-haiku-4` |
227
+ | OpenAI | `openai/gpt-4o`, `openai/gpt-4o-mini` |
228
+ | Google | `google/gemini-2.5-flash`, `google/gemini-2.5-pro` |
229
+ | GitHub Copilot | `github-copilot/sonnet-4.6` |
230
+ | Minimax | `minimax/minimax-m2.7-highspeed` |
231
+
232
+ Agents with no entry in `agents` inherit the session model selected in OpenCode's model picker.
233
+
234
+ ### Governance config
235
+
236
+ | Field | Default | Description |
237
+ |-------|---------|-------------|
238
+ | `governance.validator.mode` | `"advisory"` | `"off"` — disabled; `"advisory"` — warn but never block; `"strict"` — block on contract violations |
239
+ | `governance.delegationBudget.maxToolCalls` | `200` | Total tool calls allowed per workflow run before escalation |
240
+ | `governance.delegationBudget.maxDelegatedAgents` | `30` | Maximum number of sub-agent delegations per run |
241
+ | `governance.delegationBudget.maxRetries` | `10` | Total retries allowed across all steps |
242
+ | `governance.delegationBudget.maxDepth` | `8` | Maximum delegation nesting depth |
243
+ | `governance.delegationBudget.maxSameStepRetries` | `3` | Retries allowed on a single failing step before escalation |
244
+ | `governance.deadlockDetection.enabled` | `true` | Enable deadlock and loop detection |
245
+ | `governance.deadlockDetection.bounceThreshold` | `3` | Agent-pair invocations before bounce is flagged |
246
+ | `governance.deadlockDetection.stageStallMinutes` | `30` | Minutes without stage progress before stall is flagged |
247
+ | `governance.deadlockDetection.autoStop` | `false` | Stop automatically on detection; `false` emits warning only |
248
+ | `governance.scorecard.enabled` | `true` | Generate a quality scorecard after every run |
249
+
250
+ ### Design-first defaults
251
+
252
+ - `designFirst.enabled`: defaults to `true`
253
+ - `designFirst.enforcement`: defaults to `strict` (`advisory` supported)
254
+ - `designFirst.requireApprovalBeforeImplementation`: defaults to `true`
255
+ - UI-heavy tasks are blocked from implementation until design handoff is approved, unless explicit override is recorded.
226
256
 
227
257
  ---
228
258
 
@@ -0,0 +1,94 @@
1
+ # Design-First Workflow
2
+
3
+ FlowDeck enforces a design-first path for UI-heavy tasks by default.
4
+
5
+ ## Trigger Conditions
6
+
7
+ Design-first is triggered when tasks mention user-facing work such as:
8
+ - landing page
9
+ - dashboard
10
+ - admin panel
11
+ - website redesign
12
+ - onboarding UX
13
+ - app screen/mobile UI
14
+
15
+ Backend-only or infra-only tasks skip design-first.
16
+
17
+ ## Workflow
18
+
19
+ ```text
20
+ task intake
21
+ → task classification
22
+ → design discovery
23
+ → UX structure
24
+ → wireframe/layout planning
25
+ → visual system definition
26
+ → design review/approval
27
+ → implementation handoff
28
+ → frontend implementation
29
+ → QA/review
30
+ ```
31
+
32
+ ## Commands
33
+
34
+ - `/fd-design --mode=draft`: produce design artifact and handoff
35
+ - `/fd-design --mode=review`: compare implementation to approved design artifact
36
+ - `/fd-design --mode=system`: create/update token and component consistency guidance
37
+
38
+ ## Design Artifact Schema
39
+
40
+ Each design run should persist:
41
+ - `task_type`
42
+ - `user_goals`
43
+ - `target_audience`
44
+ - `core_user_flows`
45
+ - `page_map_or_screen_map`
46
+ - `section_structure`
47
+ - `layout_plan`
48
+ - `component_list`
49
+ - `state_list`
50
+ - `responsive_behavior_notes`
51
+ - `visual_direction`
52
+ - `design_tokens_guidance`
53
+ - `accessibility_notes`
54
+ - `implementation_handoff_checklist`
55
+ - `approval_status`
56
+
57
+ ## Example: Landing Page
58
+
59
+ ```yaml
60
+ task_type: landing-page
61
+ user_goals:
62
+ - understand value in <10 seconds
63
+ - complete signup CTA
64
+ core_user_flows:
65
+ - hero -> social-proof -> pricing -> CTA
66
+ layout_plan:
67
+ - hero_section: headline, subheadline, primary_cta, secondary_cta
68
+ - proof_section: logos, testimonials
69
+ - pricing_section: tier_cards, comparison_table
70
+ state_list: [loading, empty, error, success]
71
+ approval_status: approved
72
+ ```
73
+
74
+ ## Example: App Screen Redesign
75
+
76
+ ```yaml
77
+ task_type: app-screen
78
+ target_audience:
79
+ - returning mobile users
80
+ core_user_flows:
81
+ - home -> quick-action -> detail -> completion
82
+ section_structure:
83
+ - top_nav
84
+ - summary_cards
85
+ - task_list
86
+ - persistent_action_bar
87
+ responsive_behavior_notes:
88
+ - compact_nav_on_small_screens
89
+ - collapse_secondary_panels_under_768
90
+ design_tokens_guidance:
91
+ - spacing_scale: [4, 8, 12, 16, 24, 32]
92
+ - text_scale: [12, 14, 16, 20, 24]
93
+ approval_status: approved
94
+ ```
@@ -11,7 +11,7 @@ This layer adds 8 capabilities behind the existing command architecture without
11
11
  | Capability | Implementation | Data File |
12
12
  |---|---|---|
13
13
  | Patch Trust Engine | `src/hooks/patch-trust.ts` | `.codebase/DECISIONS.jsonl` |
14
- | Adaptive Model Router | `src/services/model-router.ts` | `.codebase/MODEL_ROUTER.json` |
14
+ | Agent Performance Memory | `src/services/agent-performance.ts` | `.codebase/AGENT_PERF.json` |
15
15
  | Approval-Aware Execution | `src/services/approval-manager.ts` + `src/hooks/approval-hook.ts` | `.codebase/APPROVALS.json` |
16
16
  | Workflow Replay + Diff | `src/services/run-trace.ts` | `.codebase/RUNS.jsonl` |
17
17
  | Agent Performance Memory | `src/services/agent-performance.ts` | `.codebase/AGENT_PERF.json` |
@@ -63,27 +63,6 @@ isSensitivePath(filePath) → boolean
63
63
 
64
64
  **Approval TTL:** 30 minutes. Sensitive path patterns: auth, payment, secrets, migrations, infra, production config.
65
65
 
66
- ### model-router.ts
67
- Routes task types to the best available model.
68
-
69
- ```typescript
70
- routeModel(dir, task_type, risk_score?) → RoutedModel
71
- buildAgentConfig(dir, agents) → AgentConfig[]
72
- getRouterConfig(dir) → ModelRouterConfig
73
- ```
74
-
75
- **Default routing:**
76
- | Task | Primary | High-Risk Override |
77
- |---|---|---|
78
- | planning | claude-sonnet-4-5 | — |
79
- | implementation | claude-opus-4-5 | claude-opus-4-5 |
80
- | debugging | claude-sonnet-4-5 | claude-opus-4-5 |
81
- | review | gemini-2.5-flash | — |
82
- | testing | claude-haiku-4-5 | — |
83
- | security | claude-opus-4-5 | claude-opus-4-5 |
84
-
85
- Override by creating `.codebase/MODEL_ROUTER.json` with `{ "task_type": { "primary": "model-name" } }`.
86
-
87
66
  ### agent-performance.ts
88
67
  Tracks success rates, costs, and durations per agent+model+task combination.
89
68
 
@@ -94,7 +73,7 @@ getBestAgentForTask(dir, task_type) → AgentRecommendation | null
94
73
  getAgentLeaderboard(dir) → AgentRecommendation[]
95
74
  ```
96
75
 
97
- Requires ≥ 3 runs per combination before making routing recommendations.
76
+ Requires ≥ 3 runs per combination before making routing recommendations. Model is tracked from the actual call — no hardcoded model list.
98
77
 
99
78
  ---
100
79
 
@@ -122,7 +101,6 @@ Emits `tool.call` events for all tool invocations. Lightweight — never blocks.
122
101
 
123
102
  ### /fd-new-feature
124
103
  - Calls `startTrace()` on entry → `run_id` included in config
125
- - Calls `buildAgentConfig()` from model-router → no hardcoded models
126
104
  - Emits `command.start` telemetry event with risk score and phase
127
105
 
128
106
  ### /fd-fix-bug
@@ -175,12 +153,7 @@ The dashboard at `http://localhost:<port>` now includes:
175
153
 
176
154
  ### AGENT_PERF.json
177
155
  ```json
178
- {"entries":[{"agent":"coder","model":"claude-opus-4-5","task_type":"implementation","runs":12,"successes":11,"failures":1,"total_duration_ms":60000,"total_cost":0.48,"last_run":"ISO","last_status":"success"}],"updated_at":"ISO"}
179
- ```
180
-
181
- ### MODEL_ROUTER.json (optional override)
182
- ```json
183
- {"implementation":{"primary":"claude-sonnet-4-5","temperature":0.2},"review":{"primary":"claude-haiku-4-5"}}
156
+ {"entries":[{"agent":"backend-coder","model":"<user-configured>","task_type":"implementation","runs":12,"successes":11,"failures":1,"total_duration_ms":60000,"total_cost":0.48,"last_run":"ISO","last_status":"success"}],"updated_at":"ISO"}
184
157
  ```
185
158
 
186
159
  ---
@@ -189,7 +162,6 @@ The dashboard at `http://localhost:<port>` now includes:
189
162
 
190
163
  No new required config. Optional per-repo overrides:
191
164
 
192
- - `.codebase/MODEL_ROUTER.json` — override model routing per task type
193
165
  - `.codebase/POLICIES.json` — runtime policy rules (existing, enhanced)
194
166
  - `.codebase/CONSTRAINTS.md` — architectural constraints (existing)
195
167
 
package/docs/index.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # FlowDeck Documentation
2
2
 
3
- FlowDeck is an OpenCode plugin that brings structured, multi-agent workflow orchestration to your development sessions. It coordinates specialist agents through a four-phase cycle — discuss, plan, execute, review — with persistent state stored in your project's `.planning/` directory.
3
+ FlowDeck is an OpenCode plugin that brings structured, multi-agent workflow orchestration to your development sessions. It coordinates specialist agents through a gated workflow — discuss, plan, design (UI-heavy), execute, review — with persistent state stored in your project's `.planning/` directory.
4
4
 
5
5
  ---
6
6
 
@@ -18,12 +18,14 @@ FlowDeck is an OpenCode plugin that brings structured, multi-agent workflow orch
18
18
 
19
19
  | Document | Description |
20
20
  |----------|-------------|
21
- | [Agents](agents.md) | All specialist agents — names, roles, models, and when to invoke each one |
21
+ | [Agents](agents.md) | All specialist agents — names, roles, and when to invoke each one |
22
22
  | [Skills](skills.md) | Reusable skill patterns for common tasks |
23
23
  | [Commands](commands.md) | All 18 slash commands — syntax, arguments, and what each command triggers |
24
24
  | [Workflows](workflows.md) | Built-in workflows for common scenarios |
25
+ | [Design-First Workflow](design-first-workflow.md) | UI-heavy workflow gates from design discovery to implementation handoff |
25
26
  | [Rules](rules.md) | Language and common rule files — what they enforce and how to activate them |
26
27
  | [Intelligence Features](intelligence.md) | AI-safety features for pre-change analysis and risk assessment |
28
+ | [Governance Layer](configuration.md#governance-config) | Agent contracts, validator, trace graph, budget, deadlock detection, and scorecards |
27
29
  | [Memory System](memory.md) | Persistent memory — recall past sessions, tool executions, and context across sessions |
28
30
 
29
31
  ---
@@ -53,6 +55,7 @@ FlowDeck is an OpenCode plugin that brings structured, multi-agent workflow orch
53
55
  | `/fd-new-project <name>` | Initialize project with planning structure and default config |
54
56
  | `/fd-discuss <topic>` | Run structured requirements Q&A to capture decisions |
55
57
  | `/fd-plan [--phase=N]` | Generate implementation plan from decisions (requires CONFIRM) |
58
+ | `/fd-design [--mode=draft\|review\|system]` | Run design-first planning and UI fidelity review for UI-heavy tasks |
56
59
  | `/fd-new-feature "<description>"` | Execute full feature workflow with TDD discipline |
57
60
  | `/fd-fix-bug "<description>"` | Diagnose and fix a bug with regression test |
58
61
  | `/fd-deploy-check [--check=deploy,review,analysis]` | Pre-deploy checks, code review, or pre-change analysis |
@@ -252,12 +252,103 @@ Manages `.codebase/POLICIES.json` — self-healing editing rules that update aft
252
252
  | `VOLATILITY.json` | JSON | Per-file churn and stability metrics |
253
253
  | `POLICIES.json` | JSON | Self-healing editing rule set |
254
254
  | `CONSTRAINTS.md` | Markdown | Forbidden path list for Arch Constraint Guard |
255
+ | `AGENT_SPANS.jsonl` | Newline-delimited JSON | Inter-agent trace graph (governance) |
256
+ | `BUDGETS.json` | JSON | Per-run delegation budget state (governance) |
257
+ | `DEADLOCK_SIGNALS.jsonl` | Newline-delimited JSON | Detected loops and deadlocks (governance) |
258
+ | `SCORECARDS.jsonl` | Newline-delimited JSON | 10-dimension workflow quality scores (governance) |
255
259
 
256
260
  > **Tip:** All `.codebase/` files should be committed to version control so the intelligence layer improves over time.
257
261
 
258
262
  ---
259
263
 
260
- ## Skills
264
+ ## Governance Layer
265
+
266
+ The governance layer makes multi-agent execution trustworthy and debuggable. It runs automatically as internal runtime services — no commands or manual wiring needed.
267
+
268
+ ### Agent Contracts
269
+
270
+ Every major agent has an explicit contract defining:
271
+
272
+ - **Allowed tools** — tools the agent may invoke
273
+ - **Forbidden actions** — things the agent must never do (e.g. `@reviewer` may not write files)
274
+ - **Required inputs** — what context must be present before the agent runs
275
+ - **Escalation conditions** — when to surface to human review
276
+ - **Success criteria** — what a good output looks like
277
+
278
+ Contracts are defined in `src/services/agent-contract-registry.ts` and cover: orchestrator, planner, plan-checker, design, backend-coder, frontend-coder, devops, tester, reviewer, security-auditor, researcher, architect, writer, and doc-updater.
279
+
280
+ ### Agent Validator
281
+
282
+ Before and after each agent invocation, the validator checks the execution context against the agent's contract. Configure the enforcement mode in `flowdeck.json`:
283
+
284
+ | Mode | Behaviour |
285
+ |------|-----------|
286
+ | `off` | Validation disabled |
287
+ | `advisory` | Validate and warn; never block execution (default) |
288
+ | `strict` | Block on contract violations of severity `block` |
289
+
290
+ Violations are emitted as `contract.violation` telemetry events and attached to the agent span.
291
+
292
+ ### Inter-Agent Trace Graph
293
+
294
+ Every delegation opens a **span** in the trace graph. Spans record:
295
+
296
+ - Invoker → agent direction
297
+ - Trace ID and parent span ID (causal chain)
298
+ - Tools used and outputs
299
+ - Contract violations attached to the span
300
+ - Latency and delegation depth
301
+
302
+ Spans are stored in `.codebase/AGENT_SPANS.jsonl`. The trace graph is dashboard-ready and can be rendered as a timeline, causality graph, or per-agent drilldown.
303
+
304
+ ### Delegation Budget
305
+
306
+ Each workflow run has a budget tracked in `.codebase/BUDGETS.json`:
307
+
308
+ | Limit | Default | Config key |
309
+ |-------|---------|------------|
310
+ | Max tool calls | 200 | `governance.delegationBudget.maxToolCalls` |
311
+ | Max delegated agents | 30 | `governance.delegationBudget.maxDelegatedAgents` |
312
+ | Max retries (total) | 10 | `governance.delegationBudget.maxRetries` |
313
+ | Max delegation depth | 8 | `governance.delegationBudget.maxDepth` |
314
+ | Max retries per step | 3 | `governance.delegationBudget.maxSameStepRetries` |
315
+
316
+ When a limit is exceeded the system escalates to human review or (if `autoStop: true`) stops safely and summarises what was completed.
317
+
318
+ ### Deadlock and Loop Detector
319
+
320
+ The detector runs four independent pattern checks after each agent invocation:
321
+
322
+ | Pattern | Trigger |
323
+ |---------|---------|
324
+ | `agent_bounce` | Same agent pair invoked ≥ N times without resolution |
325
+ | `step_retry_loop` | Same stage retried beyond the per-step limit |
326
+ | `circular_delegation` | DFS detects a cycle in the delegation graph — always triggers `auto_stop` |
327
+ | `stage_stall` | Workflow stage makes no progress within the stall window |
328
+
329
+ Signals are written to `.codebase/DEADLOCK_SIGNALS.jsonl`. Duplicate signals for the same trace and pattern are suppressed. A recovery action recommendation is attached to each signal.
330
+
331
+ ### Workflow Scorecard
332
+
333
+ After every completed or failed run, a scorecard is generated and appended to `.codebase/SCORECARDS.jsonl`. Ten dimensions are scored and combined into a weighted 0–100 score:
334
+
335
+ | Dimension | Weight |
336
+ |-----------|--------|
337
+ | Stage compliance | 15% |
338
+ | TDD compliance | 15% |
339
+ | Design-first compliance | 10% |
340
+ | Approval compliance | 10% |
341
+ | Review quality | 10% |
342
+ | Handoff quality | 10% |
343
+ | Budget efficiency | 10% |
344
+ | Tool reliability | 10% |
345
+ | Policy compliance | 5% |
346
+ | Override frequency | 5% |
347
+
348
+ Scorecards support trend analysis over time. Use `getScorecardTrend(dir, command)` and `computeAverageScore(dir)` from `src/services/workflow-scorecard.ts` to query them programmatically.
349
+
350
+ ---
351
+
261
352
 
262
353
  Each intelligence feature also has a corresponding skill that gives the OpenCode agent detailed workflow instructions. Skills are installed automatically by `install.sh`.
263
354
 
@@ -180,7 +180,7 @@ The `multi-repo-flow` workflow orchestrates the full end-to-end process:
180
180
  1. **Analyze** — `@code-explorer` runs in each registered repo and builds a combined dependency graph
181
181
  2. **Classify** — `@multi-repo-coordinator` identifies which changes are breaking vs non-breaking and determines service change order
182
182
  3. **Plan** — produces a CHANGE PLAN per repo in dependency order
183
- 4. **Execute** — `@coder` is invoked per repo in order; `@tester` runs per repo in parallel with `@coder` (using that repo's test suite)
183
+ 4. **Execute** — role-routed implementation agent (`@backend-coder`/`@frontend-coder`/`@devops`) is invoked per repo in order; `@tester` runs per repo in parallel with the selected implementation agent (using that repo's test suite)
184
184
  5. **Verify** — `@reviewer` and `@security-auditor` run per repo after implementation; integration tests are run across the full service mesh in staging before any production rollout
185
185
 
186
186
  Each step produces output files in `.planning/fd-multi-repo/` so the entire process is auditable.
package/docs/rules.md CHANGED
@@ -111,7 +111,7 @@ Governs how FlowDeck agents are selected and coordinated.
111
111
  - **Run `@task-splitter` before `/fd-new-feature` on large scope.** If a feature description spans more than a few hours of work, invoke `@task-splitter` first to break it into independent sub-features. Attempting to implement large scope in one `/fd-new-feature` call produces lower-quality output.
112
112
  - **`@reviewer` is mandatory before merge.** Every code-producing command (`/fd-new-feature`, `/fd-fix-bug`) must be followed by at least one `@reviewer` pass. This is enforced when guard mode is enabled in `.planning/config.json`.
113
113
  - **`@security-auditor` is mandatory for auth, payment, and PII code.** Any change to authentication flows, payment processing, or code that stores or transmits personally identifiable information must be audited by `@security-auditor` before merge — regardless of the change size.
114
- - **Wave gates are not optional.** In parallel execution, Wave 3 (`@coder` + `@tester`) must not begin until Wave 2 (`@architect`) has produced its output. Starting implementation before design is complete produces rework.
114
+ - **Wave gates are not optional.** In parallel execution, Wave 3 (`@backend-coder` + `@tester`) must not begin until Wave 2 (`@architect`) has produced its output. Starting implementation before design is complete produces rework.
115
115
 
116
116
  ---
117
117
 
package/docs/skills.md CHANGED
@@ -26,21 +26,30 @@ For example: `@tester use the tdd-workflow skill to add tests for the payments m
26
26
  | `context-load` | Efficient session start: load STATE.md, PLAN.md, PROJECT.md | Any agent at session start |
27
27
  | `debug-flow` | 6-step debug sequence: reproduce → trace → test → fix → verify | `@debug-specialist`, `@tester` |
28
28
  | `dependency-audit` | CVE scanning, license compliance, outdated package detection | `@security-auditor`, `@reviewer` |
29
+ | `design-audit` | UI fidelity audit against approved design artifacts | `@design`, `@reviewer` |
30
+ | `ui-ux-planning` | UX flow and structure planning before implementation | `@design` |
31
+ | `wireframe-planning` | Wireframe-level layout and section planning | `@design` |
32
+ | `design-system-definition` | Token and component behavior guidance | `@design`, `@backend-coder` |
33
+ | `frontend-handoff` | Convert design outputs into implementation checklist | `@design`, `@backend-coder` |
34
+ | `responsive-review` | Responsive behavior and breakpoint review | `@design`, `@reviewer` |
35
+ | `dashboard-design` | Dashboard-specific hierarchy and data-density patterns | `@design` |
36
+ | `landing-page-design` | Conversion-oriented landing page structure | `@design` |
37
+ | `app-shell-design` | App shell and navigation model design | `@design` |
29
38
  | `deploy-check` | Pre-deployment go/no-go checklist | `@orchestrator`, `@security-auditor` |
30
39
  | `documentation-writer` | Technical writing standards for READMEs, API docs, changelogs | `@writer`, `@doc-updater` |
31
40
  | `git-release` | Semantic versioning, changelog generation, release tagging | `@writer`, `@orchestrator` |
32
- | `git-workflow` | Conventional commits, branching strategy, PR standards | `@coder`, `@orchestrator` |
33
- | `golang-patterns` | Idiomatic Go: error handling, goroutines, interfaces, testing | `@coder`, `@reviewer` |
34
- | `java-patterns` | Modern Java 17+: records, Spring Boot, JPA, CompletableFuture | `@coder`, `@reviewer` |
41
+ | `git-workflow` | Conventional commits, branching strategy, PR standards | `@backend-coder`, `@orchestrator` |
42
+ | `golang-patterns` | Idiomatic Go: error handling, goroutines, interfaces, testing | `@backend-coder`, `@reviewer` |
43
+ | `java-patterns` | Modern Java 17+: records, Spring Boot, JPA, CompletableFuture | `@backend-coder`, `@reviewer` |
35
44
  | `multi-repo` | Cross-repo dependency graphs, contract-first changes, ordered rollouts | `@multi-repo-coordinator`, `@architect` |
36
- | `parallel-execute` | Wave-based parallel task coordination and merge protocol | `@parallel-coordinator`, `@task-splitter` |
45
+ | `parallel-execute` | Wave-based parallel task coordination and merge protocol | `@orchestrator`, `@task-splitter` |
37
46
  | `performance-profiling` | Profiling methodology, bottleneck identification, before/after measurement | `@performance-optimizer` |
38
47
  | `plan-task` | Wave-structured task planning with dependency graph and success criteria | `@planner`, `@planner` |
39
- | `python-patterns` | Python 3.10+: type hints, dataclasses, asyncio, pytest | `@coder`, `@reviewer` |
40
- | `refactor-guide` | Safe refactoring: tests-first, one transformation per commit | `@refactor-guide`, `@coder` |
41
- | `rust-patterns` | Ownership, traits, async/Tokio, error handling, smart pointers | `@coder`, `@reviewer` |
48
+ | `python-patterns` | Python 3.10+: type hints, dataclasses, asyncio, pytest | `@backend-coder`, `@reviewer` |
49
+ | `refactor-guide` | Safe refactoring: tests-first, one transformation per commit | `@refactor-guide`, `@backend-coder` |
50
+ | `rust-patterns` | Ownership, traits, async/Tokio, error handling, smart pointers | `@backend-coder`, `@reviewer` |
42
51
  | `security-scan` | OWASP-based scanning, severity classification, PASS/FAIL verdict | `@security-auditor`, `@reviewer` |
43
- | `tdd-workflow` | Red-Green-Refactor cycle, AAA pattern, 80% coverage target | `@tester`, `@coder` |
52
+ | `tdd-workflow` | Red-Green-Refactor cycle, AAA pattern, 80% coverage target | `@tester`, `@backend-coder` |
44
53
  | `test-coverage` | Coverage gap analysis, TDD enforcement, write-test-first cycle | `@tester`, `@reviewer` |
45
54
 
46
55
  ---
@@ -178,7 +187,7 @@ Idiomatic Python 3.10+ patterns for production code: type hints with `TypeVar` a
178
187
 
179
188
  **Example invocation:**
180
189
  ```
181
- @coder Use the python-patterns skill to implement the data pipeline.
190
+ @backend-coder Use the python-patterns skill to implement the data pipeline.
182
191
  Prefer dataclasses for the value objects and asyncio for IO operations.
183
192
  ```
184
193
 
@@ -192,7 +201,7 @@ Idiomatic Go for production services: explicit error handling with wrapped error
192
201
 
193
202
  **Example invocation:**
194
203
  ```
195
- @coder Use the golang-patterns skill to implement the worker pool.
204
+ @backend-coder Use the golang-patterns skill to implement the worker pool.
196
205
  Use proper goroutine lifecycle management and context cancellation.
197
206
  ```
198
207
 
@@ -206,7 +215,7 @@ Modern Java 17+ patterns for production applications: records for immutable valu
206
215
 
207
216
  **Example invocation:**
208
217
  ```
209
- @coder Use the java-patterns skill to implement the OrderService.
218
+ @backend-coder Use the java-patterns skill to implement the OrderService.
210
219
  Use records for the command objects and constructor injection for dependencies.
211
220
  ```
212
221
 
@@ -220,7 +229,7 @@ Safe, idiomatic Rust: ownership and borrowing mental model (own vs borrow vs bor
220
229
 
221
230
  **Example invocation:**
222
231
  ```
223
- @coder Use the rust-patterns skill to implement the async HTTP client.
232
+ @backend-coder Use the rust-patterns skill to implement the async HTTP client.
224
233
  Use Tokio and ensure proper error propagation with the ? operator.
225
234
  ```
226
235
 
@@ -308,7 +317,7 @@ Branching strategy (feature branches from `main`, naming convention `feat/`, `fi
308
317
 
309
318
  **Example invocation:**
310
319
  ```
311
- @coder Use the git-workflow skill to commit the authentication changes.
320
+ @backend-coder Use the git-workflow skill to commit the authentication changes.
312
321
  Write a conventional commit message and create the PR.
313
322
  ```
314
323
 
@@ -380,8 +389,8 @@ Coordinates parallel agent execution for independent workstreams. Provides the W
380
389
 
381
390
  **Example invocation:**
382
391
  ```
383
- @parallel-coordinator Use the parallel-execute skill to run Wave 3 of the current plan.
384
- @coder and @tester are independent — start both simultaneously.
392
+ @orchestrator Use the parallel-execute skill to run Wave 3 of the current plan.
393
+ @backend-coder and @tester are independent — start both simultaneously.
385
394
  ```
386
395
 
387
396
  **When to use:** When a plan has tasks that can run simultaneously. The skill makes independence explicit so merge conflicts are caught before they occur.
package/docs/workflows.md CHANGED
@@ -20,7 +20,9 @@ FlowDeck commands are the single entry point for all operations. Each command em
20
20
  /fd-discuss → .planning/phases/phase-N/DISCUSS.md (locked decisions)
21
21
 
22
22
  /fd-plan → .planning/phases/phase-N/PLAN.md (confirmed plan)
23
-
23
+
24
+ /fd-design → design artifact + approval + handoff (UI-heavy tasks only)
25
+
24
26
  /fd-execute → implemented, tested, reviewed code (via TDD)
25
27
 
26
28
  /fd-verify → verification report (tests, review, security, deploy check)
@@ -28,7 +30,7 @@ FlowDeck commands are the single entry point for all operations. Each command em
28
30
  /fd-checkpoint → .planning/STATE.md saved
29
31
  ```
30
32
 
31
- Each step gates the next. `/fd-discuss` requires a defined feature. `/fd-plan` requires confirmed decisions from `DISCUSS.md`. `/fd-execute` requires a confirmed `PLAN.md`. `/fd-verify` confirms all checks pass before marking the feature as complete.
33
+ Each step gates the next. `/fd-discuss` requires a defined feature. `/fd-plan` requires confirmed decisions from `DISCUSS.md`. `/fd-design` is mandatory for UI-heavy tasks unless explicitly overridden. `/fd-execute` requires a confirmed `PLAN.md` and (for UI-heavy tasks) approved design handoff. `/fd-verify` confirms all checks pass before marking the feature as complete.
32
34
 
33
35
  ---
34
36
 
@@ -41,10 +43,11 @@ Each step gates the next. `/fd-discuss` requires a defined feature. `/fd-plan` r
41
43
  | `/fd-new-feature` | Initialize a new feature | @orchestrator |
42
44
  | `/fd-discuss` | Pre-planning discussion | @discusser |
43
45
  | `/fd-plan` | Generate a phase plan | @planner, @plan-checker |
46
+ | `/fd-design` | Run design-first planning/review/system modes | @design |
44
47
  | `/fd-ask` | Smart agent dispatch | various |
45
- | `/fd-execute` | Implement feature via TDD | @orchestrator, @coder, @tester, @reviewer |
48
+ | `/fd-execute` | Implement feature via TDD | @orchestrator, @backend-coder/@frontend-coder/@devops, @tester, @reviewer |
46
49
  | `/fd-verify` | Verify feature completion | @tester, @reviewer, @security-auditor |
47
- | `/fd-fix-bug` | Fix a bug with TDD | @debug-specialist, @tester, @coder |
50
+ | `/fd-fix-bug` | Fix a bug with TDD | @debug-specialist, @tester, @backend-coder/@frontend-coder/@devops |
48
51
  | `/fd-write-docs` | Generate documentation | @writer, @reviewer |
49
52
  | `/fd-deploy-check` | Pre-deploy safety check | @tester, @security-auditor, @reviewer |
50
53
  | `/fd-status` | View project progress | — |
@@ -53,7 +56,7 @@ Each step gates the next. `/fd-discuss` requires a defined feature. `/fd-plan` r
53
56
  | `/fd-multi-repo` | Multi-repo orchestration | @multi-repo-coordinator, @architect |
54
57
  | `/fd-translate-intent` | Convert vague requests to ranked implementation options | @architect, @researcher |
55
58
  | `/fd-suggest` | Suggest high-value feature opportunities from codebase signals | @researcher, @architect |
56
- | `/fd-quick` | Fast focused task execution | @coder or selected specialist |
59
+ | `/fd-quick` | Fast focused task execution | @backend-coder/@frontend-coder/@devops or selected specialist |
57
60
  | `/fd-reflect` | Post-session reflection and skill capture | @auto-learner |
58
61
  | `/fd-doctor` | Installation and environment diagnostics | @orchestrator |
59
62
 
@@ -115,7 +118,9 @@ argument-hint: [args]
115
118
  |-------|---------|
116
119
  | @orchestrator | Coordinates multi-step workflows |
117
120
  | @planner | Creates implementation plans |
118
- | @coder | Implements code changes |
121
+ | @backend-coder | Implements backend code changes |
122
+ | @frontend-coder | Implements frontend code changes |
123
+ | @devops | Implements infrastructure and operations changes |
119
124
  | @tester | Writes and runs tests |
120
125
  | @reviewer | Reviews code quality |
121
126
  | @researcher | Investigates and provides context |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dv.nghiem/flowdeck",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "FlowDeck — structured planning and execution workflows for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,6 +15,7 @@ Analyze `$ARGUMENTS` to determine the best specialist:
15
15
 
16
16
  | Keywords / Topic | Agent |
17
17
  |-----------------|-------|
18
+ | ui, ux, wireframe, landing page, dashboard, admin panel, app screen, design system | **@design** |
18
19
  | design, architecture, structure, system, component, API | **@architect** |
19
20
  | security, auth, vulnerability, token, permission, injection | **@security-auditor** |
20
21
  | performance, speed, slow, optimize, latency, cache, memory | **@performance** |