feat(plan): persist plans with step-by-step execution#526
Open
12britz wants to merge 1 commit into
Open
Conversation
Replaces the bare-prompt /plan command with a full planning workflow: structured checklist plans saved to .claude/plan.md, terminal display, editor integration, step-by-step LLM execution with auto-checkoff, and manual tracking. New file: code_puppy/command_line/plan_manager.py - PlanManager class for plan file I/O, step parsing, execution prompts - Parses - [ ] / - [x] checklist items with 1-based indexing - mark_step_done(N) toggles completion in the file - build_run_prompt([N]) generates LLM prompts for step execution - edit_in_editor() opens plan in / - show_formatted() displays plan with progress header Modified: code_puppy/command_line/core_commands.py - /plan <goal> | show | edit | run [N] | mark <N> subcommands - Added alias 'p' Modified: code_puppy/cli_runner.py - _process_plan_step_markers() intercepts PLAN_STEP_DONE: N markers in LLM responses and auto-checks steps in the plan file Tests: test_plan_manager.py (28) + test_core_commands_full_coverage (56)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(plan): Persist plans with step-by-step execution
Summary
Replaces the bare-prompt
/plancommand with a full planning workflow: structured checklist plans saved to.claude/plan.md, terminal display, editor integration, step-by-step LLM execution with auto-checkoff, and manual tracking.Changes Made
New file:
code_puppy/command_line/plan_manager.pyCore module for plan file I/O, step parsing, execution prompt building, and editor support.
PlanManagerclass manages.claude/plan.md- [ ]/- [x]checklist items with 1-based indexingmark_step_done(N)toggles completion in the filebuild_run_prompt([N])generates LLM prompts for executing one or all pending stepsedit_in_editor()opens the plan in$EDITOR/$VISUAL(creates template if missing)create_template()returns a bare-bones plan skeletonshow_formatted()displays the plan with a progress headerModified:
code_puppy/command_line/core_commands.pyReplaced the simple prompt wrapper with a full subcommand handler:
/plan <goal>.claude/plan.md/plan show(N/M steps complete)/plan edit.claude/plan.mdin$EDITOR/plan run [N]/plan mark <N>Added alias
p→/pworks as shorthand.Modified:
code_puppy/cli_runner.pyAdded
_process_plan_step_markers()— interceptsPLAN_STEP_DONE: Nin LLM responses and auto-checks the corresponding step in the plan file. Runs after every turn (main loop + continuation loop).Modified:
code_puppy/help_system/help_content.pyUpdated
/planhelp entry with new syntax and examples.New file:
tests/command_line/test_plan_manager.py28 tests covering PlanManager: I/O, step parsing, mark-done/undone, display formatting, editor launch (with mocked subprocess), execution prompt builders, and marker stripping.
Modified:
tests/command_line/test_core_commands_full_coverage.py6 tests for the new plan command subcommands: show (with/without plan), edit, mark, goal prompt, and usage error.
Testing
Technical Details
Writetool for.claude/plan.mdwhile blocking other modificationsbuild_run_prompt()includes the full plan for context plus a## Pending stepssection with only unchecked itemsPLAN_STEP_DONE: Nmarker is stripped from the user-visible response after processing$VISUAL→$EDITOR→nanoin that order;open -tis not used (runs $EDITOR directly)/plan, but doesn't enforce via a permission mode)Files Modified
code_puppy/command_line/plan_manager.pycode_puppy/command_line/core_commands.pycode_puppy/cli_runner.pycode_puppy/help_system/help_content.pytests/command_line/test_plan_manager.pytests/command_line/test_core_commands_full_coverage.py