@bradygaster/squad-cli 0.9.0 → 0.9.2-insider.5

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 (213) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +10 -10
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/config.d.ts +12 -0
  6. package/dist/cli/commands/config.d.ts.map +1 -0
  7. package/dist/cli/commands/config.js +157 -0
  8. package/dist/cli/commands/config.js.map +1 -0
  9. package/dist/cli/commands/consult.d.ts.map +1 -1
  10. package/dist/cli/commands/consult.js +9 -4
  11. package/dist/cli/commands/consult.js.map +1 -1
  12. package/dist/cli/commands/copilot.d.ts.map +1 -1
  13. package/dist/cli/commands/copilot.js +8 -7
  14. package/dist/cli/commands/copilot.js.map +1 -1
  15. package/dist/cli/commands/doctor.d.ts.map +1 -1
  16. package/dist/cli/commands/doctor.js +50 -17
  17. package/dist/cli/commands/doctor.js.map +1 -1
  18. package/dist/cli/commands/economy.d.ts.map +1 -1
  19. package/dist/cli/commands/economy.js +3 -2
  20. package/dist/cli/commands/economy.js.map +1 -1
  21. package/dist/cli/commands/export.d.ts.map +1 -1
  22. package/dist/cli/commands/export.js +22 -16
  23. package/dist/cli/commands/export.js.map +1 -1
  24. package/dist/cli/commands/extract.d.ts.map +1 -1
  25. package/dist/cli/commands/extract.js +14 -10
  26. package/dist/cli/commands/extract.js.map +1 -1
  27. package/dist/cli/commands/import.d.ts.map +1 -1
  28. package/dist/cli/commands/import.js +21 -18
  29. package/dist/cli/commands/import.js.map +1 -1
  30. package/dist/cli/commands/init-remote.d.ts.map +1 -1
  31. package/dist/cli/commands/init-remote.js +7 -6
  32. package/dist/cli/commands/init-remote.js.map +1 -1
  33. package/dist/cli/commands/link.d.ts.map +1 -1
  34. package/dist/cli/commands/link.js +11 -10
  35. package/dist/cli/commands/link.js.map +1 -1
  36. package/dist/cli/commands/migrate.d.ts.map +1 -1
  37. package/dist/cli/commands/migrate.js +19 -18
  38. package/dist/cli/commands/migrate.js.map +1 -1
  39. package/dist/cli/commands/personal.d.ts.map +1 -1
  40. package/dist/cli/commands/personal.js +12 -20
  41. package/dist/cli/commands/personal.js.map +1 -1
  42. package/dist/cli/commands/plugin.d.ts.map +1 -1
  43. package/dist/cli/commands/plugin.js +8 -7
  44. package/dist/cli/commands/plugin.js.map +1 -1
  45. package/dist/cli/commands/rc.d.ts.map +1 -1
  46. package/dist/cli/commands/rc.js +19 -12
  47. package/dist/cli/commands/rc.js.map +1 -1
  48. package/dist/cli/commands/schedule.d.ts.map +1 -1
  49. package/dist/cli/commands/schedule.js +6 -5
  50. package/dist/cli/commands/schedule.js.map +1 -1
  51. package/dist/cli/commands/start.d.ts.map +1 -1
  52. package/dist/cli/commands/start.js +18 -11
  53. package/dist/cli/commands/start.js.map +1 -1
  54. package/dist/cli/commands/streams.d.ts.map +1 -1
  55. package/dist/cli/commands/streams.js +3 -2
  56. package/dist/cli/commands/streams.js.map +1 -1
  57. package/dist/cli/commands/upstream.d.ts.map +1 -1
  58. package/dist/cli/commands/upstream.js +23 -19
  59. package/dist/cli/commands/upstream.js.map +1 -1
  60. package/dist/cli/commands/watch/capabilities/board.d.ts +22 -0
  61. package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -0
  62. package/dist/cli/commands/watch/capabilities/board.js +121 -0
  63. package/dist/cli/commands/watch/capabilities/board.js.map +1 -0
  64. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts +14 -0
  65. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts.map +1 -0
  66. package/dist/cli/commands/watch/capabilities/decision-hygiene.js +72 -0
  67. package/dist/cli/commands/watch/capabilities/decision-hygiene.js.map +1 -0
  68. package/dist/cli/commands/watch/capabilities/execute.d.ts +33 -0
  69. package/dist/cli/commands/watch/capabilities/execute.d.ts.map +1 -0
  70. package/dist/cli/commands/watch/capabilities/execute.js +119 -0
  71. package/dist/cli/commands/watch/capabilities/execute.js.map +1 -0
  72. package/dist/cli/commands/watch/capabilities/index.d.ts +7 -0
  73. package/dist/cli/commands/watch/capabilities/index.d.ts.map +1 -0
  74. package/dist/cli/commands/watch/capabilities/index.js +28 -0
  75. package/dist/cli/commands/watch/capabilities/index.js.map +1 -0
  76. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts +14 -0
  77. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts.map +1 -0
  78. package/dist/cli/commands/watch/capabilities/monitor-email.js +54 -0
  79. package/dist/cli/commands/watch/capabilities/monitor-email.js.map +1 -0
  80. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts +14 -0
  81. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts.map +1 -0
  82. package/dist/cli/commands/watch/capabilities/monitor-teams.js +55 -0
  83. package/dist/cli/commands/watch/capabilities/monitor-teams.js.map +1 -0
  84. package/dist/cli/commands/watch/capabilities/retro.d.ts +14 -0
  85. package/dist/cli/commands/watch/capabilities/retro.d.ts.map +1 -0
  86. package/dist/cli/commands/watch/capabilities/retro.js +81 -0
  87. package/dist/cli/commands/watch/capabilities/retro.js.map +1 -0
  88. package/dist/cli/commands/watch/capabilities/self-pull.d.ts +14 -0
  89. package/dist/cli/commands/watch/capabilities/self-pull.d.ts.map +1 -0
  90. package/dist/cli/commands/watch/capabilities/self-pull.js +33 -0
  91. package/dist/cli/commands/watch/capabilities/self-pull.js.map +1 -0
  92. package/dist/cli/commands/watch/capabilities/two-pass.d.ts +14 -0
  93. package/dist/cli/commands/watch/capabilities/two-pass.d.ts.map +1 -0
  94. package/dist/cli/commands/watch/capabilities/two-pass.js +66 -0
  95. package/dist/cli/commands/watch/capabilities/two-pass.js.map +1 -0
  96. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts +14 -0
  97. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts.map +1 -0
  98. package/dist/cli/commands/watch/capabilities/wave-dispatch.js +117 -0
  99. package/dist/cli/commands/watch/capabilities/wave-dispatch.js.map +1 -0
  100. package/dist/cli/commands/watch/config.d.ts +25 -0
  101. package/dist/cli/commands/watch/config.d.ts.map +1 -0
  102. package/dist/cli/commands/watch/config.js +82 -0
  103. package/dist/cli/commands/watch/config.js.map +1 -0
  104. package/dist/cli/commands/watch/index.d.ts +95 -0
  105. package/dist/cli/commands/watch/index.d.ts.map +1 -0
  106. package/dist/cli/commands/watch/index.js +704 -0
  107. package/dist/cli/commands/watch/index.js.map +1 -0
  108. package/dist/cli/commands/watch/registry.d.ts +19 -0
  109. package/dist/cli/commands/watch/registry.d.ts.map +1 -0
  110. package/dist/cli/commands/watch/registry.js +28 -0
  111. package/dist/cli/commands/watch/registry.js.map +1 -0
  112. package/dist/cli/commands/watch/types.d.ts +57 -0
  113. package/dist/cli/commands/watch/types.d.ts.map +1 -0
  114. package/dist/cli/commands/watch/types.js +8 -0
  115. package/dist/cli/commands/watch/types.js.map +1 -0
  116. package/dist/cli/core/cast.d.ts.map +1 -1
  117. package/dist/cli/core/cast.js +15 -19
  118. package/dist/cli/core/cast.js.map +1 -1
  119. package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
  120. package/dist/cli/core/detect-squad-dir.js +12 -10
  121. package/dist/cli/core/detect-squad-dir.js.map +1 -1
  122. package/dist/cli/core/email-scrub.d.ts.map +1 -1
  123. package/dist/cli/core/email-scrub.js +12 -11
  124. package/dist/cli/core/email-scrub.js.map +1 -1
  125. package/dist/cli/core/gh-cli.d.ts +13 -0
  126. package/dist/cli/core/gh-cli.d.ts.map +1 -1
  127. package/dist/cli/core/gh-cli.js +24 -0
  128. package/dist/cli/core/gh-cli.js.map +1 -1
  129. package/dist/cli/core/init.d.ts +2 -0
  130. package/dist/cli/core/init.d.ts.map +1 -1
  131. package/dist/cli/core/init.js +22 -5
  132. package/dist/cli/core/init.js.map +1 -1
  133. package/dist/cli/core/migrate-directory.d.ts.map +1 -1
  134. package/dist/cli/core/migrate-directory.js +14 -13
  135. package/dist/cli/core/migrate-directory.js.map +1 -1
  136. package/dist/cli/core/migrations.d.ts.map +1 -1
  137. package/dist/cli/core/migrations.js +22 -8
  138. package/dist/cli/core/migrations.js.map +1 -1
  139. package/dist/cli/core/nap.d.ts.map +1 -1
  140. package/dist/cli/core/nap.js +111 -49
  141. package/dist/cli/core/nap.js.map +1 -1
  142. package/dist/cli/core/project-type.d.ts.map +1 -1
  143. package/dist/cli/core/project-type.js +11 -10
  144. package/dist/cli/core/project-type.js.map +1 -1
  145. package/dist/cli/core/team-md.d.ts.map +1 -1
  146. package/dist/cli/core/team-md.js +9 -4
  147. package/dist/cli/core/team-md.js.map +1 -1
  148. package/dist/cli/core/templates.d.ts.map +1 -1
  149. package/dist/cli/core/templates.js +4 -3
  150. package/dist/cli/core/templates.js.map +1 -1
  151. package/dist/cli/core/upgrade.d.ts.map +1 -1
  152. package/dist/cli/core/upgrade.js +68 -55
  153. package/dist/cli/core/upgrade.js.map +1 -1
  154. package/dist/cli/core/version.d.ts.map +1 -1
  155. package/dist/cli/core/version.js +8 -7
  156. package/dist/cli/core/version.js.map +1 -1
  157. package/dist/cli/index.d.ts +1 -1
  158. package/dist/cli/index.d.ts.map +1 -1
  159. package/dist/cli/index.js +1 -1
  160. package/dist/cli/index.js.map +1 -1
  161. package/dist/cli/self-update.d.ts.map +1 -1
  162. package/dist/cli/self-update.js +7 -4
  163. package/dist/cli/self-update.js.map +1 -1
  164. package/dist/cli/shell/agent-name-parser.d.ts +16 -0
  165. package/dist/cli/shell/agent-name-parser.d.ts.map +1 -0
  166. package/dist/cli/shell/agent-name-parser.js +54 -0
  167. package/dist/cli/shell/agent-name-parser.js.map +1 -0
  168. package/dist/cli/shell/commands.d.ts.map +1 -1
  169. package/dist/cli/shell/commands.js +4 -3
  170. package/dist/cli/shell/commands.js.map +1 -1
  171. package/dist/cli/shell/coordinator.d.ts +4 -1
  172. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  173. package/dist/cli/shell/coordinator.js +29 -26
  174. package/dist/cli/shell/coordinator.js.map +1 -1
  175. package/dist/cli/shell/index.d.ts.map +1 -1
  176. package/dist/cli/shell/index.js +33 -35
  177. package/dist/cli/shell/index.js.map +1 -1
  178. package/dist/cli/shell/lifecycle.d.ts +13 -2
  179. package/dist/cli/shell/lifecycle.d.ts.map +1 -1
  180. package/dist/cli/shell/lifecycle.js +26 -13
  181. package/dist/cli/shell/lifecycle.js.map +1 -1
  182. package/dist/cli/shell/session-store.d.ts.map +1 -1
  183. package/dist/cli/shell/session-store.js +16 -12
  184. package/dist/cli/shell/session-store.js.map +1 -1
  185. package/dist/cli/shell/spawn.d.ts +4 -1
  186. package/dist/cli/shell/spawn.d.ts.map +1 -1
  187. package/dist/cli/shell/spawn.js +28 -10
  188. package/dist/cli/shell/spawn.js.map +1 -1
  189. package/dist/cli-entry.js +83 -12
  190. package/dist/cli-entry.js.map +1 -1
  191. package/package.json +8 -4
  192. package/templates/scribe-charter.md +4 -0
  193. package/templates/skills/cross-machine-coordination/SKILL.md +434 -0
  194. package/templates/skills/error-recovery/SKILL.md +99 -0
  195. package/templates/skills/iterative-retrieval/SKILL.md +165 -0
  196. package/templates/skills/notification-routing/SKILL.md +105 -0
  197. package/templates/skills/pr-screenshots/SKILL.md +149 -0
  198. package/templates/skills/ralph-two-pass-scan/SKILL.md +35 -0
  199. package/templates/skills/reflect/SKILL.md +229 -0
  200. package/templates/skills/release-process/SKILL.md +84 -376
  201. package/templates/skills/retro-enforcement/SKILL.md +148 -0
  202. package/templates/skills/tiered-memory/SKILL.md +234 -0
  203. package/templates/skills/windows-compatibility/SKILL.md +24 -0
  204. package/templates/{squad.agent.md → squad.agent.md.template} +1316 -1287
  205. package/templates/workflows/squad-ci.yml +1 -1
  206. package/templates/workflows/squad-heartbeat.yml +0 -4
  207. package/templates/workflows/squad-insider-release.yml +1 -1
  208. package/templates/workflows/squad-preview.yml +1 -1
  209. package/templates/workflows/squad-release.yml +1 -1
  210. package/dist/cli/commands/watch.d.ts +0 -18
  211. package/dist/cli/commands/watch.d.ts.map +0 -1
  212. package/dist/cli/commands/watch.js +0 -306
  213. package/dist/cli/commands/watch.js.map +0 -1
@@ -0,0 +1,234 @@
1
+ ---
2
+ name: tiered-memory
3
+ description: Three-tier agent memory model (hot/cold/wiki) for 20-55% context reduction per spawn
4
+ domain: memory-management, performance
5
+ confidence: high
6
+ source: earned (production measurements in tamirdresher/tamresearch1, 34-74KB baseline payloads)
7
+ ---
8
+
9
+ # Skill: Tiered Agent Memory
10
+
11
+ ## Overview
12
+
13
+ Squad agents currently load their full context history on every spawn, resulting in 34–74KB payloads per agent (8,800–18,500 tokens). Measurement shows 82–96% of that context is "old noise" — information that is no longer relevant to the current task. The Tiered Agent Memory skill introduces a three-tier memory model that eliminates this bloat, achieving 20–55% context reduction per spawn in production.
14
+
15
+ ---
16
+
17
+ ## Memory Tiers
18
+
19
+ ### 🔥 Hot Tier — Current Session Context
20
+ - **Size target:** ~2–4KB
21
+ - **Load policy:** Always loaded. Every spawn includes hot memory by default.
22
+ - **Contents:** Current task description, active decisions made this session, immediate blockers, last 3–5 actions taken, who you are talking to right now.
23
+ - **Lifetime:** Current session only. Discarded after session ends (Scribe promotes relevant parts to Cold).
24
+ - **Purpose:** Provide immediate task context without any latency or load decision.
25
+
26
+ ### ❄️ Cold Tier — Summarized Cross-Session History
27
+ - **Size target:** ~8–12KB
28
+ - **Load policy:** Load on demand. Include only when the task explicitly needs history.
29
+ - **Contents:** Summarized past sessions (compressed by Scribe), cross-session decisions, recurring patterns, unresolved issues from prior work.
30
+ - **Lifetime:** 30 days rolling window. After 30 days, Scribe promotes to Wiki tier.
31
+ - **Purpose:** Answer "what have we tried before?" and "what was decided?" without replaying full transcripts.
32
+ - **How to include:** Pass `--include-cold` in spawn template or add `## Cold Memory` section.
33
+
34
+ ### 📚 Wiki Tier — Durable Structured Knowledge
35
+ - **Size target:** variable, structured reference docs
36
+ - **Load policy:** Async write, selective read. Load only when task requires domain knowledge.
37
+ - **Contents:** Architecture decisions (ADRs), agent charters, routing rules, stable conventions, external API contracts, known platform constraints.
38
+ - **Lifetime:** Permanent until explicitly deprecated.
39
+ - **Purpose:** Authoritative reference. Not history — structured facts.
40
+ - **How to include:** Pass `--include-wiki` or reference specific wiki doc paths in spawn template.
41
+
42
+ ---
43
+
44
+ ## When to Load Each Tier
45
+
46
+ | Situation | Hot | Cold | Wiki |
47
+ |-----------|-----|------|------|
48
+ | New task, no prior context needed | ✅ | ❌ | ❌ |
49
+ | Resuming interrupted work | ✅ | ✅ | ❌ |
50
+ | Debugging a recurring issue | ✅ | ✅ | ❌ |
51
+ | Implementing against a spec/ADR | ✅ | ❌ | ✅ |
52
+ | Onboarding to unfamiliar subsystem | ✅ | ❌ | ✅ |
53
+ | Post-incident review | ✅ | ✅ | ✅ |
54
+
55
+ ---
56
+
57
+ ## Spawn Template Pattern
58
+
59
+ The default spawn prompt should include **Hot tier only**:
60
+
61
+ ```
62
+ ## Memory Context
63
+
64
+ ### Hot (current session)
65
+ {hot_context}
66
+ ```
67
+
68
+ Add `--include-cold` when the task needs history:
69
+ ```
70
+ ## Memory Context
71
+
72
+ ### Hot (current session)
73
+ {hot_context}
74
+
75
+ ### Cold (summarized history — load on demand)
76
+ See: .squad/memory/cold/{agent-name}.md
77
+ ```
78
+
79
+ Add `--include-wiki` when the task needs domain knowledge:
80
+ ```
81
+ ## Memory Context
82
+
83
+ ### Hot (current session)
84
+ {hot_context}
85
+
86
+ ### Wiki (durable reference)
87
+ See: .squad/memory/wiki/{topic}.md
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Measurement Data
93
+
94
+ Baseline measurements from tamirdresher/tamresearch1 production runs (June 2025):
95
+
96
+ | Agent | Total Context | Old Noise % | Hot-Only Size | Savings |
97
+ |-------|--------------|-------------|---------------|---------|
98
+ | Picard (Lead) | 74KB / 18.5K tokens | 96% | ~3KB | 55% |
99
+ | Scribe | 52KB / 13K tokens | 91% | ~4KB | 48% |
100
+ | Data | 43KB / 10.7K tokens | 88% | ~3.5KB | 42% |
101
+ | Ralph | 38KB / 9.5K tokens | 85% | ~3KB | 38% |
102
+ | Worf | 34KB / 8.5K tokens | 82% | ~3KB | 20% |
103
+
104
+ **Average savings: 20–55% per spawn** with Hot-only loading. Cold + Wiki on-demand adds ~2–8KB when needed, still well below current baselines.
105
+
106
+ ---
107
+
108
+ ## Integration with Scribe Agent
109
+
110
+ Scribe is the memory coordinator for this system. It automates tier promotion:
111
+
112
+ 1. **End of session:** Scribe compresses Hot → Cold summary (keeps ~10% of session verbosity)
113
+ 2. **After 30 days:** Scribe promotes Cold → Wiki for decisions/facts that aged into stable knowledge
114
+ 3. **On-demand wiki writes:** Any agent can request Scribe to write a wiki entry mid-session using `scribe:wiki-write`
115
+
116
+ See Scribe charter: `.squad/agents/scribe/charter.md`
117
+
118
+ ---
119
+
120
+ ## Implementation Checklist
121
+
122
+ - [ ] Scribe writes Hot context file at session start (`.squad/memory/hot/{agent}.md`)
123
+ - [ ] Scribe compresses and writes Cold summary at session end
124
+ - [ ] Spawn templates default to Hot-only
125
+ - [ ] Coordinators add `--include-cold` / `--include-wiki` flags as needed
126
+ - [ ] Wiki entries stored in `.squad/memory/wiki/`
127
+ - [ ] Cold entries stored in `.squad/memory/cold/` with 30-day TTL
128
+
129
+ ---
130
+
131
+ ## References
132
+
133
+ - Upstream issue: bradygaster/squad#600
134
+ - Production data: tamirdresher/tamresearch1 (June 2025)
135
+
136
+ ---
137
+
138
+ ## Spawn Template
139
+
140
+ # Spawn Template: Agent with Tiered Memory
141
+
142
+ Use this template when spawning any Squad agent. By default it loads **Hot tier only**. Add optional sections as needed.
143
+
144
+ ---
145
+
146
+ ## Task
147
+
148
+ {task_description}
149
+
150
+ ## WHY
151
+
152
+ {why_this_matters}
153
+
154
+ ## Success Criteria
155
+
156
+ - [ ] {criterion_1}
157
+ - [ ] {criterion_2}
158
+
159
+ ---
160
+
161
+ ## Memory Context
162
+
163
+ ### 🔥 Hot (always included)
164
+
165
+ > Paste current session context here (2–4KB max):
166
+
167
+ ```
168
+ Current task: {task_description}
169
+ Active decisions: {decisions_this_session}
170
+ Last actions: {last_3_to_5_actions}
171
+ Blockers: {current_blockers_or_none}
172
+ Talking to: {current_interlocutor}
173
+ ```
174
+
175
+ ---
176
+
177
+ ### ❄️ Cold (include when task needs history — add `--include-cold`)
178
+
179
+ > Load on demand. Do not inline unless specifically needed.
180
+
181
+ Summarized cross-session history is at:
182
+ `.squad/memory/cold/{agent-name}.md`
183
+
184
+ Include when:
185
+ - Resuming interrupted work
186
+ - Debugging a recurring issue
187
+ - "What have we tried before?"
188
+
189
+ **To load cold memory, add this section and fetch the file before spawning:**
190
+
191
+ ```
192
+ ## Cold Memory Summary
193
+ {contents_of_.squad/memory/cold/{agent-name}.md}
194
+ ```
195
+
196
+ ---
197
+
198
+ ### 📚 Wiki (include when task needs domain knowledge — add `--include-wiki`)
199
+
200
+ > Load on demand. Reference specific wiki docs by path.
201
+
202
+ Wiki entries are at: `.squad/memory/wiki/`
203
+
204
+ Include when:
205
+ - Implementing against an ADR or spec
206
+ - Onboarding to unfamiliar subsystem
207
+ - Need stable conventions or API contracts
208
+
209
+ **To load wiki, add this section and reference the specific doc:**
210
+
211
+ ```
212
+ ## Wiki Reference
213
+ {contents_of_.squad/memory/wiki/{topic}.md}
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Escalation
219
+
220
+ If blocked or uncertain:
221
+ - Architecture questions → @picard
222
+ - Security concerns → @worf
223
+ - Infrastructure/deployment → @belanna
224
+ - Memory/history questions → @scribe
225
+
226
+ ---
227
+
228
+ ## Notes
229
+
230
+ - Hot tier is always included and should stay under 4KB
231
+ - Cold adds ~8–12KB; only include when history is relevant
232
+ - Wiki adds variable size; only include specific relevant docs
233
+ - See `skills/tiered-memory/SKILL.md` for full tier reference
234
+ - See `docs/tiered-memory-guide.md` for wiring instructions
@@ -30,6 +30,23 @@ Squad runs on Windows, macOS, and Linux. Several bugs have been traced to platfo
30
30
  - **Never assume CWD is repo root:** Always use `TEAM ROOT` from spawn prompt or run `git rev-parse --show-toplevel`
31
31
  - **Use path.join() or path.resolve():** Don't manually concatenate with `/` or `\`
32
32
 
33
+ ### Path Comparison (Case Sensitivity)
34
+ - **Never use case-sensitive `startsWith` or `===` for path comparison on Windows or macOS:** These filesystems are case-insensitive — `C:\Users\` and `c:\users\` refer to the same location
35
+ - **Use platform-aware comparison:** Check `process.platform === 'win32' || process.platform === 'darwin'` and lowercase both sides before comparing
36
+ - **Pattern:**
37
+ ```typescript
38
+ const CASE_INSENSITIVE = process.platform === 'win32' || process.platform === 'darwin';
39
+
40
+ function pathStartsWith(fullPath: string, prefix: string): boolean {
41
+ if (CASE_INSENSITIVE) {
42
+ return fullPath.toLowerCase().startsWith(prefix.toLowerCase());
43
+ }
44
+ return fullPath.startsWith(prefix);
45
+ }
46
+ ```
47
+ - **Where it matters:** Security checks (path traversal prevention), rootDir confinement, any path-contains-path validation
48
+ - **Linux is case-sensitive:** Do NOT lowercase on Linux — `/Home/` and `/home/` are different directories
49
+
33
50
  ## Examples
34
51
 
35
52
  ✓ **Correct:**
@@ -72,3 +89,10 @@ exec('git commit -m "First line\nSecond line"'); // FAILS silently in PowerShell
72
89
  - Assuming Unix-style paths work everywhere
73
90
  - Using `git -C` because it "looks cleaner" (it doesn't work)
74
91
  - Skipping `git diff --cached --quiet` check (creates empty commits)
92
+ - **Wrong — case-sensitive path check on Windows and macOS:**
93
+ ```typescript
94
+ if (!resolved.startsWith(rootDir + path.sep)) {
95
+ throw new Error('Path traversal blocked');
96
+ }
97
+ // Fails: 'c:\\Users\\temp\\file'.startsWith('C:\\Users\\temp\\') → false
98
+ ```