@dv.nghiem/flowdeck 0.4.10 → 0.4.12
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 +0 -2
- package/dist/dashboard/lib/state-reader.d.ts +2 -1
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +128 -13
- package/dist/dashboard/types.d.ts +12 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/shell-env-hook.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -342
- package/dist/mcp/index.d.ts +1 -2
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/services/loop-detector.d.ts.map +1 -1
- package/docs/getting-started/installation.md +0 -18
- package/docs/index.md +0 -1
- package/docs/reference/hooks.md +1 -16
- package/package.json +6 -6
- package/src/commands/fd-execute.md +1 -1
- package/src/commands/fd-fix-bug.md +1 -1
- package/src/commands/fd-plan.md +1 -1
- package/src/rules/common/agent-defense.md +66 -0
- package/src/rules/common/agent-orchestration.md +35 -1
- package/src/skills/context-budget/SKILL.md +266 -0
- package/src/skills/context-guard/SKILL.md +172 -0
- package/src/skills/context-steward/SKILL.md +297 -0
- package/src/skills/decision-trace/SKILL.md +137 -0
- package/src/skills/research-first/SKILL.md +344 -0
- package/src/skills/session-persistence/SKILL.md +320 -0
- package/src/skills/telemetry-steward/SKILL.md +191 -0
- package/dist/services/rtk-manager.d.ts +0 -80
- package/dist/services/rtk-manager.d.ts.map +0 -1
- package/dist/services/rtk-policy.d.ts +0 -26
- package/dist/services/rtk-policy.d.ts.map +0 -1
- package/dist/tools/rtk-setup.d.ts +0 -22
- package/dist/tools/rtk-setup.d.ts.map +0 -1
- package/docs/reference/rtk.md +0 -162
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research-first
|
|
3
|
+
description: Strict research hierarchy before writing code — search codebase, docs, web, and registries in order.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /research-first — Research Hierarchy
|
|
7
|
+
|
|
8
|
+
Enforces a strict research-first workflow before any implementation. Research in order of proximity: codebase first, structured docs second, web third, registries last.
|
|
9
|
+
|
|
10
|
+
## Trigger
|
|
11
|
+
|
|
12
|
+
Use this skill when:
|
|
13
|
+
- About to write any new function, module, or integration
|
|
14
|
+
- Unsure of an API signature, behavior, or pattern
|
|
15
|
+
- Creating utilities, helpers, or abstractions
|
|
16
|
+
- Evaluating whether to add a dependency
|
|
17
|
+
- Debugging an issue in unfamiliar code
|
|
18
|
+
|
|
19
|
+
## The Four-Level Hierarchy
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
23
|
+
│ RESEARCH HIERARCHY │
|
|
24
|
+
├─────────────────────────────────────────────────────────────┤
|
|
25
|
+
│ LEVEL 1: CODEBASE │
|
|
26
|
+
│ ┌─────────────┐ ┌─────────────────┐ │
|
|
27
|
+
│ │ CodeGraph │ │ grep.app │ │
|
|
28
|
+
│ │ (indexed) │ │ (code search) │ │
|
|
29
|
+
│ └─────────────┘ └─────────────────┘ │
|
|
30
|
+
│ When: Need patterns, examples, or existing implementations │
|
|
31
|
+
│ Escalate: If codebase has no relevant code │
|
|
32
|
+
├─────────────────────────────────────────────────────────────┤
|
|
33
|
+
│ LEVEL 2: STRUCTURED DOCS │
|
|
34
|
+
│ ┌─────────────────┐ │
|
|
35
|
+
│ │ Context7 MCP │ │
|
|
36
|
+
│ │ (library docs) │ │
|
|
37
|
+
│ └─────────────────┘ │
|
|
38
|
+
│ When: Need accurate API signatures and usage │
|
|
39
|
+
│ Escalate: If library not indexed or docs incomplete │
|
|
40
|
+
├─────────────────────────────────────────────────────────────┤
|
|
41
|
+
│ LEVEL 3: WEB SEARCH │
|
|
42
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
43
|
+
│ │ Exa MCP │ │ Web fetch │ │
|
|
44
|
+
│ │ (semantic) │ │ (direct) │ │
|
|
45
|
+
│ └─────────────┘ └─────────────┘ │
|
|
46
|
+
│ When: Level 1-2 insufficient or library unfamiliar │
|
|
47
|
+
│ Escalate: If no authoritative source found │
|
|
48
|
+
├─────────────────────────────────────────────────────────────┤
|
|
49
|
+
│ LEVEL 4: PACKAGE REGISTRIES │
|
|
50
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
51
|
+
│ │ npm / PyPI │ │ GitHub │ │
|
|
52
|
+
│ │ (search) │ │ (packages) │ │
|
|
53
|
+
│ └─────────────┘ └─────────────┘ │
|
|
54
|
+
│ When: Need to verify existence of utility / alternative │
|
|
55
|
+
│ Escalate: Only if nothing suitable exists │
|
|
56
|
+
└─────────────────────────────────────────────────────────────┘
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Level 1: Codebase Search
|
|
60
|
+
|
|
61
|
+
**When to use:** Always start here. Before writing anything, check if the pattern already exists in the project.
|
|
62
|
+
|
|
63
|
+
**Tools:**
|
|
64
|
+
- `codegraph_search` — find symbols, functions, types by name
|
|
65
|
+
- `codegraph_context` — understand how a module or feature works
|
|
66
|
+
- `codegraph_explore` — inspect related symbols across files
|
|
67
|
+
- `grep_app_searchGitHub` — search GitHub for real-world code examples
|
|
68
|
+
|
|
69
|
+
**What to look for:**
|
|
70
|
+
- Existing utility functions that do what you need
|
|
71
|
+
- Similar features implemented elsewhere in the project
|
|
72
|
+
- Naming conventions and patterns used by the team
|
|
73
|
+
- Test files that show expected usage
|
|
74
|
+
|
|
75
|
+
**Escalate to Level 2 when:**
|
|
76
|
+
- The codebase has no relevant implementation
|
|
77
|
+
- You need library-specific API details
|
|
78
|
+
- The project uses an external dependency you are unfamiliar with
|
|
79
|
+
|
|
80
|
+
### Level 1 Example
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Need: Parse a JSON configuration file with defaults
|
|
84
|
+
|
|
85
|
+
Step 1: codegraph_search for "parseConfig" or "loadConfig"
|
|
86
|
+
Result: Found loadConfig() in src/config/loader.ts
|
|
87
|
+
|
|
88
|
+
Step 2: codegraph_context for "config loader"
|
|
89
|
+
Result: Understands the loader handles JSON, YAML, and env overrides
|
|
90
|
+
|
|
91
|
+
Decision: Reuse loadConfig() instead of writing a new parser.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Level 2: Structured Documentation (Context7)
|
|
95
|
+
|
|
96
|
+
**When to use:** You need accurate API signatures, method names, parameter types, or version-specific behavior for a library.
|
|
97
|
+
|
|
98
|
+
**Tools:**
|
|
99
|
+
- `context7_resolve-library-id` — find the correct Context7 ID
|
|
100
|
+
- `context7_query-docs` — query structured documentation with examples
|
|
101
|
+
|
|
102
|
+
**What to look for:**
|
|
103
|
+
- Exact function signatures and return types
|
|
104
|
+
- Code examples from official docs
|
|
105
|
+
- Version-specific behavior and deprecations
|
|
106
|
+
- Configuration options and defaults
|
|
107
|
+
|
|
108
|
+
**Escalate to Level 3 when:**
|
|
109
|
+
- The library is not indexed in Context7
|
|
110
|
+
- The docs are incomplete or ambiguous
|
|
111
|
+
- You need community patterns, not just API reference
|
|
112
|
+
|
|
113
|
+
### Level 2 Example
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Need: Use React useEffect cleanup correctly
|
|
117
|
+
|
|
118
|
+
Step 1: context7_resolve-library-id for "React"
|
|
119
|
+
Result: /facebook/react
|
|
120
|
+
|
|
121
|
+
Step 2: context7_query-docs for "useEffect cleanup function examples"
|
|
122
|
+
Result: Official patterns for subscription cleanup, event listener removal
|
|
123
|
+
|
|
124
|
+
Decision: Use the documented cleanup pattern; no need to search further.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Level 3: Web Search
|
|
128
|
+
|
|
129
|
+
**When to use:** Levels 1-2 failed to answer the question, or you need community consensus, real-world patterns, or comparisons.
|
|
130
|
+
|
|
131
|
+
**Tools:**
|
|
132
|
+
- `exa_search` — neural search for high-quality sources
|
|
133
|
+
- `webfetch` — fetch specific pages for details
|
|
134
|
+
- `websearch_web_search_exa` — general web search
|
|
135
|
+
|
|
136
|
+
**What to look for:**
|
|
137
|
+
- Authoritative blog posts or documentation pages
|
|
138
|
+
- GitHub issues or discussions explaining edge cases
|
|
139
|
+
- Comparison articles when choosing between alternatives
|
|
140
|
+
- Community best practices
|
|
141
|
+
|
|
142
|
+
**Escalate to Level 4 when:**
|
|
143
|
+
- No authoritative source answers the question
|
|
144
|
+
- You are considering writing a utility and need to check if a package exists
|
|
145
|
+
- You need to verify package names, versions, or alternatives
|
|
146
|
+
|
|
147
|
+
### Level 3 Example
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Need: Understand how to handle rate limiting in a specific API
|
|
151
|
+
|
|
152
|
+
Step 1: Level 1 — codebase has no API client for this service
|
|
153
|
+
Step 2: Level 2 — Context7 has no docs for this third-party API
|
|
154
|
+
Step 3: exa_search for "[ServiceName] API rate limit headers retry-after"
|
|
155
|
+
Result: Found official docs and community client implementations
|
|
156
|
+
|
|
157
|
+
Decision: Implement retry with exponential backoff based on Retry-After header.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Level 4: Package Registries
|
|
161
|
+
|
|
162
|
+
**When to use:** Before writing any utility function, verify it does not already exist as a well-maintained package.
|
|
163
|
+
|
|
164
|
+
**Tools:**
|
|
165
|
+
- `grep_app_searchGitHub` — search for existing npm/PyPI packages with real usage
|
|
166
|
+
- `webfetch` — check npmjs.com or pypi.org directly
|
|
167
|
+
|
|
168
|
+
**What to look for:**
|
|
169
|
+
- Packages that solve the exact problem
|
|
170
|
+
- Download counts, maintenance status, and license compatibility
|
|
171
|
+
- Bundle size and dependency tree (avoid bloat)
|
|
172
|
+
|
|
173
|
+
**When to stop:**
|
|
174
|
+
- A suitable package exists → adopt or extend it
|
|
175
|
+
- No suitable package exists → build custom, informed by research
|
|
176
|
+
|
|
177
|
+
### Level 4 Example
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
Need: Deep merge two objects with type safety
|
|
181
|
+
|
|
182
|
+
Step 1-3: No existing implementation or docs answer the need
|
|
183
|
+
Step 4: Search npm for "deep merge typescript"
|
|
184
|
+
Result: lodash.merge (too heavy), deepmerge-ts (lightweight, typed)
|
|
185
|
+
|
|
186
|
+
Decision: Install deepmerge-ts. Do not write a custom deep merge.
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Decision Tree
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
START: Need to implement or understand something
|
|
193
|
+
│
|
|
194
|
+
▼
|
|
195
|
+
┌───────────────────┐
|
|
196
|
+
│ Search codebase │ ──NO──▶ ┌─────────────────────┐
|
|
197
|
+
│ (CodeGraph, grep) │ │ Search structured docs│
|
|
198
|
+
└───────────────────┘ │ (Context7 MCP) │
|
|
199
|
+
│YES └─────────────────────┘
|
|
200
|
+
▼ │
|
|
201
|
+
[REUSE OR MODEL │NO
|
|
202
|
+
AFTER EXISTING] ▼
|
|
203
|
+
┌─────────────────────┐
|
|
204
|
+
│ Search web │
|
|
205
|
+
│ (Exa, webfetch) │
|
|
206
|
+
└─────────────────────┘
|
|
207
|
+
│
|
|
208
|
+
│NO
|
|
209
|
+
▼
|
|
210
|
+
┌─────────────────────┐
|
|
211
|
+
│ Check registries │
|
|
212
|
+
│ (npm, PyPI, GitHub) │
|
|
213
|
+
└─────────────────────┘
|
|
214
|
+
│
|
|
215
|
+
│NO
|
|
216
|
+
▼
|
|
217
|
+
[BUILD CUSTOM]
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Anti-Patterns
|
|
221
|
+
|
|
222
|
+
### Do NOT guess API signatures
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
❌ BAD:
|
|
226
|
+
"I think the function is called fetchData(url, options)..."
|
|
227
|
+
|
|
228
|
+
✅ GOOD:
|
|
229
|
+
Use Context7 to query the exact signature, or use codegraph_search
|
|
230
|
+
to find existing calls in the codebase.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Do NOT write utility functions that already exist
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
❌ BAD:
|
|
237
|
+
Write a custom deepClone() without checking if the project already
|
|
238
|
+
uses a utility library or has an internal implementation.
|
|
239
|
+
|
|
240
|
+
✅ GOOD:
|
|
241
|
+
1. codegraph_search for "clone", "deepClone", "copy"
|
|
242
|
+
2. Check package.json for lodash, ramda, or similar
|
|
243
|
+
3. Only write custom if nothing suitable exists
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Do NOT search the web before searching the codebase
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
❌ BAD:
|
|
250
|
+
Open a browser search for "how to parse JSON in TypeScript" when
|
|
251
|
+
the project already has a config loader module.
|
|
252
|
+
|
|
253
|
+
✅ GOOD:
|
|
254
|
+
Start with codegraph_context for "config" or "parse" to find
|
|
255
|
+
internal patterns before looking externally.
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Do NOT load full documentation pages into context
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
❌ BAD:
|
|
262
|
+
Fetch an entire docs website or README and dump it into the
|
|
263
|
+
conversation context.
|
|
264
|
+
|
|
265
|
+
✅ GOOD:
|
|
266
|
+
Use Context7 for targeted queries. If using webfetch, request
|
|
267
|
+
only the specific section or example needed.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Concrete Examples
|
|
271
|
+
|
|
272
|
+
### Example 1: Implementing a Retry Wrapper
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
❌ BAD APPROACH:
|
|
276
|
+
- Assume the signature: async function retry(fn, retries)
|
|
277
|
+
- Write a 40-line custom retry with exponential backoff
|
|
278
|
+
- Discover later the project uses p-retry everywhere
|
|
279
|
+
|
|
280
|
+
✅ GOOD APPROACH:
|
|
281
|
+
1. codegraph_search for "retry" → finds p-retry usage in src/utils/
|
|
282
|
+
2. codegraph_context for "retry pattern" → understands backoff config
|
|
283
|
+
3. Reuse p-retry with project-standard options
|
|
284
|
+
4. Implementation: 3 lines
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Example 2: Parsing a Date Format
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
❌ BAD APPROACH:
|
|
291
|
+
- Write a regex: /^(\d{4})-(\d{2})-(\d{2})$/
|
|
292
|
+
- Handle edge cases manually (leap years, timezones)
|
|
293
|
+
- Result: 30 lines, untested, buggy
|
|
294
|
+
|
|
295
|
+
✅ GOOD APPROACH:
|
|
296
|
+
1. codegraph_search for "date-fns", "moment", "luxon" in imports
|
|
297
|
+
2. Context7 query for date-fns parseISO documentation
|
|
298
|
+
3. Use date-fns.parseISO() — battle-tested, 1 line
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Example 3: Validating an Email Address
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
❌ BAD APPROACH:
|
|
305
|
+
- Write a regex from memory
|
|
306
|
+
- Guess at what constitutes a valid email
|
|
307
|
+
- Result: fragile, probably wrong
|
|
308
|
+
|
|
309
|
+
✅ GOOD APPROACH:
|
|
310
|
+
1. codegraph_search for "email" and "validate" or "zod"
|
|
311
|
+
2. Find existing zod schema: z.string().email()
|
|
312
|
+
3. Reuse the existing validation pattern
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Tool Reference
|
|
316
|
+
|
|
317
|
+
| Tool | Level | Purpose |
|
|
318
|
+
|------|-------|---------|
|
|
319
|
+
| `codegraph_search` | 1 | Find symbols by name |
|
|
320
|
+
| `codegraph_context` | 1 | Understand modules and features |
|
|
321
|
+
| `codegraph_explore` | 1 | Inspect related symbols |
|
|
322
|
+
| `grep_app_searchGitHub` | 1, 4 | Code search across GitHub |
|
|
323
|
+
| `context7_resolve-library-id` | 2 | Find library in Context7 |
|
|
324
|
+
| `context7_query-docs` | 2 | Query structured documentation |
|
|
325
|
+
| `exa_search` | 3 | Neural web search |
|
|
326
|
+
| `webfetch` | 3 | Fetch specific pages |
|
|
327
|
+
| `websearch_web_search_exa` | 3 | General web search |
|
|
328
|
+
|
|
329
|
+
## Cross-References
|
|
330
|
+
|
|
331
|
+
- **`search-first`** — Use when evaluating whether to adopt, extend, or build. `research-first` is about the search *process*; `search-first` is about the *decision* after research.
|
|
332
|
+
- **`documentation-writer`** — After researching, use this to document findings and patterns for the team.
|
|
333
|
+
- **`api-design`** — When research reveals the need for new interfaces, use this skill to design them consistently.
|
|
334
|
+
|
|
335
|
+
## Integration Points
|
|
336
|
+
|
|
337
|
+
### With `@backend-coder`
|
|
338
|
+
Before implementing any feature, the backend coder should run through Levels 1-2. Only escalate to 3-4 if the codebase and Context7 are insufficient.
|
|
339
|
+
|
|
340
|
+
### With `@researcher`
|
|
341
|
+
The researcher agent specializes in external discovery (Levels 2-4). The coder should handle Level 1 directly before delegating deeper research.
|
|
342
|
+
|
|
343
|
+
### With `@planner`
|
|
344
|
+
The planner should assume research is complete. If a plan includes "write utility X", the planner must verify via codegraph that X does not already exist.
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-persistence
|
|
3
|
+
description: Maintain continuity across FlowDeck sessions by loading previous context, checkpointing mid-session state, and writing structured summaries at session end.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Session Persistence
|
|
8
|
+
|
|
9
|
+
FlowDeck sessions are bounded by context windows. This skill ensures work survives across sessions without losing state, decisions, or momentum.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate at:
|
|
14
|
+
- **Session start** — before any agent does work
|
|
15
|
+
- **Mid-session** — when context exceeds 60% of the window
|
|
16
|
+
- **Session end** — before closing the workspace
|
|
17
|
+
|
|
18
|
+
## Core Principles
|
|
19
|
+
|
|
20
|
+
- Load before you act. Never start work without reading the prior session summary.
|
|
21
|
+
- Checkpoint early and often. Ephemeral state is lost when the context window rolls over.
|
|
22
|
+
- Summaries are append-only. Each session adds a new entry; old entries rotate monthly.
|
|
23
|
+
- STATE.md owns the plan. SESSION_SUMMARY.md owns the narrative. Do not duplicate.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Phase 1: Session Start
|
|
28
|
+
|
|
29
|
+
**Goal**: Bring the agent up to speed on what happened in the previous session and what remains.
|
|
30
|
+
|
|
31
|
+
### Files to Read
|
|
32
|
+
|
|
33
|
+
| File | Purpose | Max Chars | Required |
|
|
34
|
+
|------|---------|-----------|----------|
|
|
35
|
+
| `.planning/STATE.md` | Current phase, active plan, blockers, steps completed | 10,000 | Yes |
|
|
36
|
+
| `.planning/SESSION_SUMMARY.md` | Prior session narratives, decisions, failures, remaining work | 15,000 | Yes |
|
|
37
|
+
| `.planning/phases/phase-N/PLAN.md` | Active plan with tasks and success criteria | 8,000 | If referenced in STATE.md |
|
|
38
|
+
| `.codebase/DECISIONS.jsonl` | Recent decisions relevant to active work | 5,000 | Query last 10 entries |
|
|
39
|
+
|
|
40
|
+
### Information to Capture
|
|
41
|
+
|
|
42
|
+
1. **Phase and status** — from STATE.md
|
|
43
|
+
2. **Last completed step** — what was finished
|
|
44
|
+
3. **Next pending step** — what should happen now
|
|
45
|
+
4. **Blockers** — anything preventing progress
|
|
46
|
+
5. **Approaches that failed** — avoid repeating them
|
|
47
|
+
6. **Key decisions** — links to DECISIONS.jsonl entries
|
|
48
|
+
7. **Files modified** — what changed recently
|
|
49
|
+
8. **Test status** — green, failing, or unknown
|
|
50
|
+
|
|
51
|
+
### Commands to Use
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
/fd-resume # Load STATE.md and latest SESSION_SUMMARY.md entry
|
|
55
|
+
/fd-status # Show current phase, next step, and blocker summary
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Context Bounding Rules
|
|
59
|
+
|
|
60
|
+
- If SESSION_SUMMARY.md exceeds 15,000 chars, read only the **last 3 entries**.
|
|
61
|
+
- If there are more than 10 entries total, archive entries older than 30 days.
|
|
62
|
+
- Never load the full git history — use `git log --oneline -10` if needed.
|
|
63
|
+
|
|
64
|
+
### Startup Briefing Format
|
|
65
|
+
|
|
66
|
+
After loading, produce:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
## Session Resume
|
|
70
|
+
|
|
71
|
+
**Phase**: [N] — [name] | **Status**: [discuss | plan | execute | review]
|
|
72
|
+
**Plan**: [path or "none"]
|
|
73
|
+
**Last Step Completed**: [step number + name]
|
|
74
|
+
**Next Step**: [step number + name]
|
|
75
|
+
**Blockers**: [none | description]
|
|
76
|
+
|
|
77
|
+
**Context from Previous Session**:
|
|
78
|
+
- [What was attempted]
|
|
79
|
+
- [What worked]
|
|
80
|
+
- [What failed]
|
|
81
|
+
- [What remains]
|
|
82
|
+
|
|
83
|
+
**Key Decisions**: [links to DECISIONS.jsonl entries]
|
|
84
|
+
**Files Modified**: [list]
|
|
85
|
+
**Tests**: [passing | failing | unknown]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Phase 2: Mid-Session Checkpoint
|
|
91
|
+
|
|
92
|
+
**Goal**: Save ephemeral state before the context window rolls over or before switching tasks.
|
|
93
|
+
|
|
94
|
+
### When to Checkpoint
|
|
95
|
+
|
|
96
|
+
- Context window is > 60% full
|
|
97
|
+
- Before running a long command (build, test suite, migration)
|
|
98
|
+
- Before switching agents or workflows
|
|
99
|
+
- Before pausing for research or discussion
|
|
100
|
+
|
|
101
|
+
### What to Save
|
|
102
|
+
|
|
103
|
+
| Data | Storage | Tool |
|
|
104
|
+
|------|---------|------|
|
|
105
|
+
| Current plan step | `.planning/STATE.md` | `planning-state` |
|
|
106
|
+
| Partial implementation notes | `.planning/SESSION_SUMMARY.md` | Append to latest entry |
|
|
107
|
+
| Decisions made this session | `.codebase/DECISIONS.jsonl` | `decision-trace` |
|
|
108
|
+
| Files modified | `git status` + `git diff --name-only` | Read from git |
|
|
109
|
+
|
|
110
|
+
### Command to Use
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
/fd-checkpoint # Save current state to STATE.md and update SESSION_SUMMARY.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Checkpoint Content
|
|
117
|
+
|
|
118
|
+
A checkpoint is a lightweight update to the current SESSION_SUMMARY.md entry. Include:
|
|
119
|
+
|
|
120
|
+
- **Timestamp** — when the checkpoint occurred
|
|
121
|
+
- **Current step** — what is in progress
|
|
122
|
+
- **Partial results** — what is working so far
|
|
123
|
+
- **Open questions** — what is blocking or unclear
|
|
124
|
+
- **Next action** — what to do immediately after resuming
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Phase 3: Session End
|
|
129
|
+
|
|
130
|
+
**Goal**: Write a durable narrative summary so the next session can resume without re-discovering context.
|
|
131
|
+
|
|
132
|
+
### Files to Write
|
|
133
|
+
|
|
134
|
+
| File | Action | Max Size |
|
|
135
|
+
|------|--------|----------|
|
|
136
|
+
| `.planning/SESSION_SUMMARY.md` | Append new entry | Rotate when file exceeds 50 KB |
|
|
137
|
+
| `.planning/STATE.md` | Update completed steps, status | Keep under 5 KB |
|
|
138
|
+
| `.codebase/DECISIONS.jsonl` | Record any pending decisions | Append only |
|
|
139
|
+
|
|
140
|
+
### Information to Capture
|
|
141
|
+
|
|
142
|
+
1. **Session timestamp** — start and end time
|
|
143
|
+
2. **Phase and step** — what was being worked on
|
|
144
|
+
3. **Approaches that worked** — with evidence (test output, build success, etc.)
|
|
145
|
+
4. **Approaches attempted but failed** — with reason for failure
|
|
146
|
+
5. **What remains to do** — next steps with clear boundaries
|
|
147
|
+
6. **Key decisions made** — with links to DECISIONS.jsonl entries
|
|
148
|
+
7. **Files modified** — full list with one-line purpose
|
|
149
|
+
8. **Tests status** — which tests pass, which fail, which are new
|
|
150
|
+
9. **Blockers for next session** — anything that needs resolution
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## SESSION_SUMMARY.md Format
|
|
155
|
+
|
|
156
|
+
Each entry is a level-2 section with a standard structure.
|
|
157
|
+
|
|
158
|
+
### Required Sections
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Session YYYY-MM-DD HH:MM
|
|
162
|
+
|
|
163
|
+
**Phase**: [N] — [phase name]
|
|
164
|
+
**Plan**: [path to PLAN.md]
|
|
165
|
+
**Step Worked On**: [step number + name]
|
|
166
|
+
**Agents Involved**: [@agent-name, ...]
|
|
167
|
+
|
|
168
|
+
### What Worked
|
|
169
|
+
|
|
170
|
+
- [Approach 1] — Evidence: [test output / build success / deployed status]
|
|
171
|
+
- [Approach 2] — Evidence: [commit hash / PR link / log snippet]
|
|
172
|
+
|
|
173
|
+
### What Was Attempted But Failed
|
|
174
|
+
|
|
175
|
+
- [Approach] — Reason: [why it failed] — Lesson: [what to try instead]
|
|
176
|
+
|
|
177
|
+
### Remaining Work
|
|
178
|
+
|
|
179
|
+
- [ ] [Next step 1]
|
|
180
|
+
- [ ] [Next step 2]
|
|
181
|
+
|
|
182
|
+
### Key Decisions
|
|
183
|
+
|
|
184
|
+
- [Decision 1] — See `.codebase/DECISIONS.jsonl`:[entry-id]
|
|
185
|
+
- [Decision 2] — See `.codebase/DECISIONS.jsonl`:[entry-id]
|
|
186
|
+
|
|
187
|
+
### Files Modified
|
|
188
|
+
|
|
189
|
+
| File | Change | Purpose |
|
|
190
|
+
|------|--------|---------|
|
|
191
|
+
| `src/...` | Added | ... |
|
|
192
|
+
| `src/...` | Edited | ... |
|
|
193
|
+
|
|
194
|
+
### Tests
|
|
195
|
+
|
|
196
|
+
| Test File | Status | Notes |
|
|
197
|
+
|-----------|--------|-------|
|
|
198
|
+
| `tests/...` | Passing | ... |
|
|
199
|
+
| `tests/...` | Failing | ... |
|
|
200
|
+
| `tests/...` | New | ... |
|
|
201
|
+
|
|
202
|
+
### Blockers
|
|
203
|
+
|
|
204
|
+
- [none | description]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Template: SESSION_SUMMARY.md
|
|
210
|
+
|
|
211
|
+
```markdown
|
|
212
|
+
# Session Summaries
|
|
213
|
+
|
|
214
|
+
> Rotate monthly. Archive entries older than 30 days to `.planning/archive/summaries-YYYY-MM.md`.
|
|
215
|
+
|
|
216
|
+
## Session 2026-06-10 14:00
|
|
217
|
+
|
|
218
|
+
**Phase**: 2 — Implementation
|
|
219
|
+
**Plan**: `.planning/phases/phase-2/PLAN.md`
|
|
220
|
+
**Step Worked On**: 2.3 — Add billing service
|
|
221
|
+
**Agents Involved**: [@backend-coder, @tester]
|
|
222
|
+
|
|
223
|
+
### What Worked
|
|
224
|
+
|
|
225
|
+
- Using Stripe's `SubscriptionSchedule` for phased rollouts — Evidence: `npm test tests/billing.test.ts` passes
|
|
226
|
+
- Mocking the Stripe API with `stripe-mock` in CI — Evidence: CI run #412 green
|
|
227
|
+
|
|
228
|
+
### What Was Attempted But Failed
|
|
229
|
+
|
|
230
|
+
- Direct webhook signature verification in the controller — Reason: secret rotation broke tests — Lesson: Move verification to a dedicated middleware with fallback secrets
|
|
231
|
+
|
|
232
|
+
### Remaining Work
|
|
233
|
+
|
|
234
|
+
- [ ] Wire webhook handler to the event bus
|
|
235
|
+
- [ ] Add idempotency key checks
|
|
236
|
+
- [ ] Update API docs
|
|
237
|
+
|
|
238
|
+
### Key Decisions
|
|
239
|
+
|
|
240
|
+
- Use `SubscriptionSchedule` over `Subscription` for enterprise plans — See `.codebase/DECISIONS.jsonl`:billing-schedule-2026-06-10
|
|
241
|
+
|
|
242
|
+
### Files Modified
|
|
243
|
+
|
|
244
|
+
| File | Change | Purpose |
|
|
245
|
+
|------|--------|---------|
|
|
246
|
+
| `src/services/billing.ts` | Added | Core billing logic |
|
|
247
|
+
| `src/middleware/webhook-verify.ts` | Added | Stripe signature verification |
|
|
248
|
+
| `tests/billing.test.ts` | Added | Unit tests for billing service |
|
|
249
|
+
|
|
250
|
+
### Tests
|
|
251
|
+
|
|
252
|
+
| Test File | Status | Notes |
|
|
253
|
+
|-----------|--------|-------|
|
|
254
|
+
| `tests/billing.test.ts` | Passing | 12/12 tests green |
|
|
255
|
+
| `tests/webhook.test.ts` | Failing | 2/5 fail — signature mismatch in test fixtures |
|
|
256
|
+
|
|
257
|
+
### Blockers
|
|
258
|
+
|
|
259
|
+
- Need Stripe test secret key to fix webhook fixtures. Ask DevOps.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Anti-Patterns
|
|
265
|
+
|
|
266
|
+
### Do Not Load Old Context Into New Unrelated Work
|
|
267
|
+
|
|
268
|
+
If a new feature or bug fix is unrelated to the previous session's work, skip loading the full SESSION_SUMMARY.md. Read STATE.md only to confirm the current phase, then start fresh. Loading stale context pollutes the agent's reasoning with irrelevant constraints.
|
|
269
|
+
|
|
270
|
+
**Signal to skip**: The new task's files do not overlap with the prior session's `Files Modified` list.
|
|
271
|
+
|
|
272
|
+
### Do Not Let SESSION_SUMMARY.md Grow Unbounded
|
|
273
|
+
|
|
274
|
+
When the file exceeds 50 KB:
|
|
275
|
+
1. Create `.planning/archive/summaries-YYYY-MM.md`
|
|
276
|
+
2. Move all entries older than 30 days into the archive
|
|
277
|
+
3. Keep only the last 30 days in the active file
|
|
278
|
+
|
|
279
|
+
**Why**: Large summaries slow down session startup and waste context window space.
|
|
280
|
+
|
|
281
|
+
### Do Not Duplicate Information Already in STATE.md
|
|
282
|
+
|
|
283
|
+
SESSION_SUMMARY.md is narrative. STATE.md is structural.
|
|
284
|
+
|
|
285
|
+
| Belongs in STATE.md | Belongs in SESSION_SUMMARY.md |
|
|
286
|
+
|---------------------|-------------------------------|
|
|
287
|
+
| Phase number, plan path | What was attempted and why |
|
|
288
|
+
| Completed step list | Which approaches worked or failed |
|
|
289
|
+
| Blocker IDs | Detailed blocker context and mitigation |
|
|
290
|
+
| Next step reference | What remains to do with boundaries |
|
|
291
|
+
|
|
292
|
+
If STATE.md says "Step 2.3 complete", SESSION_SUMMARY.md should say "Step 2.3 complete — used SubscriptionSchedule approach, tests green".
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## FlowDeck Commands Reference
|
|
297
|
+
|
|
298
|
+
| Command | Phase | Purpose |
|
|
299
|
+
|---------|-------|---------|
|
|
300
|
+
| `/fd-resume` | Start | Load STATE.md and latest SESSION_SUMMARY.md entry |
|
|
301
|
+
| `/fd-checkpoint` | Mid | Save current state before context rolls over |
|
|
302
|
+
| `/fd-status` | Any | Show phase, next step, blockers, and test status |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Related Skills
|
|
307
|
+
|
|
308
|
+
- **[context-load](context-load/SKILL.md)** — Loads the structural context (STATE.md, PLAN.md, PROJECT.md). Use at session start before reading SESSION_SUMMARY.md.
|
|
309
|
+
- **[plan-task](plan-task/SKILL.md)** — Breaks work into waves with verifiable steps. Use when the remaining work in SESSION_SUMMARY.md needs re-planning.
|
|
310
|
+
- **[decision-trace](decision-trace/SKILL.md)** — Records the why behind changes. Link to DECISIONS.jsonl entries from SESSION_SUMMARY.md.
|
|
311
|
+
- **[failure-replay-engine](failure-replay-engine/SKILL.md)** — Tracks failures to avoid repeating them. Check before attempting an approach that failed in a prior session.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Guidance
|
|
316
|
+
|
|
317
|
+
- **One summary per session**. If a session spans multiple days, append a sub-section with the new date rather than creating a new top-level entry.
|
|
318
|
+
- **Evidence over claims**. "Tests pass" is weak. "`npm test` exits 0, 14/14 tests in `billing.test.ts` green" is strong.
|
|
319
|
+
- **Link, don't repeat**. Reference DECISIONS.jsonl entries by ID instead of copying rationale into the summary.
|
|
320
|
+
- **Be honest about failures**. A failed approach with a clear lesson is more valuable than a vague success.
|