Candidate Reference Resolution Engine #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement the candidate reference resolution engine (
POST /v1/resolve/life resolve), providing deterministic exact matching over live calendar candidates, calibrated Jevreference_match.v1semantic judgment for ambiguous phrases, explicit candidate pool narrowing disclosures, and interactive clarification (exit code 3) when uncertainty remains. Strictly enforce that semantic confidence never authorizes mutations.Background & Technical Rationale
Users and AI agents frequently refer to tasks or calendar events using informal titles, conversational paraphrases, or partial keywords (e.g., "finish portfolio outline", "weekly sync"). To enable safe operations without hardcoding fragile lookups, the candidate reference resolution engine maps informal references to an authoritative calendar item ID (
itm_...) and currentETag.The design enforces strict architectural invariants:
method: "deterministic".no_matchoption.candidate_narrowed. If narrowing could exclude the intended reference, the engine prompts the user to narrow scope rather than treating the top candidate as exhaustive.no_match, when the probability distribution is uncalibrated/ambiguous, when multiple candidates tie, or when Jev is unavailable, the engine returnsstatus: "error"with codeclarification_required(orneeds_clarificationstructure in HTTP 200 data, terminating with CLI exit code 3).stateobject as untrusted data, never interpolated into Jev system instructions or rubrics.--input -) to prevent leaking private information into process argument lists (argv).Exact Technical References & Specifications
Normative Question Specification
From
docs/technical/jev.md(lines 15, 23–25, 32):CLI & API Route Contract
From
docs/technical/cli-api.md(lines 41, 57, 88, 113, 127):life resolve --text TEXT --kind task|eventtext,kind(task|event); optionalcollection_ids.item_id,etag,method(deterministic|semantic), candidate narrowing and judgment provenance; or clarification.--textis for short non-sensitive references; resolve also accepts--input -with{text, kind}instead of those flags to avoid private text inargv.clarification_required: Resolve ambiguity; exit code 3.candidate_narrowed,judgment_unavailable.Verification Scenario W05
From
docs/technical/verification.md(lines 19):What to Build
1.
src/domain/resolve.rskind: task, active/upcoming events forkind: event).textmatches any item'sidoruidexactly.text.trim().to_lowercase()equals any item'stitle.trim().to_lowercase().ResolveOutcome::Resolvedwithmethod: ResolveMethod::Deterministic, zero calls to Jev.> 20, take top 20 candidates and record warningcandidate_narrowed.ResolveOutcome::NeedsClarificationwith empty candidates and a prompt to rephrase.NeedsClarificationreturning the top candidates withjudgment_unavailablewarning.reference_match.v1(choiceprimitive) with candidate item IDs mapped to item titles/details, plus the fixed optionno_match: "None of the above candidates match the user reference".state.user_reference.JevClient.no_matchor choice has ambiguity: returnNeedsClarificationwith candidate choices.docs/technical/jev.md:32, 59–61), semantic reference matches require user clarification; returnNeedsClarificationwith candidate choices and judgment provenance. Only with an explicit evaluated and approved threshold can confidence above that threshold returnResolved.2.
src/jev/questions/reference_match.rsreference_match.v1Jev question:state.candidates, NEVER interpolated into the criteria rubrics (docs/technical/jev.md:21).3. Axum API Endpoint (
src/api/routes/resolve.rs)POST /v1/resolve.ResolveRequestfrom JSON body.4. CLI Subcommand (
src/cli/commands/resolve.rs)life resolve:--text <TEXT>,--kind <task|event>,--collection <ID>,--input -,--json.{ "text": "...", "kind": "task" }from stdin (--input -).clarification_required, prints candidate choices to stderr/stdout and exits with code 3.Acceptance Criteria
method: "deterministic"without calling Jev (Scenario W05).reference_match.v1; if ambiguous or uncertain, returnsneeds_clarification(Exit code 3) without mutating any state (Scenario W05).needs_clarificationwith candidate choices and exit code 3; confidence alone does not authorize resolution.needs_clarificationenvelope with questions and candidates.no_match.candidate_narrowed.--input -are processed identically without exposing text in process arguments.Notes
reference_match.v1plus the resolve route/CLI only; the remaining families and the advisory fallback policy landed in #21.no_match= 20 total, the stricter reading of Life's ownMAX_CHOICE_CANDIDATES, with exclusions disclosed ascandidate_narrowed.Cargo.tomlauthors chore stays pending.Blocked by
Issue #020: Candidate Reference Resolution Engineto Candidate Reference Resolution Engine