Skip to content

Semantic lint (Jev linter) ​

PR #981 (opened 2026-10-15 21:47 IDT by yoni-monday, branch cursor/jev-linter-eval-2794; merged 2026-10-17 09:07 IDT / 2026-10-17T06:07:06Z by yoni-monday, merge 644fe79c, final head 91771057, 27 commits, 582 files) adds a semantic linter for the code the coding agent writes in a workspace app. It checks 15 Brilliant rules after a passing typecheck and adds an advisory "Semantic lint" section to the tool result.

It is off everywhere. The PostHog flag semantic_lint defaults to false and is at 0% in both projects. Findings never change the typecheck result.

What landed ​

PiecePathWhat it is
Runtime package @brilliant/jev-linterpackages/jev-linterThe 15 rules, a regex facts pass (comment blanking uses typescript@5), the state builder, the rule catalog (@brilliant/jev-linter/catalog), and container.ts, the entry the agent image bundles.
Eval package @brilliant/jev-linter-evalpackages/jev-linter-evalA 407-fixture labeled corpus, recorded Jev answers, and a harness that scores precision, recall and F1 per rule and sweeps cutoffs. DESIGN.md there holds the design context.
Conductor integrationservices/conductor (typecheck tool, runSemanticLint)Runs the container bundle after a passing typecheck, then asks the control plane to judge the semantic rules.
Control-plane routeGET / POST /internal/workspaces/:wsId/semantic-lintFlag probe and the model call, behind internalGuard and requireFlagForTenant("semantic_lint").

Rules ​

Each rule is either det (decided from the regex facts, no model) or sem (one question to Jev, the typesafe/jev model, with a confidence cutoff).

RuleKindCutoff
db/aggregate-not-client-countsem0.80
db/for-requestdet
db/no-raw-sqlsem0.90
query/use-brilliant-querysem0.90
mut/invalidate-after-writesem0.90
mut/optimistic-updatesem0.80
int/catch-integrations-errorsem0.80
int/no-direct-provider-fetchdet
ai/non-ai-fallbacksem0.80
auth/no-handwritten-authsem0.90
data/no-fake-connected-datasem0.90
id/assign-by-idsem0.90
a11y/icon-button-namedet
a11y/input-labeldet
a11y/img-altdet

For a sem rule, the state sent to Jev carries the numbered source, call windows, server-function reads and writes, sibling files, a one-line-per-area API contract, and the regex facts as hints.

How a lint runs ​

agent container                          conductor (typecheck tool)           control plane
bun /opt/brilliant/semantic-lint.mjs ──▶ runSemanticLint ──GET──▶ /internal/workspaces/:wsId/semantic-lint
  --template-dir /opt/template/apps/web    (flag probe, cached 10s   → { enabled, configured, model: "typesafe/jev" }
  skips files identical to the template      per workspace)
  det findings + ≤64 {id,state,ruleIds}    └──POST──▶ same route, body { requests: [{ id, state, ruleIds }] }
                                                       ≤64 requests, 4 MB cap
                                                       → catalog lookup (question, cutoff, message)
                                                       → env.AI.run("typesafe/jev", { state, questions })
                                                       → { model, results: [{ id, rules, error? }] }
  • The route is not an open proxy. The POST body is only { requests: [{ id, state, ruleIds }] }. Unknown rule ids are dropped and never reach the model. The question text, cutoff, message, fix, docs and model all come from the catalog on the control plane. A caller-supplied model or questions field is a 400.
  • The control plane imports only @brilliant/jev-linter/catalog, never the package barrel. The barrel imports typescript, and workerd then exits with ReferenceError: __filename is not defined.
  • The model runs on the existing Workers AI binding. The control plane is not a TypeSafe consumer and has no TYPESAFE_API_KEY. configured means the AI binding is present. Without it the route answers configured: false / 503 lint_unavailable, and the tool stays silent.
  • Siblings. A file's imports and its importers both go in state.related, because a server function's invalidation lives in its importers. Jev then also attributes a sibling's violation to the file, so the conductor reports each rule once per sibling cluster, on the file Jev is most confident about (oncePerSiblingCluster).
  • Failure is quiet. A refused, unconfigured or failed model call keeps the deterministic findings or drops the section. Every early return logs semantic_lint.skipped with a stage (probe, unconfigured, exec, report, ask); a flag that is off logs nothing. Since #1008 the same outcomes are also PostHog events. The probe result (off, unconfigured, ready) is cached per workspace for 10 seconds; transport failures are not cached.

Example tool result from the side-env run in the PR:

Typecheck passed with 0 errors in apps/web.

Semantic lint (4 warnings in apps/web, advisory, does not fail typecheck):
- src/components/PhotoList.tsx:13 [mut/optimistic-update] (suspected, 0.94 >= 0.80) ...
- src/routes/gallery.tsx [db/aggregate-not-client-count] (suspected, 0.83 >= 0.80) ...
- src/routes/gallery.tsx:2 [query/use-brilliant-query] (suspected, 0.97 >= 0.90) ...
- src/routes/gallery.tsx:13 [a11y/img-alt] (deterministic) ...

Analytics in PostHog (#1008, merged) ​

PR #1008 (merged 2026-10-17 14:28 IDT by yoni-monday, merge 30370364) records every lint run and every rule answer as PostHog product events. Before it, the linter only logged skips, and PostHog LLM spans don't keep tool output, so nobody could see which rules fire.

  • When. After a passing typecheck, the conductor sends two events through the existing track() path. A tenant with semantic_lint off still sends nothing, and the advisory section in the tool result is unchanged.
  • Never blocks the tool. Capture runs detached and errors are swallowed. A Durable Object's waitUntil doesn't keep the isolate alive, so productEventTracker (services/conductor/src/coding-agent/host/product-events.ts) holds the capture promise until it settles while the turn keeps running. It is wired into the tool deps as trackProductEvent.
  • Identity. tenant_id and app_id come from the workspace's bound scope, never from the event. user_id is the user directing the turn, turn_id is the turn, source is brilliant-conductor, and workspace_id is added to every row.
  • Not recorded. Whether the agent later fixes a flagged file. The linter runs once the code already passes typecheck, so that signal would need stored findings and a watch on later writes.

semantic_lint_run ​

One event per lint invocation once the flag is on.

PropertyMeaning
kindfindings (warnings shown), clean, skipped (Workers AI not bound) or error (a failed probe, bundle, report or model call that produced nothing to show)
duration_msModel round trip, only when the control plane was asked
lint_idJoins the run to its semantic_lint_finding events
filesFiles the bundle linted
findings / findings_by_ruleWarnings shown to the agent, and { rule id: count } of them
reasonunconfigured, probe, exec, report, ask, workers_ai_timeout or workers_ai_failed. Set on a skip or error, and also when a partial model failure still showed deterministic warnings (kind stays findings).
statusProbe or model HTTP status, or unreachable
app, areaApp directory (web) and apps/web

semantic_lint_finding ​

One event per rule answer, including answers under the cutoff and ones dropped as a sibling of a stronger hit.

PropertyMeaning
kind / severitywarn or info
rule_idCatalog rule id
basisdeterministic or semantic
confidence, cutoffJev probability and the rule's cutoff (semantic answers only)
clearedProbability at or above the cutoff. Deterministic findings are always cleared.
reportedShown to the agent. False when under the cutoff or sibling-shadowed.
path, lineOnly when they are a normal app-relative path
messageThe catalog sentence for the rule id. Text that doesn't match the catalog is dropped.

No source code, prompts, model output, stderr or fix text is sent.

Queries (HogQL) ​

Top rules by warnings shown, last 7 days:

sql
SELECT properties.rule_id AS rule_id, count() AS warnings
FROM events
WHERE event = 'semantic_lint_finding'
  AND properties.reported = true
  AND timestamp >= now() - INTERVAL 7 DAY
GROUP BY rule_id
ORDER BY warnings DESC
LIMIT 20

Skip or error rate, last 7 days:

sql
SELECT
  countIf(properties.kind IN ('skipped', 'error')) / count() AS skip_or_error_rate,
  countIf(properties.kind = 'skipped') AS skipped,
  countIf(properties.kind = 'error') AS errored,
  count() AS runs
FROM events
WHERE event = 'semantic_lint_run'
  AND timestamp >= now() - INTERVAL 7 DAY

Partial model failures that still showed warnings have kind = findings and a reason; break them out with properties.reason. Comparing cleared with reported, and confidence with cutoff, on finding events is the way to check the cutoffs against real traffic (see the rules to watch under Evals).

Agent image ​

The image builds the bundle from packages/jev-linter with typescript@5 pinned in packages/jev-linter/bun.lock (bun install --frozen-lockfile --production, then bun build --target=bun). The image's global typescript is v7, which has no parser API. packages/jev-linter is an image input (IMAGE_INPUTS / IMAGE_INPUT_PATHS), so changing it rebuilds the image.

Turning it on ​

semantic_lint is tenant-aggregated with owner: brilliant-admin. It exists in both PostHog projects: staging flag 966547 and prod flag 966714, both 0% with no conditions. To try it on one tenant, add a release condition on the tenant group ($group_key, or env to pick a side env). There is no new secret.

Evals ​

bun run eval in packages/jev-linter-eval with TYPESAFE_API_KEY unset replays the committed recordings and prints the per-rule table. bun run eval:jev with no key exits 2 before scoring. The eval harness still calls TypeSafe over HTTP, which is why evals keep the optional TYPESAFE_API_KEY catalog entry (consumers: ["evals"]).

Results at merge (jev-1.13.0, replayed): 407 fixtures, 307 model requests, about 703k input tokens, p50 280 ms and p95 348 ms. Every rule scored P, R and F1 of 1.00 at its cutoff, with no false positives. The question wording was tuned on this same corpus, so the PR treats the margins as the real evidence. The rules to watch are int/catch-integrations-error (highest negative 0.74 against a 0.80 cutoff) and mut/optimistic-update (0.68 against 0.80).

Known caveats at merge ​

  • The side-env verification (jevlint, sha c2f88af0e) ran against TypeSafe and has not been repeated on Workers AI.
  • The PhotoList.tsx finding above came from scaffold_model output: its delete waits for the server, which the proposed mut/optimistic-update policy flags. That is a finding about the scaffold, not the linter.
  • A container report over 64 KiB was cut off under exec. See Troubleshooting.

Conductor · Control plane · Agents service & evals · PostHog · Admin Feature Flags · Secrets & envs · Monorepo layout