---
title: "Daemon and background work"
description: "agent-qa background work: the post-run analysis and curation chain, its 60-second budget, the three queues, agent-jobs commands, and the optional foreground daemon."
canonical_url: "https://vostride.com/docs/agent-qa/daemon"
md_url: "https://vostride.com/docs/agent-qa/daemon.md"
last_updated: "2026-10-24T01:12:08+05:30"
---

> [Documentation index](https://vostride.com/docs.md) · [Site index](https://vostride.com/llms.txt)
> Follow the Markdown links to read individual pages; the indexes list the available documentation.

# Daemon and background work

> agent-qa background work: the post-run analysis and curation chain, its 60-second budget, the three queues, agent-jobs commands, and the optional foreground daemon.

After every run, agent-qa analyzes it and learns from it. Most of the time this finishes inside the `agent-qa run` process and you never think about it. This page is for when it does not.

## After a run
When a run has its verdict, agent-qa queues a chain of three jobs:

1. `analyze-run` gives each failure a root cause.
2. `curate-memory` turns the run's evidence into [knowledge](https://vostride.com/docs/agent-qa/memory/learning.md).
3. `propose-improvements` runs extra checks on new knowledge when an [eval corpus](https://vostride.com/docs/agent-qa/self-improvement/evals.md) exists.

The run works through the chain for up to 60 seconds, then exits. The verdict and exit code are fixed before the chain starts, so nothing here can change them. The run prints the state of each stage on stderr, such as `analysis: complete · curation: complete`.

Each stage reads `pending`, `running`, `complete`, `failed` or `skipped`. `agent-qa digest <runId>` and the dashboard's run page show the same states later.

## Unfinished work
Work left when the minute is up, or when you ran with `--detach`, stays queued on this machine:

- **The next local run finishes it.** Every `agent-qa run` without `--detach` also picks up earlier runs whose curation never finished.
- **`agent-qa knowledge drain`** finishes queued curation now, using fixed templates instead of a model. `--status` only reports what is left.

The queues are local files. On a CI runner or any machine that is thrown away, unfinished work goes with it.

## The daemon
```bash
npx agent-qa daemon
```

The daemon is an optional background host that runs in the foreground of its terminal. It finishes queued analysis jobs as they arrive, and it serves agent-qa functions to commands that pass `--via-daemon`. It needs a working model credential to start.

| Command | What it does |
| --- | --- |
| `agent-qa daemon status` | Shows whether it is running, its uptime and how much curation is waiting. `--json` prints the raw status. |
| `agent-qa daemon stop` | Stops the running daemon. |

In v0.2 the daemon does not run curation. While it runs, it holds the knowledge folder's writer lease, so curation waits until the daemon stops and a local run picks the work up. Most projects do not need the daemon.

Restart the daemon, and any long-running dashboard, after you upgrade agent-qa.

## Three queues
agent-qa keeps three separate queues. Messages and commands always name which one they mean.

| Queue | Holds | Lives in | Commands |
| --- | --- | --- | --- |
| Run queue | Test runs started from the dashboard | The dashboard's database | `agent-qa queue list`, `queue cancel` |
| Curation queue | Knowledge work from finished runs | `agent-qa-knowledge/memory/queue/` | `agent-qa knowledge drain` |
| Agent job queue | The post-run jobs above | `.agent-qa/agent-jobs.db` | `agent-qa agent-jobs …` |

## Agent jobs
| Command | What it does |
| --- | --- |
| `agent-qa agent-jobs list` | Lists every job with its kind, status, attempts and run, without payloads. |
| `agent-qa agent-jobs pump --only <kind>` | Works through one kind of job now, leaving the others queued. |
| `agent-qa agent-jobs cancel <jobId>` | Asks a job to stop. |
| `agent-qa agent-jobs requeue <jobId>` | Returns a finished, failed or cancelled job to the queue, forgetting its previous attempt. Run `pump` afterwards. |

Jobs retry on their own: analysis and curation up to three times, proposals twice. If analysis keeps failing, the chain carries on with an unknown root cause.

## If the job store is refused
The job database is stamped with its format version, and agent-qa refuses one from another version instead of guessing. To reset it, stop agent-qa and delete `.agent-qa/agent-jobs.db`, its `-wal` and `-shm` files, and `.agent-qa/agent-jobs/checkpoints/`. Recorded runs, their evidence and your knowledge live elsewhere and are not affected.

## Documentation navigation

- [All documentation](https://vostride.com/docs.md)
- Parent: [What is agent-qa](https://vostride.com/docs/agent-qa.md)
- Previous: [Dashboard](https://vostride.com/docs/agent-qa/dashboard.md)
- Next: [Recorded test evidence](https://vostride.com/docs/agent-qa/guides/recorded-evidence.md)
