orchestr8 2.6.1 → 2.7.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 (46) hide show
  1. package/.blueprint/agents/AGENT_BA_CASS.md +2 -112
  2. package/.blueprint/agents/AGENT_DEVELOPER_CODEY.md +1 -40
  3. package/.blueprint/agents/AGENT_SPECIFICATION_ALEX.md +1 -40
  4. package/.blueprint/agents/AGENT_TESTER_NIGEL.md +3 -51
  5. package/.blueprint/agents/GUARDRAILS.md +42 -0
  6. package/.blueprint/features/feature_compressed-feedback/FEATURE_SPEC.md +136 -0
  7. package/.blueprint/features/feature_compressed-feedback/IMPLEMENTATION_PLAN.md +40 -0
  8. package/.blueprint/features/feature_lazy-business-context/FEATURE_SPEC.md +140 -0
  9. package/.blueprint/features/feature_lazy-business-context/IMPLEMENTATION_PLAN.md +54 -0
  10. package/.blueprint/features/feature_model-native-features/FEATURE_SPEC.md +174 -0
  11. package/.blueprint/features/feature_model-native-features/IMPLEMENTATION_PLAN.md +45 -0
  12. package/.blueprint/features/feature_shared-guardrails/FEATURE_SPEC.md +119 -0
  13. package/.blueprint/features/feature_shared-guardrails/IMPLEMENTATION_PLAN.md +34 -0
  14. package/.blueprint/features/feature_shared-guardrails/story-extract-guardrails.md +60 -0
  15. package/.blueprint/features/feature_shared-guardrails/story-update-init-commands.md +63 -0
  16. package/.blueprint/features/feature_slim-agent-prompts/FEATURE_SPEC.md +145 -0
  17. package/.blueprint/features/feature_slim-agent-prompts/IMPLEMENTATION_PLAN.md +87 -0
  18. package/.blueprint/features/feature_slim-agent-prompts/story-create-runtime-prompt-template.md +59 -0
  19. package/.blueprint/features/feature_slim-agent-prompts/story-create-slim-agent-prompts.md +65 -0
  20. package/.blueprint/features/feature_slim-agent-prompts/story-skill-integration.md +53 -0
  21. package/.blueprint/features/feature_smart-story-routing/FEATURE_SPEC.md +147 -0
  22. package/.blueprint/features/feature_smart-story-routing/IMPLEMENTATION_PLAN.md +73 -0
  23. package/.blueprint/features/feature_template-extraction/FEATURE_SPEC.md +134 -0
  24. package/.blueprint/features/feature_template-extraction/IMPLEMENTATION_PLAN.md +46 -0
  25. package/.blueprint/features/feature_upstream-summaries/FEATURE_SPEC.md +150 -0
  26. package/.blueprint/features/feature_upstream-summaries/IMPLEMENTATION_PLAN.md +70 -0
  27. package/.blueprint/prompts/TEMPLATE.md +65 -0
  28. package/.blueprint/prompts/alex-runtime.md +48 -0
  29. package/.blueprint/prompts/cass-runtime.md +45 -0
  30. package/.blueprint/prompts/codey-implement-runtime.md +50 -0
  31. package/.blueprint/prompts/codey-plan-runtime.md +46 -0
  32. package/.blueprint/prompts/nigel-runtime.md +46 -0
  33. package/.blueprint/templates/STORY_TEMPLATE.md +96 -0
  34. package/.blueprint/templates/TEST_TEMPLATE.md +76 -0
  35. package/README.md +82 -18
  36. package/SKILL.md +180 -80
  37. package/package.json +1 -1
  38. package/src/business-context.js +91 -0
  39. package/src/classifier.js +173 -0
  40. package/src/feedback.js +47 -17
  41. package/src/handoff.js +148 -0
  42. package/src/index.js +51 -1
  43. package/src/tools/index.js +27 -0
  44. package/src/tools/prompts.js +45 -0
  45. package/src/tools/schemas.js +38 -0
  46. package/src/tools/validation.js +83 -0
@@ -179,77 +179,7 @@ Explicitly list what is **out of scope** and why deferral is safe.
179
179
 
180
180
  ## User story template
181
181
 
182
- ```markdown
183
- # Screen [N] — [Title]
184
-
185
- ## User story
186
- As a [role], I want [capability] so that [benefit].
187
-
188
- ---
189
-
190
- ## Context / scope
191
- - Professional user (Solicitor)
192
- - England standard possession claim
193
- - Screen is reached when: [entry condition]
194
- - Route:
195
- - `GET /claims/[route-name]`
196
- - `POST /claims/[route-name]`
197
- - This screen captures: [what data]
198
-
199
- ---
200
-
201
- ## Acceptance criteria
202
-
203
- **AC-1 — [Short description]**
204
- - Given [precondition],
205
- - When [action],
206
- - Then [expected result].
207
-
208
- **AC-2 — [Short description]**
209
- - Given [precondition],
210
- - When [action],
211
- - Then [expected result].
212
-
213
- <!-- Continue with AC-3, AC-4, etc. -->
214
-
215
- **AC-N — Previous navigation**
216
- - Given I click Previous,
217
- - Then I am returned to [previous route]
218
- - And any entered data is preserved in session.
219
-
220
- **AC-N+1 — Continue navigation**
221
- - Given I click Continue and validation passes,
222
- - Then I am redirected to [next route].
223
-
224
- **AC-N+2 — Cancel behaviour**
225
- - Given I click Cancel,
226
- - Then I am returned to /case-list
227
- - And the claim draft remains stored in session.
228
-
229
- **AC-N+3 — Accessibility compliance**
230
- - Given validation errors occur,
231
- - Then:
232
- - a GOV.UK error summary is displayed at the top of the page,
233
- - errors link to the relevant field,
234
- - focus moves to the error summary,
235
- - and all inputs are properly labelled and keyboard accessible.
236
-
237
- ---
238
-
239
- ## Session persistence
240
-
241
- ```js
242
- session.claim.fieldName = {
243
- property: 'value' | null
244
- }
245
- ```
246
-
247
- ---
248
-
249
- ## Out of scope
250
- - [Item 1]
251
- - [Item 2]
252
- ```
182
+ See: `.blueprint/templates/STORY_TEMPLATE.md`
253
183
 
254
184
  ---
255
185
 
@@ -382,44 +312,4 @@ You have done your job well when:
382
312
 
383
313
  ## Guardrails
384
314
 
385
- ### Allowed Sources
386
- You may use ONLY information from these sources:
387
- - System specification (`.blueprint/system_specification/SYSTEM_SPEC.md`)
388
- - Feature specifications (`.blueprint/features/*/FEATURE_SPEC.md`)
389
- - User stories (`story-*.md`) and test artifacts (`test-spec.md`, `*.test.js`)
390
- - Implementation code in the project
391
- - Business context (`.business_context/*`)
392
- - Templates (`.blueprint/templates/*`) and agent specifications
393
-
394
- ### Prohibited Sources
395
- Do not use:
396
- - Social media, forums, blog posts, or external APIs
397
- - Training data for domain facts—do not invent business rules
398
- - External project or company references by name
399
-
400
- ### Citation Requirements
401
- - Cite sources using: "Per [filename]: [claim]" or "[filename:section] states..."
402
- - Use section-level citations where feasible (e.g., "story-login.md:AC-3")
403
- - Reference `.business_context/` files for domain definitions
404
- - Maintain a traceable chain: downstream artifacts cite upstream sources
405
-
406
- ### Assumptions vs Facts
407
- - Label assumptions explicitly: "ASSUMPTION: [statement]" or "NOTE: Assuming..."
408
- - Distinguish clearly between cited facts and assumptions
409
- - Do not guess—state "This information is not available in the provided inputs"
410
-
411
- ### Confidentiality
412
- - Do not reproduce `.business_context/` content verbatim; summarise or use generic descriptions
413
- - Do not reference external entities, companies, or projects by name
414
- - Do not use external services that would expose project data
415
- - Outputs must be self-contained and understandable without access to confidential sources
416
-
417
- ### Escalation Protocol
418
- Escalate to the user when:
419
- - Critical information is missing and cannot be safely assumed
420
- - Inputs are ambiguous with multiple possible interpretations—list options and ask for clarification
421
- - Source documents conflict—cite both sources and request resolution
422
- - Output would require violating confidentiality constraints
423
-
424
- When escalation is not warranted, you may proceed with an explicit assumption labelled as such.
425
-
315
+ Read and apply the shared guardrails from: `.blueprint/agents/GUARDRAILS.md`
@@ -425,43 +425,4 @@ By following this guide, Codey and Nigel can work together in a tight loop: Nige
425
425
 
426
426
  ## Guardrails
427
427
 
428
- ### Allowed Sources
429
- You may use ONLY information from these sources:
430
- - System specification (`.blueprint/system_specification/SYSTEM_SPEC.md`)
431
- - Feature specifications (`.blueprint/features/*/FEATURE_SPEC.md`)
432
- - User stories (`story-*.md`) and test artifacts (`test-spec.md`, `*.test.js`)
433
- - Implementation code in the project
434
- - Business context (`.business_context/*`)
435
- - Templates (`.blueprint/templates/*`) and agent specifications
436
-
437
- ### Prohibited Sources
438
- Do not use:
439
- - Social media, forums, blog posts, or external APIs
440
- - Training data for domain facts—do not invent business rules
441
- - External project or company references by name
442
-
443
- ### Citation Requirements
444
- - Cite sources using: "Per [filename]: [claim]" or "[filename:section] states..."
445
- - Use section-level citations where feasible (e.g., "story-login.md:AC-3")
446
- - Reference `.business_context/` files for domain definitions
447
- - Maintain a traceable chain: downstream artifacts cite upstream sources
448
-
449
- ### Assumptions vs Facts
450
- - Label assumptions explicitly: "ASSUMPTION: [statement]" or "NOTE: Assuming..."
451
- - Distinguish clearly between cited facts and assumptions
452
- - Do not guess—state "This information is not available in the provided inputs"
453
-
454
- ### Confidentiality
455
- - Do not reproduce `.business_context/` content verbatim; summarise or use generic descriptions
456
- - Do not reference external entities, companies, or projects by name
457
- - Do not use external services that would expose project data
458
- - Outputs must be self-contained and understandable without access to confidential sources
459
-
460
- ### Escalation Protocol
461
- Escalate to the user when:
462
- - Critical information is missing and cannot be safely assumed
463
- - Inputs are ambiguous with multiple possible interpretations—list options and ask for clarification
464
- - Source documents conflict—cite both sources and request resolution
465
- - Output would require violating confidentiality constraints
466
-
467
- When escalation is not warranted, you may proceed with an explicit assumption labelled as such.
428
+ Read and apply the shared guardrails from: `.blueprint/agents/GUARDRAILS.md`
@@ -168,43 +168,4 @@ He ensures that what gets built is:
168
168
 
169
169
  ## Guardrails
170
170
 
171
- ### Allowed Sources
172
- You may use ONLY information from these sources:
173
- - System specification (`.blueprint/system_specification/SYSTEM_SPEC.md`)
174
- - Feature specifications (`.blueprint/features/*/FEATURE_SPEC.md`)
175
- - User stories (`story-*.md`) and test artifacts (`test-spec.md`, `*.test.js`)
176
- - Implementation code in the project
177
- - Business context (`.business_context/*`)
178
- - Templates (`.blueprint/templates/*`) and agent specifications
179
-
180
- ### Prohibited Sources
181
- Do not use:
182
- - Social media, forums, blog posts, or external APIs
183
- - Training data for domain facts—do not invent business rules
184
- - External project or company references by name
185
-
186
- ### Citation Requirements
187
- - Cite sources using: "Per [filename]: [claim]" or "[filename:section] states..."
188
- - Use section-level citations where feasible (e.g., "story-login.md:AC-3")
189
- - Reference `.business_context/` files for domain definitions
190
- - Maintain a traceable chain: downstream artifacts cite upstream sources
191
-
192
- ### Assumptions vs Facts
193
- - Label assumptions explicitly: "ASSUMPTION: [statement]" or "NOTE: Assuming..."
194
- - Distinguish clearly between cited facts and assumptions
195
- - Do not guess—state "This information is not available in the provided inputs"
196
-
197
- ### Confidentiality
198
- - Do not reproduce `.business_context/` content verbatim; summarise or use generic descriptions
199
- - Do not reference external entities, companies, or projects by name
200
- - Do not use external services that would expose project data
201
- - Outputs must be self-contained and understandable without access to confidential sources
202
-
203
- ### Escalation Protocol
204
- Escalate to the user when:
205
- - Critical information is missing and cannot be safely assumed
206
- - Inputs are ambiguous with multiple possible interpretations—list options and ask for clarification
207
- - Source documents conflict—cite both sources and request resolution
208
- - Output would require violating confidentiality constraints
209
-
210
- When escalation is not warranted, you may proceed with an explicit assumption labelled as such.
171
+ Read and apply the shared guardrails from: `.blueprint/agents/GUARDRAILS.md`
@@ -52,17 +52,9 @@ If critical information is missing or ambiguous, you should:
52
52
 
53
53
  **IMPORTANT: Write files ONE AT A TIME to avoid token limits.**
54
54
 
55
- Produce exactly 2 files:
55
+ Produce exactly 2 files: **test-spec.md** and an **executable test file**.
56
56
 
57
- 1. **test-spec.md** (write FIRST, keep under 100 lines)
58
- - Brief understanding (5-10 lines max)
59
- - AC → Test ID mapping table (compact format)
60
- - Key assumptions (bullet list)
61
-
62
- 2. **Executable test file** (write SECOND)
63
- - One `describe` block per user story
64
- - One `it` block per acceptance criterion
65
- - Self-documenting test names - minimal comments
57
+ See: `.blueprint/templates/TEST_TEMPLATE.md` for detailed format guidance.
66
58
 
67
59
  ## 3. Standard workflow
68
60
 
@@ -173,44 +165,4 @@ When you receive a new story or feature, you can structure your response like th
173
165
 
174
166
  ## Guardrails
175
167
 
176
- ### Allowed Sources
177
- You may use ONLY information from these sources:
178
- - System specification (`.blueprint/system_specification/SYSTEM_SPEC.md`)
179
- - Feature specifications (`.blueprint/features/*/FEATURE_SPEC.md`)
180
- - User stories (`story-*.md`) and test artifacts (`test-spec.md`, `*.test.js`)
181
- - Implementation code in the project
182
- - Business context (`.business_context/*`)
183
- - Templates (`.blueprint/templates/*`) and agent specifications
184
-
185
- ### Prohibited Sources
186
- Do not use:
187
- - Social media, forums, blog posts, or external APIs
188
- - Training data for domain facts—do not invent business rules
189
- - External project or company references by name
190
-
191
- ### Citation Requirements
192
- - Cite sources using: "Per [filename]: [claim]" or "[filename:section] states..."
193
- - Use section-level citations where feasible (e.g., "story-login.md:AC-3")
194
- - Reference `.business_context/` files for domain definitions
195
- - Maintain a traceable chain: downstream artifacts cite upstream sources
196
-
197
- ### Assumptions vs Facts
198
- - Label assumptions explicitly: "ASSUMPTION: [statement]" or "NOTE: Assuming..."
199
- - Distinguish clearly between cited facts and assumptions
200
- - Do not guess—state "This information is not available in the provided inputs"
201
-
202
- ### Confidentiality
203
- - Do not reproduce `.business_context/` content verbatim; summarise or use generic descriptions
204
- - Do not reference external entities, companies, or projects by name
205
- - Do not use external services that would expose project data
206
- - Outputs must be self-contained and understandable without access to confidential sources
207
-
208
- ### Escalation Protocol
209
- Escalate to the user when:
210
- - Critical information is missing and cannot be safely assumed
211
- - Inputs are ambiguous with multiple possible interpretations—list options and ask for clarification
212
- - Source documents conflict—cite both sources and request resolution
213
- - Output would require violating confidentiality constraints
214
-
215
- When escalation is not warranted, you may proceed with an explicit assumption labelled as such.
216
-
168
+ Read and apply the shared guardrails from: `.blueprint/agents/GUARDRAILS.md`
@@ -0,0 +1,42 @@
1
+ # Guardrails
2
+
3
+ ### Allowed Sources
4
+ You may use ONLY information from these sources:
5
+ - System specification (`.blueprint/system_specification/SYSTEM_SPEC.md`)
6
+ - Feature specifications (`.blueprint/features/*/FEATURE_SPEC.md`)
7
+ - User stories (`story-*.md`) and test artifacts (`test-spec.md`, `*.test.js`)
8
+ - Implementation code in the project
9
+ - Business context (`.business_context/*`)
10
+ - Templates (`.blueprint/templates/*`) and agent specifications
11
+
12
+ ### Prohibited Sources
13
+ Do not use:
14
+ - Social media, forums, blog posts, or external APIs
15
+ - Training data for domain facts—do not invent business rules
16
+ - External project or company references by name
17
+
18
+ ### Citation Requirements
19
+ - Cite sources using: "Per [filename]: [claim]" or "[filename:section] states..."
20
+ - Use section-level citations where feasible (e.g., "story-login.md:AC-3")
21
+ - Reference `.business_context/` files for domain definitions
22
+ - Maintain a traceable chain: downstream artifacts cite upstream sources
23
+
24
+ ### Assumptions vs Facts
25
+ - Label assumptions explicitly: "ASSUMPTION: [statement]" or "NOTE: Assuming..."
26
+ - Distinguish clearly between cited facts and assumptions
27
+ - Do not guess—state "This information is not available in the provided inputs"
28
+
29
+ ### Confidentiality
30
+ - Do not reproduce `.business_context/` content verbatim; summarise or use generic descriptions
31
+ - Do not reference external entities, companies, or projects by name
32
+ - Do not use external services that would expose project data
33
+ - Outputs must be self-contained and understandable without access to confidential sources
34
+
35
+ ### Escalation Protocol
36
+ Escalate to the user when:
37
+ - Critical information is missing and cannot be safely assumed
38
+ - Inputs are ambiguous with multiple possible interpretations—list options and ask for clarification
39
+ - Source documents conflict—cite both sources and request resolution
40
+ - Output would require violating confidentiality constraints
41
+
42
+ When escalation is not warranted, you may proceed with an explicit assumption labelled as such.
@@ -0,0 +1,136 @@
1
+ # Feature Specification — Compressed Feedback Prompts
2
+
3
+ ## 1. Feature Intent
4
+ **Why this feature exists.**
5
+
6
+ - Current feedback prompts are verbose (~10 lines, ~200 tokens per stage)
7
+ - Feedback is collected at 3 points: Cass→Alex, Nigel→Cass, Codey→Nigel
8
+ - Total overhead: ~600 tokens per pipeline run
9
+ - Compressed prompts achieve same result with ~3 lines each
10
+
11
+ ---
12
+
13
+ ## 2. Scope
14
+ ### In Scope
15
+ - Rewrite feedback prompt sections to be more concise
16
+ - Maintain same output format (JSON with rating, issues, recommendation)
17
+ - Ensure feedback quality is not degraded
18
+
19
+ ### Out of Scope
20
+ - Changing feedback data structure
21
+ - Removing feedback collection
22
+ - Changing quality gate thresholds
23
+
24
+ ---
25
+
26
+ ## 3. Actors Involved
27
+
28
+ | Actor | Feedback Role |
29
+ |-------|--------------|
30
+ | Cass | Rates Alex's feature spec |
31
+ | Nigel | Rates Cass's user stories |
32
+ | Codey | Rates Nigel's tests |
33
+
34
+ ---
35
+
36
+ ## 4. Behaviour Overview
37
+
38
+ **Current verbose prompt (~10 lines):**
39
+ ```
40
+ FIRST, before writing stories, evaluate Alex's feature spec:
41
+ - Rating (1-5): How clear and complete is the spec?
42
+ - Issues: List any problems (e.g., "missing-error-handling", "unclear-scope")
43
+ - Recommendation: "proceed" | "pause" | "revise"
44
+
45
+ Output your feedback as:
46
+ FEEDBACK: { "rating": N, "issues": [...], "recommendation": "..." }
47
+ ```
48
+
49
+ **Compressed prompt (~3 lines):**
50
+ ```
51
+ FEEDBACK FIRST: Rate prior stage 1-5, list issues (e.g., unclear-scope), recommend proceed|pause|revise.
52
+ Format: FEEDBACK: {"rating":N,"issues":["..."],"rec":"proceed|pause|revise"}
53
+ Then continue with your task.
54
+ ```
55
+
56
+ **Key outcomes:**
57
+ - ~400 fewer tokens per pipeline run (3 stages × ~130 token savings)
58
+ - Same feedback data collected
59
+ - Same quality gate functionality
60
+
61
+ ---
62
+
63
+ ## 5. State & Lifecycle Interactions
64
+
65
+ - No state changes
66
+ - Feedback format unchanged
67
+ - Quality gate logic unchanged
68
+
69
+ ---
70
+
71
+ ## 6. Rules & Decision Logic
72
+
73
+ | Rule | Description |
74
+ |------|-------------|
75
+ | Same output format | JSON structure must remain compatible with feedback.js |
76
+ | Abbreviations allowed | "rec" instead of "recommendation" in output |
77
+ | Examples condensed | One inline example instead of multiple lines |
78
+
79
+ ---
80
+
81
+ ## 7. Dependencies
82
+
83
+ - SKILL.md feedback sections updated
84
+ - `src/feedback.js` may need to accept abbreviated keys ("rec" → "recommendation")
85
+ - No other module changes
86
+
87
+ ---
88
+
89
+ ## 8. Non-Functional Considerations
90
+
91
+ - **Performance:** ~400 token reduction per run
92
+ - **Clarity:** Compressed prompts must still be unambiguous
93
+ - **Risk:** Agents may misinterpret terse instructions
94
+
95
+ ---
96
+
97
+ ## 9. Assumptions & Open Questions
98
+
99
+ **Assumptions:**
100
+ - Agents can parse terse instructions correctly
101
+ - Abbreviated JSON keys are acceptable
102
+ - Feedback quality won't degrade with shorter prompts
103
+
104
+ **Open Questions:**
105
+ - Should we A/B test compressed vs verbose prompts?
106
+ - Is "rec" acceptable or should we keep "recommendation"?
107
+ - Do we need to update feedback.js to normalize keys?
108
+
109
+ ---
110
+
111
+ ## 10. Impact on System Specification
112
+
113
+ - No impact on system specification
114
+ - Feedback behaviour unchanged
115
+ - Quality gates unchanged
116
+
117
+ ---
118
+
119
+ ## 11. Handover to BA (Cass)
120
+
121
+ **Story themes:**
122
+ - Rewrite Cass feedback prompt (rates Alex)
123
+ - Rewrite Nigel feedback prompt (rates Cass)
124
+ - Rewrite Codey feedback prompt (rates Nigel)
125
+ - Update feedback.js if key normalization needed
126
+
127
+ **Expected story boundaries:**
128
+ - One story for prompt compression (all 3 stages)
129
+ - One story for feedback.js updates if needed
130
+
131
+ ---
132
+
133
+ ## 12. Change Log (Feature-Level)
134
+ | Date | Change | Reason | Raised By |
135
+ |-----|------|--------|-----------|
136
+ | 2026-02-25 | Initial spec | Token efficiency improvement | Claude |
@@ -0,0 +1,40 @@
1
+ # Implementation Plan — Compressed Feedback Prompts
2
+
3
+ ## Summary
4
+
5
+ Compress verbose feedback prompts (~10 lines) to terse format (~3 lines) across three pipeline stages (Cass, Nigel, Codey). Update `src/feedback.js` to normalize the abbreviated "rec" key to "recommendation" and add a parsing function for extracting feedback JSON from agent output.
6
+
7
+ ## Files to Create/Modify
8
+
9
+ | Path | Action | Purpose |
10
+ |------|--------|---------|
11
+ | `SKILL.md` | Modify | Compress feedback prompts in Steps 6.5, 7.5, 8.5 |
12
+ | `src/feedback.js` | Modify | Add key normalization and output parsing functions |
13
+
14
+ ## Implementation Steps
15
+
16
+ 1. **Add `normalizeFeedbackKeys()` to feedback.js** — Function that converts `{rec: "..."}` to `{recommendation: "..."}` while preserving existing full key.
17
+
18
+ 2. **Add `parseFeedbackFromOutput()` to feedback.js** — Regex-based parser to extract `FEEDBACK: {...}` JSON from agent output text.
19
+
20
+ 3. **Update `validateFeedback()` in feedback.js** — Accept both "rec" and "recommendation" keys by checking either before validation.
21
+
22
+ 4. **Export new functions from feedback.js** — Add `normalizeFeedbackKeys` and `parseFeedbackFromOutput` to module.exports.
23
+
24
+ 5. **Compress Step 6.5 prompt in SKILL.md** — Replace Cass→Alex verbose prompt with:
25
+ ```
26
+ FEEDBACK FIRST: Rate Alex's spec 1-5, list issues (e.g., unclear-scope), recommend proceed|pause|revise.
27
+ Format: FEEDBACK: {"rating":N,"issues":["..."],"rec":"proceed|pause|revise"}
28
+ Then continue with your task.
29
+ ```
30
+
31
+ 6. **Compress Step 7.5 prompt in SKILL.md** — Replace Nigel→Cass verbose prompt with similar terse format.
32
+
33
+ 7. **Compress Step 8.5 prompt in SKILL.md** — Replace Codey→Nigel verbose prompt with similar terse format.
34
+
35
+ 8. **Run tests** — Execute `node --test test/feature_compressed-feedback.test.js` to verify implementation.
36
+
37
+ ## Risks/Questions
38
+
39
+ - **Agent interpretation:** Terse prompts may occasionally confuse agents; monitor initial runs for correct feedback format.
40
+ - **Key preference:** If both "rec" and "recommendation" appear, current implementation prefers "recommendation" — this matches test expectations.
@@ -0,0 +1,140 @@
1
+ # Feature Specification — Lazy Business Context Loading
2
+
3
+ ## 1. Feature Intent
4
+ **Why this feature exists.**
5
+
6
+ - Currently all agents are told to read `.business_context/*` directory
7
+ - Many features don't require business context
8
+ - Reading unnecessary files wastes tokens and processing time
9
+ - Lazy loading reads business context only when the feature spec references it
10
+
11
+ ---
12
+
13
+ ## 2. Scope
14
+ ### In Scope
15
+ - Detect whether feature spec cites `.business_context/` files
16
+ - Include business context in agent prompt only if referenced
17
+ - Provide mechanism for agents to request business context if needed mid-task
18
+
19
+ ### Out of Scope
20
+ - Changing business context structure
21
+ - Removing business context capability
22
+ - Automatic business context summarization
23
+
24
+ ---
25
+
26
+ ## 3. Actors Involved
27
+
28
+ | Actor | Business Context Usage |
29
+ |-------|----------------------|
30
+ | Alex | Primary consumer — grounds feature specs in domain context |
31
+ | Cass | Secondary — references for domain terminology |
32
+ | Nigel | Rare — may need for domain-specific test data |
33
+ | Codey | Rare — may need for domain-specific implementation |
34
+
35
+ ---
36
+
37
+ ## 4. Behaviour Overview
38
+
39
+ **Happy path (context needed):**
40
+ 1. Feature spec contains citation: "Per business_context/domain.md: ..."
41
+ 2. Pipeline detects citation during setup
42
+ 3. Agent prompt includes: "Business Context: .business_context/"
43
+ 4. Agent reads and applies business context
44
+
45
+ **Happy path (context not needed):**
46
+ 1. Feature spec has no business context citations
47
+ 2. Pipeline skips business context directive
48
+ 3. Agent prompt omits business context reference
49
+ 4. Tokens saved
50
+
51
+ **Detection logic:**
52
+ ```javascript
53
+ const featureSpecContent = readFile(FEAT_SPEC);
54
+ const needsBusinessContext = featureSpecContent.includes('.business_context')
55
+ || featureSpecContent.includes('business_context/');
56
+ ```
57
+
58
+ **Key outcomes:**
59
+ - Variable token savings (depends on business context size)
60
+ - Faster processing for simple features
61
+ - Business context still available when needed
62
+
63
+ ---
64
+
65
+ ## 5. State & Lifecycle Interactions
66
+
67
+ - No persistent state changes
68
+ - Detection happens at pipeline setup (Step 5)
69
+ - Flag stored in queue: `current.needsBusinessContext: boolean`
70
+
71
+ ---
72
+
73
+ ## 6. Rules & Decision Logic
74
+
75
+ | Rule | Description |
76
+ |------|-------------|
77
+ | Citation detection | Scan feature spec for business_context references |
78
+ | Default to exclude | If no citation found, don't include business context |
79
+ | Alex exception | Alex always has access (creates feature specs from business context) |
80
+ | Explicit include | `--include-business-context` flag overrides detection |
81
+
82
+ ---
83
+
84
+ ## 7. Dependencies
85
+
86
+ - SKILL.md updated with conditional business context inclusion
87
+ - Pipeline setup (Step 5) performs detection
88
+ - Queue stores detection result for downstream agents
89
+
90
+ ---
91
+
92
+ ## 8. Non-Functional Considerations
93
+
94
+ - **Performance:** Token savings proportional to business context size
95
+ - **Correctness:** Risk of missing needed context if detection fails
96
+ - **Flexibility:** Override flag provides escape hatch
97
+
98
+ ---
99
+
100
+ ## 9. Assumptions & Open Questions
101
+
102
+ **Assumptions:**
103
+ - Feature specs reliably cite business context when it's used
104
+ - Detection can be simple string matching
105
+ - Alex stage always needs business context access
106
+
107
+ **Open Questions:**
108
+ - Should detection be more sophisticated (AST parsing)?
109
+ - What if an agent needs business context mid-task but it wasn't loaded?
110
+ - Should there be a "request context" mechanism for agents?
111
+
112
+ ---
113
+
114
+ ## 10. Impact on System Specification
115
+
116
+ - Reinforces efficiency goals
117
+ - Adds conditional loading pattern to pipeline
118
+ - No contradiction with system spec
119
+
120
+ ---
121
+
122
+ ## 11. Handover to BA (Cass)
123
+
124
+ **Story themes:**
125
+ - Implement business context citation detection
126
+ - Update pipeline setup to conditionally include context
127
+ - Add override flag for explicit inclusion
128
+ - Ensure Alex always has business context access
129
+
130
+ **Expected story boundaries:**
131
+ - One story for detection logic
132
+ - One story for pipeline integration
133
+ - One story for override flag
134
+
135
+ ---
136
+
137
+ ## 12. Change Log (Feature-Level)
138
+ | Date | Change | Reason | Raised By |
139
+ |-----|------|--------|-----------|
140
+ | 2026-02-25 | Initial spec | Token efficiency improvement | Claude |