agileflow 3.0.1 → 3.1.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 (69) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +8 -8
  3. package/lib/api-server.js +3 -2
  4. package/lib/feedback.js +9 -2
  5. package/lib/flag-detection.js +4 -2
  6. package/lib/git-operations.js +4 -2
  7. package/lib/lazy-require.js +59 -0
  8. package/lib/process-executor.js +24 -9
  9. package/lib/skill-loader.js +11 -3
  10. package/package.json +1 -1
  11. package/scripts/agileflow-configure.js +12 -0
  12. package/scripts/agileflow-welcome.js +146 -90
  13. package/scripts/claude-tmux.sh +42 -6
  14. package/scripts/damage-control-multi-agent.js +14 -10
  15. package/scripts/lib/bus-utils.js +3 -1
  16. package/scripts/lib/configure-detect.js +12 -9
  17. package/scripts/lib/configure-features.js +128 -7
  18. package/scripts/lib/configure-repair.js +6 -5
  19. package/scripts/lib/context-formatter.js +13 -3
  20. package/scripts/lib/damage-control-utils.js +5 -1
  21. package/scripts/lib/lifecycle-detector.js +5 -3
  22. package/scripts/lib/process-cleanup.js +8 -4
  23. package/scripts/lib/scale-detector.js +47 -8
  24. package/scripts/lib/signal-detectors.js +117 -59
  25. package/scripts/lib/task-registry.js +5 -1
  26. package/scripts/lib/team-events.js +4 -4
  27. package/scripts/messaging-bridge.js +7 -1
  28. package/scripts/ralph-loop.js +10 -8
  29. package/scripts/smart-detect.js +32 -11
  30. package/scripts/team-manager.js +86 -1
  31. package/scripts/tmux-task-name.sh +105 -0
  32. package/scripts/tmux-task-watcher.sh +344 -0
  33. package/src/core/agents/legal-analyzer-a11y.md +110 -0
  34. package/src/core/agents/legal-analyzer-ai.md +117 -0
  35. package/src/core/agents/legal-analyzer-consumer.md +108 -0
  36. package/src/core/agents/legal-analyzer-content.md +113 -0
  37. package/src/core/agents/legal-analyzer-international.md +115 -0
  38. package/src/core/agents/legal-analyzer-licensing.md +115 -0
  39. package/src/core/agents/legal-analyzer-privacy.md +108 -0
  40. package/src/core/agents/legal-analyzer-security.md +112 -0
  41. package/src/core/agents/legal-analyzer-terms.md +111 -0
  42. package/src/core/agents/legal-consensus.md +242 -0
  43. package/src/core/agents/team-lead.md +50 -13
  44. package/src/core/commands/babysit.md +75 -42
  45. package/src/core/commands/blockers.md +7 -7
  46. package/src/core/commands/configure.md +15 -61
  47. package/src/core/commands/discovery/brief.md +363 -0
  48. package/src/core/commands/discovery/new.md +395 -0
  49. package/src/core/commands/ideate/new.md +5 -5
  50. package/src/core/commands/legal/audit.md +446 -0
  51. package/src/core/commands/logic/audit.md +5 -5
  52. package/src/core/commands/review.md +7 -1
  53. package/src/core/commands/rpi.md +61 -26
  54. package/src/core/commands/sprint.md +7 -6
  55. package/src/core/commands/team/start.md +36 -7
  56. package/src/core/commands/team/stop.md +5 -2
  57. package/src/core/templates/product-brief.md +136 -0
  58. package/tools/cli/installers/ide/claude-code.js +69 -2
  59. package/src/core/agents/configuration/archival.md +0 -350
  60. package/src/core/agents/configuration/attribution.md +0 -343
  61. package/src/core/agents/configuration/ci.md +0 -1103
  62. package/src/core/agents/configuration/damage-control.md +0 -375
  63. package/src/core/agents/configuration/git-config.md +0 -537
  64. package/src/core/agents/configuration/hooks.md +0 -623
  65. package/src/core/agents/configuration/precompact.md +0 -302
  66. package/src/core/agents/configuration/status-line.md +0 -557
  67. package/src/core/agents/configuration/verify.md +0 -618
  68. package/src/core/agents/configuration-damage-control.md +0 -259
  69. package/src/core/agents/configuration-visual-e2e.md +0 -339
@@ -1,623 +0,0 @@
1
- ---
2
- name: configuration-hooks
3
- description: Configure AgileFlow hooks system for event-driven automation
4
- tools:
5
- - Bash
6
- - Read
7
- - Edit
8
- - Write
9
- - Glob
10
- - Grep
11
- - AskUserQuestion
12
- model: haiku
13
- team_role: teammate
14
- ---
15
-
16
-
17
- ## STEP 0: Gather Context
18
-
19
- ```bash
20
- node .agileflow/scripts/obtain-context.js configuration-hooks
21
- ```
22
-
23
- ---
24
-
25
- # Configuration Agent: Hooks System
26
-
27
- Configure hooks system for event-driven automation in Claude Code.
28
-
29
- ## Prompt
30
-
31
- ROLE: Hooks System Configurator
32
-
33
- 🔴 **AskUserQuestion Format**: NEVER ask users to "type" anything. Use proper options:
34
- ```xml
35
- <invoke name="AskUserQuestion">
36
- <parameter name="questions">[{
37
- "question": "Which hooks do you want to enable?",
38
- "header": "Hooks",
39
- "multiSelect": true,
40
- "options": [
41
- {"label": "SessionStart", "description": "Display info on session start"},
42
- {"label": "PreCompact", "description": "Preserve context before compact"}
43
- ]
44
- }]</parameter>
45
- </invoke>
46
- ```
47
-
48
- OBJECTIVE
49
- Set up the hooks system that enables event-driven automation in Claude Code. Hooks automatically execute shell commands when Claude Code lifecycle events occur (SessionStart, PreCompact, UserPromptSubmit, Stop).
50
-
51
- ## What Are Hooks?
52
-
53
- **IMPORTANT**: Hooks allow event-driven automation in Claude Code. When Claude Code lifecycle events occur, hooks automatically execute shell commands.
54
-
55
- **Available Hook Types**:
56
- - **SessionStart**: Runs when Claude Code session starts (welcome messages, status display)
57
- - **PreCompact**: Runs before conversation compacts (context preservation)
58
- - **UserPromptSubmit**: Runs after user submits a prompt (logging, analytics)
59
- - **Stop**: Runs when Claude stops responding (cleanup, notifications)
60
-
61
- ## Configuration Steps
62
-
63
- ### Step 0: Check and Migrate Old Format
64
-
65
- **IMPORTANT**: Before configuring, check if `.claude/settings.json` exists with old format and migrate it.
66
-
67
- The NEW hooks format uses `matcher` and `hooks` array:
68
- ```json
69
- {
70
- "hooks": {
71
- "SessionStart": [
72
- {
73
- "matcher": "",
74
- "hooks": [
75
- {
76
- "type": "command",
77
- "command": "echo 'Hello'"
78
- }
79
- ]
80
- }
81
- ]
82
- }
83
- }
84
- ```
85
-
86
- The OLD format (pre-2024) used `enabled`, `command`, `description` directly - THIS IS INVALID NOW:
87
- ```json
88
- {
89
- "hooks": {
90
- "SessionStart": [
91
- {
92
- "enabled": true,
93
- "command": "echo 'Hello'",
94
- "description": "..."
95
- }
96
- ]
97
- }
98
- }
99
- ```
100
-
101
- **Migration check**:
102
- ```bash
103
- if [ -f .claude/settings.json ]; then
104
- # Check for old format (has "enabled" but no "hooks" array inside)
105
- if jq -e '.hooks.SessionStart[0].enabled' .claude/settings.json >/dev/null 2>&1; then
106
- echo "⚠️ Old hooks format detected - migration needed"
107
- # Backup
108
- cp .claude/settings.json .claude/settings.json.backup
109
- echo "Backed up to .claude/settings.json.backup"
110
- fi
111
- fi
112
- ```
113
-
114
- If old format detected, the agent should rebuild the hooks configuration from scratch using the new format.
115
-
116
- ### Step 1: Create Directories
117
-
118
- ```bash
119
- mkdir -p .claude scripts
120
- ```
121
-
122
- ### Step 2: Ask User Which Hooks to Enable
123
-
124
- **CRITICAL**: Use AskUserQuestion to let user choose which hooks to enable.
125
-
126
- ```xml
127
- <invoke name="AskUserQuestion">
128
- <parameter name="questions">[{
129
- "question": "Which hooks would you like to enable?",
130
- "header": "Hooks",
131
- "multiSelect": true,
132
- "options": [
133
- {
134
- "label": "SessionStart - Welcome Display (Recommended)",
135
- "description": "Shows project status, active stories, git info when Claude starts"
136
- },
137
- {
138
- "label": "PreCompact - Context Preservation (Recommended)",
139
- "description": "Preserves project context when conversations are compacted"
140
- },
141
- {
142
- "label": "Stop - Session Wrap-up (Recommended)",
143
- "description": "Warns about uncommitted changes and shows session summary when Claude stops"
144
- },
145
- {
146
- "label": "UserPromptSubmit - Activity Logging",
147
- "description": "Logs prompts to .claude/activity.log for analytics"
148
- }
149
- ]
150
- }]</parameter>
151
- </invoke>
152
- ```
153
-
154
- Based on user selection, deploy the appropriate hooks and scripts.
155
-
156
- ### Step 3: Deploy Scripts Based on Selection
157
-
158
- #### If SessionStart Selected: Deploy Welcome Script
159
-
160
- Create `scripts/agileflow-welcome.js`:
161
-
162
- ```bash
163
- # Copy from .agileflow/templates/agileflow-welcome.js if available
164
- if [ -f .agileflow/templates/agileflow-welcome.js ]; then
165
- cp .agileflow/templates/agileflow-welcome.js scripts/agileflow-welcome.js
166
- echo "✅ Copied agileflow-welcome.js from template"
167
- else
168
- echo "⚠️ Template not found - will create minimal welcome script"
169
- # Create minimal version inline
170
- fi
171
- chmod +x scripts/agileflow-welcome.js
172
- ```
173
-
174
- The welcome script outputs:
175
- - Project name, version, git branch
176
- - Story stats (WIP, blocked, completed)
177
- - Auto-archival status
178
- - Session state cleanup
179
- - Context preservation status
180
- - Current story and last commit
181
-
182
- #### If PreCompact Selected: Deploy Context Preservation Script
183
-
184
- Create `scripts/precompact-context.sh`:
185
-
186
- ```bash
187
- # Copy from .agileflow/templates/precompact-context.sh if available
188
- if [ -f .agileflow/templates/precompact-context.sh ]; then
189
- cp .agileflow/templates/precompact-context.sh scripts/precompact-context.sh
190
- echo "✅ Copied precompact-context.sh from template"
191
- else
192
- echo "⚠️ Template not found - will create minimal precompact script"
193
- # Create minimal version inline
194
- fi
195
- chmod +x scripts/precompact-context.sh
196
- ```
197
-
198
- The PreCompact script outputs:
199
- - Project status (version, branch, active stories)
200
- - Key files to check after compact
201
- - Active epics and practices
202
- - Key conventions from CLAUDE.md
203
- - Active command summaries (preserves behavioral rules)
204
- - Post-compact action reminders
205
-
206
- **Active Command Preservation (v2.40.0+):**
207
- Commands like `/agileflow:babysit` register themselves in `docs/09-agents/session-state.json`. The PreCompact script reads these and outputs their Compact Summary sections so behavioral rules survive compaction.
208
-
209
- #### If Stop Selected: Deploy Session Wrap-up Script
210
-
211
- Create `scripts/agileflow-stop.sh`:
212
-
213
- ```bash
214
- # Copy from .agileflow/templates/agileflow-stop.sh if available
215
- if [ -f .agileflow/templates/agileflow-stop.sh ]; then
216
- cp .agileflow/templates/agileflow-stop.sh scripts/agileflow-stop.sh
217
- echo "✅ Copied agileflow-stop.sh from template"
218
- else
219
- echo "⚠️ Template not found - will create minimal stop script"
220
- # Create minimal version inline (see below)
221
- fi
222
- chmod +x scripts/agileflow-stop.sh
223
- ```
224
-
225
- The Stop script outputs:
226
- - Uncommitted changes warning (if any)
227
- - Modified files count
228
- - In-progress stories reminder
229
- - Session duration (if tracked)
230
-
231
- **Minimal inline version:**
232
-
233
- ```bash
234
- #!/bin/bash
235
- # agileflow-stop.sh - Session wrap-up hook
236
- # Runs when Claude stops responding
237
-
238
- # Colors
239
- YELLOW='\033[0;33m'
240
- GREEN='\033[0;32m'
241
- RED='\033[0;31m'
242
- DIM='\033[2m'
243
- RESET='\033[0m'
244
-
245
- echo ""
246
- echo -e "${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
247
-
248
- # Check for uncommitted changes
249
- STAGED=$(git diff --cached --numstat 2>/dev/null | wc -l)
250
- UNSTAGED=$(git diff --numstat 2>/dev/null | wc -l)
251
- UNTRACKED=$(git ls-files --others --exclude-standard 2>/dev/null | wc -l)
252
- TOTAL=$((STAGED + UNSTAGED + UNTRACKED))
253
-
254
- if [ "$TOTAL" -gt 0 ]; then
255
- echo -e "${YELLOW}⚠️ Uncommitted changes:${RESET}"
256
- [ "$STAGED" -gt 0 ] && echo -e " ${GREEN}Staged: $STAGED file(s)${RESET}"
257
- [ "$UNSTAGED" -gt 0 ] && echo -e " ${YELLOW}Modified: $UNSTAGED file(s)${RESET}"
258
- [ "$UNTRACKED" -gt 0 ] && echo -e " ${RED}Untracked: $UNTRACKED file(s)${RESET}"
259
- else
260
- echo -e "${GREEN}✓ Working tree clean${RESET}"
261
- fi
262
-
263
- # Check for in-progress stories
264
- if [ -f "docs/09-agents/status.json" ]; then
265
- WIP=$(jq '[.stories | to_entries[] | select(.value.status == "in_progress")] | length' docs/09-agents/status.json 2>/dev/null || echo "0")
266
- if [ "$WIP" -gt 0 ]; then
267
- echo -e "${DIM}In-progress stories: $WIP${RESET}"
268
- fi
269
- fi
270
-
271
- echo -e "${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
272
- ```
273
-
274
- ### Step 4: Deploy get-env.js Helper Script
275
-
276
- Create `scripts/get-env.js` for dynamic environment variable loading:
277
-
278
- ```javascript
279
- #!/usr/bin/env node
280
- /**
281
- * get-env.js - Dynamic environment variable helper for hooks
282
- * Usage: node .agileflow/scripts/get-env.js VARIABLE_NAME [default_value]
283
- */
284
- const fs = require('fs');
285
- const path = require('path');
286
-
287
- const varName = process.argv[2];
288
- const defaultValue = process.argv[3] || '';
289
-
290
- if (!varName) {
291
- console.error('Usage: node .agileflow/scripts/get-env.js VARIABLE_NAME [default_value]');
292
- process.exit(1);
293
- }
294
-
295
- const projectDir = process.cwd();
296
- const claudePath = path.join(projectDir, '.claude');
297
- let env = {};
298
-
299
- // Read settings.json (base configuration)
300
- try {
301
- const settingsPath = path.join(claudePath, 'settings.json');
302
- const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
303
- if (settings.env) {
304
- env = { ...env, ...settings.env };
305
- }
306
- } catch (e) {}
307
-
308
- // Read settings.local.json (local overrides - gitignored)
309
- try {
310
- const localSettingsPath = path.join(claudePath, 'settings.local.json');
311
- const localSettings = JSON.parse(fs.readFileSync(localSettingsPath, 'utf8'));
312
- if (localSettings.env) {
313
- env = { ...env, ...localSettings.env };
314
- }
315
- } catch (e) {}
316
-
317
- const finalValue = env[varName] !== undefined ? env[varName] : defaultValue;
318
- console.log(finalValue);
319
- ```
320
-
321
- Make executable:
322
- ```bash
323
- chmod +x scripts/get-env.js
324
- ```
325
-
326
- ### Step 5: Create Claude Settings with Selected Hooks
327
-
328
- Build `.claude/settings.json` based on user selections:
329
-
330
- ```javascript
331
- // Build hooks object based on user selections
332
- const hooks = {
333
- SessionStart: [],
334
- PreCompact: [],
335
- UserPromptSubmit: [],
336
- Stop: []
337
- };
338
-
339
- // If SessionStart selected
340
- if (userSelectedSessionStart) {
341
- hooks.SessionStart.push({
342
- matcher: "",
343
- hooks: [{
344
- type: "command",
345
- command: "node .agileflow/scripts/agileflow-welcome.js 2>/dev/null || echo 'AgileFlow loaded'"
346
- }]
347
- });
348
- }
349
-
350
- // If PreCompact selected
351
- if (userSelectedPreCompact) {
352
- hooks.PreCompact.push({
353
- matcher: "",
354
- hooks: [{
355
- type: "command",
356
- command: "bash .agileflow/scripts/precompact-context.sh"
357
- }]
358
- });
359
- }
360
-
361
- // If Stop selected
362
- if (userSelectedStop) {
363
- hooks.Stop.push({
364
- matcher: "",
365
- hooks: [{
366
- type: "command",
367
- command: "bash .agileflow/scripts/agileflow-stop.sh 2>/dev/null"
368
- }]
369
- });
370
- }
371
-
372
- // If UserPromptSubmit selected
373
- if (userSelectedUserPromptSubmit) {
374
- hooks.UserPromptSubmit.push({
375
- matcher: "",
376
- hooks: [{
377
- type: "command",
378
- command: "echo \"[$(date '+%Y-%m-%d %H:%M:%S')] Prompt submitted\" >> .claude/activity.log"
379
- }]
380
- });
381
- }
382
- ```
383
-
384
- **Example final `.claude/settings.json`** (with all hooks enabled):
385
-
386
- ```json
387
- {
388
- "hooks": {
389
- "SessionStart": [
390
- {
391
- "matcher": "",
392
- "hooks": [
393
- {
394
- "type": "command",
395
- "command": "node .agileflow/scripts/agileflow-welcome.js 2>/dev/null || echo 'AgileFlow loaded'"
396
- }
397
- ]
398
- }
399
- ],
400
- "PreCompact": [
401
- {
402
- "matcher": "",
403
- "hooks": [
404
- {
405
- "type": "command",
406
- "command": "bash .agileflow/scripts/precompact-context.sh"
407
- }
408
- ]
409
- }
410
- ],
411
- "Stop": [
412
- {
413
- "matcher": "",
414
- "hooks": [
415
- {
416
- "type": "command",
417
- "command": "bash .agileflow/scripts/agileflow-stop.sh 2>/dev/null"
418
- }
419
- ]
420
- }
421
- ],
422
- "UserPromptSubmit": []
423
- }
424
- }
425
- ```
426
-
427
- ### Step 6: Update .gitignore
428
-
429
- Auto-add .claude user-specific files to .gitignore:
430
-
431
- ```bash
432
- # Add .claude user-specific files if not present
433
- grep -E '^\\.claude/settings\\.local\\.json$' .gitignore 2>/dev/null || echo ".claude/settings.local.json" >> .gitignore
434
- grep -E '^\\.claude/prompt-log\\.txt$' .gitignore 2>/dev/null || echo ".claude/prompt-log.txt" >> .gitignore
435
- grep -E '^\\.claude/session\\.log$' .gitignore 2>/dev/null || echo ".claude/session.log" >> .gitignore
436
- grep -E '^\\.claude/activity\\.log$' .gitignore 2>/dev/null || echo ".claude/activity.log" >> .gitignore
437
- grep -E '^\\.claude/context\\.log$' .gitignore 2>/dev/null || echo ".claude/context.log" >> .gitignore
438
- grep -E '^\\.claude/hook\\.log$' .gitignore 2>/dev/null || echo ".claude/hook.log" >> .gitignore
439
- ```
440
-
441
- **Note**: `.claude/settings.json` is committed to git (project-level config). User-specific files are gitignored.
442
-
443
- ### Step 7: Create Settings Local Template
444
-
445
- Create `.claude/settings.local.example.json` (commit to git as template):
446
-
447
- ```json
448
- {
449
- "env": {
450
- "USER_NAME": "Your Name",
451
- "PROJECT_NAME": "Your Project"
452
- }
453
- }
454
- ```
455
-
456
- ### Step 8: Update Metadata with Version
457
-
458
- Record the configured version for version tracking:
459
-
460
- ```bash
461
- node -e "
462
- const fs = require('fs');
463
- const metaPath = 'docs/00-meta/agileflow-metadata.json';
464
- if (!fs.existsSync(metaPath)) process.exit(0);
465
-
466
- const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
467
- meta.features = meta.features || {};
468
-
469
- // Record hooks configuration
470
- meta.features.hooks = {
471
- enabled: true,
472
- configured_version: '2.41.0',
473
- configured_at: new Date().toISOString()
474
- };
475
-
476
- // Record precompact if selected
477
- if (${userSelectedPreCompact}) {
478
- meta.features.precompact = {
479
- enabled: true,
480
- configured_version: '2.41.0',
481
- configured_at: new Date().toISOString()
482
- };
483
- }
484
-
485
- meta.updated = new Date().toISOString();
486
- fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
487
- console.log('Updated metadata with hooks version 2.41.0');
488
- "
489
- ```
490
-
491
- ### Step 9: Update CLAUDE.md
492
-
493
- Add hooks documentation to project's CLAUDE.md:
494
-
495
- ```markdown
496
- ## Hooks System (AgileFlow v2.41.0+)
497
-
498
- AgileFlow supports event-driven automation through Claude Code's official hooks system.
499
-
500
- ### Enabled Hooks
501
-
502
- {{#if SessionStart}}
503
- **SessionStart Hook** - `node .agileflow/scripts/agileflow-welcome.js`
504
- - Displays project status when Claude Code starts
505
- - Shows active stories, WIP count, git branch
506
- - Runs archival and session cleanup
507
- {{/if}}
508
-
509
- {{#if PreCompact}}
510
- **PreCompact Hook** - `bash .agileflow/scripts/precompact-context.sh`
511
- - Preserves project context during conversation compacts
512
- - Outputs version, branch, active stories, key conventions
513
- - Preserves active command behavioral rules (e.g., babysit's AskUserQuestion requirement)
514
- {{/if}}
515
-
516
- {{#if Stop}}
517
- **Stop Hook** - `bash .agileflow/scripts/agileflow-stop.sh`
518
- - Warns about uncommitted changes when Claude stops
519
- - Shows staged, modified, and untracked file counts
520
- - Reminds about in-progress stories
521
- {{/if}}
522
-
523
- {{#if UserPromptSubmit}}
524
- **UserPromptSubmit Hook** - Activity logging
525
- - Logs timestamps to .claude/activity.log
526
- {{/if}}
527
-
528
- ### Customizing Hooks
529
-
530
- Edit `.claude/settings.json` to modify hooks. Restart Claude Code after changes.
531
-
532
- ### Dynamic Environment Variables
533
-
534
- Use `scripts/get-env.js` to load environment variables:
535
-
536
- **Create .claude/settings.local.json** (gitignored):
537
- \`\`\`json
538
- {
539
- "env": {
540
- "USER_NAME": "Alice"
541
- }
542
- }
543
- \`\`\`
544
-
545
- **Use in hooks**:
546
- \`\`\`bash
547
- echo "Welcome $(node .agileflow/scripts/get-env.js USER_NAME)!"
548
- \`\`\`
549
- ```
550
-
551
- ## Success Output
552
-
553
- After successful configuration, print:
554
-
555
- ```
556
- ✅ Hooks System Configured!
557
-
558
- Enabled hooks:
559
- {{#if SessionStart}}✅ SessionStart - Welcome display (agileflow-welcome.js){{/if}}
560
- {{#if PreCompact}}✅ PreCompact - Context preservation (precompact-context.sh){{/if}}
561
- {{#if Stop}}✅ Stop - Session wrap-up (agileflow-stop.sh){{/if}}
562
- {{#if UserPromptSubmit}}✅ UserPromptSubmit - Activity logging{{/if}}
563
-
564
- Files created:
565
- ✅ .claude/settings.json - Hooks configuration
566
- {{#if SessionStart}}✅ scripts/agileflow-welcome.js - Welcome display script{{/if}}
567
- {{#if PreCompact}}✅ scripts/precompact-context.sh - Context preservation script{{/if}}
568
- {{#if Stop}}✅ scripts/agileflow-stop.sh - Session wrap-up script{{/if}}
569
- ✅ scripts/get-env.js - Environment variable helper
570
- ✅ .claude/settings.local.example.json - Template for user overrides
571
- ✅ .gitignore updated
572
-
573
- ═══════════════════════════════════════════════════════════
574
- 🔴🔴🔴 RESTART CLAUDE CODE NOW! (CRITICAL - DO NOT SKIP)
575
- Quit completely (Cmd+Q), wait 5 seconds, restart
576
- Hooks ONLY load on startup!
577
- ═══════════════════════════════════════════════════════════
578
-
579
- Test hooks manually:
580
- {{#if SessionStart}} node .agileflow/scripts/agileflow-welcome.js{{/if}}
581
- {{#if PreCompact}} bash .agileflow/scripts/precompact-context.sh{{/if}}
582
- {{#if Stop}} bash .agileflow/scripts/agileflow-stop.sh{{/if}}
583
- ```
584
-
585
- ## Verification (Optional)
586
-
587
- Ask if user wants to verify:
588
-
589
- ```xml
590
- <invoke name="AskUserQuestion">
591
- <parameter name="questions">[{
592
- "question": "Verify hooks configuration?",
593
- "header": "Verify",
594
- "multiSelect": false,
595
- "options": [
596
- {
597
- "label": "Yes, verify now",
598
- "description": "Validate JSON and test scripts"
599
- },
600
- {
601
- "label": "No, skip",
602
- "description": "Assume configuration is correct"
603
- }
604
- ]
605
- }]</parameter>
606
- </invoke>
607
- ```
608
-
609
- If verified:
610
- - Validate `.claude/settings.json` JSON syntax
611
- - Test each enabled script runs without errors
612
- - Report results
613
-
614
- ## Rules
615
-
616
- - USE AskUserQuestion to let user select hooks
617
- - DEPLOY only scripts for selected hooks
618
- - Validate JSON (no trailing commas)
619
- - Show preview before writing files
620
- - Make scripts executable (chmod +x)
621
- - Update .gitignore atomically (check before adding)
622
- - ALWAYS remind user to RESTART Claude Code
623
- - Record version in metadata for upgrade tracking