mindsystem-cc 3.20.0 → 3.21.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/README.md +5 -6
  2. package/agents/ms-mockup-designer.md +1 -1
  3. package/agents/ms-product-researcher.md +69 -0
  4. package/agents/ms-research-synthesizer.md +1 -1
  5. package/agents/ms-researcher.md +8 -8
  6. package/agents/ms-roadmapper.md +9 -13
  7. package/bin/install.js +68 -5
  8. package/commands/ms/add-phase.md +4 -4
  9. package/commands/ms/adhoc.md +1 -1
  10. package/commands/ms/audit-milestone.md +12 -12
  11. package/commands/ms/complete-milestone.md +25 -22
  12. package/commands/ms/config.md +202 -0
  13. package/commands/ms/design-phase.md +3 -8
  14. package/commands/ms/discuss-phase.md +26 -22
  15. package/commands/ms/doctor.md +22 -202
  16. package/commands/ms/execute-phase.md +18 -7
  17. package/commands/ms/help.md +46 -39
  18. package/commands/ms/insert-phase.md +3 -3
  19. package/commands/ms/new-milestone.md +40 -16
  20. package/commands/ms/new-project.md +53 -42
  21. package/commands/ms/plan-milestone-gaps.md +4 -5
  22. package/commands/ms/plan-phase.md +2 -2
  23. package/commands/ms/progress.md +2 -4
  24. package/commands/ms/research-phase.md +7 -12
  25. package/commands/ms/research-project.md +12 -12
  26. package/mindsystem/references/continuation-format.md +3 -3
  27. package/mindsystem/references/principles.md +1 -1
  28. package/mindsystem/references/routing/audit-result-routing.md +12 -11
  29. package/mindsystem/references/routing/between-milestones-routing.md +2 -2
  30. package/mindsystem/references/routing/milestone-complete-routing.md +1 -1
  31. package/mindsystem/references/routing/next-phase-routing.md +4 -2
  32. package/mindsystem/templates/context.md +7 -6
  33. package/mindsystem/templates/milestone-archive.md +5 -5
  34. package/mindsystem/templates/milestone-context.md +1 -1
  35. package/mindsystem/templates/milestone.md +9 -9
  36. package/mindsystem/templates/project.md +2 -2
  37. package/mindsystem/templates/research-subagent-prompt.md +3 -3
  38. package/mindsystem/templates/roadmap-milestone.md +14 -14
  39. package/mindsystem/templates/roadmap.md +9 -7
  40. package/mindsystem/workflows/adhoc.md +1 -1
  41. package/mindsystem/workflows/complete-milestone.md +40 -75
  42. package/mindsystem/workflows/discuss-phase.md +137 -65
  43. package/mindsystem/workflows/doctor-fixes.md +273 -0
  44. package/mindsystem/workflows/execute-phase.md +7 -3
  45. package/mindsystem/workflows/execute-plan.md +3 -0
  46. package/mindsystem/workflows/map-codebase.md +2 -2
  47. package/mindsystem/workflows/mockup-generation.md +1 -1
  48. package/mindsystem/workflows/plan-phase.md +1 -1
  49. package/mindsystem/workflows/transition.md +2 -2
  50. package/mindsystem/workflows/verify-work.md +1 -1
  51. package/package.json +1 -1
  52. package/scripts/__pycache__/ms-tools.cpython-314.pyc +0 -0
  53. package/scripts/__pycache__/test_ms_tools.cpython-314-pytest-9.0.2.pyc +0 -0
  54. package/scripts/fixtures/scan-context/.planning/ROADMAP.md +16 -0
  55. package/scripts/fixtures/scan-context/.planning/adhoc/20260220-fix-token-SUMMARY.md +12 -0
  56. package/scripts/fixtures/scan-context/.planning/config.json +3 -0
  57. package/scripts/fixtures/scan-context/.planning/debug/resolved/token-bug.md +11 -0
  58. package/scripts/fixtures/scan-context/.planning/knowledge/auth.md +11 -0
  59. package/scripts/fixtures/scan-context/.planning/phases/02-infra/02-1-SUMMARY.md +20 -0
  60. package/scripts/fixtures/scan-context/.planning/phases/04-setup/04-1-SUMMARY.md +21 -0
  61. package/scripts/fixtures/scan-context/.planning/phases/05-auth/05-1-SUMMARY.md +28 -0
  62. package/scripts/fixtures/scan-context/.planning/todos/done/setup-db.md +10 -0
  63. package/scripts/fixtures/scan-context/.planning/todos/pending/add-logout.md +10 -0
  64. package/scripts/fixtures/scan-context/expected-output.json +257 -0
  65. package/scripts/ms-tools.py +2139 -0
  66. package/scripts/test_ms_tools.py +836 -0
  67. package/commands/ms/list-phase-assumptions.md +0 -56
  68. package/mindsystem/workflows/list-phase-assumptions.md +0 -178
  69. package/scripts/__pycache__/compare_mockups.cpython-314.pyc +0 -0
  70. package/scripts/archive-milestone-files.sh +0 -68
  71. package/scripts/archive-milestone-phases.sh +0 -138
  72. package/scripts/doctor-scan.sh +0 -402
  73. package/scripts/gather-milestone-stats.sh +0 -179
  74. package/scripts/generate-adhoc-patch.sh +0 -79
  75. package/scripts/generate-phase-patch.sh +0 -169
  76. package/scripts/scan-artifact-subsystems.sh +0 -55
  77. package/scripts/scan-planning-context.py +0 -839
  78. package/scripts/update-state.sh +0 -59
  79. package/scripts/validate-execution-order.sh +0 -104
@@ -0,0 +1,273 @@
1
+ <purpose>
2
+ Apply fixes for doctor health check failures. Each step targets one check category,
3
+ runs only if that check failed, and commits atomically.
4
+ </purpose>
5
+
6
+ <process>
7
+
8
+ <step name="fix_subsystems">
9
+ **Only if Subsystem Vocabulary failed.**
10
+
11
+ If subsystems array is empty (State A):
12
+
13
+ 1. Scan all artifacts for existing values:
14
+
15
+ ```bash
16
+ ms-tools scan-artifact-subsystems --values-only
17
+ ```
18
+
19
+ 2. Read `.planning/PROJECT.md` and `.planning/ROADMAP.md`.
20
+
21
+ 3. Derive 5-12 canonical subsystem identifiers from:
22
+ - Unique values found in artifacts
23
+ - Project domain from PROJECT.md
24
+ - Phase structure from ROADMAP.md
25
+
26
+ Rules:
27
+ - Lowercase, single-word or hyphenated (e.g., "auth", "real-time", "ui")
28
+ - Merge synonyms into one canonical value (pick shortest/most common)
29
+ - Cover all existing usage plus obvious gaps
30
+ - Include infrastructure-level subsystems if relevant (api, database, infra, testing)
31
+
32
+ 4. Present the proposed list with merge mappings (e.g., "authentication" -> "auth").
33
+
34
+ 5. Use AskUserQuestion:
35
+ - header: "Subsystems"
36
+ - question: "These subsystems were derived from your project. Look good?"
37
+ - options:
38
+ - "Looks good" — accept and apply
39
+ - "Add/remove some" — iterate on the list
40
+ - "Start over" — re-derive from scratch
41
+
42
+ 6. After confirmation: update `config.json` (subsystems as first field), standardize existing artifact `subsystem:` fields using Edit tool.
43
+
44
+ If subsystems exist but artifacts have mismatches (State B):
45
+
46
+ 1. Classify each artifact as OK/MISMATCH/MISSING.
47
+ 2. For MISMATCH: propose closest canonical value.
48
+ 3. For MISSING: propose based on artifact content/path.
49
+ 4. Apply fixes using Edit tool.
50
+
51
+ Commit:
52
+
53
+ ```bash
54
+ git add .planning/config.json
55
+ git add .planning/phases/*/*-SUMMARY.md 2>/dev/null
56
+ git add .planning/adhoc/*-SUMMARY.md 2>/dev/null
57
+ git add .planning/debug/*.md 2>/dev/null
58
+ git add .planning/debug/resolved/*.md 2>/dev/null
59
+ git add .planning/todos/pending/*.md 2>/dev/null
60
+ git add .planning/todos/done/*.md 2>/dev/null
61
+ ```
62
+
63
+ ```bash
64
+ git commit -m "$(cat <<'EOF'
65
+ chore(doctor): fix subsystem vocabulary
66
+
67
+ Standardized subsystem configuration and artifact values.
68
+ EOF
69
+ )"
70
+ ```
71
+ </step>
72
+
73
+ <step name="fix_milestone_dirs">
74
+ **Only if Milestone Directory Structure failed.**
75
+
76
+ For each flat file like `milestones/v0.1-ROADMAP.md`:
77
+
78
+ 1. Extract version prefix (e.g., `v0.1`).
79
+ 2. Create directory if it doesn't exist: `mkdir -p .planning/milestones/v0.1`
80
+ 3. `git mv` the file, stripping the version prefix from the filename:
81
+ `git mv .planning/milestones/v0.1-ROADMAP.md .planning/milestones/v0.1/ROADMAP.md`
82
+
83
+ **Note:** New milestones use slug-based directories (e.g., `milestones/mvp/`, `milestones/push-notifications/`). Old v-prefixed directories from previous format are valid and handled.
84
+
85
+ Commit:
86
+
87
+ ```bash
88
+ git add .planning/milestones/
89
+ ```
90
+
91
+ ```bash
92
+ git commit -m "$(cat <<'EOF'
93
+ chore(doctor): restructure milestone directories
94
+
95
+ Moved flat milestone files into versioned directories.
96
+ EOF
97
+ )"
98
+ ```
99
+ </step>
100
+
101
+ <step name="fix_milestone_naming">
102
+ **Only if Milestone Naming Convention failed.**
103
+
104
+ 1. **Build mapping** — run `ms-tools scan-milestone-naming`, parse JSON output.
105
+
106
+ 2. **Resolve slugs** — For each versioned dir, match to MILESTONES.md name mapping:
107
+ - Standard dirs: version matches directly (v0.1 → "MVP" → slug "mvp")
108
+ - Nested dirs: match sub-directory name to the milestone name in MILESTONES.md (v2.0.0/quests → "Quests Feature" → slug "quests-feature")
109
+ - Derive short slugs from names (Claude proposes, user confirms)
110
+
111
+ 3. **Present mapping** to user with AskUserQuestion:
112
+
113
+ ```
114
+ | Current Directory | Milestone Name | Proposed Slug |
115
+ |-------------------------|----------------------|------------------|
116
+ | v0.1/ | MVP | mvp |
117
+ | v0.2/ | Infrastructure | infrastructure |
118
+ | (active) | Demo Release | demo-release |
119
+ ```
120
+
121
+ Options: "Looks good" / "Edit slugs" / "Skip"
122
+
123
+ 4. **Rename directories:**
124
+ - Standard: `git mv .planning/milestones/v0.1 .planning/milestones/mvp`
125
+ - Nested: `git mv .planning/milestones/v2.0.0/quests .planning/milestones/quests-feature` for each sub-dir, then `rmdir .planning/milestones/v2.0.0` to remove empty parent
126
+
127
+ 5. **Update archived milestone files** (inside each renamed dir):
128
+ - `PHASE-SUMMARIES.md`: `# Phase Summaries: v0.1` → `# Phase Summaries: MVP`
129
+ - `ROADMAP.md`: `# Milestone v0.1: Name` → `# Milestone: Name`
130
+ - `REQUIREMENTS.md`: `# Requirements Archive: v0.1 Name` → `# Requirements Archive: Name`
131
+ - `MILESTONE-AUDIT.md`: YAML `milestone: v0.1` → `milestone: mvp` (use slug)
132
+ - `CONTEXT.md`: `# Milestone Context: v0.1 Name` → `# Milestone Context: Name`
133
+
134
+ 6. **Update MILESTONES.md:**
135
+ - Strip version prefix from headers: `## v0.1 MVP (Shipped:...)` → `## MVP (Shipped:...)`
136
+ - Preserve all other content (git ranges, stats, accomplishments)
137
+
138
+ 7. **Update active .planning files:**
139
+ - `PROJECT.md`: Replace `— v0.1` with `— MVP` in validated requirements, strip version from `## Current Milestone:` header, update `Shipped v0.2 with...` → `Shipped Infrastructure with...`
140
+ - `STATE.md`: Replace version refs with names (`v0.3 Demo Release` → `Demo Release`)
141
+ - `ROADMAP.md`: Strip version from `**Milestone:** v0.3 Demo Release` → `**Milestone:** Demo Release`
142
+ - `MILESTONE-CONTEXT.md`: Strip version from header
143
+ - `REQUIREMENTS.md`: Strip version from `**Milestone:**` line. For deferred sections (`### v0.4 — On-Device Hardening`), use AskUserQuestion to confirm replacement names or keep description-only format (`### On-Device Hardening (deferred)`)
144
+
145
+ 8. **Rules:**
146
+ - Do NOT modify git range references (`**Git range:** feat(01-01) → ...`)
147
+ - Do NOT modify git commit messages quoted in MILESTONES.md
148
+ - Preserve shipped dates, stats, phase ranges
149
+ - Use Edit tool for targeted replacements (not bulk find-replace)
150
+
151
+ 9. **Commit:**
152
+
153
+ ```bash
154
+ git add .planning/
155
+ ```
156
+
157
+ ```bash
158
+ git commit -m "$(cat <<'EOF'
159
+ chore(doctor): migrate milestone naming from versions to slugs
160
+
161
+ Renamed milestone directories from version-based (v0.1/, v2.0.0/) to
162
+ name-based slugs (mvp/, quests-feature/). Updated all planning file references.
163
+ EOF
164
+ )"
165
+ ```
166
+ </step>
167
+
168
+ <step name="fix_phase_archival">
169
+ **Only if Phase Archival failed.**
170
+
171
+ Parse MILESTONES.md for completed milestones and their phase ranges (`**Phases completed:** X-Y`).
172
+
173
+ For each completed milestone with orphaned phases in `.planning/phases/`:
174
+
175
+ 1. Determine the version and phase range from MILESTONES.md.
176
+ 2. Ensure the milestone directory exists: `mkdir -p .planning/milestones/{slug}`
177
+ 3. Run the archive script:
178
+
179
+ ```bash
180
+ ms-tools archive-milestone-phases <start> <end> <slug>
181
+ ```
182
+
183
+ This simultaneously:
184
+ - Consolidates PHASE-SUMMARIES.md (fixes Phase Summaries check)
185
+ - Deletes raw artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION)
186
+ - Moves phase directories to milestone archive
187
+
188
+ **If MILESTONES.md doesn't have parseable phase ranges:** Use AskUserQuestion to ask the user for the phase range for each milestone.
189
+
190
+ After archive completes, clean up leftover PLAN files in archived phases (fixes PLAN Cleanup check):
191
+
192
+ ```bash
193
+ find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
194
+ ```
195
+
196
+ Commit:
197
+
198
+ ```bash
199
+ git add .planning/phases/ .planning/milestones/
200
+ ```
201
+
202
+ ```bash
203
+ git commit -m "$(cat <<'EOF'
204
+ chore(doctor): archive completed milestone phases
205
+
206
+ Consolidated summaries, deleted raw artifacts, moved phase directories.
207
+ EOF
208
+ )"
209
+ ```
210
+ </step>
211
+
212
+ <step name="fix_plan_cleanup">
213
+ **Only if PLAN Cleanup failed AND fix_phase_archival did not already handle it.**
214
+
215
+ Delete leftover PLAN files in completed phase directories:
216
+
217
+ ```bash
218
+ find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
219
+ ```
220
+
221
+ For any leftover PLANs in `phases/` belonging to completed milestones (identified by the scan), delete those too.
222
+
223
+ Commit:
224
+
225
+ ```bash
226
+ git add .planning/
227
+ ```
228
+
229
+ ```bash
230
+ git commit -m "$(cat <<'EOF'
231
+ chore(doctor): clean up leftover PLAN files
232
+
233
+ Removed PLAN files from completed phase directories.
234
+ EOF
235
+ )"
236
+ ```
237
+ </step>
238
+
239
+ <step name="fix_knowledge">
240
+ **Only if Knowledge Files failed.**
241
+
242
+ Spawn a `general-purpose` subagent (Task tool) to generate knowledge files retroactively. Provide the subagent with:
243
+
244
+ - Subsystem vocabulary from config.json
245
+ - Instructions to read all PHASE-SUMMARIES.md from `milestones/*/PHASE-SUMMARIES.md` AND any remaining SUMMARY files in `phases/`
246
+ - The knowledge template at `~/.claude/mindsystem/templates/knowledge.md`
247
+ - Instructions to read any existing knowledge files and merge (rewrite semantics — current state, not append)
248
+ - Instructions to create `.planning/knowledge/` directory if missing
249
+ - Instructions to write `.planning/knowledge/{subsystem}.md` for each missing subsystem
250
+
251
+ After subagent completes, verify files exist:
252
+
253
+ ```bash
254
+ ls .planning/knowledge/*.md
255
+ ```
256
+
257
+ Commit:
258
+
259
+ ```bash
260
+ git add .planning/knowledge/
261
+ ```
262
+
263
+ ```bash
264
+ git commit -m "$(cat <<'EOF'
265
+ chore(doctor): generate knowledge files
266
+
267
+ Created per-subsystem knowledge files from phase summaries.
268
+ EOF
269
+ )"
270
+ ```
271
+ </step>
272
+
273
+ </process>
@@ -81,7 +81,7 @@ Skip completed plans. If all complete, report "Phase already executed" and exit.
81
81
  Run validation before launching executors:
82
82
 
83
83
  ```bash
84
- ~/.claude/mindsystem/scripts/validate-execution-order.sh "$PHASE_DIR"
84
+ ms-tools validate-execution-order "$PHASE_DIR"
85
85
  ```
86
86
 
87
87
  If validation fails (exit 1), stop execution and report the mismatch to user.
@@ -201,7 +201,7 @@ Execute each wave in sequence. Autonomous plans within a wave run in parallel.
201
201
 
202
202
  After reporting wave completion, update STATE.md with progress:
203
203
  ```bash
204
- ~/.claude/mindsystem/scripts/update-state.sh {completed_count} {total_count}
204
+ ms-tools update-state {completed_count} {total_count}
205
205
  ```
206
206
 
207
207
  5. **Handle failures:**
@@ -412,7 +412,7 @@ Generate a patch file with all implementation changes from this phase.
412
412
 
413
413
  **Run the patch generation script:**
414
414
  ```bash
415
- ~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER}
415
+ ms-tools generate-phase-patch ${PHASE_NUMBER}
416
416
  ```
417
417
 
418
418
  The script will:
@@ -527,6 +527,10 @@ git commit -m "docs: update codebase map after phase {X}"
527
527
  <step name="offer_next">
528
528
  Present next steps based on milestone status.
529
529
 
530
+ **First, surface user actions:**
531
+
532
+ Read `## User Actions Required` from all `*-SUMMARY.md` files in the phase directory. If any non-empty actions exist, present as `## ⚠ Action Required` block before route-specific content. Skip if all "None".
533
+
530
534
  **If more phases remain:**
531
535
 
532
536
  Read `~/.claude/mindsystem/references/routing/next-phase-routing.md` and follow its instructions to present "Next Up" with pre-work context for the next phase.
@@ -298,6 +298,9 @@ completed: YYYY-MM-DD
298
298
  ## Issues Encountered
299
299
  [Problems during planned work, or "None"]
300
300
 
301
+ ## User Actions Required
302
+ [Commands the user must run: migrations, package installs, env vars, server restarts. Or "None — no manual steps needed."]
303
+
301
304
  ## Next Step
302
305
  [Ready for next plan, or "Phase complete, ready for transition"]
303
306
  ```
@@ -100,8 +100,8 @@ After writing STACK.md, update config.json code_review fields with the appropria
100
100
  1. Read STACK.md to detect primary framework
101
101
  2. Map framework to code review agent names:
102
102
  - Flutter/Dart:
103
- - adhoc: "ms-flutter-simplifier"
104
- - phase: "ms-flutter-simplifier"
103
+ - adhoc: "ms-flutter-code-quality"
104
+ - phase: "ms-flutter-code-quality"
105
105
  - milestone: "ms-flutter-reviewer"
106
106
  - All others (React, Next.js, Node, Swift, Kotlin, etc.):
107
107
  - adhoc: "ms-code-simplifier"
@@ -106,7 +106,7 @@ Task(prompt=assembled_context, subagent_type="ms-mockup-designer", description="
106
106
  After all 3 agents return, run the comparison script to create the comparison page. Do NOT generate comparison HTML manually — use the script:
107
107
 
108
108
  ```bash
109
- uv run ~/.claude/mindsystem/scripts/compare_mockups.py "${PHASE_DIR}/mockups"
109
+ ms-compare-mockups "${PHASE_DIR}/mockups"
110
110
  open "${PHASE_DIR}/mockups/comparison.html"
111
111
  ```
112
112
 
@@ -277,7 +277,7 @@ PHASE_NAME=$(grep -A2 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null | head
277
277
  **2. Run context scanner:**
278
278
 
279
279
  ```bash
280
- uv run ~/.claude/mindsystem/scripts/scan-planning-context.py \
280
+ ms-tools scan-planning-context \
281
281
  --phase "${PHASE}" \
282
282
  --phase-name "${PHASE_NAME}" \
283
283
  ${SUBSYSTEM:+--subsystem="${SUBSYSTEM}"}
@@ -400,12 +400,12 @@ Exit skill and invoke SlashCommand("/ms:plan-phase [X+1]")
400
400
  ```
401
401
  Phase {X} marked complete.
402
402
 
403
- 🎉 Milestone {version} is 100% complete — all {N} phases finished!
403
+ 🎉 Milestone is 100% complete — all {N} phases finished!
404
404
 
405
405
  ⚡ Auto-continuing: Complete milestone and archive
406
406
  ```
407
407
 
408
- Exit skill and invoke SlashCommand("/ms:complete-milestone {version}")
408
+ Exit skill and invoke SlashCommand("/ms:complete-milestone")
409
409
 
410
410
  </step>
411
411
 
@@ -580,7 +580,7 @@ Use `mocked_files` list from UAT.md frontmatter. Clear the list after reverting.
580
580
 
581
581
  **2. Generate UAT fixes patch (if fixes were made):**
582
582
  ```bash
583
- ~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER} --suffix=uat-fixes
583
+ ms-tools generate-phase-patch ${PHASE_NUMBER} --suffix=uat-fixes
584
584
  ```
585
585
  Output: `.planning/phases/{phase_dir}/{phase}-uat-fixes.patch`
586
586
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindsystem-cc",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.",
5
5
  "bin": {
6
6
  "mindsystem-cc": "bin/install.js"
@@ -0,0 +1,16 @@
1
+ # Roadmap
2
+
3
+ ## Phase 02: Infrastructure
4
+ Database setup and core infrastructure.
5
+
6
+ ## Phase 03: Core Models
7
+ Data models and schemas.
8
+
9
+ ## Phase 04: Setup
10
+ Project configuration and tooling.
11
+
12
+ ## Phase 05: Authentication
13
+ User auth with JWT tokens.
14
+
15
+ ## Phase 06: UI
16
+ Frontend components and screens.
@@ -0,0 +1,12 @@
1
+ ---
2
+ subsystem: auth
3
+ learnings:
4
+ - Token expiry must account for clock skew
5
+ - Always validate token signature before checking claims
6
+ related_phase: "05-auth"
7
+ tags: [jwt, tokens]
8
+ ---
9
+
10
+ # Fix Token Validation
11
+
12
+ Fixed edge case where expired tokens passed validation due to clock skew.
@@ -0,0 +1,3 @@
1
+ {
2
+ "subsystems": ["auth", "database", "api"]
3
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ subsystem: auth
3
+ root_cause: Clock skew between servers caused token validation to fail intermittently
4
+ resolution: Added 30-second leeway to token expiry check
5
+ tags: [jwt, timing]
6
+ phase: "05-auth"
7
+ ---
8
+
9
+ # Token Validation Bug
10
+
11
+ Intermittent auth failures due to clock skew between API servers.
@@ -0,0 +1,11 @@
1
+ # Auth Subsystem Knowledge
2
+
3
+ ## Authentication Flow
4
+ 1. User submits credentials to POST /api/auth/login
5
+ 2. Server validates with bcrypt
6
+ 3. JWT issued as httpOnly cookie
7
+ 4. Middleware validates on subsequent requests
8
+
9
+ ## Key Patterns
10
+ - Token rotation on refresh
11
+ - Clock skew leeway of 30 seconds
@@ -0,0 +1,20 @@
1
+ ---
2
+ phase: "02-infra"
3
+ subsystem: database
4
+ affects: []
5
+ requires: []
6
+ tags: [postgres, migrations]
7
+ tech-stack:
8
+ added: [postgres]
9
+ patterns: []
10
+ patterns-established: []
11
+ key-files:
12
+ created: [db/schema.sql]
13
+ modified: []
14
+ key-decisions:
15
+ - Use PostgreSQL for primary store
16
+ ---
17
+
18
+ # Phase 02 Plan 1 Summary
19
+
20
+ Set up database infrastructure with migrations.
@@ -0,0 +1,21 @@
1
+ ---
2
+ phase: "04-setup"
3
+ subsystem: api
4
+ affects: []
5
+ requires: []
6
+ tags: [jwt, config]
7
+ tech-stack:
8
+ added: [dotenv]
9
+ patterns: [env-config]
10
+ patterns-established:
11
+ - Config loading pattern
12
+ key-files:
13
+ created: [src/config.ts]
14
+ modified: [package.json]
15
+ key-decisions:
16
+ - Use dotenv for configuration
17
+ ---
18
+
19
+ # Phase 04 Plan 1 Summary
20
+
21
+ Project setup and configuration with JWT support.
@@ -0,0 +1,28 @@
1
+ ---
2
+ phase: "05-auth"
3
+ subsystem: auth
4
+ affects: ["06-ui"]
5
+ requires: ["04-setup"]
6
+ tags: [jwt, auth, tokens]
7
+ tech-stack:
8
+ added: [jose, bcrypt]
9
+ patterns: [jwt-auth]
10
+ patterns-established:
11
+ - JWT token rotation
12
+ - Password hashing with bcrypt
13
+ key-files:
14
+ created: [src/auth/login.ts, src/auth/middleware.ts]
15
+ modified: [src/config.ts]
16
+ key-decisions:
17
+ - JWT with httpOnly cookies
18
+ - bcrypt for password hashing
19
+ ---
20
+
21
+ # Phase 05 Plan 1 Summary
22
+
23
+ Authentication system with JWT and bcrypt.
24
+
25
+ ## Next Phase Readiness
26
+
27
+ - UI phase needs auth context provider
28
+ - Token refresh endpoint not yet implemented
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Set up database migrations
3
+ subsystem: database
4
+ priority: high
5
+ phase_origin: "02-infra"
6
+ ---
7
+
8
+ # Set Up Database Migrations
9
+
10
+ Configure migration tooling for PostgreSQL.
@@ -0,0 +1,10 @@
1
+ ---
2
+ title: Add logout endpoint
3
+ subsystem: auth
4
+ priority: medium
5
+ phase_origin: "05-auth"
6
+ ---
7
+
8
+ # Add Logout Endpoint
9
+
10
+ Implement POST /api/auth/logout to invalidate tokens.