claude-code-pilot 2.0.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 (257) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/bin/install.js +431 -0
  4. package/docs/agent-guides/architecture.md +107 -0
  5. package/ecc/agents/architect.md +211 -0
  6. package/ecc/agents/code-reviewer.md +237 -0
  7. package/ecc/agents/doc-updater.md +107 -0
  8. package/ecc/agents/e2e-runner.md +107 -0
  9. package/ecc/agents/security-reviewer.md +108 -0
  10. package/ecc/agents/tdd-guide.md +91 -0
  11. package/ecc/commands/checkpoint.md +74 -0
  12. package/ecc/commands/evolve.md +178 -0
  13. package/ecc/commands/learn.md +70 -0
  14. package/ecc/commands/model-route.md +26 -0
  15. package/ecc/commands/quality-gate.md +29 -0
  16. package/ecc/commands/resume-session.md +155 -0
  17. package/ecc/commands/save-session.md +275 -0
  18. package/ecc/commands/sessions.md +305 -0
  19. package/ecc/commands/verify.md +59 -0
  20. package/ecc/contexts/dev.md +20 -0
  21. package/ecc/contexts/research.md +26 -0
  22. package/ecc/contexts/review.md +22 -0
  23. package/ecc/examples/CLAUDE.md +100 -0
  24. package/ecc/examples/django-api-CLAUDE.md +308 -0
  25. package/ecc/examples/go-microservice-CLAUDE.md +267 -0
  26. package/ecc/examples/rust-api-CLAUDE.md +285 -0
  27. package/ecc/examples/saas-nextjs-CLAUDE.md +166 -0
  28. package/ecc/examples/user-CLAUDE.md +109 -0
  29. package/ecc/rules/common/agents.md +49 -0
  30. package/ecc/rules/common/coding-style.md +48 -0
  31. package/ecc/rules/common/development-workflow.md +37 -0
  32. package/ecc/rules/common/git-workflow.md +24 -0
  33. package/ecc/rules/common/hooks.md +30 -0
  34. package/ecc/rules/common/patterns.md +31 -0
  35. package/ecc/rules/common/performance.md +55 -0
  36. package/ecc/rules/common/security.md +29 -0
  37. package/ecc/rules/common/testing.md +29 -0
  38. package/ecc/rules/golang/coding-style.md +32 -0
  39. package/ecc/rules/golang/hooks.md +17 -0
  40. package/ecc/rules/golang/patterns.md +45 -0
  41. package/ecc/rules/golang/security.md +34 -0
  42. package/ecc/rules/golang/testing.md +31 -0
  43. package/ecc/rules/kotlin/coding-style.md +86 -0
  44. package/ecc/rules/kotlin/patterns.md +146 -0
  45. package/ecc/rules/kotlin/security.md +82 -0
  46. package/ecc/rules/kotlin/testing.md +128 -0
  47. package/ecc/rules/perl/coding-style.md +46 -0
  48. package/ecc/rules/perl/hooks.md +22 -0
  49. package/ecc/rules/perl/patterns.md +76 -0
  50. package/ecc/rules/perl/security.md +69 -0
  51. package/ecc/rules/perl/testing.md +54 -0
  52. package/ecc/rules/php/coding-style.md +35 -0
  53. package/ecc/rules/php/hooks.md +24 -0
  54. package/ecc/rules/php/patterns.md +32 -0
  55. package/ecc/rules/php/security.md +33 -0
  56. package/ecc/rules/php/testing.md +34 -0
  57. package/ecc/rules/python/coding-style.md +42 -0
  58. package/ecc/rules/python/hooks.md +19 -0
  59. package/ecc/rules/python/patterns.md +39 -0
  60. package/ecc/rules/python/security.md +30 -0
  61. package/ecc/rules/python/testing.md +38 -0
  62. package/ecc/rules/swift/coding-style.md +47 -0
  63. package/ecc/rules/swift/hooks.md +20 -0
  64. package/ecc/rules/swift/patterns.md +66 -0
  65. package/ecc/rules/swift/security.md +33 -0
  66. package/ecc/rules/swift/testing.md +45 -0
  67. package/ecc/rules/typescript/coding-style.md +199 -0
  68. package/ecc/rules/typescript/hooks.md +22 -0
  69. package/ecc/rules/typescript/patterns.md +52 -0
  70. package/ecc/rules/typescript/security.md +28 -0
  71. package/ecc/rules/typescript/testing.md +18 -0
  72. package/ecc/scripts/hooks/check-hook-enabled.js +12 -0
  73. package/ecc/scripts/hooks/evaluate-session.js +100 -0
  74. package/ecc/scripts/hooks/pre-compact.js +48 -0
  75. package/ecc/scripts/hooks/run-with-flags-shell.sh +32 -0
  76. package/ecc/scripts/hooks/run-with-flags.js +120 -0
  77. package/ecc/scripts/hooks/session-end-marker.js +15 -0
  78. package/ecc/scripts/hooks/session-end.js +258 -0
  79. package/ecc/scripts/hooks/session-start.js +97 -0
  80. package/ecc/scripts/hooks/suggest-compact.js +80 -0
  81. package/ecc/scripts/lib/hook-flags.js +74 -0
  82. package/ecc/scripts/lib/package-manager.d.ts +119 -0
  83. package/ecc/scripts/lib/package-manager.js +431 -0
  84. package/ecc/scripts/lib/project-detect.js +428 -0
  85. package/ecc/scripts/lib/resolve-formatter.js +185 -0
  86. package/ecc/scripts/lib/session-aliases.d.ts +136 -0
  87. package/ecc/scripts/lib/session-aliases.js +481 -0
  88. package/ecc/scripts/lib/session-manager.d.ts +131 -0
  89. package/ecc/scripts/lib/session-manager.js +444 -0
  90. package/ecc/scripts/lib/shell-split.js +86 -0
  91. package/ecc/scripts/lib/utils.d.ts +183 -0
  92. package/ecc/scripts/lib/utils.js +543 -0
  93. package/ecc/skills/continuous-learning-v2/SKILL.md +365 -0
  94. package/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +144 -0
  95. package/ecc/skills/continuous-learning-v2/agents/observer.md +198 -0
  96. package/ecc/skills/continuous-learning-v2/agents/start-observer.sh +194 -0
  97. package/ecc/skills/continuous-learning-v2/config.json +8 -0
  98. package/ecc/skills/continuous-learning-v2/hooks/observe.sh +246 -0
  99. package/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +218 -0
  100. package/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +1148 -0
  101. package/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +984 -0
  102. package/ecc/skills/strategic-compact/SKILL.md +103 -0
  103. package/ecc/skills/strategic-compact/suggest-compact.sh +54 -0
  104. package/ecc/skills/verification-loop-SKILL.md +126 -0
  105. package/gsd/LICENSE +21 -0
  106. package/gsd/agents/gsd-codebase-mapper.md +772 -0
  107. package/gsd/agents/gsd-debugger.md +1257 -0
  108. package/gsd/agents/gsd-executor.md +489 -0
  109. package/gsd/agents/gsd-integration-checker.md +445 -0
  110. package/gsd/agents/gsd-nyquist-auditor.md +178 -0
  111. package/gsd/agents/gsd-phase-researcher.md +555 -0
  112. package/gsd/agents/gsd-plan-checker.md +708 -0
  113. package/gsd/agents/gsd-planner.md +1309 -0
  114. package/gsd/agents/gsd-project-researcher.md +631 -0
  115. package/gsd/agents/gsd-research-synthesizer.md +249 -0
  116. package/gsd/agents/gsd-roadmapper.md +652 -0
  117. package/gsd/agents/gsd-verifier.md +581 -0
  118. package/gsd/commands-gsd/add-phase.md +43 -0
  119. package/gsd/commands-gsd/add-tests.md +41 -0
  120. package/gsd/commands-gsd/add-todo.md +47 -0
  121. package/gsd/commands-gsd/audit-milestone.md +36 -0
  122. package/gsd/commands-gsd/check-todos.md +45 -0
  123. package/gsd/commands-gsd/cleanup.md +18 -0
  124. package/gsd/commands-gsd/complete-milestone.md +136 -0
  125. package/gsd/commands-gsd/debug.md +168 -0
  126. package/gsd/commands-gsd/discuss-phase.md +90 -0
  127. package/gsd/commands-gsd/execute-phase.md +41 -0
  128. package/gsd/commands-gsd/health.md +22 -0
  129. package/gsd/commands-gsd/help.md +22 -0
  130. package/gsd/commands-gsd/insert-phase.md +32 -0
  131. package/gsd/commands-gsd/join-discord.md +18 -0
  132. package/gsd/commands-gsd/list-phase-assumptions.md +46 -0
  133. package/gsd/commands-gsd/map-codebase.md +71 -0
  134. package/gsd/commands-gsd/new-milestone.md +44 -0
  135. package/gsd/commands-gsd/new-project.md +42 -0
  136. package/gsd/commands-gsd/pause-work.md +38 -0
  137. package/gsd/commands-gsd/plan-milestone-gaps.md +34 -0
  138. package/gsd/commands-gsd/plan-phase.md +45 -0
  139. package/gsd/commands-gsd/progress.md +24 -0
  140. package/gsd/commands-gsd/quick.md +45 -0
  141. package/gsd/commands-gsd/reapply-patches.md +123 -0
  142. package/gsd/commands-gsd/remove-phase.md +31 -0
  143. package/gsd/commands-gsd/research-phase.md +190 -0
  144. package/gsd/commands-gsd/resume-work.md +40 -0
  145. package/gsd/commands-gsd/set-profile.md +34 -0
  146. package/gsd/commands-gsd/settings.md +36 -0
  147. package/gsd/commands-gsd/update.md +37 -0
  148. package/gsd/commands-gsd/validate-phase.md +35 -0
  149. package/gsd/commands-gsd/verify-work.md +38 -0
  150. package/gsd/get-shit-done/bin/gsd-tools.cjs +592 -0
  151. package/gsd/get-shit-done/bin/lib/commands.cjs +548 -0
  152. package/gsd/get-shit-done/bin/lib/config.cjs +169 -0
  153. package/gsd/get-shit-done/bin/lib/core.cjs +492 -0
  154. package/gsd/get-shit-done/bin/lib/frontmatter.cjs +299 -0
  155. package/gsd/get-shit-done/bin/lib/init.cjs +710 -0
  156. package/gsd/get-shit-done/bin/lib/milestone.cjs +241 -0
  157. package/gsd/get-shit-done/bin/lib/phase.cjs +901 -0
  158. package/gsd/get-shit-done/bin/lib/roadmap.cjs +298 -0
  159. package/gsd/get-shit-done/bin/lib/state.cjs +721 -0
  160. package/gsd/get-shit-done/bin/lib/template.cjs +222 -0
  161. package/gsd/get-shit-done/bin/lib/verify.cjs +820 -0
  162. package/gsd/get-shit-done/references/checkpoints.md +776 -0
  163. package/gsd/get-shit-done/references/continuation-format.md +249 -0
  164. package/gsd/get-shit-done/references/decimal-phase-calculation.md +65 -0
  165. package/gsd/get-shit-done/references/git-integration.md +248 -0
  166. package/gsd/get-shit-done/references/git-planning-commit.md +38 -0
  167. package/gsd/get-shit-done/references/model-profile-resolution.md +34 -0
  168. package/gsd/get-shit-done/references/model-profiles.md +93 -0
  169. package/gsd/get-shit-done/references/phase-argument-parsing.md +61 -0
  170. package/gsd/get-shit-done/references/planning-config.md +200 -0
  171. package/gsd/get-shit-done/references/questioning.md +162 -0
  172. package/gsd/get-shit-done/references/tdd.md +263 -0
  173. package/gsd/get-shit-done/references/ui-brand.md +160 -0
  174. package/gsd/get-shit-done/references/verification-patterns.md +612 -0
  175. package/gsd/get-shit-done/templates/DEBUG.md +164 -0
  176. package/gsd/get-shit-done/templates/UAT.md +247 -0
  177. package/gsd/get-shit-done/templates/VALIDATION.md +76 -0
  178. package/gsd/get-shit-done/templates/codebase/architecture.md +255 -0
  179. package/gsd/get-shit-done/templates/codebase/concerns.md +310 -0
  180. package/gsd/get-shit-done/templates/codebase/conventions.md +307 -0
  181. package/gsd/get-shit-done/templates/codebase/integrations.md +280 -0
  182. package/gsd/get-shit-done/templates/codebase/stack.md +186 -0
  183. package/gsd/get-shit-done/templates/codebase/structure.md +285 -0
  184. package/gsd/get-shit-done/templates/codebase/testing.md +480 -0
  185. package/gsd/get-shit-done/templates/config.json +37 -0
  186. package/gsd/get-shit-done/templates/context.md +297 -0
  187. package/gsd/get-shit-done/templates/continue-here.md +78 -0
  188. package/gsd/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  189. package/gsd/get-shit-done/templates/discovery.md +146 -0
  190. package/gsd/get-shit-done/templates/milestone-archive.md +123 -0
  191. package/gsd/get-shit-done/templates/milestone.md +115 -0
  192. package/gsd/get-shit-done/templates/phase-prompt.md +569 -0
  193. package/gsd/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  194. package/gsd/get-shit-done/templates/project.md +184 -0
  195. package/gsd/get-shit-done/templates/requirements.md +231 -0
  196. package/gsd/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  197. package/gsd/get-shit-done/templates/research-project/FEATURES.md +147 -0
  198. package/gsd/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  199. package/gsd/get-shit-done/templates/research-project/STACK.md +120 -0
  200. package/gsd/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  201. package/gsd/get-shit-done/templates/research.md +552 -0
  202. package/gsd/get-shit-done/templates/retrospective.md +54 -0
  203. package/gsd/get-shit-done/templates/roadmap.md +202 -0
  204. package/gsd/get-shit-done/templates/state.md +176 -0
  205. package/gsd/get-shit-done/templates/summary-complex.md +59 -0
  206. package/gsd/get-shit-done/templates/summary-minimal.md +41 -0
  207. package/gsd/get-shit-done/templates/summary-standard.md +48 -0
  208. package/gsd/get-shit-done/templates/summary.md +248 -0
  209. package/gsd/get-shit-done/templates/user-setup.md +311 -0
  210. package/gsd/get-shit-done/templates/verification-report.md +322 -0
  211. package/gsd/get-shit-done/workflows/add-phase.md +112 -0
  212. package/gsd/get-shit-done/workflows/add-tests.md +351 -0
  213. package/gsd/get-shit-done/workflows/add-todo.md +158 -0
  214. package/gsd/get-shit-done/workflows/audit-milestone.md +332 -0
  215. package/gsd/get-shit-done/workflows/check-todos.md +177 -0
  216. package/gsd/get-shit-done/workflows/cleanup.md +152 -0
  217. package/gsd/get-shit-done/workflows/complete-milestone.md +764 -0
  218. package/gsd/get-shit-done/workflows/diagnose-issues.md +219 -0
  219. package/gsd/get-shit-done/workflows/discovery-phase.md +289 -0
  220. package/gsd/get-shit-done/workflows/discuss-phase.md +676 -0
  221. package/gsd/get-shit-done/workflows/execute-phase.md +459 -0
  222. package/gsd/get-shit-done/workflows/execute-plan.md +449 -0
  223. package/gsd/get-shit-done/workflows/health.md +159 -0
  224. package/gsd/get-shit-done/workflows/help.md +489 -0
  225. package/gsd/get-shit-done/workflows/insert-phase.md +130 -0
  226. package/gsd/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  227. package/gsd/get-shit-done/workflows/map-codebase.md +316 -0
  228. package/gsd/get-shit-done/workflows/new-milestone.md +384 -0
  229. package/gsd/get-shit-done/workflows/new-project.md +1111 -0
  230. package/gsd/get-shit-done/workflows/pause-work.md +122 -0
  231. package/gsd/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
  232. package/gsd/get-shit-done/workflows/plan-phase.md +560 -0
  233. package/gsd/get-shit-done/workflows/progress.md +382 -0
  234. package/gsd/get-shit-done/workflows/quick.md +601 -0
  235. package/gsd/get-shit-done/workflows/remove-phase.md +155 -0
  236. package/gsd/get-shit-done/workflows/research-phase.md +74 -0
  237. package/gsd/get-shit-done/workflows/resume-project.md +307 -0
  238. package/gsd/get-shit-done/workflows/set-profile.md +81 -0
  239. package/gsd/get-shit-done/workflows/settings.md +214 -0
  240. package/gsd/get-shit-done/workflows/transition.md +544 -0
  241. package/gsd/get-shit-done/workflows/update.md +240 -0
  242. package/gsd/get-shit-done/workflows/validate-phase.md +167 -0
  243. package/gsd/get-shit-done/workflows/verify-phase.md +243 -0
  244. package/gsd/get-shit-done/workflows/verify-work.md +583 -0
  245. package/gsd/hooks/gsd-check-update.js +81 -0
  246. package/gsd/hooks/gsd-context-monitor.js +141 -0
  247. package/gsd/hooks/gsd-statusline.js +115 -0
  248. package/kit/CLAUDE.md +43 -0
  249. package/kit/commands/kit/update.md +46 -0
  250. package/kit/commands/setup-refresh.md +50 -0
  251. package/kit/commands/setup.md +579 -0
  252. package/kit/commands/tool-guide.md +44 -0
  253. package/kit/hooks/kit-check-update.js +54 -0
  254. package/kit/mcp.json +10 -0
  255. package/kit/rules/code-style.md +24 -0
  256. package/manifest.json +30 -0
  257. package/package.json +36 -0
@@ -0,0 +1,155 @@
1
+ ---
2
+ description: Load the most recent session file from ~/.claude/sessions/ and resume work with full context from where the last session ended.
3
+ ---
4
+
5
+ # Resume Session Command
6
+
7
+ Load the last saved session state and orient fully before doing any work.
8
+ This command is the counterpart to `/save-session`.
9
+
10
+ ## When to Use
11
+
12
+ - Starting a new session to continue work from a previous day
13
+ - After starting a fresh session due to context limits
14
+ - When handing off a session file from another source (just provide the file path)
15
+ - Any time you have a session file and want Claude to fully absorb it before proceeding
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ /resume-session # loads most recent file in ~/.claude/sessions/
21
+ /resume-session 2024-01-15 # loads most recent session for that date
22
+ /resume-session ~/.claude/sessions/2024-01-15-session.tmp # loads a specific legacy-format file
23
+ /resume-session ~/.claude/sessions/2024-01-15-abc123de-session.tmp # loads a current short-id session file
24
+ ```
25
+
26
+ ## Process
27
+
28
+ ### Step 1: Find the session file
29
+
30
+ If no argument provided:
31
+
32
+ 1. Check `~/.claude/sessions/`
33
+ 2. Pick the most recently modified `*-session.tmp` file
34
+ 3. If the folder does not exist or has no matching files, tell the user:
35
+ ```
36
+ No session files found in ~/.claude/sessions/
37
+ Run /save-session at the end of a session to create one.
38
+ ```
39
+ Then stop.
40
+
41
+ If an argument is provided:
42
+
43
+ - If it looks like a date (`YYYY-MM-DD`), search `~/.claude/sessions/` for files matching
44
+ `YYYY-MM-DD-session.tmp` (legacy format) or `YYYY-MM-DD-<shortid>-session.tmp` (current format)
45
+ and load the most recently modified variant for that date
46
+ - If it looks like a file path, read that file directly
47
+ - If not found, report clearly and stop
48
+
49
+ ### Step 2: Read the entire session file
50
+
51
+ Read the complete file. Do not summarize yet.
52
+
53
+ ### Step 3: Confirm understanding
54
+
55
+ Respond with a structured briefing in this exact format:
56
+
57
+ ```
58
+ SESSION LOADED: [actual resolved path to the file]
59
+ ════════════════════════════════════════════════
60
+
61
+ PROJECT: [project name / topic from file]
62
+
63
+ WHAT WE'RE BUILDING:
64
+ [2-3 sentence summary in your own words]
65
+
66
+ CURRENT STATE:
67
+ ✅ Working: [count] items confirmed
68
+ 🔄 In Progress: [list files that are in progress]
69
+ 🗒️ Not Started: [list planned but untouched]
70
+
71
+ WHAT NOT TO RETRY:
72
+ [list every failed approach with its reason — this is critical]
73
+
74
+ OPEN QUESTIONS / BLOCKERS:
75
+ [list any blockers or unanswered questions]
76
+
77
+ NEXT STEP:
78
+ [exact next step if defined in the file]
79
+ [if not defined: "No next step defined — recommend reviewing 'What Has NOT Been Tried Yet' together before starting"]
80
+
81
+ ════════════════════════════════════════════════
82
+ Ready to continue. What would you like to do?
83
+ ```
84
+
85
+ ### Step 4: Wait for the user
86
+
87
+ Do NOT start working automatically. Do NOT touch any files. Wait for the user to say what to do next.
88
+
89
+ If the next step is clearly defined in the session file and the user says "continue" or "yes" or similar — proceed with that exact next step.
90
+
91
+ If no next step is defined — ask the user where to start, and optionally suggest an approach from the "What Has NOT Been Tried Yet" section.
92
+
93
+ ---
94
+
95
+ ## Edge Cases
96
+
97
+ **Multiple sessions for the same date** (`2024-01-15-session.tmp`, `2024-01-15-abc123de-session.tmp`):
98
+ Load the most recently modified matching file for that date, regardless of whether it uses the legacy no-id format or the current short-id format.
99
+
100
+ **Session file references files that no longer exist:**
101
+ Note this during the briefing — "⚠️ `path/to/file.ts` referenced in session but not found on disk."
102
+
103
+ **Session file is from more than 7 days ago:**
104
+ Note the gap — "⚠️ This session is from N days ago (threshold: 7 days). Things may have changed." — then proceed normally.
105
+
106
+ **User provides a file path directly (e.g., forwarded from a teammate):**
107
+ Read it and follow the same briefing process — the format is the same regardless of source.
108
+
109
+ **Session file is empty or malformed:**
110
+ Report: "Session file found but appears empty or unreadable. You may need to create a new one with /save-session."
111
+
112
+ ---
113
+
114
+ ## Example Output
115
+
116
+ ```
117
+ SESSION LOADED: /Users/you/.claude/sessions/2024-01-15-abc123de-session.tmp
118
+ ════════════════════════════════════════════════
119
+
120
+ PROJECT: my-app — JWT Authentication
121
+
122
+ WHAT WE'RE BUILDING:
123
+ User authentication with JWT tokens stored in httpOnly cookies.
124
+ Register and login endpoints are partially done. Route protection
125
+ via middleware hasn't been started yet.
126
+
127
+ CURRENT STATE:
128
+ ✅ Working: 3 items (register endpoint, JWT generation, password hashing)
129
+ 🔄 In Progress: app/api/auth/login/route.ts (token works, cookie not set yet)
130
+ 🗒️ Not Started: middleware.ts, app/login/page.tsx
131
+
132
+ WHAT NOT TO RETRY:
133
+ ❌ Next-Auth — conflicts with custom Prisma adapter, threw adapter error on every request
134
+ ❌ localStorage for JWT — causes SSR hydration mismatch, incompatible with Next.js
135
+
136
+ OPEN QUESTIONS / BLOCKERS:
137
+ - Does cookies().set() work inside a Route Handler or only Server Actions?
138
+
139
+ NEXT STEP:
140
+ In app/api/auth/login/route.ts — set the JWT as an httpOnly cookie using
141
+ cookies().set('token', jwt, { httpOnly: true, secure: true, sameSite: 'strict' })
142
+ then test with Postman for a Set-Cookie header in the response.
143
+
144
+ ════════════════════════════════════════════════
145
+ Ready to continue. What would you like to do?
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Notes
151
+
152
+ - Never modify the session file when loading it — it's a read-only historical record
153
+ - The briefing format is fixed — do not skip sections even if they are empty
154
+ - "What Not To Retry" must always be shown, even if it just says "None" — it's too important to miss
155
+ - After resuming, the user may want to run `/save-session` again at the end of the new session to create a new dated file
@@ -0,0 +1,275 @@
1
+ ---
2
+ description: Save current session state to a dated file in ~/.claude/sessions/ so work can be resumed in a future session with full context.
3
+ ---
4
+
5
+ # Save Session Command
6
+
7
+ Capture everything that happened in this session — what was built, what worked, what failed, what's left — and write it to a dated file so the next session can pick up exactly where this one left off.
8
+
9
+ ## When to Use
10
+
11
+ - End of a work session before closing Claude Code
12
+ - Before hitting context limits (run this first, then start a fresh session)
13
+ - After solving a complex problem you want to remember
14
+ - Any time you need to hand off context to a future session
15
+
16
+ ## Process
17
+
18
+ ### Step 1: Gather context
19
+
20
+ Before writing the file, collect:
21
+
22
+ - Read all files modified during this session (use git diff or recall from conversation)
23
+ - Review what was discussed, attempted, and decided
24
+ - Note any errors encountered and how they were resolved (or not)
25
+ - Check current test/build status if relevant
26
+
27
+ ### Step 2: Create the sessions folder if it doesn't exist
28
+
29
+ Create the canonical sessions folder in the user's Claude home directory:
30
+
31
+ ```bash
32
+ mkdir -p ~/.claude/sessions
33
+ ```
34
+
35
+ ### Step 3: Write the session file
36
+
37
+ Create `~/.claude/sessions/YYYY-MM-DD-<short-id>-session.tmp`, using today's actual date and a short-id that satisfies the rules enforced by `SESSION_FILENAME_REGEX` in `session-manager.js`:
38
+
39
+ - Allowed characters: lowercase `a-z`, digits `0-9`, hyphens `-`
40
+ - Minimum length: 8 characters
41
+ - No uppercase letters, no underscores, no spaces
42
+
43
+ Valid examples: `abc123de`, `a1b2c3d4`, `frontend-worktree-1`
44
+ Invalid examples: `ABC123de` (uppercase), `short` (under 8 chars), `test_id1` (underscore)
45
+
46
+ Full valid filename example: `2024-01-15-abc123de-session.tmp`
47
+
48
+ The legacy filename `YYYY-MM-DD-session.tmp` is still valid, but new session files should prefer the short-id form to avoid same-day collisions.
49
+
50
+ ### Step 4: Populate the file with all sections below
51
+
52
+ Write every section honestly. Do not skip sections — write "Nothing yet" or "N/A" if a section genuinely has no content. An incomplete file is worse than an honest empty section.
53
+
54
+ ### Step 5: Show the file to the user
55
+
56
+ After writing, display the full contents and ask:
57
+
58
+ ```
59
+ Session saved to [actual resolved path to the session file]
60
+
61
+ Does this look accurate? Anything to correct or add before we close?
62
+ ```
63
+
64
+ Wait for confirmation. Make edits if requested.
65
+
66
+ ---
67
+
68
+ ## Session File Format
69
+
70
+ ```markdown
71
+ # Session: YYYY-MM-DD
72
+
73
+ **Started:** [approximate time if known]
74
+ **Last Updated:** [current time]
75
+ **Project:** [project name or path]
76
+ **Topic:** [one-line summary of what this session was about]
77
+
78
+ ---
79
+
80
+ ## What We Are Building
81
+
82
+ [1-3 paragraphs describing the feature, bug fix, or task. Include enough
83
+ context that someone with zero memory of this session can understand the goal.
84
+ Include: what it does, why it's needed, how it fits into the larger system.]
85
+
86
+ ---
87
+
88
+ ## What WORKED (with evidence)
89
+
90
+ [List only things that are confirmed working. For each item include WHY you
91
+ know it works — test passed, ran in browser, Postman returned 200, etc.
92
+ Without evidence, move it to "Not Tried Yet" instead.]
93
+
94
+ - **[thing that works]** — confirmed by: [specific evidence]
95
+ - **[thing that works]** — confirmed by: [specific evidence]
96
+
97
+ If nothing is confirmed working yet: "Nothing confirmed working yet — all approaches still in progress or untested."
98
+
99
+ ---
100
+
101
+ ## What Did NOT Work (and why)
102
+
103
+ [This is the most important section. List every approach tried that failed.
104
+ For each failure write the EXACT reason so the next session doesn't retry it.
105
+ Be specific: "threw X error because Y" is useful. "didn't work" is not.]
106
+
107
+ - **[approach tried]** — failed because: [exact reason / error message]
108
+ - **[approach tried]** — failed because: [exact reason / error message]
109
+
110
+ If nothing failed: "No failed approaches yet."
111
+
112
+ ---
113
+
114
+ ## What Has NOT Been Tried Yet
115
+
116
+ [Approaches that seem promising but haven't been attempted. Ideas from the
117
+ conversation. Alternative solutions worth exploring. Be specific enough that
118
+ the next session knows exactly what to try.]
119
+
120
+ - [approach / idea]
121
+ - [approach / idea]
122
+
123
+ If nothing is queued: "No specific untried approaches identified."
124
+
125
+ ---
126
+
127
+ ## Current State of Files
128
+
129
+ [Every file touched this session. Be precise about what state each file is in.]
130
+
131
+ | File | Status | Notes |
132
+ | ----------------- | -------------- | -------------------------- |
133
+ | `path/to/file.ts` | ✅ Complete | [what it does] |
134
+ | `path/to/file.ts` | 🔄 In Progress | [what's done, what's left] |
135
+ | `path/to/file.ts` | ❌ Broken | [what's wrong] |
136
+ | `path/to/file.ts` | 🗒️ Not Started | [planned but not touched] |
137
+
138
+ If no files were touched: "No files modified this session."
139
+
140
+ ---
141
+
142
+ ## Decisions Made
143
+
144
+ [Architecture choices, tradeoffs accepted, approaches chosen and why.
145
+ These prevent the next session from relitigating settled decisions.]
146
+
147
+ - **[decision]** — reason: [why this was chosen over alternatives]
148
+
149
+ If no significant decisions: "No major decisions made this session."
150
+
151
+ ---
152
+
153
+ ## Blockers & Open Questions
154
+
155
+ [Anything unresolved that the next session needs to address or investigate.
156
+ Questions that came up but weren't answered. External dependencies waiting on.]
157
+
158
+ - [blocker / open question]
159
+
160
+ If none: "No active blockers."
161
+
162
+ ---
163
+
164
+ ## Exact Next Step
165
+
166
+ [If known: The single most important thing to do when resuming. Be precise
167
+ enough that resuming requires zero thinking about where to start.]
168
+
169
+ [If not known: "Next step not determined — review 'What Has NOT Been Tried Yet'
170
+ and 'Blockers' sections to decide on direction before starting."]
171
+
172
+ ---
173
+
174
+ ## Environment & Setup Notes
175
+
176
+ [Only fill this if relevant — commands needed to run the project, env vars
177
+ required, services that need to be running, etc. Skip if standard setup.]
178
+
179
+ [If none: omit this section entirely.]
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Example Output
185
+
186
+ ```markdown
187
+ # Session: 2024-01-15
188
+
189
+ **Started:** ~2pm
190
+ **Last Updated:** 5:30pm
191
+ **Project:** my-app
192
+ **Topic:** Building JWT authentication with httpOnly cookies
193
+
194
+ ---
195
+
196
+ ## What We Are Building
197
+
198
+ User authentication system for the Next.js app. Users register with email/password,
199
+ receive a JWT stored in an httpOnly cookie (not localStorage), and protected routes
200
+ check for a valid token via middleware. The goal is session persistence across browser
201
+ refreshes without exposing the token to JavaScript.
202
+
203
+ ---
204
+
205
+ ## What WORKED (with evidence)
206
+
207
+ - **`/api/auth/register` endpoint** — confirmed by: Postman POST returns 200 with user
208
+ object, row visible in Supabase dashboard, bcrypt hash stored correctly
209
+ - **JWT generation in `lib/auth.ts`** — confirmed by: unit test passes
210
+ (`npm test -- auth.test.ts`), decoded token at jwt.io shows correct payload
211
+ - **Password hashing** — confirmed by: `bcrypt.compare()` returns true in test
212
+
213
+ ---
214
+
215
+ ## What Did NOT Work (and why)
216
+
217
+ - **Next-Auth library** — failed because: conflicts with our custom Prisma adapter,
218
+ threw "Cannot use adapter with credentials provider in this configuration" on every
219
+ request. Not worth debugging — too opinionated for our setup.
220
+ - **Storing JWT in localStorage** — failed because: SSR renders happen before
221
+ localStorage is available, caused React hydration mismatch error on every page load.
222
+ This approach is fundamentally incompatible with Next.js SSR.
223
+
224
+ ---
225
+
226
+ ## What Has NOT Been Tried Yet
227
+
228
+ - Store JWT as httpOnly cookie in the login route response (most likely solution)
229
+ - Use `cookies()` from `next/headers` to read token in server components
230
+ - Write middleware.ts to protect routes by checking cookie existence
231
+
232
+ ---
233
+
234
+ ## Current State of Files
235
+
236
+ | File | Status | Notes |
237
+ | -------------------------------- | -------------- | ----------------------------------------------- |
238
+ | `app/api/auth/register/route.ts` | ✅ Complete | Works, tested |
239
+ | `app/api/auth/login/route.ts` | 🔄 In Progress | Token generates but not setting cookie yet |
240
+ | `lib/auth.ts` | ✅ Complete | JWT helpers, all tested |
241
+ | `middleware.ts` | 🗒️ Not Started | Route protection, needs cookie read logic first |
242
+ | `app/login/page.tsx` | 🗒️ Not Started | UI not started |
243
+
244
+ ---
245
+
246
+ ## Decisions Made
247
+
248
+ - **httpOnly cookie over localStorage** — reason: prevents XSS token theft, works with SSR
249
+ - **Custom auth over Next-Auth** — reason: Next-Auth conflicts with our Prisma setup, not worth the fight
250
+
251
+ ---
252
+
253
+ ## Blockers & Open Questions
254
+
255
+ - Does `cookies().set()` work inside a Route Handler or only in Server Actions? Need to verify.
256
+
257
+ ---
258
+
259
+ ## Exact Next Step
260
+
261
+ In `app/api/auth/login/route.ts`, after generating the JWT, set it as an httpOnly
262
+ cookie using `cookies().set('token', jwt, { httpOnly: true, secure: true, sameSite: 'strict' })`.
263
+ Then test with Postman — the response should include a `Set-Cookie` header.
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Notes
269
+
270
+ - Each session gets its own file — never append to a previous session's file
271
+ - The "What Did NOT Work" section is the most critical — future sessions will blindly retry failed approaches without it
272
+ - If the user asks to save mid-session (not just at the end), save what's known so far and mark in-progress items clearly
273
+ - The file is meant to be read by Claude at the start of the next session via `/resume-session`
274
+ - Use the canonical global session store: `~/.claude/sessions/`
275
+ - Prefer the short-id filename form (`YYYY-MM-DD-<short-id>-session.tmp`) for any new session file