warp-os 1.1.3 → 1.2.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 (44) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +6 -4
  3. package/VERSION +1 -1
  4. package/agents/warp-annotate.md +394 -0
  5. package/agents/warp-browse.md +9 -1
  6. package/agents/warp-build-code.md +9 -1
  7. package/agents/warp-orchestrator.md +10 -1
  8. package/agents/warp-plan-architect.md +9 -1
  9. package/agents/warp-plan-brainstorm.md +9 -1
  10. package/agents/warp-plan-design.md +9 -1
  11. package/agents/warp-plan-onboarding.md +9 -1
  12. package/agents/warp-plan-optimize.md +9 -1
  13. package/agents/warp-plan-scope.md +9 -1
  14. package/agents/warp-plan-security.md +9 -1
  15. package/agents/warp-plan-testdesign.md +9 -1
  16. package/agents/warp-qa-debug.md +9 -1
  17. package/agents/warp-qa-test.md +9 -1
  18. package/agents/warp-release-update.md +9 -1
  19. package/agents/warp-setup.md +9 -1
  20. package/agents/warp-upgrade.md +21 -4
  21. package/bin/hooks/CLAUDE.md +24 -0
  22. package/bin/hooks/_warp_json.sh +4 -2
  23. package/bin/hooks/identity-briefing.sh +20 -13
  24. package/bin/hooks/validate-askuser.sh +41 -0
  25. package/dist/warp-annotate/SKILL.md +404 -0
  26. package/dist/warp-browse/SKILL.md +9 -1
  27. package/dist/warp-build-code/SKILL.md +9 -1
  28. package/dist/warp-orchestrator/SKILL.md +10 -1
  29. package/dist/warp-plan-architect/SKILL.md +9 -1
  30. package/dist/warp-plan-brainstorm/SKILL.md +9 -1
  31. package/dist/warp-plan-design/SKILL.md +9 -1
  32. package/dist/warp-plan-onboarding/SKILL.md +9 -1
  33. package/dist/warp-plan-optimize/SKILL.md +9 -1
  34. package/dist/warp-plan-scope/SKILL.md +9 -1
  35. package/dist/warp-plan-security/SKILL.md +9 -1
  36. package/dist/warp-plan-testdesign/SKILL.md +9 -1
  37. package/dist/warp-qa-debug/SKILL.md +9 -1
  38. package/dist/warp-qa-test/SKILL.md +9 -1
  39. package/dist/warp-release-update/SKILL.md +9 -1
  40. package/dist/warp-setup/SKILL.md +9 -1
  41. package/dist/warp-upgrade/SKILL.md +21 -4
  42. package/package.json +2 -2
  43. package/shared/project-hooks.json +7 -0
  44. package/shared/tier1-engineering-constitution.md +9 -1
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -119,6 +119,8 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
119
119
 
120
120
  ## AskUserQuestion
121
121
 
122
+ **Flow: analysis first, then decision tool.** Present your full reasoning, trade-offs, and recommendations as conversational text — the user wants to read your thinking. Then cap it with AskUserQuestion to formalize the decision. **If you're composing a message with multiple options or "which approach?" language, you MUST end it with AskUserQuestion.** Never present options in prose without the tool.
123
+
122
124
  **Contract:**
123
125
  1. **Re-ground:** Project name, branch, current task. (1-2 sentences.)
124
126
  2. **Simplify:** Plain English a smart 16-year-old could follow.
@@ -140,9 +142,15 @@ Shell commands use Unix syntax (Git Bash). Never use CMD (`dir`, `type`, `del`)
140
142
  Format: `"Option name — X/10 🟢"` (or 🟡 or 🔴). In the label, not the description.
141
143
  Rate: 🟢 9-10 complete, 🟡 6-8 adequate, 🔴 1-5 shortcuts.
142
144
 
145
+ **Pre-call checklist (verify before every AskUserQuestion invocation):**
146
+ - ☐ Completeness scores in every option label
147
+ - ☐ Recommended option listed first
148
+ - ☐ One decision per question (split if multiple)
149
+ - ☐ Analysis/reasoning already presented in message text above
150
+
143
151
  **Formatting:**
144
152
  - *Italics* for emphasis, not **bold** (bold for headers only).
145
- - After each answer: `✔ Decision {N} recorded [quicksave updated]`
153
+ - After each answer: `✔ Decision {N} recorded`
146
154
  - Previews under 8 lines. Full mockups go in conversation text before the question.
147
155
 
148
156
  ---
@@ -311,11 +319,20 @@ WARP │ UPGRADE
311
319
  Hooks: patched ✓
312
320
  claude-mem: installed ✓
313
321
  Stale: {N items cleaned / none}
314
- Restart: required
322
+ Restart: {context-aware — see below}
315
323
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
316
324
  ```
317
325
 
318
- **Always remind:** "Restart Claude Code to pick up the new skills and hooks."
326
+ ### Restart guidance (context-aware)
327
+
328
+ Skills are discovered dynamically — new skills are available immediately after install, no restart needed. Hooks fire on session lifecycle events (SessionStart, Stop, PreToolUse) — if hook *scripts* changed in this upgrade, a restart picks up the new behavior.
329
+
330
+ Determine restart need:
331
+ - **Hooks changed** (new hooks added, existing hooks modified) → `Restart: recommended (hooks updated)`
332
+ - **Only skills/agents changed** → `Restart: not needed — new skills available now`
333
+ - **Already current** (same version) → `Restart: not needed`
334
+
335
+ When hooks changed, say: "Restart Claude Code to pick up updated hooks." When they didn't, say: "No restart needed — new skills are available now."
319
336
 
320
337
  ---
321
338
 
@@ -327,7 +344,7 @@ WARP │ UPGRADE
327
344
  - Check for and offer to clean stale artifacts
328
345
  - Verify claude-mem is installed
329
346
  - Show changelog summary
330
- - Remind user to restart Claude Code
347
+ - Give context-aware restart guidance (hooks changed → recommend restart; skills only → no restart needed)
331
348
 
332
349
  **MUST NOT:**
333
350
  - Use git clone/pull to upgrade (npm handles distribution now)
@@ -0,0 +1,24 @@
1
+ # Hooks
2
+
3
+ Warp hook scripts for Claude Code's hook system. Each script handles a specific lifecycle event.
4
+
5
+ ## Hook scripts
6
+
7
+ - **identity-foundation.sh** — SessionStart. Injects the Warp engineering foundation identity. Runs on all session sources.
8
+ - **identity-briefing.sh** — SessionStart. Injects pipeline state, branch, P1 priorities via `additionalContext` JSON. Dual-path artifact lookup: checks `.warp/reports/planning/` then `.warp/pipeline/`.
9
+ - **consistency-check.sh** — Stop. Validates CLAUDE.md and TODOS.md consistency on session end. Warns only (stdout), cannot block.
10
+ - **validate-askuser.sh** — PreToolUse on AskUserQuestion. L1 deterministic gate that blocks calls if option labels lack completeness scores (`X/10` + emoji). Exit 2 = block.
11
+
12
+ ## Shared utilities
13
+
14
+ - **_warp_json.sh** — JSON field extraction without jq. Source this in every hook. Provides `_warp_read_input`, `_warp_field`, `_warp_field_raw`, `_warp_escape_json`.
15
+ - **_warp_html.sh** — Markdown-to-HTML conversion with Warp styling. Used by orchestrator for artifact preview.
16
+
17
+ ## Conventions
18
+
19
+ - All scripts use `set -euo pipefail`. Every `grep` in a pipeline must have `|| true` to survive no-match (exit 1 + pipefail = crash).
20
+ - Source `_warp_json.sh` and call `_warp_read_input` before extracting fields.
21
+ - Exit codes: `0` = allow/success, `2` = block with message (PreToolUse only). Never exit 1 (treated as error, not block).
22
+ - SessionStart hooks output JSON: `{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"..."}}`. Escape newlines via `_warp_escape_json`.
23
+ - Stop hooks can only warn via stdout. They cannot block session end.
24
+ - Keep hooks fast (< 100ms). No network calls, no heavy computation.
@@ -22,6 +22,7 @@ _warp_read_input() {
22
22
  # Extract a JSON string field: "key": "value" → value
23
23
  # Handles optional whitespace around the colon.
24
24
  # Returns empty string if field not found.
25
+ # Safe under set -eo pipefail (grep no-match → empty, not crash).
25
26
  _warp_field() {
26
27
  local key="$1"
27
28
  if [ -z "$_WARP_HOOK_INPUT" ]; then
@@ -31,11 +32,12 @@ _warp_field() {
31
32
  echo "$_WARP_HOOK_INPUT" | \
32
33
  grep -o "\"$key\"[[:space:]]*:[[:space:]]*\"[^\"]*\"" | \
33
34
  head -1 | \
34
- sed "s/\"$key\"[[:space:]]*:[[:space:]]*\"//;s/\"$//"
35
+ sed "s/\"$key\"[[:space:]]*:[[:space:]]*\"//;s/\"$//" || true
35
36
  }
36
37
 
37
38
  # Extract a non-string JSON field: "key": true → true, "key": 42 → 42
38
39
  # For booleans, numbers, null. Returns empty string if not found.
40
+ # Safe under set -eo pipefail (grep no-match → empty, not crash).
39
41
  _warp_field_raw() {
40
42
  local key="$1"
41
43
  if [ -z "$_WARP_HOOK_INPUT" ]; then
@@ -46,7 +48,7 @@ _warp_field_raw() {
46
48
  grep -o "\"$key\"[[:space:]]*:[[:space:]]*[^,}\"][^,}]*" | \
47
49
  head -1 | \
48
50
  sed "s/\"$key\"[[:space:]]*:[[:space:]]*//" | \
49
- tr -d '[:space:]'
51
+ tr -d '[:space:]' || true
50
52
  }
51
53
 
52
54
  # Escape a string for safe embedding inside a JSON string value.
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
  # identity-briefing.sh — Inject pipeline state + priorities into Claude's context
3
- # Fires on SessionStart (all sources). Bounded to ~100-200 tokens.
3
+ # Fires on SessionStart (all sources including compact). Bounded to ~100-200 tokens.
4
4
  # Outputs partial briefing if some files are missing (graceful degradation).
5
+ # Must survive set -eo pipefail — every pipeline has || true or || echo fallback.
5
6
  set -euo pipefail
6
7
 
7
8
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
@@ -19,28 +20,28 @@ RULE="━━━━━━━━━━━━━━━━━━━━━━━━
19
20
 
20
21
  # Branch and git state
21
22
  BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
22
- UNCOMMITTED=$(git status --porcelain 2>/dev/null | wc -l | tr -d '[:space:]')
23
+ UNCOMMITTED=$(git status --porcelain 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")
23
24
  if [ "$UNCOMMITTED" = "0" ]; then
24
25
  GIT_STATE="clean"
25
26
  else
26
27
  GIT_STATE="${UNCOMMITTED} files"
27
28
  fi
28
29
 
29
- # Pipeline state
30
+ # Pipeline state — check new path (.warp/reports/planning/) then fall back to old (.warp/pipeline/)
30
31
  PIPELINE=""
31
32
  for artifact in brainstorm onboarding scope architecture design testspec security README; do
32
- f=".warp/pipeline/${artifact}.md"
33
- if [ -f "$f" ]; then
33
+ if [ -f ".warp/reports/planning/${artifact}.md" ] || [ -f ".warp/pipeline/${artifact}.md" ]; then
34
34
  PIPELINE="${PIPELINE} ✓${artifact}"
35
35
  else
36
36
  PIPELINE="${PIPELINE} ○${artifact}"
37
37
  fi
38
38
  done
39
39
 
40
- # Mode detection
41
- if [ -f ".warp/pipeline/README.md" ]; then
40
+ # Mode detection — check new path then old
41
+ if [ -f ".warp/reports/roadmap/README.md" ] || [ -f ".warp/pipeline/README.md" ]; then
42
42
  WARP_MODE="pipeline"
43
- elif [ -d ".warp/pipeline" ] && ls .warp/pipeline/*.md >/dev/null 2>&1; then
43
+ elif ([ -d ".warp/reports/planning" ] && ls .warp/reports/planning/*.md >/dev/null 2>&1) || \
44
+ ([ -d ".warp/pipeline" ] && ls .warp/pipeline/*.md >/dev/null 2>&1); then
44
45
  WARP_MODE="pipeline-partial"
45
46
  else
46
47
  WARP_MODE="no-pipeline"
@@ -53,11 +54,17 @@ if [ -n "$PIPELINE" ]; then
53
54
  BRIEFING="${BRIEFING}"$'\n'" Pipeline:${PIPELINE}"
54
55
  fi
55
56
 
56
- # Phase/cycle progress from roadmap
57
- if [ -f ".warp/pipeline/README.md" ]; then
58
- CHECKED=$(grep -c '^\- \[x\]' .warp/pipeline/README.md 2>/dev/null || echo "0")
59
- TOTAL=$(grep -c '^\- \[' .warp/pipeline/README.md 2>/dev/null || echo "0")
60
- NEXT=$(grep -m1 '^\- \[ \]' .warp/pipeline/README.md 2>/dev/null | sed 's/^- \[ \] //' | head -c 60 || true)
57
+ # Phase/cycle progress from roadmap — check new path then old
58
+ ROADMAP=""
59
+ if [ -f ".warp/reports/roadmap/README.md" ]; then
60
+ ROADMAP=".warp/reports/roadmap/README.md"
61
+ elif [ -f ".warp/pipeline/README.md" ]; then
62
+ ROADMAP=".warp/pipeline/README.md"
63
+ fi
64
+ if [ -n "$ROADMAP" ]; then
65
+ CHECKED=$(grep -c '^\- \[x\]' "$ROADMAP" 2>/dev/null || echo "0")
66
+ TOTAL=$(grep -c '^\- \[' "$ROADMAP" 2>/dev/null || echo "0")
67
+ NEXT=$(grep -m1 '^\- \[ \]' "$ROADMAP" 2>/dev/null | sed 's/^- \[ \] //' | head -c 60 || true)
61
68
  if [ "$TOTAL" != "0" ]; then
62
69
  BRIEFING="${BRIEFING}"$'\n'"Cycles: ${CHECKED}/${TOTAL} complete"
63
70
  if [ -n "$NEXT" ]; then
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # validate-askuser.sh — PreToolUse gate for AskUserQuestion
3
+ # Blocks the call if any option label is missing completeness scores.
4
+ # Pattern required: "X/10" followed by 🟢, 🟡, or 🔴 somewhere in the label.
5
+ #
6
+ # L1 enforcement — deterministic regex, zero AI judgment.
7
+ # Exit 0 = allow, exit 2 = block with message.
8
+ set -euo pipefail
9
+
10
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
11
+ source "$SCRIPT_DIR/_warp_json.sh"
12
+ _warp_read_input
13
+
14
+ # Extract all label values from the tool input.
15
+ # Labels appear as "label": "Option name — 8/10 🟡" in the JSON.
16
+ LABELS=$(echo "$_WARP_HOOK_INPUT" | grep -o '"label"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"label"[[:space:]]*:[[:space:]]*"//;s/"$//' || true)
17
+
18
+ if [ -z "$LABELS" ]; then
19
+ # No labels found — might be malformed, let it through
20
+ exit 0
21
+ fi
22
+
23
+ # Check each label for the completeness pattern: digit(s)/10 + emoji
24
+ MISSING=""
25
+ while IFS= read -r label; do
26
+ # Match: one or more digits, /10, then anywhere in the label one of the three emojis
27
+ if ! echo "$label" | grep -qE '[0-9]+/10'; then
28
+ MISSING="${MISSING}\n - \"${label}\""
29
+ fi
30
+ done <<< "$LABELS"
31
+
32
+ if [ -n "$MISSING" ]; then
33
+ echo "BLOCKED: Completeness scores missing from option labels." >&2
34
+ echo "Every AskUserQuestion option label MUST include 'X/10' + 🟢🟡🔴." >&2
35
+ echo "Labels missing scores:${MISSING}" >&2
36
+ echo "" >&2
37
+ echo "Format: \"Option name — X/10 🟢\" (🟢 9-10, 🟡 6-8, 🔴 1-5)" >&2
38
+ exit 2
39
+ fi
40
+
41
+ exit 0