@torus-engineering/tas-kit 1.13.0 → 2.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 (100) hide show
  1. package/.tas/_platform/claude-code/settings.json +58 -46
  2. package/.tas/_platform/hooks/code-quality.js +127 -127
  3. package/.tas/_platform/hooks/session-end.js +111 -111
  4. package/.tas/agents/architect.md +53 -53
  5. package/.tas/agents/aws-reviewer.md +71 -71
  6. package/.tas/agents/build-resolver.md +89 -59
  7. package/.tas/agents/code-explorer.md +63 -63
  8. package/.tas/agents/csharp-reviewer.md +62 -62
  9. package/.tas/agents/database-reviewer.md +73 -73
  10. package/.tas/agents/doc-updater.md +68 -66
  11. package/.tas/agents/python-reviewer.md +67 -67
  12. package/.tas/agents/security-reviewer.md +79 -79
  13. package/.tas/agents/software-engineer.md +53 -0
  14. package/.tas/agents/typescript-reviewer.md +65 -65
  15. package/.tas/commands/ado-create.md +33 -28
  16. package/.tas/commands/ado-delete.md +26 -22
  17. package/.tas/commands/ado-get.md +24 -20
  18. package/.tas/commands/ado-status.md +22 -18
  19. package/.tas/commands/ado-update.md +31 -27
  20. package/.tas/commands/tas-adr.md +37 -33
  21. package/.tas/commands/tas-apitest-plan.md +177 -173
  22. package/.tas/commands/tas-apitest.md +147 -143
  23. package/.tas/commands/tas-brainstorm.md +23 -19
  24. package/.tas/commands/tas-brd.md +50 -0
  25. package/.tas/commands/tas-bug.md +127 -113
  26. package/.tas/commands/tas-checklist.md +180 -0
  27. package/.tas/commands/tas-debug.md +103 -0
  28. package/.tas/commands/tas-design.md +41 -37
  29. package/.tas/commands/tas-dev.md +225 -125
  30. package/.tas/commands/tas-e2e-mobile.md +146 -155
  31. package/.tas/commands/tas-e2e-web.md +150 -163
  32. package/.tas/commands/tas-e2e.md +289 -102
  33. package/.tas/commands/tas-feature.md +181 -47
  34. package/.tas/commands/tas-fix.md +72 -51
  35. package/.tas/commands/tas-functest-mobile.md +138 -144
  36. package/.tas/commands/tas-functest-web.md +176 -192
  37. package/.tas/commands/tas-functest.md +225 -76
  38. package/.tas/commands/tas-init.md +22 -17
  39. package/.tas/commands/tas-master-plan.md +300 -0
  40. package/.tas/commands/tas-orchestrate.md +159 -0
  41. package/.tas/commands/tas-plan.md +152 -117
  42. package/.tas/commands/tas-prd.md +57 -37
  43. package/.tas/commands/tas-review-pr.md +174 -0
  44. package/.tas/commands/tas-review.md +115 -113
  45. package/.tas/commands/tas-sad.md +47 -43
  46. package/.tas/commands/tas-security.md +91 -87
  47. package/.tas/commands/tas-spec.md +54 -50
  48. package/.tas/commands/tas-status.md +25 -16
  49. package/.tas/project-status-example.yaml +3 -1
  50. package/.tas/rules/ado-integration.md +67 -65
  51. package/.tas/rules/common/api-design.md +517 -517
  52. package/.tas/rules/common/build-debug-loop.md +233 -0
  53. package/.tas/rules/common/code-review.md +4 -0
  54. package/.tas/rules/common/feature-done.md +42 -0
  55. package/.tas/rules/common/post-implementation-review.md +4 -0
  56. package/.tas/rules/common/project-status.md +33 -16
  57. package/.tas/rules/common/sad-impact.md +81 -0
  58. package/.tas/rules/common/tdd.md +104 -89
  59. package/.tas/rules/csharp/api-testing.md +2 -2
  60. package/.tas/rules/csharp/torus-core-framework.md +128 -0
  61. package/.tas/tas-example.yaml +9 -32
  62. package/.tas/templates/AGENTS.md +13 -0
  63. package/.tas/templates/API-Test-Spec.md +5 -4
  64. package/.tas/templates/BRD.md +133 -0
  65. package/.tas/templates/Bug.md +15 -0
  66. package/.tas/templates/E2E-Execution-Report.md +8 -8
  67. package/.tas/templates/E2E-Mobile-Spec.md +6 -8
  68. package/.tas/templates/E2E-Report.md +2 -2
  69. package/.tas/templates/E2E-Scenario.md +22 -22
  70. package/.tas/templates/E2E-Test-Spec.md +274 -0
  71. package/.tas/templates/E2E-Web-Spec.md +4 -4
  72. package/.tas/templates/Feature-Technical-Part.md +69 -0
  73. package/.tas/templates/Feature-Technical-Stack.md +74 -0
  74. package/.tas/templates/Feature-Technical.md +329 -0
  75. package/.tas/templates/Feature.md +50 -26
  76. package/.tas/templates/Func-Test-Script.md +29 -56
  77. package/.tas/templates/Func-Test-Spec.md +144 -142
  78. package/.tas/templates/PRD.md +173 -142
  79. package/.tas/templates/TestChecklist.md +96 -0
  80. package/.tas/templates/torus-dotnet-bootstrap.md +223 -0
  81. package/.tas/tools/tas-ado-readme.md +24 -27
  82. package/.tas/tools/tas-ado.py +328 -25
  83. package/.tas/tools/tas-github.py +339 -0
  84. package/README.md +142 -57
  85. package/bin/cli.js +90 -90
  86. package/lib/adapters/antigravity.js +131 -131
  87. package/lib/adapters/claude-code.js +71 -35
  88. package/lib/adapters/codex.js +157 -157
  89. package/lib/adapters/cursor.js +80 -80
  90. package/lib/adapters/index.js +20 -20
  91. package/lib/adapters/utils.js +81 -81
  92. package/lib/deleted-files.json +7 -0
  93. package/lib/install.js +546 -543
  94. package/package.json +2 -2
  95. package/.tas/README.md +0 -334
  96. package/.tas/commands/tas-epic.md +0 -35
  97. package/.tas/commands/tas-story.md +0 -91
  98. package/.tas/rules/common/story-done.md +0 -30
  99. package/.tas/templates/Epic.md +0 -46
  100. package/.tas/templates/Story.md +0 -90
@@ -0,0 +1,159 @@
1
+ ---
2
+ model: sonnet
3
+ ---
4
+
5
+ # /tas-orchestrate $ARGUMENTS
6
+
7
+ Role: Tech Lead — Orchestrator
8
+ Execute the project master plan by spawning `software-engineer` agents per Feature in stage/track order. Blocking stages complete before next stage starts. Parallel stages batch by `max_parallel`. Tracks run concurrently across stacks. Supports resume — skips `done` Features on restart.
9
+
10
+ `$ARGUMENTS` is optional. If provided, must be a track name (e.g., `service`) to execute only that track.
11
+ `--autonomous=true|false` flag overrides `autonomy_mode` from `tas.yaml` for this run.
12
+
13
+ **Scope:** Execution coordination only — reads plan, spawns agents, tracks status.
14
+ **Out of scope:** Writing Features, writing Technical Plans, coding.
15
+
16
+ ## Always / Ask / Never
17
+
18
+ | | Action |
19
+ |---|---|
20
+ | **Always** | Read `project-status.yaml` on start to skip `done` Features — never re-run completed work |
21
+ | **Always** | Show execution queue and ask for confirmation before spawning agents (manual mode only) |
22
+ | **Always** | In autonomous mode: skip confirmation, auto-spawn, report at end |
23
+ | **Always** | Batch parallel stages by `max_parallel` from `tas.yaml` (default: 3) |
24
+ | **Always** | Update `project-status.yaml` after each Feature completes |
25
+ | **Always** | Pause a blocked/errored track — continue other tracks |
26
+ | **Never** | Spawn next stage until all Features in current stage are `done` |
27
+ | **Never** | Re-run a Feature with status `done` or `skipped` |
28
+
29
+ ## Prerequisites
30
+ - `docs/master-plan.md` exists (run `/tas-master-plan` first if missing)
31
+ - `project-status.yaml` has `master_plan` key
32
+
33
+ ## Steps
34
+
35
+ **Step 1 — Load plan + current status**
36
+ - Read `docs/master-plan.md` — parse YAML block under `## Execution Plan`
37
+ - Read `project-status.yaml` — read `master_plan.tracks` for all Feature statuses
38
+ - Read `tas.yaml` → `workflow.develop.orchestration.max_parallel` (default: `3` if absent)
39
+ - Resolve autonomy mode (CLI flag wins over yaml):
40
+ 1. Parse `--autonomous=true|false` from `$ARGUMENTS`
41
+ 2. If absent → read `autonomy_mode` from `tas.yaml` (`manual` | `full`, default `manual`)
42
+ 3. `autonomous = true` iff CLI `true` OR (CLI absent AND `autonomy_mode: full`)
43
+ - Update `project-status.yaml`: `master_plan.status: in_progress`
44
+ - If `$ARGUMENTS` contains a track name → filter to that track only; otherwise run all tracks
45
+
46
+ **Step 2 — Build execution queue**
47
+
48
+ For each track (in parallel across tracks):
49
+ 1. Skip Features already `done` or `skipped`
50
+ 2. Find current stage (lowest stage number where not all Features are `done`)
51
+ 3. Check blocking constraint: stage N Features only queue if all stage N-1 Features are `done`
52
+ 4. Check cross-track `depends_on`: Feature only queues if all listed dependency Features are `done`
53
+ 5. Note stage type (`blocking` / `sequential` / `parallel`)
54
+
55
+ Show queue:
56
+ ```
57
+ Execution queue:
58
+
59
+ Track: service
60
+ Stage 1 [blocking] → Feature-001 scaffold-service
61
+ Track: web
62
+ Stage 1 [blocking] → Feature-002 scaffold-web
63
+
64
+ (Subsequent stages queue as each stage completes per track)
65
+ ```
66
+
67
+ **Manual mode** (`autonomous = false`): show queue, ask `Proceed? (yes / abort)`, wait for user.
68
+ **Autonomous mode** (`autonomous = true`): show queue, skip confirmation, proceed immediately to Step 3.
69
+
70
+ **Step 3 — Execute features**
71
+
72
+ Spawn `software-engineer` agents. Pass feature context in prompt.
73
+
74
+ For each queued Feature:
75
+ ```
76
+ Agent({
77
+ subagent_type: "software-engineer",
78
+ description: "Feature-{ID} {slug}",
79
+ prompt: "feature_id: {Feature-ID}
80
+ slug: {slug}
81
+ feature_file: {feature_file_path}
82
+ technical_file: {technical_file_path}"
83
+ })
84
+ ```
85
+
86
+ **Parallel stage batching:**
87
+ - Do NOT spawn all Features in a parallel stage at once
88
+ - Split stage Features into batches of `max_parallel`
89
+ - Batch 1: spawn `max_parallel` agents simultaneously (single message, multiple Agent calls)
90
+ - Wait for all in batch → update status (Step 4) → spawn next batch
91
+ - Only advance to next stage after all batches in current stage are done
92
+
93
+ Example — `max_parallel: 3`, 7 Features in parallel stage:
94
+ ```
95
+ Batch 1: Feature-007, Feature-008, Feature-009 → wait → update
96
+ Batch 2: Feature-010, Feature-011, Feature-012 → wait → update
97
+ Batch 3: Feature-013 → wait → update
98
+ → stage done → queue next stage
99
+ ```
100
+
101
+ Sequential stages: always spawn one Feature at a time regardless of `max_parallel`.
102
+
103
+ **Step 4 — Process results + update status**
104
+
105
+ After each agent returns, parse result prefix:
106
+
107
+ - `DONE: Feature-NNN` →
108
+ - Update `project-status.yaml`:
109
+ - `master_plan.tracks.{track}.stages.{N}.features.Feature-NNN: done`
110
+ - `features.Feature-NNN.status: Done`
111
+ - `features.Feature-NNN.done_date: {today}`
112
+ - If all Features in stage `done` → set stage status: `done` → queue next stage
113
+
114
+ - `BLOCKED: Feature-NNN — {reason}` →
115
+ - Update: `master_plan.tracks.{track}.stages.{N}.features.Feature-NNN: blocked`
116
+ - Log reason, pause track, continue other tracks
117
+
118
+ - `ERROR: Feature-NNN — {reason}` →
119
+ - Update: `master_plan.tracks.{track}.stages.{N}.features.Feature-NNN: error`
120
+ - Log reason, pause track, continue other tracks
121
+
122
+ Always update: `master_plan.last_updated: {today}`
123
+
124
+ **Step 5 — Continue until all tracks exhausted**
125
+
126
+ Repeat Steps 3–4 until no Features remain to queue across all active tracks.
127
+
128
+ **Step 6 — Final report**
129
+
130
+ When all tracks complete:
131
+ - If all `done` → update `project-status.yaml`: `master_plan.status: completed`
132
+ - If any `blocked`/`error` → `master_plan.status: in_progress`
133
+
134
+ Output:
135
+ ```
136
+ Orchestration complete.
137
+
138
+ ✅ Done (N): Feature-001, Feature-002, Feature-003
139
+ ⚠️ Blocked (N): Feature-007 — auth service not responding
140
+ ❌ Error (N): Feature-008 — compilation failed in payment module
141
+
142
+ project-status.yaml updated.
143
+ Blocked/errored features require manual fix, then re-run /tas-orchestrate to resume.
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Resume behavior
149
+
150
+ On re-run when `master_plan.status: in_progress`:
151
+ 1. Read current statuses from `project-status.yaml`
152
+ 2. Skip all `done` Features
153
+ 3. Features with `in_progress`: re-spawn (previous agent may have died)
154
+ 4. Features with `blocked` or `error`: skip unless manually cleared in `project-status.yaml` first
155
+ 5. Show updated queue → manual: confirm → continue | autonomous: auto-continue
156
+
157
+ ## Final Step — Token Log
158
+
159
+ Follow `.tas/rules/common/token-logging.md`: write AI Usage Log to `docs/master-plan.md`.
@@ -1,198 +1,233 @@
1
+ ---
2
+ model: opus
3
+ ---
4
+
1
5
  # /tas-plan $ARGUMENTS
2
6
 
3
7
  Role: SE - Software Engineer
4
- Bridge between business (Story) and technical (code).
5
- Analyze Story, create technical plan, break tasks — before implementing.
8
+ Bridge between business (Feature) and technical (code).
9
+ Analyze Feature, generate `Feature-{NNN}-Technical.md` from `.tas/templates/Feature-Technical.md`.
10
+
11
+ `$ARGUMENTS` may include `--autonomous=true|false` (overrides `autonomy_mode` in `tas.yaml`).
6
12
 
7
- **Required output:** Technical Plan written to Story file + `plan_status: completed`.
13
+ **Required output:** New file `{CODE}-Feature-{NNN}-{slug}-Technical.md` next to the Feature file, plus `plan_status: completed` on the Feature.
8
14
 
9
15
  ## Always / Ask / Never
10
16
 
11
17
  | | Action |
12
18
  |---|---|
13
- | **Always** | Read Story file before doing anything |
14
- | **Always** | Wait for user to approve plan before writing to Story |
15
- | **Always** | Write Technical Plan to Story file after approval |
16
- | **Ask** | When need to reference SAD/ADR confirm with user before reading |
17
- | **Ask** | When Story scope > 8 hours suggest splitting Story |
19
+ | **Always** | Read Feature file before doing anything |
20
+ | **Always** | Use `.tas/templates/Feature-Technical.md` as the structure |
21
+ | **Always** | Wait for user approval before writing the technical file (manual mode only) |
22
+ | **Always** | Write `plan_status: completed` + `plan_date` to Feature frontmatter after approval |
23
+ | **Ask** | When need to reference SAD/ADRconfirm before reading (manual mode only) |
18
24
  | **Never** | Start implementing in this command |
19
- | **Never** | Read SAD/ADR without asking user first |
20
- | **Never** | Write plan to Story without approval |
25
+ | **Never** | Read SAD/ADR without asking user first (manual mode) |
26
+ | **Never** | Write Technical file before user approval (manual mode) |
27
+ | **Never** | Auto-run `/tas-adr` even in autonomous mode — log candidates only |
28
+ | **Never** | Add technical content (schema, SQL, code, migration, data model, API spec) to the Feature file — Feature file is business spec only; all technical output goes to Feature-Technical file |
29
+
30
+ ## Autonomous Mode
31
+
32
+ Resolve `autonomous` flag at start (CLI flag wins over yaml):
33
+ 1. Parse `--autonomous=true|false` from `$ARGUMENTS`
34
+ 2. If absent → read `autonomy_mode` from `tas.yaml` (`manual` | `full`, default `manual`)
35
+ 3. Final value: `autonomous = true` iff CLI `true` OR (CLI absent AND `autonomy_mode: full`)
36
+
37
+ When `autonomous = true`:
38
+ - Step 3 (SAD/ADR ask): skip ask. Auto-read SAD section / ADR file when reasoning calls for it. Log paths read in `## Autonomous Decisions Log` on Feature file.
39
+ - Step 5 (multiple feasible approaches): auto-pick simplest that satisfies AC + matches existing patterns from code-explorer survey. Log decision in Technical file `Architecture Decisions` section with `Auto-selected: true` column.
40
+ - Step 6 (wait approval): skip. Write Technical file straight to disk.
41
+ - Re-plan prompt (Step 1): if Technical file already exists → skip ask, overwrite, log entry to `## Autonomous Decisions Log`.
42
+
43
+ Mandatory audit trail in autonomous mode:
44
+ - Set Feature frontmatter: `autonomous_run: true`, `autonomous_run_date: {datetime}`
45
+ - Append every skipped gate + chosen path to Feature `## Autonomous Decisions Log`
21
46
 
22
47
  ## Actions
23
48
 
24
- ### Step 1 — Identify Story
49
+ ### Step 1 — Identify Feature
25
50
 
26
- `$ARGUMENTS` can be: Story ID (`Story-005`), file path, or Story description.
51
+ `$ARGUMENTS` can be: Feature ID (`Feature-005`), file path, or Feature description.
27
52
 
28
- - If Story ID: find file via glob `docs/epics/**/*-Story-{ID}-*.md`
53
+ - If Feature ID: find file via glob `docs/features/{CODE}-Feature-{ID}-*/{CODE}-Feature-{ID}-*.md` (the file WITHOUT `-Technical` suffix)
29
54
  - If file path: read directly
30
- - If description: ask user for specific Story ID/file
31
- - Read Story file
55
+ - If description: ask user for specific Feature ID/file
56
+ - Read Feature file
32
57
 
33
- **Check re-plan:** If `plan_status: completed` ask user:
34
- > "This Story already has a Technical Plan. Do you want to re-plan?"
35
- If user confirms continue. If not → stop.
58
+ **Check re-plan:** If `plan_status: completed` (Technical file already exists):
59
+ - **Manual mode:** ask:
60
+ > "Feature-{NNN} already has a Technical Plan. Re-plan and overwrite?"
61
+ If user confirms → continue. If not → stop.
62
+ - **Autonomous mode:** skip ask, overwrite, log entry: `re-plan overwrite | reason: autonomous run`.
36
63
 
37
64
  ### Step 2 — Parallel Context Gathering
38
65
 
39
66
  Launch 2 agents SIMULTANEOUSLY:
40
67
 
41
68
  **Agent 1 — `code-explorer`** (always run):
42
- > Survey codebase related to Story: "{Story title + AC summary}".
43
- > Find: entry points, files likely to change, existing patterns, dependencies.
69
+ > Survey codebase related to Feature: "{Feature title + AC summary}".
70
+ > Feature may span multiple stacks survey all relevant layers (web, service, integration, app).
71
+ > Find: entry points, files likely to change, existing patterns, dependencies across all involved stacks.
44
72
  > Read max 10 most relevant files.
45
- > Return: concise map — what exists, what needs to change, potential conflicts.
73
+ > Return: concise map — what exists per stack, what needs change, potential conflicts.
46
74
 
47
- **Agent 2 — `architect`** (only run if Story shows architectural changes:
48
- new service/module, data flow changes, external system integration,
49
- database schema changes, new design pattern):
50
- > Evaluate architectural implications of Story: "{Story title}".
75
+ **Agent 2 — `architect`** (only if Feature shows architectural changes:
76
+ new service/module, data flow change, external integration, schema change, new design pattern):
77
+ > Evaluate architectural implications of Feature: "{Feature title}".
51
78
  > Read `docs/sad.md` (if exists) and files in `docs/adr/`.
52
79
  > Read `.tas/rules/common/patterns.md`.
53
80
  > Return: which ADRs relate, patterns to follow, architectural risks, constraints.
54
81
 
55
- Wait for ALL agents to finish, synthesize findings.
82
+ Wait for ALL agents to finish, synthesize.
56
83
 
57
84
  ### Step 3 — Ask about SAD/ADR (if still unclear)
58
85
 
59
- After seeing agent findings, if need to reference specific SAD or ADR:
60
- > "I need to read [SAD / ADR-XXX] to clarify [reason]. OK?"
86
+ If need to reference specific SAD section or ADR:
87
+ - **Manual mode:** ask
88
+ > "I need to read [SAD section X / ADR-XXX] to clarify [reason]. OK?"
89
+ Only read after user confirms.
90
+ - **Autonomous mode:** auto-read. Log path + reason to Feature `## Autonomous Decisions Log`.
61
91
 
62
- Only read after user confirms.
92
+ ### Step 4 API Design (if Feature involves backend API)
63
93
 
64
- ### Step 4 API Design (if Story involves backend API)
65
-
66
- **If Story shows API design** (new endpoint, API contract change, exposing service):
67
- Read `.tas/rules/common/api-design.md` for REST API conventions, then design API Spec before planning:
94
+ If Feature shows API design (new endpoint, contract change, exposing service):
95
+ Read `.tas/rules/common/api-design.md` for REST conventions, then design API Spec:
68
96
  - URL structure, HTTP methods, status codes
69
- - Request/response payload shape
97
+ - Request/response payload shape (JSON schema examples)
70
98
  - Pagination, filtering if needed
71
- - Error response format
72
-
73
- Attach API Spec to **Technical Plan → API Contract** section in Story.
74
- If Story not API-related → skip this step.
75
-
76
- ### Step 5 — Technical Analysis
77
-
78
- Based on Story + agent findings, list clearly:
99
+ - Error codes + response format
79
100
 
80
- **Files to change:**
81
- | File | What change | Why |
101
+ This API Spec goes into the Technical file's **API Spec** section.
82
102
 
83
- **Files to create** (if any):
84
- | File | Purpose |
103
+ ### Step 4.5 Estimate Size + Choose Split Mode
85
104
 
86
- **Database changes** (if any): migration, schema changes, seed data
105
+ Before drafting full content, estimate plan size from agent survey findings:
87
106
 
88
- **Config/Infrastructure changes** (if any): env vars, feature flags, new dependencies
107
+ - Count stacks involved
108
+ - Estimate tasks per stack (1 task ≈ 1–2h AI coding time)
89
109
 
90
- **Need to update SAD?** Yes/No + brief reason
110
+ **Choose `split_mode`:**
91
111
 
92
- **Need new ADR?** Yes/No + brief reason
93
-
94
- ### Step 6 Propose approach
95
-
96
- If multiple feasible approaches, list 2-3 options:
97
- ```
98
- Option A: [short description]
99
- + [pro]
100
- - [con]
112
+ | Condition | split_mode |
113
+ |---|---|
114
+ | 2 stacks AND total tasks ≤ 4 | `single` |
115
+ | 2–3 stacks OR any stack total tasks > 4, stacks independently implementable | `stack-split` |
116
+ | 3+ stacks OR sub-flows that cut across stacks (one part touches multiple stacks together) | `sub-feature-split` |
101
117
 
102
- Option B: [short description]
103
- + [pro]
104
- - [con]
105
- ```
106
- Recommend best option and reason. If only 1 approach → present directly.
118
+ State chosen mode explicitly before drafting:
119
+ > "Chosen `split_mode: {mode}`. Reason: {N stacks, ~X total tasks, Y condition}."
107
120
 
108
- ### Step 7Break Tasks
121
+ ### Step 5Draft Technical Plan (in-conversation, NOT yet written to file)
109
122
 
110
- Break down into implementation-order tasks. Each task ~1-2 hours:
111
- ```
112
- - [ ] Task 1: [specific action — which file, what change]
113
- - [ ] Task 2: [specific action]
114
- - [ ] Task 3: Write unit tests for [AC-1, AC-2...]
115
- - [ ] Task 4: [if needed] Create ADR / update SAD
116
- ```
123
+ Read `.tas/templates/Feature-Technical.md` for structure. Read `.tas/rules/common/sad-impact.md` for SAD Impact Matrix trigger list. Draft based on chosen `split_mode`.
117
124
 
118
- If total estimate > 8 hourssuggest splitting Story before continuing.
125
+ **Filling SAD Impact Matrix:** For each of the 8 categories in `sad-impact.md`, scan plan content (Tech Stack additions in Config tables, ERD `New tables`, Diagram new nodes, API Spec changes, Architecture Decisions rows) mark `Detected: Yes` if any signal applies, fill SAD section ref + change summary + ADR candidate flag. Set Technical-file frontmatter `sad_impact: true` if any row Yes.
119
126
 
120
- ### Step 8 Wait for approval
127
+ **Stack-specific scaffolding rules** (read only when applicable, before drafting Execution Plan):
128
+ - **.NET / C# backend AND target dir has no `*.sln`** → Read `.tas/rules/csharp/torus-core-framework.md`. Pin exact `torus-bootstrap create ...` command (with all chosen flags) as the first step in Execution Plan.
121
129
 
122
- **STOP.** Display entire plan and ask:
123
- > "Does the Technical Plan above look OK? Any adjustments?"
130
+ **Global sections (always in index/main file, regardless of split_mode):**
131
+ - **Context Diagram** all containers involved, callers, DBs touched, external systems (Mermaid)
132
+ - **Data Flow** — end-to-end data journey across all stacks (Mermaid)
133
+ - **API Spec** — (only if Feature exposes new/changed interfaces) contracts between stacks
134
+ - **ERD** — tables involved; new tables/columns/indexes (Mermaid)
135
+ - **SAD Impact Matrix** — fill per `.tas/rules/common/sad-impact.md` (8 categories). Set frontmatter `sad_impact: true` if any row `Detected: Yes`. Auto-invoke `/tas-sad` happens in `/tas-dev` Step 5, not here.
136
+ - **Architecture Decisions** — document all significant design decisions + rationale; mark candidates for ADR review (human decides)
137
+ - **Execution Plan** — table of parts/stacks with file refs, dependency order, parallel-safe flag, est. time
124
138
 
125
- - If user approves Step 9
126
- - If user has feedback → update plan, ask again
127
- - DO NOT write anything to Story before approval
139
+ **Per-stack / per-part detail sections location depends on split_mode:**
128
140
 
129
- ### Step 9 Write Technical Plan to Story
141
+ | split_mode | Where to put Logic Flow / File Changes / Config / Unit Tests / Tasks |
142
+ |---|---|
143
+ | `single` | In main file, one section per stack (classic format) |
144
+ | `stack-split` | In child files `Feature-{NNN}-Technical-{stack}.md` — use `Feature-Technical-Stack.md` template. Main file has NO stack detail. |
145
+ | `sub-feature-split` | In child files `Feature-{NNN}-Technical-{part-slug}.md` — use `Feature-Technical-Part.md` template. Main file has NO part detail. |
130
146
 
131
- After approval, update Story file:
147
+ For `stack-split` / `sub-feature-split`: draft both the index content AND child file content in-conversation (all visible in one response for review), clearly labeled.
132
148
 
133
- **1. Add section `## Technical Plan`** to Story (replace comment placeholder):
149
+ If multiple feasible approaches:
150
+ - **Manual mode:** list 2–3 options with pros/cons and recommend one.
151
+ - **Autonomous mode:** auto-pick simplest path that satisfies AC + matches existing patterns from code-explorer. Document in `Architecture Decisions` section with `Auto-selected: true`. Mark high-impact decisions as ADR candidates (still human-triggered).
134
152
 
135
- ```markdown
136
- ## Technical Plan
137
- > **Plan by:** {SE name} | **Date:** {current date}
153
+ ### Step 6 — Wait for approval
138
154
 
139
- ### Approach
140
- {Brief description of chosen approach and reason}
155
+ - **Manual mode: STOP.** Display the entire draft and ask:
156
+ > "Technical Plan above OK? Any adjustments before I write it to file?"
157
+ - If user approves → Step 7
158
+ - If user has feedback → update draft, ask again
159
+ - DO NOT write any file before approval
160
+ - **Autonomous mode:** skip wait. Continue Step 7 directly. Log skipped-approval entry.
141
161
 
142
- ### Files to Change
143
- | File | Change | Reason |
144
- |------|--------|--------|
162
+ ### Step 7 — Write Technical file
145
163
 
146
- ### Files to Create
147
- | File | Purpose |
148
- |------|---------|
164
+ After approval:
149
165
 
150
- ### Database Changes
151
- {If none: "None"}
166
+ **1. Write Technical file(s)** in same directory as Feature file:
152
167
 
153
- ### Config Changes
154
- {If none: "None"}
168
+ **If `split_mode: single`:**
169
+ - Create `{CODE}-Feature-{NNN}-{slug}-Technical.md` using `.tas/templates/Feature-Technical.md`
170
+ - Fill frontmatter: `feature_id`, `feature_file`, `plan_by`, `plan_date`, `status: Draft`, `split_mode: single`
171
+ - Fill all global sections + all involved stack sections
155
172
 
156
- ### Architecture Notes
157
- - SAD update needed: Yes/No
158
- - New ADR needed: Yes/No — {title if Yes}
173
+ **If `split_mode: stack-split`:**
174
+ - Create index `{CODE}-Feature-{NNN}-{slug}-Technical.md`:
175
+ - Fill frontmatter with `split_mode: stack-split`
176
+ - Global sections + Execution Plan only — NO stack detail sections
177
+ - For each involved stack, create `{CODE}-Feature-{NNN}-{slug}-Technical-{stack}.md` using `.tas/templates/Feature-Technical-Stack.md`:
178
+ - Fill `parent_technical_file` pointing to index file
179
+ - Fill Logic Flow, File Changes, Config, Unit Tests, Tasks for that stack only
159
180
 
160
- ### Tasks
161
- - [ ] Task 1: ...
162
- - [ ] Task 2: ...
163
- - [ ] Task 3: Write unit tests
164
- ```
181
+ **If `split_mode: sub-feature-split`:**
182
+ - Create index `{CODE}-Feature-{NNN}-{slug}-Technical.md`:
183
+ - Fill frontmatter with `split_mode: sub-feature-split`
184
+ - Global sections + Execution Plan only — NO part detail
185
+ - For each part, create `{CODE}-Feature-{NNN}-{slug}-Technical-{part-slug}.md` using `.tas/templates/Feature-Technical-Part.md`:
186
+ - Fill `parent_technical_file`, `part_id`, `part_title`, `stacks_involved`
187
+ - Fill stack sections only for stacks this part touches
165
188
 
166
- **2. Update frontmatter:**
189
+ **2. Update Feature frontmatter:**
167
190
  - `plan_status: completed`
168
191
  - `plan_date: {current datetime}`
192
+ - If autonomous run: also set `autonomous_run: true` + `autonomous_run_date: {datetime}` (preserve if already true from prior step)
169
193
 
170
194
  **3. Update `project-status.yaml`:**
171
195
  - `last_updated: {current date}`
172
- - `epics.{EPIC_ID}.features.{FEATURE_ID}.stories.{STORY_ID}.plan_status: completed`
196
+ - `features.{FEATURE_ID}.plan_status: completed`
197
+ - `features.{FEATURE_ID}.technical_file: {path}`
173
198
 
174
- **4. If ADR needed:** run `/tas-adr "{Decision title}"` immediately after writing plan.
199
+ **4. Document architectural decisions in Technical file ADR creation is human-triggered:**
200
+ - Significant decisions go in "Architecture Decisions" section
201
+ - Mark candidates for ADR review (`Yes` in ADR Candidate column)
202
+ - **Do NOT auto-run `/tas-adr`** — human will review and decide
175
203
 
176
- ### Step 10 — Notify next step
177
- > "Technical Plan written to Story. SE can start implementing with `/tas-dev {Story-ID}`."
204
+ ### Step 8 — Notify next step
205
+ - **Manual mode:**
206
+ > "Technical Plan written: `{path-to-Technical.md}`. SE can start implementing with `/tas-dev {Feature-ID}`."
207
+ - **Autonomous mode (when invoked inline by `/tas-dev`):** Output **zero text**. Do NOT print any message, summary, or status to the user — any text output ends the turn and forces a manual "ok". After file writes complete, execution returns automatically to the calling `tas-dev` Step 2. Silence is required.
178
208
 
179
209
  ---
180
210
 
181
- ## Quick Mode (require_plan: false in tas.yaml)
211
+ ## Quick Mode (`require_plan: false` in tas.yaml)
182
212
 
183
213
  For: solo dev, prototype, spike, urgent hotfix.
184
214
 
185
215
  - `/tas-dev` will NOT require running `/tas-plan` first
186
- - `/tas-plan` can still be run voluntarily when Story is complex
216
+ - `/tas-plan` can still be run voluntarily when Feature is complex
187
217
  - Trade-off: higher speed, lower traceability
188
218
 
189
219
  ## Principles
190
- - Technical Plan lives in Story file — no separate plan file
191
- - Each task ~1-2 hours; whole Story ~4-8 hours
192
- - If estimate > 8 hours split Story
193
- - If task affects architecture suggest ADR
194
- - Keep plan concise, actionable don't write essays
220
+ - **Feature file = business spec only.** Never add sections beyond the template structure. No schema, SQL, code, data model, or technical diagrams in Feature file — all technical output belongs in Feature-Technical file.
221
+ - Technical Plan lives in **separate file(s)** next to the Feature — always start with `Feature-{NNN}-Technical.md` as index
222
+ - Each Task ~1–2 hours; break into smaller tasks if work block is unclear
223
+ - Only fill stack sections that this Feature actually touches — omit the rest
224
+ - Document all significant architectural decisions in "Architecture Decisions" section; mark candidates for ADR review
225
+ - **ADR creation requires human approval** — SE documents decision + rationale, human decides if formal ADR needed
226
+ - Keep plan concise, actionable — no essays
227
+ - **Split mode rules:** `single` when ≤ 2 stacks + ≤ 4 tasks total; `stack-split` when stacks are independently implementable; `sub-feature-split` when sub-flows cut across stacks
228
+ - Child files contain implementation detail only — global context (ERD, API Spec, etc.) lives in index, child references it by link, no duplication
229
+ - Execution Plan in index is the orchestration contract for `tas-dev` — must be accurate and complete before writing files
195
230
 
196
231
  ## Final Step — Token Log
197
232
 
198
- Follow `.tas/rules/common/token-logging.md`: write AI Usage Log to working Story file.
233
+ Follow `.tas/rules/common/token-logging.md`: write AI Usage Log to working Feature file.
@@ -1,37 +1,57 @@
1
- # /tas-prd $ARGUMENTS
2
-
3
- Role: PE - Product Engineer
4
- Create or update Product Requirements Document.
5
-
6
- ## Actions
7
- 1. Need context from root/tas.yaml for project context
8
- 2. Check if docs/prd.md already exists:
9
-
10
- ### CREATE mode (file doesn't exist):
11
- 3. Need context from .tas/templates/PRD.md
12
- 4. If $ARGUMENTS has content, use as product description input
13
- 5. If no $ARGUMENTS, ask user:
14
- - What problem does the product solve?
15
- - Who are the main users?
16
- - What are core features?
17
- - Any technical/business constraints?
18
- 6. Create file docs/prd.md per template
19
- 7. Update `project-status.yaml` per `.tas/rules/common/project-status.md` — add `artifacts.prd`.
20
-
21
- ### UPDATE mode (file exists):
22
- 3. Need context from current docs/prd.md
23
- 4. $ARGUMENTS is change description. If not provided, ask user which section to update.
24
- 5. Update file, keep unchanged sections as-is
25
- 6. Add line to Changelog section at end: date, change description
26
- 7. Update `project-status.yaml` per `.tas/rules/common/project-status.md` update `artifacts.prd`.
27
-
28
- ## Principles
29
- - Write at sufficient detail for SE to understand and design architecture
30
- - Classify requirements by MoSCoW: Must/Should/Could/Won't
31
- - Each requirement has unique ID: FR-001, NFR-001
32
- - Always include Non-Goals section to limit scope
33
- - Mermaid diagrams must use :::mermaid wrapper, NO () characters
34
-
35
- ## Final Step Token Log
36
-
37
- Follow `.tas/rules/common/token-logging.md`: write AI Usage Log to `docs/prd.md`.
1
+ ---
2
+ model: opus
3
+ ---
4
+
5
+ # /tas-prd $ARGUMENTS
6
+
7
+ Role: PE - Product Engineer
8
+ Create or update Product Requirements Document.
9
+
10
+ ## Actions
11
+ 1. Read root/tas.yaml for project context
12
+ 2. Check if docs/brd.md exists store result as HAS_BRD (yes/no)
13
+ 3. Check if docs/prd.md already exists:
14
+
15
+ ### CREATE mode (file doesn't exist):
16
+ 4. Read .tas/templates/PRD.md
17
+ 5. If HAS_BRD = yes: read docs/brd.md for business context
18
+ 6. If $ARGUMENTS has content, use as product description input
19
+ 7. If no $ARGUMENTS, ask user:
20
+ - What product or feature does this PRD cover?
21
+ - Who are the primary users / personas?
22
+ - What are the core features (P0 must-haves)?
23
+ - Any technical or integration constraints?
24
+ - (Skip business goal questions if HAS_BRD = yes — read from BRD instead)
25
+ 8. Create file docs/prd.md per template:
26
+ - **If HAS_BRD = yes:** Fill Business Context using "WITH BRD" format — summary (2-3 sentences from BRD Problem Statement) + link to brd.md + Business Goals bullets copied from BRD. Remove STANDALONE format blocks.
27
+ - **If HAS_BRD = no:** Fill Business Context using "STANDALONE" format — fill all sub-sections (Why Now, User Research, Market Analysis, Business Goals, User Goals). Remove WITH BRD format blocks.
28
+ 9. Update `project-status.yaml` per `.tas/rules/common/project-status.md` — add `artifacts.prd`
29
+
30
+ ### UPDATE mode (file exists):
31
+ 4. Read current docs/prd.md
32
+ 5. If HAS_BRD = yes: read docs/brd.md to stay aligned with business context
33
+ 6. $ARGUMENTS is change description. If not provided, ask user which section to update.
34
+ 7. Update file, keep unchanged sections as-is
35
+ 8. If HAS_BRD = yes and Business Context section is in STANDALONE format: offer to collapse it to WITH BRD format
36
+ 9. Add line to Changelog section at end: date, change description
37
+ 10. Update `project-status.yaml` per `.tas/rules/common/project-status.md` update `artifacts.prd`
38
+
39
+ ## Principles
40
+ - **Two sections:** Business Context (problem, goals, research) + Product Specification (features, AC, flows)
41
+ - Business Context adapts to BRD presence — never duplicate full business analysis when BRD exists
42
+ - Write Acceptance Criteria in Given/When/Then format — each AC generates test ID + automated test
43
+ - Write at sufficient detail for SE to understand and design architecture
44
+ - Classify requirements by MoSCoW: Must/Should/Could/Won't
45
+ - Each requirement has unique ID: FR-001, NFR-001
46
+ - Always include Non-Goals section to limit scope
47
+ - Mermaid diagrams must use :::mermaid wrapper, NO () characters
48
+
49
+ ## Flow Context
50
+ - Upstream: BRD (optional) → **PRD** → Feature → Feature-Technical
51
+ - `/tas-brd` creates `docs/brd.md` (business level: why, goals, stakeholders, constraints)
52
+ - `/tas-prd` creates `docs/prd.md` (product level: features, AC, UX, NFR)
53
+ - `/tas-feature` uses PRD as input to create Feature files
54
+
55
+ ## Final Step — Token Log
56
+
57
+ Apply `.tas/rules/common/token-logging.md` to `docs/prd.md` NOW (do not defer, do not leave placeholder text). Estimate input/output tokens from this session per the rule, then fill the `## AI Usage Log` table row and Total. The PRD template already includes the skeleton — replace `~{N}k` with actual estimates.