feat(rectification): add adaptive director tool loop

This commit is contained in:
Jesse_Chen
2026-07-31 15:09:03 +08:00
parent a7a11a1a7a
commit 453eacf3e2
11 changed files with 264 additions and 52 deletions
+6 -6
View File
@@ -11,11 +11,11 @@ Before choosing an action, read the contracts in `references/`. Treat `assets/re
## Product boundary
- Current skill version: `birth-time-rectification-v6`.
- Current prompt version: `rectification-director-v2`.
- The scoring algorithm remains `rectification-v5-matrix-scoring-1`; the V6 label describes the conversation contract, not a replacement scoring engine.
- Current skill version: `birth-time-rectification-v8`.
- Current prompt version: `rectification-director-v4`.
- The scoring algorithm remains `rectification-v5-matrix-scoring-2`; the V8 label describes the conversation contract, not a replacement scoring engine.
- The server owns event reconciliation, the real Python scan of every minute in the candidate window, the event contribution matrix, Candidate Snapshots, LOEO/LODO, date sensitivity, neighbor stability, candidate split, jobs, replay, persistence, and final decision validation.
- The Director reads the complete event ledger plus the latest 1012 raw turns, may propose multiple grounded events or revisions, chooses one interview focus, writes the public reply and at most one natural question, and may call up to two allowed read-only diagnostics.
- The evidence pass reads the complete event ledger plus the latest 1012 raw turns to propose grounded events or revisions. The final pass starts with only runtime state and tool availability, then reads Case, candidate scan, evidence gaps, or diagnostics on demand before choosing one focus and writing at most one natural question. The adaptive loop allows up to ten unique read-only tool rounds; each immutable observation may be read only once per Turn.
- Event proposals are not facts until the server validates their source span, declared date, target revision, subject, classification, and scoreability. The Director never creates scores, candidate minutes, Case state, database mutations, or profile updates.
- VedAstro is a read-only post-validation gate for `v5_agent` only. It runs only after the local stability and range-eligibility gates pass, compares the server-provided primary and runner-up, and never replaces V5 local scoring or lets SearchEvents choose the final candidate.
- Candidate windows are inclusive. When `start_time > end_time`, the Python scan continues across midnight into the next calendar day; equal endpoints mean one candidate minute, and a window may not exceed 1,440 minutes.
@@ -53,9 +53,9 @@ Before choosing an action, read the contracts in `references/`. Treat `assets/re
## Turn strategy
1. Read the complete Case Dossier: recent raw turns, full revision ledger, current target disposition, pending evidence, candidate contrasts, event sensitivity, and range gate.
1. During evidence interpretation, read the complete Case Dossier: recent raw turns, full revision ledger, current target disposition, pending evidence, candidate contrasts, event sensitivity, and range gate. During final planning, do not assume those server-owned views are already loaded; request only the focused tool observations needed for the decision.
2. Propose every explicit event in the latest answer. Use exact source spans and declared date text; propose `revise` only with a server-issued event ID already present in the Dossier.
3. After the server stages valid revisions and recomputes diagnostics, choose the single most useful focus. The Dossier includes unresolved Pending Evidence and prior declined domains; use up to two read-only diagnostics when one result is not enough. Do not rotate through domains or ask for finer dates unless the diagnostics show value.
3. After the server stages valid revisions and recomputes diagnostics, choose the single most useful focus. Read focused server observations through `case_read`, `candidate_scan`, `evidence_gap`, or `diagnostic_read`; each result advances the in-run Dossier revision and must inform the next decision. Stop the loop as soon as the evidence supports one useful question, a gated range, or an honest low-confidence result. Do not rotate through domains or ask for finer dates unless the observations show value.
4. Write one short natural question and the public reply in the same TurnPlan. Do not expose internal IDs, scores, contribution details, tools, or candidate minutes.
5. If server validation rejects the TurnPlan, repair it once. If it still fails, accept the generic safety fallback. Offer a range only when the current server Snapshot allows it; otherwise stop honestly at low confidence when no useful question remains.
@@ -2,10 +2,10 @@
## Version and ownership
- Skill: `birth-time-rectification-v6`.
- Prompt: `rectification-agent-v6-1`.
- Algorithm: `rectification-v5-matrix-scoring-1` remains unchanged.
- V6 changes the conversation and semantic-question contracts; it does not replace the V5 candidate engine.
- Skill: `birth-time-rectification-v8`.
- Prompt: `rectification-director-v4`.
- Algorithm: `rectification-v5-matrix-scoring-2` remains unchanged.
- V8 changes the conversation and semantic-question contracts; it does not replace the V5 candidate engine.
- The server owns candidate-minute scanning, the event contribution matrix, Candidate Snapshots, diagnostics, stability gates, Decision Validator, deterministic fallback, Jobs, claim/lease, completed-job replay, atomic completion, idempotency, and persistence.
- Preserve `v4_legacy`, `v5_shadow`, and `v5_agent` deployment behavior. Shadow artifacts must not change the legacy visible reply.
@@ -21,9 +21,10 @@ When evidence is sparse, conflicting, tied, date-sensitive, or unstable, stop or
The agent may only:
1. select one active server-generated semantic question opportunity;
2. call at most one permitted read-only diagnostic;
3. offer a server-generated candidate range that has passed the public gate; or
4. stop with low confidence.
1. propose grounded evidence from the latest answer;
2. choose and directly write one safe interview question;
3. adapt through up to ten unique permitted read-only tool rounds;
4. offer a server-generated candidate range that has passed the public gate; or
5. stop with low confidence.
The agent must not create or alter events, normalized dates, candidate minutes, scores, diagnostic results, or profile birth data.
The final planning prompt exposes only the current runtime revision, prior tool observations, capabilities, and tool availability; it does not preload Case, candidate hypotheses, gap, or diagnostic payloads. The available read-only tools are `case_read`, `candidate_scan`, `evidence_gap`, and `diagnostic_read`; they expose the current authoritative server projection on demand. Every successful call becomes an immutable Observation in the in-run Dossier, increments its revision, and is visible to the next Director round. The agent must not create or alter events, normalized dates, candidate minutes, scores, diagnostic results, or profile birth data.