Adopt evlog in a repository
Five verbs, one loop. Every task here starts by measuring the repository, does its work, and ends by measuring again. The number is what makes the result reviewable.
Before anything: where you are
- On the home repository the checkout is
/workspace/repo, dependencies installed. On any other repository,git__checkoutthengit__install, and work in/workspace/<owner>/<repo>; that checkout is cold, so say so when you report its checks. evlogis on PATH: the CLI built from the currentmain. Run it from the target repository's root, nevernpx @evlog/cli.- Two commands ground every verb. Run both first, together:
evlog doctor --json: the stack, whether evlog is installed, which drains exist.evlog map --json --no-write: the global score and every entry point with its rule findings. It covers Nuxt, Nitro, Next.js, TanStack Start and Hono. On another framework it refuses; then there is no score, and the framework section ofreview-logging-patternsis the procedure.
- Load
review-logging-patternsbefore touching code. Its framework sections, drain and enricher tables, andreferences/code-review.mdare the rules. Do not instrument from memory.
Instrument
The request: add evlog, or make an app observable.
evlog init --dry-run --yesto see what the CLI would change, thenevlog init --yes(add--drain fsfor a dev-only file drain). Skip when doctor says evlog is already wired.- Take the entry points from
map, worst score first. Fix by rule weight:wide-event(40), thenaudit(25),structured-errors(20),page-error-handling(20),context(15),error-handling(15).evlog map <file> --no-writeprints the suggested shape for one entry point. evlog agents --yes --no-skillswrites the evlog block into the repository's ownAGENTS.md, so the next agent in that repo follows the same conventions. Skip--no-skillsonly when the person asked for the skills installed there.- Run the repository's own checks, then
evlog map --json --no-writeagain. - One pull request. The body carries the score before and after, the entry points changed, the commands run, and the revision. A drain that needs credentials is wired with the env var name and nothing else; never invent a token.
Review
The request: look at logging in a diff, a file, or a pull request.
evlog map <file> --no-writefor each entry point the diff touches; the findings are the comments, in the words ofreferences/code-review.md.- With an
evlog.map.jsonin the repository,evlog map --baseline evlog.map.json --no-writesays whether the diff regressed coverage. - Comment on what the diff does to observability, not on style. Requirements are defects; opportunities (
error-catalog,audit-coverage) are suggestions.
Verify
The request: does this setup work, is the score real, is this claim true.
evlog doctor --jsonfor configuration claims. A green doctor is a claim about wiring, not about events.- For a claim about emitted events, run the code: start the app or call the handler in the sandbox with the fs drain, then read
.evlog/logs/asanalyze-logsdescribes. Report the event you saw, or that nothing was written. - To lock a score, propose
evlog map --min-score <n>or--baselinein the repository's CI, with the number the current tree earns.
Monitor
The request: what happened, what is slow, what failed.
- Load
analyze-logs. It reads.evlog/logs/*.jsonl(NDJSON or pretty) and the memory drain endpoint, withreadFsLogs()fromevlog/fsfor anything beyond a grep. - The sandbox sees local drains only. A production drain (Axiom, Datadog, PostHog, and the others) is not reachable from here; say so and point at the drain's own UI. The
telemetryskill is about the CLI's own usage data, not the person's application.
Audit
The request: track who did what, denials, retention, a compliance review.
- Load
build-audit-logs. It carries the call sites,withAudit, denials, catalogs, and the review checklist.map'sauditrule (25) andaudit-coverageopportunity tell you which handlers are missing one.
Report
Lead with the number: the score before and after, or the count of entry points fixed, or the events read. Then the commands, their observed results, and the revision. A check you could not run is stated as not run. Nothing here is verified by reading source alone; the CLI and the logs are the evidence.