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
| Piece | Path | What it is |
|---|---|---|
Runtime package @brilliant/jev-linter | packages/jev-linter | The 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-eval | packages/jev-linter-eval | A 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 integration | services/conductor (typecheck tool, runSemanticLint) | Runs the container bundle after a passing typecheck, then asks the control plane to judge the semantic rules. |
| Control-plane route | GET / POST /internal/workspaces/:wsId/semantic-lint | Flag 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).
| Rule | Kind | Cutoff |
|---|---|---|
db/aggregate-not-client-count | sem | 0.80 |
db/for-request | det | |
db/no-raw-sql | sem | 0.90 |
query/use-brilliant-query | sem | 0.90 |
mut/invalidate-after-write | sem | 0.90 |
mut/optimistic-update | sem | 0.80 |
int/catch-integrations-error | sem | 0.80 |
int/no-direct-provider-fetch | det | |
ai/non-ai-fallback | sem | 0.80 |
auth/no-handwritten-auth | sem | 0.90 |
data/no-fake-connected-data | sem | 0.90 |
id/assign-by-id | sem | 0.90 |
a11y/icon-button-name | det | |
a11y/input-label | det | |
a11y/img-alt | det |
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-suppliedmodelorquestionsfield is a 400. - The control plane imports only
@brilliant/jev-linter/catalog, never the package barrel. The barrel importstypescript, and workerd then exits withReferenceError: __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.configuredmeans the AI binding is present. Without it the route answersconfigured: false/ 503lint_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.skippedwith 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 withsemantic_lintoff 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
waitUntildoesn't keep the isolate alive, soproductEventTracker(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 astrackProductEvent. - Identity.
tenant_idandapp_idcome from the workspace's bound scope, never from the event.user_idis the user directing the turn,turn_idis the turn,sourceisbrilliant-conductor, andworkspace_idis 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.
| Property | Meaning |
|---|---|
kind | findings (warnings shown), clean, skipped (Workers AI not bound) or error (a failed probe, bundle, report or model call that produced nothing to show) |
duration_ms | Model round trip, only when the control plane was asked |
lint_id | Joins the run to its semantic_lint_finding events |
files | Files the bundle linted |
findings / findings_by_rule | Warnings shown to the agent, and { rule id: count } of them |
reason | unconfigured, 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). |
status | Probe or model HTTP status, or unreachable |
app, area | App 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.
| Property | Meaning |
|---|---|
kind / severity | warn or info |
rule_id | Catalog rule id |
basis | deterministic or semantic |
confidence, cutoff | Jev probability and the rule's cutoff (semantic answers only) |
cleared | Probability at or above the cutoff. Deterministic findings are always cleared. |
reported | Shown to the agent. False when under the cutoff or sibling-shadowed. |
path, line | Only when they are a normal app-relative path |
message | The 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:
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 20Skip or error rate, last 7 days:
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 DAYPartial 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, shac2f88af0e) ran against TypeSafe and has not been repeated on Workers AI. - The
PhotoList.tsxfinding above came fromscaffold_modeloutput: its delete waits for the server, which the proposedmut/optimistic-updatepolicy flags. That is a finding about the scaffold, not the linter. - A container report over 64 KiB was cut off under
exec. See Troubleshooting.
Related pages
Conductor · Control plane · Agents service & evals · PostHog · Admin Feature Flags · Secrets & envs · Monorepo layout