@dv.nghiem/flowdeck 0.3.8 → 0.4.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 (136) hide show
  1. package/README.md +13 -122
  2. package/dist/agents/code-explorer.d.ts.map +1 -1
  3. package/dist/agents/mapper.d.ts.map +1 -1
  4. package/dist/agents/orchestrator.d.ts.map +1 -1
  5. package/dist/agents/planner.d.ts.map +1 -1
  6. package/dist/agents/specialist.d.ts.map +1 -1
  7. package/dist/dashboard/server.mjs +12 -2
  8. package/dist/hooks/compaction-hook.d.ts.map +1 -1
  9. package/dist/hooks/file-tracker.d.ts +6 -0
  10. package/dist/hooks/file-tracker.d.ts.map +1 -1
  11. package/dist/hooks/notifications.d.ts.map +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +752 -785
  14. package/dist/lib/completion-validator.d.ts +51 -0
  15. package/dist/lib/completion-validator.d.ts.map +1 -0
  16. package/dist/lib/recommended-question.d.ts +24 -0
  17. package/dist/lib/recommended-question.d.ts.map +1 -0
  18. package/dist/lib/research-gate.d.ts +97 -0
  19. package/dist/lib/research-gate.d.ts.map +1 -0
  20. package/dist/lib/research-gate.test.d.ts +2 -0
  21. package/dist/lib/research-gate.test.d.ts.map +1 -0
  22. package/dist/mcp/index.d.ts +14 -3
  23. package/dist/mcp/index.d.ts.map +1 -1
  24. package/dist/services/codegraph.d.ts +36 -0
  25. package/dist/services/codegraph.d.ts.map +1 -0
  26. package/dist/services/codegraph.test.d.ts +2 -0
  27. package/dist/services/codegraph.test.d.ts.map +1 -0
  28. package/dist/services/command-validator.d.ts +11 -0
  29. package/dist/services/command-validator.d.ts.map +1 -1
  30. package/dist/services/preflight-explorer.d.ts +130 -0
  31. package/dist/services/preflight-explorer.d.ts.map +1 -0
  32. package/dist/services/preflight-explorer.test.d.ts +25 -0
  33. package/dist/services/preflight-explorer.test.d.ts.map +1 -0
  34. package/dist/services/question-guard.d.ts +96 -0
  35. package/dist/services/question-guard.d.ts.map +1 -0
  36. package/dist/services/quick-router.d.ts +40 -1
  37. package/dist/services/quick-router.d.ts.map +1 -1
  38. package/dist/services/recommended-question.test.d.ts +2 -0
  39. package/dist/services/recommended-question.test.d.ts.map +1 -0
  40. package/dist/services/supervisor-binding.d.ts +3 -1
  41. package/dist/services/supervisor-binding.d.ts.map +1 -1
  42. package/dist/tools/codebase-index.d.ts +30 -0
  43. package/dist/tools/codebase-index.d.ts.map +1 -0
  44. package/dist/tools/codebase-index.test.d.ts +2 -0
  45. package/dist/tools/codebase-index.test.d.ts.map +1 -0
  46. package/dist/tools/codegraph-tool.d.ts +3 -0
  47. package/dist/tools/codegraph-tool.d.ts.map +1 -0
  48. package/dist/tools/planning-state-lib.d.ts +23 -0
  49. package/dist/tools/planning-state-lib.d.ts.map +1 -1
  50. package/docs/agents/index.md +154 -0
  51. package/docs/commands/fd-ask.md +71 -39
  52. package/docs/commands/fd-checkpoint.md +63 -8
  53. package/docs/commands/fd-deploy-check.md +166 -9
  54. package/docs/commands/fd-design.md +101 -0
  55. package/docs/commands/fd-discuss.md +87 -20
  56. package/docs/commands/fd-doctor.md +100 -13
  57. package/docs/commands/fd-done.md +215 -0
  58. package/docs/commands/fd-execute.md +104 -0
  59. package/docs/commands/fd-fix-bug.md +144 -24
  60. package/docs/commands/fd-map-codebase.md +85 -21
  61. package/docs/commands/fd-multi-repo.md +155 -40
  62. package/docs/commands/fd-new-feature.md +63 -19
  63. package/docs/commands/fd-plan.md +80 -27
  64. package/docs/commands/fd-quick.md +143 -29
  65. package/docs/commands/fd-reflect.md +81 -13
  66. package/docs/commands/fd-resume.md +65 -8
  67. package/docs/commands/fd-status.md +80 -12
  68. package/docs/commands/fd-suggest.md +114 -0
  69. package/docs/commands/fd-translate-intent.md +69 -9
  70. package/docs/commands/fd-verify.md +71 -14
  71. package/docs/commands/fd-write-docs.md +121 -8
  72. package/docs/concepts/architecture.md +163 -0
  73. package/docs/concepts/governance.md +242 -0
  74. package/docs/concepts/intelligence.md +145 -0
  75. package/docs/concepts/multi-repo.md +227 -0
  76. package/docs/concepts/workflows.md +205 -0
  77. package/docs/configuration/index.md +208 -0
  78. package/docs/configuration/opencode-settings.md +98 -0
  79. package/docs/getting-started/first-project.md +126 -0
  80. package/docs/getting-started/installation.md +73 -0
  81. package/docs/getting-started/quick-start.md +74 -0
  82. package/docs/index.md +36 -72
  83. package/docs/reference/hooks.md +176 -0
  84. package/docs/reference/rules.md +109 -0
  85. package/docs/skills/code-review.md +47 -0
  86. package/docs/skills/index.md +148 -0
  87. package/docs/skills/planning.md +39 -0
  88. package/package.json +1 -1
  89. package/src/commands/fd-deploy-check.md +2 -2
  90. package/src/commands/fd-discuss.md +128 -7
  91. package/src/commands/fd-done.md +196 -0
  92. package/src/commands/fd-execute.md +43 -6
  93. package/src/commands/fd-fix-bug.md +43 -6
  94. package/src/commands/fd-map-codebase.md +100 -20
  95. package/src/commands/fd-multi-repo.md +1 -1
  96. package/src/commands/fd-new-feature.md +14 -5
  97. package/src/commands/fd-plan.md +38 -1
  98. package/src/commands/fd-quick.md +77 -14
  99. package/src/commands/fd-resume.md +1 -1
  100. package/src/commands/fd-status.md +1 -1
  101. package/src/commands/fd-verify.md +16 -2
  102. package/src/commands/fd-write-docs.md +30 -5
  103. package/src/rules/common/behavioral.md +63 -0
  104. package/src/skills/codebase-mapping/SKILL.md +1 -1
  105. package/src/skills/context-load/SKILL.md +1 -1
  106. package/src/skills/multi-repo/SKILL.md +1 -1
  107. package/src/skills/repo-memory-graph/SKILL.md +1 -1
  108. package/dist/hooks/memory-hook.d.ts +0 -28
  109. package/dist/hooks/memory-hook.d.ts.map +0 -1
  110. package/dist/services/memory-store.d.ts +0 -73
  111. package/dist/services/memory-store.d.ts.map +0 -1
  112. package/dist/services/memory-store.test.d.ts +0 -2
  113. package/dist/services/memory-store.test.d.ts.map +0 -1
  114. package/dist/tools/memory-search.d.ts +0 -3
  115. package/dist/tools/memory-search.d.ts.map +0 -1
  116. package/dist/tools/memory-status.d.ts +0 -3
  117. package/dist/tools/memory-status.d.ts.map +0 -1
  118. package/docs/USER_GUIDE.md +0 -20
  119. package/docs/agents.md +0 -544
  120. package/docs/best-practices.md +0 -47
  121. package/docs/commands/fd-new-project.md +0 -24
  122. package/docs/commands.md +0 -557
  123. package/docs/configuration.md +0 -325
  124. package/docs/design-first-workflow.md +0 -94
  125. package/docs/feature-integration-architecture.md +0 -227
  126. package/docs/installation.md +0 -123
  127. package/docs/intelligence.md +0 -370
  128. package/docs/memory.md +0 -69
  129. package/docs/multi-repo.md +0 -201
  130. package/docs/notifications.md +0 -170
  131. package/docs/optimization-baseline.md +0 -21
  132. package/docs/quick-start.md +0 -197
  133. package/docs/rules.md +0 -432
  134. package/docs/skills.md +0 -417
  135. package/docs/workflows.md +0 -134
  136. package/src/commands/fd-new-project.md +0 -114
@@ -0,0 +1,109 @@
1
+ # Language Rules
2
+
3
+ FlowDeck agents follow coding standards defined in `src/rules/`. Rules are loaded automatically at startup — no manual configuration required. They are injected into OpenCode's instructions as language-agnostic and language-specific guidance.
4
+
5
+ ## Rule Precedence
6
+
7
+ When guidance conflicts, FlowDeck resolves precedence in this order:
8
+
9
+ 1. Repository governance files (`AGENTS.md`, `CLAUDE.md`)
10
+ 2. FlowDeck plugin rules from `src/rules/**`
11
+ 3. Runtime policies from `.codebase/POLICIES.json`
12
+
13
+ ## Common Rules (All Languages)
14
+
15
+ Language-agnostic rules are in `src/rules/common/`:
16
+
17
+ | File | Description |
18
+ |------|-------------|
19
+ | `common/agent-orchestration.md` | When to use each FlowDeck agent and parallel execution patterns |
20
+ | `common/coding-style.md` | Immutability, KISS/DRY/YAGNI, file organization, error handling, naming |
21
+ | `common/testing.md` | TDD workflow, coverage thresholds, test types, AAA pattern |
22
+ | `common/security.md` | Pre-commit security checklist, secret management, OWASP Top 10 |
23
+ | `common/git-workflow.md` | Conventional commits, branch naming, PR workflow, rebase vs merge |
24
+ | `common/behavioral.md` | Agent behavioral expectations and interaction patterns |
25
+
26
+ ---
27
+
28
+ ## TypeScript / JavaScript
29
+
30
+ **Location:** `src/rules/typescript/`
31
+
32
+ **Framework conventions:** API response format, custom hooks, repository pattern, Result types.
33
+
34
+ | File | Description |
35
+ |------|-------------|
36
+ | `typescript/patterns.md` | TypeScript API response format, custom hooks, repository pattern, Result types |
37
+
38
+ FlowDeck TypeScript rules apply to all `.ts` and `.tsx` files in your project.
39
+
40
+ ---
41
+
42
+ ## Python
43
+
44
+ **Location:** `src/rules/python/`
45
+
46
+ **Framework conventions:** Pythonic patterns, typing, async conventions.
47
+
48
+ | File | Description |
49
+ |------|-------------|
50
+ | `python/patterns.md` | Pythonic API design, typing, async patterns |
51
+
52
+ FlowDeck Python rules apply to all `.py` files in your project.
53
+
54
+ ---
55
+
56
+ ## Go
57
+
58
+ **Location:** `src/rules/golang/`
59
+
60
+ **Framework conventions:** Go idiom conventions, error handling, concurrency patterns.
61
+
62
+ | File | Description |
63
+ |------|-------------|
64
+ | `golang/patterns.md` | Go idioms, error wrapping, goroutine patterns, module layout |
65
+
66
+ FlowDeck Go rules apply to all `.go` files in your project.
67
+
68
+ ---
69
+
70
+ ## Rust
71
+
72
+ **Location:** `src/rules/rust/`
73
+
74
+ **Framework conventions:** Rust idiom conventions, ownership, lifetimes, Result types.
75
+
76
+ | File | Description |
77
+ |------|-------------|
78
+ | `rust/patterns.md` | Rust idioms, ownership model, error handling with `Result`, lifetime annotations |
79
+
80
+ FlowDeck Rust rules apply to all `.rs` files in your project.
81
+
82
+ ---
83
+
84
+ ## Java
85
+
86
+ **Location:** `src/rules/java/`
87
+
88
+ **Framework conventions:** Java idiom conventions, OOP patterns, exception handling.
89
+
90
+ | File | Description |
91
+ |------|-------------|
92
+ | `java/patterns.md` | Java idioms, OOP conventions, exception handling, package layout |
93
+
94
+ FlowDeck Java rules apply to all `.java` files in your project.
95
+
96
+ ---
97
+
98
+ ## Overriding Default Rules
99
+
100
+ To load only specific rules, add them to the `instructions` array in `opencode.json`:
101
+
102
+ ```json
103
+ {
104
+ "instructions": [
105
+ "node_modules/@dv.nghiem/flowdeck/src/rules/common/coding-style.md",
106
+ "node_modules/@dv.nghiem/flowdeck/src/rules/typescript/patterns.md"
107
+ ]
108
+ }
109
+ ```
@@ -0,0 +1,47 @@
1
+ # Code Quality Skills
2
+
3
+ These skills enforce FlowDeck's "working code only" guarantee — systematic review, test-driven discipline, and coverage enforcement that catches real problems before they reach production.
4
+
5
+ ---
6
+
7
+ ## code-review
8
+
9
+ Systematic review with security checklist and severity-ranked findings.
10
+
11
+ Reviews only changed code, reports only confirmed issues (80%+ confidence), and provides actionable fixes for every finding. Findings are ranked Critical then High then Medium then Pass. Security checklist runs first — SQL injection, XSS, hardcoded credentials, path traversal — before quality and performance checks.
12
+
13
+ ---
14
+
15
+ ## tdd-workflow
16
+
17
+ Red-green-refactor discipline with 80%+ coverage enforcement.
18
+
19
+ Tests before code. Always. The workflow: write a failing test (Red), write minimum code to pass (Green), then refactor while keeping tests green. Coverage threshold is 80% line coverage — non-negotiable. Unit tests for every function, integration tests for every API route, E2E only for critical paths.
20
+
21
+ ---
22
+
23
+ ## test-coverage
24
+
25
+ Coverage enforcement with pass/fail thresholds and actionable failure output.
26
+
27
+ Drives the write-test-then-implement cycle. Enforces 80% minimum line coverage. When coverage drops below threshold or a gap is found, the report identifies exact uncovered lines with file and line number so the agent knows exactly what to add.
28
+
29
+ ---
30
+
31
+ ## test-gap-detector
32
+
33
+ Identifies uncovered edge cases and suggests minimum viable test sets.
34
+
35
+ Runs before implementing a feature or fix. Checks whether modified files have test counterparts, scans for untested if/else/catch branches, flags integration gaps for external calls (db, fetch, email), and cross-references `.codebase/FAILURES.json` for regression risk. Output is a ranked gap list and 3-5 suggested test skeletons.
36
+
37
+ ---
38
+
39
+ ## refactor-guide
40
+
41
+ Safe refactoring one transformation at a time — tests must stay green throughout.
42
+
43
+ One transformation per commit. No features in refactor commits. If any test breaks, undo and try a smaller step. Applies the extract-function, extract-variable, and rename patterns. Danger signs that stop the refactor immediately: tests breaking during refactor, adding features during refactor, renaming and moving in the same commit.
44
+
45
+ ---
46
+
47
+ Source: `src/skills/<name>/SKILL.md` in the project repository.
@@ -0,0 +1,148 @@
1
+ # Skills
2
+
3
+ Skills are reusable workflow patterns that encode FlowDeck's best practices into automated agents. Each skill is a self-contained unit with activation triggers, core principles, and step-by-step workflows.
4
+
5
+ ## How to Activate
6
+
7
+ Skills activate in two ways:
8
+
9
+ - **Slash command**: Type `/<skill-name>` (e.g., `/fd-plan`, `/fd-code-review`)
10
+ - **Auto-trigger**: FlowDeck hooks can invoke skills automatically based on context (e.g., `code-review` triggers after every code write, `deploy-check` before any deploy)
11
+
12
+ ## Skill Taxonomy
13
+
14
+ ### Planning & Requirements
15
+
16
+ | Skill | Description |
17
+ |-------|-------------|
18
+ | `plan-task` | Wave-structured task breakdown for multi-file features |
19
+ | `confidence-aware-planning` | Uncertainty-aware estimates — asks clarifying questions when confidence is low |
20
+ | `intent-translator` | Converts vague requests ("make it faster") into ranked implementation options with tradeoffs |
21
+ | `decision-trace` | Records why changes were made, what evidence was used, and what assumptions were made |
22
+
23
+ Source files live in `src/skills/<name>/SKILL.md` in the project repository.
24
+
25
+ ### Architecture
26
+
27
+ | Skill | Description |
28
+ |-------|-------------|
29
+ | `clean-architecture` | Layered architecture with independent use cases |
30
+ | `hexagonal-architecture` | Ports-and-adapters pattern for testable business logic |
31
+ | `layered-architecture` | Traditional UI / business logic / data layer separation |
32
+ | `ddd-architecture` | Domain-driven design with bounded contexts and aggregates |
33
+ | `saga-architecture` | Distributed transaction pattern for microservices |
34
+ | `event-driven-architecture` | Event-based decoupling between services |
35
+ | `cqrs` | Command-query responsibility segregation for read/write optimization |
36
+
37
+ ### Code Quality
38
+
39
+ | Skill | Description |
40
+ |-------|-------------|
41
+ | `code-review` | Systematic review with security checklist and severity-ranked findings |
42
+ | `tdd-workflow` | Red-green-refactor discipline with 80%+ coverage enforcement |
43
+ | `test-coverage` | Coverage enforcement with pass/fail thresholds |
44
+ | `test-gap-detector` | Identifies uncovered edge cases and suggests minimum viable test sets |
45
+ | `refactor-guide` | Safe refactoring patterns — one transformation per commit, tests stay green |
46
+
47
+ Source files live in `src/skills/<name>/SKILL.md` in the project repository.
48
+
49
+ ### Security
50
+
51
+ | Skill | Description |
52
+ |-------|-------------|
53
+ | `security-scan` | Scans for OWASP vulnerabilities, injection risks, and credential leakage |
54
+ | `patch-trust-score` | Scores patch reliability based on changelog, age, and publisher reputation |
55
+ | `arch-constraint-guard` | Enforces architectural constraints at commit time |
56
+ | `self-healing-policies` | Automatic rollback and recovery policies for failed deployments |
57
+
58
+ ### Deployment
59
+
60
+ | Skill | Description |
61
+ |-------|-------------|
62
+ | `deploy-check` | Pre-deploy safety verification — runs tests, checks coverage, validates config |
63
+ | `git-release` | Semantic version tagging and CHANGELOG generation for releases |
64
+
65
+ ### Performance
66
+
67
+ | Skill | Description |
68
+ |-------|-------------|
69
+ | `performance-profiling` | Identifies hot paths and memory bottlenecks from profiling data |
70
+ | `volatility-map` | Maps codebase areas by change frequency to predict impact zones |
71
+ | `blast-radius-preview` | Estimates blast radius of a proposed change before it is merged |
72
+ | `dependency-audit` | Scans for outdated, vulnerable, or circular dependencies |
73
+
74
+ ### Frontend
75
+
76
+ | Skill | Description |
77
+ |-------|-------------|
78
+ | `frontend-pattern` | General frontend implementation patterns |
79
+ | `ui-design` | Component-level UI design patterns |
80
+ | `landing-page-design` | Landing page layout and conversion patterns |
81
+ | `dashboard-design` | Dashboard layout and data visualization patterns |
82
+ | `design-tokens` | Design tokens for consistent theming |
83
+ | `app-shell-design` | Application shell and navigation patterns |
84
+ | `wireframe-planning` | Low-fidelity wireframe to structured layout planning |
85
+ | `design-audit` | Design consistency and accessibility review |
86
+ | `ui-ux-planning` | Full UI/UX planning from user flow to component specs |
87
+ | `responsive-review` | Responsive design verification across breakpoints |
88
+ | `frontend-handoff` | Design-to-code handoff specification |
89
+
90
+ ### Backend
91
+
92
+ | Skill | Description |
93
+ |-------|-------------|
94
+ | `backend-patterns` | General backend service patterns |
95
+ | `golang-patterns` | Go-specific patterns (goroutines, channels, error handling) |
96
+ | `java-patterns` | Java/JVM patterns (Spring, concurrency) |
97
+ | `python-patterns` | Python patterns (async, dataclasses, typing) |
98
+ | `rust-patterns` | Rust patterns (ownership, traits, concurrency) |
99
+ | `postgres-patterns` | PostgreSQL schema, query, and indexing patterns |
100
+ | `django-patterns` | Django-specific patterns (ORM, views, middleware) |
101
+ | `django-tdd` | Django test-driven development workflow |
102
+
103
+ ### Intelligence
104
+
105
+ | Skill | Description |
106
+ |-------|-------------|
107
+ | `failure-replay-engine` | Replays past failures to understand root causes |
108
+ | `regression-prediction` | Predicts which files are likely to break from a given change |
109
+ | `repo-memory-graph` | Builds a semantic graph of codebase knowledge |
110
+ | `decision-trace` | Records decision rationale for future review |
111
+ | `volatility-map` | Maps change frequency to identify stable vs. volatile areas |
112
+
113
+ ### Workflow
114
+
115
+ | Skill | Description |
116
+ |-------|-------------|
117
+ | `git-workflow` | Git branch strategy, commit conventions, and PR workflow |
118
+ | `agent-harness-construction` | How to construct and wire agents together |
119
+ | `context-load` | Strategies for loading context efficiently |
120
+ | `debug-flow` | Systematic debugging workflow |
121
+ | `documentation-writer` | Generates documentation from code structure |
122
+ | `human-review-routing` | Routes review requests to appropriate reviewers |
123
+
124
+ ### More
125
+
126
+ Additional skills: `api-design`, `codebase-mapping`, `codebase-onboarding`, `code-tour`, `design-system-definition`, `multi-repo`.
127
+
128
+ ## Skill File Structure
129
+
130
+ Each skill lives in `src/skills/<name>/SKILL.md` with YAML frontmatter:
131
+
132
+ ```yaml
133
+ ---
134
+ name: skill-name
135
+ description: One-line description of what the skill does
136
+ origin: FlowDeck
137
+ ---
138
+
139
+ # Skill Title
140
+
141
+ Step-by-step workflow description...
142
+ ```
143
+
144
+ ## Adding New Skills
145
+
146
+ 1. Create `src/skills/<name>/SKILL.md` with frontmatter
147
+ 2. Add the skill path to the OpenCode plugin config in `src/index.ts`
148
+ 3. Skills become available immediately — no rebuild required
@@ -0,0 +1,39 @@
1
+ # Planning Skills
2
+
3
+ These skills handle the "thinking before coding" phase — turning vague requests into concrete, executable plans with verifiable success criteria.
4
+
5
+ ---
6
+
7
+ ## plan-task
8
+
9
+ Wave-structured task breakdown for multi-file features.
10
+
11
+ Breaks complex features into phased wave-based plans. Each step maps to a file, has a verification check, and fits within a working session. Foundation-first ordering: types then data then services then routes then UI.
12
+
13
+ ---
14
+
15
+ ## confidence-aware-planning
16
+
17
+ Uncertainty-aware estimates that signal low confidence instead of guessing.
18
+
19
+ Adjusts planning behavior based on how certain the agent is. HIGH confidence proceeds normally. MEDIUM confidence surfaces explicit assumptions and risks. LOW confidence stops and asks clarifying questions before writing a plan.
20
+
21
+ ---
22
+
23
+ ## intent-translator
24
+
25
+ Converts vague requests into ranked implementation options with tradeoffs.
26
+
27
+ Takes input like "make checkout faster" and produces a ranked menu of 3-5 concrete options with file scope, effort estimates, risk ratings, and explicit tradeoffs — before any code is written. Stops and asks clarifying questions when intent is genuinely ambiguous.
28
+
29
+ ---
30
+
31
+ ## decision-trace
32
+
33
+ Records why the agent changed something, what evidence was used, and what assumptions were made.
34
+
35
+ Creates an append-only audit trail in `.codebase/DECISIONS.jsonl` for every non-trivial edit. Code reviewers can query decisions for any file in the diff and immediately understand the "why" without asking the author. Rationale answers "why this approach and not the obvious alternative?"
36
+
37
+ ---
38
+
39
+ Source: `src/skills/<name>/SKILL.md` in the project repository.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dv.nghiem/flowdeck",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "FlowDeck — structured planning and execution workflows for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -89,7 +89,7 @@ Required fixes before deploy:
89
89
  - [ ] [fix 1]
90
90
  - [ ] [fix 2]
91
91
 
92
- Run /deploy-check again after fixing.
92
+ Run /fd-deploy-check again after fixing.
93
93
  ```
94
94
 
95
95
  ## No-go conditions (automatic)
@@ -102,7 +102,7 @@ Any of these → automatic NO-GO:
102
102
 
103
103
  ### Step 4: Code Review Scope (--check=review)
104
104
 
105
- If `/deploy-check --check=review [scope]` provided: review files matching scope.
105
+ If `/fd-deploy-check --check=review [scope]` provided: review files matching scope.
106
106
  If no scope: review all files changed since last commit.
107
107
 
108
108
  ```bash
@@ -11,16 +11,90 @@ Run a structured requirements discussion session and capture decisions.
11
11
 
12
12
  ## Pre-flight
13
13
 
14
- 1. Check `.planning/STATE.md` exists — if not, return error: "Run /fd-new-project first."
14
+ 1. Check `.planning/STATE.md` exists — if not, return error: "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
15
15
  2. Read current phase from STATE.md.
16
16
  3. Create `.planning/phases/phase-<N>/` directory if it does not exist.
17
17
 
18
18
  ## Process
19
19
 
20
+ ### Step 0: CodeGraph Intelligence Check
21
+
22
+ **Before any exploration**, check if codegraph provides existing code understanding:
23
+
24
+ ```
25
+ codegraph action=check
26
+ ```
27
+
28
+ - **If codegraph is installed and indexed (fresh)**: Use codegraph MCP tools to answer architecture, structure, and pattern questions directly. Prefer `codegraph_context`, `codegraph_search`, `codegraph_explore` over file reads.
29
+ - Log: "codegraph available — using code intelligence index for preflight exploration"
30
+ - **If codegraph index is stale or has changed files**: Log "codegraph index may be stale — prefer direct verification for recent changes"
31
+ - **If codegraph is not installed or not indexed**: Log "codegraph not available — will explore via @code-explorer"
32
+
33
+ Use codegraph status to decide how Step 0 autonomous exploration is performed.
34
+
35
+ ### Step 0b: Autonomous Codebase Exploration
36
+
37
+ **Before asking the user any question**, explore the repository to gather evidence.
38
+
39
+ **If codegraph is available (indexed and fresh):**
40
+ Use codegraph MCP tools directly for:
41
+ 1. **Project structure** — `codegraph_context` to map entry points and module layout
42
+ 2. **Tech stack detection** — `codegraph_files` and `codegraph_explore` on package manifests
43
+ 3. **Implementation patterns** — `codegraph_explore` on `src/` for service/component patterns
44
+ 4. Skip or minimally use @code-explorer — codegraph already provides the index
45
+
46
+ **If codegraph is NOT available:**
47
+ Invoke `@code-explorer` to inspect:
48
+ 1. **Project files** — `.planning/PROJECT.md` (goals, tech stack, constraints)
49
+ 2. **Session state** — `.planning/STATE.md` (current phase, prior decisions)
50
+ 3. **Prior discussions** — `.planning/phases/*/DISCUSS.md` (already-captured decisions)
51
+ 4. **Tech stack** — `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`
52
+ 5. **Implementation patterns** — `src/` directory structure (services, components, api, etc.)
53
+ 6. **AGENTS.md / rules** — any project-level constraints or conventions
54
+ 7. **Relevant source files** — files matching keywords in `$ARGUMENTS`
55
+
56
+ In both cases, read:
57
+ - `.planning/phases/*/DISCUSS.md` for prior decisions
58
+ - `.codebase/CODEGRAPH.md` for codegraph index metadata if available
59
+
60
+ Store exploration findings in the discussion context. These will be used to:
61
+ - Skip questions whose answers are already known from the codebase
62
+ - Inform the `@discusser` agent with concrete evidence
63
+ - Prevent worker agents from emitting questions to the user
64
+
65
+
66
+ 1. **Project files** — `.planning/PROJECT.md` (goals, tech stack, constraints)
67
+ 2. **Session state** — `.planning/STATE.md` (current phase, prior decisions)
68
+ 3. **Prior discussions** — `.planning/phases/*/DISCUSS.md` (already-captured decisions)
69
+ 4. **Tech stack** — `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`
70
+ 5. **Implementation patterns** — `src/` directory structure (services, components, api, etc.)
71
+ 6. **AGENTS.md / rules** — any project-level constraints or conventions
72
+ 7. **Relevant source files** — files matching keywords in `$ARGUMENTS`
73
+
74
+ Store exploration findings in the discussion context. These will be used to:
75
+ - Skip questions whose answers are already known from the codebase
76
+ - Inform the `@discusser` agent with concrete evidence
77
+ - Prevent worker agents from emitting questions to the user
78
+
79
+ ### Question suppression rule
80
+
81
+ After exploration, apply the question guard before each `@discusser` question:
82
+
83
+ > A `@discusser` question is skipped if:
84
+ > 1. The answer already exists in `PROJECT.md`, `STATE.md`, or prior `DISCUSS.md` files
85
+ > 2. The answer is determinable from the tech stack / implementation patterns
86
+ > 3. The question was already answered in a prior session for this phase
87
+
88
+ If a question is suppressed, record it in the DISCUSS.md `## Suppressed Questions` section
89
+ with the evidence that answered it.
90
+
20
91
  ### Step 1: Load Context
21
92
 
22
93
  Read `.planning/PROJECT.md` to understand the project vision and goals.
23
94
  Read `.planning/STATE.md` to determine the current phase and context.
95
+ Read any prior `.planning/phases/phase-<N>/DISCUSS.md` for existing decisions.
96
+
97
+ Use exploration findings (from Step 0) to populate the discusser's starting context.
24
98
 
25
99
  ### Step 2: Determine Phase
26
100
 
@@ -32,11 +106,31 @@ Decisions will be saved to `.planning/phases/phase-{N}/DISCUSS.md`.
32
106
  Spawn @discusser agent with:
33
107
  - Project context (from PROJECT.md)
34
108
  - Current phase number
35
- - Instructions to ask ONE question per turn
109
+ - **Preflight exploration findings** the full ExplorationResult from Step 0, including:
110
+ - `techStack`: detected tech stack (e.g. ["Node.js / JavaScript / TypeScript"])
111
+ - `availableAgents`: list of registered agents
112
+ - `availableCommands`: list of available commands
113
+ - `implementationPatterns`: detected patterns (e.g. ["service layer", "agent architecture"])
114
+ - `evidenceItems`: evidence that can answer common questions
115
+ - `hasPriorDiscussions`: whether prior DISCUSS.md files exist
116
+ - Instructions to ask ONE question per turn using the RecommendedQuestion format
117
+ - Instructions to skip questions already answered by exploration evidence
36
118
 
37
119
  ### Step 4: Q&A Loop
38
120
 
39
- The @discusser agent asks one question at a time.
121
+ The @discusser agent asks one question at a time using the RecommendedQuestion format.
122
+
123
+ Before each question:
124
+ 1. Question guard check:
125
+ - If the question can be answered from exploration evidence → skip it, record as suppressed
126
+ - If the question was already asked in a prior session for this phase → skip it
127
+ - Otherwise → proceed to validation
128
+ 2. Recommendation validation:
129
+ - Parse the question block with `parseQuestionBlocks()`
130
+ - Validate with `validateRecommendedQuestion()`
131
+ - If validation fails (bare question, missing fields) → return a rewrite hint to @discusser
132
+ - If validation passes → format with `formatRecommendedQuestion()` and present to the user
133
+
40
134
  After each user response:
41
135
  - Assign D-XX number to any new decision
42
136
  - Record: topic, choice, rationale
@@ -44,7 +138,7 @@ After each user response:
44
138
 
45
139
  Continue until all required topics are covered or user says to stop early.
46
140
 
47
- Structure the discussion:
141
+ Structure the discussion (skip topics already answered by exploration):
48
142
 
49
143
  1. **Scope** — What exactly needs to be built/changed? What is out of scope?
50
144
  2. **Constraints** — Technical constraints, deadlines, dependencies?
@@ -53,6 +147,7 @@ Structure the discussion:
53
147
  5. **UI classification** — Is this task user-facing and UI-heavy (website/app/dashboard/admin/landing/onboarding)?
54
148
 
55
149
  Ask questions one at a time. Wait for answers before proceeding.
150
+ Do not ask about things the codebase already reveals.
56
151
 
57
152
  ## Decision Recording
58
153
 
@@ -65,12 +160,35 @@ After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
65
160
  **Date:** <timestamp>
66
161
  **Topic:** <topic>
67
162
 
163
+ ## Preflight Evidence Used
164
+
165
+ - Tech stack: <detected stack>
166
+ - Prior decisions loaded: <yes/no>
167
+ - Questions suppressed by evidence: <N>
168
+
68
169
  ## Decisions
69
170
 
70
171
  D-01: [Topic] — [Decision] ([Rationale])
71
172
  D-02: [Topic] — [Decision] ([Rationale])
72
173
  ...
73
174
 
175
+ ## Answered Recommendations
176
+
177
+ RQ-01: [question]
178
+ Recommendation: [the recommended answer]
179
+ User choice: [what they said]
180
+ Rationale: [why the system recommended it]
181
+ Asked by: discusser
182
+ Stage: discuss
183
+ Timestamp: <ISO 8601>
184
+ ...
185
+
186
+ ## Suppressed Questions
187
+
188
+ (Questions that were answered by repo evidence and not asked of the user)
189
+ - "<question>" → answered by: <evidence source>
190
+ ...
191
+
74
192
  ## Open Questions
75
193
 
76
194
  - <any unresolved items>
@@ -83,19 +201,22 @@ D-02: [Topic] — [Decision] ([Rationale])
83
201
  ## D-05 Compliance
84
202
 
85
203
  - Loads PROJECT.md + current phase STATE.md
86
- - Invokes @discusser agent
204
+ - **Performs codebase exploration before any question is asked (Step 0)**
205
+ - Invokes @discusser agent with full exploration context
87
206
  - Saves decisions with D-XX numbering to DISCUSS.md
88
207
  - One question at a time (no compound questions)
208
+ - Questions suppressed when answered by evidence
89
209
 
90
210
  ## Completion
91
211
 
92
- Report: decisions captured, file path, and suggest running `/fd-plan`.
212
+ Report: decisions captured, questions suppressed, file path, and suggest running `/fd-plan`.
93
213
  If UI-heavy, also suggest running `/fd-design --mode=draft` before `/fd-execute`.
94
214
 
95
215
  ## Error Handling
96
216
 
97
217
  D-03: Fail fast with clear error
98
- - If PROJECT.md not found: error with "Run /fd-new-project first"
218
+ - If PROJECT.md not found: proceed without it (PROJECT.md is optional in the new flow; codebase context is provided by `.codebase/`)
99
219
  - If STATE.md not found: error with "Project not initialized"
100
220
  - If @discusser fails: error with "Discusser agent unavailable"
221
+ - If @code-explorer fails during preflight: proceed with reduced evidence (log warning)
101
222
  - No partial state saved on error