feat(7730): prior art and preferences speak only past a cue-swap gate, at most two lines
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 37s
CI & Build / Python tests (push) Failing after 1m35s
CI & Build / integration (push) Successful in 2m1s
CI & Build / Build & push image (push) Skipped
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 37s
CI & Build / Python tests (push) Failing after 1m35s
CI & Build / integration (push) Successful in 2m1s
CI & Build / Build & push image (push) Skipped
A record or preference found by resemblance alone is shown only when the message's score beats all but a set share (default 10%) of the user's own recent cues on that surface and project. The comparison set is the best_available_score already logged per call, so the bar rises with the store by construction and a fixed floor no longer decides. Too few cues to judge by is silence; the searches still run and calibrate the gate. - cue_gate: conformal bar, per (user, surface, project) with a user-wide fallback, cached five minutes; readout for Settings. - Notes arms (auto_inject, write_path) abstain unless the top line passes, show at most two lines, and hold slots to the same bar and cap. - Rule arms hold preference lines to the gate; rules are not gated. - retrieval_logs gains gate_bar and gate_kept (migration 0131). - Turns the harness wrote are refused server-side as well as in the plugin. - Settings: the rate field and a per-surface readout of bar and how often each surface spoke; GET /api/retrieval/gate. - Replay test: on unrelated cues a fixed bar tuned to 5% on a 32-record store fires ~97% on 2,048 records; the gate stays near 10% at both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,24 @@ async def get_surfaces_route():
|
||||
return jsonify({"surfaces": surfaces, "total": len(surfaces)})
|
||||
|
||||
|
||||
@retrieval_bp.route("/gate", methods=["GET"])
|
||||
@login_required
|
||||
async def get_gate_route():
|
||||
"""The cue-swap gate on each surface it holds: the rate it speaks at, the
|
||||
bar that rate comes to on the user's own recent cues, and how often each
|
||||
surface actually spoke over the last week."""
|
||||
from grimoire.services import cue_gate
|
||||
from grimoire.services import retrieval_pipeline as rp
|
||||
|
||||
uid = get_current_user_id()
|
||||
surfaces = [(arm.source, "records") for arm in rp.NOTE_ARMS if arm.gated] + [
|
||||
(arm.source, "preferences") for arm in rp.RULE_ARMS if arm.gates_preferences
|
||||
]
|
||||
rows = await cue_gate.readout(uid, surfaces)
|
||||
return jsonify({"surfaces": rows, "rate": rows[0]["rate"] if rows else cue_gate.RATE_DEFAULT,
|
||||
"lines": cue_gate.LINES, "min_sample": cue_gate.MIN_SAMPLE})
|
||||
|
||||
|
||||
@retrieval_bp.route("/surfaces/<surface>", methods=["PUT"])
|
||||
@login_required
|
||||
async def tune_surface_route(surface: str):
|
||||
|
||||
Reference in New Issue
Block a user