feat(analyze): prime analyst engine — --analyzer prime posts the span projection to an OpenAI-compatible bridge - #81
Conversation
… projection to an OpenAI-compatible bridge primeAnalyzer joins the external-engine registry as a peer of haloAnalyzer and hodoscopeAnalyzer: it inlines the full OpenInference span projection into a one-shot prompt (per-attribute char cap on oversized traces, loud failure when inline delivery is impossible), enforces a short-strings fenced-JSON reply contract with one bounded stateless repair turn, maps rows to grounded AnalystFindings validated against the artifact's span URIs, and records bridge-reported usage in the result output. Transport is injectable; the default is plain node:http(s) because undici's fixed 300s headers timeout kills prime calls that legitimately run longer. Config follows the env idiom: TRACES_PRIME_BRIDGE_URL, TRACES_PRIME_MODEL, TRACES_PRIME_TIMEOUT_MS; --model and --analyzer-prompt forward like every other engine. Default analyze behavior is unchanged; the branch only fires on --analyzer prime.
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 4ac1ff1f
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-08-08T03:43:07Z
tangletools
left a comment
There was a problem hiding this comment.
⚪ Value Audit — audit-incomplete
| Verdict | audit-incomplete |
| Concerns | 1 (1 low) |
| Heuristic | 0.0s |
| Duplication | 0.1s |
| Interrogation | 90.0s (2 bridge agents) |
| Total | 90.1s |
💰 Value — error
value agent produced no parseable value-audit JSON.
- Model: opencode/deepseek/deepseek-v4-pro
- Bridge attempts: 3
- Bridge error: opencode/kimi-for-coding/k2p7: Bridge returned 503: {"error":{"message":"cli-bridge admission timed out after 30000ms","type":"admission_rejected","reason":"queue_timeout","admission":{"active":20,"queued":2,"maxActive":20,"maxQueue":48}}}; opencode/zai-coding-plan/glm-5.2: Bridge returned 503: {"error":{"message":"cli-bridge admission timed out after 30000ms","type":"admission_rejected","reason":
🎯 Usefulness — error
usefulness agent produced no parseable value-audit JSON.
- Model: opencode/deepseek/deepseek-v4-pro
- Bridge attempts: 3
- Bridge error: opencode/zai-coding-plan/glm-5.2: Bridge returned 503: {"error":{"message":"cli-bridge admission timed out after 30000ms","type":"admission_rejected","reason":"queue_timeout","admission":{"active":20,"queued":2,"maxActive":20,"maxQueue":48}}}; opencode/kimi-for-coding/k2p7: Bridge returned 503: {"error":{"message":"cli-bridge admission timed out after 30000ms","type":"admission_rejected","reason":
🔎 Heuristic Signals
🟡 Cruft: console debug added examples/external-engines.ts
+console.log(
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
What
traces analyze --analyzer prime: any captured session can now be analyzed by the prime-RLM arm. Registered at the external-engine seam (ExternalAnalyzer), deliberately not the agentic dspy seam — prime here is a one-shot model call with no REPL/tools, and registering it as an agentic engine would misrepresent its execution model (seam map with file:line in the commit).The engine posts the span projection to an OpenAI-compatible bridge (cli-bridge prime backend), using the proven protocol: short-strings finding contract, one bounded repair turn (malformed reply forwarded, trajectory never), per-attribute-cap re-render for oversized projections, findings decoded with exact-key + span-URI grounding against the artifact. Additive only — default analyze behavior byte-identical.
Includes a review fix: the per-finding
span_idscap is now enforced on the deduplicated list (was 2× the documented contract pre-dedup; found by the adversarial verifier).Proof
Named follow-up
A registryBenchmarkRunner adapter wrapping this engine for scored benchmark runs belongs in agent-eval, not here.