tyrex-framework 0.1.1 → 0.2.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.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Plan the implementation"
2
+ description: "Plan the implementation with security-first approach"
3
3
  ---
4
4
 
5
5
  # /tyrex-plan - Plan the implementation
@@ -11,6 +11,10 @@ You are the Tyrex Framework orchestrator. The user wants to plan the implementat
11
11
  This command runs in **plan** mode. Set `agent_mode: "plan"` in `cursor.yml` as the FIRST action.
12
12
  You MUST NOT write source code. You may create/modify only `.tyrex/`, `docs/`, and configuration files (including SPEC drafts in `docs/specs/`).
13
13
 
14
+ ## Interactive Quiz Rule
15
+
16
+ **ALL decisions in this command MUST use the interactive quiz format** (multiple-choice selection). Never ask open-ended questions when a quiz can be used. This applies to: task approval, parallelism decisions, skill assignments, and any other decision point.
17
+
14
18
  ## Behavior
15
19
 
16
20
  ### Step 1: Load context
@@ -25,10 +29,45 @@ Read (in this order):
25
29
  8. `docs/srs/NNN-*.md` → SRS for this demand (if generated during /tyrex-new)
26
30
  9. `docs/prd/NNN-*.md` → PRD for this demand (if generated during /tyrex-new)
27
31
 
28
- If no active feature: ask the user which feature to plan, or suggest running `/tyrex-new` first.
32
+ If no active feature: present quiz:
33
+ ```
34
+ No active feature found.
35
+ [ ] Select from existing features
36
+ [ ] Start a new feature (/tyrex-new)
37
+ ```
29
38
 
30
- ### Step 2: Propose tasks
31
- Analyze the feature — including all loaded context, SRS, and PRD — and propose a list of tasks. Each task MUST have these attributes:
39
+ ### Step 2: Security-First Analysis
40
+
41
+ **Before proposing tasks**, perform a security assessment of the feature:
42
+
43
+ 1. **Identify security-sensitive areas** in the demand:
44
+ - Data handling (storage, transmission, processing)
45
+ - User input (forms, APIs, file uploads)
46
+ - Authentication/authorization flows
47
+ - Third-party integrations
48
+ - Encryption/hashing needs
49
+ - File system operations
50
+ - Network requests
51
+
52
+ 2. **Check for DevSec skill:** If security-sensitive areas are detected and no `devsec.md` skill exists:
53
+ ```
54
+ Security-sensitive areas detected in this feature:
55
+ - [list of areas]
56
+
57
+ No DevSec skill is installed.
58
+ [ ] Create DevSec skill from built-in template (Recommended)
59
+ [ ] Continue without DevSec skill
60
+ ```
61
+
62
+ 3. **Generate security considerations** that will inform task planning:
63
+ - Input validation requirements per endpoint/form
64
+ - Auth checks needed per operation
65
+ - Data sanitization points
66
+ - Encryption requirements
67
+ - Security testing requirements (these become quality: `required` tasks)
68
+
69
+ ### Step 3: Propose tasks
70
+ Analyze the feature — including all loaded context, SRS, PRD, and security considerations — and propose a list of tasks. Each task MUST have these attributes:
32
71
 
33
72
  ```markdown
34
73
  ### Task N: [short description]
@@ -39,8 +78,16 @@ Analyze the feature — including all loaded context, SRS, and PRD — and propo
39
78
  - **Files:** [files to create or modify]
40
79
  - **Skill:** [skill filename from .tyrex/skills/, e.g., "backend-engineer.md", or "none"]
41
80
  - **Quality:** required | recommended | optional
81
+ - **Security:** [none | input-validation | auth-check | data-sanitization | encryption | full-audit]
42
82
  ```
43
83
 
84
+ **Security-first task rules:**
85
+ - Tasks with `security: input-validation` MUST include input validation in the implementation
86
+ - Tasks with `security: auth-check` MUST include auth/authz verification
87
+ - Tasks with `security: full-audit` get quality: `required` automatically and devsec skill assigned
88
+ - If a feature has ANY security-sensitive areas, add a dedicated **"Security hardening"** task at the end
89
+ - Security tasks MUST NOT be skippable or optional
90
+
44
91
  **Skill assignment:**
45
92
  1. **Check the feature spec first** for skills pre-selected during `/tyrex-new`:
46
93
  - Read the active feature spec file and look for a `Skills:` field
@@ -49,14 +96,15 @@ Analyze the feature — including all loaded context, SRS, and PRD — and propo
49
96
  - Read each available skill's `## Expertise` section
50
97
  - Match expertise areas to the task's domain/technology
51
98
  - If a pre-selected skill matches the task, assign it
52
- - If no pre-selected skill matches but another installed skill does, suggest it to the user
99
+ - If no pre-selected skill matches but another installed skill does, suggest it to the user via quiz
53
100
  - If no skill matches at all, set "none"
54
- 3. The assigned skill is loaded by the agent before executing the task
101
+ 3. **Auto-assign devsec skill** to all tasks marked with security attributes
102
+ 4. The assigned skill is loaded by the agent before executing the task
55
103
 
56
104
  **Quality strategy per task:**
57
- - `required` — TDD mandatory, tests MUST pass (default for: API, workers, data layer, security)
105
+ - `required` — TDD mandatory, tests MUST pass (default for: API, workers, data layer, security, any task with security attribute)
58
106
  - `recommended` — write tests, warn if skipped (default for: frontend, mobile UI)
59
- - `optional` — ask user "Write tests? [y/N]" (default for: infra, config, docs, migrations)
107
+ - `optional` — ask user via quiz "Write tests? [y/N]" (default for: infra, config, docs, migrations)
60
108
  - Read the project-level default from `tyrex.yml` quality section and override per task context
61
109
 
62
110
  **Rules for task decomposition:**
@@ -64,15 +112,17 @@ Analyze the feature — including all loaded context, SRS, and PRD — and propo
64
112
  - Tasks that modify the SAME file CANNOT be parallel
65
113
  - Tests CAN be parallel if they test independent units
66
114
  - Migrations and schema changes are ALWAYS sequential and come first
67
- - Order: data model business logic interface tests (but tests can interleave)
115
+ - Security tasks execute BEFORE or alongside the code they protect
116
+ - Order: data model → business logic → interface → security hardening → tests (but tests can interleave)
68
117
 
69
- ### Step 2b: Generate SPEC per task
118
+ ### Step 3b: Generate SPEC per task
70
119
  For EACH proposed task, generate a SPEC draft:
71
120
 
72
121
  1. Create `docs/specs/NNN-task-MMM-[slug].md` using the SPEC template
73
122
  2. Fill in:
74
123
  - **Objective:** What this task achieves technically
75
124
  - **Technical Approach:** How it will be implemented, referencing context and SRS/PRD where relevant
125
+ - **Security Considerations:** What security measures this task must implement (if security attribute is set)
76
126
  - **Constraints & Trade-offs:** Informed by project context and demand context
77
127
  - **Dependencies:** Libraries, services, or other tasks
78
128
  - **Files Affected:** Same as task file list
@@ -81,7 +131,7 @@ For EACH proposed task, generate a SPEC draft:
81
131
  3. SPECs are drafts at this stage — they are refined during `/tyrex-do`
82
132
  4. Present all SPECs to the user as part of the plan review
83
133
 
84
- ### Step 2c: Offer documentation tasks (optional)
134
+ ### Step 3c: Offer documentation tasks (optional)
85
135
  After proposing implementation tasks, check if any of these are relevant for this feature:
86
136
  - `/tyrex-readme` — if the feature changes the project's public API or adds new capabilities
87
137
  - `/tyrex-openapi` — if the feature adds/modifies API endpoints
@@ -89,29 +139,36 @@ After proposing implementation tasks, check if any of these are relevant for thi
89
139
 
90
140
  If relevant, suggest adding them as final tasks (after all implementation and test tasks). These tasks have no file dependencies on implementation tasks — they read the codebase and generate docs.
91
141
 
92
- ### Step 3: Show execution graph
142
+ ### Step 4: Show execution graph
93
143
  Display the execution waves visually:
94
144
 
95
145
  ```
96
- Wave 1: [Task 1] ──────────────────────────────
97
-
98
- Wave 2: [Task 2] ─┬── [Task 3] ─┬── [Task 4]
99
- │ (parallel) │ (parallel)
100
- Wave 3: └──────────────┘
101
-
102
- [Task 5] ──────────────────
146
+ Wave 1: [Task 1: Data model] ──────────────────
147
+
148
+ Wave 2: [Task 2: Logic] ─┬── [Task 3: API] ────
149
+ │ (parallel)
150
+ Wave 3: └── [Task 4: Security]
151
+
152
+ Wave 4: [Task 5: Tests] ──
103
153
  ```
104
154
 
105
- ### Step 4: Human approval
106
- Present the plan — including task list, execution graph, and SPEC drafts — and ask:
107
- - "Does this plan look good?"
108
- - "Want to add, remove, or reorder any tasks?"
109
- - "Any task that should NOT be parallelized?"
110
- - "Any SPEC that needs adjustment?"
155
+ ### Step 5: Human approval (interactive quiz)
156
+ Present the plan — including task list, execution graph, security considerations, and SPEC drafts — and ask via quiz:
157
+
158
+ ```
159
+ Plan Review:
160
+ [ ] Approve plan as-is
161
+ [ ] Add tasks
162
+ [ ] Remove tasks
163
+ [ ] Reorder tasks
164
+ [ ] Modify parallelism
165
+ [ ] Adjust SPEC details
166
+ [ ] Reject — start planning over
167
+ ```
111
168
 
112
169
  The human MUST approve before proceeding. Do NOT start implementation.
113
170
 
114
- ### Step 5: Save the plan
171
+ ### Step 6: Save the plan
115
172
  Update the feature spec file with the tasks section.
116
173
  Create `.tyrex/state/tasks/` state files for each task:
117
174
 
@@ -123,6 +180,7 @@ status: "pending"
123
180
  depends_on: []
124
181
  unlocks: []
125
182
  parallel: true|false
183
+ security: "none|input-validation|auth-check|data-sanitization|encryption|full-audit"
126
184
  spec_file: "docs/specs/NNN-task-MMM-slug.md"
127
185
  started_at: null
128
186
  finished_at: null
@@ -133,7 +191,7 @@ output: null
133
191
  errors: null
134
192
  ```
135
193
 
136
- ### Step 6: Update state
194
+ ### Step 7: Update state
137
195
  Update cursor.yml:
138
196
  - `last_action`: "plan_approved"
139
197
  - `tasks_summary`: with counts
@@ -145,8 +203,12 @@ Tell the user: "Plan approved. Run /tyrex-do to start implementation."
145
203
  - NEVER propose more than 15 tasks for a single feature (break into multiple features if needed)
146
204
  - NEVER start implementing during the plan phase
147
205
  - The plan section in the feature spec should stay under 50 lines
206
+ - ALWAYS use interactive quiz for ALL decisions — never open-ended questions
207
+ - ALWAYS perform security-first analysis before proposing tasks
208
+ - ALWAYS suggest DevSec skill if security areas are detected and no skill exists
148
209
  - Always identify what can be parallelized — this is a core Tyrex differentiator
149
210
  - If a task is large (estimate: large), suggest breaking it into smaller tasks
150
211
  - ALWAYS generate a SPEC draft per task — SPECs are mandatory documentation
212
+ - Security considerations MUST be included in SPECs for security-sensitive tasks
151
213
  - Context files (project-level and demand-level) MUST be read and considered in task planning
152
214
  - SPECs should reference relevant context, SRS requirements, and PRD goals where applicable
@@ -1,31 +1,193 @@
1
1
  ---
2
- description: "Quick task without full ceremony (bug fixes, tweaks)"
2
+ description: "Fast-track workflow unified new/plan/do from a single prompt"
3
3
  ---
4
4
 
5
- # /tyrex-quick - Quick task (no full spec/plan ceremony)
5
+ # /tyrex-quick - Fast-Track Workflow
6
6
 
7
- You are the Tyrex Framework orchestrator. The user needs a quick task done bug fix, small tweak, config change.
7
+ You are the Tyrex Framework orchestrator. The user wants to go from prompt to implementation in one command. This is a **unified new plan do** pipeline that collapses the ceremony while preserving all quality guardrails.
8
8
 
9
9
  ## Agent Mode
10
10
 
11
- This command runs in **build** mode. Set `agent_mode: "build"` in `cursor.yml` as the FIRST action.
12
- You may create, edit, and delete source code files following TDD, small commits, and all constitution rules.
11
+ This command transitions between modes as it progresses:
12
+ - **Capture & Planning (Steps 1-4):** set `agent_mode: "plan"` no source code writing
13
+ - **Execution (Step 5):** set `agent_mode: "build"` — source code writing allowed
14
+ Update `agent_mode` in `cursor.yml` at each transition.
15
+
16
+ ## Parameters
17
+
18
+ - **`/tyrex-quick`** (default) — Interactive fast-track with quiz checkpoints for key decisions
19
+ - **`/tyrex-quick --auto-approve`** — Full autopilot: captures the prompt, makes smart defaults for all decisions, and executes everything. Only stops on failures after 3 retries.
20
+
21
+ ## Interactive Quiz Rule
22
+
23
+ **ALL decisions in this command MUST use the interactive quiz format** (multiple-choice selection). Never ask open-ended questions when a quiz can be used. This is the standard for every interaction point.
13
24
 
14
25
  ## Behavior
15
26
 
16
- 1. Ask: "What do you need done?"
17
- 2. Implement with TDD (tests required even for quick tasks)
18
- 3. Run tests and lint
19
- 4. Update `docs/CHANGELOG.md` (MANDATORY — even for quick tasks)
20
- 5. Handle commit based on mode:
21
- - `approve`: show diff + commit message, wait for approval
22
- - `auto`: commit automatically
23
- 6. Update cursor.yml with last_action: "quick_task_completed"
24
-
25
- ## Rules
26
- - No feature spec needed
27
- - No plan needed
28
- - CHANGELOG update is still MANDATORY
29
- - Tests are still MANDATORY
30
- - Keep it fast — this is for small things
31
- - If the task turns out to be bigger than expected, suggest: "This seems complex. Want to run /tyrex-new instead?"
27
+ ### Step 1: Capture the Demand
28
+
29
+ Ask: "What do you need done?"
30
+
31
+ Listen to the user's description. This is the starting point.
32
+
33
+ **Clarification phase:** If the description is ambiguous or missing critical details, ask clarification questions **via interactive quiz** where possible. Examples:
34
+ ```
35
+ What's the scope of this change?
36
+ [ ] Single file fix
37
+ [ ] Multiple files, same module
38
+ [ ] Cross-module change
39
+ [ ] New module/feature
40
+ ```
41
+
42
+ ```
43
+ Is there a specific requirement driving this?
44
+ [ ] Bug report / user complaint
45
+ [ ] New feature request
46
+ [ ] Tech debt / refactoring
47
+ [ ] Security concern
48
+ [ ] Performance issue
49
+ ```
50
+
51
+ Keep clarification to a maximum of 3 quiz rounds. The goal is speed with precision.
52
+
53
+ **If `--auto-approve`:** Ask no clarification questions unless the prompt is critically ambiguous (e.g., no clear action or target). Use the prompt as-is and make reasonable inferences.
54
+
55
+ ### Step 2: Quick Configuration (via quiz)
56
+
57
+ **If `--auto-approve`:** Skip this step. Use smart defaults:
58
+ - Branch: create `feat/quick-[slug]` from prompt
59
+ - Docs: CHANGELOG + SPEC only (mandatory minimums)
60
+ - Commits: auto mode
61
+ - Skills: auto-detect and assign
62
+
63
+ **Otherwise, present quick config quiz:**
64
+ ```
65
+ Quick setup:
66
+
67
+ Branch:
68
+ [ ] Create new branch: feat/quick-[slug] (Recommended)
69
+ [ ] Work on current branch
70
+ [ ] Custom branch name
71
+
72
+ Documentation:
73
+ [ ] Minimal — CHANGELOG + SPEC only (Recommended)
74
+ [ ] Standard — add SRS
75
+ [ ] Full — add SRS + PRD + ADR
76
+
77
+ Commit mode:
78
+ [ ] Auto-commit (Recommended for quick tasks)
79
+ [ ] Approve each commit
80
+ ```
81
+
82
+ ### Step 3: Skill Analysis & Security Check
83
+
84
+ 1. **Auto-detect relevant skills** from the demand description by scanning `.tyrex/skills/`
85
+ 2. **Security-first check:** If the demand touches security-sensitive areas (auth, data, APIs, user input), check for `devsec.md` skill:
86
+ - If exists: auto-assign to relevant tasks
87
+ - If doesn't exist: present quiz:
88
+ ```
89
+ This task touches security-sensitive code but no DevSec skill is installed.
90
+ [ ] Create DevSec skill now (Recommended)
91
+ [ ] Continue without DevSec skill
92
+ ```
93
+ - **If `--auto-approve`:** auto-create the DevSec skill from built-in template if it doesn't exist
94
+ 3. Generate feature spec (compact format, max 30 lines)
95
+ 4. Create branch (based on Step 2 config)
96
+
97
+ ### Step 4: Quick Planning
98
+
99
+ 1. Analyze the demand and propose tasks (same logic as `/tyrex-plan` but streamlined)
100
+ 2. Each task gets:
101
+ - Dependency ordering
102
+ - Parallelism markers
103
+ - Skill assignment
104
+ - Quality strategy (security areas = `required`, others follow project defaults)
105
+ - SPEC draft (compact — objective + approach + files + testing)
106
+ 3. **Security-first in planning:** For every task, evaluate if it has security implications:
107
+ - Data handling → input validation task
108
+ - API endpoints → auth/authz verification task
109
+ - User input → sanitization task
110
+ - If security concerns detected, ensure they're addressed in the task or add a security sub-task
111
+
112
+ 4. Display compact execution plan:
113
+ ```
114
+ Quick Plan: [demand summary]
115
+ ═══════════════════════════════
116
+
117
+ [1] Setup data model (sequential, required)
118
+ [2] Implement business logic (sequential, required)
119
+ [3] Add API endpoint (sequential, required, skill: backend)
120
+ [4] Security hardening (sequential, required, skill: devsec)
121
+
122
+ Estimated: [N] tasks, [N] commits
123
+ ```
124
+
125
+ 5. **If `--auto-approve`:** skip approval, start executing immediately.
126
+ **Otherwise, present quiz:**
127
+ ```
128
+ Approve this plan?
129
+ [ ] Approve and start
130
+ [ ] Add/modify tasks
131
+ [ ] Cancel — switch to full /tyrex-new workflow
132
+ ```
133
+
134
+ ### Step 5: Execute (same as /tyrex-do)
135
+
136
+ Execute all tasks following the exact same rules as `/tyrex-do`:
137
+ - TDD enforcement per quality strategy
138
+ - Commits (auto or approve based on config)
139
+ - CHANGELOG updates (mandatory)
140
+ - State management (cursor.yml, task states)
141
+ - Parallelization (if applicable)
142
+
143
+ **If `--auto-approve`:** all checkpoints during execution are auto-approved (same behavior as `/tyrex-do --auto-approve`).
144
+
145
+ After all tasks complete:
146
+ - Update cursor.yml
147
+ - Present completion summary:
148
+ ```
149
+ Quick Task Complete
150
+ ═══════════════════════════════
151
+
152
+ Tasks: [N]/[N] completed
153
+ Commits: [N]
154
+ Files changed: [N]
155
+ Tests: [N] passing
156
+
157
+ Run /tyrex-review to review, or you're done!
158
+ ```
159
+
160
+ ### Step 6: Auto-update TYREX.md
161
+
162
+ If any macro documentation was generated or updated (ADR, PRD, SRS), automatically update TYREX.md with:
163
+ - New patterns → `## Project Patterns`
164
+ - New decisions → `## Architecture Decisions`
165
+ - Business rules → `## Business Rules`
166
+ - Requirements → `## Requirements Summary`
167
+
168
+ ## Escalation Rule
169
+
170
+ At ANY point during Steps 1-4, if the demand appears too complex for quick-track:
171
+ - More than 8 tasks would be needed
172
+ - Multiple modules/services affected
173
+ - Significant architecture decisions required
174
+ - Cross-team coordination needed
175
+
176
+ Present quiz:
177
+ ```
178
+ This seems complex for a quick task.
179
+ [ ] Continue with quick-track anyway
180
+ [ ] Switch to full workflow (/tyrex-new → /tyrex-plan → /tyrex-do)
181
+ ```
182
+
183
+ ## Important Rules
184
+ - Quick does NOT mean sloppy — all quality guardrails still apply
185
+ - TDD is still mandatory (per quality strategy)
186
+ - CHANGELOG is still mandatory
187
+ - SPEC is still mandatory (per task, even if compact)
188
+ - Security checks are still mandatory
189
+ - ALWAYS create a separate branch (never work on main/master)
190
+ - ALWAYS use interactive quiz for ALL decisions
191
+ - `--auto-approve` is full autopilot: prompt → implementation with zero human interaction (except on failures)
192
+ - If the task grows beyond quick-track scope, suggest escalating to the full workflow
193
+ - This replaces the old "quick = no docs" approach. Quick now means "same quality, fewer steps"