cosmotron_mcp.inference.draft¶
draft_inference_spec ¶
draft_inference_spec(session_dir: str, task_description: str = '', label: str | None = None) -> dict
Scaffold a typed InferenceSpec draft from the session SACC — deterministic, no LLM.
Reads the registered SACC to learn the run's probes and per-probe tomographic bin
counts, then writes inference/{label}/inference_spec.draft.json with the structure
filled (probes, per-bin prior slots pre-keyed to the actual tracers, standard DES-Y1
cosmology priors) and the value-level choices left as kind:"TODO" slots. This is
the FIRST step of the recommended inference path (draft → fill via
update_inference_spec → validate_inference_spec → human gate → compile_inference).
A literature-prior request in the task ("same priors as DESI DR2") is never
fabricated: the reference is recorded in notes and returned as needs_literature
for the orchestrator to resolve + human-confirm first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session directory (must have a SACC data vector). |
required |
task_description
|
str
|
Task text; used to seed sampler/priors and the spec notes. Defaults to the session's stored task. |
''
|
label
|
str | None
|
Spec label (names |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|
Source code in cosmotron_mcp/server.py
update_inference_spec ¶
Deep-merge corrections into a draft spec, rewrite it, and revalidate — no LLM.
How the write-tool-free @inference agent fills a draft's kind:"TODO" slots: pass
the corrected fragments (nested dicts merge; a leaf value such as a prior's params
list is replaced wholesale) and get back the current schema-only validation state so
the agent can see what remains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session directory. |
required |
spec_path
|
str
|
Path to the draft spec JSON (from |
required |
updates
|
dict
|
Partial spec dict to deep-merge in. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|