learnship 2.0.11 → 2.1.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 (79) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/.cursor-plugin/plugin.json +2 -2
  3. package/README.md +59 -14
  4. package/SKILL.md +24 -2
  5. package/agents/learnship-doc-writer.md +63 -0
  6. package/agents/learnship-security-auditor.md +67 -0
  7. package/bin/install.js +2 -0
  8. package/commands/learnship/discuss-phase.md +1 -1
  9. package/commands/learnship/docs-update.md +22 -0
  10. package/commands/learnship/execute-phase.md +2 -6
  11. package/commands/learnship/extract-learnings.md +22 -0
  12. package/commands/learnship/forensics.md +21 -0
  13. package/commands/learnship/help.md +2 -1
  14. package/commands/learnship/ideate.md +1 -1
  15. package/commands/learnship/milestone-summary.md +22 -0
  16. package/commands/learnship/note.md +22 -0
  17. package/commands/learnship/plan-phase.md +0 -1
  18. package/commands/learnship/quick.md +1 -5
  19. package/commands/learnship/secure-phase.md +23 -0
  20. package/commands/learnship/session-report.md +21 -0
  21. package/commands/learnship/undo.md +22 -0
  22. package/commands/learnship/verify-work.md +1 -1
  23. package/cursor-rules/learnship.mdc +12 -2
  24. package/gemini-extension.json +2 -2
  25. package/hooks/session-start +12 -1
  26. package/learnship/agents/doc-writer.md +63 -0
  27. package/learnship/agents/security-auditor.md +67 -0
  28. package/learnship/references/common-bug-patterns.md +92 -0
  29. package/learnship/references/context-budget.md +49 -0
  30. package/learnship/references/domain-probes.md +133 -0
  31. package/learnship/references/gates.md +72 -0
  32. package/learnship/references/planning-config.md +99 -9
  33. package/learnship/references/thinking-models.md +61 -0
  34. package/learnship/references/universal-anti-patterns.md +51 -0
  35. package/learnship/templates/agents.md +3 -0
  36. package/learnship/templates/context.md +207 -32
  37. package/learnship/templates/discussion-log.md +49 -0
  38. package/learnship/templates/security.md +61 -0
  39. package/learnship/templates/ui-spec.md +107 -0
  40. package/learnship/workflows/complete-milestone.md +4 -5
  41. package/learnship/workflows/compound.md +2 -0
  42. package/learnship/workflows/debug.md +2 -0
  43. package/learnship/workflows/discuss-phase.md +73 -15
  44. package/learnship/workflows/docs-update.md +144 -0
  45. package/learnship/workflows/execute-phase.md +35 -6
  46. package/learnship/workflows/extract-learnings.md +161 -0
  47. package/learnship/workflows/forensics.md +118 -0
  48. package/learnship/workflows/help.md +20 -2
  49. package/learnship/workflows/ideate.md +63 -4
  50. package/learnship/workflows/ls.md +1 -1
  51. package/learnship/workflows/milestone-summary.md +150 -0
  52. package/learnship/workflows/new-project.md +30 -3
  53. package/learnship/workflows/next.md +1 -1
  54. package/learnship/workflows/note.md +110 -0
  55. package/learnship/workflows/pause-work.md +2 -0
  56. package/learnship/workflows/plan-phase.md +17 -2
  57. package/learnship/workflows/quick.md +28 -8
  58. package/learnship/workflows/review.md +1 -0
  59. package/learnship/workflows/secure-phase.md +147 -0
  60. package/learnship/workflows/session-report.md +133 -0
  61. package/learnship/workflows/settings.md +40 -46
  62. package/learnship/workflows/ship.md +2 -0
  63. package/learnship/workflows/undo.md +151 -0
  64. package/learnship/workflows/verify-work.md +36 -4
  65. package/package.json +1 -1
  66. package/references/common-bug-patterns.md +92 -0
  67. package/references/context-budget.md +49 -0
  68. package/references/domain-probes.md +133 -0
  69. package/references/gates.md +72 -0
  70. package/references/planning-config.md +139 -0
  71. package/references/solution-schema.md +159 -0
  72. package/references/thinking-models.md +61 -0
  73. package/references/universal-anti-patterns.md +51 -0
  74. package/templates/agents.md +80 -7
  75. package/templates/config.json +28 -3
  76. package/templates/context.md +207 -32
  77. package/templates/discussion-log.md +49 -0
  78. package/templates/security.md +61 -0
  79. package/templates/ui-spec.md +107 -0
@@ -197,21 +197,107 @@ These options were added in v2.0.0 to support the new compounding, review, ship,
197
197
  | `ship.conventional_commits` | `true` | Use conventional commit format in `/ship` |
198
198
  | `ship.pr_template` | `true` | Auto-generate PR description in `/ship` |
199
199
 
200
- ### Example config.json with v2 options
200
+ </v2_config_options>
201
+
202
+ <v21_config_options>
203
+
204
+ ## v2.1.0 Configuration Options
205
+
206
+ New sections and fields added in v2.1.0 for security, parallelization control, gates, and safety.
207
+
208
+ ### Workflow Section (new fields)
209
+
210
+ | Option | Default | Description |
211
+ |--------|---------|-------------|
212
+ | `workflow.security_enforcement` | `true` | Enable per-phase security verification via `/secure-phase` |
213
+ | `workflow.discuss_mode` | `"discuss"` | Discussion mode for discuss-phase |
214
+ | `workflow.tdd_mode` | `false` | Instruct planner to apply `type: tdd` to eligible tasks |
215
+
216
+ ### Parallelization Section (replaces flat boolean)
217
+
218
+ The `parallelization` field is now an object. Legacy flat `"parallelization": true` is still honored for backward compatibility.
219
+
220
+ | Option | Default | Description |
221
+ |--------|---------|-------------|
222
+ | `parallelization.enabled` | `false` | Enable parallel subagent execution on supported platforms |
223
+ | `parallelization.plan_level` | `true` | Parallelize at plan level (each plan gets its own agent) |
224
+ | `parallelization.task_level` | `false` | Parallelize at task level within a plan (experimental) |
225
+ | `parallelization.max_concurrent_agents` | `5` | Maximum number of concurrent subagents per wave |
226
+ | `parallelization.min_plans_for_parallel` | `2` | Minimum plans in a wave before parallelization activates |
227
+
228
+ **Why default 5?** Each subagent gets its own context window (~200k tokens). 5 agents is the sweet spot for cost vs. speed — most phases have 2-5 plans per wave. Going higher risks git lock contention and significant cost spikes without proportional speed gains. Configurable for power users.
229
+
230
+ ### Gates Section
231
+
232
+ Controls which confirmation prompts are shown during workflows. Set to `false` to skip specific confirmations (useful for experienced users in yolo mode).
233
+
234
+ | Option | Default | Description |
235
+ |--------|---------|-------------|
236
+ | `gates.confirm_project` | `true` | Confirm PROJECT.md before proceeding |
237
+ | `gates.confirm_phases` | `true` | Confirm phase breakdown |
238
+ | `gates.confirm_roadmap` | `true` | Confirm roadmap before proceeding |
239
+ | `gates.confirm_plan` | `true` | Confirm plans before execution |
240
+ | `gates.execute_next_plan` | `true` | Confirm before executing each plan |
241
+ | `gates.issues_review` | `true` | Confirm issue resolution approach |
242
+ | `gates.confirm_transition` | `true` | Confirm before phase transitions |
243
+
244
+ ### Safety Section
245
+
246
+ | Option | Default | Description |
247
+ |--------|---------|-------------|
248
+ | `safety.always_confirm_destructive` | `true` | Always confirm before destructive operations (file deletion, git reset) |
249
+ | `safety.always_confirm_external_services` | `true` | Always confirm before calling external APIs or services |
250
+
251
+ ### Hooks Section
252
+
253
+ | Option | Default | Description |
254
+ |--------|---------|-------------|
255
+ | `hooks.context_warnings` | `true` | Show context budget warnings when usage is high |
256
+
257
+ ### Example config.json with all v2.1 options
201
258
 
202
259
  ```json
203
260
  {
204
261
  "mode": "interactive",
262
+ "granularity": "standard",
205
263
  "model_profile": "balanced",
206
264
  "learning_mode": "auto",
207
- "parallelization": false,
208
265
  "test_first": false,
266
+ "planning": {
267
+ "commit_docs": true,
268
+ "commit_mode": "auto",
269
+ "search_gitignored": false
270
+ },
209
271
  "workflow": {
210
- "review": true,
211
- "solutions_search": true,
212
272
  "research": true,
213
273
  "plan_check": true,
214
- "verifier": true
274
+ "verifier": true,
275
+ "validation": true,
276
+ "review": true,
277
+ "solutions_search": true,
278
+ "security_enforcement": true,
279
+ "discuss_mode": "discuss",
280
+ "tdd_mode": false
281
+ },
282
+ "parallelization": {
283
+ "enabled": false,
284
+ "plan_level": true,
285
+ "task_level": false,
286
+ "max_concurrent_agents": 5,
287
+ "min_plans_for_parallel": 2
288
+ },
289
+ "gates": {
290
+ "confirm_project": true,
291
+ "confirm_phases": true,
292
+ "confirm_roadmap": true,
293
+ "confirm_plan": true,
294
+ "execute_next_plan": true,
295
+ "issues_review": true,
296
+ "confirm_transition": true
297
+ },
298
+ "safety": {
299
+ "always_confirm_destructive": true,
300
+ "always_confirm_external_services": true
215
301
  },
216
302
  "review": {
217
303
  "auto_after_verify": false
@@ -221,13 +307,17 @@ These options were added in v2.0.0 to support the new compounding, review, ship,
221
307
  "conventional_commits": true,
222
308
  "pr_template": true
223
309
  },
224
- "planning": {
225
- "commit_docs": true,
226
- "search_gitignored": false
310
+ "hooks": {
311
+ "context_warnings": true
312
+ },
313
+ "git": {
314
+ "branching_strategy": "none",
315
+ "phase_branch_template": "phase-{phase}-{slug}",
316
+ "milestone_branch_template": "{milestone}-{slug}"
227
317
  }
228
318
  }
229
319
  ```
230
320
 
231
- </v2_config_options>
321
+ </v21_config_options>
232
322
 
233
323
  </planning_config>
@@ -0,0 +1,61 @@
1
+ <thinking_models>
2
+
3
+ Structured reasoning models for the **planner** and **plan-checker** agents. Apply these at decision points during plan creation, not continuously. Each model counters a specific failure mode.
4
+
5
+ ## Conflict Resolution
6
+
7
+ Pre-Mortem and Constraint Analysis both analyze risk at different granularities. Run Constraint Analysis FIRST (identify the hardest constraint), then Pre-Mortem (enumerate failure modes around that constraint and the rest of the plan).
8
+
9
+ ## 1. Pre-Mortem Analysis
10
+
11
+ **Counters:** Optimistic plan decomposition that ignores failure modes.
12
+
13
+ Before finalizing this plan, assume it has already failed. List the 3 most likely reasons for failure — missing dependency, wrong decomposition, underestimated complexity — and add mitigation steps or acceptance criteria that would catch each failure early.
14
+
15
+ ## 2. MECE Decomposition
16
+
17
+ **Counters:** Overlapping tasks (merge conflicts) or gapped tasks (missing requirements).
18
+
19
+ Verify this task breakdown is MECE at the REQUIREMENT level: (1) list every requirement from the phase goal, (2) confirm each maps to exactly one task's `<done>`, (3) if two tasks modify the same file, confirm they modify DIFFERENT sections or serve DIFFERENT requirements, (4) flag any requirement not covered by any task.
20
+
21
+ ## 3. Constraint Analysis
22
+
23
+ **Counters:** Deferring the hardest constraint to the last task, causing late-stage failures.
24
+
25
+ Identify the single hardest constraint in this phase — the one thing that, if it doesn't work, makes everything else irrelevant. Schedule that constraint as Task 1 or 2, not last. If the constraint involves an external API or unfamiliar library, add a spike/proof-of-concept task before the main implementation.
26
+
27
+ ## 4. Reversibility Test
28
+
29
+ **Counters:** Over-analyzing cheap decisions, under-analyzing costly ones.
30
+
31
+ For each significant decision in this plan, classify as REVERSIBLE (can change later with low cost) or IRREVERSIBLE (changing later requires migration, breaking changes, or significant rework). Spend analysis time proportional to irreversibility. For irreversible decisions, document the rationale in the plan.
32
+
33
+ ## 5. Curse of Knowledge Counter
34
+
35
+ **Counters:** Plan-to-executor ambiguity from compressed instructions.
36
+
37
+ For each `<action>` step, re-read it as if you have NEVER seen this codebase. Is every noun unambiguous (which file? which function? which endpoint?)? Is every verb specific (add WHERE? modify HOW?)? If a step could be interpreted two ways, rewrite it. Include file paths, function names, and expected behavior in every action step.
38
+
39
+ ## 6. Base Rate Neglect Counter
40
+
41
+ **Counters:** Planners ignoring low-confidence research caveats.
42
+
43
+ Before finalizing the plan, read ALL `[NEEDS DECISION]` items and LOW-confidence recommendations from RESEARCH.md. For each: either (a) create a checkpoint task to resolve it, or (b) document why the risk is acceptable in the plan's deviation notes. Low-confidence items that are silently accepted become undocumented technical debt.
44
+
45
+ ## Gap Closure Mode: Root-Cause Check
46
+
47
+ **Applies only when:** Planner enters gap closure mode (triggered by `gaps_found` in VERIFICATION.md).
48
+
49
+ Before writing the fix plan, apply a single "why" round: Why did this gap occur? Was it a plan deficiency (wrong task), an execution miss (correct task, wrong implementation), or a changed assumption (environment/dependency shift)? The fix plan must target the root cause category, not just the symptom.
50
+
51
+ ---
52
+
53
+ ## When NOT to Think
54
+
55
+ Skip structured reasoning models when the situation does not benefit from them:
56
+
57
+ - **Single-task plans** — If the phase has one clear requirement and one obvious task, do not run Pre-Mortem or MECE analysis. Write the task directly.
58
+ - **Well-researched phases** — If RESEARCH.md has HIGH-confidence recommendations for every decision and no `[NEEDS DECISION]` items, skip Base Rate Neglect Counter.
59
+ - **Gap closure plans** — Focus on the Root-Cause Check model only. Skip all others — the original plan already went through them.
60
+
61
+ </thinking_models>
@@ -0,0 +1,51 @@
1
+ <universal_anti_patterns>
2
+
3
+ Rules that apply to ALL workflows and agents. Individual workflows may have additional specific anti-patterns.
4
+
5
+ ---
6
+
7
+ ## Context Budget Rules
8
+
9
+ 1. **Never** read agent definition files (`agents/*.md`) when spawning subagents — `subagent_type` auto-loads them. Reading agent definitions into the orchestrator wastes context for content automatically injected into subagent sessions.
10
+ 2. **Never** inline large files into subagent prompts — tell agents to read files from disk instead. Agents have their own context windows.
11
+ 3. **Read depth scales with context window** — check `context_window` in `.planning/config.json`. At < 500000: read only frontmatter, status fields, or summaries. At >= 500000: full body reads permitted when content is needed for inline decisions. See `references/context-budget.md` for the complete table.
12
+ 4. **Delegate** heavy work to subagents — the orchestrator routes, it does not build, analyze, research, investigate, or verify.
13
+ 5. **Proactive pause warning**: If you have already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider checkpointing progress."
14
+
15
+ ## File Reading Rules
16
+
17
+ 6. **SUMMARY.md read depth scales with context window** — at context_window < 500000: read frontmatter only from prior phase SUMMARYs. At >= 500000: full body reads permitted for direct-dependency phases. Transitive dependencies (2+ phases back) remain frontmatter-only regardless.
18
+ 7. **Never** read full PLAN.md files from other phases — only current phase plans.
19
+ 8. **Do not** re-read full file contents when frontmatter is sufficient — frontmatter contains status, key_files, commits, and provides fields.
20
+
21
+ ## Subagent Rules
22
+
23
+ 9. **Always use learnship agent types** (`learnship-executor`, `learnship-planner`, `learnship-phase-researcher`, etc.) — never fall back to generic or built-in agent types. Learnship agents have project-aware prompts and workflow context.
24
+ 10. **Do not** re-litigate decisions that are already locked in CONTEXT.md — respect locked decisions unconditionally.
25
+
26
+ ## Questioning Anti-Patterns
27
+
28
+ 11. **Do not** walk through checklists — checklist walking (asking items one by one from a list) is the #1 anti-pattern. Instead, use progressive depth: start broad, dig where interesting.
29
+ 12. **Do not** use corporate speak — avoid jargon like "stakeholder alignment", "synergize", "deliverables". Use plain language.
30
+ 13. **Do not** apply premature constraints — don't narrow the solution space before understanding the problem. Ask about the problem first, then constrain.
31
+
32
+ ## State Management Anti-Patterns
33
+
34
+ 14. **Always use atomic file writes for STATE.md and ROADMAP.md.** Read the current content, modify, write the whole file. Do not use append-only operations that could corrupt the file on interruption.
35
+ 15. **Never** skip STATE.md updates after completing work — downstream workflows depend on accurate state.
36
+
37
+ ## Behavioral Rules
38
+
39
+ 16. **Do not** create artifacts the user did not approve — always confirm before writing new planning documents.
40
+ 17. **Do not** modify files outside the workflow's stated scope — check the plan's files_modified list.
41
+ 18. **Do not** suggest multiple next actions without clear priority — one primary suggestion, alternatives listed secondary.
42
+ 19. **Do not** use `git add .` or `git add -A` — stage specific files only.
43
+ 20. **Do not** include sensitive information (API keys, passwords, tokens) in planning documents or commits.
44
+
45
+ ## Error Recovery Rules
46
+
47
+ 21. **Git lock detection**: Before any git operation, if it fails with "Unable to create lock file", check for stale `.git/index.lock` and advise the user to remove it (do not remove automatically).
48
+ 22. **Config fallback awareness**: Config loading returns `null` silently on invalid JSON. If your workflow depends on config values, check for null and warn the user: "config.json is invalid or missing — running with defaults."
49
+ 23. **Partial state recovery**: If STATE.md references a phase directory that doesn't exist, do not proceed silently. Warn the user and suggest diagnosing the mismatch.
50
+
51
+ </universal_anti_patterns>
@@ -152,9 +152,12 @@ This project uses **learnship**. Key facts:
152
152
 
153
153
  - All planning artifacts live in `.planning/` — read STATE.md and ROADMAP.md first when unsure where we are
154
154
  - The phase loop: `discuss-phase` → `plan-phase` → `execute-phase` → `verify-work` → `/review` → `/ship` → `/compound`
155
+ - Optional per-phase: `/secure-phase` (security verification), `/extract-learnings` (capture meta-knowledge)
156
+ - Recovery: `/forensics` (post-mortem), `/undo` (safe revert)
155
157
  - Current status is always in `.planning/STATE.md`
156
158
  - Decisions are tracked in `.planning/DECISIONS.md` — read it before proposing approaches that may conflict
157
159
  - Compounded solutions live in `.planning/solutions/` — organized by category with YAML frontmatter (module, problem_type, severity, tags). Search these before planning to avoid reinventing known solutions
160
+ - Quick ideas: `/note [text]` for zero-friction capture, `/session-report` for end-of-session summaries
158
161
  - Run `/ls` if context is unclear about what phase we're on or what to do next — it shows status and offers to run the next step
159
162
 
160
163
  ---
@@ -6,67 +6,242 @@ workflow: discuss-phase
6
6
 
7
7
  # Phase [N] Context: [Phase Name]
8
8
 
9
- Implementation decisions captured during `discuss-phase [N]`. This file is read by the planner, researcher, and executor it represents locked user preferences that override default approaches.
9
+ Implementation decisions captured during `discuss-phase [N]`. This file is the primary input for downstream agents — the researcher uses it to know WHAT to investigate, the planner uses it to know WHAT choices are locked.
10
10
 
11
- ---
11
+ <domain>
12
+ ## Phase Boundary
13
+
14
+ [Clear statement of what this phase delivers — the scope anchor. This comes from ROADMAP.md and is fixed. Discussion clarifies implementation within this boundary.]
15
+
16
+ </domain>
12
17
 
18
+ <decisions>
13
19
  ## Implementation Decisions
14
20
 
15
- ### Technology Choices
21
+ ### [Area 1 that was discussed]
22
+ - **D-01:** [Specific decision made]
23
+ - **D-02:** [Another decision if applicable]
24
+
25
+ ### [Area 2 that was discussed]
26
+ - **D-03:** [Specific decision made]
27
+
28
+ ### [Area 3 that was discussed]
29
+ - **D-04:** [Specific decision made]
30
+
31
+ ### Claude's Discretion
32
+ [Areas where user explicitly said "you decide" — the agent has flexibility here during planning/implementation]
33
+
34
+ </decisions>
35
+
36
+ <specifics>
37
+ ## Specific Ideas
38
+
39
+ [Any particular references, examples, or "I want it like X" moments from discussion. Product references, specific behaviors, interaction patterns.]
16
40
 
17
- *What specific libraries, frameworks, or tools should be used?*
41
+ [If none: "No specific requirements open to standard approaches"]
18
42
 
19
- - [Decision]: [Choice] — [rationale]
20
- - [Decision]: [Choice] — [rationale]
43
+ </specifics>
21
44
 
22
- ### Architecture Preferences
45
+ <canonical_refs>
46
+ ## Canonical References
23
47
 
24
- *How should this be structured? Patterns, layers, component organization?*
48
+ **Downstream agents MUST read these before planning or implementing.**
25
49
 
26
- - [Decision]: [Choice] [rationale]
50
+ [List every spec, ADR, feature doc, or design doc that defines requirements or constraints for this phase. Use full relative paths so agents can read them directly.]
27
51
 
28
- ### Scope Boundaries
52
+ ### [Topic area 1]
53
+ - `path/to/spec-or-adr.md` — [What this doc decides/defines that's relevant]
29
54
 
30
- *What's explicitly in scope vs. explicitly deferred?*
55
+ ### [Topic area 2]
56
+ - `path/to/feature-doc.md` — [What capability this defines]
31
57
 
32
- **In scope for this phase:**
33
- - [item]
34
- - [item]
58
+ [If the project has no external specs: "No external specs — requirements are fully captured in decisions above"]
35
59
 
36
- **Explicitly deferred (do not implement):**
37
- - [item]
38
- - [item]
60
+ </canonical_refs>
39
61
 
40
- ### UI/UX Decisions
62
+ <code_context>
63
+ ## Existing Code Insights
41
64
 
42
- *Visual style, interaction patterns, design direction (if UI work)*
65
+ ### Reusable Assets
66
+ - [Component/hook/utility]: [How it could be used in this phase]
43
67
 
44
- - [Decision]: [Choice] — [rationale]
68
+ ### Established Patterns
69
+ - [Pattern]: [How it constrains/enables this phase]
45
70
 
46
71
  ### Integration Points
72
+ - [Where new code connects to existing system]
47
73
 
48
- *How should this phase connect to other phases or existing systems?*
74
+ </code_context>
49
75
 
50
- - [item]: [approach]
76
+ <deferred>
77
+ ## Deferred Ideas
51
78
 
52
- ### Quality Standards
79
+ [Ideas that came up during discussion but belong in other phases. Captured here so they're not lost, but explicitly out of scope for this phase.]
53
80
 
54
- *Performance targets, error handling approach, test coverage expectations*
81
+ [If none: "None discussion stayed within phase scope"]
55
82
 
56
- - [item]: [requirement]
83
+ </deferred>
57
84
 
58
85
  ---
59
86
 
60
- ## Open Questions
87
+ *Phase: [padded]-[slug]*
88
+ *Context gathered: [date]*
61
89
 
62
- *Unresolved items — planner should make a reasonable default choice and note it*
90
+ ---
63
91
 
64
- - [question]: [status — TBD / will decide during planning / not critical]
92
+ <good_examples>
65
93
 
66
- ---
94
+ **Example 1: Visual feature (Post Feed)**
95
+
96
+ ```markdown
97
+ # Phase 3: Post Feed - Context
98
+
99
+ **Gathered:** 2025-01-20
100
+ **Status:** Ready for planning
101
+
102
+ <domain>
103
+ ## Phase Boundary
104
+
105
+ Display posts from followed users in a scrollable feed. Users can view posts and see engagement counts. Creating posts and interactions are separate phases.
106
+ </domain>
107
+
108
+ <decisions>
109
+ ## Implementation Decisions
67
110
 
68
- ## Anti-Patterns to Avoid
111
+ ### Layout style
112
+ - Card-based layout, not timeline or list
113
+ - Each card shows: author avatar, name, timestamp, full post content, reaction counts
114
+ - Cards have subtle shadows, rounded corners — modern feel
69
115
 
70
- *Approaches the user explicitly wants to avoid*
116
+ ### Loading behavior
117
+ - Infinite scroll, not pagination
118
+ - Pull-to-refresh on mobile
119
+ - New posts indicator at top ("3 new posts") rather than auto-inserting
120
+
121
+ ### Empty state
122
+ - Friendly illustration + "Follow people to see posts here"
123
+ - Suggest 3-5 accounts to follow based on interests
124
+
125
+ ### Claude's Discretion
126
+ - Loading skeleton design
127
+ - Exact spacing and typography
128
+ - Error state handling
129
+ </decisions>
130
+
131
+ <specifics>
132
+ ## Specific Ideas
133
+
134
+ - "I like how Twitter shows the new posts indicator without disrupting your scroll position"
135
+ - Cards should feel like Linear's issue cards — clean, not cluttered
136
+ </specifics>
137
+
138
+ <canonical_refs>
139
+ ## Canonical References
140
+
141
+ ### Feed display
142
+ - `docs/features/social-feed.md` — Feed requirements, post card fields, engagement display rules
143
+
144
+ ### Empty states
145
+ - `docs/design/empty-states.md` — Empty state patterns, illustration guidelines
146
+ </canonical_refs>
147
+
148
+ <deferred>
149
+ ## Deferred Ideas
150
+
151
+ - Commenting on posts — Phase 5
152
+ - Bookmarking posts — add to backlog
153
+ </deferred>
154
+ ```
155
+
156
+ **Example 2: CLI tool (Database backup)**
157
+
158
+ ```markdown
159
+ # Phase 2: Backup Command - Context
160
+
161
+ **Gathered:** 2025-01-20
162
+ **Status:** Ready for planning
163
+
164
+ <domain>
165
+ ## Phase Boundary
166
+
167
+ CLI command to backup database to local file or S3. Supports full and incremental backups. Restore command is a separate phase.
168
+ </domain>
169
+
170
+ <decisions>
171
+ ## Implementation Decisions
71
172
 
72
- - [anti-pattern]: [reason]
173
+ ### Output format
174
+ - JSON for programmatic use, table format for humans
175
+ - Default to table, --json flag for JSON
176
+ - Verbose mode (-v) shows progress, silent by default
177
+
178
+ ### Flag design
179
+ - Short flags for common options: -o (output), -v (verbose), -f (force)
180
+ - Long flags for clarity: --incremental, --compress, --encrypt
181
+ - Required: database connection string (positional or --db)
182
+
183
+ ### Error recovery
184
+ - Retry 3 times on network failure, then fail with clear message
185
+ - --no-retry flag to fail fast
186
+ - Partial backups are deleted on failure (no corrupt files)
187
+
188
+ ### Claude's Discretion
189
+ - Exact progress bar implementation
190
+ - Compression algorithm choice
191
+ - Temp file handling
192
+ </decisions>
193
+
194
+ <specifics>
195
+ ## Specific Ideas
196
+
197
+ - "I want it to feel like pg_dump — familiar to database people"
198
+ - Should work in CI pipelines (exit codes, no interactive prompts)
199
+ </specifics>
200
+
201
+ <canonical_refs>
202
+ ## Canonical References
203
+
204
+ ### Backup CLI
205
+ - `docs/features/backup-restore.md` — Backup requirements, supported backends, encryption spec
206
+ - `docs/decisions/adr-007-cli-conventions.md` — Flag naming, exit codes, output format standards
207
+ </canonical_refs>
208
+
209
+ <deferred>
210
+ ## Deferred Ideas
211
+
212
+ - Scheduled backups — separate phase
213
+ - Backup rotation/retention — add to backlog
214
+ </deferred>
215
+ ```
216
+
217
+ </good_examples>
218
+
219
+ <guidelines>
220
+ **This template captures DECISIONS for downstream agents.**
221
+
222
+ The output should answer: "What does the researcher need to investigate? What choices are locked for the planner?"
223
+
224
+ **Good content (concrete decisions):**
225
+ - "Card-based layout, not timeline"
226
+ - "Retry 3 times on network failure, then fail"
227
+ - "Group by year, then by month"
228
+ - "JSON for programmatic use, table for humans"
229
+
230
+ **Bad content (too vague):**
231
+ - "Should feel modern and clean"
232
+ - "Good user experience"
233
+ - "Fast and responsive"
234
+ - "Easy to use"
235
+
236
+ **After creation:**
237
+ - File lives in phase directory: `.planning/phases/XX-name/{phase_num}-CONTEXT.md`
238
+ - The researcher uses decisions to focus investigation AND reads canonical_refs to know WHAT docs to study
239
+ - The planner uses decisions + research to create executable tasks AND reads canonical_refs to verify alignment
240
+ - Downstream agents should NOT need to ask the user again about captured decisions
241
+
242
+ **Canonical references:**
243
+ - The `<canonical_refs>` section is MANDATORY. Every CONTEXT.md must have one.
244
+ - If your project has external specs, ADRs, or design docs, list them with full relative paths grouped by topic
245
+ - If ROADMAP.md lists `Canonical refs:` per phase, extract and expand those
246
+ - If no external specs exist, say so explicitly — don't silently omit the section
247
+ </guidelines>
@@ -0,0 +1,49 @@
1
+ ---
2
+ phase: [N]
3
+ slug: [phase-slug]
4
+ areas_discussed: []
5
+ created: [date]
6
+ ---
7
+
8
+ # Phase [N]: [Name] - Discussion Log
9
+
10
+ > **Audit trail only.** Do not use as input to planning, research, or execution agents.
11
+ > Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
12
+
13
+ **Date:** [ISO date]
14
+ **Phase:** [phase number]-[phase name]
15
+ **Areas discussed:** [comma-separated list]
16
+
17
+ ---
18
+
19
+ ## [Area 1 Name]
20
+
21
+ | Option | Description | Selected |
22
+ |--------|-------------|----------|
23
+ | [Option 1] | [Brief description] | |
24
+ | [Option 2] | [Brief description] | ✓ |
25
+ | [Option 3] | [Brief description] | |
26
+
27
+ **User's choice:** [Selected option or verbatim free-text response]
28
+ **Notes:** [Any clarifications or rationale provided during discussion]
29
+
30
+ ---
31
+
32
+ ## [Area 2 Name]
33
+
34
+ ...
35
+
36
+ ---
37
+
38
+ ## Claude's Discretion
39
+
40
+ [Areas delegated to Claude's judgment — list what was deferred and why]
41
+
42
+ ## Deferred Ideas
43
+
44
+ [Ideas mentioned but not in scope for this phase]
45
+
46
+ ---
47
+
48
+ *Phase: [padded]-[slug]*
49
+ *Discussion log generated: [date]*
@@ -0,0 +1,61 @@
1
+ ---
2
+ phase: {N}
3
+ slug: {phase-slug}
4
+ status: draft
5
+ threats_open: 0
6
+ created: {date}
7
+ ---
8
+
9
+ # Phase {N} — Security
10
+
11
+ > Per-phase security contract: threat register, accepted risks, and audit trail.
12
+
13
+ ---
14
+
15
+ ## Trust Boundaries
16
+
17
+ | Boundary | Description | Data Crossing |
18
+ |----------|-------------|---------------|
19
+ | {boundary} | {description} | {data type / sensitivity} |
20
+
21
+ ---
22
+
23
+ ## Threat Register
24
+
25
+ | Threat ID | Category | Component | Disposition | Mitigation | Status |
26
+ |-----------|----------|-----------|-------------|------------|--------|
27
+ | T-{N}-01 | {STRIDE category} | {component} | {mitigate / accept / transfer} | {control or reference} | open |
28
+
29
+ *Status: open · closed*
30
+ *Disposition: mitigate (implementation required) · accept (documented risk) · transfer (third-party)*
31
+ *STRIDE categories: Spoofing · Tampering · Repudiation · Information Disclosure · Denial of Service · Elevation of Privilege*
32
+
33
+ ---
34
+
35
+ ## Accepted Risks Log
36
+
37
+ | Risk ID | Threat Ref | Rationale | Accepted By | Date |
38
+ |---------|------------|-----------|-------------|------|
39
+
40
+ *Accepted risks do not resurface in future audit runs.*
41
+
42
+ *If none: "No accepted risks."*
43
+
44
+ ---
45
+
46
+ ## Security Audit Trail
47
+
48
+ | Audit Date | Threats Total | Closed | Open | Run By |
49
+ |------------|---------------|--------|------|--------|
50
+ | {YYYY-MM-DD} | {N} | {N} | {N} | {name / agent} |
51
+
52
+ ---
53
+
54
+ ## Sign-Off
55
+
56
+ - [ ] All threats have a disposition (mitigate / accept / transfer)
57
+ - [ ] Accepted risks documented in Accepted Risks Log
58
+ - [ ] `threats_open: 0` confirmed
59
+ - [ ] `status: verified` set in frontmatter
60
+
61
+ **Approval:** {pending / verified YYYY-MM-DD}