Skip to content

Prompt Automation

Sia edited this page May 31, 2026 · 2 revisions

Prompt Automation — server-side autopilot

vibe-coder-server can drive a project's Claude console unattended: every time a turn finishes, the server sends the next prompt automatically. It runs in the server process, so it keeps going even after you close the browser.

Two modes:

  • Repeat — send the same prompt N times (e.g. "review the whole codebase and fix everything you find" × 20).
  • Sequence — send a list of prompts one per turn, optionally looping the whole list loops times.

How it works

The single source of truth for "a turn finished" is ClaudeSessionManager's Done event (the same signal that flips the console busy badge to idle). A turn-done listener feeds PromptAutomationManager, which pops the next prompt from an in-memory queue and calls sendPrompt. When the queue empties, the run completes.

  • A turn that ends via cancel / new session / process crash stops the automation (turn-interrupt listener).
  • Progress is broadcast on the console WebSocket as an automation_progress frame, so the console panel updates live.
  • Run history is persisted to prompt_automation_runs. On server restart, any running rows are reconciled to stopped (the in-memory queue is gone).

Safety limits

  • One active run per project.
  • Repeat count ≤ 200, sequence list ≤ 100 prompts, whole-list loops ≤ 50.
  • Total sends per run capped at 500.
  • Optional stop on error — abort if a turn ends with an error subtype.

Where to use it

Console panel

Open a project console. Below the input there is a collapsible 🤖 Prompt automation panel: pick repeat/sequence, paste your prompt(s), set the count, and press Start. The badge shows live progress (e.g. 3/20); press Stop any time. Hidden in conversation-only General Chat.

Settings page

/projects/{id}/automation/prompts (linked from the build Automation page) is the management surface:

  • Start ad-hoc or from a saved preset.
  • Create / delete presets (saved globally under <workspace>/.vibecoder/prompt-automations.json, reusable across projects).
  • View recent run history.

Presets

Presets store a reusable automation config (name, mode, prompts, repeat count, loops, stop-on-error). They are workspace-global — define once, start from any project. Managed via the settings page or the JSON API.

JSON API

Run control (per project, Bearer token or session cookie):

Method Path Purpose
POST /api/projects/{id}/claude/automation/start Start (preset or inline)
POST /api/projects/{id}/claude/automation/stop Stop the active run
GET /api/projects/{id}/claude/automation/status Current / last run snapshot

Preset CRUD (workspace-global):

Method Path Purpose
GET /api/prompt-automations List presets
POST /api/prompt-automations Create preset
PUT /api/prompt-automations/{presetId} Update preset
DELETE /api/prompt-automations/{presetId} Delete preset

Start request body

{
  "presetId": null,
  "mode": "repeat",
  "prompts": ["Review the whole codebase and fix every issue you find."],
  "repeatCount": 20,
  "loops": 1,
  "stopOnError": false
}

presetId takes precedence — when set, the inline fields are ignored and the named preset is used.

Start with curl

HOST=https://vibe.wody.work
TOKEN='<bearer token>'
curl -X POST "$HOST/api/projects/myapp/claude/automation/start" \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"mode":"repeat","prompts":["Audit and fix the whole app."],"repeatCount":20}'

Status response

{
  "active": true,
  "runId": "01J…",
  "name": "ad-hoc",
  "mode": "repeat",
  "status": "running",
  "sent": 3,
  "total": 20,
  "lastPrompt": null,
  "startedAt": "2026-05-31T…",
  "finishedAt": null,
  "lastError": null
}

WebSocket progress frame

Sent on the console topic (/ws/projects/{id}/console/logs) on start, on every turn advance, and on completion:

{
  "type": "automation_progress",
  "projectId": "myapp",
  "runId": "01J…",
  "status": "running",
  "mode": "repeat",
  "sent": 3,
  "total": 20,
  "active": true,
  "lastPrompt": null,
  "seq": 412
}

active=false means the run ended; status is then done, stopped, or failed. Older clients that don't know this frame type ignore it.

Notes & limitations

  • A run mid-flight when the server restarts is not resumed — it is reconciled to stopped. (Resume is a possible future enhancement.)
  • Cron-style scheduled starts ("run this automation every night") are not wired in yet — combine with the build scheduler is future work.
  • Costs add up fast: 20 repeats = 20 full Claude turns. Use Stop and the safety limits deliberately.

Clone this wiki locally