feat: Generate and inject coding style guide from CLAUDE.md #81
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.
Summary
Test plan
pytest tests/core/test_prompts_coding_style.py- tests for the promptpytest tests/core/test_state_file_ops.py- tests for save/load coding stylepytest tests/core/test_state_backup.py- tests for cleanup preserving coding-style.mdpytest tests/core/test_prompts_planning.py- tests for coding style in planning promptpytest tests/core/test_prompts_working.py- tests for coding style in work promptpytest tests/- all 4539 tests passruff check . && ruff format --check .- all checks passmypy .- no type errors🤖 Generated with Claude Code
Greptile Overview
Greptile Summary
This PR implements automatic coding style guide generation from
CLAUDE.mdand convention files, injecting the guide into planning and work prompts to ensure consistent coding practices across tasks.Key Changes:
CLAUDE.md, linter configs, and convention filescoding-style.mdacross runs (not deleted on success) to save tokens on subsequent runsImplementation Quality:
prompts_coding_style.pymoduleagent.py→agent_phases.py→ prompt builderssave_coding_style()andload_coding_style()methods# Coding Style)Test Coverage:
coding-style.mdpreservation during cleanupConfidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant Orchestrator participant Planner participant AgentWrapper participant AgentPhaseExecutor participant StateManager participant FileSystem Orchestrator->>Planner: create_plan(goal) Planner->>Planner: ensure_coding_style() Planner->>StateManager: load_coding_style() StateManager->>FileSystem: Read coding-style.md alt coding-style.md exists FileSystem-->>StateManager: Return existing style StateManager-->>Planner: Return style content else coding-style.md missing Planner->>AgentWrapper: generate_coding_style() AgentWrapper->>AgentPhaseExecutor: generate_coding_style() AgentPhaseExecutor->>AgentPhaseExecutor: build_coding_style_prompt() AgentPhaseExecutor->>AgentPhaseExecutor: run_query(prompt, planning_tools, Opus) AgentPhaseExecutor->>AgentPhaseExecutor: extract_coding_style(result) AgentPhaseExecutor-->>AgentWrapper: Return {coding_style, raw_output} AgentWrapper-->>Planner: Return style content Planner->>StateManager: save_coding_style(content) StateManager->>FileSystem: Write coding-style.md end Planner->>StateManager: load_context() Planner->>AgentWrapper: run_planning_phase(goal, context, coding_style) AgentWrapper->>AgentPhaseExecutor: run_planning_phase(goal, context, coding_style) AgentPhaseExecutor->>AgentPhaseExecutor: build_planning_prompt(goal, context, coding_style) Note over AgentPhaseExecutor: Injects coding style into prompt AgentPhaseExecutor->>AgentPhaseExecutor: run_query(prompt, planning_tools, Opus) AgentPhaseExecutor-->>Planner: Return {plan, criteria, raw_output} Planner->>StateManager: save_plan(plan) Planner->>StateManager: save_criteria(criteria) Note over Orchestrator: Later during work phase Orchestrator->>AgentWrapper: run_work_session(task, context, coding_style) AgentWrapper->>AgentPhaseExecutor: run_work_session(task, context, coding_style) AgentPhaseExecutor->>AgentPhaseExecutor: build_work_prompt(task, context, coding_style) Note over AgentPhaseExecutor: Injects coding style into work prompt AgentPhaseExecutor->>AgentPhaseExecutor: run_query(prompt, all_tools, model) AgentPhaseExecutor-->>Orchestrator: Return {output, success, model_used} Note over Orchestrator: On success cleanup Orchestrator->>StateManager: cleanup_on_success(run_id) StateManager->>FileSystem: Delete state files (preserve coding-style.md) Note over FileSystem: coding-style.md preserved for reuseContext used:
dashboard- CLAUDE.md (source)