Architecture: - director_v2: always-on brain, produces DirectorPlan with tool_sequence - thinker_v2: pure executor, runs tools from DirectorPlan - interpreter_v1: factual result summarizer, no hallucination - v2_director_drives graph: Input -> Director -> Thinker -> Output Infrastructure: - Split into 3 pods: cog-frontend (nginx), cog-runtime (FastAPI), cog-mcp (SSE proxy) - MCP survives runtime restarts (separate pod, proxies via HTTP) - Async send pipeline: /api/send/check -> /api/send -> /api/result with progress - Zero-downtime rolling updates (maxUnavailable: 0) - Dynamic graph visualization (fetched from API, not hardcoded) Tests: 22 new mocked unit tests (director_v2: 7, thinker_v2: 8, interpreter_v1: 7) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
2.9 KiB
Python
66 lines
2.9 KiB
Python
"""v2-director-drives: Director is the brain, Thinker is the executor.
|
|
|
|
Director (smart model) receives Input, decides what to do, produces a plan.
|
|
Thinker (fast model) executes the plan's tool_sequence without autonomous reasoning.
|
|
Interpreter (fast model) summarizes tool results factually.
|
|
No S3* audits needed — Director controls everything.
|
|
|
|
Flow: Input -> Director -> Thinker -> [Output, UI] -> Memorizer -> Director.update()
|
|
(Interpreter is called by Thinker when tool results need summarization)
|
|
"""
|
|
|
|
NAME = "v2-director-drives"
|
|
DESCRIPTION = "Director is the brain, Thinker executes, Interpreter reads results"
|
|
|
|
NODES = {
|
|
"input": "input_v1", # Same structured classifier
|
|
"director": "director_v2", # NEW: always-on brain, produces DirectorPlan
|
|
"thinker": "thinker_v2", # NEW: pure executor, follows DirectorPlan
|
|
"interpreter": "interpreter_v1", # NEW: factual result summarizer
|
|
"output": "output_v1", # Same text renderer
|
|
"ui": "ui", # Same dashboard renderer
|
|
"memorizer": "memorizer_v1", # Same long-term memory
|
|
"sensor": "sensor", # Same state monitor
|
|
}
|
|
|
|
EDGES = [
|
|
# Data edges — Director drives the pipeline
|
|
{"from": "input", "to": "director", "type": "data", "carries": "Command"},
|
|
{"from": "input", "to": "output", "type": "data", "carries": "Command",
|
|
"condition": "reflex"},
|
|
{"from": "director", "to": "thinker", "type": "data", "carries": "DirectorPlan"},
|
|
{"from": "thinker", "to": ["output", "ui"], "type": "data",
|
|
"carries": "ThoughtResult", "parallel": True},
|
|
{"from": "thinker", "to": "interpreter", "type": "data",
|
|
"carries": "tool_output", "condition": "has_tool_output"},
|
|
{"from": "interpreter", "to": "output", "type": "data",
|
|
"carries": "InterpretedResult", "condition": "has_tool_output"},
|
|
{"from": "output", "to": "memorizer", "type": "data", "carries": "history"},
|
|
|
|
# Context edges
|
|
{"from": "memorizer", "to": "director", "type": "context",
|
|
"method": "get_context_block"},
|
|
{"from": "memorizer", "to": "input", "type": "context",
|
|
"method": "get_context_block"},
|
|
{"from": "memorizer", "to": "output", "type": "context",
|
|
"method": "get_context_block"},
|
|
{"from": "director", "to": "output", "type": "context",
|
|
"method": "get_context_line"},
|
|
{"from": "sensor", "to": "director", "type": "context",
|
|
"method": "get_context_lines"},
|
|
{"from": "ui", "to": "director", "type": "context",
|
|
"method": "get_machine_summary"},
|
|
|
|
# State edges
|
|
{"from": "sensor", "to": "runtime", "type": "state", "reads": "flags"},
|
|
{"from": "ui", "to": "runtime", "type": "state", "reads": "current_controls"},
|
|
]
|
|
|
|
CONDITIONS = {
|
|
"reflex": "intent==social AND complexity==trivial",
|
|
"has_tool_output": "thinker.tool_used is not empty",
|
|
}
|
|
|
|
# No audits — Director controls tool usage, no need for S3* corrections
|
|
AUDIT = {}
|