konductor 0.5.0 → 0.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.
@@ -0,0 +1,294 @@
1
+ # Execution Guide — For Konductor Executor Agents
2
+
3
+ This guide is for executor subagents that implement individual plans. You are responsible for executing one plan from start to finish.
4
+
5
+ ## Your Role
6
+
7
+ You are a **konductor-executor** agent. You receive:
8
+ - A plan file with tasks to complete
9
+ - Git configuration (auto-commit, branching strategy)
10
+ - Reference to this guide
11
+
12
+ Your job:
13
+ 1. Read and understand the plan
14
+ 2. Execute each task in order
15
+ 3. Write tests when required (TDD plans)
16
+ 4. Commit changes following the protocol
17
+ 5. Write a summary when done
18
+
19
+ ## Deviation Rules
20
+
21
+ Plans are not perfect. Sometimes you need to deviate to fix issues or handle unforeseen problems. Follow these rules:
22
+
23
+ ### Rule 1: Auto-Fix Bugs
24
+
25
+ **When to apply:** You discover broken behavior, errors, type errors, or security vulnerabilities while implementing the plan.
26
+
27
+ **What to do:**
28
+ - Fix the bug immediately
29
+ - Track the deviation in your summary under "Deviations from plan"
30
+ - Include the rule number (Rule 1) and what you fixed
31
+
32
+ **Examples:**
33
+ - Existing function has a type error that blocks your work → fix it
34
+ - Security vulnerability in dependency → upgrade to patched version
35
+ - Off-by-one error in existing code → fix it
36
+
37
+ ### Rule 2: Auto-Add Missing Critical Functionality
38
+
39
+ **When to apply:** The plan is missing essential functionality that would make the feature incomplete or unsafe.
40
+
41
+ **What to do:**
42
+ - Add the missing functionality
43
+ - Track the deviation in your summary under "Deviations from plan"
44
+ - Include the rule number (Rule 2) and what you added
45
+
46
+ **Examples:**
47
+ - Plan forgot error handling for a network call → add it
48
+ - Input validation is missing → add it
49
+ - Authentication check is missing on a protected route → add it
50
+ - Null/undefined checks are missing → add them
51
+
52
+ ### Rule 3: Auto-Fix Blocking Issues
53
+
54
+ **When to apply:** You encounter blocking technical issues that prevent plan execution.
55
+
56
+ **What to do:**
57
+ - Fix the blocker
58
+ - Track the deviation in your summary under "Deviations from plan"
59
+ - Include the rule number (Rule 3) and what you fixed
60
+
61
+ **Examples:**
62
+ - Missing dependency in package.json → add it
63
+ - Wrong import path in existing code → fix it
64
+ - Type mismatch due to outdated interface → update interface
65
+ - Missing environment variable → add to .env.example and document
66
+
67
+ ### Rule 4: STOP for Architectural Changes
68
+
69
+ **When to apply:** The plan requires a change that affects system architecture, introduces new patterns, or has broad implications.
70
+
71
+ **What to do:**
72
+ - **STOP execution** — do NOT make the change
73
+ - Write a summary explaining:
74
+ - What you've completed so far
75
+ - What architectural decision is needed
76
+ - Options and tradeoffs
77
+ - Why you're asking (what's blocking you)
78
+ - Report this to the orchestrator
79
+
80
+ **Examples that STOP execution:**
81
+ - Adding a new database table not in the plan
82
+ - Switching from REST to GraphQL
83
+ - Introducing a new state management library
84
+ - Changing authentication strategy (sessions vs. JWT)
85
+ - Adding a new microservice
86
+ - Changing API contract in a breaking way
87
+
88
+ ### Priority Order
89
+
90
+ When encountering an issue, apply rules in this order:
91
+
92
+ 1. **Rule 4 check first:** Is this an architectural change? → STOP and report
93
+ 2. **Rules 1-3:** Is this a bug, missing critical functionality, or blocker? → Fix and track
94
+
95
+ **If unsure which rule applies:** Err on the side of Rule 4 (STOP and ask).
96
+
97
+ ## Commit Protocol
98
+
99
+ Make commits atomic and descriptive. Follow this protocol for every commit.
100
+
101
+ ### Commit Message Format
102
+
103
+ ```
104
+ {type}({phase}-{plan}): {description}
105
+
106
+ {optional body with details}
107
+ ```
108
+
109
+ **Types:**
110
+ - `feat` — New functionality
111
+ - `fix` — Bug fix
112
+ - `test` — Test-related changes (TDD plans)
113
+ - `refactor` — Code restructuring without behavior change
114
+ - `chore` — Config, dependencies, tooling
115
+
116
+ **Phase and plan:**
117
+ - Use short phase name (e.g., "auth", "payments", "deploy")
118
+ - Use plan number (e.g., "plan-1", "plan-2")
119
+ - Full example: `feat(auth-plan-1): add User model with password hashing`
120
+
121
+ ### Commit Frequency
122
+
123
+ **One commit per task** (preferred):
124
+ - After completing each task, commit the changes
125
+ - Keeps history granular and reviewable
126
+ - Easier to roll back individual changes
127
+
128
+ **Exceptions:**
129
+ - If tasks are tightly coupled and splitting commits would break functionality, combine them
130
+ - Always explain in the commit body why tasks were combined
131
+
132
+ ### Staging Files
133
+
134
+ **IMPORTANT:** Stage specific files, never use `git add -A` or `git add .`
135
+
136
+ **Why?**
137
+ - Prevents accidentally committing sensitive files (.env, credentials)
138
+ - Prevents committing large binaries or generated files
139
+ - Keeps commits focused and reviewable
140
+
141
+ **How:**
142
+ ```bash
143
+ git add src/models/user.rs
144
+ git add src/db/migrations/001_users.sql
145
+ git commit -m "feat(auth-plan-1): add User model and migration"
146
+ ```
147
+
148
+ ### Git Branching Strategy
149
+
150
+ Follow the strategy from `config.toml`:
151
+
152
+ **If `branching_strategy = "main"`:**
153
+ - Commit directly to the current branch (usually main)
154
+ - No branching required
155
+
156
+ **If `branching_strategy = "phase-branches"`:**
157
+ - Create a branch named `{phase}` if it doesn't exist (e.g., `git checkout -b 01-auth-system`)
158
+ - Commit all plan changes to this branch
159
+ - Do NOT merge to main (orchestrator handles merges)
160
+
161
+ **If `branching_strategy = "plan-branches"`:**
162
+ - Create a branch named `{phase}-plan-{n}` (e.g., `git checkout -b 01-auth-system-plan-1`)
163
+ - Commit all plan changes to this branch
164
+ - Do NOT merge to main (orchestrator handles merges)
165
+
166
+ ### Auto-Commit Setting
167
+
168
+ Check `config.toml` field `git.auto_commit`:
169
+
170
+ **If `auto_commit = true`:**
171
+ - Commit after each task automatically
172
+ - Use the commit protocol above
173
+
174
+ **If `auto_commit = false`:**
175
+ - Stage changes but do NOT commit
176
+ - Let the user review and commit manually
177
+ - Still write the summary file
178
+
179
+ ## Analysis Paralysis Guard
180
+
181
+ **Problem:** You spend too much time reading/searching without writing code.
182
+
183
+ **Rule:** If you perform **5 or more consecutive read/search operations** without writing any code or making any file changes, you are in analysis paralysis.
184
+
185
+ **What to do:**
186
+ 1. STOP reading/searching
187
+ 2. Write a summary of what you've learned
188
+ 3. Explain what's blocking you:
189
+ - Missing information? → Be specific about what's missing
190
+ - Unclear requirements? → Point to the ambiguity
191
+ - Technical complexity? → Describe the challenge
192
+ 4. Report to the orchestrator
193
+
194
+ **Why this matters:**
195
+ - Prevents infinite research loops
196
+ - Forces you to make progress incrementally
197
+ - Surfaces blockers early
198
+
199
+ **Exceptions:**
200
+ - Reading the plan file itself (doesn't count)
201
+ - Reading referenced interfaces from dependencies (doesn't count)
202
+ - First-time codebase exploration at start of plan (first 3 reads don't count)
203
+
204
+ ## Summary Writing
205
+
206
+ After completing all tasks (or encountering a blocker), write a summary file.
207
+
208
+ **File location:** `.konductor/phases/{phase}/plans/{plan-number}-summary.md`
209
+
210
+ **File name examples:**
211
+ - `001-summary.md`
212
+ - `002-summary.md`
213
+ - `010-summary.md`
214
+
215
+ ### Summary Structure
216
+
217
+ ```markdown
218
+ # Plan {plan-number} Summary
219
+
220
+ ## Status
221
+ [Completed | Blocked | Partial]
222
+
223
+ ## Files Created
224
+ - `src/models/user.rs` — User struct with password hashing
225
+ - `src/db/migrations/001_users.sql` — Users table migration
226
+
227
+ ## Files Modified
228
+ - `src/routes/auth.rs` — Added registration endpoint
229
+ - `Cargo.toml` — Added bcrypt dependency
230
+
231
+ ## Tests Added
232
+ - `user::test_password_hashing` — Verifies bcrypt integration
233
+ - `auth::test_registration_endpoint` — Verifies POST /auth/register
234
+
235
+ ### Test Results
236
+ ```
237
+ cargo test user
238
+ Compiling auth-system v0.1.0
239
+ Finished test [unoptimized + debuginfo] target(s) in 2.3s
240
+ Running unittests (target/debug/deps/auth_system-abc123)
241
+ running 2 tests
242
+ test user::test_password_hashing ... ok
243
+ test auth::test_registration_endpoint ... ok
244
+
245
+ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
246
+ ```
247
+
248
+ ## Deviations from Plan
249
+ 1. **Rule 1:** Fixed type error in existing auth routes that prevented compilation
250
+ 2. **Rule 2:** Added email validation to registration endpoint (plan didn't specify)
251
+ 3. **Rule 3:** Added bcrypt to Cargo.toml (plan assumed it was already present)
252
+
253
+ ## Decisions Made
254
+ - Used bcrypt cost factor of 12 (industry standard for password hashing)
255
+ - Made password_hash field private to prevent accidental exposure
256
+ - Added index on users.email for faster lookups during login
257
+
258
+ ## Blockers Encountered
259
+ None. All tasks completed successfully.
260
+
261
+ ## Verification
262
+ All must_haves from plan frontmatter verified:
263
+ - [x] Users can register with email and password (POST /auth/register returns 201)
264
+ - [x] Passwords are hashed with bcrypt (verified in test)
265
+ - [x] User model imported by auth routes (compiler confirms)
266
+ ```
267
+
268
+ ### Summary Requirements
269
+
270
+ Your summary MUST include:
271
+ - **Status:** One of [Completed, Blocked, Partial]
272
+ - **Files created:** List with brief descriptions
273
+ - **Files modified:** List with brief descriptions
274
+ - **Tests added:** Test names and what they verify
275
+ - **Test results:** Actual output from test runner (paste full output)
276
+ - **Deviations:** Every deviation with rule number and explanation
277
+ - **Decisions:** Technical choices you made
278
+ - **Blockers:** Any issues that stopped you (or "None")
279
+ - **Verification:** Checklist of must_haves from plan frontmatter
280
+
281
+ **If blocked:** Explain clearly what stopped you and what information or decision is needed to proceed.
282
+
283
+ ## Working with TDD Plans
284
+
285
+ If the plan frontmatter has `type = "tdd"`, follow test-driven development:
286
+
287
+ See `references/tdd.md` for detailed patterns. Key points:
288
+
289
+ 1. **Red phase:** Write failing tests first
290
+ 2. **Green phase:** Write minimal code to pass tests
291
+ 3. **Refactor phase:** Improve code while keeping tests green
292
+ 4. **Commit after each phase** (red commit, green commit, refactor commit)
293
+
294
+ TDD plans prioritize observable behavior over implementation details. Tests should verify the plan's `must_haves.truths`.