Skip to content

opencode (agent-driven, recommended)

scripts/install.sh already registers the server — see Install if you need to do it manually. Confirm the tools appear with /mcp inside opencode, then drive the analysis through the primary agent cosmotron. There are three equivalent ways to reach it:

  • @cosmotron mention — inside a running opencode session, address it by name in natural language (the form used throughout this page).
  • Tab-switch — launch opencode bare and press Tab to switch the active agent to cosmotron, then type your request with no @mention.
  • Shell aliasopencode --agent=cosmotron (or opencode --agent cosmotron) launches straight into the agent, skipping both of the above. This is the cosmotron shell alias installed by scripts/install.sh — see Running from any directory below.

@cosmotron compute the angular power spectrum for the galaxy catalogue in /data/my_survey/ at nside=512.

A multi-probe (3×2pt) task declares each probe and the correlation selection in structured task sections — see Writing TASK.md for the full syntax:

@cosmotron run a 3×2pt analysis on /data/my_survey/ at nside=1024.

## probes: galaxy_density: bias=1.8 galaxy_shear: sigma_e=0.28, lmax=2000

## correlations: adjacent: 1

@cosmotron bootstraps a session, delegates to the sub-agents (one ingest per catalogue, analysis, systematics, review), and asks you only when a real decision is required. nside is global; per-probe lmax/bias/σ_e come from ## probes:; ## correlations: fixes which pairs are computed (here: autos + adjacent bins). See Agent roster for what each subagent does.

Running from any directory

By default the agents are discovered from this repo's .opencode/ (so you launch opencode from the repo). Run scripts/install.sh and accept the global prompt to symlink the agents + skills into ~/.config/opencode/, after which @cosmotron/Tab-switch/the alias are all available from any directory — see Install for how the alias is set up.

Useful opencode commands

A @cosmotron run is a long, multi-agent conversation tied to a workspace/{date}_{stem}/ session — these opencode built-ins are worth knowing on top of /mcp (above):

  • /sessions — list and resume prior opencode conversations. Useful since a pipeline run's opencode chat and its workspace/ session are two different things — the workspace dir persists on disk regardless, but resuming the conversation (to keep going after a NEEDS_INPUT pause, or to re-check a past run's reasoning) is what /sessions is for.
  • /export — export the current conversation log. Handy for archiving the human-gate/plan-approval trail of a run alongside its session_context.json/plan.json, or for sharing a run's reasoning without pasting the whole terminal scrollback.
  • /agent — same agent switcher the Tab key drives (see above); lists every agent opencode can see, including cosmotron and the subagents it delegates to.
  • /models — switch the active model for the current session; useful when checking whether a subagent misbehaviour is model-specific (see Model choice).

Full command reference: opencode docs.