D86 · Team sessions may ask TypeSafe's Jev which rules a slice needs, within a budget zuki sets, and work without it when the budget is spent
Proposed · 2026-11-03 · zuki agreed to the recommendation in a CTO session ("I agree with your recommendations"), proposed on #433; it binds when this page's pull request is merged
Decision: In a team session (D77), tools/team/find-rules.mts <rule page> --issue <n> gives a teammate the rules on a rule page that a slice needs, so it reads those instead of the whole page. It keeps every rule the issue cites by ID (a regex, no model), and asks TypeSafe's Jev one yes/no question per remaining rule; a rule whose answer is 0.7 or more is kept. When more than 40% of the page's rules are kept, the slice is broad and the tool says to read the whole page.
Jev is an aid within a fixed budget, never a dependency:
- The budget is zuki's. He sets it in US dollars in
.team/typesafe-budget(gitignored). The tool records each answer'susage.input_tokensin.team/typesafe-usage.jsonland prices them at Jev's list price ($0.042 per million input tokens, checked 2026-11-03; output is free). - When the budget is spent, the session goes on without Jev. Before each request the tool checks that the spend so far plus the request's estimated size fits the budget. If it doesn't, or the key is missing, or the API refuses (no credit, rate limit after retries, an error), the tool sends nothing more and prints the cited rules with "Jev unavailable: read the whole page". A failure never means "not needed".
- Nothing gates on Jev. No hook, task gate or commit check calls it. It only shortens what an agent reads; the rules, tests and audits are unchanged.
- Jev answers judgments; code and zuki decide. A use of Jev asks a question a person could answer at a glance ("does this work need this rule?") and code acts on the answer. Jev never chooses an option, accepts a decision, approves a run or settles a question; those stay zuki's.
Every session reports what it used and what Jev saved, and the use is improved from those reports:
- At close.
/team-closewrites a Tokens section into the digest (#432): each agent's calls, median context and cache-read tokens with their estimated cost; the ten reads that cost most; and, for Jev, its requests, tokens, dollars spent, the budget left, and the reading it saved. The saving is an estimate: the tokens of each page minus the tokens of the rules kept, times the later calls of the agent that asked. - Next for Jev. The same section names up to three places in the flow, taken from the costly reads or from a judgment the session made by hand, where a Jev question might save tokens or make a judgment more consistent, such as runbook sections or which issue comments settle a question. The CTO tries a candidate only offline: against past sessions' saved inputs, with ground truth from their digests, within the budget, and with zuki's consent to the data it sends.
- Adopting one is a decision. A candidate that beats the code-only way on held-out sessions is proposed to zuki as an amendment to this page, with its results. A use that saves less than it costs, or whose recall falls on later sessions, is taken out the same way.
Why:
- The experiments, 2026-11-03, counts and rule IDs only: tuned on #405, held out #302 and #357, ground truth from the IDs each slice's digest and issue cite. On #405, a narrow slice, the tool kept every rule the slice needed while reading 4 of 68 rules (13% of the page). On #302, which migrates all of v1's rentals, Jev marked about 75% of the rules as needed, which is right, so the tool tells the agent to read the page. A rerun moved answers by 0.015 on average. A keyword baseline and a single ranking question over the whole page did worse.
- Cost: a request is about 28k input tokens for a 74 KB page, about $0.0012. The experiments used 288k tokens, about $0.012.
- Where it saves: rule pages are 6 to 10% of the weighted cost of what agents read in a team session, and the saving comes on narrow slices only. The larger savings are in #429, #430 and #431, which need no outside service. This decision is the small part, and is worth taking only because it costs little and fails safe.
Options:
- (a) No Jev. Agents read whole rule pages, plus the cited-rules regex from #430's brief. Costs nothing; saves nothing on rule pages.
- (b) Jev for rule pages, within a budget (recommended). This page.
- (c) Jev for runbook pages and decisions too. Not tested on runbook pages. For decisions, the regex alone found 91 to 100% of what the held-out slices needed, and decision pages are 1 to 3% of the cost. Not now.
Consequences:
- Data sent to TypeSafe: a rule page from
apps/docs/src/content/docs/system/rules/, and the slice issue's title and body. The tool refuses any other path. Rule pages and slice issues hold counts and IDs only, with no personal data (D15). TypeSafe states it does not train on customer requests; zero data retention is for enterprise plans only, so this account has no ZDR. - The key: kept in the Keychain as
opleet-typesafe.pnpm team:startexports it asTYPESAFE_API_KEYonly when it is there, as it does the GitHub token. The Bash guard refuses commands that nameTYPESAFE_API_KEY, as it does the other tokens. Never in a file, a log or a prompt. - Tooling (CTO):
tools/team/find-rules.mts,.claude/team.sh,.claude/hooks/guard-bash.mjs, and a line in theopleet-docandopleet-berole files on when to use it. - Working rules: contributing/team-sessions.md names the tool, the budget file, the fallback and the Tokens section at close.
- Team close:
.claude/skills/team-close/SKILL.mdadds the Tokens section to the digest (#432). Without Jev it still reports the session's tokens. - Model version: the tool pins
jev-1.14.0, notjev-latest. A new Jev version is a change to the tool, checked by rerunning the experiments on #405 and #302. - Not decided here: the budget's amount (zuki's, in the file), and any use of Jev outside team sessions.