One row in the local candidate queue. Mirrors SkillRecord but
drops the engine flags that aren’t actionable for a pending rule
and adds the ingest-time provenance we surface in the UI.
Return value of update_confidence so the caller can render a
before/after message (“rule X: 0.65 → 0.70”). 2026-04-25: previously
returned (), which made the feedback loop feel inert from the
user’s POV. The before/name fields piggy-back on the SELECT we now
do anyway to compute the clamped after value.
Lightweight metadata for recall/search flows. Returns just enough to
explain why a rule surfaced
(file_patterns + canonical source_repo). Uses dynamic SQL so it doesn’t pin
the sqlx offline cache to current schema.
Confidence ceiling for conversation-channel rules. Agent-captured rules get
a fidelity discount relative to manually curated local memory, and the cap
prevents a looping agent from pushing one past manual rules in ranking.
Hard daily limit. At 50 captures in one day the most likely cause is
an agent stuck in a loop calling remember_rule over and over —
blocking protects the user’s rule corpus from being polluted faster
than they can audit it. Reset is per-calendar-day local time.
Dedup window size in milliseconds. Identical content-hash captures
within this window collapse into a single soft-accept bump so an
agent in a tight loop cannot stack many +0.05 increments on one
rule.
Soft warning threshold — at this count, MCP/CLI surfaces tell the
user “you’ve captured a lot today, are you sure?” without blocking.
Picked at 10 because the median user is unlikely to record more than
a handful of rules in one session; ten is a strong signal of either
an agent runaway or a deliberate batch import.
Cloud review memory is agent-agnostic: once a team rule is synced
locally, Codex/Cursor/Gemini should get the same protection Claude
gets. Older syncs wrote only enabled_for_claude=1, which made the
CLI look full of rules while Codex MCP recall returned nothing.
Re-stamp skills.confidence_score for every row whose tags carry a
cluster-size:N / severity:X evidence signal but whose score is
still at the historic flat default (0.7). Returns the number of
rows updated. Tight tolerance (±0.001) so user-customized scores
like 0.65 / 0.75 are left alone.
How many conversation-channel captures landed today. Used both for
the rate-limit warn threshold and for surfacing captures_today on
the outcome so callers can render guidance like “12/50 today, getting
close to the cap”. Returns 0 for non-conversation origins (the rate
limit only protects against agent runaway).
Count pending candidates, optionally filtered to a repo. Cheaper than
list_candidates(...).len() when the caller only needs the total
(e.g. the “+N more — --limit 0 to see all” hint in candidates list).
Insert a rule via remember() and downgrade it to status='pending'
so MCP doesn’t serve it. Used by import/extraction flows to land agent
memory as drafts pending review. Idempotent: dedup paths in
remember() may return an existing row; if that row was already
active we leave it alone (the user already reviewed it).
Insert a rule as a status='pending' draft, seeding its
confidence_score from a caller-computed value (e.g. the import gate’s
capture_confidence) instead of the flat conversation default.