@bradygaster/squad-cli 0.9.6-insider.2 → 0.10.0-insider.1

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 (188) hide show
  1. package/CHANGELOG.md +555 -0
  2. package/README.md +5 -5
  3. package/dist/cli/commands/build.js +3 -3
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/copilot-bridge.d.ts.map +1 -1
  6. package/dist/cli/commands/copilot-bridge.js +5 -1
  7. package/dist/cli/commands/copilot-bridge.js.map +1 -1
  8. package/dist/cli/commands/cross-squad.d.ts +15 -2
  9. package/dist/cli/commands/cross-squad.d.ts.map +1 -1
  10. package/dist/cli/commands/cross-squad.js +78 -4
  11. package/dist/cli/commands/cross-squad.js.map +1 -1
  12. package/dist/cli/commands/doctor.d.ts +6 -0
  13. package/dist/cli/commands/doctor.d.ts.map +1 -1
  14. package/dist/cli/commands/doctor.js +120 -5
  15. package/dist/cli/commands/doctor.js.map +1 -1
  16. package/dist/cli/commands/export.d.ts +7 -3
  17. package/dist/cli/commands/export.d.ts.map +1 -1
  18. package/dist/cli/commands/export.js +68 -16
  19. package/dist/cli/commands/export.js.map +1 -1
  20. package/dist/cli/commands/import.d.ts +7 -3
  21. package/dist/cli/commands/import.d.ts.map +1 -1
  22. package/dist/cli/commands/import.js +140 -42
  23. package/dist/cli/commands/import.js.map +1 -1
  24. package/dist/cli/commands/install-hooks.d.ts.map +1 -1
  25. package/dist/cli/commands/install-hooks.js +50 -5
  26. package/dist/cli/commands/install-hooks.js.map +1 -1
  27. package/dist/cli/commands/link.d.ts.map +1 -1
  28. package/dist/cli/commands/link.js +7 -1
  29. package/dist/cli/commands/link.js.map +1 -1
  30. package/dist/cli/commands/loop.d.ts.map +1 -1
  31. package/dist/cli/commands/loop.js +7 -5
  32. package/dist/cli/commands/loop.js.map +1 -1
  33. package/dist/cli/commands/memory.d.ts +2 -0
  34. package/dist/cli/commands/memory.d.ts.map +1 -0
  35. package/dist/cli/commands/memory.js +304 -0
  36. package/dist/cli/commands/memory.js.map +1 -0
  37. package/dist/cli/commands/migrate-backend.d.ts +36 -5
  38. package/dist/cli/commands/migrate-backend.d.ts.map +1 -1
  39. package/dist/cli/commands/migrate-backend.js +250 -40
  40. package/dist/cli/commands/migrate-backend.js.map +1 -1
  41. package/dist/cli/commands/notes.d.ts +27 -0
  42. package/dist/cli/commands/notes.d.ts.map +1 -0
  43. package/dist/cli/commands/notes.js +222 -0
  44. package/dist/cli/commands/notes.js.map +1 -0
  45. package/dist/cli/commands/plugin.d.ts.map +1 -1
  46. package/dist/cli/commands/plugin.js +423 -8
  47. package/dist/cli/commands/plugin.js.map +1 -1
  48. package/dist/cli/commands/skill.d.ts +31 -0
  49. package/dist/cli/commands/skill.d.ts.map +1 -0
  50. package/dist/cli/commands/skill.js +498 -0
  51. package/dist/cli/commands/skill.js.map +1 -0
  52. package/dist/cli/commands/start.d.ts.map +1 -1
  53. package/dist/cli/commands/start.js +9 -1
  54. package/dist/cli/commands/start.js.map +1 -1
  55. package/dist/cli/commands/state-mcp.d.ts +25 -0
  56. package/dist/cli/commands/state-mcp.d.ts.map +1 -0
  57. package/dist/cli/commands/state-mcp.js +174 -0
  58. package/dist/cli/commands/state-mcp.js.map +1 -0
  59. package/dist/cli/commands/watch/agent-spawn.d.ts +62 -0
  60. package/dist/cli/commands/watch/agent-spawn.d.ts.map +1 -0
  61. package/dist/cli/commands/watch/agent-spawn.js +127 -0
  62. package/dist/cli/commands/watch/agent-spawn.js.map +1 -0
  63. package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -1
  64. package/dist/cli/commands/watch/capabilities/board.js +2 -1
  65. package/dist/cli/commands/watch/capabilities/board.js.map +1 -1
  66. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts.map +1 -1
  67. package/dist/cli/commands/watch/capabilities/decision-hygiene.js +3 -2
  68. package/dist/cli/commands/watch/capabilities/decision-hygiene.js.map +1 -1
  69. package/dist/cli/commands/watch/capabilities/execute.d.ts.map +1 -1
  70. package/dist/cli/commands/watch/capabilities/execute.js +14 -2
  71. package/dist/cli/commands/watch/capabilities/execute.js.map +1 -1
  72. package/dist/cli/commands/watch/capabilities/index.d.ts.map +1 -1
  73. package/dist/cli/commands/watch/capabilities/index.js +2 -0
  74. package/dist/cli/commands/watch/capabilities/index.js.map +1 -1
  75. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts +1 -1
  76. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts.map +1 -1
  77. package/dist/cli/commands/watch/capabilities/monitor-email.js +21 -4
  78. package/dist/cli/commands/watch/capabilities/monitor-email.js.map +1 -1
  79. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts +1 -1
  80. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts.map +1 -1
  81. package/dist/cli/commands/watch/capabilities/monitor-teams.js +21 -5
  82. package/dist/cli/commands/watch/capabilities/monitor-teams.js.map +1 -1
  83. package/dist/cli/commands/watch/capabilities/notes-promote.d.ts +11 -0
  84. package/dist/cli/commands/watch/capabilities/notes-promote.d.ts.map +1 -0
  85. package/dist/cli/commands/watch/capabilities/notes-promote.js +124 -0
  86. package/dist/cli/commands/watch/capabilities/notes-promote.js.map +1 -0
  87. package/dist/cli/commands/watch/capabilities/retro.d.ts.map +1 -1
  88. package/dist/cli/commands/watch/capabilities/retro.js +3 -2
  89. package/dist/cli/commands/watch/capabilities/retro.js.map +1 -1
  90. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts.map +1 -1
  91. package/dist/cli/commands/watch/capabilities/wave-dispatch.js +2 -1
  92. package/dist/cli/commands/watch/capabilities/wave-dispatch.js.map +1 -1
  93. package/dist/cli/commands/watch/index.d.ts.map +1 -1
  94. package/dist/cli/commands/watch/index.js +16 -12
  95. package/dist/cli/commands/watch/index.js.map +1 -1
  96. package/dist/cli/core/cast.d.ts.map +1 -1
  97. package/dist/cli/core/cast.js +216 -1
  98. package/dist/cli/core/cast.js.map +1 -1
  99. package/dist/cli/core/command-help.d.ts +44 -0
  100. package/dist/cli/core/command-help.d.ts.map +1 -0
  101. package/dist/cli/core/command-help.js +401 -0
  102. package/dist/cli/core/command-help.js.map +1 -0
  103. package/dist/cli/core/copilot-invocation.d.ts +57 -0
  104. package/dist/cli/core/copilot-invocation.d.ts.map +1 -0
  105. package/dist/cli/core/copilot-invocation.js +84 -0
  106. package/dist/cli/core/copilot-invocation.js.map +1 -0
  107. package/dist/cli/core/effective-squad-dir.d.ts +33 -0
  108. package/dist/cli/core/effective-squad-dir.d.ts.map +1 -0
  109. package/dist/cli/core/effective-squad-dir.js +37 -0
  110. package/dist/cli/core/effective-squad-dir.js.map +1 -0
  111. package/dist/cli/core/init.d.ts +2 -0
  112. package/dist/cli/core/init.d.ts.map +1 -1
  113. package/dist/cli/core/init.js +130 -1
  114. package/dist/cli/core/init.js.map +1 -1
  115. package/dist/cli/core/mcp-root.d.ts +73 -0
  116. package/dist/cli/core/mcp-root.d.ts.map +1 -0
  117. package/dist/cli/core/mcp-root.js +195 -0
  118. package/dist/cli/core/mcp-root.js.map +1 -0
  119. package/dist/cli/core/mcp-spec.d.ts +48 -0
  120. package/dist/cli/core/mcp-spec.d.ts.map +1 -0
  121. package/dist/cli/core/mcp-spec.js +62 -0
  122. package/dist/cli/core/mcp-spec.js.map +1 -0
  123. package/dist/cli/core/npm-registry.d.ts +25 -0
  124. package/dist/cli/core/npm-registry.d.ts.map +1 -0
  125. package/dist/cli/core/npm-registry.js +65 -0
  126. package/dist/cli/core/npm-registry.js.map +1 -0
  127. package/dist/cli/core/templates.d.ts.map +1 -1
  128. package/dist/cli/core/templates.js +102 -24
  129. package/dist/cli/core/templates.js.map +1 -1
  130. package/dist/cli/core/upgrade.d.ts +29 -0
  131. package/dist/cli/core/upgrade.d.ts.map +1 -1
  132. package/dist/cli/core/upgrade.js +413 -15
  133. package/dist/cli/core/upgrade.js.map +1 -1
  134. package/dist/cli/index.d.ts +1 -0
  135. package/dist/cli/index.d.ts.map +1 -1
  136. package/dist/cli/index.js +1 -0
  137. package/dist/cli/index.js.map +1 -1
  138. package/dist/cli/shell/components/App.js +1 -1
  139. package/dist/cli/shell/components/App.js.map +1 -1
  140. package/dist/cli/shell/components/MessageStream.js +2 -2
  141. package/dist/cli/shell/components/MessageStream.js.map +1 -1
  142. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  143. package/dist/cli/shell/coordinator.js +11 -5
  144. package/dist/cli/shell/coordinator.js.map +1 -1
  145. package/dist/cli/shell/index.d.ts.map +1 -1
  146. package/dist/cli/shell/index.js +14 -7
  147. package/dist/cli/shell/index.js.map +1 -1
  148. package/dist/cli/shell/lifecycle.d.ts.map +1 -1
  149. package/dist/cli/shell/lifecycle.js +12 -7
  150. package/dist/cli/shell/lifecycle.js.map +1 -1
  151. package/dist/cli/shell/session-store.d.ts +4 -4
  152. package/dist/cli/shell/session-store.d.ts.map +1 -1
  153. package/dist/cli/shell/session-store.js +11 -11
  154. package/dist/cli/shell/session-store.js.map +1 -1
  155. package/dist/cli-entry.js +171 -50
  156. package/dist/cli-entry.js.map +1 -1
  157. package/package.json +9 -4
  158. package/scripts/patch-esm-imports.mjs +3 -1
  159. package/templates/after-agent-reference.md +64 -0
  160. package/templates/ceremony-reference.md +82 -0
  161. package/templates/client-compatibility-reference.md +46 -0
  162. package/templates/copilot-agent.md +96 -0
  163. package/templates/copilot-instructions.md +14 -0
  164. package/templates/fact-checker-policy.md +104 -0
  165. package/templates/model-selection-reference.md +101 -0
  166. package/templates/prd-intake.md +105 -0
  167. package/templates/rai-charter.md +110 -0
  168. package/templates/rai-policy.md +103 -0
  169. package/templates/ralph-reference.md +141 -0
  170. package/templates/routing.md +1 -0
  171. package/templates/scribe-charter.md +18 -151
  172. package/templates/session-init-reference.md +199 -0
  173. package/templates/skills/cross-squad/SKILL.md +66 -6
  174. package/templates/skills/cross-squad-communication/SKILL.md +399 -0
  175. package/templates/skills/e2e-template-testing/SKILL.md +557 -0
  176. package/templates/skills/fact-checking/SKILL.md +61 -0
  177. package/templates/skills/release-process/SKILL.md +2 -2
  178. package/templates/skills/squad/SKILL.md +299 -0
  179. package/templates/skills/squad-help/SKILL.md +97 -0
  180. package/templates/skills/squad-version-check/SKILL.md +169 -0
  181. package/templates/skills/tiered-memory/SKILL.md +31 -44
  182. package/templates/spawn-reference.md +131 -0
  183. package/templates/squad.agent.md.template +306 -618
  184. package/templates/workflow-wiring-appendix-a-code-reviewer.md +131 -0
  185. package/templates/workflow-wiring-appendix-b-documenter.md +140 -0
  186. package/templates/workflow-wiring-guide.md +276 -0
  187. package/templates/workflows/squad-heartbeat.yml +167 -167
  188. package/templates/worktree-reference.md +126 -0
@@ -1,33 +1,35 @@
1
1
  ---
2
2
  name: tiered-memory
3
- description: Three-tier agent memory model (hot/cold/wiki) for 20-55% context reduction per spawn
3
+ description: Three-tier agent memory model (hot/cold/wiki) for context reduction per spawn
4
4
  domain: memory-management, performance
5
- confidence: high
6
- source: earned (production measurements in tamirdresher/tamresearch1, 34-74KB baseline payloads)
5
+ confidence: design (runtime not yet implemented)
6
+ source: design proposal
7
7
  ---
8
8
 
9
9
  # Skill: Tiered Agent Memory
10
10
 
11
+ > **Status (v0.10.0):** This skill describes a **design proposal**, not a shipped runtime. Skill files install via `squad init`/`upgrade`, but the underlying tier scaffolding (`.squad/memory/hot/`, `cold/`, `wiki/`), Scribe promotion logic, and spawn-template tier-aware reads are tracked in [bradygaster/squad#1264](https://github.com/bradygaster/squad/issues/1264). Until those land, agents continue to load full `history.md` + `decisions.md` on every spawn.
12
+
11
13
  ## Overview
12
14
 
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.
15
+ Squad agents today load their full context history on every spawn, which grows unboundedly across sessions. The Tiered Agent Memory model proposes a three-tier separation so agents only load the bytes that are actually relevant to the current task, with older context kept available on demand.
14
16
 
15
17
  ---
16
18
 
17
19
  ## Memory Tiers
18
20
 
19
21
  ### 🔥 Hot Tier — Current Session Context
20
- - **Size target:** ~2–4KB
22
+ - **Size target:** keep small (~2–4KB typical)
21
23
  - **Load policy:** Always loaded. Every spawn includes hot memory by default.
22
24
  - **Contents:** Current task description, active decisions made this session, immediate blockers, last 3–5 actions taken, who you are talking to right now.
23
25
  - **Lifetime:** Current session only. Discarded after session ends (Scribe promotes relevant parts to Cold).
24
26
  - **Purpose:** Provide immediate task context without any latency or load decision.
25
27
 
26
28
  ### ❄️ Cold Tier — Summarized Cross-Session History
27
- - **Size target:** ~8–12KB
29
+ - **Size target:** larger summary, not full transcript (~8–12KB typical)
28
30
  - **Load policy:** Load on demand. Include only when the task explicitly needs history.
29
31
  - **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.
32
+ - **Lifetime:** Rolling window (default proposal: 30 days). Eligible entries are then promoted to Wiki.
31
33
  - **Purpose:** Answer "what have we tried before?" and "what was decided?" without replaying full transcripts.
32
34
  - **How to include:** Pass `--include-cold` in spawn template or add `## Cold Memory` section.
33
35
 
@@ -89,49 +91,34 @@ See: .squad/memory/wiki/{topic}.md
89
91
 
90
92
  ---
91
93
 
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
94
+ ## Integration with Scribe Agent (design — not yet implemented)
109
95
 
110
- Scribe is the memory coordinator for this system. It automates tier promotion:
96
+ Scribe is the proposed memory coordinator for this system. Once the runtime lands, Scribe will:
111
97
 
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`
98
+ 1. **End of session:** Compress Hot → Cold summary (target: ~10% of session verbosity)
99
+ 2. **Aged cold entries:** Promote Cold → Wiki for decisions/facts that aged into stable knowledge
100
+ 3. **On-demand wiki writes:** Any agent can request Scribe to write a wiki entry mid-session
115
101
 
116
- See Scribe charter: `.squad/agents/scribe/charter.md`
102
+ Until then, see the Scribe charter for current behavior: `.squad/agents/scribe/charter.md`
117
103
 
118
104
  ---
119
105
 
120
- ## Implementation Checklist
106
+ ## Implementation Checklist (tracked in #1264)
121
107
 
122
108
  - [ ] Scribe writes Hot context file at session start (`.squad/memory/hot/{agent}.md`)
123
109
  - [ ] Scribe compresses and writes Cold summary at session end
124
110
  - [ ] Spawn templates default to Hot-only
125
111
  - [ ] Coordinators add `--include-cold` / `--include-wiki` flags as needed
126
112
  - [ ] Wiki entries stored in `.squad/memory/wiki/`
127
- - [ ] Cold entries stored in `.squad/memory/cold/` with 30-day TTL
113
+ - [ ] Cold entries stored in `.squad/memory/cold/` with rolling TTL
128
114
 
129
115
  ---
130
116
 
131
117
  ## References
132
118
 
133
- - Upstream issue: bradygaster/squad#600
134
- - Production data: tamirdresher/tamresearch1 (June 2025)
119
+ - Tracking issue: [bradygaster/squad#1264](https://github.com/bradygaster/squad/issues/1264) — installation gap + runtime status
120
+ - Original design spike: [bradygaster/squad#686](https://github.com/bradygaster/squad/issues/686) — tiered memory implementation plan
121
+ - Related: [bradygaster/squad#600](https://github.com/bradygaster/squad/issues/600) — context payload growth
135
122
 
136
123
  ---
137
124
 
@@ -162,7 +149,7 @@ Use this template when spawning any Squad agent. By default it loads **Hot tier
162
149
 
163
150
  ### 🔥 Hot (always included)
164
151
 
165
- > Paste current session context here (2–4KB max):
152
+ > Paste current session context here (~2–4KB target):
166
153
 
167
154
  ```
168
155
  Current task: {task_description}
@@ -178,12 +165,12 @@ Talking to: {current_interlocutor}
178
165
 
179
166
  > Load on demand. Do not inline unless specifically needed.
180
167
 
181
- Summarized cross-session history is at:
168
+ Summarized cross-session history is at:
182
169
  `.squad/memory/cold/{agent-name}.md`
183
170
 
184
171
  Include when:
185
172
  - Resuming interrupted work
186
- - Debugging a recurring issue
173
+ - Debugging a recurring issue
187
174
  - "What have we tried before?"
188
175
 
189
176
  **To load cold memory, add this section and fetch the file before spawning:**
@@ -218,17 +205,17 @@ Include when:
218
205
  ## Escalation
219
206
 
220
207
  If blocked or uncertain:
221
- - Architecture questions → @picard
222
- - Security concerns → @worf
223
- - Infrastructure/deployment → @belanna
224
- - Memory/history questions → @scribe
208
+ - Architecture questions → @picard
209
+ - Security concerns → @worf
210
+ - Infrastructure/deployment → @belanna
211
+ - Memory/history questions → @scribe
225
212
 
226
213
  ---
227
214
 
228
215
  ## Notes
229
216
 
230
- - Hot tier is always included and should stay under 4KB
231
- - Cold adds ~8–12KB; only include when history is relevant
217
+ - Hot tier is always included; keep it focused
218
+ - Cold adds a summary; only include when history is relevant
232
219
  - 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
220
+ - Runtime backing is tracked in [bradygaster/squad#1264](https://github.com/bradygaster/squad/issues/1264) — until those changes land, this skill is design-only and agents continue to load full history.md + decisions.md on every spawn
221
+
@@ -0,0 +1,131 @@
1
+ # Spawn Reference
2
+
3
+ ### How to Spawn an Agent
4
+
5
+ **You MUST dispatch every agent spawn** via the platform's tool (`task` on CLI, `runSubagent` on VS Code):
6
+
7
+ - **`agent_type`**: `"general-purpose"` (always — this gives agents full tool access)
8
+ - **`mode`**: `"background"` (default) or `"sync"` — use `"background"` for all parallelizable work; use `"sync"` only when the result is needed before the next step can proceed
9
+ - **`description`**: `"{Name}: {brief task summary}"` (e.g., `"Ripley: Design REST API endpoints"`, `"Dallas: Build login form"`) — this is what appears in the UI, so it MUST carry the agent's name and what they're doing
10
+ - **`prompt`**: The full agent prompt (see below)
11
+
12
+ **⚡ Inline the charter.** Before spawning, read the agent's `charter.md` (resolve from team root: `{team_root}/.squad/agents/{name}/charter.md`) and paste its contents directly into the spawn prompt. This eliminates a tool call from the agent's critical path. The agent still reads its own `history.md` and `decisions.md`.
13
+
14
+ **Background spawn (the default):** Use the template below with `mode: "background"`.
15
+
16
+ **Sync spawn (when required):** Use the template below and omit the `mode` parameter (sync is default).
17
+
18
+ > **VS Code equivalent:** Use `runSubagent` with the prompt content below. Drop `agent_type`, `mode`, `model`, and `description` parameters. Multiple subagents in one turn run concurrently. Sync is the default on VS Code.
19
+
20
+ **Template for any agent** (substitute `{Name}`, `{Role}`, `{name}`, and inline the charter):
21
+
22
+ ```
23
+ agent_type: "general-purpose"
24
+ model: "{resolved_model}"
25
+ mode: "background"
26
+ name: "{name}"
27
+ description: "{emoji} {Name}: {brief task summary}"
28
+ prompt: |
29
+ You are {Name}, the {Role} on this project.
30
+
31
+ YOUR CHARTER:
32
+ {paste contents of .squad/agents/{name}/charter.md here}
33
+
34
+ TEAM ROOT: {team_root}
35
+ CURRENT_DATETIME: <resolved CURRENT_DATETIME literal>
36
+ All `.squad/` paths are relative to this root.
37
+
38
+ Use the literal CURRENT_DATETIME value from your prompt for dated file content:
39
+ `<literal CURRENT_DATETIME value from your prompt>`. Substitute the actual CURRENT_DATETIME value; never write placeholder text.
40
+
41
+ PERSONAL_AGENT: {true|false} # Whether this is a personal agent
42
+ GHOST_PROTOCOL: {true|false} # Whether ghost protocol applies
43
+
44
+ {If PERSONAL_AGENT is true, append Ghost Protocol rules:}
45
+ ## Ghost Protocol
46
+ You are a personal agent operating in a project context. You MUST follow these rules:
47
+ - Read-only project state: Do NOT write to project's .squad/ directory
48
+ - No project ownership: You advise; project agents execute
49
+ - Transparent origin: Tag all logs with [personal:{name}]
50
+ - Consult mode: Provide recommendations, not direct changes
51
+ {end Ghost Protocol block}
52
+
53
+ WORKTREE_PATH: {worktree_path}
54
+ WORKTREE_MODE: {true|false}
55
+
56
+ {% if WORKTREE_MODE %}
57
+ **WORKTREE:** You are working in a dedicated worktree at `{WORKTREE_PATH}`.
58
+ - All file operations should be relative to this path
59
+ - Do NOT switch branches — the worktree IS your branch (`{branch_name}`)
60
+ - Build and test in the worktree, not the main repo
61
+ - Commit and push from the worktree
62
+ {% endif %}
63
+
64
+ STATE_BACKEND: {state_backend}
65
+
66
+ ## State Protocol — Runtime State Tools
67
+ Mutable squad state is owned by the runtime. You MUST use the `state.*` tools
68
+ whenever they are available:
69
+ - `squad_state_read` / `squad_state_list` for decisions, history, logs, and inbox entries
70
+ - `squad_state_write` / `squad_state_append` for durable updates
71
+ - `squad_state_delete` after Scribe merges inbox entries
72
+ - `squad_state_health` when diagnosing backend availability
73
+ - `squad_decide` for team-relevant decisions
74
+
75
+ The runtime routes those calls to the configured backend (`{state_backend}`), including
76
+ git-native backends. Do NOT run backend git commands, switch to a state branch, push
77
+ note refs, or write mutable `.squad/` state files by hand. Static config (charters,
78
+ team.md, routing.md, skills) remains on disk and may be read with normal file tools.
79
+
80
+ Read `agents/{name}/history.md` with `squad_state_read` when state tools are available; otherwise fall back to `.squad/agents/{name}/history.md`.
81
+ Read `decisions.md` with `squad_state_read` when state tools are available; otherwise fall back to `.squad/decisions.md`.
82
+ If .squad/identity/wisdom.md exists, read it before starting work.
83
+ If .squad/identity/now.md exists, read it at spawn time.
84
+ Check project skill directories (.squad/skills/, .github/skills/, .copilot/skills/, .claude/skills/, .agents/skills/) for any SKILL.md the coordinator attached to your prompt.
85
+ Read any relevant SKILL.md files before working.
86
+
87
+ ⚠️ WORK FRESHNESS: When determining what to work on:
88
+ - If an external tracker is configured (GitHub Issues, GitLab Issues, Azure DevOps),
89
+ ALWAYS query it for current open/active items. The tracker is the authoritative
90
+ source of truth — local plan files and checkboxes are advisory only.
91
+ - If .squad/identity/now.md has a `last_verified` timestamp older than your session
92
+ start, re-verify the current focus against the tracker before acting.
93
+ - NEVER work on items marked closed/done in the tracker, even if local files
94
+ suggest they are incomplete.
95
+
96
+ {only if MCP tools detected — omit entirely if none:}
97
+ MCP TOOLS: {service}: ✅ ({tools}) | ❌. Fall back to CLI when unavailable.
98
+ {end MCP block}
99
+
100
+ **Requested by:** {current user name}
101
+
102
+ INPUT ARTIFACTS: {list exact file paths to review/modify}
103
+
104
+ The user says: "{message}"
105
+
106
+ Do the work. Respond as {Name}.
107
+
108
+ ⚠️ OUTPUT: Report outcomes in human terms. Never expose tool internals or SQL.
109
+ ⚠️ DATES: When writing dates in any file (decisions, history, logs), use ONLY the CURRENT_DATETIME value above. Never infer or guess the date.
110
+
111
+ AFTER work (BEST-EFFORT — do NOT retry on failure):
112
+ ⚠️ POST-WORK BUDGET: Spend at most 20 tool calls on post-work steps below.
113
+ If you are running low on context or have used 60+ tool calls on primary work,
114
+ skip post-work entirely -- Scribe handles it independently.
115
+ 1. APPEND learnings with `squad_state_append` to `agents/{name}/history.md`.
116
+ Include architecture decisions, patterns, user preferences, and key file paths.
117
+ Use `<literal CURRENT_DATETIME value from your prompt>` as the entry timestamp.
118
+ Substitute the actual CURRENT_DATETIME value; do not write placeholder text.
119
+ 2. If you made a team-relevant decision, call `squad_decide`. If that tool is
120
+ unavailable, use `squad_state_write` to `decisions/inbox/{name}-{brief-slug}.md`.
121
+ 3. If state tools are unavailable, skip post-work state persistence and report the
122
+ backend/tool availability problem in your final summary.
123
+ 4. SKILL EXTRACTION is handled by Scribe — do NOT attempt it yourself.
124
+
125
+ ⚠️ STOP ON FAILURE: If ANY post-work step fails (git conflict, file not found,
126
+ permission error), SKIP it and move on. Do NOT retry. Scribe handles cleanup
127
+ independently. Your primary deliverable is already done — post-work is optional.
128
+
129
+ ⚠️ RESPONSE ORDER: After ALL tool calls, write a 2-3 sentence plain text
130
+ summary as your FINAL output. No tool calls after this summary.
131
+ ```