forked from HAL9000/cleveragents-core
b888afab71
Add builtin/plan-subplan tool for strategy actors to emit SUBPLAN_SPAWN or SUBPLAN_PARALLEL_SPAWN decisions when decomposing a plan into child plans. Implements all acceptance criteria from issue #198: - SubplanPayload (Pydantic) validates goal, resource_scopes/project_ref (at least one required), merge_strategy, max_parallel (1-50), parallel flag, dependencies, and context_view override. - Defaults: merge_strategy=git_three_way, max_parallel=5, parallel=False, dependencies=[]. Omitted fields inherit sensible values automatically. - make_plan_subplan_spec(decision_service=None) factory supports optional DecisionService injection for persistent decision recording. - _build_rationale() generates human-readable rationale text (goal, scope, execution mode, dependencies, context_view) surfaced in plan explain. - register_subplan_tool() added to tool/builtins/__init__.py for bulk registration. PLAN_SUBPLAN_SPEC exported as the default ready-to-use spec. - Actor YAML example (examples/actors/strategy_with_subplan.yaml) with annotated serial and parallel spawn payload examples. - Behave BDD: 20 scenarios, 70 steps covering validation, defaults, decision type, rationale, service injection, registry, and ToolRunner. - Robot Framework: 9 smoke tests via robot/plan_subplan_tool.robot. - ASV benchmarks: benchmarks/subplan_actor_tool_bench.py (5 suites). - Coverage: 100% on subplan_tool.py. Lint, typecheck, and security clean. ISSUES CLOSED: #198
67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
# Strategy Actor — Subplan Emission
|
|
#
|
|
# Demonstrates a strategy actor that uses builtin/plan-subplan to spawn
|
|
# sequential and parallel child plans during the Strategize phase.
|
|
#
|
|
# The actor calls builtin/plan-subplan with the following payload:
|
|
# - goal: What the child plan should accomplish
|
|
# - resource_scopes: Paths or resource IDs the child plan targets
|
|
# - parallel: True → SUBPLAN_PARALLEL_SPAWN; False → SUBPLAN_SPAWN
|
|
# - merge_strategy: How to merge child-plan results (default: git_three_way)
|
|
# - max_parallel: Maximum concurrent subplans (default: 5)
|
|
# - dependencies: Sibling subplan ULIDs this plan depends on
|
|
|
|
name: local/strategy_with_subplan
|
|
type: llm
|
|
description: >
|
|
Strategy actor that decomposes a large plan into coordinated subplans
|
|
using the builtin/plan-subplan tool.
|
|
version: "1.0"
|
|
|
|
model: gpt-4-turbo
|
|
context_view: strategist
|
|
|
|
system_prompt: |
|
|
You are a strategy actor responsible for decomposing complex plans into
|
|
child subplans. Use the builtin/plan-subplan tool to emit subplan decisions.
|
|
|
|
For sequential work (one subplan at a time):
|
|
Call plan-subplan with parallel=false.
|
|
|
|
For parallel work (multiple subplans at once):
|
|
Call plan-subplan with parallel=true and list any dependencies.
|
|
|
|
Always include at least one resource_scope or project_ref.
|
|
|
|
tools:
|
|
- builtin/plan-subplan
|
|
|
|
memory:
|
|
enabled: false
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Example: Sequential subplan payload
|
|
#
|
|
# {
|
|
# "goal": "Refactor the authentication module",
|
|
# "plan_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
# "sequence_number": 1,
|
|
# "resource_scopes": ["src/auth/", "tests/auth/"],
|
|
# "parallel": false,
|
|
# "merge_strategy": "git_three_way"
|
|
# }
|
|
#
|
|
# Example: Parallel subplan payload with dependencies
|
|
#
|
|
# {
|
|
# "goal": "Run full test suite",
|
|
# "plan_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
# "sequence_number": 2,
|
|
# "resource_scopes": ["tests/"],
|
|
# "parallel": true,
|
|
# "max_parallel": 3,
|
|
# "dependencies": ["01ARZ3NDEKTSV4RRFFQ69G5FAW"],
|
|
# "merge_strategy": "fail_on_conflict"
|
|
# }
|
|
# ---------------------------------------------------------------------------
|