claude-task-master 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/PKG-INFO +2 -2
  2. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/pyproject.toml +2 -2
  3. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/__init__.py +1 -1
  4. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/models.py +22 -0
  5. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/routes.py +67 -1
  6. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent.py +25 -2
  7. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent_phases.py +53 -3
  8. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/orchestrator.py +4 -0
  9. claude_task_master-0.1.9/src/claude_task_master/core/planner.py +84 -0
  10. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts.py +8 -0
  11. claude_task_master-0.1.9/src/claude_task_master/core/prompts_coding_style.py +160 -0
  12. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts_planning.py +30 -6
  13. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts_working.py +36 -13
  14. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state_backup.py +11 -3
  15. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state_file_ops.py +32 -0
  16. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/task_runner.py +8 -0
  17. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mcp/server.py +19 -0
  18. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mcp/tools.py +60 -0
  19. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/PKG-INFO +2 -2
  20. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/SOURCES.txt +1 -0
  21. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/requires.txt +1 -1
  22. claude_task_master-0.1.7/src/claude_task_master/core/planner.py +0 -46
  23. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/README.md +0 -0
  24. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/setup.cfg +0 -0
  25. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/__init__.py +0 -0
  26. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/routes_config.py +0 -0
  27. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/routes_control.py +0 -0
  28. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/routes_repo.py +0 -0
  29. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/routes_webhooks.py +0 -0
  30. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/api/server.py +0 -0
  31. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/auth/__init__.py +0 -0
  32. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/auth/middleware.py +0 -0
  33. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/auth/password.py +0 -0
  34. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/bin/claudetm +0 -0
  35. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli.py +0 -0
  36. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/__init__.py +0 -0
  37. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/ci_helpers.py +0 -0
  38. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/config.py +0 -0
  39. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/control.py +0 -0
  40. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/fix_pr.py +0 -0
  41. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/fix_session.py +0 -0
  42. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/github.py +0 -0
  43. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/info.py +0 -0
  44. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/mailbox.py +0 -0
  45. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/cli_commands/workflow.py +0 -0
  46. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/__init__.py +0 -0
  47. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent_exceptions.py +0 -0
  48. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent_message.py +0 -0
  49. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent_models.py +0 -0
  50. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/agent_query.py +0 -0
  51. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/checkpoint.py +0 -0
  52. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/circuit_breaker.py +0 -0
  53. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/config.py +0 -0
  54. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/config_loader.py +0 -0
  55. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/console.py +0 -0
  56. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/context_accumulator.py +0 -0
  57. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/control.py +0 -0
  58. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/conversation.py +0 -0
  59. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/credentials.py +0 -0
  60. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/hooks.py +0 -0
  61. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/key_listener.py +0 -0
  62. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/logger.py +0 -0
  63. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/parallel.py +0 -0
  64. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/plan_updater.py +0 -0
  65. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/pr_context.py +0 -0
  66. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/progress_tracker.py +0 -0
  67. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts_base.py +0 -0
  68. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts_plan_update.py +0 -0
  69. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/prompts_verification.py +0 -0
  70. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/rate_limit.py +0 -0
  71. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/shutdown.py +0 -0
  72. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state.py +0 -0
  73. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state_exceptions.py +0 -0
  74. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state_pr.py +0 -0
  75. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/state_recovery.py +0 -0
  76. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/subagents.py +0 -0
  77. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/task_group.py +0 -0
  78. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/core/workflow_stages.py +0 -0
  79. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/__init__.py +0 -0
  80. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/client.py +0 -0
  81. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/client_ci.py +0 -0
  82. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/client_pr.py +0 -0
  83. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/exceptions.py +0 -0
  84. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/github/pr_cycle.py +0 -0
  85. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mailbox/__init__.py +0 -0
  86. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mailbox/merger.py +0 -0
  87. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mailbox/models.py +0 -0
  88. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mailbox/storage.py +0 -0
  89. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mcp/__init__.py +0 -0
  90. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/mcp/auth.py +0 -0
  91. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/server.py +0 -0
  92. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/utils/__init__.py +0 -0
  93. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/utils/debug_claude_md.py +0 -0
  94. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/utils/doctor.py +0 -0
  95. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/webhooks/__init__.py +0 -0
  96. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/webhooks/client.py +0 -0
  97. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/webhooks/config.py +0 -0
  98. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/webhooks/events.py +0 -0
  99. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master/wrapper.py +0 -0
  100. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/dependency_links.txt +0 -0
  101. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/entry_points.txt +0 -0
  102. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/src/claude_task_master.egg-info/top_level.txt +0 -0
  103. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/tests/test_server.py +0 -0
  104. {claude_task_master-0.1.7 → claude_task_master-0.1.9}/tests/test_wrapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: claude-task-master
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Autonomous task orchestration system that keeps Claude working until a goal is achieved
5
5
  Author: Claude Task Master Team
6
6
  License-Expression: MIT
@@ -19,7 +19,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Requires-Python: >=3.12
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: claude-agent-sdk>=0.1.0
22
+ Requires-Dist: claude-agent-sdk>=0.1.27
23
23
  Requires-Dist: typer>=0.12.0
24
24
  Requires-Dist: pydantic>=2.0.0
25
25
  Requires-Dist: rich>=13.0.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "claude-task-master"
7
- version = "0.1.7"
7
+ version = "0.1.9"
8
8
  description = "Autonomous task orchestration system that keeps Claude working until a goal is achieved"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -24,7 +24,7 @@ classifiers = [
24
24
  ]
25
25
 
26
26
  dependencies = [
27
- "claude-agent-sdk>=0.1.0",
27
+ "claude-agent-sdk>=0.1.27",
28
28
  "typer>=0.12.0",
29
29
  "pydantic>=2.0.0",
30
30
  "rich>=13.0.0",
@@ -3,5 +3,5 @@
3
3
  Uses Claude Agent SDK to keep Claude working until a goal is achieved.
4
4
  """
5
5
 
6
- __version__ = "0.1.7"
6
+ __version__ = "0.1.9"
7
7
  __all__ = ["__version__"]
@@ -25,6 +25,7 @@ Response Models:
25
25
  - CloneRepoResponse: Result of cloning a repository
26
26
  - SetupRepoResponse: Result of setting up a repository
27
27
  - PlanRepoResponse: Result of planning for a repository
28
+ - DeleteCodingStyleResponse: Result of deleting coding-style.md
28
29
 
29
30
  Usage:
30
31
  from claude_task_master.api.models import (
@@ -860,3 +861,24 @@ class PlanRepoResponse(BaseModel):
860
861
  criteria: str | None = None
861
862
  run_id: str | None = None
862
863
  error: str | None = None
864
+
865
+
866
+ # =============================================================================
867
+ # Coding Style Response Models
868
+ # =============================================================================
869
+
870
+
871
+ class DeleteCodingStyleResponse(BaseModel):
872
+ """Response model for deleting the coding-style.md file.
873
+
874
+ Attributes:
875
+ success: Whether the deletion operation succeeded.
876
+ message: Human-readable result message.
877
+ file_existed: Whether the file existed before deletion.
878
+ error: Error message if deletion failed.
879
+ """
880
+
881
+ success: bool
882
+ message: str
883
+ file_existed: bool = False
884
+ error: str | None = None
@@ -10,6 +10,7 @@ Endpoints:
10
10
  - GET /progress: Get progress summary
11
11
  - GET /context: Get accumulated context/learnings
12
12
  - GET /health: Health check endpoint
13
+ - DELETE /coding-style: Delete the coding-style.md file
13
14
  - POST /task/init: Initialize a new task
14
15
  - DELETE /task: Delete/cleanup current task
15
16
  - POST /control/stop: Stop a running task with optional cleanup
@@ -51,6 +52,7 @@ from claude_task_master.api.models import (
51
52
  ConfigUpdateRequest,
52
53
  ContextResponse,
53
54
  ControlResponse,
55
+ DeleteCodingStyleResponse,
54
56
  ErrorResponse,
55
57
  HealthResponse,
56
58
  LogsResponse,
@@ -613,6 +615,68 @@ def create_info_router() -> APIRouter:
613
615
  active_tasks=active_tasks,
614
616
  )
615
617
 
618
+ @router.delete(
619
+ "/coding-style",
620
+ response_model=DeleteCodingStyleResponse,
621
+ responses={
622
+ 404: {"model": ErrorResponse, "description": "No active task found"},
623
+ 500: {"model": ErrorResponse, "description": "Internal server error"},
624
+ },
625
+ summary="Delete Coding Style",
626
+ description="Delete the coding-style.md file from the state directory.",
627
+ )
628
+ async def delete_coding_style(request: Request) -> DeleteCodingStyleResponse | JSONResponse:
629
+ """Delete the coding-style.md file.
630
+
631
+ Removes the coding-style.md file from the state directory. This file
632
+ contains extracted coding conventions and is regenerated on the next run.
633
+
634
+ Returns:
635
+ DeleteCodingStyleResponse indicating whether the file was deleted.
636
+
637
+ Raises:
638
+ 404: If no active task exists.
639
+ 500: If an error occurs during deletion.
640
+ """
641
+ state_manager = _get_state_manager(request)
642
+
643
+ if not state_manager.exists():
644
+ return JSONResponse(
645
+ status_code=404,
646
+ content=ErrorResponse(
647
+ error="not_found",
648
+ message="No active task found",
649
+ suggestion="Start a new task with 'claudetm start <goal>'",
650
+ ).model_dump(),
651
+ )
652
+
653
+ try:
654
+ file_existed = state_manager.delete_coding_style()
655
+
656
+ if file_existed:
657
+ return DeleteCodingStyleResponse(
658
+ success=True,
659
+ message="Coding style file deleted successfully",
660
+ file_existed=True,
661
+ )
662
+ else:
663
+ return DeleteCodingStyleResponse(
664
+ success=True,
665
+ message="Coding style file did not exist",
666
+ file_existed=False,
667
+ )
668
+
669
+ except Exception as e:
670
+ logger.exception("Error deleting coding style file")
671
+ return JSONResponse(
672
+ status_code=500,
673
+ content=ErrorResponse(
674
+ error="internal_error",
675
+ message="Failed to delete coding style file",
676
+ detail=str(e),
677
+ ).model_dump(),
678
+ )
679
+
616
680
  return router
617
681
 
618
682
 
@@ -1356,7 +1420,9 @@ def register_routes(app: FastAPI) -> None:
1356
1420
  repo_router = create_repo_router()
1357
1421
  app.include_router(repo_router, prefix="/repo")
1358
1422
 
1359
- logger.debug("Registered info routes: /status, /plan, /logs, /progress, /context, /health")
1423
+ logger.debug(
1424
+ "Registered info routes: /status, /plan, /logs, /progress, /context, /health, /coding-style"
1425
+ )
1360
1426
  logger.debug("Registered control routes: /control/stop, /control/resume, /config")
1361
1427
  logger.debug("Registered task routes: /task/init, /task")
1362
1428
  logger.debug("Registered webhook routes: /webhooks, /webhooks/{id}, /webhooks/test")
@@ -170,15 +170,35 @@ class AgentWrapper:
170
170
  ValueError("query must be callable"),
171
171
  )
172
172
 
173
- def run_planning_phase(self, goal: str, context: str = "") -> dict[str, Any]:
173
+ def run_planning_phase(
174
+ self, goal: str, context: str = "", coding_style: str | None = None
175
+ ) -> dict[str, Any]:
174
176
  """Run planning phase with read-only tools.
175
177
 
176
178
  Always uses Opus (smartest model) for planning to ensure
177
179
  high-quality task breakdown and complexity classification.
178
180
 
181
+ Args:
182
+ goal: The goal to plan for.
183
+ context: Additional context for planning.
184
+ coding_style: Optional coding style guide to inject into prompt.
185
+
186
+ Delegates to AgentPhaseExecutor for implementation.
187
+ """
188
+ return self._phase_executor.run_planning_phase(goal, context, coding_style)
189
+
190
+ def generate_coding_style(self) -> dict[str, Any]:
191
+ """Generate a coding style guide by analyzing the codebase.
192
+
193
+ Analyzes CLAUDE.md, convention files, and codebase to create a
194
+ concise coding style guide with workflow and conventions.
195
+
196
+ Returns:
197
+ Dict with 'coding_style' and 'raw_output' keys.
198
+
179
199
  Delegates to AgentPhaseExecutor for implementation.
180
200
  """
181
- return self._phase_executor.run_planning_phase(goal, context)
201
+ return self._phase_executor.generate_coding_style()
182
202
 
183
203
  def run_work_session(
184
204
  self,
@@ -190,6 +210,7 @@ class AgentWrapper:
190
210
  create_pr: bool = True,
191
211
  pr_group_info: dict | None = None,
192
212
  target_branch: str = "main",
213
+ coding_style: str | None = None,
193
214
  ) -> dict[str, Any]:
194
215
  """Run a work session with full tools.
195
216
 
@@ -203,6 +224,7 @@ class AgentWrapper:
203
224
  create_pr: If True, instruct agent to create PR. If False, commit only.
204
225
  pr_group_info: Optional dict with PR group context (name, completed_tasks, etc).
205
226
  target_branch: The target branch for rebasing (default: "main").
227
+ coding_style: Optional coding style guide to inject into prompt.
206
228
 
207
229
  Returns:
208
230
  Dict with 'output', 'success', and 'model_used' keys.
@@ -218,6 +240,7 @@ class AgentWrapper:
218
240
  create_pr=create_pr,
219
241
  pr_group_info=pr_group_info,
220
242
  target_branch=target_branch,
243
+ coding_style=coding_style,
221
244
  )
222
245
 
223
246
  def verify_success_criteria(self, criteria: str, context: str = "") -> dict[str, Any]:
@@ -13,7 +13,13 @@ from typing import TYPE_CHECKING, Any, TypeVar
13
13
 
14
14
  from . import console
15
15
  from .agent_models import ModelType, get_tools_for_phase
16
- from .prompts import build_planning_prompt, build_verification_prompt, build_work_prompt
16
+ from .prompts import (
17
+ build_coding_style_prompt,
18
+ build_planning_prompt,
19
+ build_verification_prompt,
20
+ build_work_prompt,
21
+ extract_coding_style,
22
+ )
17
23
 
18
24
  if TYPE_CHECKING:
19
25
  from .agent_query import AgentQueryExecutor
@@ -104,7 +110,9 @@ class AgentPhaseExecutor:
104
110
  self.get_agents_func = get_agents_func
105
111
  self.process_message_func = process_message_func
106
112
 
107
- def run_planning_phase(self, goal: str, context: str = "") -> dict[str, Any]:
113
+ def run_planning_phase(
114
+ self, goal: str, context: str = "", coding_style: str | None = None
115
+ ) -> dict[str, Any]:
108
116
  """Run planning phase with read-only tools.
109
117
 
110
118
  Always uses Opus (smartest model) for planning to ensure
@@ -113,12 +121,17 @@ class AgentPhaseExecutor:
113
121
  Args:
114
122
  goal: The goal to plan for.
115
123
  context: Additional context for planning.
124
+ coding_style: Optional coding style guide to inject into prompt.
116
125
 
117
126
  Returns:
118
127
  Dict with 'plan', 'criteria', and 'raw_output' keys.
119
128
  """
120
129
  # Build prompt for planning
121
- prompt = build_planning_prompt(goal=goal, context=context if context else None)
130
+ prompt = build_planning_prompt(
131
+ goal=goal,
132
+ context=context if context else None,
133
+ coding_style=coding_style,
134
+ )
122
135
 
123
136
  # Always use Opus for planning (smartest model)
124
137
  console.info("Planning with Opus (smartest model)...")
@@ -152,6 +165,7 @@ class AgentPhaseExecutor:
152
165
  create_pr: bool = True,
153
166
  pr_group_info: dict | None = None,
154
167
  target_branch: str = "main",
168
+ coding_style: str | None = None,
155
169
  ) -> dict[str, Any]:
156
170
  """Run a work session with full tools.
157
171
 
@@ -165,6 +179,7 @@ class AgentPhaseExecutor:
165
179
  create_pr: If True, instruct agent to create PR. If False, commit only.
166
180
  pr_group_info: Optional dict with PR group context (name, completed_tasks, etc).
167
181
  target_branch: The target branch for rebasing (default: "main").
182
+ coding_style: Optional coding style guide to inject into prompt.
168
183
 
169
184
  Returns:
170
185
  Dict with 'output', 'success', and 'model_used' keys.
@@ -178,6 +193,7 @@ class AgentPhaseExecutor:
178
193
  create_pr=create_pr,
179
194
  pr_group_info=pr_group_info,
180
195
  target_branch=target_branch,
196
+ coding_style=coding_style,
181
197
  )
182
198
 
183
199
  # Run async query with optional model override
@@ -328,3 +344,37 @@ class AgentPhaseExecutor:
328
344
 
329
345
  # Default criteria if none specified
330
346
  return "All tasks in the task list are completed successfully."
347
+
348
+ def generate_coding_style(self) -> dict[str, Any]:
349
+ """Generate a coding style guide by analyzing the codebase.
350
+
351
+ Analyzes CLAUDE.md, convention files, and sample source files
352
+ to create a concise coding style guide.
353
+
354
+ Returns:
355
+ Dict with 'coding_style' and 'raw_output' keys.
356
+ """
357
+ # Build prompt for coding style generation
358
+ prompt = build_coding_style_prompt()
359
+
360
+ console.info("Generating coding style guide with Opus...")
361
+
362
+ # Run with planning tools (read-only) and Opus for quality
363
+ result = run_async_with_cleanup(
364
+ self.query_executor.run_query(
365
+ prompt=prompt,
366
+ tools=self.get_tools_for_phase("planning"),
367
+ model_override=ModelType.OPUS, # Use Opus for quality
368
+ get_model_name_func=self.get_model_name_func,
369
+ get_agents_func=self.get_agents_func,
370
+ process_message_func=self.process_message_func,
371
+ )
372
+ )
373
+
374
+ # Extract the coding style content
375
+ coding_style = extract_coding_style(result)
376
+
377
+ return {
378
+ "coding_style": coding_style,
379
+ "raw_output": result,
380
+ }
@@ -1337,11 +1337,15 @@ After fixing everything, run the tests again to confirm they pass.
1337
1337
  After completing your fixes, end with: TASK COMPLETE"""
1338
1338
 
1339
1339
  try:
1340
+ # Load coding style for consistent style in fix session
1341
+ coding_style = self.state_manager.load_coding_style()
1342
+
1340
1343
  self.agent.run_work_session(
1341
1344
  task_description=task_description,
1342
1345
  context=context,
1343
1346
  model_override=ModelType.OPUS,
1344
1347
  create_pr=True,
1348
+ coding_style=coding_style,
1345
1349
  )
1346
1350
  state.session_count += 1
1347
1351
  self.state_manager.save_state(state)
@@ -0,0 +1,84 @@
1
+ """Planner - Orchestrates initial planning phase (read-only tools)."""
2
+
3
+ from typing import Any
4
+
5
+ from . import console
6
+ from .agent import AgentWrapper
7
+ from .state import StateManager
8
+
9
+
10
+ class Planner:
11
+ """Handles the initial planning phase."""
12
+
13
+ def __init__(self, agent: AgentWrapper, state_manager: StateManager):
14
+ """Initialize planner."""
15
+ self.agent = agent
16
+ self.state_manager = state_manager
17
+
18
+ def ensure_coding_style(self) -> str | None:
19
+ """Ensure coding style guide exists, generating it if needed.
20
+
21
+ Checks if coding-style.md exists. If not, generates it by analyzing
22
+ CLAUDE.md and convention files in the codebase.
23
+
24
+ Returns:
25
+ The coding style guide content, or None if generation failed.
26
+ """
27
+ # Check if coding style already exists
28
+ coding_style = self.state_manager.load_coding_style()
29
+ if coding_style:
30
+ console.info("Using existing coding style guide")
31
+ return coding_style
32
+
33
+ # Generate coding style by analyzing codebase
34
+ console.info("Generating coding style guide from codebase...")
35
+ result = self.agent.generate_coding_style()
36
+
37
+ coding_style_content: str = result.get("coding_style", "")
38
+ if coding_style_content:
39
+ self.state_manager.save_coding_style(coding_style_content)
40
+ console.success("Coding style guide generated and saved")
41
+ return coding_style_content
42
+
43
+ console.warning("Could not generate coding style guide")
44
+ return None
45
+
46
+ def create_plan(self, goal: str) -> dict[str, Any]:
47
+ """Create initial task plan using read-only tools.
48
+
49
+ First generates coding style guide if it doesn't exist, then
50
+ runs planning phase with the coding style injected.
51
+ """
52
+ # Ensure coding style exists (generate if needed)
53
+ coding_style = self.ensure_coding_style()
54
+
55
+ # Load any existing context
56
+ context = self.state_manager.load_context()
57
+
58
+ # Run planning phase with Claude (with coding style)
59
+ result = self.agent.run_planning_phase(
60
+ goal=goal, context=context, coding_style=coding_style
61
+ )
62
+
63
+ # Extract plan and criteria from result
64
+ plan = result.get("plan", "")
65
+ criteria = result.get("criteria", "")
66
+
67
+ # Save to state
68
+ if plan:
69
+ self.state_manager.save_plan(plan)
70
+ if criteria:
71
+ self.state_manager.save_criteria(criteria)
72
+
73
+ return result
74
+
75
+ def update_plan_progress(self, task_index: int, completed: bool) -> None:
76
+ """Update task completion status in plan."""
77
+ plan = self.state_manager.load_plan()
78
+ if not plan:
79
+ return
80
+
81
+ # TODO: Parse markdown checkboxes and update status
82
+ # This will require parsing the plan.md file and toggling checkboxes
83
+
84
+ self.state_manager.save_plan(plan)
@@ -1,6 +1,7 @@
1
1
  """Prompt Templates - Centralized, maintainable prompt generation.
2
2
 
3
3
  This module provides structured prompt templates for different agent phases:
4
+ - Coding Style: Generate concise coding style guide from codebase analysis
4
5
  - Planning: Initial codebase analysis and task creation
5
6
  - Plan Update: Modifying existing plans based on change requests
6
7
  - Working: Task execution with verification
@@ -12,6 +13,7 @@ All prompts are designed to be concise, structured, and token-efficient.
12
13
  This module re-exports all prompt functions for backward compatibility.
13
14
  The actual implementations are in:
14
15
  - prompts_base.py: PromptSection, PromptBuilder
16
+ - prompts_coding_style.py: build_coding_style_prompt, extract_coding_style
15
17
  - prompts_planning.py: build_planning_prompt
16
18
  - prompts_plan_update.py: build_plan_update_prompt
17
19
  - prompts_working.py: build_work_prompt
@@ -24,6 +26,9 @@ from __future__ import annotations
24
26
  # Re-export base classes
25
27
  from .prompts_base import PromptBuilder, PromptSection
26
28
 
29
+ # Re-export coding style prompts
30
+ from .prompts_coding_style import build_coding_style_prompt, extract_coding_style
31
+
27
32
  # Re-export planning prompts
28
33
  from .prompts_plan_update import build_plan_update_prompt
29
34
  from .prompts_planning import build_planning_prompt
@@ -43,6 +48,9 @@ __all__ = [
43
48
  # Base classes
44
49
  "PromptSection",
45
50
  "PromptBuilder",
51
+ # Coding Style
52
+ "build_coding_style_prompt",
53
+ "extract_coding_style",
46
54
  # Planning
47
55
  "build_planning_prompt",
48
56
  "build_plan_update_prompt",
@@ -0,0 +1,160 @@
1
+ """Coding Style Generation Prompt for Claude Task Master.
2
+
3
+ This module contains the prompt for generating a concise coding style guide
4
+ by analyzing CLAUDE.md and convention files. The generated guide captures:
5
+ - Coding workflow (TDD, development process)
6
+ - Code style conventions (naming, formatting)
7
+ - Project-specific requirements
8
+
9
+ The guide is saved to coding-style.md and injected into planning and work
10
+ prompts to save tokens while ensuring consistent code quality.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from .prompts_base import PromptBuilder
16
+
17
+
18
+ def build_coding_style_prompt() -> str:
19
+ """Build the prompt for generating a coding style guide.
20
+
21
+ This prompt instructs Claude to analyze CLAUDE.md and convention files
22
+ to create a concise coding style guide that captures the project's
23
+ workflow (TDD, development process) and code conventions.
24
+
25
+ Returns:
26
+ Complete coding style generation prompt.
27
+ """
28
+ builder = PromptBuilder(
29
+ intro="""You are analyzing a codebase to extract its coding workflow and style guide.
30
+
31
+ Your mission: **Create a CONCISE coding guide (under 600 words).**
32
+
33
+ Focus on extracting:
34
+ 1. **Development workflow** (TDD, test-first, iteration patterns)
35
+ 2. **Code conventions** (naming, formatting, imports)
36
+ 3. **Project-specific requirements** (from CLAUDE.md)
37
+
38
+ This guide will be injected into every coding task, so keep it SHORT and ACTIONABLE.
39
+
40
+ ## TOOL RESTRICTIONS (MANDATORY)
41
+
42
+ **ALLOWED TOOLS (use ONLY these):**
43
+ - `Read` - Read files to understand patterns
44
+ - `Glob` - Find files by pattern
45
+ - `Grep` - Search for code patterns
46
+ - `Bash` - Run commands (check configs, linters, etc.)
47
+
48
+ **FORBIDDEN TOOLS (NEVER use):**
49
+ - `Write` - Do NOT write any files
50
+ - `Edit` - Do NOT edit any files
51
+ - `Task` - Do NOT launch any agents"""
52
+ )
53
+
54
+ builder.add_section(
55
+ "Step 1: Read CLAUDE.md (PRIORITY)",
56
+ """**Start by reading `CLAUDE.md` at the repository root.**
57
+
58
+ This file contains the project's coding requirements and workflow instructions.
59
+ Extract:
60
+ - Development workflow (TDD, test-driven, iteration patterns)
61
+ - Code quality requirements
62
+ - Testing approach (test first? mock patterns?)
63
+ - Any specific coding rules or constraints
64
+
65
+ Also check these if CLAUDE.md doesn't exist:
66
+ - `.claude/instructions.md`
67
+ - `CONTRIBUTING.md`
68
+ - `.cursorrules`, `.github/copilot-instructions.md`""",
69
+ )
70
+
71
+ builder.add_section(
72
+ "Step 2: Check Configs",
73
+ """Quickly scan linter/formatter configs for conventions:
74
+
75
+ - Python: `pyproject.toml` [tool.ruff], `ruff.toml`
76
+ - JS/TS: `.eslintrc`, `.prettierrc`, `biome.json`
77
+ - General: `.editorconfig`
78
+
79
+ Note line length, quote style, import ordering rules.""",
80
+ )
81
+
82
+ builder.add_section(
83
+ "Step 3: Generate Coding Guide",
84
+ """Create a CONCISE guide with these sections (skip if not applicable):
85
+
86
+ ```markdown
87
+ # Coding Style
88
+
89
+ ## Workflow
90
+ - [TDD approach? Test-first? Iteration pattern?]
91
+ - [Required checks before commit: tests, lint, types?]
92
+
93
+ ## Code Style
94
+ - [Naming: snake_case, camelCase, etc.]
95
+ - [Formatting: line length, quotes, indentation]
96
+ - [Imports: ordering, grouping]
97
+
98
+ ## Types
99
+ - [Type annotations required? Strictness level?]
100
+
101
+ ## Testing
102
+ - [Test file naming, location]
103
+ - [Assertion style, mock patterns]
104
+ - [Coverage requirements?]
105
+
106
+ ## Error Handling
107
+ - [Exception patterns, logging approach]
108
+
109
+ ## Project-Specific
110
+ - [Any unique requirements from CLAUDE.md]
111
+ ```
112
+
113
+ **Rules:**
114
+ - Each section: 2-4 bullet points MAX
115
+ - Be SPECIFIC and ACTIONABLE: "Run `pytest` before commit" not "Test your code"
116
+ - Capture the WORKFLOW, not just style
117
+ - Include actual commands where relevant
118
+ - Total guide: under 600 words""",
119
+ )
120
+
121
+ builder.add_section(
122
+ "Output Format",
123
+ """Output ONLY the coding guide in markdown format.
124
+
125
+ Start with `# Coding Style` and include only relevant sections.
126
+
127
+ Do NOT include explanations or meta-commentary - just the guide itself.
128
+
129
+ End with:
130
+ ```
131
+ CODING_STYLE_COMPLETE
132
+ ```""",
133
+ )
134
+
135
+ return builder.build()
136
+
137
+
138
+ def extract_coding_style(result: str) -> str:
139
+ """Extract the coding style guide from the generation result.
140
+
141
+ Args:
142
+ result: The raw output from the coding style generation.
143
+
144
+ Returns:
145
+ The extracted coding style guide content.
146
+ """
147
+ # Remove the completion marker if present
148
+ content = result.replace("CODING_STYLE_COMPLETE", "").strip()
149
+
150
+ # If it starts with markdown header, return as-is
151
+ if content.startswith("# Coding Style") or content.startswith("# coding style"):
152
+ return content
153
+
154
+ # Try to find the coding style section
155
+ if "# Coding Style" in content:
156
+ idx = content.index("# Coding Style")
157
+ return content[idx:].strip()
158
+
159
+ # Fallback: wrap the content
160
+ return f"# Coding Style\n\n{content}"