@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,98 @@
1
+ # OpenCode Integration Settings
2
+
3
+ FlowDeck integrates with OpenCode as a plugin. This page explains how the plugin is registered, what gets published as an npm package, and what environment variables FlowDeck reads at runtime.
4
+
5
+ ---
6
+
7
+ ## Plugin Registration
8
+
9
+ FlowDeck uses the `@opencode-ai/plugin` package to register itself with OpenCode. After running `npm install @dv.nghiem/flowdeck`, the `postinstall` script (`postinstall.mjs`) automatically:
10
+
11
+ 1. Reads the OpenCode global config at `~/.config/opencode/opencode.json` (or `$OPENCODE_CONFIG_DIR/opencode.json`)
12
+ 2. Adds `"@dv.nghiem/flowdeck"` to the `plugin` array if not already present
13
+ 3. Sets `"default_agent": "orchestrator"` if not already set
14
+ 4. Writes the updated config back to disk
15
+
16
+ OpenCode loads all plugins listed in the `plugin` array on startup.
17
+
18
+ ---
19
+
20
+ ## Package Contents
21
+
22
+ The `package.json` `files` field controls what gets published as the npm package:
23
+
24
+ ```
25
+ files:
26
+ dist/ — compiled plugin code
27
+ bin/ — CLI entry point
28
+ src/commands/ — command implementations
29
+ src/rules/ — coding standards
30
+ src/skills/ — skill definitions
31
+ docs/ — documentation
32
+ postinstall.mjs — post-install registration script
33
+ ```
34
+
35
+ The npm package does **not** include `src/agents/`, `src/tools/`, `src/hooks/` (with the exception of `src/skills/`), or development files.
36
+
37
+ ---
38
+
39
+ ## Plugin Architecture
40
+
41
+ FlowDeck registers its capabilities through the following source directories:
42
+
43
+ ### `src/agents/`
44
+
45
+ Agent definitions. Each agent specifies its role, allowed tools, instructions, and delegation policies.
46
+
47
+ ### `src/tools/`
48
+
49
+ Tool definitions. These extend OpenCode's tool set with FlowDeck-specific capabilities.
50
+
51
+ ### `src/hooks/`
52
+
53
+ System hooks that react to OpenCode lifecycle events:
54
+
55
+ | Hook File | When It Fires | Purpose |
56
+ |-----------|---------------|---------|
57
+ | `session-start.ts` | `session.created` | Loads prior state from `.planning/STATE.md` and injects phase/status/steps into context |
58
+ | `compaction-hook.ts` | `experimental.session.compacting` | Injects structured planning context before context window compaction |
59
+ | `shell-env-hook.ts` | Every `bash` tool execution | Injects `FLOWDECK_VERSION`, `PROJECT_ROOT`, `PACKAGE_MANAGER`, `DETECTED_LANGUAGES`, `FLOWDECK_PHASE` env vars |
60
+ | `context-window-monitor.ts` | `message.updated`, `tool.execute.after` | Warns when context usage exceeds 70% of the token limit |
61
+ | `session-idle-hook.ts` | `session.idle` (when files edited) | Sends desktop notification and logs edited file summary |
62
+ | `notifications.ts` | Various | Desktop notification dispatch |
63
+ | `file-tracker.ts` | During session | Tracks edited file paths across agent turns |
64
+
65
+ ### `src/skills/`
66
+
67
+ Skill definitions exported via the plugin's skill registration API. Skills expose reusable workflow patterns (TDD, security scan, code review, etc.) to OpenCode's skill system.
68
+
69
+ ---
70
+
71
+ ## Environment Variables
72
+
73
+ FlowDeck reads the following environment variables:
74
+
75
+ | Variable | Default | Description |
76
+ |----------|---------|-------------|
77
+ | `OPENCODE_CONFIG_DIR` | `~/.config/opencode` | OpenCode configuration directory |
78
+ | `XDG_CONFIG_HOME` | `~/.config` | Used to derive `OPENCODE_CONFIG_DIR` if not set |
79
+ | `FLOWDECK_CONTEXT_LIMIT` | `200000` | Token limit for context window monitor (used by `context-window-monitor.ts`) |
80
+
81
+ FlowDeck does **not** read any API keys, tokens, or secrets. All model authentication is handled by OpenCode.
82
+
83
+ ---
84
+
85
+ ## opencode.json Schema (Plugin Section)
86
+
87
+ After installation, your `opencode.json` looks like:
88
+
89
+ ```json
90
+ {
91
+ "plugin": [
92
+ "@dv.nghiem/flowdeck"
93
+ ],
94
+ "default_agent": "orchestrator"
95
+ }
96
+ ```
97
+
98
+ FlowDeck's plugin reads the top-level keys described in [Configuration](index.md) (`agents`, `governance`, `model_profile`, etc.) from this same file.
@@ -0,0 +1,126 @@
1
+ # First Project — End-to-End Walkthrough
2
+
3
+ This guide walks through creating a simple feature end-to-end, showing what FlowDeck produces at each step.
4
+
5
+ ## Step 1: Map the Codebase
6
+
7
+ ```bash
8
+ fd-map-codebase
9
+ ```
10
+
11
+ FlowDeck analyses the project and creates `.codebase/` with:
12
+ - `.codebase/CODEGRAPH.json` — dependency graph
13
+ - `.codebase/CONVENTIONS.md` — detected code conventions
14
+ - `.codebase/CODEBASE_INDEX.md` — high-level structural index
15
+
16
+ This step is required before starting a feature.
17
+
18
+ ## Step 2: Start a Feature
19
+
20
+ ```bash
21
+ fd-new-feature "user authentication"
22
+ ```
23
+
24
+ FlowDeck initializes `.planning/` (if it doesn't exist yet) and creates `.planning/phases/phase-1/FEATURE.md`:
25
+
26
+ ```markdown
27
+ # Feature: user authentication
28
+
29
+ ## Description
30
+ user authentication
31
+
32
+ ## Status
33
+ discuss
34
+
35
+ ## Created
36
+ 2026-05-26
37
+ ```
38
+
39
+ ## Step 3: Discuss
40
+
41
+ ```bash
42
+ fd-discuss
43
+ ```
44
+
45
+ The discusser agent runs structured Q&A and produces **`DISCUSS.md`**:
46
+
47
+ ```markdown
48
+ # Discussion — user authentication
49
+
50
+ ## Q: What is the scope?
51
+ A: [agent response]
52
+
53
+ ## Q: What are the constraints?
54
+ A: [agent response]
55
+
56
+ ## Decisions
57
+ - [captured decisions listed here]
58
+ ```
59
+
60
+ ## Step 4: Plan
61
+
62
+ ```bash
63
+ fd-plan
64
+ ```
65
+
66
+ When prompted, type `CONFIRM` to proceed. The planner generates **`PLAN.md`**:
67
+
68
+ ```markdown
69
+ # Plan — user authentication
70
+
71
+ ## Wave 1 (parallel)
72
+ - [ ] Implement user model
73
+ - [ ] Create auth service
74
+ - [ ] Write unit tests
75
+
76
+ ## Wave 2 (parallel)
77
+ - [ ] Implement login endpoint
78
+ - [ ] Implement registration endpoint
79
+ - [ ] Add integration tests
80
+
81
+ ## Wave 3 (sequential)
82
+ - [ ] Security audit
83
+ - [ ] Documentation
84
+ ```
85
+
86
+ ## Step 5: Execute
87
+
88
+ ```bash
89
+ fd-execute
90
+ ```
91
+
92
+ Agents work through each wave in `PLAN.md`. Independent tasks run in parallel. State is updated in `STATE.md` after each task.
93
+
94
+ ## Step 6: Verify
95
+
96
+ ```bash
97
+ fd-verify
98
+ ```
99
+
100
+ Runs the full verification pipeline:
101
+ - Unit and integration tests
102
+ - Code review by reviewer agent
103
+ - Security scan
104
+ - Deploy check
105
+
106
+ Results are written to `.planning/VERIFICATION.md`.
107
+
108
+ ## What You Have Now
109
+
110
+ After completing the full workflow:
111
+
112
+ ```
113
+ .planning/
114
+ STATE.md — current phase and progress
115
+ ROADMAP.md — all features and timeline
116
+ PLAN.md — current feature execution plan
117
+ DISCUSS.md — captured decisions
118
+ VERIFICATION.md — test results, review, security
119
+ .codebase/
120
+ CODEGRAPH.json — dependency graph
121
+ CONVENTIONS.md — detected code conventions
122
+ CODEBASE_INDEX.md — structural index
123
+ ```
124
+
125
+ You can now run `/fd-status` to see the project overview, or start a new feature with `/fd-new-feature`.
126
+
@@ -0,0 +1,73 @@
1
+ # Installation
2
+
3
+ ## Prerequisites
4
+
5
+ - [OpenCode](https://opencode.ai) installed and configured
6
+ - Node.js 18+ (for npx installation)
7
+ - Git (for curl installation)
8
+
9
+ ## Install Methods
10
+
11
+ ### Method 1: curl (recommended)
12
+
13
+ ```bash
14
+ curl -fsSL https://raw.githubusercontent.com/DVNghiem/flowdeck/main/install.sh | bash
15
+ ```
16
+
17
+ This downloads and runs the official installer script. It clones the repository and runs the post-install setup.
18
+
19
+ ### Method 2: npx
20
+
21
+ ```bash
22
+ npx @dv.nghiem/flowdeck install
23
+ ```
24
+
25
+ No git required. Uses npx to fetch and install the package directly.
26
+
27
+ ## Verify Installation
28
+
29
+ Run the health check command:
30
+
31
+ ```bash
32
+ flowdeck doctor
33
+ ```
34
+
35
+ Expected output shows FlowDeck version, OpenCode plugin status, and environment health.
36
+
37
+ Alternatively, verify the binary is in your path:
38
+
39
+ ```bash
40
+ which flowdeck
41
+ ```
42
+
43
+ ## Post-Installation
44
+
45
+ After installation, FlowDeck registers as an OpenCode plugin. Restart OpenCode to load the plugin and its commands.
46
+
47
+ ## Environment Variables
48
+
49
+ FlowDeck respects the following environment variables:
50
+
51
+ | Variable | Description | Default |
52
+ |----------|-------------|---------|
53
+ | `FLOWDECK_CONFIG` | Path to flowdeck.json config | `./flowdeck.json` |
54
+ | `FLOWDECK_STATE_DIR` | Directory for state files | `.planning/` |
55
+ | `OPENCODE_MODEL` | Model to use when not overridden | (OpenCode default) |
56
+
57
+ ## Uninstall
58
+
59
+ ### Method 1: npm
60
+
61
+ ```bash
62
+ npm uninstall -g @dv.nghiem/flowdeck
63
+ ```
64
+
65
+ ### Method 2: Run uninstall script
66
+
67
+ If you used the curl installer:
68
+
69
+ ```bash
70
+ ./uninstall.sh
71
+ ```
72
+
73
+ This removes the plugin from OpenCode and cleans up installed files.
@@ -0,0 +1,74 @@
1
+ # Quick Start — First 15 Minutes
2
+
3
+ Get FlowDeck installed and run your first feature workflow in under 15 minutes.
4
+
5
+ ## Step 1: Install FlowDeck
6
+
7
+ ```bash
8
+ curl -fsSL https://raw.githubusercontent.com/DVNghiem/flowdeck/main/install.sh | bash
9
+ ```
10
+
11
+ See [Installation](installation.md) for alternative install methods.
12
+
13
+ ## Step 2: Verify Installation
14
+
15
+ ```bash
16
+ flowdeck doctor
17
+ ```
18
+
19
+ Checks that FlowDeck is installed, the OpenCode plugin is loaded, and your environment is ready.
20
+
21
+ ## Step 3: Map the Codebase
22
+
23
+ ```bash
24
+ fd-map-codebase
25
+ ```
26
+
27
+ Analyses the project and writes structured indexes to `.codebase/`. This is required before starting a feature — it gives all subsequent agents the context they need.
28
+
29
+ ## Step 4: Start a Feature
30
+
31
+ ```bash
32
+ fd-new-feature "hello world API"
33
+ ```
34
+
35
+ Initializes feature context and creates a `FEATURE.md` file in the current phase directory. If `.planning/` does not exist yet, it is created automatically.
36
+
37
+ ## Step 5: Discuss the Feature
38
+
39
+ ```bash
40
+ fd-discuss
41
+ ```
42
+
43
+ Runs structured Q&A to capture requirements, constraints, and decisions. Saves to `DISCUSS.md`.
44
+
45
+ ## Step 6: Plan Implementation
46
+
47
+ ```bash
48
+ fd-plan
49
+ ```
50
+
51
+ Generates a wave-structured execution plan. When prompted, type `CONFIRM` to proceed.
52
+
53
+ The planner outputs a `PLAN.md` with task waves — groups of independent tasks that can run in parallel.
54
+
55
+ ## Step 7: Execute
56
+
57
+ ```bash
58
+ fd-execute
59
+ ```
60
+
61
+ Implements the feature using TDD discipline. Parallel agents (architect, coder, tester, reviewer) work through the plan waves.
62
+
63
+ ## What to Expect
64
+
65
+ After completing these steps you will have:
66
+
67
+ - A `.planning/` directory with full project state
68
+ - A `PLAN.md` with executable task breakdown
69
+ - Working code with tests
70
+ - Verification results from the review pipeline
71
+
72
+ ## Next Steps
73
+
74
+ - [First Project → End-to-End Walkthrough](first-project.md) — see what the output files actually look like
package/docs/index.md CHANGED
@@ -1,72 +1,36 @@
1
- # FlowDeck Documentation
2
-
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
-
5
- ---
6
-
7
- ## Getting Started
8
-
9
- | Document | Description |
10
- |----------|-------------|
11
- | [Installation](installation.md) | Prerequisites, all three install methods, verification commands, and how to uninstall |
12
- | [Quick Start](quick-start.md) | Step-by-step walkthrough of your first 15 minutes with FlowDeck |
13
- | [Best Practices](best-practices.md) | Maximize efficiency and safety with Spec-Driven Development and Ensemble Reasoning |
14
-
15
- ---
16
-
17
- ## Reference
18
-
19
- | Document | Description |
20
- |----------|-------------|
21
- | [Agents](agents.md) | All specialist agents names, roles, and when to invoke each one |
22
- | [Skills](skills.md) | Reusable skill patterns for common tasks |
23
- | [Commands](commands.md) | All 18 slash commands syntax, arguments, and what each command triggers |
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 |
26
- | [Rules](rules.md) | Language and common rule files what they enforce and how to activate them |
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 |
29
- | [Memory System](memory.md) | Persistent memory recall past sessions, tool executions, and context across sessions |
30
-
31
- ---
32
-
33
- ## Advanced
34
-
35
- | Document | Description |
36
- |----------|-------------|
37
- | [Multi-Repo](multi-repo.md) | Coordinating changes across two or more repositories in a single session |
38
- | [Notifications](notifications.md) | Desktop and system alerts for long-running task completion |
39
-
40
- ---
41
-
42
- ## Setup & Maintenance
43
-
44
- | Document | Description |
45
- |----------|-------------|
46
- | [Configuration](configuration.md) | `opencode.json` fields, project config schema, environment variables, and plugin tools |
47
- | [Troubleshooting](troubleshooting.md) | Fixes for the most common problems: missing agents, corrupted state, build failures |
48
-
49
- ---
50
-
51
- ## Quick Command Cheat Sheet
52
-
53
- | Command | What it does |
54
- |---------|--------------|
55
- | `/fd-new-project <name>` | Initialize project with planning structure and default config |
56
- | `/fd-discuss <topic>` | Run structured requirements Q&A to capture decisions |
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 |
59
- | `/fd-new-feature "<description>"` | Execute full feature workflow with TDD discipline |
60
- | `/fd-fix-bug "<description>"` | Diagnose and fix a bug with regression test |
61
- | `/fd-deploy-check [--check=deploy,review,analysis]` | Pre-deploy checks, code review, or pre-change analysis |
62
- | `/fd-status [--roadmap\|--workspace\|--phase=N]` | Combined status, roadmap, and workspace view |
63
- | `/fd-checkpoint` | Save current state — safe to close the session after this |
64
- | `/fd-resume [--yes]` | Reload STATE.md and PLAN.md to continue interrupted session |
65
- | `/fd-reflect [--mode=reflect,learn]` | Post-session reflection or capture skill from session |
66
- | `/fd-map-codebase [--incremental]` | Generate `.codebase/` documentation |
67
- | `/fd-write-docs [--scope=path]` | Generate documentation from public APIs |
68
- | `/fd-multi-repo <list\|add\|remove\|status>` | Manage multi-repo configuration |
69
- | `/fd-translate-intent "<vague request>"` | Convert vague request into ranked implementation options |
70
- | `/fd-ask "<question>"` | Route question to specialist agent |
71
- | `/fd-quick "<task>"` | Quick focused task with automatic agent selection |
72
- | `/fd-doctor` | Check FlowDeck installation and environment health |
1
+ # FlowDeck
2
+
3
+ > AI-powered multi-agent workflow orchestration with built-in safety intelligence for OpenCode
4
+
5
+ FlowDeck structures every feature through a six-step cycle:
6
+ `/fd-map-codebase` → `/fd-new-feature` → `/fd-discuss` → `/fd-plan` → `/fd-execute` → `/fd-verify`
7
+
8
+ ## Features
9
+
10
+ - **25 agents** — architect, planner, coder, reviewer, tester, debugger, risk-analyst, policy-enforcer, and more
11
+ - **59 skills** reusable workflow patterns (TDD, security scan, code review, deploy check, and more)
12
+ - **20 commands** workflow commands for all project operations
13
+ - **Persistent state** resume exactly where you left off across sessions via `.planning/STATE.md`
14
+ - **Parallel execution** — independent tasks run simultaneously in wave-structured batches
15
+ - **AI Safety layer** — patch trust scoring, edit gates, phase gating, regression prediction built into every workflow
16
+
17
+ ## Quick Reference
18
+
19
+ | Command | Purpose |
20
+ |---------|---------|
21
+ | `/fd-map-codebase` | Analyse and index the codebase into structured `.codebase/` files |
22
+ | `/fd-new-feature` | Define a new feature and initialize feature context |
23
+ | `/fd-discuss` | Pre-planning structured Q&A to capture decisions |
24
+ | `/fd-plan` | Generate a wave-structured execution plan |
25
+ | `/fd-execute` | Implement feature with TDD discipline and parallel agents |
26
+ | `/fd-verify` | Full verification pipeline: tests, code review, security scan |
27
+ | `/fd-checkpoint` | Save a mid-session checkpoint to STATE.md |
28
+ | `/fd-resume` | Reload checkpoint to continue interrupted session |
29
+ | `/fd-status` | View project progress and roadmap |
30
+ | `/fd-doctor` | Check FlowDeck installation and environment health |
31
+
32
+ ## Next Steps
33
+
34
+ - [Getting Started → Installation](getting-started/installation.md)
35
+ - [Quick Start First 15 Minutes](getting-started/quick-start.md)
36
+ - [First Project → Bootstrap Your First Project](getting-started/first-project.md)
@@ -0,0 +1,176 @@
1
+ # System Hooks Reference
2
+
3
+ FlowDeck implements deep system hooks that react to OpenCode lifecycle events. These hooks maintain session state, inject environment context, monitor resource usage, and send notifications without requiring any explicit commands.
4
+
5
+ ---
6
+
7
+ ## Hooks Overview
8
+
9
+ | Hook | Fires On | Purpose |
10
+ |------|----------|---------|
11
+ | `session-start` | `session.created` | Loads and injects prior planning state into the new session |
12
+ | `compaction` | `experimental.session.compacting` | Preserves planning context before context window compaction |
13
+ | `shell-env` | Every `bash` tool execution | Injects FlowDeck environment variables |
14
+ | `context-window-monitor` | `message.updated`, `tool.execute.after` | Warns when context usage exceeds 70% of the token limit |
15
+ | `session-idle` | `session.idle` (when files edited) | Desktop notification and edits summary logging |
16
+ | `notifications` | Various | Desktop notification dispatch |
17
+ | `file-tracker` | During session | Tracks edited file paths across agent turns |
18
+
19
+ ---
20
+
21
+ ## `session-start` Hook
22
+
23
+ **File:** `src/hooks/session-start.ts`
24
+
25
+ **Fires:** `session.created` — when a new OpenCode session starts.
26
+
27
+ **What it does:**
28
+
29
+ Reads `.planning/STATE.md` from the workspace and injects the following context keys:
30
+
31
+ | Context Key | Source | Description |
32
+ |------------|--------|-------------|
33
+ | `flowdeck_phase` | `current_phase.phase` in STATE.md | Current planning phase or `null` if fresh |
34
+ | `flowdeck_status` | `current_phase.status` in STATE.md | Phase status or `null` |
35
+ | `flowdeck_steps_pending` | `current_phase.steps_pending` in STATE.md | Pending steps or `null` |
36
+ | `flowdeck_last_action` | `current_phase.last_action` in STATE.md | Last executed action or `null` |
37
+ | `flowdeck_has_codebase` | — | Whether `.codebase/` directory exists |
38
+ | `flowdeck_workspace_root` | `opencode.json` workspace config | Workspace root if multi-repo detected |
39
+ | `flowdeck_sub_repos` | `opencode.json` workspace config | List of sub-repositories |
40
+ | `flowdeck_workspace_mode` | `opencode.json` workspace config | Workspace mode |
41
+
42
+ **State read:**
43
+ - `.planning/STATE.md`
44
+ - `.codebase/` (existence check only)
45
+ - `opencode.json` (workspace config, if present)
46
+
47
+ **Errors:** If the state file is unreadable, the hook returns with `flowdeck_status: "error"` and a warning message — it does not block session startup.
48
+
49
+ ---
50
+
51
+ ## `compaction` Hook
52
+
53
+ **File:** `src/hooks/compaction-hook.ts`
54
+
55
+ **Fires:** `experimental.session.compacting` — when OpenCode triggers context window compaction.
56
+
57
+ **What it does:**
58
+
59
+ Injects a structured 8-section summary into the compaction context so the LLM summarization preserves FlowDeck-specific state:
60
+
61
+ 1. **Planning State** — First 1500 characters of `.planning/STATE.md`
62
+ 2. **Codebase Index** — First 800 characters of `.planning/CODEBASE_INDEX.md` (if present)
63
+ 3. **Recently Edited Files** — Up to 20 files from `SessionFileTracker`
64
+
65
+ Then replaces the default summarization prompt with a structured template that requires the summary to include:
66
+ - User requests (verbatim)
67
+ - Final goal
68
+ - Work completed
69
+ - Remaining tasks
70
+ - Active working context
71
+ - Explicit constraints (verbatim)
72
+ - Verification state
73
+ - Delegated agent sessions (with `session_id` for resume)
74
+
75
+ **State read:**
76
+ - `.planning/STATE.md`
77
+ - `.planning/CODEBASE_INDEX.md`
78
+ - In-memory `SessionFileTracker` (edited paths ring buffer)
79
+
80
+ ---
81
+
82
+ ## `shell-env` Hook
83
+
84
+ **File:** `src/hooks/shell-env-hook.ts`
85
+
86
+ **Fires:** Every `bash` tool execution.
87
+
88
+ **What it does:**
89
+
90
+ Injects the following environment variables into every bash tool execution:
91
+
92
+ | Env Var | Source | Description |
93
+ |---------|--------|-------------|
94
+ | `FLOWDECK_VERSION` | `package.json` | Installed FlowDeck version |
95
+ | `FLOWDECK_PLUGIN` | `"true"` (constant) | Plugin activation flag |
96
+ | `PROJECT_ROOT` | `worktree` or `directory` | Resolved project root |
97
+ | `PACKAGE_MANAGER` | Detected lockfile | `npm`, `yarn`, `pnpm`, or `bun` |
98
+ | `DETECTED_LANGUAGES` | Marker files scan | Comma-separated list (e.g., `typescript,python`) |
99
+ | `PRIMARY_LANGUAGE` | Marker files scan | First detected language |
100
+ | `FLOWDECK_PHASE` | `STATE.md` phase field | Current FlowDeck planning phase |
101
+
102
+ Language detection uses marker files: `tsconfig.json` (TypeScript), `go.mod` (Go), `pyproject.toml`/`requirements.txt` (Python), `Cargo.toml` (Rust), `build.gradle`/`pom.xml` (Java).
103
+
104
+ **State read:** `package.json`, lockfiles, marker files, `.planning/STATE.md`
105
+
106
+ ---
107
+
108
+ ## `context-window-monitor` Hook
109
+
110
+ **File:** `src/hooks/context-window-monitor.ts`
111
+
112
+ **Fires:** `message.updated` (assistant messages with token info), `tool.execute.after`.
113
+
114
+ **What it does:**
115
+
116
+ Tracks token usage per session. When input token usage exceeds 70% of `FLOWDECK_CONTEXT_LIMIT` (default: 200,000 tokens), appends a warning to the next tool output:
117
+
118
+ ```
119
+ [FlowDeck Context Monitor]
120
+ Context: 71.4% used (142,800/200,000 tokens), 28.6% remaining.
121
+ You still have context remaining — do NOT rush or skip tasks. Work thoroughly.
122
+ ```
123
+
124
+ The warning fires once per session (tracked by `sessionID`).
125
+
126
+ **Token limit override:** Set `FLOWDECK_CONTEXT_LIMIT` env var (e.g., `FLOWDECK_CONTEXT_LIMIT=150000`).
127
+
128
+ **State read:** Per-session token cache from `message.updated` events.
129
+
130
+ ---
131
+
132
+ ## `session-idle` Hook
133
+
134
+ **File:** `src/hooks/session-idle-hook.ts`
135
+
136
+ **Fires:** `session.idle` — when OpenCode's session becomes idle after a task is completed.
137
+
138
+ **Fires only when:** At least one file has been edited during the session (empty idle events are ignored).
139
+
140
+ **What it does:**
141
+
142
+ 1. Sends a desktop notification via `notifySessionIdle()`
143
+ 2. Logs a session summary via `client.app.log` (up to 10 edited files, then `… and N more`)
144
+
145
+ **State read:** In-memory `SessionFileTracker` (edited paths ring buffer).
146
+
147
+ ---
148
+
149
+ ## `file-tracker`
150
+
151
+ **File:** `src/hooks/file-tracker.ts`
152
+
153
+ **When it runs:** Continuously during session, tracking every file path edited by agents.
154
+
155
+ **What it does:**
156
+
157
+ Maintains a ring buffer of edited file paths. Consumed by the `compaction` hook (recently edited files) and `session-idle` hook (edited summary).
158
+
159
+ Implements a windowed snapshot of edited paths per session — consumed by compaction hook and idle hook.
160
+
161
+ ---
162
+
163
+ ## Other Hooks
164
+
165
+ | Hook | File | Purpose |
166
+ |------|------|---------|
167
+ | `approval-hook` | `approval-hook.ts` | Phase/project-level approval gates |
168
+ | `orchestrator-guard-hook` | `orchestrator-guard-hook.ts` | Guarding orchestrator delegation patterns |
169
+ | `decision-trace-hook` | `decision-trace-hook.ts` | Decision audit trail |
170
+ | `telemetry-hook` | `telemetry-hook.ts` | Workflow telemetry |
171
+ | `patch-trust` | `patch-trust.ts` | AI safety: patch trust scoring |
172
+ | `tool-guard` | `tool-guard.ts` | Tool usage guardrails |
173
+ | `auto-learn-hook` | `auto-learn-hook.ts` | Runtime policy learning |
174
+ | `todo-hook` | `todo-hook.ts` | Todo tracking integration |
175
+
176
+ These hooks are internal governance and safety mechanisms. The five hooks described above are the ones users interact with most directly.