Documentation
Everything you need to get started with COSMIOS.
Quick Start
Prerequisites
COSMIOS does not install or manage agents. You must install and authenticate your agent (Claude Code, Codex, etc.) on the machine before using COSMIOS. COSMIOS observes, reports, and controls - but the agent runs natively on your machine with its own configuration.
Install COSMIOS
npm i -g cosmios
cosmios initThis will:
- Open the COSMIOS dashboard in your browser
- Approve your machine from the browser
- Save the config to
~/.cosmios/config.json - Start the runner automatically
Your machine is now online and ready to receive runs from the dashboard.
Alternatively, you can register manually with an API key:
cosmios registerRegister a Machine
There are two ways to register a machine:
Method 1: API Key (recommended)
cosmios registerGo to the dashboard > Machines > enter a name > click Register. Copy the API key and paste it in the CLI when prompted.
Method 2: Device Auth Flow
cosmios initOpens a browser window with a verification code. Approve the device in the browser and the machine registers automatically. No API key copy-paste needed.
Start the Runner
cosmios startThe runner connects to COSMIOS via WebSocket and polls for pending runs every 3 seconds. It runs in the foreground - use tmux, screen, or a systemd service to keep it running in the background.
To check the runner status from another terminal:
cosmios statusBackground with systemd
# /etc/systemd/system/cosmios.service
[Unit]
Description=COSMIOS Runner
After=network.target
[Service]
ExecStart=/usr/bin/env cosmios start
Restart=always
User=your-user
WorkingDirectory=/home/your-user
[Install]
WantedBy=multi-user.targetsudo systemctl enable --now cosmiosDispatch a Run
Runs can be dispatched from the dashboard or the CLI.
From the Dashboard
Open the terminal panel (bottom right) or the Tasks page. Select a machine, agent, workspace path, and enter your prompt. Click the send button to dispatch.
From the CLI
cosmios run --workspace ~/my-project --task "Fix the auth bug in login.ts"The CLI streams logs in real-time until the run completes.
Options
--agent codex- Use Codex instead of Claude Code (default)
Missions
Missions let you chain multiple tasks into a sequential pipeline. Each mission contains cards - individual instructions dispatched one after another to your agents.
Creating a Mission
Open the Missions page from the dashboard. Enter a title, select a workspace, and click Create. Then add cards with instructions and select which agent should execute each one.
How Cards Execute
Click Play to start the mission. Cards execute sequentially: card 1 runs first, and when it completes, card 2 starts automatically. Each subsequent card receives context from previous cards (a summary of what was accomplished).
- If a card completes, the next card starts automatically
- If a card fails, the mission pauses and you can resume later
- Click Pause to stop the current card mid-execution
- Click Resume to restart from where you left off
Action Items
When a card finishes, COSMIOS analyzes the run logs and extracts any tasks that require your manual action (e.g. configuring environment variables, enabling cloud APIs, setting up DNS). These appear as a checklist in the mission view and on the dashboard overview.
Live Terminal
While a card is running, the execution output streams in real-time below the card pipeline. The card statuses refresh automatically every 3 seconds.
Notifications
You receive an email when a mission completes (all cards done) or fails. No emails are sent for individual card completions to avoid noise.
Snapshot & Rollback
Before every run, COSMIOS automatically creates a git commit in the workspace:
git add -A && git commit -m "COSMIOS snapshot before run {run_id}"If anything goes wrong, click Rollback on the run detail page. COSMIOS will git reset --hard to the snapshot commit, restoring the exact state before the agent ran.
Rollback is available after every run (completed, failed, or cancelled).
CLI Reference
| Command | Description |
|---|---|
cosmios register | Register this machine with an API key |
cosmios init | Register via device auth flow (browser) |
cosmios start | Start the runner (foreground) |
cosmios status | Show runner status (online/offline) |
cosmios run | Dispatch a run and stream logs |
Supported Agents
Agents must be installed and logged in on the target machine. COSMIOS does not manage agent credentials, API keys, or model selection - the agent uses its own local configuration. COSMIOS wraps the agent process to capture events, logs, and metrics.
- Claude Code - Full support. Uses
--output-format stream-jsonfor structured logs. Supports--continuefor session resume. - Codex - Full support. Uses
--jsonfor JSONL event stream. Native session resume viacodex exec resume. - Aider - Coming soon.
- Gemini CLI - Coming soon.
API KeysPro+
Programmatic access to your COSMIOS data. Generate an API key from the dashboard (Developers page). The key is shown once at creation.
Authentication
Pass your key in the Authorization header:
curl -H "Authorization: Bearer csu_your_key_here" \
https://www.cosmios.dev/api/v1/machinesRate Limits
API keys are limited to 60 requests per minute. Rate limit headers are included in every response:
X-RateLimit-Limit- Max requests per windowX-RateLimit-Remaining- Requests leftX-RateLimit-Reset- Window reset timestamp
WebhooksPro+
Receive real-time HTTP notifications when events happen on your machines. Configure webhooks from the dashboard (Developers > Webhooks tab).
Event Types
| Event | Description |
|---|---|
run.completed | A run finished successfully |
run.failed | A run failed or was cancelled |
approval.requested | An agent needs permission approval |
machine.offline | A machine went offline |
machine.online | A machine came online |
event.critical | A critical event was logged |
Payload Format
{
"event": "run.completed",
"timestamp": "2026-03-07T12:00:00Z",
"data": {
"run_id": "abc123",
"workspace": "/home/user/project",
"agent": "claude-code",
"status": "completed"
}
}Signature Verification
Every webhook request includes an X-Cosmios-Signature header. Verify it with HMAC-SHA256 using your webhook signing secret:
const crypto = require('crypto');
const signature = crypto
.createHmac('sha256', webhookSecret)
.update(requestBody)
.digest('hex');
if (signature === req.headers['x-cosmios-signature']) {
// Valid request from COSMIOS
}REST APIPro+
All endpoints are under /api/v1/ and require Bearer authentication.
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/machines | List machines with status and metrics |
GET | /api/v1/runs | List runs with filters (status, machine) |
GET | /api/v1/events | List timeline events |
GET | /api/v1/sessions | List agent sessions |
POST | /api/v1/machines/:id/enable | Enable a machine |
POST | /api/v1/machines/:id/disable | Disable a machine |
POST | /api/v1/events/:id/approve | Approve a pending event |
POST | /api/v1/events/:id/reject | Reject a pending event |
FAQ
Does COSMIOS have access to my code?
No. COSMIOS never stores your source code on the server. Only metadata, logs, and event data are transmitted. Your code stays on your machine.
What happens if my machine goes offline?
The agent continues running locally. Events are journaled on disk and automatically synced when the connection is restored. No data is lost.
Do I need a VPS?
No. COSMIOS works on any machine - your laptop, a Mac Mini, or a headless VPS. Install with npm i -g cosmios, run cosmios init, and control your agents from any browser.
How do I change the model without SSH?
Configure the model locally on your machine with claude config set model (Claude Code) or via your agent's settings. COSMIOS observes and reports - the agent uses its own local configuration.
Is my data encrypted?
All communication between the runner and the server is over HTTPS. API keys are hashed (SHA-256) in the database. 2FA secrets are encrypted with AES-256-GCM.
Can I self-host COSMIOS?
Not yet. Self-hosting is planned for a future release.