Repository navigation
Decision backends: typed, calibrated judgments as an optional seam - #354
Merged
Merged
Conversation
…tional seam) The contract every phase of the decision-backend work implements against: the areev_llm::decide seam, the provider chain and spec grammar, the DEC error domain, the eighteen opt-in plug-in points, surfaces per crate, and the phase/ownership plan.
A System One model (TypeSafe Jev and every gateway/clone that speaks its
POST /v1/systemone shape) takes a `state` plus named noul/choice/score
questions and returns typed answers with calibrated probabilities. That is
the shape of every judgment Areev used to make with a constant or a
keyword list. This adds one provider-agnostic seam and plugs it, opt-in,
into the recall reranker, the context allocator, the run scheduler and the
loop engine. Contract: docs/decision-model-proposal.md. Named decision in
ARCHITECTURE.md §10.
Rules: a model scores and orders, only code omits/gates/approves/applies;
an uncalibrated backend may reorder, never omit; fail open to the
deterministic rule, anonymization fails safe (DEC-E008 stops a chain);
every judgment is attributable. Nothing is default-on: with no --decide /
$AREEV_DECIDE every path is byte-identical (test-pinned per crate). The
keyless floor and the conformance suite do not move. No new dependency.
Measured (crates/areev-bench/RESULTS.md §9): full LoCoMo retrieval with
Jev via OpenRouter as the reranker, hit@1 18.6% -> 51.8%, MRR@10
0.250 -> 0.567, oracle ceiling 66.3%; $0.61 per run.
Phase 0 real recall scores in SearchHit.score / MCP / bindings, recall
deadline, CommandRerank (--rerank-cmd)
Phase 1 areev_core::decide (types, DEC-E001..E008), areev_llm::decide
adapters + chain + PseudonymizingDecider; --decide* flags,
`areev decide`, MCP env, py/js set_decider/decide, /api/config
Phase 2 areev_store::DecisionRerank, conformance case on both backends,
decide_calibrate bench, LoCoMo A/B with oracle control
Phase 3 intent + per-candidate disclosure questions in areev-context and
ASSEMBLE (CAL-W019), recall-hook under 1500 ms
Phase 4 decision node (areev://decide, RUN-E030), decision-guided fold,
tool-offer narrowing; run start/resume + trigger run wired;
packs may carry a decision node
Phase 5 areev_loop::DecideBackend + LoopDecider; GROUND/VERIFY number,
duplicate/contradiction sweeps, tool-cause classification;
drafts only, judged_by never auto-applies (LOP-E051)
Gate: cargo test --workspace (3,361), clippy -D warnings, cargo doc,
pytest (174), node --test (106), conformance Turso+Postgres, perf gates,
repo_stats --check, coverage --check (83.6%), check_versions. Docs moved
with every surface. Not a release: no version bump.
neoneye
pushed a commit
to agent-memory-atlas-archive/AreevAI--areev
that referenced
this pull request
Sep 25, 2026
…ide test budget; doc follow-ups Two CI failures on main after AreevAI#354/AreevAI#355, neither in the code those PRs changed, plus the follow-ups noted on AreevAI#353. The egress broker gave back the memory it was lent only when its detached accept thread next polled the stop flag (every 5 ms), not when the Broker was dropped. An embedded memory's file lock is a process-wide fcntl record lock that lives as long as any handle does, so a host that closed its handle and immediately handed the file to another process — the Node binding's `close()` followed by a CLI run on the same file, which is exactly the binding's egress parity test (AreevAI#201) — could find it still locked on a slow macOS runner. `Broker::drop` now takes the store out of the shared slot itself; `serve_one` clones the store out of that slot for the length of one upload, so an in-flight artifact keeps its own reference and the drop never blocks on it. Pinned by `dropping_the_broker_releases_the_bound_store_synchronously`, which fails without the fix (verified) and needs no sleep or join to pass with it. The CLI decision smoke test drove its toy Python `--decide-cmd` under the default 2 s decision deadline; a cold interpreter on a shared Windows runner was killed before it printed anything (DEC-E004) and the failure read as a backend bug. The test now sets a generous budget: it measures the answers, not interpreter start-up, and the default's tightness is pinned by the deadline tests beside it. Also: every rustdoc warning in the workspace (16: private intra-doc links, unresolved links, a macro example fenced as Rust, an unescaped `<tag>` and `[:port]`) is fixed, so `cargo doc` is clean; `docs/security-model.md` no longer claims the store pins `search_path` per session and that transaction pooling is unsafe — AreevAI#181 made every statement schema-qualified and the chaos runner proves transaction-mode PgBouncer, so it now states the one real condition (prepared-statement tracking) and points at the deployment profile; the Python and Node binding docs and the quickstart mention the paired layout's `meta_schema=` (AreevAI#353).
neoneye
pushed a commit
to agent-memory-atlas-archive/AreevAI--areev
that referenced
this pull request
Sep 28, 2026
- min_score: the builtin ASSEMBLE queries drop their 0.4-0.55 floors.
Recall scores are relative (rank-normalized RRF, or reranker min-max),
so a fixed floor is a leg-count-dependent rank cut. Measured on LoCoMo
with the new `min_score_sweep` bench (RESULTS.md §10): no-op keyless,
4-7 points of gold-evidence recall lost at 0.5+ with a vector leg.
- Decision carries the provider-reported cost (`usage.cost` -> usd_micros,
rounded up); decision nodes now charge it to the run's USD budget, and
the reranker stats / benches sum it.
- record_tool_call takes `failure_detail` on MCP, CLI, Python and Node, so
the loop's tool-cause classifier can fire from those surfaces.
- areev-context: one shared selection for single-pass, census and
timeline. Timeline no longer renders retracted grains; census renders
exactly what it counts.
- CLI: remove the duplicated resolve_db block that ran before
`anonymize scan|test`.
- areev-js / areev-py: strip = false in release. rustc's rust-objcopy
strip over an Xcode 27 ld-linked dylib is refused by macOS 27 dyld
("mis-aligned LINKEDIT string pool").
neoneye
pushed a commit
to agent-memory-atlas-archive/AreevAI--areev
that referenced
this pull request
Sep 28, 2026
Version bump across all six sites (workspace, areev-js package.json + Cargo.toml + generated index.js, areev-py pyproject, areev-sandbox), the three lockfiles, the repo-stats artifacts that embed the version, and the changelog. Ships the AreevAI#354 follow-ups: builtin ASSEMBLE queries drop min_score, Decision carries the provider-reported cost, failure_detail on record_tool_call, and the timeline/census/anonymize/dylib-strip fixes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decision backends: typed, calibrated judgments as an optional seam
Contract:
docs/decision-model-proposal.md. Named decision: ARCHITECTURE.md §10"A decision model may score and order; only code omits, gates, approves or applies".
What a decision backend is. A System One model (TypeSafe Jev and the eleven
gateways/clones that speak its
POST /v1/systemoneshape) takes astateplusnamed
noul/choice/scorequestions and returns typed answers withcalibrated probabilities — no text, one parallel evaluation. That is the shape of
every judgment Areev used to make with a constant or a keyword list.
The four rules. (1) A model scores and orders; only code omits, gates,
approves or applies. (2) An uncalibrated backend (
llm:emulation) may reorder,never omit. (3) Fail open to the deterministic rule — except anonymization, which
fails safe (
DEC-E008stops a chain). (4) Every judgment is attributable(provider, model, calibrated, latency) in the recall explanation, the run journal,
the loop's
judged_by,areev decideoutput andGET /api/config.Nothing is default-on. With no
--decide/$AREEV_DECIDE, every path isbyte-identical to 1.9.5 (pinned by tests in every crate touched). The keyless
floor and the conformance suite do not move. No new dependency.
Measured (
crates/areev-bench/RESULTS.md§9)Full LoCoMo retrieval, 1,982 questions, lexical-floor recall, Jev via OpenRouter
(
typesafe/jev-1.13-20260917, calibrated) installed as the reranker:1,972 requests, $0.61, 242 s wall at 4 workers. The oracle reaching the pool ceiling
exactly proves the rerank path reaches the metric before any real number is quoted.
Phases in this PR
SearchHit.scoreis the real normalized fused score (was 1.0);MCP
areev_searchrows and bindingsearchrows gainscore; recall deadlinethreaded everywhere (
--recall-deadline-ms);CommandRerank/--rerank-cmd.areev_core::decide(pure types,DEC-E001…E008),areev_llm::decideadapters (typesafe:openrouter:vercel:cloudflare:openjev:systemone:<url>llm:<spec>--decide-cmd), the ordered chain,PseudonymizingDecider; surfaces: global--decide*flags,areev decide,MCP env, Python
set_decider/decide, NodesetDecider/decide,/api/config.areev_store::DecisionRerank(one request perrecall, content-hash LRU), conformance case on both backends,
decide_calibratebench, LoCoMo A/B with oracle control.choicereplaces the keyword lists; per-candidaterelevance
score+ verbatimnoulfeed the allocator (calibrated only may omit/ prefer Full); ASSEMBLE tier drops warn
CAL-W019; the Claude Code recall hookuses it under 1500 ms. Rendering unchanged (
render_paritygreen).executor_uri: "areev://decide", journaled asa Tool execution, edges branch in the frozen grammar,
RUN-E030without abackend), decision-guided fold (index-layer prune before the summarizer),
tool-offer narrowing; manifest pins
decider;run start/resumeandtrigger runwired; packs may carry a decision node (no pin, no warning).areev_loop::DecideBackend+LoopDeciderbridge; GROUND/VERIFY routing number from a calibrated
noul; near-duplicateand non-seeded contradiction sweeps; tool-cause classification; drafts only,
judged_bynever auto-applies;LOP-E051.Gate
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo doc, both binding suites, conformance on Turso + Postgres, perf gates,repo_stats.py --check,check_versions.py. Docs moved with every surface(cookbook §27, mcp-reference, cal-reference, run.md, loop.md, triggers.md,
pack.md, security-model, deployment-profile, ERROR_CODES, CHANGELOG Unreleased).
Follow-ups (deliberately not in this PR)
min_scorein ASSEMBLE saved queries now really filters (scores were all 1.0before); the thresholds in
queries.rswere never tuned against real scores.Decisioncould carry the provider-reportedusage.cost.areev_record_tool_callhas no free-textfailure_detail, so the loop'stool-cause classifier rarely fires from MCP.
disagree with the rendered text; a duplicated
resolve_dbblock in the CLI runsbefore
anonymize scan|test.(
mis-aligned LINKEDIT string pool); build withCARGO_PROFILE_RELEASE_STRIP=nonelocally. CI's toolchain is unaffected so far.Not a release: no version bump, no tag.