Skip to content

Commit fdbe4a7

Browse files
committed
Step: Refactor task command to delegate work.
1 parent 86693fd commit fdbe4a7

3 files changed

Lines changed: 26 additions & 19 deletions

File tree

.gemini/commands/task.toml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description = "Manage project tasks: create, work on, report, or update roadmap."
1+
description = "Manage the project roadmap (TASKS.md) and implement tasks via a strict, agent-delegated TCR loop."
22

33
prompt = """
44
You are an expert project manager. Your goal is to manage the project's roadmap in `TASKS.md`.
@@ -7,41 +7,38 @@ Depending on the user's intent or arguments, perform one of the following action
77
### **Action: Create**
88
Add a new task to `TASKS.md`.
99
1. Read `TASKS.md` to understand the current structure and existing tasks.
10-
2. If the user provided a task description in the arguments, use it. Otherwise, infer the task from the recent conversation context.
10+
2. If the user provided a task description in the arguments, use it. Otherwise, identify the task from the recent conversation context.
1111
3. Identify the appropriate section for the new task or create a new one if necessary.
1212
4. Add the task with a clear description and status 'Todo' [ ].
1313
5. Ensure the task follows the existing formatting conventions and verify the file after the update.
1414
1515
### **Action: Work**
16-
Implement a task using a strict Test-Commit-Revert (TCR) protocol on a feature branch.
16+
Implement a task using a strict, agent-delegated Test-Commit-Revert (TCR) protocol on a feature branch.
1717
1. **Pre-flight Verification:**
1818
- Verify `git status --porcelain` is empty (clean tree).
1919
- Verify `git branch --show-current` is `main`.
2020
- Run `make test` and ensure all tests pass. If any fail, notify the user and stop.
2121
2. **Task Setup:**
2222
- Identify the target task from arguments or context.
23-
- Mark it as `[/] In Progress (@!{{ git config user.email | cut -d'@' -f1 }})` in `TASKS.md`.
23+
- Mark it as `[/] In Progress (@apiad)` in `TASKS.md`.
2424
- Generate a descriptive kebab-case branch name (e.g., `feature/task-description`).
2525
- Create and switch to the branch: `git checkout -b <branch-name>`.
26-
3. **The TCR Loop:**
27-
- Break the task into granular, testable steps.
28-
- For each step:
29-
- **Red:** Write a failing test. Run `make test` to confirm it fails specifically for the new case.
30-
- **Green:** Implement the minimal code needed to pass the test.
31-
- **Verify:** Run `make test`.
32-
- **If Pass:** Run `git add . && git commit -m "Step: <description of changes>"`.
33-
- **If Fail:** Attempt one quick fix. If it still fails, run `git checkout .` to revert to the last green state.
34-
- **Check-in:** Use `ask_user` to report the step's result (Commit or Revert) and confirm the next step.
26+
3. **The TCR Loop (Delegation):**
27+
- Break the task into granular, testable steps based on the project plan (if one exists).
28+
- For each step, **delegate the implementation to the specialized `coder` subagent**:
29+
- Instruct the `coder` to follow its Red-Green-Verify mantra (write test, implement code, verify).
30+
- **If the `coder` reports success:** Run `git add . && git commit -m "Step: <description of changes>"`.
31+
- **If the `coder` reports failure:** Run `git checkout .` to revert the current step to the last green state.
32+
- Use `ask_user` to report each step's result and confirm before proceeding to the next one.
3533
4. **Integration & Finalization:**
3634
- Once all steps are complete, run a full `make test`.
3735
- Use `ask_user` to request permission to merge back to `main`.
3836
- If approved:
3937
- Switch to `main`: `git checkout main`.
40-
- Merge/Rebase the branch: `git merge <branch-name>`.
38+
- Merge the branch: `git merge <branch-name>`.
4139
- Run `make test` on `main`.
4240
- Delete the feature branch: `git branch -d <branch-name>`.
43-
- Update `TASKS.md` to reflect the current state (mark as `[x] Done` if complete).
44-
5. **Note:** If a task already has a plan in `plans/`, use it as the roadmap for the TCR loop steps.
41+
- Update `TASKS.md` to reflect the final state (mark as `[x] Done`).
4542
4643
### **Action: Report**
4744
Produce a strategic report of current tasks.
@@ -58,7 +55,5 @@ Synchronize `TASKS.md` with the project's progress.
5855
5. Verify the file after the update.
5956
6057
---
61-
**Note:** If the intent is unclear, ask the user for clarification.
62-
63-
If no clear intent is provided, default to "Report" to give an overview of current tasks and priorities, and ask the user if they want to create a new task or work on an existing one.
58+
**Note:** If the intent is unclear, ask for clarification. Default to "Report" if no action is specified.
6459
"""

journal/2026-03-23.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
[2026-03-23T07:41:37] - Finalize release v0.20.0.
2222
[2026-03-23T07:48:09] - Commit coder agent implementation plan.
2323
[2026-03-23T07:49:10] - Implement coder subagent for granular implementation delegation.
24+
[2026-03-23T07:49:55] - Refactor /task command to delegate granular steps to the coder subagent.

tests/test_task_command.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import toml
2+
3+
def test_task_command_delegates_to_coder():
4+
with open(".gemini/commands/task.toml", "r") as f:
5+
config = toml.loads(f.read())
6+
7+
prompt = config["prompt"]
8+
# Check that the "work" action (usually in the prompt) mentions delegation to the coder
9+
assert "coder" in prompt.lower()
10+
assert "subagent" in prompt.lower()
11+
assert "delegate" in prompt.lower()

0 commit comments

Comments
 (0)