算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
jev-audit【设计与创意】Audit a repo for the top opportunities to replace brittle heuristics (regex, keyword lists, if-chains, hand-tuned scores, LLM-as-classifier prompts) with TypeSafe's Jev decision model. Returns a ranked report with evidence, a question design, and cost/latency estimates. Use when asked to "find Jev opportunities", "audit heuristics", or "where should …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Most codebases contain code that tries to detect a world situation the data does not state: "is this email automatic", "are these two records the same company", "is this message a complaint". Because no field says so, someone wrote rules. Those rules are a proxy, and the proxy is wrong some fraction of the time.
Jev (TypeSafe's System One decision model) answers typed questions about text (noul yes/no probability, choice over fixed options, score on ordered levels) with calibrated probabilities, at a price and latency low enough to sit where a heuristic sits today.
Your job: find those proxies, rank them by how much getting closer to the truth is worth, and show what the replacement looks like. This skill is read-only. Do not modify application code. Output is one report file.
Prices, limits and known weaknesses change. Before estimating anything, fetch:
https://docs.typesafe.ai/models.md (price, rate limits, context length)https://docs.typesafe.ai/model-jaggedness/jev-1.13.md (or the current version's page, listed in https://docs.typesafe.ai/llms.txt)https://docs.typesafe.ai/concepts/how-to-build-with-system-one.md (question design)If fetching fails, use the fallback below and say in the report that figures are from the snapshot date.
Fallback snapshot (2026-10-06, jev-1.13.0):
state plus the longest single question.state; adding questions barely changes latency.state, instructions, criteria.If the official TypeSafe agent skill is installed (typesafe-ai), use it for exact request/response shapes when writing sketches. If not, follow the shapes in the docs above and recommend installing it in the report.
Before hunting, establish in a few minutes:
jev-latest, ~typesafe/jev-latest) silently moves every tuned threshold; report it.choice and noul, or flat string state). Report gaps the sketches would need.Cast wide. Aim for 20 to 40 raw candidates before ranking. Use subagents per top-level directory on large repos, plus one subagent that sweeps the whole repo for Signature B only: LLM classifiers go through shared helpers and spread across directories, so per-directory agents find them only in part. Have it start from the shared LLM helpers (structured-output wrappers, model factories) and trace every caller. Skip vendored code, generated code, lockfiles, migrations.
Signature A: heuristics over natural-language or semi-structured text
contains / startswith / in checks applied to human-written fields: subject, body, title, name, description, bio, notes, comment, message, job title, company name, address, user agent, filename.*_KEYWORDS, *_PATTERNS, BLOCKLIST, SPAM_WORDS, GENERIC_DOMAINS, ROLE_PREFIXES, NOREPLY_*.if / elif or switch chains whose conditions are string tests and whose result is a label.is_*, looks_like_*, seems_*, detect_*, classify_*, categorize_*, guess_*, infer_*, should_*, match_*, normalize_*, dedupe_*, extract_* (when extracting from a bounded set).> 0.8x.score += 10 if ..., weights dictionaries, then a cutoff.Signature B: LLM used as a classifier
Signature C: evidence the proxy is failing
heuristic, hack, best effort, naive, good enough, fragile, edge case, TODO, FIXME, not perfect, false positive.git log --follow --oneline -- <path>, and for each pattern constant run git log --oneline -S'<a distinctive pattern string>'. Plain git log -- <path> stops at the last file move, so after a large refactor it shows 1 to 3 commits and hides the real history. Look for a stream of small commits adding one more pattern or exception. Count them. A rule list that keeps growing is the strongest gap signal available without labels.For each candidate record: file and line range, what world situation it is trying to detect (one sentence, phrased as a question), what inputs it reads, what happens downstream of its result.
Keep a candidate only if the answer to "is the truth stated anywhere in the data?" is no. Then apply these gates. A failed gate either rejects the candidate or reshapes it; say which.
Reject or reshape (from Jev's documented weak spots):
Keep the hard signals. If part of the heuristic is a deterministic, high-precision check (a header that states the fact, an exact ID match, an allowlist), that part stays as a fast path in code. The opportunity is the remainder the rules cannot decide. Say this explicitly in the sketch; the right design is almost always hybrid.
Name the cheapest code fix. If a small deterministic change removes most of the errors (whole-word instead of substring matching, a hard signal the system already has, asking the caller for an enum instead of parsing its text), say so. Either the candidate becomes "fix in code" and is rejected, or Jev stays an opportunity for the remainder and Step 7 compares three options: the current rule, the code fix, and Jev. Never credit Jev with errors a one-line fix removes.
List every rejected candidate in the report with a one-line reason.
Production data turns guesses into evidence: how often a path runs, and how often the heuristic is wrong. Do this step only when all of these hold:
If any condition fails, skip this step without asking further, and continue. Score from code and git (Step 4 caps unmeasured gaps at their code evidence), mark volumes as "not measured", and list them under open questions. Do not wait, retry access, or ask the user to set up access.
When the step runs, measure for each surviving candidate:
Score each surviving candidate 1 to 5 on three axes, each with cited evidence (file:line, commit count, comment text). No evidence, no score above 3.
Gap: how far is the current proxy from the truth?
Stakes: what does a wrong answer cost?
Fit: how well does the decision map to Jev?
Volume gate. If Step 3b measured that a path ran rarely or never in the last 30 days, mark it "leave it" and move it to the rejected table, whatever its score. If volume was not measured, do not reject on volume; keep the candidate and list its volume under open questions. Between candidates with equal priority, rank the one with higher measured volume first.
Priority = Gap x Stakes x Fit (max 125). Then apply the operating constraint from Step 5 as a label, not a multiplier: clear, needs design (async, prefilter, cache), or blocked.
Rank. Take the top 10. If fewer than 10 qualify, report fewer. Do not pad.
For each top candidate:
Tokens per call. Estimate state size from the actual fields that would be sent (use fixtures, test data, schema limits; chars / 4) plus all question text (instructions + criteria). State the assumption.
Cost. tokens_per_call x price_per_token. Always give cost per 1,000 calls. Worked example at the snapshot price: 1,500-token email + 300 tokens of questions = 1,800 tokens = $0.000076 per call = $0.076 per 1,000 = about $76 per million.
Volume. Use the measured volume from Step 3b when it exists. Otherwise derive it from code (webhook, per-request, cron frequency, loop over a table). If volume is not inferable, do not invent it: give per-1,000 cost, the break-even framing, and list "monthly volume" under open questions. If the user gave volumes, use them.
Latency. Classify the call site:
clear.clear or needs design depending on the path's budget.needs design (move off the hot path, precompute, cache by input hash) or blocked.Throughput. Compare peak calls/sec and tokens/sec against the rate limits. Flag anything within 2x of the limit.
Reducers. Note which apply: deterministic fast path handles the easy share; cache on normalized input; batch several decisions about the same state into one request (questions run in parallel, state is billed once per request); trim state to needed fields.
If replacing a Signature B LLM call, also estimate the current cost and latency of that call from its model and prompt size, and show the delta.
For each top candidate, write a sketch in the repo's language. If the repo already calls Jev, use its existing client and types (Step 1). Otherwise use the SDK for Python or JS/TS, and plain HTTP for other languages. Keep it short. It must show:
criteria where the boundary is subtle. Reference state fields by backticked path. Prefer noul for yes/no, choice when the outcome is one of N labels (include an explicit "none of these" option when applicable), score for degree.jev-latest) since thresholds are tuned per version.Question-writing rules that matter (Jev reads literally):
choice answers are stable under option reordering.You cannot know the accuracy gain from reading code. Never state one. For each top candidate give a concrete way to measure it:
If TYPESAFE_API_KEY is set and the user has explicitly agreed, you may run a small experiment on test fixtures only. Sending real customer data to a third-party API requires the user's explicit go-ahead; ask, and mention TypeSafe's data-handling page.
Write JEV_OPPORTUNITIES.md at the repo root (or print it if the user prefers). Structure:
# Jev opportunities: <repo>
Audited <date> at <commit>. Jev facts: <live from docs | snapshot date>, model <id>, lt;price>/Mtok (<list price | price on the repo's route>).
Volumes: <measured in production, window | from code only>. Existing Jev integration: <none | client, pinned or floating model, type gaps>.
## Summary
| # | Opportunity | Where | Priority | Gap/Stakes/Fit | Cost per 1k | Latency | Constraint |
## 1. <World situation as a question, e.g. "Is this inbound email automatic?">
- Where: path:lines (+ callers)
- Today: what the heuristic does, in two sentences
- Why it misses: evidence (rule count, churn commits, comments, uncovered input classes with concrete examples)
- What depends on it: downstream effect of a wrong answer
- Scores: Gap n (evidence), Stakes n (evidence), Fit n (evidence)
- Replacement sketch: code block
- Cost: tokens/call, $/1k calls, $/month if volume known (assumptions stated)
- Latency and scale: call-site class, added latency, rate-limit headroom, reducers
- Risks: applicable Jev weak spots, language, adversarial exposure
- Validate: sample source, labels, metric
... up to 10 ...
## Considered and rejected
| Candidate | Where | Reason |
## Open questions
Volumes, latency budgets, or data-handling constraints the audit could not determine.
## Next step
The single opportunity to shadow-test first, and why.