Skip to content

Add plan/draft mode for repo intelligence before coding (#29)#130

Open
jrchatruc wants to merge 4 commits intomainfrom
feat/plan-mode
Open

Add plan/draft mode for repo intelligence before coding (#29)#130
jrchatruc wants to merge 4 commits intomainfrom
feat/plan-mode

Conversation

@jrchatruc
Copy link
Copy Markdown
Collaborator

Summary

  • Adds an optional plan mode to the task pipeline: when enabled, Claude first analyzes the repo in read-only mode (all write tools blocked), produces a structured Markdown plan, and pauses for user approval before writing any code
  • Users can approve to proceed to execution, reject to cancel with no changes, or send revision comments to iterate on the plan
  • When plan mode is off (default), the pipeline runs exactly as before — no regression

Changes

Backend (dashboard/backend/src/):

  • db.rs: Added plan_mode BOOLEAN NOT NULL DEFAULT false column migration
  • models.rs: Added plan_mode to Task struct and CreateTaskRequest
  • tasks.rs: New run_claude_plan_streaming() (read-only Claude), build_plan_prompt(), plan_approval_loop(), plan phase in run_task_pipeline(), updated all SELECT queries

Frontend (dashboard/frontend/src/):

  • lib/api.ts: Added plan_mode to Task type and createTask params
  • lib/status.ts: Added planning (spinner) and awaiting_plan_approval (blue/Clock) statuses
  • pages/Tasks.tsx: "Generate plan before coding" checkbox in task creation form
  • pages/TaskDetail.tsx: Plan statuses in CHAT_STATUSES, passes taskStatus to TaskChat
  • components/TaskChat.tsx: Plan Review header, blue banner, Approve/Reject buttons

Test plan

  • Create a task without plan mode → verify pipeline runs exactly as before
  • Create a task with plan mode → verify status goes planningawaiting_plan_approval
  • Verify Claude's plan renders as Markdown in chat with Approve/Reject buttons
  • Send a revision comment → verify Claude revises the plan (still read-only)
  • Click "Approve Plan" → verify execution starts with plan context, normal push/preview flow
  • Click "Reject" on a plan-mode task → verify task completes with no code changes
  • Verify token usage includes both plan and execution runs

Closes #29

When enabled, Claude first analyzes the repo in read-only mode (write
tools blocked via --disallowedTools), produces a structured Markdown
plan, and waits for user approval before writing any code. Users can
comment to revise the plan, approve to proceed, or reject to cancel.

Backend: new plan_mode column, run_claude_plan_streaming (read-only),
build_plan_prompt, plan_approval_loop, plan phase in run_task_pipeline.
Frontend: plan mode checkbox, planning/awaiting_plan_approval statuses,
Plan Review UI with Approve/Reject buttons in TaskChat.
The audit log page has 'Event Type' in both a filter label and a table
column header. At tablet width both are visible, causing Playwright's
strict mode to fail. Use getByRole('columnheader') for an unambiguous
match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repo intelligence and draft/plan mode

1 participant