Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/extraction-judge-band.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@schlessera/brain-common": minor
"@schlessera/brain": minor
"@schlessera/brain-ui-sdk": minor
"@schlessera/brain-ui-server": minor
---

Add the `taint.judge` governance policy setting, `{ mode: off, floor: 0.9 }` by default. With `mode: jev` beside `taint.classifier: heuristics`, a tainted interactive session's outgoing call whose heuristic score falls in the ambiguous band is put to Jev (`jev-1.13.0`, pinned) instead of raising its card. Jev sees only the outgoing request (its body cut at 2,000 characters), the name of what tainted the session and the overlap score. A `benign` answer at or above the floor admits the call, and an `extraction` answer at or above it refuses the call. Any other outcome keeps the card: a lower or `suspicious` answer, no answer, a timeout, an open breaker, another answering model, an exhausted budget, or a provider rule that keeps the conversation's folders from `typesafe`. Each call is metered in the turn, conversation and day budgets as a `typesafe` attempt with the new operation `extraction_judge`. Voice turns never call the judge and keep refusing. `brain policy check` reports the resolved setting.
11 changes: 11 additions & 0 deletions api-report/ui-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,13 @@ signatures (every public export and the types it is made of)
egress: z.ZodOptional<z.ZodObject<{
allow: z.ZodArray<z.ZodString>;
}, z.core.$strict>>;
judge: z.ZodOptional<z.ZodObject<{
floor: z.ZodOptional<z.ZodNumber>;
mode: z.ZodOptional<z.ZodEnum<{
jev: "jev";
off: "off";
}>>;
}, z.core.$strict>>;
trusted_sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
id: z.ZodString;
incomingContent: z.ZodDefault<z.ZodBoolean>;
Expand Down Expand Up @@ -2775,6 +2782,10 @@ signatures (every public export and the types it is made of)
egress: {
allow: string[];
};
judge: {
floor: number;
mode: "jev" | "off";
};
trusted_sources: {
id: string;
incomingContent: boolean;
Expand Down
41 changes: 38 additions & 3 deletions docs/decisions/governed-writable-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4359,9 +4359,9 @@ anything sent to a host the session already reached. The policy setting
heuristics #3434 measured ([the plan](../plans/extraction-classifier.md)) on
each call a tainted session makes, at the per-call admission every backend
awaits with the call's full input (`wrap`,
`packages/ui-server/src/brain/turn-extraction.ts:137-158`). The signals and
`packages/ui-server/src/brain/turn-extraction.ts:154-175`). The signals and
bands are pure (`classify`,
`packages/ui-server/src/governance/extraction-classifier.ts:583-590`); their
`packages/ui-server/src/governance/extraction-classifier.ts:596-605`); their
session state (shingle hashes of the files read, the hosts the tainting
content named, each site's earlier payloads) is in-memory host state, never
recorded or sent to a provider. `block` refuses the call with the reason as
Expand All @@ -4371,13 +4371,48 @@ voice refuses instead. `allow` relaxes only the #3430 card, only for the hosts
a readable call (a WebFetch, a visible curl/wget or `gh` read) names, and only
while that call is in progress; an opaque or unattributable call in progress
withholds it, because the proxy cannot tell which process opened a connection
(`relaxes`, `packages/ui-server/src/brain/turn-extraction.ts:193-197`). Deny,
(`relaxes`, `packages/ui-server/src/brain/turn-extraction.ts:210-214`). Deny,
`allowlist` mode, the byte ceiling, the outward-host card and the outward
action cards never consult it. A session this process did not observe from
its first turn, or whose state outgrew its bounds, never allows. The setting
stays off by default until a maintainer ruling on #4088 after the band is
requalified (#4090).

<a id="extraction-judge"></a>

**The Jev judge for the ambiguous band — 2026-11-16
([#4089](https://github.com/schlessera/brain-kit/issues/4089)).** Most of the
heuristics' remaining benign cards are links the tainting content named and
pagination cursors, which score in a band from 0.2 to below 0.35. With
`taint.judge.mode: jev` (default `off`, effective only beside
`classifier: heuristics`), an interactive turn puts a call in that band to Jev
instead of showing its card (`let band: Band`,
`packages/ui-server/src/brain/turn-extraction.ts:131-133`). Jev is
shown the outgoing request with its body cut at 2,000 characters, the wording
of what tainted the session and the overlap score, never the conversation,
the tainting content or a file the session read. The model is pinned to
`jev-1.13.0`, the one #3434 measured, and an answer from any other model is no
answer. `benign` admits the call and `extraction` refuses it only at or above
the floor, 0.9 by default and configurable from 0.5 to 1 (`judgeBand`,
`packages/ui-server/src/governance/extraction-judge.ts:74-77`). Every other
outcome leaves the card (`createExtractionJudge`,
`packages/ui-server/src/governance/extraction-judge.ts:116-148`). That covers
`suspicious`, an answer below the floor, no answer, a timeout, the host
client's open breaker and a missing key. The request is its own G2 data flow.
TypeSafe is the recipient `typesafe` under the web providers' routing rule, so
a conversation shown a folder the policy keeps from it, or one whose exposure
cannot be judged yet, sends nothing. A blocked budget scope, or no ledger to
charge, sends nothing either. Each request is recorded as a `typesafe`
attempt with operation `extraction_judge` against the turn, its conversation
and its UTC day, with the tokens TypeSafe reports. No rate is held for it, so
its cost is unknown, never zero (`turnExtractionJudge`,
`packages/ui-server/src/brain/turn-extraction-judge.ts:26-58`). Voice turns
never call it and keep refusing; autonomous turns have no turn proxy and so
no classifier. Answers stay host state: a judged call reaches the conversation
only as its card or its refusal, whose text is the heuristics' reason. The
setting stays off by default until the band is requalified (#4090) and a
maintainer rules on it.

<a id="refusals-say-why"></a>

**Refusals say why — 2026-11-04
Expand Down
5 changes: 4 additions & 1 deletion docs/hosting/agent-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,10 @@ without a card. With `taint.classifier: heuristics` in the governance policy
before it runs (#4088): a call that looks like it carries the session's
notes out is refused, or asks with the reason on the card, even to a host
the session already reached, and a clean read admits the hosts it names
without the card while it runs. Refusals, including a declined card, are `egress_denial`
without the card while it runs. Adding `taint.judge: { mode: jev }` (also
off by default) puts the heuristics' ambiguous calls to Jev with the host's
`TYPESAFE_API_KEY` instead of asking (#4089). Each such call is metered in the
turn budgets, and without the key, an answer, or budget it asks as before. Refusals, including a declined card, are `egress_denial`
events with reason `taint_allowlist`. Every refusal with a policy cause
(taint, the deny or allow list, the byte ceiling, an unapproved outward host)
answers with a status text and a body naming that cause, so `curl -v`, `git`
Expand Down
12 changes: 12 additions & 0 deletions docs/integration-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ See [the supported input](supported-inputs.md#governance-policy),
[the package API](integration-contract/package-api.md#extraction-classifier-setting-additive-0450-4088).
This ships in a minor; no breaking ruling is required.

## Extraction judge setting and metered operation (additive, 0.45.0, #4089)

The governance policy gains optional `taint.judge`, `{ mode: "off" | "jev", floor }`,
resolved to `{ mode: "off", floor: 0.9 }`, and `brain policy check --json`
reports it in `effective.taint`. With `mode: jev` beside
`classifier: heuristics`, the host's judge calls are recorded in the turn
budgets as relayed attempts of family `typesafe` with the new operation
`extraction_judge`. See [the supported input](supported-inputs.md#governance-policy),
[the CLI component](integration-contract/cli.md) and
[the package API](integration-contract/package-api.md#extraction-judge-setting-additive-0450-4089).
This ships in a minor; no breaking ruling is required.

## Reference pool growth status (additive, 0.45.0, #3515)

The host-only `brain-native-store pool` projection gains a read-only `growth`
Expand Down
3 changes: 3 additions & 0 deletions docs/integration-contract/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ with explicit incoming/recipient defaults. This reports data, not a runtime
trust exemption or new review capability; sticky taint enforcement is unchanged.
Since #4088 (additive), `effective.taint` also includes `classifier`, `"off"`
unless the file sets `"heuristics"`.
Since #4089 (additive), `effective.taint` also includes `judge`,
`{ "mode": "off", "floor": 0.9 }` unless the file sets `mode: jev` or a
`floor` from 0.5 to 1.
Valid and missing inputs exit 0 with `ok: true`, and invalid inputs exit 1 with
`ok: false`. Missing inputs have a null hash, no errors and built-in defaults.
Invalid input returns defaults, its validation errors, and a hash when its bytes
Expand Down
12 changes: 12 additions & 0 deletions docs/integration-contract/package-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5360,6 +5360,18 @@ additive type change. No SDK type, HTTP endpoint, card field or provider
conversation changes: the classifier's card and refusal are existing
permission requests and tool-result text.

## Extraction judge setting (additive, 0.45.0, #4089)

The governance policy types reachable through ui-server's public signatures
accept optional `taint.judge` (`{ mode?: "off" | "jev"; floor?: number }`, a
floor from 0.5 to 1) and resolve it to `{ mode: "off", floor: 0.9 }`. The
internal `ProviderOperation` gains `"extraction_judge"`, the operation each
judge call is recorded under in the turn budgets. The same-commit API report
records these additive type changes. No SDK type, HTTP endpoint, card field or
provider conversation changes: the judge's answers stay host state, and a call
it leaves on the card or refuses uses the existing permission request and
tool-result text.

## Live brain orientation and task status (additive, #3623)

`LiveConversationOpenOptions.orientation?: ConversationOrientation` supplies an
Expand Down
7 changes: 5 additions & 2 deletions docs/plans/extraction-classifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ The heuristics now ship behind `taint.classifier: heuristics`, off by default
admission is [the decision record](../decisions/governed-writable-workers.md#extraction-heuristics)).
`packages/ui-server/tests/extraction-classifier-labelled.test.ts` runs the
labelled set through the production classifier and compares every call with
the recorded offline run. The Jev band is not built
([#4089](https://github.com/schlessera/brain-kit/issues/4089)).
the recorded offline run. The Jev band ships behind `taint.judge.mode: jev`,
off by default ([#4089](https://github.com/schlessera/brain-kit/issues/4089);
[the decision record](../decisions/governed-writable-workers.md#extraction-judge)),
and the same test replays the recorded Jev answers through the production
judge.

## Where it runs and what it may change

Expand Down
2 changes: 1 addition & 1 deletion docs/supported-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ objects merge per field. No value grants authority to autonomous turns.
| `commands` | `deny`, `confirm`: arrays of `{ pattern: string, reason?: string }` | Additions to existing permissions, default `[]`. Regex sources preserve their literal anchors and compile case-insensitively under [confirmation rules](decisions/confirm-patterns.md). Mixed lists retain valid entries in order and report skipped sources; nonempty entirely invalid lists refuse. |
| `egress` | `mode`: `record`/`allowlist`; `allow`, `deny`: string arrays; `max_bytes_per_turn`: nonnegative safe integer | `record`, empty lists and no byte cap by default. This reader does not establish network enforcement. |
| `outward` | `allow`: array of `{ command: string, remotes: string[] }`; `hosts`: string array; `github`: `{ repositories: string[] }` (at most 256) | Default empty additions to the existing outward-action rules and built-in destination list. Parsing grants no action. `github.repositories` (additive, #3798) lists the repositories the host GitHub write tools may write to: each entry is `owner/repo` exactly or `owner/*` for every repository of one owner, with GitHub's name grammar (owner `[A-Za-z0-9-]{1,39}`, repository `[A-Za-z0-9._-]{1,100}`, not `.` or `..`). Owner and repository compare without case. No other pattern exists, and one malformed entry, or an unknown key in `github`, makes the policy invalid rather than being skipped. Absent or empty, the default, no GitHub write is admitted. A listed repository still needs a per-use approval card for each write; see [the MCP contract](integration-contract/mcp.md#github-writes-additive-0450-3798). |
| `taint` | `egress: { allow: string[] }`, `trusted_sources: TrustRule[]`, `classifier`: `off` or `heuristics` | `classifier` (additive, #4088) defaults to `off`, the #3430 behaviour; `heuristics` judges each outgoing call of a tainted session with the deterministic [extraction heuristics](decisions/governed-writable-workers.md#extraction-heuristics), which may refuse a call or ask about it, and may admit a clean read's named hosts without the tainted-destination card while it runs. Both lists default to `[]`; trust data and pure candidate matching are described below (#3607). No runtime trust capability is enabled. Default empty egress additions; session-derived hosts/inference relay and taint enforcement remain their owning guardrail's responsibility. Validated provider-relay requests are outside taint narrowing and create no taint ([#3246](integration-contract.md#provider-relay-requests-and-session-taint-breaking-before-10-3246)); this list never needs a provider host for them. |
| `taint` | `egress: { allow: string[] }`, `trusted_sources: TrustRule[]`, `classifier`: `off` or `heuristics`, `judge: { mode: off \| jev, floor: number }` | `classifier` (additive, #4088) defaults to `off`, the #3430 behaviour; `heuristics` judges each outgoing call of a tainted session with the deterministic [extraction heuristics](decisions/governed-writable-workers.md#extraction-heuristics), which may refuse a call or ask about it, and may admit a clean read's named hosts without the tainted-destination card while it runs. `judge` (additive, #4089) defaults to `{ mode: off, floor: 0.9 }`; `mode: jev`, only while `classifier` is `heuristics`, asks [Jev about the heuristics' ambiguous band](decisions/governed-writable-workers.md#extraction-judge) instead of showing its card, using the host's `TYPESAFE_API_KEY`. `floor`, from 0.5 to 1, is the confidence an answer needs to allow or refuse a call; anything less asks. Both lists default to `[]`; trust data and pure candidate matching are described below (#3607). No runtime trust capability is enabled. Default empty egress additions; session-derived hosts/inference relay and taint enforcement remain their owning guardrail's responsibility. Validated provider-relay requests are outside taint narrowing and create no taint ([#3246](integration-contract.md#provider-relay-requests-and-session-taint-breaking-before-10-3246)); this list never needs a provider host for them. |
| `providers` | Array of `{ paths?: string[], types?: string[], allow: string[] }` | Default `[]`. At least one selector is present. Paths use canonical brain-relative Bun glob patterns; types are exact runtime taxonomy names. Either selector matches; every matching rule must allow the actual recipient. Unknown recipients cannot authorize matching content. |
| `apify` | `enabled`: boolean; `discovery`, `actors`: `deny`, `ask` or `allow`; `actor_grants`: array of `{ account_id, actor_id, build_number, profile_id, schema_sha256, pricing_sha256, origins, expires_at, max_run_usd }` (at most 64); `limits`: `{ run_usd, turn_usd, session_usd, day_usd, max_runs_per_turn, max_requests_per_turn, max_concurrent_runs, max_runtime_seconds, max_result_items, max_result_bytes, max_retention_seconds }` | Default `{ enabled: false, discovery: ask, actors: ask, actor_grants: [], limits: null }` (additive, #3159, #3160 and #3161). Only `enabled: true` lets the server use its host-only `APIFY_TOKEN`; until then it contacts no Apify endpoint, whatever credential exists. An invalid policy file disables Apify rather than keeping an earlier enablement. `discovery` governs catalog searches and Actor inspection, which send the query or the chosen Actor's identifier to Apify; it never permits a run. `actors: deny` refuses every run; both `ask` and `allow` require an Actor's first approval. Approve once authorizes one prepared invocation; approve always persists approval by brain, principal, account and immutable Actor id across sessions, inputs and builds. Historical `actor_grants` entries remain parseable and revocable but do not become Actor-wide approvals. Their legacy fields and expiry syntax are unchanged. `limits` is the only spending entitlement: without it no run is admitted. With it, every field is required. Amounts are USD from 0 to 1,000,000. Counts are whole numbers up to 1,000,000. `max_runtime_seconds` is at most 7 days, `max_result_items` at most 1,000,000, `max_result_bytes` at most 1 GiB and `max_retention_seconds` at most 30 days. Legacy `max_result_items` and `max_result_bytes` remain parseable but do not truncate Actor content (#3580). Zero refuses the remaining allowances. `run_usd` bounds a run's whole reservation: its cap plus its reserved lifecycle requests and remote storage. `turn_usd`, `session_usd` and `day_usd` count pending reservations as spent and apply alongside, never above, `budgets`. `day_usd` and `max_concurrent_runs` are account-wide across brains. `max_requests_per_turn` counts every Apify request in a turn. Results stay readable for `max_retention_seconds` after a run ends, which never shortens Apify's own storage retention. See the [current Apify decision](decisions/apify-actor-approval.md). |

Expand Down
Loading
Loading