Task Server
The task server is a FastAPI application running at http://127.0.0.1:8052 (port configurable). It is the single source of truth for all task state.
The server is started automatically by bernstein run. You can also start it standalone with bernstein server start for scripting use cases.
Tasks
Create a new task.
curl -s -X POST http://127.0.0.1:8052/tasks \
-H "Content-Type: application/json" \
-d '{
"title": "Add pagination to users API",
"role": "backend",
"description": "Implement cursor-based pagination on GET /users.",
"priority": 1,
"scope": "small",
"complexity": "low"
}'
Body fields:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | ✓ | Short task name |
role | string | ✓ | Agent role: manager, backend, qa, security, frontend, devops |
description | string | Full task description injected into the agent prompt | |
priority | int | 1 = critical, 2 = normal, 3 = nice-to-have. Default: 2 | |
scope | string | small / medium / large. Affects model selection. | |
complexity | string | low / medium / high. Affects effort level. | |
depends_on | string[] | Task IDs that must complete before this task is claimable | |
completion_signals | object[] | Janitor checks these before marking done (see Completion Signals) | |
files | string[] | File paths this task owns (prevents parallel conflicts) | |
estimated_minutes | int | Time budget hint for the spawner |
List tasks. Optionally filter by status or role.
curl http://127.0.0.1:8052/tasks
curl "http://127.0.0.1:8052/tasks?status=open"
curl "http://127.0.0.1:8052/tasks?status=in_progress"
curl "http://127.0.0.1:8052/tasks?role=backend"
Query params: status (open | in_progress | done | failed | blocked), role
Get a single task by ID.
curl http://127.0.0.1:8052/tasks/abc123
Claim the next open task for a given role. Used by agent adapters to pick up work.
curl http://127.0.0.1:8052/tasks/next/backend
Returns 404 if no tasks are available for that role.
Claim a specific task by ID.
curl -X POST http://127.0.0.1:8052/tasks/abc123/claim \
-H "Content-Type: application/json" \
-d '{"agent_id": "agent-42"}'
Mark a task as done. The janitor will verify completion signals before finalising.
curl -X POST http://127.0.0.1:8052/tasks/abc123/complete \
-H "Content-Type: application/json" \
-d '{"result_summary": "Added cursor pagination to GET /users"}'
Mark a task as failed.
curl -X POST http://127.0.0.1:8052/tasks/abc123/fail \
-H "Content-Type: application/json" \
-d '{"reason": "Cannot resolve import — missing dependency"}'
Recent completed and failed task records.
curl http://127.0.0.1:8052/tasks/archive
Dashboard summary — task counts per status and agent summary.
curl http://127.0.0.1:8052/status
Example response:
{
"tasks": { "open": 4, "in_progress": 3, "done": 7, "failed": 0 },
"agents": { "active": 3, "idle": 0 },
"uptime_seconds": 312
}
Agents
Register agent liveness. Agents must heartbeat every heartbeat_timeout seconds or the spawner will kill and respawn them.
curl -X POST http://127.0.0.1:8052/agents/agent-42/heartbeat
Costs
Aggregated cost breakdown by model, role, and task.
curl http://127.0.0.1:8052/costs
Real-time cost data for the current run.
Active cost alerts (budget threshold warnings).
Historical cost records across previous runs.
Cost breakdown for a specific run.
Quality
Quality dashboard data: pass rates, verification results, and trends.
Per-model quality metrics (success rates, average scores).
Webhooks
Active system alerts (task failures, budget warnings, agent health).
GitHub webhook receiver. Processes push events, PR events, and CI status updates to create or update tasks automatically.
Auth
List configured authentication providers (OIDC, SAML).
Initiate OIDC login flow (redirects to provider).
Start CLI device code flow for headless authentication.
Current authenticated user profile.
Plans
List all plans (pending, approved, rejected).
Get a specific plan by ID.
Approve a pending plan. Approved plans are converted into tasks.
Reject a pending plan with an optional reason.
Graduation
Overview of agent graduation status across all sessions.
Graduation details for a specific agent session.
Promote an agent session to a higher trust level based on performance.
Slack
Slack slash command handler. Supports /bernstein status, /bernstein run, etc.
Slack Events API handler for real-time notifications.
ACP (Agent Communication Protocol)
ACP discovery document. Describes available agents, capabilities, and protocol version.
List agents available via the ACP protocol.
Create a new ACP run (submit work to an agent).
Check the status of an ACP run.
Bulletin Board
Post a message to the bulletin board. Agents use this to share findings or warnings with each other.
curl -X POST http://127.0.0.1:8052/bulletin \
-H "Content-Type: application/json" \
-d '{"message": "Found deprecated auth API — all agents should avoid /auth/v1"}'
Read bulletin messages, optionally since a timestamp.
curl "http://127.0.0.1:8052/bulletin?since=1711574400"
Health & Status
Server liveness check. Returns 200 {"status": "ok"} when healthy.
curl http://127.0.0.1:8052/health
Prometheus-format metrics for Grafana and alerting.
Server-Sent Events (SSE) stream for real-time dashboard updates.
Bandit-based model routing statistics (arm weights, selection counts).
Semantic cache hit/miss statistics.
CLI Commands
Core
| Command | Description |
|---|---|
bernstein init | Initialise a .sdd/ workspace in the current directory |
bernstein -g "<goal>" | Run with a plain-English goal |
bernstein --seed-file <path> | Run with a YAML seed file |
bernstein stop | Graceful shutdown |
bernstein stop --force | Hard stop (kill immediately) |
bernstein checkpoint | Save progress for later resume |
bernstein wrap-up | End session with summary and learnings |
Flags
| Flag | Description |
|---|---|
--headless | Suppress live dashboard, write to logs only |
--dry-run | Preview task plan without spawning agents |
--budget N | Cost cap in USD (0 = unlimited) |
--approval auto|review|pr | Approval gate before merge |
--fresh | Ignore saved session, start clean |
--cli claude|codex|gemini|qwen|auto | Force a specific agent adapter |
--model MODEL | Force a specific model |
--evolve / -e | Enable continuous self-improvement mode |
--max-cycles N | Stop after N evolve cycles |
--interval N | Seconds between evolve cycles (default: 300) |
Monitoring
| Command | Description |
|---|---|
bernstein live | Attach interactive TUI dashboard to running session |
bernstein dashboard | Open web dashboard in browser |
bernstein status | Show current task/agent status |
bernstein ps | Show running agent processes |
bernstein logs [AGENT_ID] | Tail agent log output |
bernstein cost | Show spend breakdown by model, role, task |
Task management
| Command | Description |
|---|---|
bernstein plan | Show task backlog |
bernstein add-task | Add a task to the backlog |
bernstein list-tasks | List all tasks |
bernstein cancel <ID> | Cancel a running or queued task |
bernstein review | Review completed tasks |
bernstein approve | Approve a task for merge |
bernstein reject | Reject a task |
bernstein pending | List tasks pending review |
Diagnostics
| Command | Description |
|---|---|
bernstein doctor | Pre-flight check: adapters, API keys, ports |
bernstein recap | Post-run summary: tasks, pass/fail, cost |
bernstein retro | Detailed retrospective report |
bernstein trace <ID> | Step-by-step agent decision trace |
bernstein replay <ID> | Re-run a task from its trace |
bernstein audit | Audit tasks and code quality |
bernstein verify | Verify task completion signals |
bernstein benchmark run | Run the golden benchmark suite |
Evolution subcommands
| Command | Description |
|---|---|
bernstein evolve review | List proposals awaiting human review |
bernstein evolve approve <id> | Approve a deferred proposal |
bernstein evolve run | Run one autoresearch cycle manually |
Agents and infrastructure
| Command | Description |
|---|---|
bernstein agents list | List available agents |
bernstein agents sync | Sync from remote catalogs |
bernstein agents discover | Auto-detect installed CLI agents |
bernstein workspace | Show multi-repo workspace status |
bernstein config | View and edit configuration |
bernstein mcp | Start MCP server for tool integration |
bernstein plugins | List discovered plugins |
bernstein demo | Zero-to-running demo |
bernstein chaos | Chaos testing commands |
Config Schema
.sdd/config.yaml — created by bernstein init, edit to customise:
# Task server
server_port: 8052
# Agent concurrency
max_workers: 6
# Default model and effort for workers (overridden per task by the router)
default_model: sonnet # sonnet | opus
default_effort: high # normal | high | max
# CLI adapter
adapter: auto # auto | claude | codex | gemini | qwen (auto detects installed agents)
# Heartbeat: kill agent if silent for this many seconds
heartbeat_timeout: 120
# Cost budget for a single run ($0 = unlimited)
budget: 0
Task Schema
Full task metadata structure (YAML or JSON):
id: "TSK-042" # auto-assigned, or set manually
title: "Implement BM25 index" # required
role: "backend" # required: manager | backend | qa | security | frontend | devops
# Routing (optional — defaults applied if omitted)
priority: 1 # 1=critical, 2=normal, 3=nice-to-have
scope: "medium" # small | medium | large
complexity: "high" # low | medium | high
estimated_minutes: 30
# Dependencies
depends_on: ["TSK-040"] # task IDs that must complete first
# Verification
completion_signals:
- type: path_exists
path: "src/retrieval/bm25.py"
- type: test_passes
command: "pytest tests/test_bm25.py"
# Ownership (prevents parallel file conflicts)
files:
- "src/retrieval/bm25.py"
- "tests/test_bm25.py"
# Full prompt injected into the agent session
description: |
Implement a BM25 sparse index alongside the dense vector index in
src/retrieval/. Expose it via the same Retriever interface.
Completion Signals
The janitor checks these before marking a task done. Define them in the task's completion_signals field.
| Type | Fields | Description |
|---|---|---|
path_exists |
path |
File or directory must exist at the given path |
test_passes |
command |
Shell command must exit with code 0 |
file_contains |
path, text |
File at path must contain text as a substring |
api_responds |
url, status |
HTTP GET to url must return the expected status code |
Example:
completion_signals:
- type: path_exists
path: "src/auth/jwt.py"
- type: test_passes
command: "pytest tests/test_auth.py -x -q"
- type: file_contains
path: "src/auth/jwt.py"
text: "def verify_token"