mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Add task tracking to doc-review

Open LeanAndMean opened this issue 7 months ago • 6 comments

Summary

Add TaskCreate/TaskUpdate progress tracking to the doc-review command. This command has heavy multi-agent orchestration (8 steps) with three rounds of agent fan-outs (discovery, review, verification), a per-finding user interaction loop, and a commit step. Task tracking will make the multi-phase flow observable.

Part of #81 (Tier 1 -- VERY HIGH priority). See #81 for task tracking conventions and overall context.

File: commands/doc-review.md

What Is Task Tracking?

mach10 commands should use TaskCreate and TaskUpdate to establish visible progress checkpoints. Tasks are created upfront after input parsing, then transitioned to in_progress / completed as work proceeds. This makes long-running commands observable and forces the execution to explicitly pass through each checkpoint. See #81 for the full conventions.

Task Graph

All 5 tasks are created in a single block after Step 1 (input parsing). Each task starts as pending.

Task Subject activeForm in_progress completed
T1 Gather PR context and discover documentation Discovering documentation Before Step 2 After Step 3 (doc discovery agents return, summary presented)
T2 Review documentation against PR changes Reviewing documentation Before Step 4 (review agents launch) After Step 4 returns
T3 Present findings and get user decisions Processing findings with user Before Step 5 After Step 5 (all findings processed)
T4 Apply documentation changes Applying changes Before Step 6 After Step 6 (edits applied)
T5 Verify changes and commit Verifying and committing Before Step 7 (verification agents) After Step 8 (committed, comment posted)

Notes:

  • T1 combines Steps 2-3 (context gathering + doc discovery) since they flow together into one preparatory phase.
  • T2 is the parallel review agent fan-out -- the core analysis step.
  • T3 covers the per-finding user interaction loop (accept/modify/reject for each finding) as a single task.
  • T5 combines verification agents and commit/report since they are tightly coupled.
  • If no findings are discovered, T3 and T4 transition quickly.

Delegation Notes

  • Step 3 delegates to exploration subagents via the Task tool. T1 brackets this delegation.
  • Step 4 delegates to review subagents via the Task tool. T2 brackets this delegation.
  • Step 7 delegates to verification subagents via the Task tool. T5 brackets this delegation.
  • None of the delegations' internal steps should be tracked by this command.

Acceptance Criteria

  • [ ] All 5 tasks are created after input parsing, before any work begins
  • [ ] Each task transitions in_progress -> completed at the boundaries described above
  • [ ] T2 brackets the review agent fan-out
  • [ ] T3 covers the entire finding-by-finding interaction loop
  • [ ] If no findings, T3 and T4 transition quickly (not skipped)
  • [ ] T5 brackets both verification agents and the commit
  • [ ] allowed-tools in frontmatter includes Task (if not already present)

LeanAndMean avatar Apr 09 '26 17:04 LeanAndMean

Note: The task tracking conventions have been revised (see comment on issue 81). The task graph in this issue body follows the old "3-5 compound tasks" convention and is now stale. When implementing this sub-issue, derive the task graph using 1-to-1 step mapping: one task per command step, with a Step 0 that handles input parsing and task list creation. See the updated CLAUDE.md conventions and commands/pr-review.md for the reference implementation.

LeanAndMean avatar Apr 13 '26 19:04 LeanAndMean

Independent Assessment

Scope: Small, single-file change to commands/doc-review.md. Well-established pattern with three reference implementations (pr-review, pr-pre-merge, pr-review-fix).

Stale task graph: The T1-T5 compound task graph in the issue body was written under the old convention and is stale (as flagged by the existing comment). Below is the derived 1-to-1 task graph using current conventions.

Derived Task Graph (1-to-1 step mapping)

Step 0 absorbs the current Step 1 (input parsing). Existing Steps 2-8 shift down to Steps 1-7. All 8 tasks are created in Step 0 after input parsing. Each task starts as pending.

Task Subject activeForm in_progress completed
Step 0 Step 0: Parse input and create task list Parsing input Immediately After all tasks created
Step 1 Step 1: Gather PR context Gathering PR context Before checkout After context summary built
Step 2 Step 2: Discover documentation Discovering documentation Before exploration agents launch After summary table presented
Step 3 Step 3: Fan out review agents Reviewing documentation Before review agents launch After all agents return
Step 4 Step 4: Present findings and get user decisions Processing findings with user Before report presented After all findings processed
Step 5 Step 5: Apply documentation changes Applying changes Before edits begin After all edits applied
Step 6 Step 6: Verify changes Verifying changes Before verification agents launch After corrections applied
Step 7 Step 7: Commit and report Committing and reporting Before staging files After comment posted

Notes:

  • Step 0 absorbs the current Step 1 (Parse Input). Current Steps 2-8 become Steps 1-7.
  • TaskCreate and TaskUpdate must be added to allowed-tools in frontmatter.
  • Agent delegations in Steps 2, 3, and 6 are bracketed by their step's task -- no internal tracking of subagent work.
  • If no findings are discovered in Step 3, Steps 4 and 5 transition quickly (not skipped).

LeanAndMean avatar Apr 14 '26 03:04 LeanAndMean

Implementation Plan: Add task tracking to doc-review

Stage 1: Add task tracking to doc-review.md

What it accomplishes: Adds TaskCreate/TaskUpdate progress tracking to the doc-review command following established conventions.

File modified: commands/doc-review.md

Changes:

  1. Frontmatter: Add TaskCreate, TaskUpdate to allowed-tools
  2. Step renumbering: Current Step 1 (Parse Input) becomes Step 0; current Steps 2-8 become Steps 1-7
  3. Step 0 bootstrap: Rewrite current Step 1 into Step 0 format -- parse input, create Step 0 task and mark in_progress, create remaining 7 tasks as pending, mark Step 0 completed
  4. Task tracking instrumentation: Add Mark Step N as in_progress/completed lines at the start/end of each step (Steps 1-7), following the task graph boundaries below
  5. Task table: Insert the full task table in Step 0 (8 rows: Steps 0-7)

Task graph:

Task Subject activeForm in_progress completed
Step 0 Step 0: Parse input and create task list Parsing input Immediately After all tasks created
Step 1 Step 1: Gather PR context Gathering PR context Before checkout After context summary built
Step 2 Step 2: Discover documentation Discovering documentation Before exploration agents launch After summary table presented
Step 3 Step 3: Fan out review agents Reviewing documentation Before review agents launch After all agents return
Step 4 Step 4: Present findings and get user decisions Processing findings with user Before report presented After all findings processed
Step 5 Step 5: Apply documentation changes Applying changes Before edits begin After all edits applied
Step 6 Step 6: Verify changes Verifying changes Before verification agents launch After corrections applied
Step 7 Step 7: Commit and report Committing and reporting Before staging files After comment posted

Testing: This is a plugin command definition (markdown) -- no testable runtime code. Verification is by reading the file and confirming it matches the conventions and reference implementations.

Decision Log

Architecture Choice

Selected the only viable approach: follow the assessment's derived task graph exactly, using pr-review.md as the primary reference implementation. No alternatives were meaningfully differentiated -- the conventions are prescriptive with three existing reference implementations (pr-review.md, pr-pre-merge.md, pr-review-fix.md).


This comment will guide staged implementation via /mach10:issue-implement 94 1.

LeanAndMean avatar Apr 14 '26 04:04 LeanAndMean

Implementation Plan: Add task tracking to doc-review

Stage 1: Add task tracking to doc-review.md and update CLAUDE.md sync annotation

What it accomplishes: Adds TaskCreate/TaskUpdate progress tracking to the doc-review command following established conventions, and updates the CLAUDE.md sync annotation affected by step renumbering.

Files modified:

  • commands/doc-review.md
  • CLAUDE.md (sync annotation only)

Changes to commands/doc-review.md:

  1. Frontmatter: Add TaskCreate, TaskUpdate to allowed-tools
  2. Step renumbering: Current Step 1 (Parse Input) becomes Step 0; current Steps 2-8 become Steps 1-7. Update step headings to match the task subjects below.
  3. Step 0 bootstrap: Rewrite current Step 1 into Step 0 format -- parse input, create Step 0 task and mark in_progress, create remaining 7 tasks as pending (store each returned task ID -- do not assume IDs are sequential), mark Step 0 completed. If input parsing fails, no tasks are created.
  4. Task tracking instrumentation: Add Mark Step N as in_progress/completed lines at the start/end of each step (Steps 1-7), following the reference implementation pattern.
  5. Task table (3-column format matching reference implementations):
Task Subject activeForm
Step 0 Step 0: Parse input and create task list Parsing input
Step 1 Step 1: Gather PR context Gathering PR context
Step 2 Step 2: Discover documentation Discovering documentation
Step 3 Step 3: Fan out review agents Reviewing documentation
Step 4 Step 4: Present findings and get user decisions Processing findings with user
Step 5 Step 5: Apply documentation changes Applying changes
Step 6 Step 6: Verify changes Verifying changes
Step 7 Step 7: Commit and report Committing and reporting

Changes to CLAUDE.md:

  1. --comments two-call sync bullet (line 68): Update commands/doc-review.md (Step 2) to commands/doc-review.md (Step 1) to reflect the step renumbering.

Testing: This is a plugin command definition (markdown) -- no testable runtime code. Verification is by reading the file and confirming it matches the conventions and reference implementations.

Decision Log

Architecture Choice

Follow the assessment's derived task graph exactly, using pr-review.md as the primary reference implementation. No alternatives were meaningfully differentiated.

Addressed from plan review

  • Important finding 1: Added CLAUDE.md sync annotation update as an explicit change item.
  • Suggestion 1: Changed task table to 3-column format matching reference implementations.
  • Suggestion 2: Step headings will be updated to match task subjects for consistency.

This comment will guide staged implementation via /mach10:issue-implement 94 1.

LeanAndMean avatar Apr 14 '26 04:04 LeanAndMean

Progress: Stage 1 complete

Implemented task tracking for the doc-review command per the implementation plan.

Commit: f6d804e

Changes:

  • commands/doc-review.md: Added TaskCreate/TaskUpdate to allowed-tools, renumbered steps (old Steps 1-8 became Steps 0-7), added Step 0 bootstrap with task table, added in_progress/completed markers on all steps, updated internal cross-references
  • CLAUDE.md: Updated --comments two-call sync annotation from (Step 2) to (Step 1) to reflect step renumbering

All six plan items addressed. No deviations from the plan.

LeanAndMean avatar Apr 14 '26 04:04 LeanAndMean

Closing -- task tracking for doc-review was implemented in PR #112 (commit cfde894). The PR used 'Part of #81' but omitted 'Fixes #94'.

LeanAndMean avatar Apr 14 '26 17:04 LeanAndMean