Skip to content

Commit 60eee65

Browse files
committed
Remove heuristic subagent config shortcut
1 parent 029676b commit 60eee65

5 files changed

Lines changed: 1 addition & 311 deletions

File tree

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
//go:embed workspace
2020
var embeddedFiles embed.FS
2121

22-
var version = "0.2.1"
22+
var version = "0.0.2"
2323
var buildTime = "unknown"
2424

2525
const logo = ">"

pkg/agent/loop.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,25 +1201,6 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
12011201
} else {
12021202
specTaskRef = normalizeSpecCodingTaskRef(taskRef)
12031203
}
1204-
if configAction, handled, configErr := al.maybeHandleSubagentConfigIntent(ctx, msg); handled {
1205-
if configErr != nil && specTaskRef.Summary != "" {
1206-
if err := al.maybeReopenSpecCodingTask(specTaskRef, msg.Content, configErr.Error()); err != nil {
1207-
logger.WarnCF("agent", logger.C0172, map[string]interface{}{
1208-
"session_key": msg.SessionKey,
1209-
"error": err.Error(),
1210-
})
1211-
}
1212-
}
1213-
if configErr == nil && specTaskRef.Summary != "" {
1214-
if err := al.maybeCompleteSpecCodingTask(specTaskRef, configAction); err != nil {
1215-
logger.WarnCF("agent", logger.C0172, map[string]interface{}{
1216-
"session_key": msg.SessionKey,
1217-
"error": err.Error(),
1218-
})
1219-
}
1220-
}
1221-
return configAction, configErr
1222-
}
12231204
if routed, ok, routeErr := al.maybeAutoRoute(ctx, msg); ok {
12241205
if routeErr != nil && specTaskRef.Summary != "" {
12251206
if err := al.maybeReopenSpecCodingTask(specTaskRef, msg.Content, routeErr.Error()); err != nil {

pkg/agent/subagent_config_intent.go

Lines changed: 0 additions & 106 deletions
This file was deleted.

pkg/agent/subagent_config_intent_test.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

pkg/tools/subagent_config_manager.go

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,6 @@ import (
1010
"github.com/YspCoder/clawgo/pkg/runtimecfg"
1111
)
1212

13-
func DraftConfigSubagent(description, agentIDHint string) map[string]interface{} {
14-
desc := strings.TrimSpace(description)
15-
lower := strings.ToLower(desc)
16-
role := inferDraftRole(lower)
17-
agentID := strings.TrimSpace(agentIDHint)
18-
if agentID == "" {
19-
agentID = inferDraftAgentID(role, lower)
20-
}
21-
displayName := inferDraftDisplayName(role, agentID)
22-
toolAllowlist := inferDraftToolAllowlist(role)
23-
keywords := inferDraftKeywords(role, lower)
24-
return map[string]interface{}{
25-
"agent_id": agentID,
26-
"role": role,
27-
"display_name": displayName,
28-
"description": desc,
29-
"notify_main_policy": "final_only",
30-
"system_prompt_file": "agents/" + agentID + "/AGENT.md",
31-
"memory_namespace": agentID,
32-
"tool_allowlist": toolAllowlist,
33-
"routing_keywords": keywords,
34-
"type": "worker",
35-
}
36-
}
37-
3813
func UpsertConfigSubagent(configPath string, args map[string]interface{}) (map[string]interface{}, error) {
3914
configPath = strings.TrimSpace(configPath)
4015
if configPath == "" {
@@ -284,113 +259,3 @@ func normalizeKeywords(items []string) []string {
284259
}
285260
return out
286261
}
287-
288-
func inferDraftRole(lower string) string {
289-
switch {
290-
case containsDraftKeyword(lower, "test", "regression", "qa", "鍥炲綊", "娴嬭瘯", "楠岃瘉"):
291-
return "testing"
292-
case containsDraftKeyword(lower, "doc", "docs", "readme", "鏂囨。", "璇存槑"):
293-
return "docs"
294-
case containsDraftKeyword(lower, "research", "investigate", "analyze", "璋冪爺", "鍒嗘瀽", "鐮旂┒"):
295-
return "research"
296-
default:
297-
return "coding"
298-
}
299-
}
300-
301-
func inferDraftAgentID(role, lower string) string {
302-
switch role {
303-
case "testing":
304-
if containsDraftKeyword(lower, "review", "瀹℃煡", "reviewer") {
305-
return "reviewer"
306-
}
307-
return "tester"
308-
case "docs":
309-
return "doc_writer"
310-
case "research":
311-
return "researcher"
312-
default:
313-
if containsDraftKeyword(lower, "frontend", "ui", "鍓嶇") {
314-
return "frontend-coder"
315-
}
316-
if containsDraftKeyword(lower, "backend", "api", "鍚庣") {
317-
return "backend-coder"
318-
}
319-
return "coder"
320-
}
321-
}
322-
323-
func inferDraftDisplayName(role, agentID string) string {
324-
switch role {
325-
case "testing":
326-
return "Test Agent"
327-
case "docs":
328-
return "Docs Agent"
329-
case "research":
330-
return "Research Agent"
331-
default:
332-
if strings.Contains(agentID, "frontend") {
333-
return "Frontend Code Agent"
334-
}
335-
if strings.Contains(agentID, "backend") {
336-
return "Backend Code Agent"
337-
}
338-
return "Code Agent"
339-
}
340-
}
341-
342-
func inferDraftToolAllowlist(role string) []string {
343-
switch role {
344-
case "testing":
345-
return []string{"shell", "filesystem", "process_manager", "sessions"}
346-
case "docs":
347-
return []string{"filesystem", "read_file", "write_file", "edit_file", "repo_map", "sessions"}
348-
case "research":
349-
return []string{"web_search", "web_fetch", "repo_map", "sessions", "memory_search"}
350-
default:
351-
return []string{"filesystem", "shell", "repo_map", "sessions"}
352-
}
353-
}
354-
355-
func inferDraftKeywords(role, lower string) []string {
356-
seed := []string{}
357-
switch role {
358-
case "testing":
359-
seed = []string{"test", "regression", "verify", "鍥炲綊", "娴嬭瘯", "楠岃瘉"}
360-
case "docs":
361-
seed = []string{"docs", "readme", "document", "鏂囨。", "璇存槑"}
362-
case "research":
363-
seed = []string{"research", "analyze", "investigate", "璋冪爺", "鍒嗘瀽", "鐮旂┒"}
364-
default:
365-
seed = []string{"code", "implement", "fix", "refactor", "浠g爜", "瀹炵幇", "淇", "閲嶆瀯"}
366-
}
367-
if containsDraftKeyword(lower, "frontend", "鍓嶇", "ui") {
368-
seed = append(seed, "frontend", "ui", "鍓嶇")
369-
}
370-
if containsDraftKeyword(lower, "backend", "鍚庣", "api") {
371-
seed = append(seed, "backend", "api", "鍚庣")
372-
}
373-
return normalizeKeywords(seed)
374-
}
375-
376-
func inferDraftSystemPrompt(role, description string) string {
377-
switch role {
378-
case "testing":
379-
return "浣犺礋璐f祴璇曘€侀獙璇併€佸洖褰掓鏌ヤ笌椋庨櫓鍙嶉銆備换鍔℃弿杩帮細" + description
380-
case "docs":
381-
return "浣犺礋璐f枃妗g紪鍐欍€佺粨鏋勬暣鐞嗗拰璇存槑琛ュ叏銆備换鍔℃弿杩帮細" + description
382-
case "research":
383-
return "浣犺礋璐h皟鐮斻€佸垎鏋愩€佹瘮杈冩柟妗堬紝骞惰緭鍑虹粨璁轰笌渚濇嵁銆備换鍔℃弿杩帮細" + description
384-
default:
385-
return "浣犺礋璐d唬鐮佸疄鐜颁笌閲嶆瀯锛岃緭鍑哄叿浣撲慨鏀瑰缓璁拰鍙樻洿缁撴灉銆備换鍔℃弿杩帮細" + description
386-
}
387-
}
388-
389-
func containsDraftKeyword(text string, items ...string) bool {
390-
for _, item := range items {
391-
if strings.Contains(text, strings.ToLower(strings.TrimSpace(item))) {
392-
return true
393-
}
394-
}
395-
return false
396-
}

0 commit comments

Comments
 (0)