MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / classify_breadth_need

Function classify_breadth_need

core/recursive.py:75–104  ·  view source on GitHub ↗

Classify task complexity to determine recursion depth. Returns: "minimal" — Q&A, short lookups. No recursion. "standard" — Typical single-file coding tasks. 1 critique+refine pass. "deep" — Multi-file, complex APIs, long tasks. 2 critique+refine passes.

(user_message: str)

Source from the content-addressed store, hash-verified

73
74
75def classify_breadth_need(user_message: str) -> str:
76 """
77 Classify task complexity to determine recursion depth.
78
79 Returns:
80 "minimal" — Q&A, short lookups. No recursion.
81 "standard" — Typical single-file coding tasks. 1 critique+refine pass.
82 "deep" — Multi-file, complex APIs, long tasks. 2 critique+refine passes.
83 """
84 msg = user_message.strip().lower()
85 words = msg.split()
86
87 # Very short messages that look like questions → minimal
88 if len(words) < 8:
89 if (msg.endswith("?")
90 or msg.startswith(_QA_STARTERS)
91 or any(k in msg for k in _QA_PHRASES)):
92 return "minimal"
93
94 # No action keywords → likely Q&A → minimal
95 has_action = any(k in msg for k in _ACTION_KEYWORDS)
96 if not has_action:
97 return "minimal"
98
99 # Long messages or many deep-complexity signals → deep
100 deep_count = sum(1 for sig in _DEEP_SIGNALS if sig in msg)
101 if len(words) > 50 or deep_count >= 3:
102 return "deep"
103
104 return "standard"
105
106
107# ── Adaptive depth (Phase 8) ────────────────────────────────────────────────

Callers 15

run_agentFunction · 0.90
run_queueFunction · 0.90
test_simple_questionMethod · 0.90
test_how_questionMethod · 0.90
test_question_markMethod · 0.90
test_explain_requestMethod · 0.90
test_helloMethod · 0.90
test_thanksMethod · 0.90
test_write_functionMethod · 0.90
test_fix_bugMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_simple_questionMethod · 0.72
test_how_questionMethod · 0.72
test_question_markMethod · 0.72
test_explain_requestMethod · 0.72
test_helloMethod · 0.72
test_thanksMethod · 0.72
test_write_functionMethod · 0.72
test_fix_bugMethod · 0.72
test_edit_fileMethod · 0.72
test_full_apiMethod · 0.72