learnship 2.0.10 → 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 +9 -4
  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 +20 -6
  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 +42 -7
  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 +68 -4
  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
@@ -152,7 +152,6 @@ Create `.planning/config.json` with all settings:
152
152
  "granularity": "coarse|standard|fine",
153
153
  "model_profile": "quality|balanced|budget",
154
154
  "learning_mode": "auto|manual",
155
- "parallelization": false|true,
156
155
  "test_first": false|true,
157
156
  "planning": {
158
157
  "commit_docs": true|false,
@@ -165,7 +164,30 @@ Create `.planning/config.json` with all settings:
165
164
  "verifier": true|false,
166
165
  "validation": true|false,
167
166
  "review": true|false,
168
- "solutions_search": true|false
167
+ "solutions_search": true|false,
168
+ "security_enforcement": true|false,
169
+ "discuss_mode": "discuss",
170
+ "tdd_mode": false|true
171
+ },
172
+ "parallelization": {
173
+ "enabled": false|true,
174
+ "plan_level": true,
175
+ "task_level": false,
176
+ "max_concurrent_agents": 5,
177
+ "min_plans_for_parallel": 2
178
+ },
179
+ "gates": {
180
+ "confirm_project": true,
181
+ "confirm_phases": true,
182
+ "confirm_roadmap": true,
183
+ "confirm_plan": true,
184
+ "execute_next_plan": true,
185
+ "issues_review": true,
186
+ "confirm_transition": true
187
+ },
188
+ "safety": {
189
+ "always_confirm_destructive": true,
190
+ "always_confirm_external_services": true
169
191
  },
170
192
  "review": {
171
193
  "auto_after_verify": false|true
@@ -175,6 +197,9 @@ Create `.planning/config.json` with all settings:
175
197
  "conventional_commits": true|false,
176
198
  "pr_template": true|false
177
199
  },
200
+ "hooks": {
201
+ "context_warnings": true
202
+ },
178
203
  "git": {
179
204
  "branching_strategy": "none|phase|milestone",
180
205
  "phase_branch_template": "phase-{phase}-{slug}",
@@ -183,6 +208,8 @@ Create `.planning/config.json` with all settings:
183
208
  }
184
209
  ```
185
210
 
211
+ **Note:** The `parallelization` field is now an object (not a flat boolean). Legacy flat `"parallelization": true` is still honored for backward compatibility. The `gates` and `safety` sections use sensible defaults — only ask users about them if they specifically want to customize.
212
+
186
213
  If `planning.commit_docs` is false, add `.planning/` to `.gitignore`:
187
214
  ```bash
188
215
  echo ".planning/" >> .gitignore
@@ -257,7 +284,7 @@ Verify internally: do you have `ANSWER_1`, `ANSWER_2`, `ANSWER_3`, and `ANSWER_4
257
284
  - **Write PROJECT.md** → proceed to Step 4
258
285
  - **More to cover** → continue asking follow-ups, then re-ask this gate question
259
286
 
260
- Use the questioning techniques from `@./references/questioning.md` to shape the follow-up questions.
287
+ Use the questioning techniques from `@./references/questioning.md` and domain-aware probes from `@./references/domain-probes.md` to shape the follow-up questions. When the user mentions a known domain (auth, real-time, dashboard, API, database, search, file uploads, caching, testing, deployment, AI/ML), use the relevant probes to ask sharper questions.
261
288
 
262
289
  ## Step 4: Write PROJECT.md
263
290
 
@@ -479,6 +506,43 @@ git add .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md && git
479
506
 
480
507
  > **🔴 MANDATORY — This step must always be completed. Do not skip it, do not defer it, do not move to Step 9 without writing AGENTS.md to the project root. AGENTS.md is the persistent memory file that every future session depends on.**
481
508
 
509
+ **Substep 8a-pre — Check for existing context files.** Run this command now:
510
+
511
+ ```bash
512
+ node -e "const fs=require('fs');const files=['AGENTS.md','CLAUDE.md','GEMINI.md','.cursorrules'];const found=files.filter(f=>fs.existsSync(f));if(found.length){console.log('EXISTING: '+found.join(', '));}else{console.log('NONE FOUND');}"
513
+ ```
514
+
515
+ **If the command prints `EXISTING:`** — Ask the user:
516
+
517
+ ```
518
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
519
+ learnship ► EXISTING CONTEXT FILES DETECTED
520
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
521
+
522
+ I found existing context file(s): [list from command output]
523
+
524
+ What would you like to do?
525
+
526
+ 1. Replace (recommended for new learnship projects)
527
+ → Overwrite with learnship's AGENTS.md
528
+
529
+ 2. Merge
530
+ → Keep your existing content, add learnship sections
531
+
532
+ 3. Keep separate
533
+ → Write AGENTS.md alongside your existing file(s)
534
+
535
+ Reply 1, 2, or 3.
536
+ ```
537
+
538
+ > 🔴 **HARD GATE — Wait for the user's reply. Do NOT auto-decide.**
539
+
540
+ - **Replace (1):** Continue to substep 8a. The old files will be overwritten.
541
+ - **Merge (2):** Read the existing file(s) first, then in substep 8b, append learnship sections that are missing (Soul, Principles, Request Routing Protocol, etc.) while preserving the user's existing content at the top.
542
+ - **Keep separate (3):** Continue to substep 8a. Write `AGENTS.md` as a new file. Leave existing files untouched.
543
+
544
+ **If the command prints `NONE FOUND`:** Continue directly to substep 8a.
545
+
482
546
  **Substep 8a — Read the template.** Read `@./templates/agents.md` in full RIGHT NOW before writing anything. This is the canonical template. You need its exact content.
483
547
 
484
548
  > 🛑 **HARD GATE:** Did you just read `@./templates/agents.md`? If not, go back and read it now. The next substep requires copying sections verbatim from the template. You cannot do that without reading it first.
@@ -518,7 +582,7 @@ git add .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md && git
518
582
  > 🔴 **HARD GATE — Run this verification command now. Do not skip it. Do not proceed without running it.**
519
583
 
520
584
  ```bash
521
- node -e "const fs=require('fs');if(!fs.existsSync('AGENTS.md')){console.log('AGENTS.md NOT FOUND');process.exit(1);}const f=fs.readFileSync('AGENTS.md','utf8');const required=['Soul','Principles','Request Routing Protocol','Platform Context','Current Phase','Project Structure','Tech Stack','Skills','Regressions'];const missing=required.filter(s=>!f.includes('## '+s));if(missing.length){console.log('AGENTS.md INCOMPLETE — missing sections:\\n'+missing.map(s=>' ## '+s).join('\\n'));process.exit(1);}const verbatim=['pair programmer','Direct, no fluff','Have opinions','Friction Is Signal','Minimal Upstream Fix','decision tree'];const missingV=verbatim.filter(s=>!f.includes(s));if(missingV.length){console.log('AGENTS.md TEMPLATE VIOLATION — these verbatim phrases are missing (did you rewrite instead of copy?):\\n'+missingV.join('\\n'));process.exit(1);}console.log('AGENTS.md VERIFIED OK — all '+required.length+' sections present, verbatim content intact');"
585
+ node -e "const fs=require('fs');if(!fs.existsSync('AGENTS.md')){console.log('AGENTS.md NOT FOUND');process.exit(1);}const f=fs.readFileSync('AGENTS.md','utf8');const required=['Soul','Principles','Request Routing Protocol','Platform Context','Current Phase','Project Structure','Tech Stack','Skills','Regressions'];const missing=required.filter(s=>!f.includes('## '+s));if(missing.length){console.log('AGENTS.md INCOMPLETE — missing sections:\\n'+missing.map(s=>' ## '+s).join('\\n'));process.exit(1);}const verbatim=['pair programmer','Direct, no fluff','Have opinions','Friction Is Signal','Surgical Change','Nothing Extra','Understand First','decision tree'];const missingV=verbatim.filter(s=>!f.includes(s));if(missingV.length){console.log('AGENTS.md TEMPLATE VIOLATION — these verbatim phrases are missing (did you rewrite instead of copy?):\\n'+missingV.join('\\n'));process.exit(1);}console.log('AGENTS.md VERIFIED OK — all '+required.length+' sections present, verbatim content intact');"
522
586
  ```
523
587
 
524
588
  > 🛑 **If the command prints `INCOMPLETE` or `TEMPLATE VIOLATION` or exits with code 1:** The AGENTS.md is broken. Re-read `@./templates/agents.md` and fix the missing sections or restore the verbatim content. Run the verification again. You MUST see `AGENTS.md VERIFIED OK` before continuing to Step 9.
@@ -102,4 +102,4 @@ If no — show `/ls` output so the user can choose manually.
102
102
 
103
103
  - `/next` always confirms before acting (never fully silent).
104
104
  - For status-only with manual choice, use `/ls` instead.
105
- - To see all 49 available commands: `/help`
105
+ - To see all 57 available commands: `/help`
@@ -0,0 +1,110 @@
1
+ ---
2
+ description: Zero-friction idea capture — one write, one confirmation line, no questions
3
+ ---
4
+
5
+ # Note
6
+
7
+ Zero-friction idea capture. One write call, one confirmation line. No questions, no prompts. Runs inline — no subagents.
8
+
9
+ **Usage:**
10
+ - `note [text]` — save a note
11
+ - `note list` — show all notes
12
+ - `note promote [N]` — promote note N to a todo or decision
13
+
14
+ Notes are different from todos: **notes are observations**, todos are actions.
15
+
16
+ ## Step 1: Parse Subcommand
17
+
18
+ | Condition | Subcommand |
19
+ |-----------|------------|
20
+ | Arguments are exactly `list` (case-insensitive) | **list** |
21
+ | Arguments are exactly `promote [N]` where N is a number | **promote** |
22
+ | Arguments are empty (no text at all) | **list** |
23
+ | Anything else | **append** (the text IS the note) |
24
+
25
+ **Critical:** `list` is only a subcommand when it's the ENTIRE argument. `note list of groceries` saves a note with text "list of groceries".
26
+
27
+ ## Step 2: Determine Scope
28
+
29
+ - **Project scope** (default): `.planning/notes/` — used when `.planning/` exists
30
+ - **Global scope** (fallback): use project scope if `.planning/` exists, otherwise tell user no project is initialized
31
+
32
+ **Important:** Do NOT create `.planning/` if it doesn't exist. Fall back gracefully.
33
+
34
+ ## Step 3a: Append — Create a Timestamped Note
35
+
36
+ 1. Ensure notes directory exists:
37
+ ```bash
38
+ node -e "require('fs').mkdirSync('.planning/notes',{recursive:true})"
39
+ ```
40
+
41
+ 2. Generate slug: first ~4 meaningful words, lowercase, hyphen-separated
42
+ 3. Generate filename: `{YYYY-MM-DD}-{slug}.md`
43
+ - If file exists, append `-2`, `-3`, etc.
44
+
45
+ 4. Write the file:
46
+ ```markdown
47
+ ---
48
+ date: "YYYY-MM-DD HH:mm"
49
+ promoted: false
50
+ ---
51
+
52
+ {note text verbatim}
53
+ ```
54
+
55
+ 5. Confirm with exactly one line: `Noted: {note text}`
56
+
57
+ **Constraints:**
58
+ - **Never modify the note text** — capture verbatim, including typos
59
+ - **Never ask questions** — just write and confirm
60
+
61
+ ## Step 3b: List — Show All Notes
62
+
63
+ ```bash
64
+ ls .planning/notes/*.md 2>/dev/null
65
+ ```
66
+
67
+ For each file, read frontmatter to get `date` and `promoted` status. Sort by date, number sequentially.
68
+
69
+ Display:
70
+ ```
71
+ ## Notes
72
+
73
+ # | Date | Note
74
+ ----|------------|------
75
+ 1 | 2025-01-20 | [first line of note text]
76
+ 2 | 2025-01-21 | [first line of note text]
77
+ *3 | 2025-01-22 | [promoted — first line]
78
+
79
+ [N] notes ([M] active, [K] promoted)
80
+ ```
81
+
82
+ Promoted notes shown with `*` prefix and dimmed.
83
+
84
+ ## Step 3c: Promote — Convert Note to Action
85
+
86
+ Read note N from the numbered list. Display the full note text.
87
+
88
+ Ask: "Promote this note to:"
89
+ - **Todo** — create via `/add-todo [note text]`
90
+ - **Decision** — create via `/decision-log [note text]`
91
+ - **Phase proposal** — create via `/add-phase [note text]`
92
+ - **Keep as note** — cancel
93
+
94
+ After promoting, update the note's frontmatter: `promoted: true`.
95
+
96
+ ---
97
+
98
+ ## Learning Checkpoint
99
+
100
+ Read `learning_mode` from `.planning/config.json`.
101
+
102
+ **If `auto` and this is an append:** No learning prompt for notes — keep it fast.
103
+
104
+ **If `auto` and this is a promote:**
105
+
106
+ > **Learning moment:** Promoting a note means the idea had lasting value:
107
+ >
108
+ > `@agentic-learning either-or` — Why did this note survive? What made it worth promoting over others? Log the reasoning.
109
+
110
+ **If `manual`:** No note for notes — keep it fast.
@@ -103,6 +103,8 @@ Current state:
103
103
  - Committed as WIP
104
104
 
105
105
  ▶ To resume: resume-work
106
+ ▶ Capture an idea before you go: /note [text]
107
+ ▶ Generate a session summary: /session-report
106
108
  ```
107
109
 
108
110
  ---
@@ -8,9 +8,15 @@ Create executable plans for a roadmap phase. Default flow: Research → Plan →
8
8
 
9
9
  On platforms with subagent support (Claude Code, OpenCode, Codex), each stage spawns a dedicated specialist agent with its own full context budget. On all other platforms, all stages run sequentially in the same context.
10
10
 
11
- **Usage:** `plan-phase [N]` — optionally add `--skip-research` or `--skip-verify`
11
+ **Usage:** `plan-phase [N]` — optionally add `--skip-research`, `--skip-verify`, or `--research` (force re-research)
12
12
 
13
- > **Platform note:** Read `parallelization` from `.planning/config.json`. When `true`, researcher/planner/checker each run as a spawned subagent. When `false` (default), all stages run inline using agent persona files.
13
+ **Flags:**
14
+ - `--skip-research` — skip the research stage even if enabled in config
15
+ - `--skip-verify` — skip the plan verification stage
16
+ - `--research` — force re-research even if RESEARCH.md already exists
17
+ - `--gaps` — plan only for gaps found during verification
18
+
19
+ > **Platform note:** Read `parallelization` from `.planning/config.json`. When enabled, researcher/planner/checker each run as a spawned subagent. When `false` (default), all stages run inline using agent persona files.
14
20
 
15
21
  ## Step 1: Initialize
16
22
 
@@ -23,6 +29,15 @@ Read config:
23
29
  cat .planning/config.json
24
30
  ```
25
31
 
32
+ Read TDD mode:
33
+ ```bash
34
+ TDD_MODE=$(node -e "try{const c=JSON.parse(require('fs').readFileSync('.planning/config.json','utf8'));process.stdout.write(String((c.workflow||{}).tdd_mode||false));}catch(e){process.stdout.write('false');}" 2>/dev/null || echo 'false')
35
+ ```
36
+
37
+ When `TDD_MODE` is `true`, instruct the planner to apply `type: tdd` to eligible tasks — the executor will use the red-green-refactor cycle for those tasks.
38
+
39
+ **Context window scaling:** Check `context_window` in config (default: 200000). At >= 500000, include the 3 most recent prior phase CONTEXT.md and SUMMARY.md files in the planner's context. At < 500000, include only frontmatter from prior phases.
40
+
26
41
  Create the phase directory if it doesn't exist:
27
42
  ```bash
28
43
  node -e "require('fs').mkdirSync('.planning/phases/[padded_phase]-[phase_slug]',{recursive:true})"
@@ -10,9 +10,11 @@ Execute small, ad-hoc tasks with full agentic guarantees: atomic commits, STATE.
10
10
 
11
11
  **Flags:**
12
12
  - `--discuss` — lightweight discussion phase before planning (surfaces gray areas)
13
- - `--full` — adds plan-checking and post-execution verification
13
+ - `--research` — spawns a focused research agent before planning (investigates approaches, libraries, pitfalls)
14
+ - `--validate` — enables plan-checking (max 2 iterations) and post-execution verification
15
+ - `--full` — enables all of the above: discussion + research + plan-checking + verification
14
16
 
15
- **Composable:** `quick --discuss --full "add dark mode toggle"` gives discussion + plan-checking + verification.
17
+ **Composable:** Granular flags compose freely. `quick --discuss --research --validate` = `--full`.
16
18
 
17
19
  ## Step 1: Get Task Description
18
20
 
@@ -113,6 +115,23 @@ Write `CONTEXT.md` to the task directory:
113
115
  </specifics>
114
116
  ```
115
117
 
118
+ ## Step 3b: Research Phase (only with `--research` or `--full`)
119
+
120
+ **Skip if neither `--research` nor `--full` flag is present.**
121
+
122
+ ```
123
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
124
+ learnship ► RESEARCHING: [DESCRIPTION]
125
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
126
+ ```
127
+
128
+ Using `@./agents/researcher.md` as your research persona, do a focused research pass on the task:
129
+ - What libraries or approaches are relevant?
130
+ - What pitfalls should the implementation avoid?
131
+ - Are there existing patterns in the codebase to follow?
132
+
133
+ Write a brief `${NEXT_NUM}-RESEARCH.md` (max 50 lines) to the task directory. This feeds into the planner.
134
+
116
135
  ## Step 4: Create Plan
117
136
 
118
137
  Using `@./agents/planner.md` as your planning persona, read:
@@ -128,16 +147,17 @@ Each task needs:
128
147
  - `<verify>` — how to confirm it worked
129
148
  - `<done>` — observable completion criteria
130
149
 
131
- If `--full`: also include `must_haves` in plan frontmatter (truths, artifacts, key_links).
150
+ If `--validate` or `--full`: also include `must_haves` in plan frontmatter (truths, artifacts, key_links).
151
+ If `--research` or `--full`: also read the RESEARCH.md from step 3b.
132
152
 
133
153
  Verify plan was created (substitute actual NEXT_NUM and SLUG values):
134
154
  ```bash
135
155
  node -e "const fs=require('fs'); console.log(fs.existsSync('.planning/quick/NEXT_NUM-SLUG/NEXT_NUM-PLAN.md') ? 'OK' : 'MISSING')"
136
156
  ```
137
157
 
138
- ## Step 5: Plan Check (only with `--full`)
158
+ ## Step 5: Plan Check (only with `--validate` or `--full`)
139
159
 
140
- **Skip if `--full` flag is not present.**
160
+ **Skip if neither `--validate` nor `--full` flag is present.**
141
161
 
142
162
  ```
143
163
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -187,9 +207,9 @@ After all tasks complete, write `${NEXT_NUM}-SUMMARY.md`:
187
207
  [commit hash]
188
208
  ```
189
209
 
190
- ## Step 7: Verify Results (only with `--full`)
210
+ ## Step 7: Verify Results (only with `--validate` or `--full`)
191
211
 
192
- **Skip if `--full` flag is not present.**
212
+ **Skip if neither `--validate` nor `--full` flag is present.**
193
213
 
194
214
  ```
195
215
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -235,7 +255,7 @@ Display completion:
235
255
  Quick Task [NEXT_NUM]: [DESCRIPTION]
236
256
 
237
257
  Summary: .planning/quick/[NEXT_NUM]-[SLUG]/[NEXT_NUM]-SUMMARY.md
238
- [If --full: Verification: [status]]
258
+ [If --validate/--full: Verification: [status]]
239
259
  Commit: [hash]
240
260
 
241
261
  💡 Solved something notable? `/compound` — capture the solution while context is fresh
@@ -198,6 +198,7 @@ git commit -m "fix([scope]): [description from finding]"
198
198
 
199
199
  ```
200
200
  ▶ Next steps:
201
+ - /secure-phase [N] — STRIDE security verification before shipping
201
202
  - /ship — run the ship pipeline (test → lint → commit → push → PR)
202
203
  - /compound — capture any notable patterns from the review
203
204
  ```
@@ -0,0 +1,147 @@
1
+ ---
2
+ description: Per-phase security verification — STRIDE threat register, mitigation check, SECURITY.md generation
3
+ ---
4
+
5
+ # Secure Phase
6
+
7
+ Verify threat mitigations for a completed phase. Reads PLAN.md threat data if present, analyzes the codebase for security concerns, classifies threats, and generates a per-phase SECURITY.md using `@./templates/security.md`.
8
+
9
+ **Usage:** `secure-phase [N]`
10
+
11
+ **Sequencing:** Run after `execute-phase [N]` and before or alongside `verify-work [N]`.
12
+
13
+ ## Step 1: Initialize
14
+
15
+ Read `.planning/config.json` for `workflow.security_enforcement` (defaults to `true`).
16
+
17
+ If `security_enforcement` is `false`: exit with "Security enforcement disabled. Enable via `/settings`."
18
+
19
+ Find the phase directory and verify it has been executed (SUMMARY.md exists):
20
+
21
+ ```bash
22
+ ls ".planning/phases/[padded_phase]-[phase_slug]/"*-SUMMARY.md 2>/dev/null
23
+ ```
24
+
25
+ If no SUMMARY.md: "Phase [N] not executed yet. Run `execute-phase [N]` first."
26
+
27
+ Display:
28
+ ```
29
+ learnship > SECURE PHASE [N]: [name]
30
+ ```
31
+
32
+ ## Step 2: Discovery
33
+
34
+ ### 2a. Read Phase Artifacts
35
+
36
+ Read all PLAN.md files for this phase. Look for `<threat_model>` blocks or security-related task descriptions (auth, encryption, input validation, access control, etc.).
37
+
38
+ ### 2b. Read Summary Threat Flags
39
+
40
+ Read SUMMARY.md files. Look for any security-related notes, deviations, or flags.
41
+
42
+ ### 2c. Analyze Codebase
43
+
44
+ Scan files modified in this phase for common security patterns:
45
+
46
+ ```bash
47
+ git log --name-only --format="" --grep="([padded_phase]" | sort -u
48
+ ```
49
+
50
+ For each file, check for:
51
+ - Input validation (or lack thereof)
52
+ - Authentication/authorization checks
53
+ - Sensitive data handling (secrets, PII, tokens)
54
+ - SQL/command injection vectors
55
+ - Hardcoded credentials
56
+ - Insecure defaults
57
+
58
+ ## Step 3: Build Threat Register
59
+
60
+ For each identified concern, create a threat entry:
61
+
62
+ | Field | Value |
63
+ |-------|-------|
64
+ | Threat ID | T-{phase}-{NN} |
65
+ | Category | STRIDE category (Spoofing/Tampering/Repudiation/Info Disclosure/DoS/Elevation) |
66
+ | Component | Which file or module |
67
+ | Disposition | mitigate / accept / transfer |
68
+ | Status | open / closed |
69
+
70
+ Classify each threat:
71
+ - **CLOSED** — mitigation found in code OR accepted risk documented OR transferred to third-party
72
+ - **OPEN** — none of the above
73
+
74
+ ## Step 4: Present Threat Plan
75
+
76
+ If all threats are CLOSED: skip to Step 6.
77
+
78
+ If open threats exist, present them:
79
+
80
+ ```
81
+ Open Threats ([N]):
82
+
83
+ | ID | Category | Component | Description |
84
+ |----|----------|-----------|-------------|
85
+ | T-03-01 | Info Disclosure | api/auth.ts | JWT secret in environment without validation |
86
+
87
+ Options:
88
+ 1. Verify all open threats — investigate and resolve
89
+ 2. Accept all open — document as accepted risks
90
+ 3. Review individually — decide per threat
91
+ ```
92
+
93
+ Wait for user response.
94
+
95
+ ## Step 5: Resolve Open Threats
96
+
97
+ For option 1 (verify all): Using `@./agents/verifier.md`, check each open threat against the codebase. Update status based on findings.
98
+
99
+ For option 2 (accept all): Add each to the Accepted Risks Log with user's rationale.
100
+
101
+ For option 3 (individual): Present each threat one at a time with options: Verify / Accept / Skip.
102
+
103
+ ## Step 6: Write SECURITY.md
104
+
105
+ Write `.planning/phases/[padded_phase]-[phase_slug]/[padded_phase]-SECURITY.md` using `@./templates/security.md`:
106
+
107
+ - Fill in trust boundaries from the analysis
108
+ - Fill in the complete threat register
109
+ - Fill in accepted risks log
110
+ - Fill in audit trail
111
+ - Update frontmatter: `threats_open` count, `status` (draft/verified)
112
+
113
+ If `threats_open` is 0: set `status: verified`.
114
+
115
+ Commit:
116
+ ```bash
117
+ git add ".planning/phases/[padded_phase]-[phase_slug]/[padded_phase]-SECURITY.md"
118
+ git commit -m "security([padded_phase]): phase security verification"
119
+ ```
120
+
121
+ ## Step 7: Report
122
+
123
+ ```
124
+ learnship > SECURE PHASE [N] COMPLETE
125
+
126
+ Threats found: [total]
127
+ Closed: [N] | Accepted: [N] | Open: [N]
128
+
129
+ Status: [verified / needs attention]
130
+ Report: [path to SECURITY.md]
131
+ ```
132
+
133
+ If open threats remain: warn that the phase has unresolved security concerns.
134
+
135
+ ---
136
+
137
+ ## Learning Checkpoint
138
+
139
+ Read `learning_mode` from `.planning/config.json`.
140
+
141
+ **If `auto`:**
142
+
143
+ > **Learning moment:** Security verification surfaces patterns worth internalizing:
144
+ >
145
+ > `@agentic-learning learn [security topic]` — Active retrieval on the security concepts encountered. STRIDE categories, common vulnerability patterns, and mitigation strategies build lasting defensive instincts.
146
+
147
+ **If `manual`:** Add quietly: *"Tip: `@agentic-learning learn [topic]` to deepen security knowledge from this verification."*
@@ -0,0 +1,133 @@
1
+ ---
2
+ description: Generate a post-session summary with work performed, outcomes, and estimated resource usage
3
+ ---
4
+
5
+ # Session Report
6
+
7
+ Generate a post-session summary capturing work performed, outcomes achieved, and git activity. Writes a report to `.planning/reports/` for human review and stakeholder sharing.
8
+
9
+ **Usage:** `session-report`
10
+
11
+ ## Step 1: Gather Session Data
12
+
13
+ Collect data from available sources:
14
+
15
+ ### 1a. Git Activity
16
+
17
+ ```bash
18
+ git log --oneline --since="24 hours ago" --no-merges 2>/dev/null || echo "No recent commits"
19
+
20
+ git diff --stat HEAD~10 HEAD 2>/dev/null | tail -1 || echo "No diff available"
21
+
22
+ git log --format="%ai" --since="24 hours ago" 2>/dev/null | head -1
23
+ git log --format="%ai" --since="24 hours ago" 2>/dev/null | tail -1
24
+ ```
25
+
26
+ ### 1b. Planning State
27
+
28
+ Read `.planning/STATE.md` to get:
29
+ - Current milestone and phase
30
+ - Progress percentage
31
+ - Active blockers
32
+ - Recent decisions
33
+
34
+ Read `.planning/ROADMAP.md` to get milestone name and phase goals.
35
+
36
+ ### 1c. Phase Artifacts
37
+
38
+ ```bash
39
+ find .planning/phases -name "*-SUMMARY.md" -newer .planning/STATE.md 2>/dev/null
40
+ find .planning/phases -name "*-UAT.md" -newer .planning/STATE.md 2>/dev/null
41
+ find .planning/phases -name "*-VERIFICATION.md" -newer .planning/STATE.md 2>/dev/null
42
+ ```
43
+
44
+ ### 1d. Previous Reports
45
+
46
+ ```bash
47
+ ls -la .planning/reports/SESSION_REPORT*.md 2>/dev/null || echo "No previous reports"
48
+ ```
49
+
50
+ ## Step 2: Generate Report
51
+
52
+ ```bash
53
+ node -e "require('fs').mkdirSync('.planning/reports',{recursive:true})"
54
+ ```
55
+
56
+ Write `.planning/reports/SESSION-[YYYYMMDD].md`:
57
+
58
+ ```markdown
59
+ # Session Report
60
+
61
+ **Generated:** [timestamp]
62
+ **Project:** [from PROJECT.md title or directory name]
63
+ **Milestone:** [N] — [milestone name]
64
+
65
+ ---
66
+
67
+ ## Session Summary
68
+
69
+ **Duration:** [estimated from first to last commit timestamp, or "Single session"]
70
+ **Phase Progress:** [from STATE.md]
71
+ **Plans Executed:** [count of summaries written this session]
72
+ **Commits Made:** [count from git log]
73
+
74
+ ## Work Performed
75
+
76
+ | Phase | Plans | Status | Key Deliverables |
77
+ |-------|-------|--------|-----------------|
78
+ | [N] | [IDs] | [complete/partial] | [what was built] |
79
+
80
+ ## Decisions Made
81
+
82
+ [Decisions captured during this session, from STATE.md or DECISIONS.md changes]
83
+
84
+ ## Issues Encountered
85
+
86
+ [Any blockers, bugs, or deviations noted in SUMMARYs]
87
+
88
+ ## Files Changed
89
+
90
+ [Top 10 most-changed files from git diff --stat]
91
+
92
+ ---
93
+
94
+ ## Next Steps
95
+
96
+ [What STATE.md says is next]
97
+
98
+ ---
99
+
100
+ *Generated by learnship session-report*
101
+ ```
102
+
103
+ ## Step 3: Commit and Present
104
+
105
+ ```bash
106
+ git add .planning/reports/
107
+ git commit -m "docs: session report [date]"
108
+ ```
109
+
110
+ ```
111
+ learnship > SESSION REPORT COMPLETE
112
+
113
+ Report: .planning/reports/SESSION-[date].md
114
+ Duration: [estimate]
115
+ Commits: [N]
116
+ Plans completed: [M]
117
+
118
+ Share this report with stakeholders or use it for team standups.
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Learning Checkpoint
124
+
125
+ Read `learning_mode` from `.planning/config.json`.
126
+
127
+ **If `auto`:**
128
+
129
+ > **Learning moment:** End of session is a natural reflection point:
130
+ >
131
+ > `@agentic-learning reflect` — What was the most valuable thing accomplished this session? What would you do differently? Structured reflection at session boundaries builds compounding insight.
132
+
133
+ **If `manual`:** Add quietly: *"Tip: `@agentic-learning reflect` to consolidate lessons from this session."*