orchestr8 2.6.0 → 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 +94 -18
  36. package/SKILL.md +180 -80
  37. package/package.json +2 -2
  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
@@ -0,0 +1,145 @@
1
+ # Feature Specification — Slim Agent Prompts
2
+
3
+ ## 1. Feature Intent
4
+ **Why this feature exists.**
5
+
6
+ - Current agent prompts tell each agent to "Read your full specification from: AGENT_*.md"
7
+ - Full specs are 200-450 lines (~1,500-2,000 tokens each), loaded every invocation
8
+ - Most spec content is background/training context, not runtime-essential
9
+ - Creating slim runtime prompts reduces token usage by ~5,200 tokens per pipeline run
10
+
11
+ ---
12
+
13
+ ## 2. Scope
14
+ ### In Scope
15
+ - Create slim runtime prompts in `.blueprint/prompts/` directory
16
+ - Runtime prompts contain only: role reminder, task, inputs, outputs, output rules
17
+ - Update SKILL.md to use runtime prompts instead of full specs
18
+ - Keep full specs for reference/documentation
19
+
20
+ ### Out of Scope
21
+ - Changing agent behaviour or capabilities
22
+ - Removing full agent specs (they remain for context)
23
+ - Changing the pipeline flow
24
+
25
+ ---
26
+
27
+ ## 3. Actors Involved
28
+
29
+ | Actor | Can Do | Cannot Do |
30
+ |-------|--------|-----------|
31
+ | Alex | Execute from slim prompt | Access removed context unless needed |
32
+ | Cass | Execute from slim prompt | Access removed context unless needed |
33
+ | Nigel | Execute from slim prompt | Access removed context unless needed |
34
+ | Codey | Execute from slim prompt (plan + implement) | Access removed context unless needed |
35
+
36
+ ---
37
+
38
+ ## 4. Behaviour Overview
39
+
40
+ **Happy path:**
41
+ 1. Pipeline invokes agent via Task tool
42
+ 2. Agent receives slim prompt (~30-50 lines) instead of "read full spec" instruction
43
+ 3. Agent executes task with essential context only
44
+ 4. Output quality maintained with fewer input tokens
45
+
46
+ **Slim prompt structure:**
47
+ ```markdown
48
+ You are {Agent}, the {Role}.
49
+
50
+ ## Task
51
+ {Current task description}
52
+
53
+ ## Inputs
54
+ {List of files to read}
55
+
56
+ ## Outputs
57
+ {Files to write, format requirements}
58
+
59
+ ## Rules
60
+ {5-7 critical rules only}
61
+ ```
62
+
63
+ **Key outcomes:**
64
+ - ~5,200 fewer input tokens per pipeline run
65
+ - Faster agent responses (less context to process)
66
+ - Same output quality
67
+
68
+ ---
69
+
70
+ ## 5. State & Lifecycle Interactions
71
+
72
+ - No state changes — prompts are stateless
73
+ - Pipeline flow unchanged
74
+ - Queue structure unchanged
75
+
76
+ ---
77
+
78
+ ## 6. Rules & Decision Logic
79
+
80
+ | Rule | Description |
81
+ |------|-------------|
82
+ | Essential only | Runtime prompts contain only task-critical information |
83
+ | No duplication | Don't repeat what's in input files (e.g., feature spec) |
84
+ | Reference full spec | Include path to full spec for edge cases: "For detailed guidance, see: AGENT_*.md" |
85
+ | Consistent structure | All runtime prompts follow same template |
86
+
87
+ ---
88
+
89
+ ## 7. Dependencies
90
+
91
+ - SKILL.md must be updated with new prompt structure
92
+ - New `.blueprint/prompts/` directory created
93
+ - Full agent specs remain in `.blueprint/agents/` for reference
94
+
95
+ ---
96
+
97
+ ## 8. Non-Functional Considerations
98
+
99
+ - **Performance:** ~5,200 token reduction per run (~35% of agent input tokens)
100
+ - **Latency:** Faster responses due to smaller context
101
+ - **Maintainability:** Two places to update (runtime prompt + full spec) — mitigated by clear separation of concerns
102
+
103
+ ---
104
+
105
+ ## 9. Assumptions & Open Questions
106
+
107
+ **Assumptions:**
108
+ - Agents can perform tasks effectively with condensed prompts
109
+ - Edge cases are rare enough that full spec reference is sufficient
110
+ - Output quality won't degrade with less verbose instructions
111
+
112
+ **Open Questions:**
113
+ - Should runtime prompts be generated from full specs, or maintained separately?
114
+ - What's the minimum context needed for each agent to maintain quality?
115
+ - Should we A/B test slim vs full prompts to measure quality impact?
116
+
117
+ ---
118
+
119
+ ## 10. Impact on System Specification
120
+
121
+ - Reinforces efficiency goals
122
+ - No contradiction with system spec
123
+ - Consider adding "token efficiency" as a system-level concern
124
+
125
+ ---
126
+
127
+ ## 11. Handover to BA (Cass)
128
+
129
+ **Story themes:**
130
+ - Create runtime prompt template
131
+ - Create slim prompts for each agent (Alex, Cass, Nigel, Codey-plan, Codey-implement)
132
+ - Update SKILL.md to use runtime prompts
133
+ - Test output quality with slim prompts
134
+
135
+ **Expected story boundaries:**
136
+ - One story per agent prompt creation
137
+ - One story for SKILL.md integration
138
+ - One story for quality validation
139
+
140
+ ---
141
+
142
+ ## 12. Change Log (Feature-Level)
143
+ | Date | Change | Reason | Raised By |
144
+ |-----|------|--------|-----------|
145
+ | 2026-02-25 | Initial spec | Token efficiency improvement | Claude |
@@ -0,0 +1,87 @@
1
+ # Implementation Plan — Slim Agent Prompts
2
+
3
+ ## Summary
4
+
5
+ Create slim runtime prompts (~30-50 lines each) for all agents to reduce token usage by ~5,200 tokens per pipeline run. Implementation involves: (1) creating a TEMPLATE.md with standardized structure, (2) creating 5 runtime prompt files following the template, and (3) updating SKILL.md to use runtime prompts instead of full spec references.
6
+
7
+ ## Files to Create/Modify
8
+
9
+ | Path | Action | Purpose |
10
+ |------|--------|---------|
11
+ | `.blueprint/prompts/` | Create dir | New directory for runtime prompts |
12
+ | `.blueprint/prompts/TEMPLATE.md` | Create | Defines standard structure for all runtime prompts |
13
+ | `.blueprint/prompts/alex-runtime.md` | Create | Slim prompt for Alex (specification) |
14
+ | `.blueprint/prompts/cass-runtime.md` | Create | Slim prompt for Cass (stories) |
15
+ | `.blueprint/prompts/nigel-runtime.md` | Create | Slim prompt for Nigel (tests) |
16
+ | `.blueprint/prompts/codey-plan-runtime.md` | Create | Slim prompt for Codey planning phase |
17
+ | `.blueprint/prompts/codey-implement-runtime.md` | Create | Slim prompt for Codey implementation phase |
18
+ | `SKILL.md` | Modify | Replace "Read your full specification" with runtime prompt content |
19
+
20
+ ## Implementation Steps
21
+
22
+ 1. **Create prompts directory**: `mkdir -p .blueprint/prompts`
23
+
24
+ 2. **Create TEMPLATE.md** with sections:
25
+ - Role identity line pattern
26
+ - Task section placeholder
27
+ - Inputs section (file paths)
28
+ - Outputs section (files + format)
29
+ - Rules section (5-7 items, warn against duplication)
30
+ - Full spec reference line
31
+ - Include guidance: target 30-50 non-blank lines
32
+
33
+ 3. **Create alex-runtime.md** (~35 lines):
34
+ - Role: "You are Alex, the System Specification Agent"
35
+ - Task: Create feature spec
36
+ - Inputs: System spec, template, business context
37
+ - Outputs: FEATURE_SPEC.md with format rules
38
+ - Rules: 5-7 essential rules from full spec
39
+ - Reference: AGENT_SPECIFICATION_ALEX.md
40
+
41
+ 4. **Create cass-runtime.md** (~35 lines):
42
+ - Role: "You are Cass, the Story Writer Agent"
43
+ - Task: Create user stories
44
+ - Inputs: Feature spec, system spec
45
+ - Outputs: story-*.md files
46
+ - Rules: 5-7 essential rules
47
+ - Reference: AGENT_BA_CASS.md
48
+
49
+ 5. **Create nigel-runtime.md** (~35 lines):
50
+ - Role: "You are Nigel, the Tester Agent"
51
+ - Task: Create tests
52
+ - Inputs: Stories, feature spec
53
+ - Outputs: test-spec.md, test file
54
+ - Rules: 5-7 essential rules
55
+ - Reference: AGENT_TESTER_NIGEL.md
56
+
57
+ 6. **Create codey-plan-runtime.md** (~35 lines):
58
+ - Role: "You are Codey, the Developer Agent"
59
+ - Task: Create implementation plan (not implement)
60
+ - Inputs: Feature spec, stories, test spec, tests
61
+ - Outputs: IMPLEMENTATION_PLAN.md
62
+ - Rules: 5-7 essential rules
63
+ - Reference: AGENT_DEVELOPER_CODEY.md
64
+
65
+ 7. **Create codey-implement-runtime.md** (~35 lines):
66
+ - Role: "You are Codey, the Developer Agent"
67
+ - Task: Implement feature
68
+ - Inputs: Plan, tests
69
+ - Outputs: Source files (incremental)
70
+ - Rules: 5-7 essential rules
71
+ - Reference: AGENT_DEVELOPER_CODEY.md
72
+
73
+ 8. **Update SKILL.md agent prompts**: For each of Steps 6-10, replace the pattern:
74
+ ```
75
+ Read your full specification from: .blueprint/agents/AGENT_*.md
76
+ ```
77
+ with embedded content from corresponding runtime prompt, keeping task-specific context (slug, paths).
78
+
79
+ 9. **Verify line counts**: Ensure each runtime prompt has 30-50 non-blank lines using test helper `countNonBlankLines()`.
80
+
81
+ 10. **Run tests**: `node --test test/feature_slim-agent-prompts.test.js` to verify all 18 test cases pass.
82
+
83
+ ## Risks/Questions
84
+
85
+ - **Maintainability**: Two sources of truth (runtime prompt + full spec). Mitigated by clear separation of concerns - runtime prompts contain only task instructions, full specs contain background/training.
86
+ - **Quality impact**: Agents receive less context. Mitigated by including full spec reference for edge cases.
87
+ - **SKILL.md size**: Embedding prompt content may increase file size. Consider using file references if prompts grow.
@@ -0,0 +1,59 @@
1
+ # Story — Create Runtime Prompt Template
2
+
3
+ ## User Story
4
+
5
+ As a **framework maintainer**, I want a standardized runtime prompt template so that all agent prompts follow a consistent structure and contain only essential runtime information.
6
+
7
+ ---
8
+
9
+ ## Context / Scope
10
+
11
+ - Applies to all agents: Alex, Cass, Nigel, Codey (plan + implement)
12
+ - Template defines the structure for slim runtime prompts (~30-50 lines)
13
+ - Full agent specs remain in `.blueprint/agents/` for reference
14
+ - Runtime prompts will live in `.blueprint/prompts/`
15
+ - See feature spec: `.blueprint/features/feature_slim-agent-prompts/FEATURE_SPEC.md`
16
+
17
+ ---
18
+
19
+ ## Acceptance Criteria
20
+
21
+ **AC-1 — Template structure defined**
22
+ - Given the need for consistent slim prompts,
23
+ - When the runtime prompt template is created,
24
+ - Then it includes exactly these sections in order:
25
+ 1. Role identity line ("You are {Agent}, the {Role}.")
26
+ 2. Task section
27
+ 3. Inputs section (files to read)
28
+ 4. Outputs section (files to write, format requirements)
29
+ 5. Rules section (5-7 critical rules only)
30
+ 6. Full spec reference line
31
+
32
+ **AC-2 — Template enforces brevity**
33
+ - Given the goal of token reduction,
34
+ - When a runtime prompt follows the template,
35
+ - Then the total line count is between 30-50 lines (excluding blank lines).
36
+
37
+ **AC-3 — Template includes full spec reference**
38
+ - Given agents may need additional context for edge cases,
39
+ - When the template is applied,
40
+ - Then each prompt includes: "For detailed guidance, see: `.blueprint/agents/AGENT_*.md`"
41
+
42
+ **AC-4 — Template location established**
43
+ - Given the need for organized prompt storage,
44
+ - When runtime prompts are created,
45
+ - Then they are stored in `.blueprint/prompts/` directory with naming convention `{agent-slug}-runtime.md`.
46
+
47
+ **AC-5 — No duplication of input content**
48
+ - Given runtime prompts should be minimal,
49
+ - When the Rules section is written,
50
+ - Then it does not duplicate information already present in the agent's input files (feature spec, system spec, etc.).
51
+
52
+ ---
53
+
54
+ ## Out of Scope
55
+
56
+ - Creating the actual agent prompts (covered in separate story)
57
+ - Updating SKILL.md integration (covered in separate story)
58
+ - Automated template validation tooling
59
+ - A/B testing infrastructure for quality comparison
@@ -0,0 +1,65 @@
1
+ # Story — Create Slim Agent Prompts
2
+
3
+ ## User Story
4
+
5
+ As a **pipeline user**, I want slim runtime prompts for each agent so that pipeline execution uses fewer input tokens while maintaining output quality.
6
+
7
+ ---
8
+
9
+ ## Context / Scope
10
+
11
+ - Creates 5 runtime prompts: Alex, Cass, Nigel, Codey-plan, Codey-implement
12
+ - Each prompt follows the template from story-create-runtime-prompt-template.md
13
+ - Full specs remain in `.blueprint/agents/` for reference
14
+ - Expected token reduction: ~5,200 tokens per pipeline run
15
+ - See feature spec: `.blueprint/features/feature_slim-agent-prompts/FEATURE_SPEC.md`
16
+
17
+ ---
18
+
19
+ ## Acceptance Criteria
20
+
21
+ **AC-1 — All agents have runtime prompts**
22
+ - Given the template has been established,
23
+ - When slim prompts are created,
24
+ - Then the following files exist in `.blueprint/prompts/`:
25
+ - `alex-runtime.md`
26
+ - `cass-runtime.md`
27
+ - `nigel-runtime.md`
28
+ - `codey-plan-runtime.md`
29
+ - `codey-implement-runtime.md`
30
+
31
+ **AC-2 — Prompts contain role identity**
32
+ - Given each agent has a distinct role,
33
+ - When a runtime prompt is read,
34
+ - Then it begins with "You are {Name}, the {Role}." matching the agent's identity from the full spec.
35
+
36
+ **AC-3 — Prompts specify inputs and outputs**
37
+ - Given agents need to know what to read and write,
38
+ - When a runtime prompt is read,
39
+ - Then the Inputs section lists specific file paths to read,
40
+ - And the Outputs section lists specific files to create with format requirements.
41
+
42
+ **AC-4 — Rules are essential only**
43
+ - Given the goal of brevity,
44
+ - When a runtime prompt's Rules section is reviewed,
45
+ - Then it contains 5-7 rules maximum,
46
+ - And each rule is critical to correct task execution.
47
+
48
+ **AC-5 — Prompts reference full specs**
49
+ - Given edge cases may require additional context,
50
+ - When a runtime prompt is read,
51
+ - Then it includes a reference to the full agent spec path.
52
+
53
+ **AC-6 — Line count within target**
54
+ - Given the target of 30-50 lines,
55
+ - When any runtime prompt is measured,
56
+ - Then it contains between 30-50 non-blank lines.
57
+
58
+ ---
59
+
60
+ ## Out of Scope
61
+
62
+ - Modifying full agent specs in `.blueprint/agents/`
63
+ - Changing agent behaviour or capabilities
64
+ - SKILL.md integration (covered in separate story)
65
+ - Automated token counting tooling
@@ -0,0 +1,53 @@
1
+ # Story — SKILL.md Integration with Runtime Prompts
2
+
3
+ ## User Story
4
+
5
+ As a **pipeline user**, I want SKILL.md to use the slim runtime prompts so that agent invocations benefit from reduced token usage.
6
+
7
+ ---
8
+
9
+ ## Context / Scope
10
+
11
+ - Updates SKILL.md to embed or reference runtime prompts instead of full specs
12
+ - Runtime prompts located in `.blueprint/prompts/`
13
+ - Pipeline flow remains unchanged: Alex -> Cass -> Nigel -> Codey
14
+ - Must maintain all existing functionality (--pause-after, --no-commit, queue recovery)
15
+ - See feature spec: `.blueprint/features/feature_slim-agent-prompts/FEATURE_SPEC.md`
16
+
17
+ ---
18
+
19
+ ## Acceptance Criteria
20
+
21
+ **AC-1 — Agent spawns use runtime prompts**
22
+ - Given SKILL.md spawns agents via Task tool,
23
+ - When an agent is invoked,
24
+ - Then the prompt content comes from `.blueprint/prompts/{agent}-runtime.md` rather than instructing "Read your full specification from: AGENT_*.md".
25
+
26
+ **AC-2 — All five agent contexts updated**
27
+ - Given the pipeline has 5 agent contexts,
28
+ - When SKILL.md is reviewed,
29
+ - Then Alex, Cass, Nigel, Codey-plan, and Codey-implement all use their respective runtime prompts.
30
+
31
+ **AC-3 — Pipeline flow unchanged**
32
+ - Given existing pipeline behaviour must be preserved,
33
+ - When a feature is processed with updated SKILL.md,
34
+ - Then the sequence remains: Alex -> Cass -> Nigel -> Codey-plan -> Codey-implement -> Auto-commit.
35
+
36
+ **AC-4 — Pause and commit options preserved**
37
+ - Given users rely on `--pause-after` and `--no-commit` flags,
38
+ - When SKILL.md is updated,
39
+ - Then these options continue to function as documented.
40
+
41
+ **AC-5 — Queue recovery unchanged**
42
+ - Given pipeline may fail mid-execution,
43
+ - When a pipeline is resumed from queue state,
44
+ - Then the correct runtime prompt is used for the resumed stage.
45
+
46
+ ---
47
+
48
+ ## Out of Scope
49
+
50
+ - Changes to queue file structure
51
+ - Changes to CLI commands
52
+ - Adding new pipeline stages
53
+ - Modifying the Task tool invocation mechanism
@@ -0,0 +1,147 @@
1
+ # Feature Specification — Smart Story Routing
2
+
3
+ ## 1. Feature Intent
4
+
5
+ The pipeline currently requires manual decision about whether to include the Cass (story writing) step. This feature automates that decision by classifying features as "technical" or "user-facing" based on their content, then routing accordingly.
6
+
7
+ - Technical features skip Cass (saves ~25-40k tokens)
8
+ - User-facing features include Cass (stories add value for user journeys)
9
+ - Override flags allow manual control when needed
10
+
11
+ ---
12
+
13
+ ## 2. Scope
14
+
15
+ ### In Scope
16
+ - Classify features based on feature spec content
17
+ - Route pipeline to include/skip Cass based on classification
18
+ - Provide override flags for manual control
19
+ - Log classification decision for transparency
20
+
21
+ ### Out of Scope
22
+ - Changing Cass's behavior
23
+ - ML-based classification (use keyword matching)
24
+ - Retroactive classification of completed features
25
+
26
+ ---
27
+
28
+ ## 3. Actors Involved
29
+
30
+ | Actor | Role |
31
+ |-------|------|
32
+ | Pipeline orchestrator | Calls classifier, routes accordingly |
33
+ | Feature classifier | Analyzes spec, returns classification |
34
+ | User | Can override with flags |
35
+
36
+ ---
37
+
38
+ ## 4. Behaviour Overview
39
+
40
+ ### Classification Logic
41
+
42
+ **Technical indicators** (skip Cass):
43
+ - Keywords: refactor, token, performance, module, internal, infrastructure, optimization, extract, compress, cache, schema, validation, helper, utility, config
44
+ - Patterns: "reduce.*token", "improve.*efficiency", "extract.*to"
45
+
46
+ **User-facing indicators** (include Cass):
47
+ - Keywords: user, customer, UI, screen, journey, flow, experience, interface, form, button, login, signup, dashboard, notification, email
48
+ - Patterns: "user can", "user should", "as a user"
49
+
50
+ **Decision rules:**
51
+ 1. Count technical indicators in feature spec
52
+ 2. Count user-facing indicators in feature spec
53
+ 3. If user-facing > technical → include Cass
54
+ 4. If technical > user-facing → skip Cass
55
+ 5. If tie or unclear → default to include Cass (safer)
56
+
57
+ ### Override Flags
58
+
59
+ - `--with-stories` - Force include Cass regardless of classification
60
+ - `--skip-stories` - Force skip Cass regardless of classification
61
+
62
+ ### Pipeline Integration
63
+
64
+ ```
65
+ /implement-feature "slug"
66
+
67
+
68
+ Classify Feature
69
+
70
+ ├── Technical → Skip Cass → Nigel
71
+
72
+ └── User-facing → Include Cass → Cass → Nigel
73
+ ```
74
+
75
+ ---
76
+
77
+ ## 5. State & Lifecycle Interactions
78
+
79
+ - Classification stored in queue: `current.featureType: "technical" | "user-facing"`
80
+ - Classification stored in queue: `current.skippedCass: boolean`
81
+ - No impact on other pipeline stages
82
+
83
+ ---
84
+
85
+ ## 6. Rules & Decision Logic
86
+
87
+ | Rule | Description |
88
+ |------|-------------|
89
+ | Keyword matching | Case-insensitive search in feature spec |
90
+ | Threshold | User-facing wins ties (conservative) |
91
+ | Override precedence | Flags override classification |
92
+ | Logging | Classification reason logged to console |
93
+
94
+ ---
95
+
96
+ ## 7. Dependencies
97
+
98
+ - Feature spec must exist before classification
99
+ - SKILL.md routes based on classification result
100
+ - Queue tracks classification for recovery
101
+
102
+ ---
103
+
104
+ ## 8. Non-Functional Considerations
105
+
106
+ - **Performance**: Classification is fast (string matching)
107
+ - **Accuracy**: Keyword-based approach may misclassify edge cases
108
+ - **Transparency**: Log why decision was made
109
+
110
+ ---
111
+
112
+ ## 9. Assumptions & Open Questions
113
+
114
+ **Assumptions:**
115
+ - Keyword matching is sufficient for most cases
116
+ - Users will use override flags for edge cases
117
+ - Technical features don't benefit significantly from stories
118
+
119
+ **Open Questions:**
120
+ - Should we track classification accuracy over time?
121
+ - Should confidence score be exposed to user?
122
+
123
+ ---
124
+
125
+ ## 10. Impact on System Specification
126
+
127
+ - Adds new routing decision point to pipeline
128
+ - No breaking changes to existing behavior
129
+ - Backward compatible (default is current behavior)
130
+
131
+ ---
132
+
133
+ ## 11. Handover to Nigel
134
+
135
+ **Test themes:**
136
+ - Classification function returns correct type for technical content
137
+ - Classification function returns correct type for user-facing content
138
+ - Override flags work correctly
139
+ - Tie-breaking defaults to user-facing
140
+ - Queue state updated with classification
141
+
142
+ ---
143
+
144
+ ## 12. Change Log
145
+ | Date | Change | Reason | Raised By |
146
+ |------|--------|--------|-----------|
147
+ | 2026-02-25 | Initial spec | Optimize pipeline efficiency | User request |
@@ -0,0 +1,73 @@
1
+ # Implementation Plan: Smart Story Routing
2
+
3
+ ## Summary
4
+
5
+ This feature adds automatic classification of features as "technical" or "user-facing" to determine whether the Cass (story writing) stage should be included in the pipeline. Implementation requires creating a new classifier module and integrating it with the orchestrator and SKILL.md pipeline definition.
6
+
7
+ ## Files to Create/Modify
8
+
9
+ | Path | Action | Purpose |
10
+ |------|--------|---------|
11
+ | `src/classifier.js` | Create | Classification logic, flag parsing, decision function |
12
+ | `src/orchestrator.js` | Modify | Add `featureType` and `skippedCass` to queue state |
13
+ | `src/index.js` | Modify | Export classifier module |
14
+ | `SKILL.md` | Modify | Add routing logic and new flags documentation |
15
+ | `bin/cli.js` | Modify | Add `classify` command for testing/debugging |
16
+
17
+ ## Implementation Steps
18
+
19
+ 1. **Create `src/classifier.js` with keyword lists**
20
+ - Define `TECHNICAL_KEYWORDS` array (refactor, token, performance, etc.)
21
+ - Define `USER_FACING_KEYWORDS` array (user, customer, UI, etc.)
22
+ - Define `TECHNICAL_PATTERNS` and `USER_FACING_PATTERNS` regex arrays
23
+ - Tests: T-CF-1.1, T-CF-1.2, T-CF-1.3, T-CF-2.1, T-CF-2.2, T-CF-2.3
24
+
25
+ 2. **Implement `classifyFeature(specContent)` function**
26
+ - Case-insensitive keyword counting
27
+ - Pattern matching for regex patterns
28
+ - Return `{ type, technicalCount, userFacingCount, reason }`
29
+ - Tie-breaking: user-facing wins (conservative default)
30
+ - Tests: T-CF-3.1, T-CF-3.2
31
+
32
+ 3. **Implement `parseStoryFlags(args)` function**
33
+ - Parse `--with-stories` flag -> `{ override: 'include' }`
34
+ - Parse `--skip-stories` flag -> `{ override: 'skip' }`
35
+ - No flag -> `{ override: null }`
36
+ - Tests: T-FP-1.1, T-FP-1.2, T-FP-1.3, T-FP-1.4
37
+
38
+ 4. **Implement `shouldIncludeStories(featureType, override)` function**
39
+ - Override takes precedence over classification
40
+ - Return boolean for pipeline routing decision
41
+ - Tests: T-SD-1.1, T-SD-1.2, T-SD-2.1, T-SD-2.2
42
+
43
+ 5. **Implement logging helper `logClassification(result)`**
44
+ - Console output: "Feature classified as {type}: {reason}"
45
+ - Include indicator counts for transparency
46
+
47
+ 6. **Update `src/orchestrator.js` setCurrent function**
48
+ - Add optional `featureType` and `skippedCass` fields to queue state
49
+ - Ensure fields persist through queue operations
50
+ - Tests: T-QS-1.1, T-QS-1.2, T-QS-1.3
51
+
52
+ 7. **Update `src/index.js` exports**
53
+ - Export classifier functions for use by SKILL.md
54
+
55
+ 8. **Update `SKILL.md` pipeline routing**
56
+ - Add classification step after Step 5 (Initialize)
57
+ - Document `--with-stories` and `--skip-stories` flags
58
+ - Add conditional routing: if technical, skip to Nigel
59
+
60
+ 9. **Add optional CLI command `classify`**
61
+ - Usage: `npx orchestr8 classify path/to/FEATURE_SPEC.md`
62
+ - Outputs classification result for debugging/testing
63
+
64
+ 10. **Run all tests and verify**
65
+ - `node --test test/feature_smart-story-routing.test.js`
66
+ - Ensure all 19 tests pass
67
+
68
+ ## Risks/Questions
69
+
70
+ - **Keyword list completeness**: May need tuning based on real-world usage; current lists from spec are a starting point
71
+ - **Pattern matching performance**: Regex patterns should be compiled once, not per-call
72
+ - **Edge case handling**: Empty/whitespace-only specs default to user-facing (safe default)
73
+ - **SKILL.md integration**: Routing logic is instructional, not code - relies on Claude following instructions correctly