summaryrefslogtreecommitdiff
path: root/internal/agentloop
diff options
context:
space:
mode:
Diffstat (limited to 'internal/agentloop')
-rw-r--r--internal/agentloop/tools.go63
1 files changed, 56 insertions, 7 deletions
diff --git a/internal/agentloop/tools.go b/internal/agentloop/tools.go
index d803c23..ad1aecf 100644
--- a/internal/agentloop/tools.go
+++ b/internal/agentloop/tools.go
@@ -8,16 +8,17 @@ import (
"github.com/thepeterstone/claudomator/internal/agentchannel"
"github.com/thepeterstone/claudomator/internal/provider"
+ "github.com/thepeterstone/claudomator/internal/role"
"github.com/thepeterstone/claudomator/internal/sandbox"
)
-// agentToolSpecs returns the nine tools available to the loop: the five
-// agent back-channel tools (mirroring the MCP tools ContainerRunner exposes;
-// propose_epic was added in Phase 7c) plus the four sandbox tools, as
-// provider-neutral ToolSpecs. The original four (ask_user/report_summary/
-// spawn_subtask/record_progress) plus the sandbox tools were ported verbatim
-// (same names/descriptions/JSON schemas) from the former
-// executor.agentToolDefs (internal/executor/localtools.go).
+// agentToolSpecs returns the tools available to the loop: the agent
+// back-channel tools (mirroring the MCP tools ContainerRunner exposes;
+// propose_epic was added in Phase 7c, propose_role_config in Phase 8) plus
+// the four sandbox tools, as provider-neutral ToolSpecs. The original four
+// (ask_user/report_summary/spawn_subtask/record_progress) plus the sandbox
+// tools were ported verbatim (same names/descriptions/JSON schemas) from the
+// former executor.agentToolDefs (internal/executor/localtools.go).
func agentToolSpecs() []provider.ToolSpec {
strProp := func(desc string) map[string]any {
return map[string]any{"type": "string", "description": desc}
@@ -82,6 +83,45 @@ func agentToolSpecs() []provider.ToolSpec {
},
},
{
+ Name: "propose_role_config",
+ Description: "Propose a new draft configuration version for a role, after reflecting on what happened (e.g. during a story retro). Creates a new draft role_configs row for a human to review and activate -- it never changes what is currently active.",
+ ParametersJSONSchema: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "role": strProp("the role name this config applies to (e.g. an existing role like builder, or a new one)"),
+ "system_prompt": strProp("system prompt appended for tasks dispatched through this role"),
+ "tools": map[string]any{"type": "array", "items": map[string]any{"type": "string"}, "description": "optional tool allowlist for this role"},
+ "sandbox_kind": strProp("optional sandbox kind for this role"),
+ "default_budget_usd": map[string]any{"type": "number", "description": "optional estimated budget in USD, used when the scheduler considers escalating this role's tasks"},
+ "escalation_ladder": map[string]any{
+ "type": "array",
+ "description": "ordered list of escalation tiers",
+ "items": map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "candidates": map[string]any{
+ "type": "array",
+ "items": map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "provider": strProp("executor runner key, e.g. anthropic, google, groq, openrouter, openai, local"),
+ "model": strProp("model name"),
+ },
+ "required": []string{"provider", "model"},
+ },
+ "description": "candidate provider/model rungs for this tier",
+ },
+ "selection_mode": strProp("round_robin (default) or single"),
+ "max_retries": map[string]any{"type": "integer", "description": "attempts allowed at this tier before escalating to the next"},
+ },
+ "required": []string{"candidates"},
+ },
+ },
+ },
+ "required": []string{"role"},
+ },
+ },
+ {
Name: "read_file",
Description: "Read the contents of a file in the sandbox working directory.",
ParametersJSONSchema: map[string]any{
@@ -211,6 +251,15 @@ func (l *Loop) dispatchTool(ctx context.Context, name, argsJSON string) (result
}
return "Proposed epic " + id, false, nil
+ case "propose_role_config":
+ var a role.RoleConfig
+ _ = json.Unmarshal([]byte(argsJSON), &a)
+ version, prErr := l.Channel.ProposeRoleConfig(ctx, a)
+ if prErr != nil {
+ return "", false, prErr
+ }
+ return fmt.Sprintf("Proposed role config %s v%d (draft)", a.Role, version), false, nil
+
case "read_file":
var a struct {
Path string `json:"path"`