@dv.nghiem/flowdeck 0.3.8 → 0.3.9

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.
package/README.md CHANGED
@@ -172,104 +172,3 @@ Agents not listed in `agents` inherit the active OpenCode model. See [Configurat
172
172
  ## License
173
173
 
174
174
  MIT
175
-
176
-
177
- ---
178
-
179
- ## Quick Install
180
-
181
- ### Method 1: curl (recommended)
182
-
183
- ```bash
184
- curl -fsSL https://raw.githubusercontent.com/DVNghiem/flowdeck/main/install.sh | bash
185
- ```
186
-
187
- ### Method 2: npx (no git required)
188
-
189
- ```bash
190
- npx @dv.nghiem/flowdeck install
191
- ```
192
-
193
- See [Installation](docs/installation.md) for prerequisites, verification steps, and environment variables.
194
-
195
- ---
196
-
197
- ## Core Workflow
198
-
199
- FlowDeck structures every feature through a six-step cycle:
200
-
201
- ```
202
- /fd-new-project → /fd-new-feature → /fd-discuss → /fd-plan → /fd-execute → /fd-verify
203
- ```
204
-
205
- | Step | Command | What happens |
206
- |------|---------|--------------|
207
- | **Setup** | `/fd-new-project MyApp` | Creates `.planning/` directory with `PROJECT.md`, `STATE.md`, and `ROADMAP.md` |
208
- | **Define Feature** | `/fd-new-feature "…"` | Initialize feature context, creates `FEATURE.md` in current phase |
209
- | **Discuss** | `/fd-discuss` | `@discusser` runs structured Q&A, saves decisions to `DISCUSS.md` |
210
- | **Plan** | `/fd-plan` | `@planner` builds a wave-structured `PLAN.md`; you type `CONFIRM` to proceed |
211
- | **Execute** | `/fd-execute` | `@orchestrator` delegates to `@architect`, `@backend-coder`, `@tester`, `@reviewer` via TDD |
212
- | **Verify** | `/fd-verify` | Full test suite, code review, security scan, and deploy check |
213
-
214
- State is written to `.planning/STATE.md` after each phase. Use `/fd-checkpoint` to save mid-session and `/fd-resume` to reload context in a new session.
215
-
216
- ---
217
-
218
- ## Command Reference
219
-
220
- ### Workflow commands
221
-
222
- | Command | Purpose |
223
- |---------|---------|
224
- | `/fd-new-project` | Bootstrap a new project with PROJECT.md, ROADMAP.md, STATE.md |
225
- | `/fd-map-codebase` | Analyse and index the codebase into structured `.codebase/` files |
226
- | `/fd-new-feature` | Define a new feature and initialize feature context |
227
- | `/fd-discuss` | Pre-planning structured Q&A to capture decisions |
228
- | `/fd-plan` | Generate a wave-structured execution plan from decisions |
229
- | `/fd-execute` | Implement feature with TDD discipline and parallel agents |
230
- | `/fd-verify` | Full verification pipeline: tests, code review, security scan, deploy check |
231
- | `/fd-fix-bug` | Diagnose, fix, and verify a bug with regression test |
232
- | `/fd-write-docs` | Explore APIs and generate accurate documentation |
233
- | `/fd-deploy-check` | Pre-deploy safety check with test, security, and build verification |
234
- | `/fd-status` | View project progress, roadmap, and workspace overview |
235
- | `/fd-checkpoint` | Save a session checkpoint to STATE.md |
236
- | `/fd-resume` | Reload STATE.md and PLAN.md to continue interrupted session |
237
- | `/fd-reflect` | Post-session reflection or capture patterns as reusable skills |
238
- | `/fd-multi-repo` | Multi-repo orchestration — list, add, remove, or status |
239
- | `/fd-translate-intent` | Convert vague requests into ranked implementation options |
240
- | `/fd-suggest` | Analyze the codebase and suggest high-value feature opportunities |
241
- | `/fd-ask` | Smart agent dispatch — routes to specialist by keyword |
242
- | `/fd-quick` | Focused task with automatic agent selection |
243
- | `/fd-doctor` | Check FlowDeck installation and environment health |
244
-
245
- ### Analysis commands
246
-
247
- These umbrella commands consolidate multiple analysis modules into focused entry points:
248
-
249
- | Command | Purpose |
250
- |---------|---------|
251
- | `/fd-translate-intent` | Convert vague requests into ranked implementation options with tradeoffs |
252
- | `/fd-suggest` | Combined opportunity and risk analysis (impact, volatility, failures, and skill gaps) |
253
- | `/fd-deploy-check` | Pre-change release safety checks and review routing |
254
- | `/fd-verify` | Standalone verification for tests, review, and security checks |
255
-
256
- See [docs/workflows.md](docs/workflows.md) for details on how analysis commands work.
257
-
258
- ---
259
-
260
- ## Documentation
261
-
262
- | File | Description |
263
- |------|-------------|
264
- | [docs/index.md](docs/index.md) | Full documentation table of contents |
265
- | [docs/installation.md](docs/installation.md) | Prerequisites, install methods, verification, and uninstall |
266
- | [docs/quick-start.md](docs/quick-start.md) | First 15 minutes — step-by-step walkthrough |
267
- | [docs/configuration.md](docs/configuration.md) | `opencode.json`, project config, environment variables, plugin tools |
268
- | [docs/USER_GUIDE.md](docs/USER_GUIDE.md) | Full agent and skill usage reference with examples |
269
- | [docs/workflows.md](docs/workflows.md) | Command architecture and workflow patterns |
270
-
271
- ---
272
-
273
- ## License
274
-
275
- MIT
@@ -6,7 +6,8 @@
6
6
  * Context includes:
7
7
  * 1. FlowDeck planning state (phase, status, pending steps)
8
8
  * 2. Recently edited files (from SessionFileTracker)
9
- * 3. Structured 8-section summary prompt
9
+ * 3. Historical session summaries from memory store
10
+ * 4. Structured 8-section summary prompt
10
11
  *
11
12
  * Inspired by oh-my-openagent's compaction-context-injector and
12
13
  * ECC's experimental.session.compacting handler.
@@ -1 +1 @@
1
- {"version":3,"file":"compaction-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/compaction-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAoDxD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,OAAO,EAAE,kBAAkB,IAGzB,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC7B,QAAQ;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,mBA8BjD"}
1
+ {"version":3,"file":"compaction-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/compaction-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAqDxD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,OAAO,EAAE,kBAAkB,IAGzB,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC7B,QAAQ;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,mBAsCjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../src/hooks/session-start.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkElC"}
1
+ {"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../src/hooks/session-start.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAwElC"}
package/dist/index.js CHANGED
@@ -2452,7 +2452,7 @@ async function guardRailsHook(ctx, input, _output) {
2452
2452
  if (!existsSync18(planningDirPath))
2453
2453
  return;
2454
2454
  if (!existsSync18(codebaseDirectory)) {
2455
- throw new Error(`[flowdeck] WARNING: .codebase/ not found. Run /map-codebase to map the codebase.`);
2455
+ throw new Error(`[flowdeck] WARNING: .codebase/ not found. Run /fd-map-codebase to map the codebase.`);
2456
2456
  }
2457
2457
  const execMode = resolveExecutionMode(configPath, null);
2458
2458
  if (execMode === "review-only") {
@@ -2691,6 +2691,7 @@ async function sessionStartHook(ctx) {
2691
2691
  flowdeck_status: "no_plan",
2692
2692
  flowdeck_warning: "Run /fd-new-project or /fd-map-codebase to initialize.",
2693
2693
  flowdeck_has_codebase: existsSync20(codebaseDirectory),
2694
+ flowdeck_session_context: getContextForDirectory(ctx.directory),
2694
2695
  ...workspaceRoot && config?.sub_repos ? {
2695
2696
  flowdeck_workspace_root: workspaceRoot,
2696
2697
  flowdeck_sub_repos: config.sub_repos,
@@ -2704,12 +2705,14 @@ async function sessionStartHook(ctx) {
2704
2705
  const content = readFileSync17(stateFilePath, "utf-8");
2705
2706
  const state = parseState(content);
2706
2707
  const currentPhase = state["current_phase"] || {};
2708
+ const sessionContext = getContextForDirectory(ctx.directory);
2707
2709
  const result = {
2708
2710
  flowdeck_phase: currentPhase["phase"] ?? null,
2709
2711
  flowdeck_status: currentPhase["status"] ?? null,
2710
2712
  flowdeck_steps_pending: currentPhase["steps_pending"] ?? null,
2711
2713
  flowdeck_last_action: currentPhase["last_action"] ?? null,
2712
- flowdeck_has_codebase: existsSync20(codebaseDirectory)
2714
+ flowdeck_has_codebase: existsSync20(codebaseDirectory),
2715
+ flowdeck_session_context: sessionContext
2713
2716
  };
2714
2717
  if (workspaceRoot && config?.sub_repos && config.sub_repos.length > 0) {
2715
2718
  result.flowdeck_workspace_root = workspaceRoot;
@@ -2724,7 +2727,8 @@ async function sessionStartHook(ctx) {
2724
2727
  flowdeck_phase: null,
2725
2728
  flowdeck_status: "error",
2726
2729
  flowdeck_warning: "State file unreadable. Continuing without flowdeck context.",
2727
- flowdeck_has_codebase: existsSync20(codebaseDirectory)
2730
+ flowdeck_has_codebase: existsSync20(codebaseDirectory),
2731
+ flowdeck_session_context: getContextForDirectory(ctx.directory)
2728
2732
  };
2729
2733
  if (workspaceRoot && config?.sub_repos && config.sub_repos.length > 0) {
2730
2734
  result.flowdeck_workspace_root = workspaceRoot;
@@ -3366,6 +3370,12 @@ function createCompactionHook(ctx, tracker) {
3366
3370
  sections.push(`- … and ${edited.length - 20} more`);
3367
3371
  sections.push("");
3368
3372
  }
3373
+ const sessionContext = getContextForDirectory(ctx.directory);
3374
+ if (sessionContext) {
3375
+ sections.push("## Previous Sessions Context");
3376
+ sections.push(sessionContext);
3377
+ sections.push("");
3378
+ }
3369
3379
  output.context.push(sections.join(`
3370
3380
  `));
3371
3381
  output.prompt = STRUCTURED_SUMMARY_PROMPT.trim();
@@ -3568,6 +3578,15 @@ function createFlowDeckMcps() {
3568
3578
  oauth: false
3569
3579
  };
3570
3580
  }
3581
+ if (!disabled.has("github")) {
3582
+ mcps.github = {
3583
+ type: "remote",
3584
+ url: "https://api.githubcopilot.com/mcp/",
3585
+ enabled: true,
3586
+ ...process.env.GITHUB_TOKEN ? { headers: { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } } : {},
3587
+ oauth: false
3588
+ };
3589
+ }
3571
3590
  return mcps;
3572
3591
  }
3573
3592
 
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * FlowDeck built-in MCP server configurations.
3
3
  *
4
- * Three free, read-only remote MCPs are enabled by default:
4
+ * Four free, read-only remote MCPs are enabled by default:
5
5
  * - context7 https://mcp.context7.com/mcp (library docs lookup)
6
6
  * - websearch https://mcp.exa.ai/mcp (web search via Exa)
7
7
  * - grep_app https://mcp.grep.app (code search)
8
+ * - github https://api.githubcopilot.com/mcp/ (GitHub code search)
8
9
  *
9
- * Disable individual MCPs with: FLOWDECK_DISABLE_MCP=context7,websearch,grep_app
10
+ * Disable individual MCPs with: FLOWDECK_DISABLE_MCP=context7,websearch,grep_app,github
10
11
  */
11
12
  type RemoteMcp = {
12
13
  type: "remote";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAOD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAuC9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAOD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAmD9D"}
@@ -43,6 +43,17 @@ export declare function auditTextForInvalidCommands(text: string): AuditResult;
43
43
  * a note that the command is unavailable. Leaves valid commands untouched.
44
44
  */
45
45
  export declare function rewriteInvalidCommandRefs(text: string): string;
46
+ /**
47
+ * Combined full audit: checks both invalid /fd-* command references AND
48
+ * bare /word references missing the fd- prefix. Use this for file integrity tests.
49
+ */
50
+ export interface FullAuditResult extends AuditResult {
51
+ /** Bare /word references that are missing the fd- prefix (e.g. /plan → /fd-plan) */
52
+ barePrefixErrors: string[];
53
+ /** True if any issue was found — either invalid /fd-* refs or bare prefix errors */
54
+ hasAnyIssue: boolean;
55
+ }
56
+ export declare function auditTextFull(text: string): FullAuditResult;
46
57
  /**
47
58
  * Return the full canonical command inventory for inspection/testing.
48
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"command-validator.d.ts","sourceRoot":"","sources":["../../src/services/command-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,uBAAuB,EAAE,CAAA;IAClC,KAAK,EAAE,uBAAuB,EAAE,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;CACpB;AAQD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAmB7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAY9D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAqBrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAEvD"}
1
+ {"version":3,"file":"command-validator.d.ts","sourceRoot":"","sources":["../../src/services/command-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,uBAAuB,EAAE,CAAA;IAClC,KAAK,EAAE,uBAAuB,EAAE,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;CACpB;AAYD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAmB7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAY9D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAqBrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,oFAAoF;IACpF,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,oFAAoF;IACpF,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAQ3D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAEvD"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Preflight Explorer Service
3
+ *
4
+ * Performs autonomous codebase exploration before any clarifying question is
5
+ * emitted to the user. Both /fd-quick and /fd-discuss run this first.
6
+ *
7
+ * Contract:
8
+ * 1. exploreRepo(dir) → ExplorationResult (what exists in the project)
9
+ * 2. canAnswerFromEvidence(question, result) → boolean (suppress logic)
10
+ * 3. shouldSuppressQuestion(q, result, history) → SuppressResult
11
+ * 4. deriveTaskContext(task, result) → DerivedTaskContext (task-relative findings)
12
+ *
13
+ * This module reads the filesystem synchronously so it can be used in both
14
+ * synchronous test harnesses and async agent runtimes.
15
+ */
16
+ export interface ExplorationResult {
17
+ /** Whether .planning/STATE.md was found */
18
+ hasStateMD: boolean;
19
+ /** Whether .planning/PROJECT.md was found */
20
+ hasProjectMD: boolean;
21
+ /** Whether AGENTS.md was found at repo root */
22
+ hasAgentsMD: boolean;
23
+ /** Whether .planning/phases/ has any prior phase directories */
24
+ hasPriorPhases: boolean;
25
+ /** Whether .planning/phases/ has any DISCUSS.md from prior sessions */
26
+ hasPriorDiscussions: boolean;
27
+ /** fd-* command names found on disk (from src/commands/*.md) */
28
+ availableCommands: string[];
29
+ /** Agent names registered in this FlowDeck installation */
30
+ availableAgents: string[];
31
+ /** Skill directory names found on disk (from src/skills/ subdirectories) */
32
+ availableSkills: string[];
33
+ /** Tech stack indicators inferred from package.json / go.mod / Cargo.toml etc. */
34
+ techStack: string[];
35
+ /** Config keys present in flowdeck.json if it exists */
36
+ configKeys: string[];
37
+ /** Rules / governance keys declared in flowdeck.json */
38
+ governanceEnabled: boolean;
39
+ /** Implementation pattern hints inferred from src/ directory layout */
40
+ implementationPatterns: string[];
41
+ /** Relative paths of files that seem relevant to the task keywords */
42
+ relevantFiles: string[];
43
+ /** Evidence items that can answer common scoping questions */
44
+ evidenceItems: EvidenceItem[];
45
+ /** ISO timestamp when exploration ran */
46
+ exploredAt: string;
47
+ }
48
+ export interface EvidenceItem {
49
+ /** The kind of question this evidence answers */
50
+ answersQuestion: EvidenceQuestionKind;
51
+ /** Human-readable evidence summary */
52
+ summary: string;
53
+ /** Source path (relative) */
54
+ source: string;
55
+ }
56
+ export type EvidenceQuestionKind = "what-tech-stack" | "is-project-initialized" | "what-is-current-phase" | "what-patterns-exist" | "is-ui-heavy" | "has-existing-tests" | "has-existing-docs" | "has-ci-cd" | "what-agents-available" | "what-commands-available" | "what-skills-available" | "has-prior-decisions" | "has-governance";
57
+ export interface DerivedTaskContext {
58
+ /** Whether the task appears to touch frontend/UI code based on repo evidence */
59
+ likelyUITask: boolean;
60
+ /** Whether the task appears to touch API/backend based on repo evidence */
61
+ likelyBackendTask: boolean;
62
+ /** Whether CI/CD config exists (relevant for deploy tasks) */
63
+ hasCICD: boolean;
64
+ /** Whether existing tests exist in the project */
65
+ hasTests: boolean;
66
+ /** Whether existing documentation exists */
67
+ hasDocs: boolean;
68
+ /** Whether governance layer is active */
69
+ hasGovernance: boolean;
70
+ /** Relevant files for this specific task */
71
+ relevantFiles: string[];
72
+ /** Tech stack summary */
73
+ techStack: string[];
74
+ }
75
+ export interface SuppressResult {
76
+ /** Whether the question should be suppressed */
77
+ suppress: boolean;
78
+ /** Reason for suppression (if suppressed) */
79
+ reason?: string;
80
+ /** True when the question was answered by repo evidence (vs. session dedup) */
81
+ answeredByEvidence?: boolean;
82
+ /** The evidence that answers the question (if suppressed) */
83
+ evidence?: EvidenceItem[];
84
+ }
85
+ /**
86
+ * Explore the repository at `dir` and return structured findings.
87
+ * All filesystem reads are synchronous so this can be called in test harnesses.
88
+ *
89
+ * @param dir - Absolute path to repo root (or closest available directory)
90
+ */
91
+ export declare function exploreRepo(dir: string): ExplorationResult;
92
+ /**
93
+ * Narrow the exploration result to what is specifically relevant for a given task.
94
+ * Populates `relevantFiles` based on task keywords.
95
+ */
96
+ export declare function deriveTaskContext(taskDescription: string, result: ExplorationResult, dir: string): DerivedTaskContext;
97
+ /**
98
+ * Determine whether a candidate question should be suppressed because it can
99
+ * already be answered from repo evidence.
100
+ *
101
+ * A question is suppressed when:
102
+ * 1. The repo contains direct evidence that answers it, OR
103
+ * 2. It was already asked in the current session history, OR
104
+ * 3. It is a trivially answerable question given known project state
105
+ */
106
+ export declare function shouldSuppressQuestion(question: string, result: ExplorationResult, sessionHistory: string[]): SuppressResult;
107
+ /**
108
+ * Check if a specific question can be answered from the exploration result alone.
109
+ */
110
+ export declare function canAnswerFromEvidence(question: string, result: ExplorationResult): boolean;
111
+ /**
112
+ * Attempt to resolve a `clarificationNeeded` classification using exploration
113
+ * context. Returns an updated `clarificationNeeded` flag and an optional
114
+ * resolved task type hint.
115
+ *
116
+ * Called by quick-router after classifyTask when clarificationNeeded=true.
117
+ */
118
+ export interface ExplorationRefinement {
119
+ /** Whether clarification is still required after applying exploration data */
120
+ clarificationStillNeeded: boolean;
121
+ /** Reason clarification is no longer needed (if resolved) */
122
+ resolvedReason?: string;
123
+ /**
124
+ * Evidence-based context to pass to @supervisor if clarification is still needed.
125
+ * This lets the supervisor ask a tighter question.
126
+ */
127
+ supervisorContext?: string;
128
+ }
129
+ export declare function refineClassification(clarificationPrompt: string, result: ExplorationResult, sessionHistory: string[]): ExplorationRefinement;
130
+ //# sourceMappingURL=preflight-explorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight-explorer.d.ts","sourceRoot":"","sources":["../../src/services/preflight-explorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAA;IACnB,6CAA6C;IAC7C,YAAY,EAAE,OAAO,CAAA;IACrB,+CAA+C;IAC/C,WAAW,EAAE,OAAO,CAAA;IACpB,gEAAgE;IAChE,cAAc,EAAE,OAAO,CAAA;IACvB,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAA;IAC5B,gEAAgE;IAChE,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,2DAA2D;IAC3D,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kFAAkF;IAClF,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,wDAAwD;IACxD,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,wDAAwD;IACxD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uEAAuE;IACvE,sBAAsB,EAAE,MAAM,EAAE,CAAA;IAChC,sEAAsE;IACtE,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,8DAA8D;IAC9D,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,eAAe,EAAE,oBAAoB,CAAA;IACrC,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,wBA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M,EAChB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAIT;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,wBAAwB,EAAE,OAAO,CAAA;IACjC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,MAAM,EAC3B,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,MAAM,EAAE,GACvB,qBAAqB,CA8CvB"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Preflight Explorer Tests
3
+ *
4
+ * Covers:
5
+ * - exploreRepo: discovers commands, agents, skills, tech stack from filesystem
6
+ * - canAnswerFromEvidence: correctly identifies suppressible questions
7
+ * - shouldSuppressQuestion: suppresses answered / duplicate questions
8
+ * - deriveTaskContext: narrows findings to task-relevant context
9
+ * - refineClassification: resolves ambiguous classification via evidence
10
+ * - createQuestionGuard: tracks asked questions and prevents duplicates
11
+ * - filterQuestions: returns only questions that pass the guard
12
+ * - needsSupervisorClarification: returns false when all questions are answered
13
+ * - classifyTaskWithContext: uses exploration to resolve ambiguity
14
+ * - createQuickRunState: persists exploration snapshot
15
+ * - /fd-quick performs codebase exploration before asking questions
16
+ * - /fd-discuss performs codebase exploration before asking questions
17
+ * - repo evidence prevents unnecessary human questions
18
+ * - supervisor-agent receives only genuine ambiguity
19
+ * - worker agents do not ask ad hoc questions
20
+ * - feature/bug/UI/docs tasks route correctly after preflight
21
+ * - exploration results are stored and reused
22
+ * - repeated question suppression works
23
+ */
24
+ export {};
25
+ //# sourceMappingURL=preflight-explorer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight-explorer.test.d.ts","sourceRoot":"","sources":["../../src/services/preflight-explorer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Question Guard Service
3
+ *
4
+ * Prevents redundant or unnecessary questions from being emitted to the user.
5
+ *
6
+ * Both /fd-quick and /fd-discuss use this guard before forwarding any
7
+ * clarifying question to @supervisor. Worker agents MUST NOT call ask_user
8
+ * directly — they check this guard first, and if the answer exists in repo
9
+ * evidence or session history, the question is dropped.
10
+ *
11
+ * Contract:
12
+ * 1. createQuestionGuard(history?) → QuestionGuard instance
13
+ * 2. guard.check(question, evidence) → CheckResult
14
+ * 3. guard.record(question) → void
15
+ * 4. guard.getAsked() → string[]
16
+ *
17
+ * Only questions that pass the guard should be forwarded to @supervisor.
18
+ * @supervisor asks the human. Worker agents never ask the human directly.
19
+ */
20
+ import type { ExplorationResult } from "./preflight-explorer";
21
+ export interface CheckResult {
22
+ /** Whether the question should be allowed through to @supervisor */
23
+ allow: boolean;
24
+ /** Reason the question was blocked (when allow=false) */
25
+ blockReason?: string;
26
+ /** Whether the block was due to repo evidence answering it */
27
+ answeredByEvidence?: boolean;
28
+ /** Whether the block was due to a duplicate question */
29
+ duplicate?: boolean;
30
+ }
31
+ export interface QuestionGuard {
32
+ /**
33
+ * Check whether a question should be forwarded to @supervisor.
34
+ *
35
+ * Returns allow=true only when:
36
+ * - The question has not been asked before in this session
37
+ * - The question cannot be answered from repo evidence
38
+ * - The question is not trivially implied by known state
39
+ */
40
+ check(question: string, exploration: ExplorationResult | null): CheckResult;
41
+ /**
42
+ * Record that a question was asked. Call this after forwarding to @supervisor
43
+ * so future identical questions are suppressed.
44
+ */
45
+ record(question: string): void;
46
+ /** Return all questions recorded in this guard instance. */
47
+ getAsked(): string[];
48
+ /** Reset the guard (for new session/run). */
49
+ reset(): void;
50
+ }
51
+ /**
52
+ * Create a QuestionGuard.
53
+ *
54
+ * @param initialHistory - Questions already asked in this session (for
55
+ * persistence across restarts). Pass an empty array for new sessions.
56
+ */
57
+ export declare function createQuestionGuard(initialHistory?: string[]): QuestionGuard;
58
+ /**
59
+ * Convenience: check a list of candidate questions and return only those
60
+ * that should be forwarded to @supervisor. Records allowed questions.
61
+ */
62
+ export declare function filterQuestions(candidates: string[], guard: QuestionGuard, exploration: ExplorationResult | null): string[];
63
+ /**
64
+ * Determine whether supervisor clarification is warranted at all.
65
+ * Returns false when:
66
+ * - No questions remain after evidence filtering
67
+ * - All questions were answered by the exploration result
68
+ *
69
+ * Call this before invoking @supervisor to avoid empty escalations.
70
+ */
71
+ export declare function needsSupervisorClarification(questions: string[], guard: QuestionGuard, exploration: ExplorationResult | null): boolean;
72
+ /**
73
+ * Strict check for worker agents (coder, planner, tester, etc.).
74
+ *
75
+ * Worker agents MUST NOT ask the human directly. They must either:
76
+ * a) use repo evidence (this returns { canProceed: true, evidence })
77
+ * b) report missing data to orchestrator/supervisor
78
+ *
79
+ * This function decides which path to take.
80
+ */
81
+ export interface WorkerAgentDecision {
82
+ /** True when the worker can proceed using evidence alone */
83
+ canProceed: boolean;
84
+ /** True when the worker must stop and report missing data upward */
85
+ mustEscalate: boolean;
86
+ /** Evidence that allows the worker to proceed (when canProceed=true) */
87
+ evidence?: string;
88
+ /** What data is missing (when mustEscalate=true) */
89
+ missingData?: string;
90
+ }
91
+ export declare function workerAgentDecision(requiredInfo: string, exploration: ExplorationResult): WorkerAgentDecision;
92
+ //# sourceMappingURL=question-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-guard.d.ts","sourceRoot":"","sources":["../../src/services/question-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAG7D,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,EAAE,OAAO,CAAA;IACd,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,GAAG,WAAW,CAAA;IAC3E;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,4DAA4D;IAC5D,QAAQ,IAAI,MAAM,EAAE,CAAA;IACpB,6CAA6C;IAC7C,KAAK,IAAI,IAAI,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,GAAE,MAAM,EAAO,GAAG,aAAa,CA0ChF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAAE,EACpB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,iBAAiB,GAAG,IAAI,GACpC,MAAM,EAAE,CASV;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EAAE,EACnB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,iBAAiB,GAAG,IAAI,GACpC,OAAO,CAGT;AAMD;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAA;IACnB,oEAAoE;IACpE,YAAY,EAAE,OAAO,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,iBAAiB,GAC7B,mBAAmB,CAmBrB"}
@@ -12,7 +12,14 @@
12
12
  *
13
13
  * It does NOT create new workflows. It routes to the existing commands:
14
14
  * fd-discuss, fd-design, fd-plan, fd-execute, fd-fix-bug, fd-write-docs, fd-verify
15
+ *
16
+ * Autonomy contract:
17
+ * - classifyTaskWithContext() must be preferred over classifyTask() when a
18
+ * preflight ExplorationResult is available.
19
+ * - classificationNeeded is set to false whenever exploration evidence
20
+ * supplies the missing context, eliminating the human question entirely.
15
21
  */
22
+ import type { ExplorationResult } from "./preflight-explorer";
16
23
  export type TaskType = "feature" | "ui-feature" | "bugfix" | "docs" | "simple" | "ambiguous";
17
24
  /** A single stage in a workflow sequence, mapping to an existing fd-* command. */
18
25
  export interface WorkflowStage {
@@ -110,9 +117,41 @@ export interface QuickRunState {
110
117
  updatedAt: string;
111
118
  /** Final run outcome */
112
119
  outcome: "running" | "complete" | "blocked" | "failed";
120
+ /**
121
+ * Preflight exploration snapshot — persisted so later stages can
122
+ * reuse it without re-running exploration or re-asking the user.
123
+ */
124
+ preflightExploration?: {
125
+ exploredAt: string;
126
+ techStack: string[];
127
+ availableCommands: string[];
128
+ availableSkills: string[];
129
+ implementationPatterns: string[];
130
+ evidenceCount: number;
131
+ /** Whether clarification was resolved via evidence (no human asked) */
132
+ clarificationResolvedByEvidence: boolean;
133
+ /** The resolved reason when evidence answered the question */
134
+ clarificationResolvedReason?: string;
135
+ };
136
+ /** Questions that were suppressed by the guard (not sent to human) */
137
+ suppressedQuestions: string[];
113
138
  }
114
139
  /**
115
140
  * Create a fresh QuickRunState record for a new /fd-quick run.
116
141
  */
117
- export declare function createQuickRunState(taskDescription: string, classification: ClassificationResult): QuickRunState;
142
+ export declare function createQuickRunState(taskDescription: string, classification: ClassificationResult, exploration?: ExplorationResult): QuickRunState;
143
+ /**
144
+ * Classify a task description, using repo exploration evidence to resolve
145
+ * ambiguity before falling back to supervisor clarification.
146
+ *
147
+ * Prefer this over `classifyTask` whenever a preflight ExplorationResult is
148
+ * available. It eliminates unnecessary human questions when the repo already
149
+ * contains the answer.
150
+ *
151
+ * @param description - Free-text task from the user
152
+ * @param exploration - ExplorationResult from exploreRepo()
153
+ * @param sessionHistory - Questions already asked in this session (for
154
+ * deduplication via the question guard)
155
+ */
156
+ export declare function classifyTaskWithContext(description: string, exploration: ExplorationResult, sessionHistory?: string[]): ClassificationResult;
118
157
  //# sourceMappingURL=quick-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quick-router.d.ts","sourceRoot":"","sources":["../../src/services/quick-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,WAAW,CAAA;AAEf,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,gBAAgB,EAAE,OAAO,CAAA;IACzB,0FAA0F;IAC1F,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,QAAQ,CAAA;IAClB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAA;IAClB,yDAAyD;IACzD,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,2EAA2E;IAC3E,cAAc,EAAE,OAAO,CAAA;IACvB,2EAA2E;IAC3E,WAAW,EAAE,OAAO,CAAA;IACpB,4CAA4C;IAC5C,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,mFAAmF;IACnF,mBAAmB,EAAE,OAAO,CAAA;IAC5B,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAsCD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CA6GtE;AAiBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,EAAE,CA6CtE;AAcD,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB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SAAS,EAAE,MAAM,CAAA;IACjB,wBAAwB;IACxB,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;IACtD;;;OAGG;IACH,oBAAoB,CAAC,EAAE;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,EAAE,CAAA;QACnB,iBAAiB,EAAE,MAAM,EAAE,CAAA;QAC3B,eAAe,EAAE,MAAM,EAAE,CAAA;QACzB,sBAAsB,EAAE,MAAM,EAAE,CAAA;QAChC,aAAa,EAAE,MAAM,CAAA;QACrB,uEAAuE;QACvE,+BAA+B,EAAE,OAAO,CAAA;QACxC,8DAA8D;QAC9D,2BAA2B,CAAC,EAAE,MAAM,CAAA;KACrC,CAAA;IACD,sEAAsE;IACtE,mBAAmB,EAAE,MAAM,EAAE,CAAA;CAC9B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,oBAAoB,EACpC,WAAW,CAAC,EAAE,iBAAiB,GAC9B,aAAa,CAiCf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,iBAAiB,EAC9B,cAAc,GAAE,MAAM,EAAO,GAC5B,oBAAoB,CAuCtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dv.nghiem/flowdeck",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
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
@@ -17,10 +17,44 @@ Run a structured requirements discussion session and capture decisions.
17
17
 
18
18
  ## Process
19
19
 
20
+ ### Step 0: Autonomous Codebase Exploration
21
+
22
+ **Before asking the user any question**, explore the repository to gather evidence.
23
+
24
+ Invoke `@code-explorer` to inspect:
25
+
26
+ 1. **Project files** — `.planning/PROJECT.md` (goals, tech stack, constraints)
27
+ 2. **Session state** — `.planning/STATE.md` (current phase, prior decisions)
28
+ 3. **Prior discussions** — `.planning/phases/*/DISCUSS.md` (already-captured decisions)
29
+ 4. **Tech stack** — `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`
30
+ 5. **Implementation patterns** — `src/` directory structure (services, components, api, etc.)
31
+ 6. **AGENTS.md / rules** — any project-level constraints or conventions
32
+ 7. **Relevant source files** — files matching keywords in `$ARGUMENTS`
33
+
34
+ Store exploration findings in the discussion context. These will be used to:
35
+ - Skip questions whose answers are already known from the codebase
36
+ - Inform the `@discusser` agent with concrete evidence
37
+ - Prevent worker agents from emitting questions to the user
38
+
39
+ ### Question suppression rule
40
+
41
+ After exploration, apply the question guard before each `@discusser` question:
42
+
43
+ > A `@discusser` question is skipped if:
44
+ > 1. The answer already exists in `PROJECT.md`, `STATE.md`, or prior `DISCUSS.md` files
45
+ > 2. The answer is determinable from the tech stack / implementation patterns
46
+ > 3. The question was already answered in a prior session for this phase
47
+
48
+ If a question is suppressed, record it in the DISCUSS.md `## Suppressed Questions` section
49
+ with the evidence that answered it.
50
+
20
51
  ### Step 1: Load Context
21
52
 
22
53
  Read `.planning/PROJECT.md` to understand the project vision and goals.
23
54
  Read `.planning/STATE.md` to determine the current phase and context.
55
+ Read any prior `.planning/phases/phase-<N>/DISCUSS.md` for existing decisions.
56
+
57
+ Use exploration findings (from Step 0) to populate the discusser's starting context.
24
58
 
25
59
  ### Step 2: Determine Phase
26
60
 
@@ -32,11 +66,18 @@ Decisions will be saved to `.planning/phases/phase-{N}/DISCUSS.md`.
32
66
  Spawn @discusser agent with:
33
67
  - Project context (from PROJECT.md)
34
68
  - Current phase number
69
+ - **Preflight exploration findings** (tech stack, patterns, existing decisions)
35
70
  - Instructions to ask ONE question per turn
71
+ - Instructions to skip questions already answered by exploration evidence
36
72
 
37
73
  ### Step 4: Q&A Loop
38
74
 
39
75
  The @discusser agent asks one question at a time.
76
+ Before each question, the question guard is checked:
77
+ - If the question can be answered from exploration evidence → skip it, record as suppressed
78
+ - If the question was already asked in a prior session for this phase → skip it
79
+ - Otherwise → ask the user
80
+
40
81
  After each user response:
41
82
  - Assign D-XX number to any new decision
42
83
  - Record: topic, choice, rationale
@@ -44,7 +85,7 @@ After each user response:
44
85
 
45
86
  Continue until all required topics are covered or user says to stop early.
46
87
 
47
- Structure the discussion:
88
+ Structure the discussion (skip topics already answered by exploration):
48
89
 
49
90
  1. **Scope** — What exactly needs to be built/changed? What is out of scope?
50
91
  2. **Constraints** — Technical constraints, deadlines, dependencies?
@@ -53,6 +94,7 @@ Structure the discussion:
53
94
  5. **UI classification** — Is this task user-facing and UI-heavy (website/app/dashboard/admin/landing/onboarding)?
54
95
 
55
96
  Ask questions one at a time. Wait for answers before proceeding.
97
+ Do not ask about things the codebase already reveals.
56
98
 
57
99
  ## Decision Recording
58
100
 
@@ -65,12 +107,24 @@ After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
65
107
  **Date:** <timestamp>
66
108
  **Topic:** <topic>
67
109
 
110
+ ## Preflight Evidence Used
111
+
112
+ - Tech stack: <detected stack>
113
+ - Prior decisions loaded: <yes/no>
114
+ - Questions suppressed by evidence: <N>
115
+
68
116
  ## Decisions
69
117
 
70
118
  D-01: [Topic] — [Decision] ([Rationale])
71
119
  D-02: [Topic] — [Decision] ([Rationale])
72
120
  ...
73
121
 
122
+ ## Suppressed Questions
123
+
124
+ (Questions that were answered by repo evidence and not asked of the user)
125
+ - "<question>" → answered by: <evidence source>
126
+ ...
127
+
74
128
  ## Open Questions
75
129
 
76
130
  - <any unresolved items>
@@ -83,13 +137,15 @@ D-02: [Topic] — [Decision] ([Rationale])
83
137
  ## D-05 Compliance
84
138
 
85
139
  - Loads PROJECT.md + current phase STATE.md
86
- - Invokes @discusser agent
140
+ - **Performs codebase exploration before any question is asked (Step 0)**
141
+ - Invokes @discusser agent with full exploration context
87
142
  - Saves decisions with D-XX numbering to DISCUSS.md
88
143
  - One question at a time (no compound questions)
144
+ - Questions suppressed when answered by evidence
89
145
 
90
146
  ## Completion
91
147
 
92
- Report: decisions captured, file path, and suggest running `/fd-plan`.
148
+ Report: decisions captured, questions suppressed, file path, and suggest running `/fd-plan`.
93
149
  If UI-heavy, also suggest running `/fd-design --mode=draft` before `/fd-execute`.
94
150
 
95
151
  ## Error Handling
@@ -98,4 +154,5 @@ D-03: Fail fast with clear error
98
154
  - If PROJECT.md not found: error with "Run /fd-new-project first"
99
155
  - If STATE.md not found: error with "Project not initialized"
100
156
  - If @discusser fails: error with "Discusser agent unavailable"
157
+ - If @code-explorer fails during preflight: proceed with reduced evidence (log warning)
101
158
  - No partial state saved on error
@@ -19,7 +19,7 @@ Check if `.codebase/` directory already exists. If present, warn and require con
19
19
 
20
20
  If `.codebase/` directory already exists:
21
21
  ```
22
- Warning: .codebase/ already exists. Running /map-codebase will overwrite existing docs.
22
+ Warning: .codebase/ already exists. Running /fd-map-codebase will overwrite existing docs.
23
23
  Continue? (y/n)
24
24
  ```
25
25
  If user declines, abort. If user confirms, proceed.
@@ -25,7 +25,7 @@ Before running this flow:
25
25
  2. All `path` values in the registry resolve to actual directories on disk
26
26
  3. A description of the intended change is available (from `/fd-discuss` or passed directly)
27
27
 
28
- If the registry is empty or not set up, run `/multi-repo --add` first.
28
+ If the registry is empty or not set up, run `/fd-multi-repo --add` first.
29
29
 
30
30
  ## Behavior
31
31
 
@@ -6,9 +6,10 @@ argument-hint: [task description]
6
6
  # Quick — Autonomous Workflow Launcher
7
7
 
8
8
  Run the correct FlowDeck workflow automatically for any task. This command:
9
- - Classifies the task type
9
+ - Explores the codebase first before asking any questions
10
+ - Classifies the task type using both text signals and repo evidence
10
11
  - Selects the appropriate existing workflow and stage sequence
11
- - Routes all clarifying questions through `@supervisor`
12
+ - Routes all clarifying questions through `@supervisor` (only when evidence cannot answer)
12
13
  - Executes each stage in order using the existing registered commands
13
14
  - Stops only when blocked, awaiting approval, or fully verified
14
15
 
@@ -16,18 +17,72 @@ Run the correct FlowDeck workflow automatically for any task. This command:
16
17
 
17
18
  ---
18
19
 
20
+ ## Step 0: Autonomous Preflight Exploration
21
+
22
+ **Before asking the human anything**, explore the repository to build evidence.
23
+
24
+ Invoke `@code-explorer` to inspect the following in parallel:
25
+
26
+ 1. **Repository structure** — `.planning/STATE.md`, `.planning/PROJECT.md`, `AGENTS.md`
27
+ 2. **Available commands** — enumerate `src/commands/*.md` filenames
28
+ 3. **Available agents** — enumerate `src/agents/*.ts` filenames
29
+ 4. **Available skills** — enumerate `src/skills/` directory names
30
+ 5. **Workflow config** — read `flowdeck.json` if present (governance, models)
31
+ 6. **Tech stack** — read `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`
32
+ 7. **Implementation patterns** — inspect `src/` top-level directories
33
+ 8. **Prior decisions** — check `.planning/phases/*/DISCUSS.md` files
34
+ 9. **Relevant files** — find source files matching keywords in `$ARGUMENTS`
35
+
36
+ Store the exploration snapshot in STATE.md under `quick_run.preflightExploration`:
37
+
38
+ ```yaml
39
+ quick_run:
40
+ preflightExploration:
41
+ exploredAt: <ISO timestamp>
42
+ techStack: [...]
43
+ availableCommands: [...]
44
+ availableSkills: [...]
45
+ implementationPatterns: [...]
46
+ evidenceCount: <N>
47
+ clarificationResolvedByEvidence: false
48
+ suppressedQuestions: []
49
+ ```
50
+
51
+ **This step is mandatory. Do not proceed to Step 1 until exploration is complete.**
52
+
53
+ ### Question suppression rule
54
+
55
+ After exploration, invoke the question guard before emitting any question:
56
+
57
+ > A question may only be forwarded to `@supervisor` if:
58
+ > 1. It cannot be answered by the exploration evidence
59
+ > 2. It has not already been asked in the current session
60
+ > 3. It is required to safely select the correct workflow
61
+
62
+ If the question can be answered from repo evidence, suppress it and log it in
63
+ `quick_run.suppressedQuestions`. Do not present it to the user.
64
+
65
+ ---
66
+
19
67
  ## Step 1: Pre-flight State Check
20
68
 
21
69
  1. Check `.planning/STATE.md` exists — if not, error: "Run /fd-new-project first."
22
70
  2. Read `.planning/STATE.md` to determine if a `quick_run` entry already exists for this session.
23
71
  - If `quick_run.outcome` is `running` or `blocked`: **resume from the last completed stage** (skip to Step 5).
24
- - Otherwise: proceed to Step 2.
72
+ - If `quick_run.preflightExploration` exists and `exploredAt` is recent (< 5 min): reuse it, skip Step 0.
73
+ - Otherwise: proceed to Step 0 then Step 2.
25
74
 
26
75
  ---
27
76
 
28
77
  ## Step 2: Classify the Task
29
78
 
30
- Parse `$ARGUMENTS` using the signal table below to determine task type and required stage sequence.
79
+ Use **both** text-signal matching and preflight exploration evidence:
80
+
81
+ Call `classifyTaskWithContext(description, explorationResult)` from `quick-router.ts`.
82
+
83
+ This resolves ambiguous descriptions using repo evidence before flagging
84
+ `clarificationNeeded`. Most short descriptions that would normally prompt a
85
+ question are resolved by evidence (e.g., tech stack, existing patterns, prior decisions).
31
86
 
32
87
  ### Signal Classification Table
33
88
 
@@ -38,7 +93,7 @@ Parse `$ARGUMENTS` using the signal table below to determine task type and requi
38
93
  | **docs** | docs, documentation, readme, api docs, usage guide, write docs, document, changelog, tutorial, docstring | `discuss → write-docs → verify` |
39
94
  | **simple** | rename, move file, minor, typo, update constant, update config, bump version, one-liner | `execute → verify` |
40
95
  | **feature** | (substantive description, 8+ words, no above signals) | `discuss → plan → execute → verify` |
41
- | **ambiguous** | (short, vague, or unclear input) | *(clarify first — see Step 3)* |
96
+ | **ambiguous** | (short, vague, or unclear — only after exploration cannot resolve) | *(clarify via supervisor — see Step 3)* |
42
97
 
43
98
  ### Classification Rules
44
99
 
@@ -47,7 +102,7 @@ Parse `$ARGUMENTS` using the signal table below to determine task type and requi
47
102
  3. **Docs signals**: if "docs", "documentation", "readme", or "write docs" is present without implementation signals, classify as `docs`.
48
103
  4. **Simple**: if "rename", "typo", "minor", or "move file" is present and description is a single, scoped operation.
49
104
  5. **Feature**: substantive description (8+ words) with no specific signal type.
50
- 6. **Ambiguous**: description is too short (<5 words) or matches a bare imperative with no object (e.g., "improve", "add", "make it better").
105
+ 6. **Ambiguous** (only when exploration cannot resolve): description is too short (<5 words) or matches a bare imperative with no object (e.g., "improve", "add", "make it better") AND repo evidence does not clarify scope or type.
51
106
 
52
107
  Record the classification result:
53
108
  ```yaml
@@ -66,21 +121,25 @@ quick_run:
66
121
 
67
122
  ---
68
123
 
69
- ## Step 3: Supervisor-Gated Clarification (when needed)
124
+ ## Step 3: Supervisor-Gated Clarification (only when exploration cannot resolve)
70
125
 
71
126
  **Only proceed to Step 4 when classification confidence is sufficient.**
72
127
 
73
- If classification is `ambiguous` OR confidence is low (description < 5 words or no clear signal):
128
+ If classification is `ambiguous` AND exploration evidence did not resolve it:
74
129
 
75
- 1. Invoke `@supervisor` (preflight review of `fd-quick` command) with the partial task description.
76
- 2. Present the supervisor's single clarifying question to the user. **Ask ONE question only.**
130
+ 1. Invoke `@supervisor` (preflight review of `fd-quick` command) with:
131
+ - The partial task description
132
+ - The preflight exploration snapshot (tech stack, patterns, prior decisions)
133
+ - The `clarificationPrompt` from the classification (already enriched with context)
134
+ 2. `@supervisor` presents the single clarifying question to the user. **Ask ONE question only.**
77
135
  3. Wait for the user's answer.
78
136
  4. Re-classify using the combined original description + the user's answer.
79
137
  5. If confidence is still low after one clarification round, route to `feature` with a note in STATE.md.
80
138
 
81
139
  **All clarification goes through `@supervisor`. Do not have specialist agents ask questions directly.**
140
+ **Do not ask questions that can be answered from the exploration evidence.**
82
141
 
83
- Example supervisor clarification questions (the supervisor selects the most relevant):
142
+ Example supervisor clarification questions (only when evidence is absent):
84
143
  - "Is this a new feature, a bug fix, or a documentation task?"
85
144
  - "Does this involve building or changing a user-facing UI (page, dashboard, component)?"
86
145
  - "Can you describe the specific bug — what is the expected vs actual behavior?"
@@ -97,6 +156,7 @@ Task classified as: <task type>
97
156
  Stage sequence: <stage-1> → <stage-2> → ... → <stage-N>
98
157
  Requires design: <yes / no>
99
158
  Requires TDD: <yes / no>
159
+ Evidence used: <N> items from preflight exploration
100
160
 
101
161
  Running /fd-quick autonomously. I will proceed through each stage and pause only
102
162
  if I need approval, encounter a blocker, or complete the full sequence.
@@ -134,13 +194,15 @@ Before executing the stage, invoke `@supervisor` (preflight) on the stage's comm
134
194
 
135
195
  ### 5c. Execute the Stage
136
196
 
137
- Execute the stage using its existing command with full context:
197
+ Execute the stage using its existing command with full context from the preflight
198
+ exploration snapshot (available in `quick_run.preflightExploration`). Pass it to
199
+ each stage so worker agents can use evidence directly.
138
200
 
139
201
  **Stage → Command Mapping:**
140
202
 
141
203
  | Stage | Command | Key Behavior |
142
204
  |-------|---------|--------------|
143
- | `discuss` | `/fd-discuss` | Runs `@discusser` structured Q&A. Saves `DISCUSS.md`. One question at a time. |
205
+ | `discuss` | `/fd-discuss` | Runs `@discusser` structured Q&A. Passes preflight exploration so questions already answered by evidence are skipped. Saves `DISCUSS.md`. One question at a time. |
144
206
  | `design` | `/fd-design --mode=draft` | Runs design-first pipeline. Required for `ui-feature` tasks. Produces design artifact + approval. |
145
207
  | `plan` | `/fd-plan` | Creates `PLAN.md` from `DISCUSS.md` decisions. **Pauses for user CONFIRM before saving.** |
146
208
  | `execute` | `/fd-execute` | TDD pipeline: BEHAVIOR → RED → GREEN → REFACTOR per step. Delegates to appropriate coder agents. |
@@ -194,6 +256,7 @@ When all stages complete:
194
256
  Task: $ARGUMENTS
195
257
  Workflow: <stage-1> → ... → <stage-N>
196
258
  Outcome: ✅ COMPLETE
259
+ Evidence: <N> preflight items used (0 human questions asked before exploration)
197
260
  ────────────────────────────────────────────────
198
261
  Verify result: /fd-verify
199
262
  Save state: /fd-checkpoint
@@ -0,0 +1,63 @@
1
+ Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
2
+
3
+ **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
4
+
5
+ ## 1. Think Before Coding
6
+
7
+ **Don't assume. Don't hide confusion. Surface tradeoffs.**
8
+
9
+ Before implementing:
10
+ - State your assumptions explicitly. If uncertain, ask.
11
+ - If multiple interpretations exist, present them - don't pick silently.
12
+ - If a simpler approach exists, say so. Push back when warranted.
13
+ - If something is unclear, stop. Name what's confusing. Ask.
14
+
15
+ ## 2. Simplicity First
16
+
17
+ **Minimum code that solves the problem. Nothing speculative.**
18
+
19
+ - No features beyond what was asked.
20
+ - No abstractions for single-use code.
21
+ - No "flexibility" or "configurability" that wasn't requested.
22
+ - No error handling for impossible scenarios.
23
+ - If you write 200 lines and it could be 50, rewrite it.
24
+
25
+ Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
26
+
27
+ ## 3. Surgical Changes
28
+
29
+ **Touch only what you must. Clean up only your own mess.**
30
+
31
+ When editing existing code:
32
+ - Don't "improve" adjacent code, comments, or formatting.
33
+ - Don't refactor things that aren't broken.
34
+ - Match existing style, even if you'd do it differently.
35
+ - If you notice unrelated dead code, mention it - don't delete it.
36
+
37
+ When your changes create orphans:
38
+ - Remove imports/variables/functions that YOUR changes made unused.
39
+ - Don't remove pre-existing dead code unless asked.
40
+
41
+ The test: Every changed line should trace directly to the user's request.
42
+
43
+ ## 4. Goal-Driven Execution
44
+
45
+ **Define success criteria. Loop until verified.**
46
+
47
+ Transform tasks into verifiable goals:
48
+ - "Add validation" → "Write tests for invalid inputs, then make them pass"
49
+ - "Fix the bug" → "Write a test that reproduces it, then make it pass"
50
+ - "Refactor X" → "Ensure tests pass before and after"
51
+
52
+ For multi-step tasks, state a brief plan:
53
+ ```
54
+ 1. [Step] → verify: [check]
55
+ 2. [Step] → verify: [check]
56
+ 3. [Step] → verify: [check]
57
+ ```
58
+
59
+ Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
60
+
61
+ ---
62
+
63
+ **These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
@@ -12,7 +12,7 @@ Produces structured documentation of a codebase that agents can read to answer "
12
12
 
13
13
  - Starting work on an unfamiliar codebase
14
14
  - Before a major feature that spans multiple modules
15
- - When `/map-codebase` command is invoked
15
+ - When `/fd-map-codebase` command is invoked
16
16
  - When `.codebase/` is missing or stale
17
17
 
18
18
  ## Output Files
@@ -180,7 +180,7 @@ Conflicts must be resolved before any CHANGE PLAN is executed. The `@multi-repo-
180
180
 
181
181
  ## Independence Check Before Executing
182
182
 
183
- Before running `/multi-repo`:
183
+ Before running `/fd-multi-repo`:
184
184
  - [ ] `.planning/config.json` has a `sub_repos` array with at least two entries
185
185
  - [ ] All `path` values resolve to actual directories on disk
186
186
  - [ ] Each repo has its own `.git` directory (they are separate repos, not subtrees)
@@ -19,7 +19,7 @@ The Repo Memory Graph is FlowDeck's long-term knowledge store about this specifi
19
19
  ## When to Update
20
20
 
21
21
  Update the graph:
22
- - After running `/map-codebase`
22
+ - After running `/fd-map-codebase`
23
23
  - When onboarding a new module
24
24
  - When a bug fix reveals a recurring pattern (add to `bug_history`)
25
25
  - When a refactor changes module ownership