agileflow 2.77.0 → 2.78.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 (113) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -1
  3. package/scripts/agileflow-configure.js +174 -2
  4. package/scripts/agileflow-statusline.sh +171 -78
  5. package/scripts/agileflow-welcome.js +79 -2
  6. package/scripts/damage-control-bash.js +232 -0
  7. package/scripts/damage-control-edit.js +243 -0
  8. package/scripts/damage-control-write.js +243 -0
  9. package/src/core/agents/accessibility.md +124 -53
  10. package/src/core/agents/adr-writer.md +192 -52
  11. package/src/core/agents/analytics.md +139 -60
  12. package/src/core/agents/api.md +173 -63
  13. package/src/core/agents/ci.md +139 -57
  14. package/src/core/agents/compliance.md +159 -68
  15. package/src/core/agents/configuration/damage-control.md +356 -0
  16. package/src/core/agents/database.md +162 -61
  17. package/src/core/agents/datamigration.md +179 -66
  18. package/src/core/agents/design.md +179 -57
  19. package/src/core/agents/devops.md +160 -3
  20. package/src/core/agents/documentation.md +204 -60
  21. package/src/core/agents/epic-planner.md +147 -55
  22. package/src/core/agents/integrations.md +197 -69
  23. package/src/core/agents/mentor.md +158 -57
  24. package/src/core/agents/mobile.md +159 -67
  25. package/src/core/agents/monitoring.md +154 -65
  26. package/src/core/agents/multi-expert.md +115 -43
  27. package/src/core/agents/orchestrator.md +77 -24
  28. package/src/core/agents/performance.md +130 -75
  29. package/src/core/agents/product.md +151 -55
  30. package/src/core/agents/qa.md +162 -74
  31. package/src/core/agents/readme-updater.md +178 -76
  32. package/src/core/agents/refactor.md +148 -95
  33. package/src/core/agents/research.md +143 -72
  34. package/src/core/agents/security.md +154 -65
  35. package/src/core/agents/testing.md +176 -97
  36. package/src/core/agents/ui.md +170 -79
  37. package/src/core/commands/adr/list.md +171 -0
  38. package/src/core/commands/adr/update.md +235 -0
  39. package/src/core/commands/adr/view.md +252 -0
  40. package/src/core/commands/adr.md +207 -50
  41. package/src/core/commands/agent.md +16 -0
  42. package/src/core/commands/assign.md +148 -44
  43. package/src/core/commands/auto.md +18 -1
  44. package/src/core/commands/babysit.md +361 -36
  45. package/src/core/commands/baseline.md +14 -0
  46. package/src/core/commands/blockers.md +170 -51
  47. package/src/core/commands/board.md +144 -66
  48. package/src/core/commands/changelog.md +15 -0
  49. package/src/core/commands/ci.md +179 -69
  50. package/src/core/commands/compress.md +18 -0
  51. package/src/core/commands/configure.md +16 -0
  52. package/src/core/commands/context/export.md +193 -4
  53. package/src/core/commands/context/full.md +191 -18
  54. package/src/core/commands/context/note.md +248 -4
  55. package/src/core/commands/debt.md +17 -0
  56. package/src/core/commands/deploy.md +208 -65
  57. package/src/core/commands/deps.md +15 -0
  58. package/src/core/commands/diagnose.md +16 -0
  59. package/src/core/commands/docs.md +196 -64
  60. package/src/core/commands/epic/list.md +170 -0
  61. package/src/core/commands/epic/view.md +242 -0
  62. package/src/core/commands/epic.md +192 -69
  63. package/src/core/commands/feedback.md +191 -71
  64. package/src/core/commands/handoff.md +162 -48
  65. package/src/core/commands/help.md +9 -0
  66. package/src/core/commands/ideate.md +446 -0
  67. package/src/core/commands/impact.md +16 -0
  68. package/src/core/commands/metrics.md +141 -37
  69. package/src/core/commands/multi-expert.md +77 -0
  70. package/src/core/commands/packages.md +16 -0
  71. package/src/core/commands/pr.md +161 -67
  72. package/src/core/commands/readme-sync.md +16 -0
  73. package/src/core/commands/research/analyze.md +568 -0
  74. package/src/core/commands/research/ask.md +345 -20
  75. package/src/core/commands/research/import.md +562 -19
  76. package/src/core/commands/research/list.md +173 -5
  77. package/src/core/commands/research/view.md +181 -8
  78. package/src/core/commands/retro.md +135 -48
  79. package/src/core/commands/review.md +219 -47
  80. package/src/core/commands/session/end.md +209 -0
  81. package/src/core/commands/session/history.md +210 -0
  82. package/src/core/commands/session/init.md +116 -0
  83. package/src/core/commands/session/new.md +296 -0
  84. package/src/core/commands/session/resume.md +166 -0
  85. package/src/core/commands/session/status.md +166 -0
  86. package/src/core/commands/skill/create.md +115 -17
  87. package/src/core/commands/skill/delete.md +117 -0
  88. package/src/core/commands/skill/edit.md +104 -0
  89. package/src/core/commands/skill/list.md +128 -0
  90. package/src/core/commands/skill/test.md +135 -0
  91. package/src/core/commands/skill/upgrade.md +542 -0
  92. package/src/core/commands/sprint.md +17 -1
  93. package/src/core/commands/status.md +133 -21
  94. package/src/core/commands/story/list.md +176 -0
  95. package/src/core/commands/story/view.md +265 -0
  96. package/src/core/commands/story-validate.md +101 -1
  97. package/src/core/commands/story.md +204 -51
  98. package/src/core/commands/template.md +16 -1
  99. package/src/core/commands/tests.md +226 -64
  100. package/src/core/commands/update.md +17 -1
  101. package/src/core/commands/validate-expertise.md +16 -0
  102. package/src/core/commands/velocity.md +140 -36
  103. package/src/core/commands/verify.md +14 -0
  104. package/src/core/commands/whats-new.md +30 -0
  105. package/src/core/skills/_learnings/README.md +91 -0
  106. package/src/core/skills/_learnings/_template.yaml +106 -0
  107. package/src/core/skills/_learnings/commit.yaml +69 -0
  108. package/src/core/templates/damage-control-patterns.yaml +234 -0
  109. package/src/core/templates/skill-template.md +53 -11
  110. package/tools/cli/commands/start.js +180 -0
  111. package/tools/cli/tui/Dashboard.js +66 -0
  112. package/tools/cli/tui/StoryList.js +69 -0
  113. package/tools/cli/tui/index.js +16 -0
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  description: Export concise context excerpt for web AI tools
3
3
  argument-hint: (no arguments)
4
+ compact_context:
5
+ priority: medium
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:context:export - Read-only export command"
8
+ - "READ-ONLY: No file writes, no confirmation needed, no state changes"
9
+ - "OUTPUT LIMIT: ≤300 lines maximum for easy pasting into web AI tools"
10
+ - "REQUIRED INPUT: docs/context.md must exist (run /agileflow:context:full first if missing)"
11
+ - "EXTRACT ONLY: overview, focus, tech, decisions, features, next steps (skip progress, notes)"
12
+ - "NO TodoWrite needed - single-step read-only operation"
13
+ state_fields:
14
+ - context_file_exists
15
+ - output_line_count
4
16
  ---
5
17
 
6
18
  # /agileflow:context:export
@@ -18,11 +30,188 @@ Reads `docs/context.md` and outputs a condensed excerpt (≤300 lines) ready to
18
30
  ---
19
31
 
20
32
  <!-- COMPACT_SUMMARY_START -->
21
- ## Compact Summary
22
33
 
23
- **Command**: `/agileflow:context:export`
24
- **Purpose**: Output concise context brief for pasting into web AI tools
25
- **Key Rule**: Read-only, no file writes, ≤300 lines output
34
+ ## ⚠️ COMPACT SUMMARY - /agileflow:context:export IS ACTIVE
35
+
36
+ **CRITICAL**: You are exporting a condensed context brief from `docs/context.md`. Follow these rules EXACTLY.
37
+
38
+ **PURPOSE**: Extract ≤300 line excerpt ready to paste into ChatGPT, Perplexity, Gemini, or Claude web for immediate context loading.
39
+
40
+ ---
41
+
42
+ ### 🚨 RULE #1: READ-ONLY COMMAND
43
+
44
+ **This command NEVER writes, modifies, or changes state:**
45
+ - ✓ Read docs/context.md
46
+ - ✓ Extract and format
47
+ - ✓ Output to code block
48
+ - ✗ NO file writes
49
+ - ✗ NO Edit tool calls
50
+ - ✗ NO confirmation needed
51
+ - ✗ NO state changes
52
+
53
+ **Purpose**: Simple read → extract → display workflow.
54
+
55
+ ---
56
+
57
+ ### 🚨 RULE #2: OUTPUT LIMIT IS STRICT - ≤300 LINES
58
+
59
+ **Maximum output size is 300 lines.** This is critical for pasting into web AI tools.
60
+
61
+ **If context.md is longer:**
62
+ 1. Extract ONLY these sections (in order):
63
+ - What We're Building (overview)
64
+ - Current Focus (active work)
65
+ - Tech Stack (technologies)
66
+ - Key Decisions (ADRs list only, not full descriptions)
67
+ - Feature Map (one-line-per-epic summary)
68
+ - Next Steps (upcoming work)
69
+
70
+ 2. **SKIP these to save space:**
71
+ - Recent Progress (too verbose)
72
+ - Notes section (too long)
73
+ - Detailed story descriptions
74
+ - Full ADR content
75
+
76
+ 3. **Count lines as you extract** - use line counter to stay under 300
77
+
78
+ **Format as:**
79
+ ```markdown
80
+ # Project Context Brief
81
+ Last updated: [timestamp from context.md]
82
+
83
+ ## What We're Building
84
+ [Max 5 lines]
85
+
86
+ ## Current Focus
87
+ [Max 5 lines]
88
+
89
+ ## Tech Stack
90
+ [Max 8 lines]
91
+
92
+ ## Key Decisions
93
+ [Max 10 lines - ADR titles only]
94
+
95
+ ## Feature Map
96
+ [Max 15 lines - one per epic]
97
+
98
+ ## Next Steps
99
+ [Max 15 lines - ready stories only]
100
+ ```
101
+
102
+ ---
103
+
104
+ ### 🚨 RULE #3: REQUIRED INPUT FILE
105
+
106
+ **docs/context.md MUST exist before exporting.**
107
+
108
+ **If missing:**
109
+ ```
110
+ Error: docs/context.md not found.
111
+
112
+ To create it, run: /agileflow:context:full
113
+
114
+ Then you can export with: /agileflow:context:export
115
+ ```
116
+
117
+ **Do NOT create placeholder or fallback - user must run :full first.**
118
+
119
+ ---
120
+
121
+ ### 🚨 RULE #4: EXTRACTION SEQUENCE
122
+
123
+ **Extract in this EXACT order (don't rearrange):**
124
+
125
+ | Step | Section | Source | Max Lines |
126
+ |------|---------|--------|-----------|
127
+ | 1 | Header | "# Project Context Brief" | 1 |
128
+ | 2 | Timestamp | Last updated: [from context.md] | 1 |
129
+ | 3 | What We're Building | From overview section | 5 |
130
+ | 4 | Current Focus | From overview/focus section | 5 |
131
+ | 5 | Tech Stack | From tech section (short list) | 8 |
132
+ | 6 | Key Decisions | From decisions section (titles only) | 10 |
133
+ | 7 | Feature Map | From features section (one per epic) | 15 |
134
+ | 8 | Next Steps | From next section (ready stories) | 15 |
135
+ | 9 | Footer | Paste instructions | 3 |
136
+ | | | **TOTAL** | **≤300** |
137
+
138
+ ---
139
+
140
+ ### 🚨 RULE #5: CONTENT CONDENSING RULES
141
+
142
+ **When extracting, apply these rules to stay under limit:**
143
+
144
+ | Element | Full Size | Condensed Size | Rule |
145
+ |---------|-----------|----------------|------|
146
+ | ADRs | Full description | Title + status only | "ADR-001: Feature X (Accepted)" |
147
+ | Stories | Title + description | Title + status | "US-0042 (in-progress)" |
148
+ | Tech | Full list + versions | Framework + key deps only | "Next.js 16, TensorFlow.js, Tailwind" |
149
+ | Epics | Title + stories list | Title + story count + status | "EP-001: Auth (3 stories, 1 done)" |
150
+ | Decisions | Full context | One-liner | "JWT instead of sessions" |
151
+
152
+ ---
153
+
154
+ ### 🚨 RULE #6: OUTPUT FORMAT IS EXACT
155
+
156
+ **Always output in code block for easy copying:**
157
+
158
+ ```
159
+ markdown
160
+ # Project Context Brief
161
+ Last updated: [ISO timestamp]
162
+
163
+ [Extracted sections...]
164
+
165
+ ---
166
+ **Paste this into**: ChatGPT, Perplexity, Gemini, or Claude web
167
+ **Purpose**: Load full project context for AI assistance
168
+ **Limit**: This excerpt is ≤300 lines for easy pasting
169
+ ```
170
+
171
+ **DO NOT output as plain text, tables, or separate sections - use single code block for easy selection and copy.**
172
+
173
+ ---
174
+
175
+ ### KEY FILES & STATE TO REMEMBER
176
+
177
+ | File/State | Purpose | Notes |
178
+ |-----------|---------|-------|
179
+ | docs/context.md | Source file | Must exist, read-only |
180
+ | Output limit | Max 300 lines | Count carefully |
181
+ | Line counter | Track total | Update as you extract |
182
+ | Code block | Output format | For easy copy-paste |
183
+
184
+ ---
185
+
186
+ ### ANTI-PATTERNS & CORRECT PATTERNS
187
+
188
+ ❌ **DON'T**: Modify docs/context.md
189
+ ✅ **DO**: Read-only extract only
190
+
191
+ ❌ **DON'T**: Output >300 lines
192
+ ✅ **DO**: Condense to fit limit
193
+
194
+ ❌ **DON'T**: Include full ADR descriptions
195
+ ✅ **DO**: ADR titles + status only
196
+
197
+ ❌ **DON'T**: Include progress/notes sections
198
+ ✅ **DO**: Overview, focus, tech, decisions, features, next only
199
+
200
+ ❌ **DON'T**: Output as plain text
201
+ ✅ **DO**: Single markdown code block for copy-paste
202
+
203
+ ---
204
+
205
+ ### REMEMBER AFTER COMPACTION
206
+
207
+ After this command completes:
208
+ - ✓ Excerpt extracted from docs/context.md (read-only)
209
+ - ✓ Output ≤300 lines (verified count)
210
+ - ✓ Formatted in markdown code block
211
+ - ✓ Ready to paste into ChatGPT, Perplexity, Gemini, Claude web
212
+ - ✓ Use `/agileflow:context:full` to regenerate docs/context.md
213
+ - ✓ Use `/agileflow:context:note` to add timestamped notes to context.md
214
+
26
215
  <!-- COMPACT_SUMMARY_END -->
27
216
 
28
217
  ---
@@ -1,6 +1,21 @@
1
1
  ---
2
2
  description: Generate/refresh full context brief for web AI tools
3
3
  argument-hint: (no arguments)
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:context:full - Generates docs/context.md for external AI tools"
8
+ - "ALWAYS create TodoWrite list for multi-step workflow tracking"
9
+ - "ALWAYS show diff BEFORE ANY file writes - wait for YES/NO confirmation"
10
+ - "PRESERVE user-written content - only update sections between MANAGED_SECTION markers"
11
+ - "REQUIRED SOURCES: status.json, bus/log.jsonl, epics, stories, ADRs, practices, architecture, CI, CHANGELOG"
12
+ - "MANAGED SECTIONS: overview, features, tech, decisions, progress, next"
13
+ - "DIFF-FIRST PATTERN: Read → Gather → Generate → Show diff → Confirm → Apply"
14
+ state_fields:
15
+ - context_sources
16
+ - managed_sections
17
+ - user_content_preserved
18
+ - user_confirmation
4
19
  ---
5
20
 
6
21
  # /agileflow:context:full
@@ -24,24 +39,182 @@ This file is designed to be pasted into ChatGPT, Perplexity, Gemini, or Claude w
24
39
  ---
25
40
 
26
41
  <!-- COMPACT_SUMMARY_START -->
27
- ## Compact Summary
28
-
29
- **Command**: `/agileflow:context:full`
30
- **Purpose**: Generate/refresh docs/context.md with project context for web AI tools
31
-
32
- ### Critical Rules
33
- - **ALWAYS create TodoWrite list** to track multi-step workflow
34
- - **Diff-first**: Show changes and wait for YES/NO before ANY file writes
35
- - **Preserve user-written content**: Only update managed sections
36
- - **Sources**: status.json, bus/log.jsonl, epics, stories, ADRs, practices, architecture, CI, CHANGELOG
37
-
38
- ### Workflow
39
- 1. Create todo list
40
- 2. Read existing docs/context.md (if exists)
41
- 3. Gather sources
42
- 4. Generate/update managed sections
43
- 5. Show diff for review
44
- 6. Apply changes after YES
42
+
43
+ ## ⚠️ COMPACT SUMMARY - /agileflow:context:full IS ACTIVE
44
+
45
+ **CRITICAL**: You are generating `docs/context.md` for external AI tools. Follow these rules EXACTLY.
46
+
47
+ **PURPOSE**: Create comprehensive context brief with managed sections that external AI tools (ChatGPT, Claude web, Perplexity) can paste for full project understanding.
48
+
49
+ ---
50
+
51
+ ### 🚨 RULE #1: ALWAYS START WITH TodoWrite LIST
52
+
53
+ **Before ANY gathering, create TodoWrite to track workflow:**
54
+
55
+ ```xml
56
+ <invoke name="TodoWrite">
57
+ <parameter name="todos">[
58
+ {"content": "Read existing docs/context.md", "status": "in_progress", "activeForm": "Reading context file"},
59
+ {"content": "Gather sources (status.json, bus, epics, ADRs, practices, architecture, CI, CHANGELOG)", "status": "pending", "activeForm": "Gathering sources"},
60
+ {"content": "Generate/update managed sections (6 sections)", "status": "pending", "activeForm": "Generating sections"},
61
+ {"content": "Show diff for review", "status": "pending", "activeForm": "Showing diff"},
62
+ {"content": "Apply changes after YES confirmation", "status": "pending", "activeForm": "Applying changes"}
63
+ ]</parameter>
64
+ </invoke>
65
+ ```
66
+
67
+ **NEVER skip this.** It's how we track multi-step work.
68
+
69
+ ---
70
+
71
+ ### 🚨 RULE #2: DIFF-FIRST - ALWAYS SHOW CHANGES BEFORE WRITING
72
+
73
+ **Workflow sequence is NON-NEGOTIABLE:**
74
+ 1. **Read** existing `docs/context.md` (if exists) - identify user vs managed content
75
+ 2. **Gather** all source files (see REQUIRED SOURCES below)
76
+ 3. **Generate** new managed sections
77
+ 4. **Show diff** - display exactly what changed (use diff format)
78
+ 5. **Confirm** - call AskUserQuestion: "Apply these changes?"
79
+ 6. **Apply** - only after YES, write to file using Edit tool
80
+
81
+ **❌ WRONG:** Write changes without showing diff first
82
+ **✅ RIGHT:** Show diff, wait for YES, then write
83
+
84
+ ---
85
+
86
+ ### 🚨 RULE #3: PRESERVE USER-WRITTEN CONTENT
87
+
88
+ **MANAGED SECTIONS are within markers:**
89
+ ```markdown
90
+ <!-- MANAGED_SECTION: overview -->
91
+ [Content here - OK to update]
92
+ <!-- END_MANAGED -->
93
+ ```
94
+
95
+ **USER-WRITTEN SECTIONS have no markers:**
96
+ ```markdown
97
+ ## My Custom Section
98
+ [Content here - NEVER touch this]
99
+ ```
100
+
101
+ **Rules for updating:**
102
+ - Only modify content between `<!-- MANAGED_SECTION: X -->` markers
103
+ - NEVER delete or modify sections without markers
104
+ - If user has added custom sections outside markers, preserve them
105
+ - If user section conflicts with managed section, show diff and ask
106
+
107
+ ---
108
+
109
+ ### 🚨 RULE #4: REQUIRED SOURCES & MANAGED SECTIONS
110
+
111
+ **Required source files (gather ALL, even if missing):**
112
+ ```
113
+ docs/09-agents/status.json # Current story/epic status (REQUIRED)
114
+ docs/09-agents/bus/log.jsonl # Last 10 progress messages (REQUIRED)
115
+ docs/05-epics/*.md # Epic details (if exists)
116
+ docs/06-stories/*/*.md # Story details (if exists)
117
+ docs/03-decisions/*.md # ADRs (if exists)
118
+ docs/02-practices/*.md # Development practices (if exists)
119
+ docs/04-architecture/*.md # System architecture (if exists)
120
+ package.json / pyproject.toml # Project manifest (for tech stack)
121
+ .github/workflows/*.yml # CI config (if exists)
122
+ CHANGELOG.md # Recent changes (if exists)
123
+ ```
124
+
125
+ **Managed sections to generate (6 total):**
126
+
127
+ | Section | Source | Purpose | Max Lines |
128
+ |---------|--------|---------|-----------|
129
+ | **overview** | README, package.json | What we're building + current focus | 10 |
130
+ | **features** | status.json epics | Epic map with story counts | 20 |
131
+ | **tech** | package.json, workflows | Tech stack and dependencies | 15 |
132
+ | **decisions** | ADRs directory | Key ADRs with status | 15 |
133
+ | **progress** | bus/log.jsonl | Last 10 bus messages (chronological) | 30 |
134
+ | **next** | status.json | Ready/in-progress stories | 20 |
135
+
136
+ ---
137
+
138
+ ### 🚨 RULE #5: HANDLING MISSING FILES
139
+
140
+ **If file doesn't exist, DON'T ERROR - adapt:**
141
+
142
+ | Missing File | Action |
143
+ |--------------|--------|
144
+ | `docs/context.md` | Create new file with all sections |
145
+ | `status.json` | Skip features/next sections, leave placeholders |
146
+ | `bus/log.jsonl` | Skip progress section |
147
+ | `ADR files` | Skip decisions section |
148
+ | `CI config` | Skip CI details from tech section |
149
+
150
+ **Placeholder format for missing sections:**
151
+ ```markdown
152
+ <!-- MANAGED_SECTION: features -->
153
+ No epics found. Create epics in docs/05-epics/ to populate this section.
154
+ <!-- END_MANAGED -->
155
+ ```
156
+
157
+ ---
158
+
159
+ ### 🚨 RULE #6: CONFIRMATION BEFORE WRITING
160
+
161
+ **Always use AskUserQuestion before Edit:**
162
+
163
+ ```xml
164
+ <invoke name="AskUserQuestion">
165
+ <parameter name="questions">[{
166
+ "question": "Apply these changes to docs/context.md?",
167
+ "header": "Confirm Context Update",
168
+ "multiSelect": false,
169
+ "options": [
170
+ {"label": "Yes, update", "description": "Write changes to file"},
171
+ {"label": "No, abort", "description": "Cancel without saving"}
172
+ ]
173
+ }]</parameter>
174
+ </invoke>
175
+ ```
176
+
177
+ **Only call Edit tool if response is YES.**
178
+
179
+ ---
180
+
181
+ ### KEY FILES & STATE TO REMEMBER
182
+
183
+ | File/State | Purpose | Path |
184
+ |-----------|---------|------|
185
+ | Managed source | List of files to read | Required sources (Rule 4) |
186
+ | Diff display | What's changing | Show before confirm |
187
+ | User confirmation | Gate before writing | YES = write, NO = cancel |
188
+ | Managed sections | Content to update | 6 sections (overview, features, tech, decisions, progress, next) |
189
+ | File markers | Protect user content | Between `<!-- MANAGED_SECTION: X -->` markers |
190
+
191
+ ---
192
+
193
+ ### ANTI-PATTERNS & CORRECT PATTERNS
194
+
195
+ ❌ **DON'T**: Write directly without diff
196
+ ✅ **DO**: Show diff → ask → write
197
+
198
+ ❌ **DON'T**: Modify user-written content
199
+ ✅ **DO**: Only touch content between MANAGED_SECTION markers
200
+
201
+ ❌ **DON'T**: Skip gathering if file missing
202
+ ✅ **DO**: Gather what exists, use placeholders for missing
203
+
204
+ ❌ **DON'T**: Create context.md without section markers
205
+ ✅ **DO**: All managed content wrapped in `<!-- MANAGED_SECTION: X -->` markers
206
+
207
+ ---
208
+
209
+ ### REMEMBER AFTER COMPACTION
210
+
211
+ After this command completes:
212
+ - ✓ docs/context.md created/updated with managed sections
213
+ - ✓ User-written content preserved (outside markers untouched)
214
+ - ✓ File ready for pasting into ChatGPT, Perplexity, Gemini, Claude web
215
+ - ✓ Use `/agileflow:context:export` to get ≤300 line excerpt for pasting
216
+ - ✓ Use `/agileflow:context:note` to add quick timestamped notes
217
+
45
218
  <!-- COMPACT_SUMMARY_END -->
46
219
 
47
220
  ---
@@ -1,6 +1,21 @@
1
1
  ---
2
2
  description: Add timestamped note to context file
3
3
  argument-hint: NOTE=<text>
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:context:note NOTE=\"text\" - Append timestamped note to docs/context.md"
8
+ - "ALWAYS show diff BEFORE applying changes - wait for YES/NO confirmation"
9
+ - "REQUIRED ARGUMENT: NOTE must be provided (ask user if missing)"
10
+ - "AUTO-CREATE: Creates Notes section if missing, appends note to end"
11
+ - "ISO TIMESTAMP: Always use ISO 8601 format for timestamps"
12
+ - "PRESERVE: Creates docs/context.md if missing (don't error, create it)"
13
+ - "CHRONOLOGICAL ORDER: Notes appear in order added (newest at bottom)"
14
+ state_fields:
15
+ - note_text
16
+ - context_file_exists
17
+ - notes_section_exists
18
+ - user_confirmation
4
19
  ---
5
20
 
6
21
  # /agileflow:context:note
@@ -16,11 +31,240 @@ Quickly add a note to `docs/context.md` under the "Notes" section. Useful for re
16
31
  ---
17
32
 
18
33
  <!-- COMPACT_SUMMARY_START -->
19
- ## Compact Summary
20
34
 
21
- **Command**: `/agileflow:context:note NOTE="your note here"`
22
- **Purpose**: Append timestamped note to docs/context.md
23
- **Key Rules**: Diff-first, creates Notes section if missing
35
+ ## ⚠️ COMPACT SUMMARY - /agileflow:context:note IS ACTIVE
36
+
37
+ **CRITICAL**: You are appending a timestamped note to `docs/context.md`. Follow these rules EXACTLY.
38
+
39
+ **PURPOSE**: Quickly record decisions, observations, and reminders as timestamped notes that persist in project context.
40
+
41
+ ---
42
+
43
+ ### 🚨 RULE #1: REQUIRE NOTE ARGUMENT
44
+
45
+ **The NOTE argument is MANDATORY.**
46
+
47
+ **If not provided, ask user:**
48
+
49
+ ```xml
50
+ <invoke name="AskUserQuestion">
51
+ <parameter name="questions">[{
52
+ "question": "What note would you like to add to docs/context.md?",
53
+ "header": "Enter note text",
54
+ "multiSelect": false,
55
+ "options": [
56
+ {"label": "Enter note (use 'Other' field)", "description": "Type your 1-5 line note"}
57
+ ]
58
+ }]</parameter>
59
+ </invoke>
60
+ ```
61
+
62
+ **Then extract the user's text from response and proceed.**
63
+
64
+ **Examples of good notes:**
65
+ ```
66
+ "Decided to use JWT instead of sessions"
67
+ "User reported auth bug in production, investigating now"
68
+ "Sprint planning: focusing on US-0042 and US-0045 this week"
69
+ "Performance issue fixed: reduced API response time by 40%"
70
+ "Stakeholder meeting: new feature request added to backlog"
71
+ ```
72
+
73
+ ---
74
+
75
+ ### 🚨 RULE #2: AUTO-CREATE MISSING FILES
76
+
77
+ **If docs/context.md doesn't exist, CREATE it with Notes section:**
78
+
79
+ ```markdown
80
+ # Project Context
81
+
82
+ <!-- MANAGED_SECTION: placeholder -->
83
+ Run /agileflow:context:full to populate project context.
84
+ <!-- END_MANAGED -->
85
+
86
+ ## Notes
87
+
88
+ [Notes will appear here]
89
+ ```
90
+
91
+ **Do NOT error or skip. Create the file and add the note.**
92
+
93
+ ---
94
+
95
+ ### 🚨 RULE #3: FIND OR CREATE NOTES SECTION
96
+
97
+ **Workflow:**
98
+ 1. Read docs/context.md
99
+ 2. Look for `## Notes` section
100
+ 3. If NOT found, CREATE it at the end of the file:
101
+
102
+ ```markdown
103
+
104
+ ## Notes
105
+ ```
106
+
107
+ 4. If found, position cursor after last note
108
+
109
+ **Append format (ALWAYS use this):**
110
+ ```markdown
111
+ - **[ISO_TIMESTAMP]**: Note text here
112
+ ```
113
+
114
+ **Example:**
115
+ ```markdown
116
+ ## Notes
117
+
118
+ - **[2024-12-31T10:30:00Z]**: Decided to use JWT instead of sessions
119
+ - **[2024-12-31T15:45:00Z]**: User reported auth bug in production
120
+ - **[2025-01-01T09:00:00Z]**: Sprint planning: focusing on US-0042 this week
121
+ ```
122
+
123
+ ---
124
+
125
+ ### 🚨 RULE #4: ALWAYS DIFF-FIRST
126
+
127
+ **NEVER write directly. Always show changes first:**
128
+
129
+ 1. **Read** docs/context.md (or create new)
130
+ 2. **Find/Create** Notes section
131
+ 3. **Generate** new note with ISO timestamp
132
+ 4. **Show diff** (display exactly what changed)
133
+ 5. **Confirm** (ask user: "Add this note?")
134
+ 6. **Apply** (only after YES, write using Edit tool)
135
+
136
+ **Diff format:**
137
+ ```diff
138
+ ## Notes
139
+
140
+ - **[2024-12-31T10:30:00Z]**: Old note here
141
+ + - **[2025-01-07T14:22:00Z]**: New note being added
142
+ ```
143
+
144
+ ---
145
+
146
+ ### 🚨 RULE #5: ISO 8601 TIMESTAMP FORMAT
147
+
148
+ **ALWAYS use ISO 8601 format for all timestamps.**
149
+
150
+ **Format**: `YYYY-MM-DDTHH:MM:SSZ` (UTC/Zulu time)
151
+
152
+ **Examples:**
153
+ - `2024-12-31T10:30:00Z` - correct
154
+ - `2025-01-07T15:45:30Z` - correct
155
+ - `12/31/2024 3:30 PM` - WRONG (not ISO)
156
+ - `Jan 7, 2025 3:45 PM` - WRONG (not ISO)
157
+
158
+ **To get current timestamp in JavaScript:**
159
+ ```javascript
160
+ new Date().toISOString() // Returns "2025-01-07T14:22:18.123Z"
161
+ // Remove milliseconds: "2025-01-07T14:22:18Z"
162
+ ```
163
+
164
+ ---
165
+
166
+ ### 🚨 RULE #6: CONFIRMATION BEFORE WRITING
167
+
168
+ **Always use AskUserQuestion before Edit:**
169
+
170
+ ```xml
171
+ <invoke name="AskUserQuestion">
172
+ <parameter name="questions">[{
173
+ "question": "Add this note to docs/context.md?",
174
+ "header": "Confirm Note Addition",
175
+ "multiSelect": false,
176
+ "options": [
177
+ {"label": "Yes, add note", "description": "Append note to Notes section"},
178
+ {"label": "No, cancel", "description": "Cancel without saving"}
179
+ ]
180
+ }]</parameter>
181
+ </invoke>
182
+ ```
183
+
184
+ **Only call Edit tool if response is YES.**
185
+
186
+ ---
187
+
188
+ ### KEY FILES & STATE TO REMEMBER
189
+
190
+ | File/State | Purpose | Format |
191
+ |-----------|---------|--------|
192
+ | docs/context.md | Target file | Markdown with Notes section |
193
+ | Notes section | Append location | `## Notes` header at end |
194
+ | Timestamp | Each note | ISO 8601: `YYYY-MM-DDTHH:MM:SSZ` |
195
+ | Note format | Structure | `- **[timestamp]**: note text` |
196
+ | Diff display | Review before confirm | Show change with context lines |
197
+ | User confirmation | Gate before write | YES = write, NO = cancel |
198
+
199
+ ---
200
+
201
+ ### WORKFLOW SEQUENCE
202
+
203
+ **This is the EXACT workflow:**
204
+
205
+ ```
206
+ 1. Validate NOTE argument provided
207
+ ├─ If missing: AskUserQuestion for note text
208
+ └─ If provided: Use provided value
209
+
210
+ 2. Read docs/context.md
211
+ ├─ If missing: Create new file with placeholder
212
+ └─ If exists: Read entire file
213
+
214
+ 3. Find or Create Notes section
215
+ ├─ If found: Position after last note
216
+ └─ If missing: Add at end of file
217
+
218
+ 4. Generate note entry
219
+ ├─ Get current ISO timestamp
220
+ ├─ Format: "- **[timestamp]**: note text"
221
+ └─ Store as pending_entry
222
+
223
+ 5. Show diff to user
224
+ ├─ Display before/after
225
+ └─ Add context lines
226
+
227
+ 6. Confirm with AskUserQuestion
228
+ ├─ If YES: Go to step 7
229
+ └─ If NO: Exit, don't write
230
+
231
+ 7. Apply change using Edit tool
232
+ ├─ Call Edit with old_string and new_string
233
+ └─ Done
234
+ ```
235
+
236
+ ---
237
+
238
+ ### ANTI-PATTERNS & CORRECT PATTERNS
239
+
240
+ ❌ **DON'T**: Write note without showing diff
241
+ ✅ **DO**: Show diff → confirm → write
242
+
243
+ ❌ **DON'T**: Error if docs/context.md missing
244
+ ✅ **DO**: Create file with placeholder, add note
245
+
246
+ ❌ **DON'T**: Use non-ISO timestamp format
247
+ ✅ **DO**: Use `YYYY-MM-DDTHH:MM:SSZ` format
248
+
249
+ ❌ **DON'T**: Skip creating Notes section
250
+ ✅ **DO**: Create `## Notes` if missing, append notes there
251
+
252
+ ❌ **DON'T**: Use custom timestamp format
253
+ ✅ **DO**: All notes use same ISO format (consistent ordering)
254
+
255
+ ---
256
+
257
+ ### REMEMBER AFTER COMPACTION
258
+
259
+ After this command completes:
260
+ - ✓ Note appended to docs/context.md (diff shown first)
261
+ - ✓ ISO 8601 timestamp added automatically
262
+ - ✓ Notes section created if missing
263
+ - ✓ Note visible in `/agileflow:context:export` (if space allows)
264
+ - ✓ Notes persist across sessions
265
+ - ✓ Use `/agileflow:context:full` to regenerate managed sections
266
+ - ✓ Use `/agileflow:context:export` to get excerpt for pasting
267
+
24
268
  <!-- COMPACT_SUMMARY_END -->
25
269
 
26
270
  ---