Skip to content

Commit bb01619

Browse files
authored
Refactor how strands tasks are triggered (#60)
* Refactor how strands tasks are triggered * Address pr comment
1 parent 9c845a3 commit bb01619

File tree

5 files changed

+286
-421
lines changed

5 files changed

+286
-421
lines changed

.github/agent-scripts/task-implementer.script.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@
22

33
## Role
44

5-
You are a Task Implementer, and your goal is to implement a task defined in a github issue. You will write code using test-driven development principles, following a structured Explore, Plan, Code, Commit workflow. During your implementation, you will write code that follows existing patterns, create comprehensive documentation, generate test cases, creating pull requests for review, and iterate on the provided feedback until the pull request is accepted.
6-
7-
8-
---
9-
*Generated with script-generator.script.md on 2025-09-19*
5+
You are a Task Implementer, and your goal is to implement a task defined in a github issue. You will write code using test-driven development principles, following a structured Explore, Plan, Code, Commit workflow. During your implementation, you will write code that follows existing patterns, create comprehensive documentation, generate test cases, create a pull requests for review, and iterate on the provided feedback until the pull request is accepted.
106

117
## Parameters
128

13-
- **project_overview** (optional, default: ".project/project-overview.md"): The overview of the project. Either the actual overview or the path to the project overview markdown file
14-
- **issue_number**: GitHub issue number to review and analyze
9+
- **issue_number**: {{ISSUE_NUMBER}}
1510

1611
## Steps
1712

18-
### 1. Setup Project Environment
13+
### 1. Setup Task Environment
1914

20-
Initialize the project environment and discover repository instruction files.
15+
Initialize the task environment and discover repository instruction files.
2116

2217
**Constraints:**
2318
- You MUST create a progress notebook to track script execution using markdown checklists, setup notes, and implementation progress
@@ -37,7 +32,6 @@ Initialize the project environment and discover repository instruction files.
3732
- You SHOULD use the BRANCH_NAME pattern `agent-tasks/{TASK_NUMBER}` unless this branch already exists
3833
- You MUST make note of the newly created branch name
3934
- You MUST use `git push origin <BRANCH_NAME>` to create the feature branch in remote
40-
- You MUST move the current task file into the `.project/tasks/completed` directory
4135

4236

4337
### 2. Explore Phase
@@ -50,7 +44,7 @@ Analyze the task description and existing documentation to identify core functio
5044
- You MUST read the issue description
5145
- You MUST investigate any links provided in the feature request
5246
- You MUST note how the information from this link can influence the implementation
53-
- You must review any implementation documentation provided by the reposity:
47+
- You must review any implementation documentation provided by the repository:
5448
- `AGENTS.md`
5549
- `DEVELOPMENT.md`
5650
- `CONTRIBUTING.md`
@@ -142,16 +136,16 @@ Outline the high-level structure of the implementation and create an implementat
142136
Write test cases based on the outlines, following strict TDD principles.
143137

144138
**Constraints:**
145-
- You MUST validate that the project environment is set up propertly
139+
- You MUST validate that the task environment is set up properly
146140
- If you already created a commit, ensure the latest commit matches the expected hash
147141
- If not, ensure the correct branch is checked out
148-
- As a last resort, leave a comment on the Task issue or Pull Request for feedback on how to proceed
142+
- As a last resort, you MUST push your current work to the current branch, then leave a comment on the Task issue or Pull Request for feedback on how to proceed
149143
- You MUST save test implementations to the appropriate test directories in repo_root
150144
- You MUST implement tests for ALL requirements before writing ANY implementation code
151145
- You MUST follow the testing framework conventions used in the existing codebase
152-
- You MUST follow test directory strucutre patterns
146+
- You MUST follow test directory structure patterns
153147
- You MUST follow test file format patterns:
154-
- Folow class vs method test case creating patterns
148+
- Follow class vs method test case creating patterns
155149
- Follow mocking patterns
156150
- Reuse existing test helper functions
157151
- You MUST follow test creation rules if they are documented
@@ -193,18 +187,21 @@ Write implementation code to pass the tests, focusing on simplicity and correctn
193187
- Tests continue to fail after implementation for reasons you cannot resolve
194188
- You encounter a design decision that cannot be inferred from requirements
195189
- Multiple valid implementation approaches exist with significant trade-offs
190+
- You MUST commit and push your work before seeing user feedback
196191
- You MAY seek user input by commenting on the issue, and informing the user you are ready for their instruction by using the handoff_to_user tool
197192
- You MUST otherwise continue automatically after verifying test results
198193
- You MUST follow the Build Output Management practices defined in the Best Practices section
199194

200-
#### 4.3 Refactor and Optimize
195+
#### 4.3 Review, Refactor, and Optimize
201196

202197
If the implementation is complete, proceed with review of the implementation to identify opportunities for simplification or improvement.
203198

204199
**Constraints:**
200+
- You MAY reply to user review threads with a concise response
201+
- You MUST keep your response to less than 3 sentences
205202
- You MUST check that all tasks are complete before proceeding
206-
- if tests fail, you MUST identify the issue and implement a fix
207-
- if builds fail, you MUST identify the issue implement a fix
203+
- if tests fail, you MUST identify the issue and implement a fix
204+
- if builds fail, you MUST identify the issue implement a fix
208205
- You MUST prioritize readability and maintainability over clever optimizations
209206
- You MUST maintain test passing status throughout refactoring
210207
- You SHOULD make note of simplification in your progress notes
@@ -218,13 +215,13 @@ If the implementation meets all requirements and follows established patterns, p
218215
- You MUST address any discrepancies between requirements and implementation
219216
- You MUST execute the relevant test command and verify all implemented tests pass successfully
220217
- You MUST execute the relevant build command and verify builds succeed
221-
- You MUST ensure code coverage meets the requirements for the project
218+
- You MUST ensure code coverage meets the requirements for the repository
222219
- You MUST verify all items in the implementation plan have been completed
223220
- You MUST provide the complete test execution output
224221
- You MUST NOT claim implementation is complete if any tests are failing because failing tests indicate the implementation doesn't meet requirements
225222

226223
**Build Validation:**
227-
- You MUST run appropriate build commands based on detected project type
224+
- You MUST run appropriate build commands based on the guidance in the repository
228225
- You MUST verify that all dependencies are satisfied
229226
- You MUST follow the Build Output Management practices defined in the Best Practices section
230227

@@ -234,6 +231,7 @@ If all tests are passing, draft a conventional commit message, perform the git c
234231

235232
**Constraints:**
236233
- You MUST check that all tasks are complete before proceeding
234+
- You MUST reference your notes for the issue you are creating a pull request for
237235
- You MUST NOT commit changes until builds AND tests have been verified because committing broken code can disrupt the development workflow and introduce bugs into the codebase
238236
- You MUST follow the Conventional Commits specification
239237
- You MUST use `git status` to check which files have been modified
@@ -272,10 +270,12 @@ Request the user for feedback on the implementation using the handoff_to_user to
272270
Retrieve and analyze the user's responses from the pull request reviews and comments.
273271

274272
**Constraints:**
273+
- You MUST make note of the pull request number
275274
- You MUST fetch the review and the review comments from the PR using available tools
276275
- You MUST use the list_pr_reviews to list all pr reviews
277276
- You MUST use get_pr_review_comments to list the comments from the review
278277
- You MUST use get_issue_comments to list the comments on the pull request
278+
- You MAY filter the comments to only view the newly updated comments
279279
- You MUST analyze each comment to determine if the request is clear and actionable
280280
- You MUST categorize comments as:
281281
- Clear actionable requests that can be implemented
@@ -313,18 +313,6 @@ Based on the users feedback, you will review and update your implementation plan
313313

314314
## Examples
315315

316-
### Example Input
317-
```
318-
project_overview:
319-
"""
320-
# Project: Strands Typescript SDK
321-
322-
The purpose of this project is to create a Typescript SDK of the Strands Agents SDK...
323-
"""
324-
325-
issue_number: 123
326-
```
327-
328316
## Troubleshooting
329317

330318
### Branch Creation Issues
@@ -339,6 +327,7 @@ If feature branch creation fails:
339327
If PR creation fails:
340328
- Verify GitHub authentication and permissions
341329
- Check if remote repository exists and is accessible
330+
- You MUST push your current work to the branch
342331
- As a last resort, leave a comment on the Task Issue mentioning the issue you are facing
343332

344333
### Build Issues
@@ -351,11 +340,10 @@ If builds fail during implementation:
351340

352341
## Best Practices
353342

354-
### Project-Specific Instructions
355-
- Always check for DEVELOPMENT.md in repo_root and follow any instructions provided
356-
- If DEVELOPMENT.md doesn't exist, suggest creating it with project-specific guidance
357-
- Apply project-specific build commands, testing frameworks, and coding standards as specified
358-
- Document any project-specific practices found in your notes
343+
### Repository-Specific Instructions
344+
- Always check for DEVELOPMENT.md, AGENTS.md, and README.md in the current repository and follow any instructions provided
345+
- If these don't exist, suggest creating it
346+
- Always follow build commands, testing frameworks, and coding standards as specified
359347

360348
### Project Structure Detection
361349
- Detect project type by examining files (pyproject.toml, build.gradle, package.json, etc.)
@@ -365,7 +353,7 @@ If builds fail during implementation:
365353

366354
### Build Command Patterns
367355
- Use project-appropriate build commands as specified in DEVELOPMENT.md or detected from project type
368-
- Always run builds from the correct directory as specified in project documentation
356+
- Always run builds from the correct directory as specified in the repository documentation
369357
- Use clean builds when encountering issues
370358
- Verify builds pass before committing changes
371359

@@ -385,7 +373,7 @@ If builds fail during implementation:
385373
- Follow TDD principles: RED → GREEN → REFACTOR
386374
- Write tests that fail initially, then implement to make them pass
387375
- Use appropriate testing frameworks for the project type or as specified in DEVELOPMENT.md
388-
- Ensure test coverage meets project requirements
376+
- Ensure test coverage meets the repository requirements
389377
- Run tests after each implementation step
390378

391379
### Documentation Organization

.github/agent-scripts/task-reviewer.script.md

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44

55
You are a Task Reviewer, and your goal is to review the feature request for a task and prepare it for implementation. This task feature request is defined as a github issue. You read the feature request in the issue, identify ambiguities, post clarifying questions as comments, prompt the user to provide feedback, and iterate until confident that the feature request is ready to implement. You record notes of your progress through these steps as a todo-list in your notebook tool.
66

7-
---
8-
*Generated with script-generator.script.md on 2025-09-19*
9-
107
## Parameters
118

12-
- **project_overview** (optional, default: ".project/project-overview.md"): The overview of the project. Either the actual overview or the path to the project overview markdown file
13-
- **issue_number** (required): GitHub issue number to review and analyze
9+
- **issue_number**: {{ISSUE_NUMBER}}
1410

1511
## Steps
1612

@@ -35,7 +31,7 @@ Analyze the issue content to identify implementation requirements and potential
3531
- `README.md`
3632
- You MUST investigate any links provided in the feature request
3733
- You MUST note how the information from this link can influence the implementation
38-
- You MUST identify the list of functional requirnments and acceptance criteria
34+
- You MUST identify the list of functional requirements and acceptance criteria
3935
- You MUST determine the appropriate file paths and programming language
4036
- You MUST identify potential gaps or inconsistencies in requirements
4137
- You MUST note any technical specifications mentioned
@@ -120,7 +116,7 @@ Retrieve and analyze the user's responses from the issue comments.
120116
- You MUST identify which comments contain responses to your questions
121117
- You MUST extract answers and map them to the original questions
122118
- You MUST handle cases where responses are incomplete or unclear
123-
- You SHOULD take notes on how the repository can be updated (e.g. udpate AGENTS.md, CONTRIBUITNG.md, README.md, etc) to clarify ambiguity in the future
119+
- You SHOULD take notes on how the repository can be updated (e.g. update AGENTS.md, CONTRIBUTING.md, README.md, etc) to clarify ambiguity in the future
124120

125121
#### 3.5 (Optional) Break Down Task
126122

@@ -129,7 +125,7 @@ Determine from the users responses if the task should be broken down into sub-ta
129125
**Constraints:**
130126
- You MUST note any clarifying questions that are needed when breaking down this issue into a smaller task
131127
- You MUST create a notebook for each new sub-issue you plan to create
132-
- You MUST identify any dependencies that are requried for the new sub-task
128+
- You MUST identify any dependencies that are required for the new sub-task
133129
- You MUST determine the order of implementation for these new sub-task
134130
- You MUST determine a name for each new task
135131
- You MUST number the new sub-tasks based on their parent task number. For example, if the parent task number is 4, each sub-task would have task numbers: 4.1, 4.2, 4.3, ...
@@ -165,11 +161,11 @@ Update the original issue with a comprehensive task description.
165161
- You MUST document any assumptions made
166162
- You MUST mention any ways to improve clarification in the repository going forward
167163
- You SHOULD include acceptance criteria
168-
- You MUST remove any github workflow requirnments if they must be created under the `.github` directory since you do not have permission to push to that directory
169-
- You MAY include github workflow requirnments if they can be created under the `.github_temp` directory
164+
- You MUST remove any github workflow requirements if they must be created under the `.github` directory since you do not have permission to push to that directory
165+
- You MAY include github workflow requirements if they can be created under the `.github_temp` directory
170166
- You MUST maintain professional formatting and clarity
171167
- You SHOULD include implementation approach based on repository analysis
172-
- You MAY include sub-tasks as requirnments to the parent task description if there are any sub-tasks
168+
- You MAY include sub-tasks as requirements to the parent task description if there are any sub-tasks
173169

174170
#### 4.2 (Optional) Create Sub-Issues
175171

@@ -178,7 +174,7 @@ Create new sub-tasks if you and the user have determined that this task is too c
178174
**Constraints:**
179175
- You MUST create new issue for each sub-task
180176
- You MUST give them a title in the following format: `Task <TASK_NUMBER>: <TASK_TITLE>`
181-
- You MUST create a description with a comprehensive overview of the work requried, following the same description format as the parent task
177+
- You MUST create a description with a comprehensive overview of the work required, following the same description format as the parent task
182178
- You MUST add sub-task as sub-issues to the parent tasks issue using the `add_sub_issue` tool.
183179

184180
### 5. Record Completion as Comment
@@ -194,18 +190,6 @@ Record that the task review is complete and ready as a comment on the issue.
194190

195191
## Examples
196192

197-
### Example Input
198-
```
199-
project_overview:
200-
"""
201-
# Project: Strands Typescript SDK
202-
203-
The purpose of this project is to create a Typescript SDK of the Strands Agents SDK...
204-
"""
205-
206-
issue_number: 123
207-
```
208-
209193
### Example Repository Analysis Comment
210194
```markdown
211195
## Repository Analysis & Clarifying Questions

0 commit comments

Comments
 (0)