# vigil
**Browser QA that reproduces the reported bug, then waits for you to approve the check.**
Work arrives from a commit, a Jira issue, a log signature, or any command that
prints events. An agent reproduces the symptom in a real browser and writes a
scenario for it. You approve that scenario, and vigil runs it every day.
[](go.mod)
[](LICENSE)
[](#architecture)
---
## Business admin console
`vigil admin` opens a Korean console for project and QA teams. Add projects and
multiple sites and edit URLs in the UI. Describe a bug reproduction scenario, a
feature, or pasted commit evidence: the orchestrator delegates browser investigation
and E2E script creation, then independently runs the generated scripts. It never
modifies the target service code. IDs and URL host permissions are filled automatically.
Advanced scripts remain available through YAML import.
```sh
go build -o vigil ./cmd/vigil
./vigil -c vigil.yaml admin --addr 127.0.0.1:8787
```
Running a check opens its progress panel and a visible Chromium window. The
finished screenshot appears in place and opens in an enlargement dialog; step,
network and console details remain available separately. Each project has its
own scripts and history, and results distinguish each site's latest run.
This local-only command runs explicit checks. It does not start recurring
schedules or Jira notifications. Requested generation uses the configured agent
and browser extension; unavailable providers produce an explicit incomplete result. Existing `loop --ui` and
`proof` workflows remain available. See [admin setup and scope](docs/admin-console.md).
### Request with a screenshot or a recording
A request does not have to be prose. Attach screenshots (PNG, JPEG, GIF, WebP)
or a screen recording (MP4, MOV, WebM) and the agent reads them: it recovers the
screen, the controls and the values from the evidence, picks the single most
likely scenario the reporter wants checked, confirms that reading in the browser,
and writes the reason it chose that reading into the result. A recording is split
into evenly spaced frames with `ffmpeg` (install it, or attach stills instead);
the container itself is never sent to the model. Up to 8 files, 128 MB in total,
are stored under `evidence/requests//` and age out with failure
evidence (`evidence.retain_fail_days`). Text and attachments can be combined;
when they disagree, the agent follows what the evidence shows and says so.
### Bring your own LLM, or your own coding agent
The **LLM 설정** screen (`/settings`, stored 0600 next to the project registry)
decides who answers:
| Choice | What runs | Credential |
|---|---|---|
| 관리자 기본 설정 | `vigil.yaml`'s `agent.models` chain | the server's environment |
| 내 API 키 | vigil's own pi agent with your provider | Anthropic, GLM Coding Plan (Z.ai), OpenAI, or any OpenAI-compatible endpoint (base URL + model) |
| 내 코딩 에이전트 | the CLI you are already signed in to: Claude Code, Codex or pi | that CLI's own subscription; vigil stores no key |
A personal OpenAI-compatible endpoint is registered through a generated pi
extension, so `~/.pi/agent/models.json` is never edited. A saved key is used as
an environment variable, is masked in every response, and is checked against the
provider's model catalog before it is stored.
In 내 코딩 에이전트 mode the CLI keeps the same contract: the same system prompt,
the same result block, and the same bounded browser tool, served to it over MCP
by `vigil mcp-browser`. Neither CLI can modify the target service, but their
confinement differs, and the difference is worth knowing:
- **Claude Code** runs with `--restricted --strict-mcp-config` and an allowlist
of two tools (the browser and `Read`). It has no shell, and it sees no MCP
server other than vigil's.
- **Codex** runs `codex exec --ignore-user-config -s read-only` with
`approval_policy="never"`, and vigil's browser tool pre-approved. Its own
read-only shell stays available, so it can read local files (including your
`~/.agents` skills) while it works. Writes and approvals are refused.
## One-time checks with ProofQA
`vigil proof` adds a Korean web flow: describe one change, review its criteria,
approve one run, and read the result and evidence on the same page. It uses the
existing Chromium runner with registered DOM/API observations and optional
read-only MySQL probes. Missing evidence remains unverified. One signed-in
operator can complete the planning, QA, and development review in the same
business console; the recorded human disposition never changes the technical
verdict.
See the [ProofQA setup and independent A/B/C demo](docs/proofqa.md) and
[implementation verification record](docs/proofqa-verification.md). This mode
does not start the scheduler, collectors, supervisor, or Jira writes. The
continuous workflow below remains available through the existing commands.
## What vigil does
| Stage | What happens |
|---|---|
| Take the report | `discovery.adapters` polls git, Jira through `acli`, Loki log signatures, and any `exec` command that prints events. Issue and log features are `READY` the moment they arrive |
| Reproduce it | The Browser Agent drives a real browser to the reported symptom and writes one scenario that encodes the expected behaviour |
| Repair its own steps | A scenario that fails validation on a brittle step goes back to the agent, up to `policy.agent_fix_attempts` times |
| Wait for a person | The script sits in `PENDING_APPROVAL` (`승인 대기`) with a reproduction verdict: `confirmed`, `disputed` or `unconfirmed`. It is never due until someone approves it |
| Run it daily | `vigil approve` sets `cadence: daily` at `schedule.daily_at` and posts a Korean receipt on the source Jira issue |
| Check the fix | `run --env ` runs a scenario against another named environment. An environment marked `read_only` refuses every scenario that changes data |
| Say what broke | Every failure is reported as one plain Korean sentence naming its cause. The selector, the raw error and the evidence are one layer deeper |
## Coverage grows itself
Give it one URL. A supervisor loop reads the QA state on a slow tick, asks a
model where scenarios are missing, and turns the answer into browser
explorations. The route map fills itself in from wherever browsers actually go.
The model proposes and code decides. Deterministic Go re-validates every action
the model suggests before it becomes a job. There is no verb for deleting
coverage, and asking for one is refused by name and logged. A model outage never
stops deterministic QA.
Every run leaves evidence: console, network, DOM and screenshots. A failure
becomes a reproducible incident report with the run that produced it.
Ship features wait for the deploy. A scenario re-runs once the shipped commit is
actually served (asset-version gate), so "did the deploy break it?" has an answer
minutes later.
## Safety rails
The supervisor is the weakest actor in the system, on purpose:
| Rail | Effect |
|---|---|
| Verb allowlist | 6 verbs only; `delete`/`retire`/`purge` refused **by name** and logged |
| Host allowlist | An off-target URL is rejected outright, at harvest and at validation |
| Deny path patterns | `logout`, `delete`, `purge`… are never explored. A wandering browser must not end its session or press something irreversible |
| Mutation policy | `read-only` → `reversible` → `destructive` (off unless `policy.allow_destructive`) |
| Human approval | A script from a queue feature reaches a schedule only after `vigil approve`. Until then it is never due |
| Read-only environments | An environment with `read_only: true` refuses every scenario whose `mutation` is not `read-only` |
| Budgets | Hourly task budgets per actor; the planner cannot starve discover/repair |
| Active hours | A weekly window (weekdays 08:00 to 19:00, say) gates all cadence work, editable live from the dashboard |
| Quarantine guard | The one coverage-reducing verb is capped per plan and refused if it would blind an area completely |
| Oracle policy | Observed behaviour either waits for a human (`needs_review`) or must survive validation and clean SOAK runs (`soak`) before it gates anything |
## Quickstart
```bash
git clone https://github.com/cskwork/vigil
cd vigil && go build ./cmd/vigil
./vigil doctor --install # fetches the Lightpanda browser
cp vigil.example.yaml vigil.yaml # point target.base_url at your app
./vigil loop --ui 127.0.0.1:8787 # scheduler + live dashboard
```
The dashboard at `:8787` has five pages: `/` (할 일) is an action queue of the
things that need a person, `/results` (검증 결과) is today's verification matrix
grouped by outcome plus the deploy history, `/scripts` (검사 스크립트) lists the
scripts with inline run/approve/reject actions, `/activity` (시스템 활동) shows
running jobs, the coverage-growth panel and the schedule window, and `/help`
(도움말) explains every state and outcome word with the equivalent CLI command.
The action queue also has one text box for an operator to describe a QA
situation. Vigil forces these submissions to `read-only` and gives them priority
110, above repair and recent-failure work at priority 100.
If the same `loop --ui` process is running another Browser Agent job, it cancels
that job cooperatively, returns it to `READY` without charging an attempt or
Agent budget, and runs the operator request next. Deterministic scenario workers
continue uninterrupted. The operator request may bypass the hourly Agent budget
once. Any scenario it proposes still passes the existing candidate validation,
deduplication, oracle, and SOAK gates.
Dashboard controls are unauthenticated. Bind `loop --ui` and `serve` only to a
trusted address such as `127.0.0.1`. Standalone `serve` shows the QA box but
keeps submission disabled; use `loop --ui` with an available Browser Agent to
submit a request. Writes are additionally refused from any other origin.
Browsers the loop launches are shut down after `browser.idle_stop` (default
10m) without a run and relaunched on demand, so a resident Chromium and
Lightpanda do not hold several hundred MB overnight. The Browser Agent's own
Chrome closes with its session at the end of each agent job.
The dashboard polls with content ETags: an unchanged payload costs a 304 and
the page skips its re-render, so open panels and selections survive polling.
The landing page needs one poll (`GET /api/todo`). It follows the system
light/dark scheme (switchable in the rail), the verification list groups and
filters by outcome (`/results?outcome=APP_FAILURE`), the script list filters by
state (`/scripts?state=PENDING_APPROVAL`), long lists page with `더 보기`, and
every control is keyboard reachable behind a skip link. `serve --dev-ui internal/ui` serves the pages from disk so they can
be edited without a rebuild (see ADR-0002).
## Status
The full local product is implemented and exercised end to end against a real
deployment: git feature ingest, deployment gate, deterministic
Lightpanda/Chromium runner, failure classification, candidate lifecycle,
Browser Agent (pi + nono sandbox), the autonomous coverage supervisor,
scheduler with budgets/locks/active-hours, evidence/incidents, CLI and the live
web board. Accepted by the config but ignored at runtime: `workers.chromium`,
`budget.chromium_minutes_per_hour` enforcement (minutes are recorded),
`runtime.mode: distributed`, `state.type: postgres`, `evidence.type: s3`.
## Architecture
```text
Git ship/change
│
▼
deployment-ready?
│
▼
┌─────────────────────────┐
│ Orchestrator │
│ │
│ existing coverage? │
│ script confidence? │
│ changed/impacted area? │
│ recent failure? │
└──────┬───────────┬──────┘
│ │
uncertain proven
│ │
▼ ▼
Browser Agent QA Script
subagent Runner
│ │
└─────┬─────┘
▼
Lightpanda
│
▼
deployed website
│
PASS / classified FAIL
│
browser ambiguity
▼
Chromium
```
| Package | Responsibility |
|---|---|
| `cmd/vigil` | CLI: global flags, command dispatch, `doctor` checks |
| `internal/ingest` | Turns `generic-git`, `file`, `sdlc-kit`, `jira`, `loki` and `exec` signals into normalized `FeatureEvent`s (multi-adapter poll) |
| `internal/gate` | Deployment readiness gate (`delay`, `asset_version`, `version_endpoint`) |
| `internal/orchestrator` | Decision table, impact selection, post-run lifecycle (soak/promote, quarantine, repair, Chromium confirm, incidents), agent job handling, coverage supervisor (plan → validate → apply, stale-review reconcile) |
| `internal/scheduler` | Continuous loop: scan/gate/orchestrate, due selection, budgets, locks, workers, cheap retry, PASS marker |
| `internal/runner` | Executes DSL steps over CDP; captures console, network, DOM, screenshot |
| `internal/browser` | Lightpanda (`serve` attach-or-launch) and Chromium providers |
| `internal/classify` | Maps runner results to PRD §13 outcomes |
| `internal/dsl` | Scenario/flow schema, validator, logical fingerprint |
| `internal/evidence` | Run directories, PASS marker, portable incidents, retention prune |
| `internal/store` | SQLite (WAL) state: features, scenarios, versions, jobs, runs, incidents, locks, budget |
| `internal/agent` | pi Browser Agent adapter, model fallback chain, task contract, secret redaction, nono sandbox |
| `internal/approval` | `PENDING_APPROVAL` → ACTIVE/SOAK transitions, receipts, approval comment body |
| `internal/jira` | Approval comments through `acli`, with read-back verification and a dry-run file |
| `internal/export` | Playwright spec generation from the canonical DSL |
| `internal/config` | `vigil.yaml` + `url.md` loading, defaults, `${ENV}` substitution |
| `internal/model` | States, outcomes, actions, job kinds, priorities, entities |
## Quickstart on this repo
Assumes `bin/lightpanda` is present (it is gitignored). All commands run from the repo root.
```bash
cd
go build ./cmd/vigil
./vigil doctor # sqlite, browsers, pi, keys, sandbox, target, evidence dir
./vigil validate # every scenario/flow file on disk
./vigil add # register project, import scenarios/ + flows/ into the store
./vigil scan # ingest features once, gate, orchestrate
./vigil run home-landing # one scenario now
./vigil findings # data-analyst findings the agent reported
./vigil export --all # Playwright specs under export/playwright/
./vigil loop # continuous scheduler + workers until SIGINT
```
Global flags may appear anywhere: `-c ` / `--config=` (default `vigil.yaml`) and `--json` (honoured by `status`, `coverage`, `incidents`, `list`, `show`, `doctor`).
## Portable setup on a new machine
```bash
git clone vigil && cd vigil
go build ./cmd/vigil
./vigil doctor --install # downloads the Lightpanda nightly for this OS/arch into bin/lightpanda when missing
# (this build prints the release URL; download manually and chmod +x)
```
Then:
1. Edit `url.md`. The first URL is the primary target: its origin becomes `target.base_url`, its host is allowlisted, and its path becomes the default entry route.
2. Edit `vigil.yaml`: `project.repo` (git checkout of the deployed app) and the `discovery` section (branch, `path_prefixes`, `route_map`).
3. Export the API key named on the right-hand side of `agent.env_map` (here `Z_AI_API_KEY`); pi receives it under the left-hand name (`ZAI_API_KEY`).
4. Chromium: leave `browser.chromium.binary` empty when you do not need it, or point it at a Playwright-cache or system Chrome binary.
5. pi extension: leave `agent.extension` empty; vigil loads its own dependency-free `piext/vigil-browser.js` (it exposes `agent_browser` by spawning the `agent-browser` CLI, and it is what runs inside the nono sandbox). Only if that file is missing does it fall back to `pi-agent-browser-native` under `$HOME/.pi/agent/npm/node_modules` / `npm root -g`.
6. `./vigil add`, then `./vigil loop`.
`url.md`, `vigil.yaml`, `scenarios/`, `flows/` and `features/requests/` are domain-specific and git-ignored: copy `url.example.md` to `url.md`, `vigil.example.yaml` to `vigil.yaml`, and start from `examples/`. The binary and the DSL are generic. `vigil.yaml` must not contain user-absolute paths: use `${HOME}` or leave `browser.chromium.binary` / `agent.extension` empty. `.vigil/`, `evidence/`, `bin/` and the built binary are gitignored.
## CLI reference
| Command | Semantics |
|---|---|
| `init` | Write a starter `vigil.yaml` and `url.md` next to it (only if missing); create `scenarios/`, `flows/`, `features/` |
| `add [project]` | Upsert the project (must equal `project.id`) and import `scenarios/` + `flows/` from disk (seeds enter SOAK) |
| `import --history [--limit N]` | Ingest the last `discovery.history_limit` (or N) historical features; no gate, no plan |
| `scan` | Import files, poll every `discovery.adapters` source once, gate unhandled features, orchestrate READY ones, print the feature table (with KIND / REF) |
| `discover ` | Enqueue an `AGENT_DISCOVER` job for a known feature and run it inline (requires the Browser Agent) |
| `reproduce [--dry-run] [--no-repair] [--fresh]` | Same, for a known issue/log feature: when the feature already has a `CANDIDATE` script with a queued repair, resume that repair instead of starting over (`--fresh` forces a new reproduce job); enqueue `AGENT_REPRODUCE` at operator priority (budget bypass) and run it inline, then run the follow-up `AGENT_REPAIR` jobs inline until the script leaves `CANDIDATE` (`PENDING_APPROVAL` / `NEEDS_REVIEW`) or `policy.agent_fix_attempts` is spent; `--no-repair` stops after the reproduce job; `--dry-run` writes the request and prompt without calling the model. Ship features are refused (use `discover`) |
| `run [--browser lightpanda\|chromium] [--env ]` | Run one scenario inline; a feature id runs every ACTIVE/SOAK scenario linked to it. `--env` picks a `target.environments` entry (default: `target.default_env`) |
| `run --feature ` | Run every ACTIVE/SOAK scenario with a `feature` coverage link to `f` |
| `run --impacted ` | Run scenarios impacted by `f` (feature, then capability via `route_map`, route, path links) |
| `run --all` | Run every ACTIVE/SOAK scenario |
| `loop` | Continuous scheduler + `workers.functional` run workers + one agent worker; logs to stdout and `/vigil.log` |
| `status` | Scenario/job counts, last-hour budget, features, queue, next due, recent runs, open incidents |
| `coverage` | Per-scenario coverage links, metrics and corpus health (duplicate fingerprints, quarantined, never run, needs review, flakiest) |
| `incidents [--all] [--limit N]` | Open (or all) incidents with Markdown paths |
| `findings [--all] [--limit N]` | Open (or all) data-analyst findings reported by the agent (`--limit` default 50) |
| `findings resolve ` | Mark one finding RESOLVED |
| `approve [--soak] ` | `PENDING_APPROVAL` to ACTIVE with `cadence: daily` (next due at `schedule.daily_at`, Jira comment on the source issue); every other approvable state, or `--soak`, sends it to SOAK with counters reset, due now |
| `reject ` | Any state to REJECTED; resolves its open APP_REGRESSION incidents |
| `list [--state A,B]` | List scenarios, optionally filtered by comma-separated states |
| `show ` | Current script YAML, coverage links, metrics, last 10 runs |
| `export \|--all [--format playwright] [--env ] [-o ]` | Write `/.spec.ts` (default `export/playwright`); `--all` exports every ACTIVE / SOAK / PENDING_APPROVAL / NEEDS_REVIEW script |
| `validate` | Parse and validate every scenario/flow file; flags duplicate ids and duplicate fingerprints; exit 1 on problems |
| `serve [--addr 127.0.0.1:8787]` | Standalone live web view for non-developers. QA submission stays disabled because no in-process scheduler owns the request; existing schedule controls remain available |
| `loop --ui ` | `loop` plus the live view and one-box, read-only QA submission. An available Browser Agent is required |
| `request [--queue] [--dry-run]` | Hand a manual QA request to the orchestrator: `feature_id`, `summary`, `entry_url`, `accounts` (named test accounts, no secrets), `instructions` (the flow in plain language), `mutation` (read-only / reversible / destructive), `locks`, `max_tool_calls`, `timeout_minutes`. The Browser Agent performs the flow with one isolated browser session per role (`"session":"teacher"`) and proposes scripts; `--queue` leaves it for a running loop |
| `mcp-browser [--session ] [--timeout 45s] [--max-output 24000]` | Serve the bounded `agent_browser` tool over MCP stdio. Used by the CLI adapters, and usable directly from any MCP client (`{"command":"vigil","args":["mcp-browser"]}`): the same argv contract and the same refusal of `install`/`eval`/`connect`/`--profile` as the bundled pi extension |
| `doctor [--install]` | Check config/targets, sqlite, evidence dir, repo/branch, Lightpanda binary + serve, Chromium, pi, API keys, extension, nono, agent, target HTTP, one asset marker line per environment (`asset marker `) |
`run` exits 1 when any scenario did not PASS and 2 on a usage error, an unknown `--env`, or a mutating scenario sent to a read-only environment. `doctor` exits 1 only on hard failures (sqlite, evidence dir, repo, target).
## Sources: Jira, logs, commands
A ship (git commit, sdlc-kit item, feature file) is not the only reason to test
something. `discovery.adapters` polls several sources together; each honours its
own `poll_interval` while the scheduler keeps calling on `discovery.poll_interval`.
An adapter that errors is logged and skipped, never fatal.
| Adapter | Reads | Feature id | Kind |
|---|---|---|---|
| `generic-git`, `sdlc-kit`, `file` | shipped changes (as before) | `PROJ-123` / `commit-` / file id | `ship` |
| `jira` | `acli jira workitem search --jql ... --json --limit N --fields key,summary,description,status,labels,issuetype`; ADF descriptions are flattened to text | `` upper-cased | `issue` |
| `loki` | Grafana `POST /api/ds/query` (basic auth from `email_env`/`password_env`, read at call time), one event per error signature reaching `min_count` lines in `window` | `log-<8 hex of sha1(signature)>` | `log` |
| `exec` | stdout of `discovery.exec.command`: a JSON array of `{key, summary, details, at, routes, kind}` (see `examples/exec-events.example.json`) | `exec-` sanitised | `issue` \| `log` (default `log`) |
Every feature carries `kind` (`ship` \| `issue` \| `log`), `ref` (issue key, log
signature hash, exec key) and `details` (bounded to 8 KB: the description, the
sample log lines, or the exec `details`). `scan` and `status` print KIND and REF
next to the feature id.
The Loki signature is the first match of `discovery.loki.signature` in the line,
or, when a promtail line is itself JSON with a `message` key, in that message.
vigil normalises it so one incident is one signature: URLs become ``, UUIDs ``,
hex ids ``, numbers `#`, whitespace collapses, and the result is bounded to
160 characters. Signatures are ranked by line count and the top
`max_events_per_poll` become features.
Nothing here waits for a deployment: **issue and log features are `READY` the
moment they are ingested**, `ReadyAt = now`. Each one is ingested once per
content hash / hour bucket, so an unchanged issue or a still-firing log
signature does not re-enter the queue every poll.
## Reproduce and approve
For a non-ship feature the orchestrator decides `REPRODUCE` and enqueues
`AGENT_REPRODUCE` (priority 90). The agent is asked to reproduce the reported
symptom on the deployed app and to write **one** scenario that encodes the
expected behaviour from the report (`oracle.source: spec`,
`oracle.source_feature: `), then to refine until the flow either reaches the
symptom or proves the expectation holds. Its result carries
`reproduction: {symptom, reproduced, at_step, note}`.
`vigil reproduce [--dry-run]` does the same for one known issue/log
feature right now, inline, the way `discover` does for ship features.
The candidate is then validated by the deterministic runner, and the verdict
decides the state:
| Validation outcome | Result |
|---|---|
| `PASS` or `APP_FAILURE` | `PENDING_APPROVAL`, with `{verdict, reproduced, at_step, claimed_step, symptom, why, run_id}` stored on the script |
| `SCRIPT_DRIFT` and other script problems | the existing repair loop (`policy.agent_fix_attempts`), exhausted → `NEEDS_REVIEW` |
An `APP_FAILURE` alone is not a reproduction: a script that asserts an exact
number (`expected 40, got 37`) fails on a healthy page too. The run is
corroborated with the agent's own block into a three-way verdict, and all three
wait for a human:
| Verdict | Badge | When |
|---|---|---|
| `confirmed` | `재현됨` | `APP_FAILURE`, the agent claims `reproduced: true`, and its `at_step` is within ±1 of the failed step **or** it filed a finding on the same route |
| `disputed` | `판정 불일치` | `APP_FAILURE` but the agent disagrees (claims `reproduced: false`, or another step with no corroborating finding); `why` names the disagreement |
| `unconfirmed` | `재현 안 됨` | `PASS` (the expected behaviour held), or no agent block to corroborate the failure |
Because of that, the agent is told to assert bounds as booleans: `eval: {
script: "…value.length <= 40", expect: true }`, `assert_count` with `max:`/`min:`
over `equals:`, `assert_data` with `compare: number` against an API value. It
asserts an exact value only when the specification fixes it.
`PENDING_APPROVAL` (Korean label `승인 대기`) is never due. Running such a script
by hand, from the CLI or the dashboard, records the run and its metrics and changes nothing
else: no state transition, no incident, no repair job. That is on purpose: a
reviewer can re-run a pending script as often as they like.
```bash
vigil list --state PENDING_APPROVAL
vigil run entry-tabs-duplicated # judge it, as often as you like
vigil approve entry-tabs-duplicated # → ACTIVE, cadence daily, Jira comment
vigil reject entry-tabs-duplicated # → REJECTED
```
`approve` sets `cadence: daily` and the next due to the next `schedule.daily_at`
slot (in `schedule.active_hours.tz`, else machine local), resets the soak and
failure counters, and stamps `approved_at`. `approve --soak` forces the ordinary
SOAK path instead. Post-deploy impacted runs still pick up ACTIVE daily scripts.
When the script came from a Jira issue (`source_kind: issue` and a `source_ref`
matching `discovery.issue_key_pattern`) and `jira.comment_on_approve` is true,
approval posts a Korean receipt (≤ 12 lines: how to re-run it, the last outcome
with environment and time, the reproduction verdict, the findings count and the
top 3, the daily slot, the evidence path) with `jira.cli` and then **reads the
comments back**, because acli writes have been seen to report success without
effect. `jira.dry_run: true` writes the same body to
`evidence/jira/-.md` instead. A failed comment never undoes the
approval; it is logged and shown in the receipt.
In the dashboard, `PENDING_APPROVAL` and `NEEDS_REVIEW` cards carry
`▶ 실행 / ✔ 승인 / ✖ 반려` with an environment select (default env plus the others)
and a browser select (lightpanda / chromium), plus the reproduction badge
(`재현됨` / `판정 불일치` / `재현 안 됨`, with `why` as its sub-line). They call `POST /api/script/{run,approve,reject}`, JSON
in and out, same-origin only. `loop --ui` provides all three; standalone `serve`
approves and rejects through the store but answers 409 for run, because it has no
scheduler.
## Environments
```yaml
target:
default_env: stg
environments:
stg:
base_url: https://stg.example.com
allowed_hosts: [stg.example.com]
asset_page: https://stg.example.com/app # optional
read_only: false
prod:
base_url: https://www.example.com
allowed_hosts: [example.com]
read_only: true
```
With no `environments` block, one implicit environment named `default` is
synthesised from `target.base_url` / `allowed_hosts`: existing configs behave
exactly as before.
- `run --env prod` takes the base URL and the host
allowlist from that environment. `goto: /path` resolves against its base URL;
an absolute `goto` outside its allowlist fails that run with `ENV_FAILURE`
("url outside environment allowlist").
- `read_only: true` refuses every scenario whose `mutation` is not `read-only`:
CLI exit 2, dashboard HTTP 400, job → FAILED with the reason.
- Runs record their environment (`runs.environment`, `result.json`, incident
markdown/json); the verification table shows an environment badge and the run
detail names it.
- Agent work (discover / verify / repair / reproduce) and all cadence, soak and
impacted scheduling stay on the default environment. Multi-environment
scheduling is out of scope: nothing runs a scenario on two environments by
itself.
- Deploy markers are per environment: a run is tagged with the marker of the
environment it ran against (`.asset_page`, else that environment's
`base_url` + entry path, else `deployment.readiness.asset_page` for the
default environment), and the per-deploy Chromium evidence capture dedups per
(scenario, environment, marker). `doctor` prints one marker line per
environment.
## Model chain
```yaml
agent:
models: # ordered; entry = provider/model[:thinking]
- openai-codex/gpt-5.6-luna:low
- anthropic/claude-haiku-4-5:low
- zai/glm-5.3-flash:high
- google/gemini-2.5-flash:low
model_cooldown: 10m
```
Each attempt uses the current chain entry. When one answers with a provider
error (429, quota, auth, 5xx, "rate limit") **and another entry is available**,
that entry is put on cooldown for `model_cooldown`, the next one starts
immediately with a fresh retry budget and no backoff, and the loop logs
`agent: unavailable (); switching to `. With no
alternative the legacy behaviour is unchanged: a transient error retries the
same model `agent.retries` times with `agent.backoff`; an auth/quota error is
not retried. When every entry is cooling down the task ends model-unavailable
and deterministic QA continues (rule 12). An entry without `:thinking` inherits
`agent.thinking`; `agent.models` empty means the single legacy `agent.model`.
`agent-result.json` records `model` (the entry that produced the result) and
`model_attempts` (`{model, outcome}` per spawn; outcome `ok`, `unavailable`,
`error`, `timeout`, `budget` or `no_result`). `vigil doctor` prints one line per
chain entry from `pi auth check --provider
--json --no-refresh` and only
only warns when an entry is not ready, because the chain skips it. Cooldowns live in
memory, per process.
## Data checks and findings
A QA script can compare what the screen shows with the payload that produced it:
```yaml
- assert_data:
ui: { by: css, value: ".total-count" }
ui_regex: '\d+' # optional; first match (group 1 when present)
api: { url_contains: /api/students, json_path: $.data.totalCount, method: GET }
compare: number # text | number | contains
```
The step reads `innerText` of `ui`, takes the last captured response whose URL
contains `api.url_contains` (and method, when given), resolves `json_path`
(`$`, `.key`, `["key with spaces"]`, `[N]`, `[*]` = first element; no external
dependency) and compares: `text` trimmed, `number` numerically, `contains` = the
UI text contains the API value. A mismatch is a business assertion, so it
classifies as `APP_FAILURE` with both values and their sources in
expected/actual. `assert_data` counts as a major action in the fingerprint.
The Browser Agent has matching data-analyst duties: displayed values vs. the
API payloads behind them, totals vs. row sums, counts vs. list lengths,
dates/units/locale, empty vs. zero, stale data after an action. It reports each
one as a **finding**: `{kind: data_mismatch | domain_rule | display | accessibility,
where, expected, actual, evidence}`. Findings are persisted (`findings` table,
`OPEN` / `RESOLVED`), listed by `vigil findings [--all] [--limit N]`, closed with
`vigil findings resolve `, shown as a panel on the dashboard script detail
with a count on the verification page, and summarised in the approval comment.
`agent.domain_file` (a markdown file, relative to the config, bounded to 12 KB
and truncated with a marker) is injected into every task prompt as "Domain
rules"; the agent must obey them and cite the rule id in a finding.
`examples/domain.example.md` is a starting point. Give every rule an id.
## Playwright export
```bash
vigil export entry-tabs-duplicated # → export/playwright/entry-tabs-duplicated.spec.ts
vigil export --all --env prod -o /tmp/pw
```
The YAML DSL stays canonical; the spec is derived output and says so in its
header, together with the scenario id, the version currently in the store, the
environment and its base URL. `BASE_URL` in the shell overrides the exported base
URL at run time. `--all` exports every ACTIVE / SOAK / PENDING_APPROVAL /
NEEDS_REVIEW script.
| DSL | Playwright |
|---|---|
| `goto` | `page.goto(BASE_URL + '/path')` |
| `click`, `hover`, `fill`, `type`, `press`, `select` | locator API (`.click()`, `.fill()`, `.selectOption()`, …) |
| `wait_for` / `assert_visible` / `assert_not_visible` | `expect(loc).toBeVisible()` / `.not.toBeVisible()` |
| `wait_ms` | `page.waitForTimeout(n)` |
| `wait_url`, `assert_url` | `expect(page).toHaveURL(RegExp)` |
| `assert_text`, `assert_no_text` | `toContainText` / `not.toContainText` on the scope (body by default) |
| `assert_count` | `toHaveCount`, or `count()` bounds for `min`/`max` |
| `assert_request` | `page.waitForResponse(predicate)` |
| `assert_attr` | `toHaveAttribute` |
| `assert_data` | `waitForResponse` + JSON path + `expect` |
| `expect_popup` | `context.waitForEvent('page')` |
| `eval`, `screenshot` | `page.evaluate`, `page.screenshot` |
| `uses` / `use_flow` | inlined, with the flow named in a step comment |
| Locators | `test_id`→`getByTestId`, `role`→`getByRole(role,{name,exact})`, `label`→`getByLabel`/`getByPlaceholder`, `id`→`#id`, `text`→`getByText`, `href`→`locator('a[href*=..]')`, `css`→`locator`; `nth` → `.nth(n)` |
| Scenario `assert` flags | listeners collected during the test (console errors, 5xx, 4xx on named URLs) and checked at the end |
Anything the exporter cannot map exactly becomes a `// TODO test.fixme:` comment
next to the closest approximation: a missing locator, an unknown `by`, a role
`getByRole` does not know, an invalid timeout, an unsupported step kind, an
unsupported `compare` mode. The output is always valid TypeScript.
## Config reference
`vigil.yaml` is read with `${VAR}` substitution (unset variables become empty). Relative paths resolve against the config file directory. Defaults come from `applyDefaults`.
### runtime / project
| Key | Default | Meaning |
|---|---|---|
| `runtime.mode` | `local` | `local` or `distributed`; this build opens SQLite and local evidence regardless |
| `project.id` | required | Project key for all state |
| `project.repo` | | Git checkout of the deployed app; required by `generic-git` and `sdlc-kit` |
### target (+ url_file)
| Key | Default | Meaning |
|---|---|---|
| `target.base_url` | derived | Origin of the primary URL when empty; required otherwise |
| `target.allowed_hosts` | derived | Primary host is appended when not already allowed; match is exact or subdomain suffix |
| `target.url_file` | `url.md` when present | One URL per line, `