mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-03 07:33:37 +00:00
feat: add multi-feature batching for coding agents
Enable the orchestrator to assign 1-3 features per coding agent subprocess, selected via dependency chain extension + same-category fill. This reduces cold-start overhead and leverages shared context across related features. Orchestrator (parallel_orchestrator.py): - Add batch tracking: _batch_features and _feature_to_primary data structures - Add build_feature_batches() with dependency chain + category fill algorithm - Add start_feature_batch() and _spawn_coding_agent_batch() methods - Update _on_agent_complete() for batch cleanup across all features - Update stop_feature() with _feature_to_primary lookup - Update get_ready_features() to exclude all batch feature IDs - Update main loop to build batches then spawn per available slot CLI and agent layer: - Add --feature-ids (comma-separated) and --batch-size CLI args - Add feature_ids parameter to run_autonomous_agent() with batch prompt selection - Add get_batch_feature_prompt() with sequential workflow instructions WebSocket layer (server/websocket.py): - Add BATCH_CODING_AGENT_START_PATTERN and BATCH_FEATURES_COMPLETE_PATTERN - Add _handle_batch_agent_start() and _handle_batch_agent_complete() methods - Add featureIds field to all agent_update messages - Track current_feature_id updates as agent moves through batch Frontend (React UI): - Add featureIds to ActiveAgent and WSAgentUpdateMessage types - Update KanbanColumn and DependencyGraph agent-feature maps for batch - Update AgentCard to show "Batch: #X, #Y, #Z" with active feature highlight - Add "Features per Agent" segmented control (1-3) in SettingsModal Settings integration (full stack): - Add batch_size to schemas, settings router, agent router, process manager - Default batch_size=3, user-configurable 1-3 via settings UI - batch_size=1 is functionally identical to pre-batching behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
46
prompts.py
46
prompts.py
@@ -217,6 +217,52 @@ If blocked, use `feature_skip` and document the blocker.
|
||||
return single_feature_header + base_prompt
|
||||
|
||||
|
||||
def get_batch_feature_prompt(
|
||||
feature_ids: list[int],
|
||||
project_dir: Path | None = None,
|
||||
yolo_mode: bool = False,
|
||||
) -> str:
|
||||
"""Prepend batch-feature assignment header to base coding prompt.
|
||||
|
||||
Used in parallel mode to assign multiple features to an agent.
|
||||
Features should be implemented sequentially in the given order.
|
||||
|
||||
Args:
|
||||
feature_ids: List of feature IDs to implement in order
|
||||
project_dir: Optional project directory for project-specific prompts
|
||||
yolo_mode: If True, strip browser testing instructions from the base prompt
|
||||
|
||||
Returns:
|
||||
The prompt with batch-feature header prepended
|
||||
"""
|
||||
base_prompt = get_coding_prompt(project_dir, yolo_mode=yolo_mode)
|
||||
ids_str = ", ".join(f"#{fid}" for fid in feature_ids)
|
||||
|
||||
batch_header = f"""## ASSIGNED FEATURES (BATCH): {ids_str}
|
||||
|
||||
You have been assigned {len(feature_ids)} features to implement sequentially.
|
||||
Process them IN ORDER: {ids_str}
|
||||
|
||||
### Workflow for each feature:
|
||||
1. Call `feature_claim_and_get` with the feature ID to get its details
|
||||
2. Implement the feature fully
|
||||
3. Verify it works (browser testing if applicable)
|
||||
4. Call `feature_mark_passing` to mark it complete
|
||||
5. Git commit the changes
|
||||
6. Move to the next feature
|
||||
|
||||
### Important:
|
||||
- Complete each feature fully before starting the next
|
||||
- Mark each feature passing individually as you go
|
||||
- If blocked on a feature, use `feature_skip` and move to the next one
|
||||
- Other agents are handling other features - focus only on yours
|
||||
|
||||
---
|
||||
|
||||
"""
|
||||
return batch_header + base_prompt
|
||||
|
||||
|
||||
def get_app_spec(project_dir: Path) -> str:
|
||||
"""
|
||||
Load the app spec from the project.
|
||||
|
||||
Reference in New Issue
Block a user