cosmotron_mcp.base¶
write_plan ¶
Write the execution plan as a DRAFT plan.json and open the plan-approval gate.
Each step is a dict, e.g. {"agent": "analysis_coder", "action": "compute
auto-Cℓ bin 0", "outputs": "results/spectra/cls_bin_00.json"}. The written
plan is NOT yet approved: this call opens the plan-approval gate, and
every pipeline tool refuses until it resolves. Present the numbered plan
to the user in chat as information (not a question), then call
authorise_gate(session_dir, "plan-approval", "approve") — the
confirmation dialogue that call raises IS the approval. If the user
declines the dialogue, ask in chat what to change, revise via the
planner, and write_plan again (a rewrite always needs a fresh approval).
After approval the orchestrator dispatches strictly by reading plan.json (via read_plan) and marks each step done (set_plan_step_status) as its artefact appears — it never improvises the next step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session directory. |
required |
steps
|
list
|
Ordered list of step dicts, e.g. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
true (and |
dict
|
|
Source code in cosmotron_mcp/server.py
read_plan ¶
Read the committed plan.json.
The orchestrator calls this each turn to pick the next status == "pending"
step.
Raises:
| Type | Description |
|---|---|
Exception
|
If no plan has been committed (the plan gate has not run). |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session directory. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|
Source code in cosmotron_mcp/server.py
set_plan_step_status ¶
Mark plan step n with status (e.g. "done", "running") in plan.json.
Call after a step's artefact is confirmed in results/artefact_registry.json, then mirror the tick into the opencode TODO list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session directory. |
required |
n
|
int
|
Step number to update. |
required |
status
|
str
|
New status, e.g. |
'done'
|
Returns:
| Type | Description |
|---|---|
dict
|
The updated plan dict. |