fix(rectification): collect dated events, then distinguish with conflict probes

Empty ledgers stay in natural-language collection. After the first dated
event, dasha conflict probes reverse-infer 前事 and block offer until
answered. Unique-minute confirmation stays closed at a representative
time; adopt reverse-verifies remaining probes. Records BUG-348–351.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-22 10:37:40 +08:00
co-authored by Cursor
parent 92558ee61d
commit 9873ba420a
41 changed files with 2371 additions and 310 deletions
+64
View File
@@ -5259,3 +5259,67 @@
- 复发自:BUG-346(打开思维链通道但明确不落盘)
- 修复版本:59559d4b
## BUG-348 | 生时纠正一进场就出 A/B/C/D,比纯提问更慢
- 状态:resolved
- 首次发现:2026-08-22
- 最近更新:2026-08-22
- 影响面:staging 生时纠正开场、`method_followup_plan`、`rectification-choice-card`、Skill `jyotish-birth-time-rectification@10.0.11`、decision receipt `discriminating_event_probes`
- 用户现象:账本还没有任何已确认证据时,开场就出现 A/B/C/D 点选卡(学业 vs 工作)。用户点 A 之后仍没有具体年份事件,下一问又变成“2016 年前后,更像哪一件?”——A/B 是认真关系 vs 职责加重,或“时间大致对得上 vs 略偏”。比之前直接问一件带年份的经历更慢,也无法筛时间。
- 触发条件:新建或恢复空账本生时纠正会话;不确定范围约半小时,例如 04:45–05:15。有账本后候选仍分不开时继续出冲突排序卡。
- 根因:conversation-strategy 把“降低回忆负担”写成开场就从候选簇差异生成点选卡。`buildMethodFollowupPlan` 对空账本的 `dasha_events` 以及后续方法覆盖一律挂 `choice_frame`;系统提示强制把 A/B 写成两套盘前事。区分阶段用 `lifePeriodLabel()` 把别的事件年份贴到当前主题,并让用户给冲突排序,而不是收集可评分生平。评分链路已有 `_score_event`,但没有逆运算把两套代表分钟的年差/激活差写成可问题干。
- 修复:收集阶段用自然语言问一件带大概年份的经历,`choice_frame` 为 null,界面不出点选卡。候选已经分不开时,服务器生成 `discriminating_event_probes`(锁定年份和事件家族,不写死题干)。Agent 把题干和 A/B/C/D 写成自然语言;A/B 是同一件事的吻合程度。新 Case 绑定 Skill 10.0.11;已有 10.0.10 Case 保持原绑定,但服务器不再给空账本发点选框,也不再问两套盘哪个更像。
- 验证:`tests/test_rectification_event_probes.py` 锁定高考性质追问、年龄带退路、D4 激活差问搬家、大运起年只差几天不得写成新年、缺 Narayana 不得声称 dasha 年;`frontend/tests/rectification-choice-card.test.ts` 锁定空账本无卡、探针题干不含“更像哪一件”、跨主题不复用年份;`frontend/tests/rectification-eight-method.test.ts` 锁定方法覆盖用自然语言、分盘差异仍出 A/B/C/D。
- 防复发:空账本或 `collect_method_evidence` 不得挂 `choice_frame`。区分卡不得写“更像哪一件 / 两套盘 / 可能性”。年份必须来自探针或同主题账本/年龄带,禁止跨主题 `lifePeriodLabel`。不得把已哈希的 10.0.10 改包;未提交的 10.0.11 可折进同包。已有 10.0.10 Case 继续可解析。
- 相关记录:BUG-020、BUG-337
- 复发自:BUG-020(语言问答被包装成高阻力卡片;后来又把开场改成强制 A/B/C/D)
- 修复版本:待提交
## BUG-349 | 唯一分钟确认门被 holdout 吊着,会话没有收口
- 状态:resolved
- 首次发现:2026-08-22
- 最近更新:2026-08-22
- 影响面:确认门投影、`session_outcome`、采用卡文案、Skill `jyotish-birth-time-rectification@10.0.11`、decision receipt `unique_minute_path`
- 用户现象:采用代表性时间之后,界面和 Agent 仍说“还不能确认唯一分钟”,像下一步还要等 VedAstro / 公开 holdout / 宽度 ≤ 5 分钟。holdout 当前是 1/20 `not_ready`,确认门永远打不开,访谈没有终点。
- 触发条件:生时纠正已经可以出示或采用代表性时间;密封 holdout 为 `not_ready`。
- 根因:确认门三层 blocker 是诚实的 fail-closed,但产品把 `confirmation_allowed=false` 写成待完成的下一步,而不是本会话的终点。`candidate_accepted` 还写着“可进入确认门”。
- 修复:不放开 `confirmation_allowed`。`confirmation_gate.unique_minute_path=closed_at_representative` 时,本会话以代表性时间收口;不得调用 confirm,不得把唯一分钟确认当下一步。文案从“还不能确认”改为“本会话以代表性时间收口,不确认唯一分钟”。折进未提交的 Skill 10.0.11,不改已哈希的 10.0.10。
- 验证:`frontend/tests/rectification-confirmation-gate.test.ts` 锁定 holdout `not_ready` 时 `unique_minute_path=closed_at_representative` 且 `confirmation_allowed=false`;`tests/test_rectification_confirmation_and.py` 锁定 14 分钟并列簇提出门开、确认门关、路径为收口。
- 防复发:不得把 `confirmation_allowed` 改成 true 来假装收口。holdout 未达标时不得把确认写成下一步。不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。
- 相关记录:BUG-303、BUG-318、BUG-348
- 复发自:BUG-318(确认门与密封 holdout 对齐后,产品仍把确认当未完成步骤)
- 修复版本:待提交
## BUG-350 | 采用代表性时间后没有按该分钟核对前事,也无法改选
- 状态:resolved
- 首次发现:2026-08-22
- 最近更新:2026-08-22
- 影响面:`method_followup_plan` 采用后路由、`next_user_action`、生时纠正候选卡、Skill `jyotish-birth-time-rectification@10.0.11`
- 用户现象:用户采用一个代表性时间后,会话直接请看盘;盘外核对也不计分、不改候选。没有用该分钟去核几件还没提过的前事,对不上也不能改选其他冲突时间。
- 触发条件:生时纠正已经采用代表性时间;decision receipt 仍有 `discriminating_event_probes`(大运年界/同年激活差或年龄带退路)。
- 根因:`buildMethodFollowupPlan({ accepted: true })` 把下一问清空,只挂不计分的 `oos_blind`。`buildNextUserAction` 在 adopted 后一律 `start_consultation`。候选卡又要求 `!selectedTime`,采用后改选入口消失。
- 修复:采用后最多核两件剩余探针前事(跳过已确认/已拒绝领域和 `known_event_quality`),`next_followup.method_id=reverse_verify` 且计分。A 写入账本并重算;C 关闭该问;对不上或核对结束后可改选。不打开唯一分钟确认门。折进未提交的 Skill 10.0.11。
- 验证:`frontend/tests/rectification-eight-method.test.ts` 锁定采用后 `verify_adopted_time` 与无剩余探针时 `start_consultation`;`frontend/tests/rectification-choice-card.test.ts` 锁定核对卡计分且不是盘外核对;`frontend/tests/rectification-agentic-entry.test.ts` 锁定有点选卡时先核前事、否则在已 offer 过的会话里显示改选。
- 防复发:采用后不得把不计分盘外核对当默认下一步。`showSelectionCards` 不得因 `selectedTime` 永久藏改选;有前事点选卡时不得同时出示时间卡。不得把 `confirmation_allowed` 改成 true。
- 相关记录:BUG-120、BUG-348、BUG-349
- 复发自:BUG-120(采用后无法改选;后来又把采用后的核对做成不计分盘外问句)
- 修复版本:待提交
## BUG-351 | 候选时间冲突时反推前事被方法轮询和出牌 defer 挡住
- 状态:resolved
- 首次发现:2026-08-22
- 最近更新:2026-08-22
- 影响面:`method_followup_plan`、`isOfferBlockingFollowup`、Skill `jyotish-birth-time-rectification@10.0.11`
- 用户现象:账本已有带年份经历、两套代表分钟已经分不开时,Agent 仍继续问下一条感情/事业,或直接请采用代表性时间。不会按冲突分钟反问「某年前后有没有搬家/入职」,答案也无法先筛窗。
- 触发条件:生时纠正已有至少一件可评分事件;decision receipt 含 `dasha_boundary` 或 `dasha_activation` 探针;方法覆盖尚未齐,或 `propose_allowed` 已开。
- 根因:第一件带日期事件之后下一问固定走感情 → 事业 → 家人 → 职业。精度阶段/分盘差异问句不挡出牌,`session_outcome=adopt_representative` 时把它们放进 `deferred_followup`。探针年份锁在 choice_frame 里,但问句轮不到。
- 修复:已有带日期事件且仍有大运冲突探针时,`source=event_probe` 先问该年前事并挡住出牌。A 写入并重算以筛窗。年龄带探针不插队。空账本仍只自然语言收集。不打开唯一分钟确认门。折进未提交的 Skill 10.0.11。
- 验证:`frontend/tests/rectification-eight-method.test.ts` 锁定教育事件 + 事业激活探针先问 2018 年入职且 `session_outcome` 保持收集;年龄带探针不插在感情收集前。
- 防复发:大运冲突探针在采用前必须挡住出牌。不得在空账本挂 `choice_frame`。不得把 `confirmation_allowed` 改成 true。
- 相关记录:BUG-348、BUG-350
- 复发自:BUG-348(收集后再区分;区分问句被方法轮询和出牌 defer 排到采用之后)
- 修复版本:待提交
@@ -89,7 +89,7 @@ function RectificationCandidateCards({
<section className="rectification-candidates" aria-label="生时校正候选时间">
<div className="rectification-candidates-heading">
<strong>当前可能的出生时间</strong>
<span>这次校正的结果是采用一个代表性时间作当前排盘。相邻分钟目前分不开,还不能确认唯一分钟。可以先采用,也可以继续补充事件或改选;新增证据后,候选和相对支持度会重新计算。</span>
<span>这次校正的收口是采用一个代表性时间作当前排盘。相邻分钟目前分不开,本会话以代表性时间收口,不确认唯一分钟。可以先采用,也可以继续补充事件或改选;新增证据后,候选和相对支持度会重新计算。</span>
<span>相对支持度不是统计概率;采用不等于确认出生时间,也不会覆盖原始填报时间。</span>
</div>
<div className="rectification-candidate-list">
@@ -740,7 +740,7 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
&& Boolean(message.turnId)
&& Boolean(message.text)
))?.renderKey;
const latestOfferMessage = [...messages]
const latestSettledAssistant = [...messages]
.reverse()
.find((message) => (
message.role === "assistant"
@@ -748,27 +748,29 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
&& !message.failed
&& Boolean(message.text)
));
const showSelectionCards = Boolean(
candidateResult?.selectionAllowed
&& !candidateResult.selectedTime
&& latestOfferMessage
&& turnOfferedSelection(latestOfferMessage)
&& !busy
&& regeneratingMessageKey === null,
);
const offeredSelectionOnce = messages.some(turnOfferedSelection);
const offeredThisTurn = Boolean(latestSettledAssistant && turnOfferedSelection(latestSettledAssistant));
const showChoiceCards = Boolean(
choiceCard
&& latestOfferMessage
&& !showSelectionCards
&& latestSettledAssistant
&& !offeredThisTurn
&& !busy
&& !readonly
&& regeneratingMessageKey === null,
);
const selectionCardMessageKey = showSelectionCards && latestOfferMessage
? latestOfferMessage.renderKey
const showSelectionCards = Boolean(
candidateResult?.selectionAllowed
&& offeredSelectionOnce
&& latestSettledAssistant
&& !showChoiceCards
&& !busy
&& regeneratingMessageKey === null,
);
const selectionCardMessageKey = showSelectionCards && latestSettledAssistant
? latestSettledAssistant.renderKey
: undefined;
const choiceCardMessageKey = showChoiceCards && latestOfferMessage
? latestOfferMessage.renderKey
const choiceCardMessageKey = showChoiceCards && latestSettledAssistant
? latestSettledAssistant.renderKey
: undefined;
const canSend = !busy && !readonly && !regeneratingMessageKey;
@@ -882,7 +884,7 @@ export function RectificationAgenticChat(props: RectificationAgenticChatProps) {
{savedTime && (
<div className="rectification-saved-wrap">
<p className="rectification-saved" role="status">
{savedStatus === "confirmed" ? "已确认校正时间" : "当前排盘时间(代表性候选,还不能确认唯一分钟)"}:{savedTime}。后续排盘将使用该时间;你仍可继续补充事件或改选其他候选。
{savedStatus === "confirmed" ? "已确认校正时间" : "当前排盘时间(代表性时间,本会话不确认唯一分钟)"}:{savedTime}。后续排盘将使用该时间;你仍可继续补充事件或改选其他候选。
</p>
{savedStatus === "accepted" && onStartConsultation && (
<div className="rectification-consult-handoff">
@@ -72,7 +72,13 @@ export function ConfirmationGateDisclosure({
<details className="technique-audit">
<summary>
唯一分钟确认门
<small>{gate.confirmation_allowed ? "已允许" : "未允许"}</small>
<small>
{gate.confirmation_allowed
? "已允许"
: gate.unique_minute_path === "closed_at_representative"
? "以代表性时间收口"
: "未允许"}
</small>
</summary>
<div className="technique-audit-panel">
<table>
@@ -89,4 +89,4 @@ export function evidenceWritesAllowed(
export const MAX_RESUMABLE_CASES_PER_USER = 1;
export const RECTIFICATION_SKILL_NAME = "jyotish-birth-time-rectification";
export const RECTIFICATION_SKILL_VERSION = "10.0.10";
export const RECTIFICATION_SKILL_VERSION = "10.0.11";
@@ -7,6 +7,7 @@
* option copy, and never parses A/B/C/D out of assistant prose.
*/
import type { DiscriminatingEventProbe } from "./refinement-packet";
import type { InternalVargaObservation } from "./varga-observations";
export const CHOICE_MODE = "A/B/C/D";
@@ -69,14 +70,38 @@ export type ChoiceCardFollowup = Readonly<{
export type ChoiceCardEvidence = Readonly<{
status: string;
domain?: string;
datePrecision: string;
occurredFrom: string | null;
occurredTo: string | null;
}>;
const PRIMARY_C = "没有明显发生";
const PRIMARY_C_BOTH = "两件都没有明显发生";
const SECONDARY_D = "不记得 / 不确定";
const OPTION_A = "是,大概就在那段时间";
const OPTION_B = "有类似,但年份不对或不够重大";
const AGE_BAND: Record<string, { lo: number; hi: number; family: string; varga: string | null }> = {
education: { lo: 16, hi: 18, family: "升学、高考、转学或学习环境变化", varga: "D5 / D24" },
relocation: { lo: 18, hi: 24, family: "搬家、离乡或长期异地", varga: "D4" },
relationship: { lo: 21, hi: 26, family: "认真关系进入、结束或关系观明显转变", varga: "D9" },
career: { lo: 22, hi: 30, family: "入职、升职或职责明显加重", varga: "D10" },
family: { lo: 18, hi: 30, family: "家人相关的明显变化", varga: "D12 / D7 / D3" },
finance: { lo: 22, hi: 32, family: "收入、资产或财务明显变化", varga: "D2 / D11" },
health_pressure: { lo: 16, hi: 40, family: "健康、事故或持续压力明显变化", varga: "D30" },
};
const THEME_DOMAIN: Record<string, string> = {
relationship_style: "relationship",
career_style: "career",
home_change: "relocation",
education_style: "education",
family_event: "family",
finance_change: "finance",
health_pressure: "health_pressure",
dated_event: "education",
oos_blind: "family",
};
function yearFrom(value: string | null): number | null {
const year = value?.slice(0, 4);
@@ -91,24 +116,61 @@ function isConfirmedDated(item: ChoiceCardEvidence): boolean {
&& Boolean(item.occurredFrom || item.occurredTo);
}
export function lifePeriodLabel(evidence: readonly ChoiceCardEvidence[]): string {
export function lifePeriodLabel(
evidence: readonly ChoiceCardEvidence[],
domain?: string | null,
): string {
const years = evidence.flatMap((item) => {
if (!isConfirmedDated(item)) return [];
if (domain && item.domain !== domain) return [];
const from = yearFrom(item.occurredFrom);
const to = yearFrom(item.occurredTo);
return [from, to].filter((value): value is number => value !== null);
});
if (years.length === 0) return "按还在比的两套盘";
if (years.length === 0) return "那段时间";
const min = Math.min(...years);
const max = Math.max(...years);
return min === max ? `${min} 年前后` : `${min}–${max} 年这段里`;
}
function layerDiffers(
observations: readonly InternalVargaObservation[] | undefined,
layer: InternalVargaObservation["layer"],
): boolean {
return observations?.some((item) => item.layer === layer && item.candidates_differ) === true;
function followupDomain(followup: ChoiceCardFollowup): string | null {
if (followup.domain) return followup.domain;
return THEME_DOMAIN[followup.ask_theme] ?? null;
}
function pickProbe(
probes: readonly DiscriminatingEventProbe[] | undefined,
domain: string | null,
): DiscriminatingEventProbe | null {
if (!probes?.length) return null;
if (domain) {
const matched = probes.find((item) => item.domain === domain);
if (matched) return matched;
}
return probes[0] ?? null;
}
function ageBandPeriod(birthDate: string | null | undefined, domain: string | null): string {
const year = yearFrom(birthDate ?? null);
const band = domain ? AGE_BAND[domain] : null;
if (year && band) return `${year + Math.floor((band.lo + band.hi) / 2)} 年前后`;
return "那段时间";
}
function periodFor(
evidence: readonly ChoiceCardEvidence[] | undefined,
domain: string | null,
probes: readonly DiscriminatingEventProbe[] | undefined,
birthDate?: string | null,
): string {
const probe = pickProbe(probes, domain);
if (probe) return probe.year_label;
if (domain && (evidence ?? []).some((item) => item.domain === domain && isConfirmedDated(item))) {
return lifePeriodLabel(evidence ?? [], domain);
}
const band = ageBandPeriod(birthDate, domain);
if (band !== "那段时间") return band;
return lifePeriodLabel(evidence ?? [], domain);
}
type Hypothesis = Readonly<{
@@ -120,14 +182,19 @@ type Hypothesis = Readonly<{
neither: string;
}>;
function competingRelationshipCareer(period: string): Hypothesis {
function eventHypothesis(
period: string,
family: string,
why: string,
varga: string | null,
): Hypothesis {
return {
prompt: `${period},更像哪一件?`,
why: "两套还在比的盘,一套更指向认真关系,另一套更指向职责压力。",
varga: "D9 / D10",
a: "认真关系进入或结婚,时间和这件事差不多",
b: "工作职责明显加重,时间和这件事差不多",
neither: PRIMARY_C_BOTH,
prompt: `${period},有没有明显${family}?`,
why,
varga,
a: OPTION_A,
b: OPTION_B,
neither: PRIMARY_C,
};
}
@@ -135,87 +202,10 @@ function hypothesisFor(
followup: ChoiceCardFollowup,
observations: readonly InternalVargaObservation[] | undefined,
evidence: readonly ChoiceCardEvidence[] | undefined,
probes?: readonly DiscriminatingEventProbe[],
birthDate?: string | null,
): Hypothesis {
const period = lifePeriodLabel(evidence ?? []);
const d9 = layerDiffers(observations, "d9");
const d10 = layerDiffers(observations, "d10");
const theme = followup.ask_theme;
if (theme === "oos_blind") {
const domainTheme = followup.domain === "relationship"
? "relationship_style"
: followup.domain === "career"
? "career_style"
: followup.domain === "education"
? "education_style"
: followup.domain === "relocation"
? "home_change"
: "family_event";
const domainHypothesis = hypothesisFor(
{ ...followup, ask_theme: domainTheme },
observations,
evidence,
);
return {
...domainHypothesis,
why: "这是采用后的盘外核对,答案不会改候选分数。",
};
}
if (
d9 && d10
&& (theme === "dated_event" || theme === "relationship_style" || theme === "career_style")
) {
return competingRelationshipCareer(period);
}
if (theme === "relationship_style" || followup.domain === "relationship") {
return {
prompt: `${period},感情上更像哪一件?`,
why: "还在比的盘在关系主题上分不开。",
varga: "D9",
a: "认真关系进入或结婚,时间大致对得上",
b: "有接近的感情变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "career_style" || followup.domain === "career") {
return {
prompt: `${period},工作上更像哪一件?`,
why: "还在比的盘在事业主题上分不开。",
varga: "D10",
a: "入职、升职或职责明显加重,时间大致对得上",
b: "有接近的工作变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "family_event" || followup.domain === "family") {
return {
prompt: `${period},家里更像哪一件?`,
why: "还在比的盘在家人主题上分不开。",
varga: "D12 / D7 / D3",
a: "家人相关的明显变化,时间大致对得上",
b: "有接近的家人变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "home_change" || followup.domain === "relocation") {
return {
prompt: `${period},住处更像哪一件?`,
why: "居所盘仍会换升。",
varga: "D4",
a: "搬家或长期异地,时间大致对得上",
b: "有接近的住处变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "education_style" || followup.domain === "education") {
return {
prompt: `${period},学业或责任上更像哪一件?`,
why: "成就盘或学业盘仍会换升。",
varga: "D5 / D24",
a: "升学、考试或被委以责任,时间大致对得上",
b: "有接近的学业或责任变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "occupation") {
return {
prompt: "长期工作更像哪一类?",
@@ -236,26 +226,6 @@ function hypothesisFor(
neither: "没有专门问起过",
};
}
if (theme === "finance_change") {
return {
prompt: `${period},财务上更像哪一件?`,
why: "你主动提过财务变化,当前候选在这条线上还分不开。",
varga: "D2 / D11",
a: "收入、资产或财务明显变化,时间大致对得上",
b: "有接近的财务变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "health_pressure") {
return {
prompt: `${period},身体或压力上更像哪一件?`,
why: "你主动提过健康或压力变化。这不是医学判断。",
varga: "D30",
a: "健康、事故或压力明显变化,时间大致对得上",
b: "有接近的变化,但时间略偏或不够重大",
neither: PRIMARY_C,
};
}
if (theme === "nakshatra_trait") {
return {
prompt: "近年处事方式更像哪一组?",
@@ -267,23 +237,37 @@ function hypothesisFor(
};
}
if (theme === "active_focus") {
return {
prompt: "刚才那件待确认的经历,更像哪一种?",
why: "先承接当前问题,不要另开领域清单。",
varga: null,
a: "明确有,且时间大致吻合",
b: "有类似,但时间略偏或不够重大",
neither: PRIMARY_C,
};
const domain = followup.domain;
const probe = pickProbe(probes, domain);
const period = probe?.year_label ?? lifePeriodLabel(evidence ?? [], domain);
return eventHypothesis(
period,
probe?.event_family ?? "刚才那件待确认的经历",
probe?.user_meaning ?? "先承接当前问题,不要另开领域清单。题干自己写。",
probe ? AGE_BAND[probe.domain]?.varga ?? null : null,
);
}
return {
prompt: `${period},更像哪一类带大概时间的经历?`,
why: "先从最好记的一件带时间的经历分开两套盘。",
varga: "本命 Dasha + 行运",
a: "学业、考试或环境变化,记得大概年份",
b: "工作或职责变化,记得大概年份",
neither: PRIMARY_C_BOTH,
};
const domain = followupDomain(followup);
const probe = pickProbe(probes, domain);
const family = probe?.event_family
?? (domain ? AGE_BAND[domain]?.family : null)
?? "带大概年份的经历";
const varga = probe
? AGE_BAND[probe.domain]?.varga ?? null
: domain
? AGE_BAND[domain]?.varga ?? null
: "本命 Dasha + 行运";
const period = periodFor(evidence, domain, probes, birthDate);
const reverse = followup.method_id === "reverse_verify";
const holdout = theme === "oos_blind";
const why = reverse
? "按当前采用时间核对一件前事。对得上写入账本并重算;对不上可以改选其他候选。不确认唯一分钟。题干自己写,年份不得发明。"
: holdout
? "这是采用后的盘外核对,答案不会改候选分数。题干自己写。"
: probe?.user_meaning
?? "用一件带年份的具体生平分开还在比的时间窗。题干自己写,年份不得发明。";
void observations;
return eventHypothesis(period, family, why, varga);
}
export function buildChoiceFrame(
@@ -291,15 +275,24 @@ export function buildChoiceFrame(
input: {
observations?: readonly InternalVargaObservation[];
evidence?: readonly ChoiceCardEvidence[];
probes?: readonly DiscriminatingEventProbe[];
birthDate?: string | null;
scoring?: boolean;
} = {},
): RectificationChoiceFrame {
const scoring = input.scoring !== false;
const hypothesis = hypothesisFor(followup, input.observations, input.evidence);
const hypothesis = hypothesisFor(
followup,
input.observations,
input.evidence,
input.probes,
input.birthDate,
);
const domain = followupDomain(followup);
return {
question_id: `${followup.method_id}:${followup.ask_theme}:${scoring ? "score" : "holdout"}`,
method_id: followup.method_id,
period: lifePeriodLabel(input.evidence ?? []),
period: periodFor(input.evidence, domain, input.probes, input.birthDate),
varga: hypothesis.varga,
why: hypothesis.why,
option_a_hint: hypothesis.a,
@@ -40,8 +40,17 @@ export type ConfirmationGateBlocker = Readonly<{
sealed_benchmark_id?: string;
}>;
export type UniqueMinutePath = "closed_at_representative" | "awaiting_user_consent";
export const UNIQUE_MINUTE_CLOSED_COPY = "本会话以代表性时间收口,不确认唯一分钟";
export function uniqueMinutePath(confirmationAllowed: boolean): UniqueMinutePath {
return confirmationAllowed ? "awaiting_user_consent" : "closed_at_representative";
}
export type ConfirmationGate = Readonly<{
confirmation_allowed: boolean;
unique_minute_path: UniqueMinutePath;
blockers: readonly ConfirmationGateBlocker[];
}>;
@@ -65,7 +74,7 @@ export function sessionOutcomeView(kind: SessionOutcomeKind): SessionOutcome {
if (kind === "adopt_representative") {
return {
kind,
user_meaning: "这次校正的结果是采用代表性时间作当前排盘,还不能确认唯一分钟。",
user_meaning: `这次校正的收口是采用代表性时间作当前排盘。${UNIQUE_MINUTE_CLOSED_COPY}。`,
};
}
return {
@@ -161,6 +170,7 @@ export function buildConfirmationGate(input: {
return {
confirmation_allowed: confirmationAllowed,
unique_minute_path: uniqueMinutePath(confirmationAllowed),
blockers: [
{
id: "vedastro_minute_sensitive",
@@ -184,7 +194,9 @@ export function buildConfirmationGate(input: {
top_1_rate: SEALED_MINUTE_HOLDOUT.top_1_rate,
confirmation_coverage_rate: SEALED_MINUTE_HOLDOUT.confirmation_coverage_rate,
sealed_benchmark_id: SEALED_MINUTE_HOLDOUT.sealed_benchmark_id,
user_meaning: "公开密封 holdout 未达发布门槛,不能据此放宽确认门,也不能声称已校准到精确分钟。",
user_meaning: holdoutOk
? "公开密封 holdout 已达发布门槛。"
: `公开密封 holdout 未达发布门槛。${UNIQUE_MINUTE_CLOSED_COPY},也不能声称已校准到精确分钟。`,
},
],
};
@@ -1,8 +1,8 @@
/**
* Public interview projection for the Case GET payload.
*
* The tap card is shown only after the Agent writes prompt/A/B onto the
* active focus. The server still owns C/D/stop chrome and the discriminator frame.
* The tap card is shown only when the follow-up is a discriminator
* (candidates already diverge or holdout) and the Agent wrote choice copy.
*/
import { projectRectificationChoiceCard } from "./method-followup";
@@ -49,6 +49,7 @@ export function choiceCardFromCaseDossier(dossier: {
precisionStage: refinement.precision_stage?.current,
nakshatraBoundary: refinement.nakshatra_boundary,
oosBlindPrompts: refinement.oos_blind_prompts,
eventProbes: refinement.discriminating_event_probes,
accepted: Boolean(dossier.case.acceptedTime),
});
}
@@ -22,6 +22,12 @@
* Method coverage finishes before repeating a precision-stage ask.
* Appearance and marks are skipped_by_policy. Horary does not block offering
* time cards. Occupation does block cards.
* Method coverage asks for dated events in natural language.
* After the first dated event, remaining dasha conflict probes
* (year/activation differences) are asked before more method rotation
* and they block offering time cards so the window can be filtered.
* A/B/C/D choice frames attach only when candidates already diverge
* (event probes, precision stage, varga observation, nakshatra, or holdout).
*/
import {
@@ -33,6 +39,7 @@ import {
} from "./choice-card.ts";
import { sessionOutcomeFromGate, type SessionOutcomeKind } from "./confirmation-gate.ts";
import type {
DiscriminatingEventProbe,
NakshatraBoundary,
OosBlindPrompt,
PrecisionStageId,
@@ -60,15 +67,15 @@ export type MethodCoverage = Readonly<{
}>;
export type MethodFollowup = Readonly<{
method_id: "dasha_events" | "d9_relationship" | "d10_career" | "d4_home" | "d5_education" | "relatives" | "d2_finance" | "d30_health" | "appearance" | "marks" | "occupation" | "horary" | "active_focus" | "nakshatra_boundary" | "oos_blind";
method_id: "dasha_events" | "d9_relationship" | "d10_career" | "d4_home" | "d5_education" | "relatives" | "d2_finance" | "d30_health" | "appearance" | "marks" | "occupation" | "horary" | "active_focus" | "nakshatra_boundary" | "oos_blind" | "reverse_verify";
intent: string;
ask_theme: "dated_event" | "relationship_style" | "career_style" | "home_change" | "education_style" | "family_event" | "finance_change" | "health_pressure" | "appearance" | "marks" | "occupation" | "horary" | "active_focus" | "nakshatra_trait" | "oos_blind";
domain: string | null;
kind_hint: string | null;
user_prompt_hint: string;
must_not_label: boolean;
choice_frame: RectificationChoiceFrame;
source: "active_focus" | "method_coverage" | "varga_observation" | "precision_stage" | "nakshatra_boundary" | "oos_blind";
choice_frame: RectificationChoiceFrame | null;
source: "active_focus" | "method_coverage" | "varga_observation" | "precision_stage" | "nakshatra_boundary" | "oos_blind" | "reverse_verify" | "event_probe";
}>;
export type MethodFollowupPlan = Readonly<{
@@ -139,6 +146,83 @@ function declinedDomains(
return domains;
}
const MAX_REVERSE_VERIFY = 2;
const REVERSE_VERIFY_THEME = {
education: "education_style",
relocation: "home_change",
relationship: "relationship_style",
career: "career_style",
family: "family_event",
finance: "finance_change",
health_pressure: "health_pressure",
} as const;
const REVERSE_VERIFY_KIND = {
education: "education_milestone",
relocation: "home_change",
relationship: "relationship_change",
career: "career_change",
family: "family_event",
finance: "finance_change",
health_pressure: "self_health_event",
} as const;
const REVERSE_VERIFY_VARGA = {
education: "D5 / D24",
relocation: "D4",
relationship: "D9",
career: "D10",
family: "D12 / D7 / D3",
finance: "D2 / D11",
health_pressure: "D30",
} as const;
const PROBE_METHOD_ID = {
education: "d5_education",
relocation: "d4_home",
relationship: "d9_relationship",
career: "d10_career",
family: "relatives",
finance: "d2_finance",
health_pressure: "d30_health",
} as const;
function remainingReverseVerifyProbes(
probes: readonly DiscriminatingEventProbe[] | undefined,
evidence: readonly MethodFollowupEvidence[],
declined: ReadonlySet<string>,
): DiscriminatingEventProbe[] {
const dasha: DiscriminatingEventProbe[] = [];
const fallback: DiscriminatingEventProbe[] = [];
for (const probe of probes ?? []) {
if (probe.source === "known_event_quality" || probe.role === "distinguish") continue;
if (declined.has(probe.domain)) continue;
if (hasConfirmedDomain(evidence, probe.domain)) continue;
if (probe.source === "dasha_boundary" || probe.source === "dasha_activation") {
dasha.push(probe);
} else {
fallback.push(probe);
}
}
return [...dasha, ...fallback].slice(0, MAX_REVERSE_VERIFY);
}
function remainingConflictProbes(
probes: readonly DiscriminatingEventProbe[] | undefined,
evidence: readonly MethodFollowupEvidence[],
declined: ReadonlySet<string>,
): DiscriminatingEventProbe[] {
const rows: DiscriminatingEventProbe[] = [];
for (const probe of probes ?? []) {
if (probe.source !== "dasha_boundary" && probe.source !== "dasha_activation") continue;
if (declined.has(probe.domain)) continue;
if (hasConfirmedDomain(evidence, probe.domain)) continue;
rows.push(probe);
}
return rows.slice(0, MAX_REVERSE_VERIFY);
}
function coverage(
methodId: MethodFollowupId,
status: MethodCoverageStatus,
@@ -146,8 +230,26 @@ function coverage(
return { method_id: methodId, status };
}
function collectHint(why: string, varga: string, extra = ""): string {
return `${why}本题绑定 ${varga}。${extra}用自然语言问一件带大概年份的经历。set-focus 不要写 expectedAnswerSchema.choice,界面不出点选卡。允许模糊年份。`.replace(/\s+/g, " ").trim();
}
function agentHint(why: string, varga: string, extra = ""): string {
return `${why}本题绑定 ${varga}。${extra}根据 choice_frame 自己写题干和 A/B/C/D,经 set-focus.expectedAnswerSchema.choice 交给 A/B/C/D 点选卡;C 是两件都没明显发生,D 是不记得。正文不要复述选项,也不要照抄 hint。`.replace(/\s+/g, " ").trim();
return `${why}本题绑定 ${varga}。${extra}根据 choice_frame 自己写题干和 A/B/C/D,经 set-focus.expectedAnswerSchema.choice 交给点选卡。题干由你写成自然语言;年份和事件家族以 choice_frame.period 与探针为准,不得发明年份,不要照抄 hint。A 是这件事大概就在那段时间,B 是有类似但年份不对或不够重大,C 是没有明显发生,D 是不记得。正文不要复述选项。`.replace(/\s+/g, " ").trim();
}
export function shouldAttachChoiceFrame(
item: Pick<MethodFollowup, "intent" | "ask_theme" | "source">,
evidence: readonly MethodFollowupEvidence[] = [],
): boolean {
if (item.intent === "out_of_sample_check" || item.source === "oos_blind") return true;
if (item.intent === "reverse_verify" || item.source === "reverse_verify") return true;
if (item.source === "event_probe") return true;
if (item.ask_theme === "nakshatra_trait" || item.source === "nakshatra_boundary") return true;
if (!evidence.some(isConfirmedDated)) return false;
if (item.intent === "distinguish_candidates") return true;
if (item.source === "varga_observation" || item.source === "precision_stage") return true;
return false;
}
export type NextUserActionId =
@@ -156,6 +258,7 @@ export type NextUserActionId =
| "record_stated_events"
| "ask_method_followup"
| "explain_current_window"
| "verify_adopted_time"
| "start_consultation";
export type NextUserAction = Readonly<{
@@ -197,6 +300,7 @@ export function isOfferBlockingFollowup(
return true;
}
if (!followup) return false;
if (followup.source === "event_probe") return true;
if (followup.source !== "method_coverage") return false;
return BLOCKING_COVERAGE_IDS.has(followup.method_id as MethodFollowupId);
}
@@ -234,13 +338,20 @@ export function buildNextUserAction(input: {
if (input.accepted) {
const consult = action(
"start_consultation",
"代表性时间已写入当前排盘。请用户用这个时间看盘;不要声称已确认唯一分钟。盘外对照问句由界面展示,本轮不要再当必须补证据。",
"前事核对结束。请用户用当前采用时间看盘;对不上可改选其他候选。不要声称已确认唯一分钟。",
);
if (input.nextFollowup) {
return {
id: "verify_adopted_time",
user_meaning: input.nextFollowup.user_prompt_hint,
on_user_stop: consult,
};
}
return { id: consult.id, user_meaning: consult.user_meaning, on_user_stop: consult };
}
const adopt = action(
"adopt_representative",
"本轮已有代表性候选时间。说明还不能确认唯一分钟,请用户采用下方时间卡片;采用后才用该时间看盘。不要只说记下了以后再说。",
"本轮已有代表性候选时间。说明本会话以代表性时间收口,不确认唯一分钟,请用户采用下方时间卡片;采用后才用该时间看盘。不要只说记下了以后再说。",
);
if (input.sessionOutcome === "awaiting_confirmation") {
return { id: adopt.id, user_meaning: adopt.user_meaning, on_user_stop: adopt };
@@ -287,20 +398,28 @@ export function buildMethodFollowupPlan(input: {
precisionStage?: PrecisionStageId | null;
nakshatraBoundary?: NakshatraBoundary | null;
oosBlindPrompts?: readonly OosBlindPrompt[];
eventProbes?: readonly DiscriminatingEventProbe[];
birthDate?: string | null;
accepted?: boolean;
}): MethodFollowupPlan {
const makeFollowup = (
item: Omit<MethodFollowup, "must_not_label" | "choice_frame">,
scoring = true,
forceChoice?: boolean,
): MethodFollowup => {
const base = { ...item, must_not_label: false as const };
const attach = forceChoice ?? shouldAttachChoiceFrame(base, input.evidence);
return {
...base,
choice_frame: buildChoiceFrame(base, {
observations: input.observations,
evidence: input.evidence,
scoring,
}),
choice_frame: attach
? buildChoiceFrame(base, {
observations: input.observations,
evidence: input.evidence,
probes: input.eventProbes,
birthDate: input.birthDate,
scoring,
})
: null,
};
};
const declined = declinedDomains(input.declinedTopics ?? []);
@@ -331,7 +450,16 @@ export function buildMethodFollowupPlan(input: {
const sessionOutcome = input.sessionOutcome ?? "collect_evidence";
const focus = input.activeFocus ?? null;
if (focus) {
const keepAcceptedFocus = Boolean(focus) && (
focus.intent === "reverse_verify" || focus.intent === "out_of_sample_check"
);
if (focus && (!input.accepted || keepAcceptedFocus)) {
const existingChoice = parseAgentChoiceCopy(focus.expectedAnswerSchema ?? null);
const reverseVerify = focus.intent === "reverse_verify";
const keepChoice = reverseVerify || (Boolean(existingChoice) && (
input.evidence.some(isConfirmedDated)
|| focus.intent === "out_of_sample_check"
));
return {
methods,
next_followup: makeFollowup({
@@ -340,9 +468,11 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "active_focus",
domain: focus.targetDomain,
kind_hint: focus.targetKind,
user_prompt_hint: "先承接当前服务器焦点。根据 choice_frame 写题干和 A/B/C/D,经 set-focus.expectedAnswerSchema.choice 交给点选卡;正文不要复述选项。",
user_prompt_hint: keepChoice
? "先承接当前服务器焦点。根据 choice_frame 自己写题干和 A/B/C/D,经 set-focus.expectedAnswerSchema.choice 交给点选卡;年份不得发明,不要照抄 hint。正文不要复述选项。"
: "先承接当前服务器焦点。若用户已说带年份的经历,走 batch 写入;否则继续用自然语言问一件带大概年份的事。不要写 expectedAnswerSchema.choice。",
source: "active_focus",
}),
}, true, keepChoice),
deferred_followup: null,
session_outcome: sessionOutcome,
stop_domain_rotation: true,
@@ -352,10 +482,26 @@ export function buildMethodFollowupPlan(input: {
}
if (input.accepted) {
const probe = remainingReverseVerifyProbes(input.eventProbes, input.evidence, declined)[0] ?? null;
const theme = probe ? REVERSE_VERIFY_THEME[probe.domain] : null;
const next = probe && theme
? makeFollowup({
method_id: "reverse_verify",
intent: "reverse_verify",
ask_theme: theme,
domain: probe.domain,
kind_hint: REVERSE_VERIFY_KIND[probe.domain],
user_prompt_hint: agentHint(
`当前排盘已采用。按该分钟核对:${probe.year_label} 是否有${probe.event_family}。对得上写入账本并重算;对不上可以改选其他候选。不确认唯一分钟。`,
REVERSE_VERIFY_VARGA[probe.domain],
),
source: "reverse_verify",
}, true, true)
: null;
return {
methods,
next_followup: null,
deferred_followup: oosFollowup(input.oosBlindPrompts, makeFollowup),
next_followup: next,
deferred_followup: null,
session_outcome: sessionOutcome,
stop_domain_rotation: true,
do_not_poll: DO_NOT_POLL,
@@ -365,6 +511,9 @@ export function buildMethodFollowupPlan(input: {
let next: MethodFollowup | null = null;
const stage = input.precisionStage ?? null;
const conflictProbe = dashaCovered
? remainingConflictProbes(input.eventProbes, input.evidence, declined)[0] ?? null
: null;
if (!dashaCovered) {
next = makeFollowup({
method_id: "dasha_events",
@@ -372,13 +521,26 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "dated_event",
domain: null,
kind_hint: null,
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"可以先从最容易想起的一件带大概时间的经历开始。",
"本命 Dasha + 行运(方法1)",
"不要求一次列出 10–15 条。",
),
source: "method_coverage",
});
} else if (conflictProbe) {
next = makeFollowup({
method_id: PROBE_METHOD_ID[conflictProbe.domain],
intent: "distinguish_candidates",
ask_theme: REVERSE_VERIFY_THEME[conflictProbe.domain],
domain: conflictProbe.domain,
kind_hint: REVERSE_VERIFY_KIND[conflictProbe.domain],
user_prompt_hint: agentHint(
`当前候选时间还分不开。按冲突分钟反推:${conflictProbe.year_label} 是否有${conflictProbe.event_family}。对得上写入账本并重算以筛窗;对不上关闭该问。不要问两套盘哪个更像。不确认唯一分钟。`,
REVERSE_VERIFY_VARGA[conflictProbe.domain],
),
source: "event_probe",
}, true, true);
} else if (!relationshipCovered && !declined.has("relationship")) {
next = makeFollowup({
method_id: "d9_relationship",
@@ -386,7 +548,7 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "relationship_style",
domain: "relationship",
kind_hint: "relationship_start",
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"可以先说一段记得大概时间的感情或关系变化。",
"D9",
"对照 D9 上升类型表(白羊主动热情、天蝎深刻占有等)只作校时方法,不是命运承诺。",
@@ -400,7 +562,7 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "career_style",
domain: "career",
kind_hint: "career_entry",
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"可以先说一段记得大概时间的工作或事业变化。同一件事会同时对照本命第 10 宫和 D10。",
"D10",
"可用 D10 事业类型表作校时对照。",
@@ -414,7 +576,7 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "family_event",
domain: "family",
kind_hint: "family_event",
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"可以先说一段记得大概时间的家人相关变化。同一件事会对照 D12 父母盘、D7 子女盘和 D3 兄弟盘。",
"D12 / D7 / D3",
"六亲用 Raman 六步:前三步可执行,后三步标方法论层。",
@@ -428,7 +590,7 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "occupation",
domain: "occupation",
kind_hint: "occupation_note",
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"你长期做什么工作?对照本命第 10 宫和 D10。",
"D1-H10 + D10",
"可用事业类型表(白羊领导创业、天蝎研究转化等)作校时方法。",
@@ -442,7 +604,7 @@ export function buildMethodFollowupPlan(input: {
ask_theme: "horary",
domain: "horary",
kind_hint: "horary_query",
user_prompt_hint: agentHint(
user_prompt_hint: collectHint(
"有没有第一次认真问起这件事的时间?",
"占问观察盘",
"有的话可以按那个时间观察;没有也不挡给出时间卡。状态是 observation_only。",
@@ -457,7 +619,7 @@ export function buildMethodFollowupPlan(input: {
domain: null,
kind_hint: null,
user_prompt_hint: agentHint(
"窗口里本命上升还可能落在两段。请再补一件记得大概时间的经历,用来分开这两段。",
"窗口里本命上升还可能落在两段。按 choice_frame.period 与探针问一件前事是否发生,用来筛这两段。不要问两套盘哪个更像。",
"本命上升 / Dasha",
),
source: "precision_stage",
@@ -470,7 +632,7 @@ export function buildMethodFollowupPlan(input: {
domain: "relationship",
kind_hint: "relationship_change",
user_prompt_hint: agentHint(
"关系盘仍会换升。可以再补一件记得大概时间的感情或关系变化。",
"关系盘仍会换升。按探针年份问感情这条线的前事是否发生,用来筛窗。不要问两套盘哪个更像。",
"D9",
"对照 D9 上升类型表只作校时方法。",
),
@@ -484,7 +646,7 @@ export function buildMethodFollowupPlan(input: {
domain: "career",
kind_hint: "career_change",
user_prompt_hint: agentHint(
"事业盘仍会换升。可以再补一件记得大概时间的工作变化;同一件事会同时对照本命第 10 宫和 D10。",
"事业盘仍会换升。按探针年份问事业这条线的前事是否发生,用来筛窗。不要问两套盘哪个更像。",
"D10",
"可用 D10 事业类型表作校时对照。",
),
@@ -498,7 +660,7 @@ export function buildMethodFollowupPlan(input: {
domain: "relocation",
kind_hint: "home_change",
user_prompt_hint: agentHint(
"居所盘仍会换升。可以再补一件记得大概时间的搬家或住处变化。",
"居所盘仍会换升。按探针年份问搬家或住处变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D4",
),
source: "precision_stage",
@@ -511,7 +673,7 @@ export function buildMethodFollowupPlan(input: {
domain: "education",
kind_hint: "education_milestone",
user_prompt_hint: agentHint(
"成就盘或学业盘仍会换升。可以再补一件记得大概时间的学业、考试或被委以责任的变化;同一件事会对照本命五宫、D5 和 D24。",
"成就盘或学业盘仍会换升。按探针年份问学业或考试变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D5 / D24",
),
source: "precision_stage",
@@ -533,7 +695,7 @@ export function buildMethodFollowupPlan(input: {
domain: "relationship",
kind_hint: "relationship_change",
user_prompt_hint: agentHint(
"当前候选在关系主题上仍分不开,可以再补一件记得大概时间的感情或关系变化。",
"当前候选在关系主题上仍分不开。按探针年份问感情前事是否发生,用来筛窗。不要问两套盘哪个更像。",
"D9",
"对照 D9 上升类型表只作校时方法。",
),
@@ -547,7 +709,7 @@ export function buildMethodFollowupPlan(input: {
domain: "career",
kind_hint: "career_change",
user_prompt_hint: agentHint(
"当前候选在事业主题上仍分不开,可以再补一件记得大概时间的工作变化。同一件事会同时对照本命第 10 宫和 D10。",
"当前候选在事业主题上仍分不开。按探针年份问事业前事是否发生,用来筛窗。不要问两套盘哪个更像。",
"D10",
"可用事业类型表作校时对照。",
),
@@ -561,7 +723,7 @@ export function buildMethodFollowupPlan(input: {
domain: "relocation",
kind_hint: "home_change",
user_prompt_hint: agentHint(
"当前候选在居所主题上仍分不开,可以再补一件记得大概时间的搬家或住处变化。",
"当前候选在居所主题上仍分不开。按探针年份问搬家或住处变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D4",
),
source: "varga_observation",
@@ -574,7 +736,7 @@ export function buildMethodFollowupPlan(input: {
domain: "education",
kind_hint: "education_milestone",
user_prompt_hint: agentHint(
"当前候选在学业或成就主题上仍分不开,可以再补一件记得大概时间的学业、考试或被委以责任的变化。同一件事会对照 D5 和 D24。",
"当前候选在学业或成就主题上仍分不开。按探针年份问学业或考试变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D5 / D24",
),
source: "varga_observation",
@@ -587,7 +749,7 @@ export function buildMethodFollowupPlan(input: {
domain: "family",
kind_hint: "family_event",
user_prompt_hint: agentHint(
"当前候选在家人主题上仍分不开,可以再补一件记得大概时间的家人变化。同一件事会对照 D12、D7 和 D3。",
"当前候选在家人主题上仍分不开。按探针年份问家人变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D12 / D7 / D3",
),
source: "varga_observation",
@@ -600,7 +762,7 @@ export function buildMethodFollowupPlan(input: {
domain: "finance",
kind_hint: "finance_change",
user_prompt_hint: agentHint(
"当前候选在财务主题上仍分不开,可以再补一件记得大概时间的收入、资产或财务变化。同一件事会对照 D2 和 D11。",
"当前候选在财务主题上仍分不开。按探针年份问财务变化是否发生,用来筛窗。不要问两套盘哪个更像。",
"D2 / D11",
),
source: "varga_observation",
@@ -613,7 +775,7 @@ export function buildMethodFollowupPlan(input: {
domain: "health_pressure",
kind_hint: "self_health_event",
user_prompt_hint: agentHint(
"当前候选在健康压力主题上仍分不开,可以再补一件记得大概时间的健康、事故或压力变化。这不是医学判断。",
"当前候选在健康压力主题上仍分不开。按探针年份问健康或压力变化是否发生,用来筛窗。这不是医学判断。不要问两套盘哪个更像。",
"D30",
),
source: "varga_observation",
@@ -644,26 +806,6 @@ export function buildMethodFollowupPlan(input: {
};
}
function oosFollowup(
prompts: readonly OosBlindPrompt[] | undefined,
makeFollowup: (
item: Omit<MethodFollowup, "must_not_label" | "choice_frame">,
scoring?: boolean,
) => MethodFollowup,
): MethodFollowup | null {
const prompt = prompts?.[0];
if (!prompt) return null;
return makeFollowup({
method_id: "oos_blind",
intent: "out_of_sample_check",
ask_theme: "oos_blind",
domain: prompt.domain,
kind_hint: null,
user_prompt_hint: `${prompt.user_meaning}根据 choice_frame 写盘外核对题干和 A/B/C/D,经 set-focus.expectedAnswerSchema.choice 交给点选卡;不得写入可评分证据。`,
source: "oos_blind",
}, false);
}
export function projectRectificationChoiceCard(
input: Parameters<typeof buildMethodFollowupPlan>[0],
): RectificationChoiceCard | null {
@@ -157,6 +157,39 @@ export type OosBlindPrompt = Readonly<{
used_for_scoring: false;
}>;
export const EVENT_PROBE_DOMAINS = [
"education",
"relocation",
"relationship",
"career",
"family",
"finance",
"health_pressure",
] as const;
export type EventProbeDomain = (typeof EVENT_PROBE_DOMAINS)[number];
export type EventProbeSource =
| "dasha_activation"
| "dasha_boundary"
| "age_band"
| "known_event_quality";
export type EventProbeRole = "distinguish" | "reverse_verify";
export type DiscriminatingEventProbe = Readonly<{
year: number;
year_label: string;
domain: EventProbeDomain;
event_family: string;
source: EventProbeSource;
tracks: readonly ("vimshottari" | "narayana")[];
tracks_agree: boolean;
unique_minute_claim: false;
user_meaning: string;
role: EventProbeRole;
}>;
function asRecord(value: unknown): Readonly<Record<string, unknown>> | null {
return value && typeof value === "object" && !Array.isArray(value)
? value as Readonly<Record<string, unknown>>
@@ -370,6 +403,62 @@ export function parsePrecisionStage(value: unknown): PrecisionStage | null {
};
}
const EVENT_PROBE_DOMAIN_SET = new Set<string>(EVENT_PROBE_DOMAINS);
const EVENT_PROBE_SOURCES = new Set<string>([
"dasha_activation",
"dasha_boundary",
"age_band",
"known_event_quality",
]);
const CLOCK_IN_COPY = /(?:[01]?\d|2[0-3]):[0-5]\d/;
export function parseDiscriminatingEventProbes(value: unknown): readonly DiscriminatingEventProbe[] {
if (!Array.isArray(value)) return [];
const rows: DiscriminatingEventProbe[] = [];
for (const item of value) {
const row = asRecord(item);
const year = typeof row?.year === "number" && Number.isInteger(row.year) ? row.year : null;
const domain = typeof row?.domain === "string" ? row.domain : "";
const source = typeof row?.source === "string" ? row.source : "";
const family = asText(row?.event_family, 80);
const meaning = asText(row?.user_meaning, 160);
const label = asText(row?.year_label, 40);
if (
!row
|| year === null
|| year < 1900
|| year > 2100
|| !EVENT_PROBE_DOMAIN_SET.has(domain)
|| !EVENT_PROBE_SOURCES.has(source)
|| !family
|| !meaning
|| !label
|| CLOCK_IN_COPY.test(meaning)
|| CLOCK_IN_COPY.test(family)
|| row.unique_minute_claim === true
) continue;
const tracks = Array.isArray(row.tracks)
? row.tracks.filter((track): track is "vimshottari" | "narayana" => track === "vimshottari" || track === "narayana")
: [];
rows.push({
year,
year_label: label,
domain: domain as EventProbeDomain,
event_family: family,
source: source as EventProbeSource,
tracks,
tracks_agree: row.tracks_agree === true,
unique_minute_claim: false,
user_meaning: meaning,
role: row.role === "distinguish" || source === "known_event_quality"
? "distinguish"
: "reverse_verify",
});
if (rows.length === 3) break;
}
return rows;
}
export function parseOosBlindPrompts(value: unknown): readonly OosBlindPrompt[] {
if (!Array.isArray(value)) return [];
const rows: OosBlindPrompt[] = [];
@@ -422,6 +511,7 @@ export function refinementFromDecisionReceipt(
nakshatra_boundary: NakshatraBoundary | null;
precision_stage: PrecisionStage | null;
oos_blind_prompts: readonly OosBlindPrompt[];
discriminating_event_probes: readonly DiscriminatingEventProbe[];
} {
return {
event_dasha_ledger: parseEventDashaLedger(receipt?.event_dasha_ledger),
@@ -431,5 +521,6 @@ export function refinementFromDecisionReceipt(
nakshatra_boundary: parseNakshatraBoundary(receipt?.nakshatra_boundary),
precision_stage: parsePrecisionStage(receipt?.precision_stage),
oos_blind_prompts: parseOosBlindPrompts(receipt?.oos_blind_prompts),
discriminating_event_probes: parseDiscriminatingEventProbes(receipt?.discriminating_event_probes),
};
}
@@ -110,7 +110,7 @@ export function buildSkillVerificationReport(input: SkillVerificationReportInput
return [
"## 生时纠正验证报告(skill 八法)",
"这是当前窗的相对拟合,标签是 `candidate_range_not_birth_time_truth`。采用只把代表性时间写入当前排盘,不是已确认唯一出生分钟。",
"这是当前窗的相对拟合,标签是 `candidate_range_not_birth_time_truth`。采用把代表性时间写入当前排盘;本会话以代表性时间收口,不是已确认唯一出生分钟。",
"",
"### 筛选",
`- 当前代表分钟:${time}`,
+3 -3
View File
@@ -69,11 +69,11 @@ const agenticRectificationInstructions = `你是 Jyotisha,只服务当前绑
6. 工具执行过程保持静默。思考过程必须用简体中文,只写在思维链里:可以说你在核对哪类经历,禁止写工具名、错误码、参数、内部 ID、评分或密钥。正文像正常人说话,不写“本轮做了什么”,不描述 Skill、Case、Dossier、工具、内部 Activity、参数、错误或推理过程;完成凭证完全由服务端公开 Activity/receipt 展示。
7. 只基于成功 attempt 输出正文。工具失败时说明面向用户的边界,不声称未执行的方法或结果。
8. 当前轮新事件一律走 rectification-record-evidence-batch(一件也可以)。rectification-confirm-evidence 只用于用户对已有 pending 明确说“对/是”。不得要求用户把已说清的事件再发一遍。
9. 不得在同一回复中一边要求继续补证据,一边提供候选采用。落实 next_user_action:id 不是 adopt_representative 时不得调用 rectification-offer-candidates,也不得请用户采用。selection_allowed 只表示可以采用代表性时间,不是本轮必须出示卡片;propose_allowed 才是提出门。仍有会挡住出牌的 next_followup 时继续问。session_outcome=adopt_representative 或 next_user_action.id=adopt_representative 时本轮结果是采用代表性时间,不要再问 next_followup;正文必须说还不能确认唯一分钟。用户说“暂时想不到了 / 没有更多 / 先这样”时改走 on_user_stop:账本为空则把已说的带日期经历 batch 写入再比较,有事件无结果则本轮 compare,已有代表性结果则解释、调用 offer-candidates,并请采用下方时间卡片。禁止只说记下了、会话会保留、以后再继续。出牌/采用轮把工具返回的 skill_verification_report 写入正文:筛选窗、事件–Dasha–Gochara 表、D9/D10 类型对照、六亲六步、职业类型表、占问 observation_only、文末技法审计表。80%/60% 只描述事件吻合率,不得写成已确认唯一出生分钟。确认门以 latest_result.confirmation_gate 为准;not_evaluated 不是 fail;官方分钟层 passed 仍不能单独打开确认门;holdout 为 not_ready 时不得声称精确分钟或发布准确率。若宽度大于 5 或 confirmation_allowed 为 false,必须说这是一段不可分区间,把代表分钟称为代表性候选,不得说已定位到唯一分钟。宽度大于 5 或并列分钟仍可出示代表性时间卡;不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。精度阶段追问不挡出牌。用户仍可 accepted 代表性候选。
9. 不得在同一回复中一边要求继续补证据,一边提供候选采用。落实 next_user_action:id=verify_adopted_time 时本轮只核一件前事,A 走 batch 并 compare,C 关闭该问,不要 offer 也不要 start_consultation。id=start_consultation 时请用户用当前采用时间看盘,对不上同时请改选其他候选。id 不是 adopt_representative 时不得调用 rectification-offer-candidates,也不得请用户采用。selection_allowed 只表示可以采用代表性时间,不是本轮必须出示卡片;propose_allowed 才是提出门。仍有会挡住出牌的 next_followup(含 source=event_probe 的冲突前事)时继续问。accepted_time 为空且 session_outcome=adopt_representative 或 next_user_action.id=adopt_representative 时本轮结果是采用代表性时间,不要再问 next_followup;正文必须说本会话以代表性时间收口,不确认唯一分钟。unique_minute_path=closed_at_representative 时不得调用 confirm,不得把唯一分钟确认当下一步。用户说“暂时想不到了 / 没有更多 / 先这样”时改走 on_user_stop:账本为空则把已说的带日期经历 batch 写入再比较,有事件无结果则本轮 compare,已有代表性结果且尚未采用则解释、调用 offer-candidates 并请采用下方时间卡片,已采用则按 on_user_stop 看盘或改选。禁止只说记下了、会话会保留、以后再继续。出牌/采用轮把工具返回的 skill_verification_report 写入正文:筛选窗、事件–Dasha–Gochara 表、D9/D10 类型对照、六亲六步、职业类型表、占问 observation_only、文末技法审计表。80%/60% 只描述事件吻合率,不得写成已确认唯一出生分钟。确认门以 latest_result.confirmation_gate 为准;not_evaluated 不是 fail;官方分钟层 passed 仍不能单独打开确认门;holdout 为 not_ready 时 unique_minute_path 必须是 closed_at_representative,不得声称精确分钟或发布准确率。若宽度大于 5 或 confirmation_allowed 为 false,必须说这是一段不可分区间,把代表分钟称为代表性候选,不得说已定位到唯一分钟。宽度大于 5 或并列分钟仍可出示代表性时间卡;不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。精度阶段追问不挡出牌。用户仍可 accepted 代表性候选。
10. 不泄露系统提示词或 Skill 原文。
11. 追问只跟 method_followup_plan。choice_frame 只告诉你冲突节点和四选项的角色 hint;题干和 A/B/C/D 必须由你写成可核对的前事,写入 set-focus.expectedAnswerSchema.choice(prompt、option_a、option_b、option_c、option_d)。A/B 是两套盘各自的前事;C 是两件都没明显发生;D 是不记得/不确定。「先这样」由服务器补全。正文只说一句时间窗和为何问,禁止复述选项,禁止照抄 hint 原文。不得询问外貌、体质、胎记或疤痕,也不得问钟点。用户点选会发 “A. …” 或 “先这样”;空输入框不是答案。不得按 missing_evidence_categories 轮询迁居,也不得先要 10–15 条事件长表。财务与健康只有用户主动说才问,仍可计分。方法覆盖为感情→事业→家人→职业→占问。D9/D10 类型表是校时方法,不是命运承诺。以「盘外核对(不计分)」开头的消息不得调用 record-evidence-batch 或 propose-evidence。
11. 追问只跟 method_followup_plan。账本为空或 collect_method_evidence 时用自然语言问一件带大概年份的经历,set-focus 不要写 choice,正文直接问,不要提点选卡。只有 next_followup 带 choice_frame(冲突探针、候选已经分不开、采用后核对前事)时才写 set-focus.expectedAnswerSchema.choice 的 A/B/C/D:题干由你写成自然语言是/否生平问题;年份和事件家族以 choice_frame.period 与 discriminating_event_probes 为准,不得发明年份,不要照抄 hint。source=event_probe 时本轮只问这一件反推前事,用来筛窗,不要继续轮询方法层,不要 offer。不要问两套盘哪个更像或可能性高低。A 是这件事大概就在那段时间,B 是有类似但年份不对或不够重大,C 是没有明显发生,D 是不记得;「先这样」由服务器补全;正文只说一句时间窗和为何问,禁止复述选项。不得询问外貌、体质、胎记或疤痕,也不得问钟点。不得按 missing_evidence_categories 轮询迁居,也不得先要 10–15 条事件长表。财务与健康只有用户主动说才问。方法覆盖为感情→事业→家人→职业→占问。D9/D10 类型表是校时方法,不是命运承诺。以「盘外核对(不计分)」开头的消息不得调用 record-evidence-batch 或 propose-evidence。
12. 证据有效变化后由服务器重算候选。不要等用户说“没有更多了”才比较,也不要对同一证据指纹再 compare。分钟扫描只在服务端,结果只是候选或平台,不得宣布确认。
13. 落实 start_consultation:代表性时间被采用后,请用户用这个时间看盘。盘外核对照界面点选卡进行,答案不计分、不改候选。解释事件–Dasha 账本、双轨是否一致、换升时刻、精度阶段、D9/D10 类型对照和相对支持时,仍必须说候选范围不是出生时间真值。`;
13. 落实 start_consultation:前事核对结束或用户先这样后,请用户用当前采用时间看盘;对不上同时请改选其他候选。解释事件–Dasha 账本、双轨是否一致、换升时刻、精度阶段、D9/D10 类型对照和相对支持时,仍必须说候选范围不是出生时间真值。`;
export function getRectificationV9Agent(
model: ResolvedLanguageModel,
@@ -140,6 +140,8 @@ function safeCaseProjection(
precisionStage: refinement.precision_stage?.current,
nakshatraBoundary: refinement.nakshatra_boundary,
oosBlindPrompts: refinement.oos_blind_prompts,
eventProbes: refinement.discriminating_event_probes,
birthDate: String(compute.baselineBirthSnapshot.birth_date ?? "") || null,
accepted,
});
const selectionAllowed = latest?.selectionAllowed === true;
@@ -172,6 +174,8 @@ function safeCaseProjection(
precisionStage: refinement.precision_stage?.current,
nakshatraBoundary: refinement.nakshatra_boundary,
oosBlindPrompts: refinement.oos_blind_prompts,
eventProbes: refinement.discriminating_event_probes,
birthDate: String(compute.baselineBirthSnapshot.birth_date ?? "") || null,
accepted,
});
const birthContext = safeBirthContext(compute);
@@ -335,6 +339,7 @@ export function latestResultToolProjection(
nakshatra_boundary: refinement.nakshatra_boundary,
precision_stage: refinement.precision_stage,
oos_blind_prompts: refinement.oos_blind_prompts,
discriminating_event_probes: refinement.discriminating_event_probes,
unique_minute_claim: false,
candidate_range_not_birth_time_truth: true,
skill_verification_report: buildSkillVerificationReport({
@@ -376,6 +381,7 @@ function collectingFollowupForParsed(
precisionStage: refinement.precision_stage?.current,
nakshatraBoundary: refinement.nakshatra_boundary,
oosBlindPrompts: refinement.oos_blind_prompts,
eventProbes: refinement.discriminating_event_probes,
accepted: Boolean(parsed.case.acceptedTime),
});
}
@@ -676,7 +682,7 @@ export function createRectificationV9Tools(ctx: RectificationV9Context) {
const setFocusTool = createTool({
id: "rectification-set-focus",
description:
"在提出至多一个主问题时持久化服务器 ConversationFocus。questionId 必须稳定标识该问题;targetEvidenceId/domain/kind 只填写实际目标。新的 focus 会由服务器 supersede 旧 active focus。若本轮是 A/B/C/D 点选,必须在 expectedAnswerSchema.choice 写入你拟定的 prompt、option_a、option_b、option_c、option_d。A/B 是两套盘的前事假设;C 是两件都没明显发生;D 是不记得/不确定。不要外貌/疤痕/钟点。「先这样」由服务器补全,不要改它的含义。",
"在提出至多一个主问题时持久化服务器 ConversationFocus。questionId 必须稳定标识该问题;targetEvidenceId/domain/kind 只填写实际目标。新的 focus 会由服务器 supersede 旧 active focus。仅当 method_followup_plan.next_followup 带 choice_frame 时才在 expectedAnswerSchema.choice 写入 prompt、option_a、option_b、option_c、option_d。收集经历不要写 choice。不要外貌/疤痕/钟点。「先这样」由服务器补全,不要改它的含义。",
inputSchema: z.object({
caseId: z.string().uuid(),
questionId: z.string().trim().min(1).max(160),
@@ -114,7 +114,7 @@ test("failed server turns retain their receipt state without parsing activity fr
test("candidate acceptance copy never presents adoption as confirmation", () => {
assert.match(chatSource, /当前可能的出生时间/);
assert.match(chatSource, /采用不等于确认出生时间/);
assert.match(chatSource, /当前排盘时间(代表性候选,还不能确认唯一分钟)/);
assert.match(chatSource, /当前排盘时间(代表性时间,本会话不确认唯一分钟)/);
assert.match(chatSource, /已确认校正时间/);
assert.doesNotMatch(chatSource, /candidateResult\.confirmationAllowed \? "确认校正时间"/);
});
@@ -338,7 +338,7 @@ test("completed Agent replies restore feedback, copy and safe in-place regenerat
test("candidate state renders from the snapshot API and never from sentinels", () => {
assert.match(chat, /当前可能的出生时间/);
assert.match(chat, /还不能确认唯一分钟/);
assert.match(chat, /本会话以代表性时间收口,不确认唯一分钟/);
assert.match(chat, /可以先采用,也可以继续补充事件或改选/);
assert.match(chat, /相对支持度不是统计概率/);
assert.match(chat, /改选为此时间/);
@@ -479,10 +479,11 @@ test("time-selection cards appear under the latest settled agent bubble only aft
assert.match(chat, /candidateResult\?\.selectionAllowed/);
assert.match(chat, /turnOfferedSelection/);
assert.match(chat, /rectification-offer-candidates/);
assert.match(chat, /showSelectionCards = Boolean\(\s*candidateResult\?\.selectionAllowed[\s\S]*turnOfferedSelection\(latestOfferMessage\)[\s\S]*!busy/);
assert.match(chat, /showChoiceCards = Boolean\(\s*choiceCard[\s\S]*!offeredThisTurn[\s\S]*!busy/);
assert.match(chat, /showSelectionCards = Boolean\(\s*candidateResult\?\.selectionAllowed[\s\S]*offeredSelectionOnce[\s\S]*!showChoiceCards[\s\S]*!busy/);
assert.match(
chat,
/selectionCardMessageKey = showSelectionCards && latestOfferMessage\s*\? latestOfferMessage\.renderKey\s*: undefined/,
/selectionCardMessageKey = showSelectionCards && latestSettledAssistant\s*\? latestSettledAssistant\.renderKey\s*: undefined/,
);
assert.match(messageLoop, /showSelectionCards && message\.renderKey === selectionCardMessageKey/);
assert.match(messageLoop, /<RectificationChoiceCard/);
@@ -528,6 +529,8 @@ test("rectification Agent output stays natural and keeps tool execution silent",
assert.doesNotMatch(skill, /同一用户最多一个 resumable Case/);
assert.match(strategy, /没有更多事件/);
assert.match(strategy, /(?:无需|不要求)结束、暂停或保存进度/);
assert.match(strategy, /不要一进场就出 A\/B\/C\/D/);
assert.match(agent, /不要提点选卡/);
});
test("clear current-turn events go through the batch evidence service", () => {
@@ -549,6 +552,8 @@ test("the Agent prompt cannot offer candidates while asking for more evidence",
// offer_selection boolean anymore.
assert.match(agent, /不得在同一回复中一边要求继续补证据,一边提供候选采用/);
assert.match(agent, /id 不是 adopt_representative 时不得调用 rectification-offer-candidates/);
assert.match(agent, /verify_adopted_time/);
assert.match(agent, /event_probe/);
assert.match(agent, /selection_allowed 只表示可以采用代表性时间/);
const tools = readFileSync(
new URL("../src/mastra/rectification-v9-tools.ts", import.meta.url),
@@ -567,7 +572,7 @@ test("adopted time offers a consultation handoff without unique-minute copy", ()
assert.match(page, /startConsultationAfterRectification/);
assert.match(page, /createSession\(modelCatalog\.defaultModelId\)/);
assert.match(agent, /start_consultation/);
assert.match(agent, /还不能确认唯一分钟/);
assert.match(agent, /本会话以代表性时间收口,不确认唯一分钟/);
});
test("stream failures remove empty assistant placeholders", () => {
@@ -182,7 +182,7 @@ test("adopted minute recasts the house table and keeps technique audit collapsed
technique_audit_table: [
{ technique: "D1 本命盘", status: "executed", note: "本轮已按该分钟重算本命宫位。" },
{ technique: "KP 宫头", status: "blocked", note: "KP 宫头本轮未计算。" },
{ technique: "唯一分钟确认", status: "blocked", note: "采用不等于确认唯一分钟。" },
{ technique: "唯一分钟确认", status: "blocked", note: "本会话以代表性时间收口,不确认唯一分钟。" },
],
precision_stage: {
current: "d4_refine",
+253 -36
View File
@@ -12,39 +12,61 @@ import {
parseRectificationChoiceCard,
} from "../src/lib/rectification-agentic/v9/choice-card.ts";
import { buildMethodFollowupPlan, projectRectificationChoiceCard } from "../src/lib/rectification-agentic/v9/method-followup.ts";
import type { DiscriminatingEventProbe } from "../src/lib/rectification-agentic/v9/refinement-packet.ts";
const SAMPLE_COPY = {
prompt: "2016 年前后,更像哪一件?",
option_a: "那时开始一段认真交往",
option_b: "那时工作突然压上来",
option_c: "那几年感情和工作都没什么明显变化",
option_d: "不记得那几年发生过什么",
prompt: "2016 年前后,有没有明显搬家、离乡或长期异地?",
option_a: "是,大概就在那段时间",
option_b: "有类似,但年份不对或不够重大",
option_c: "没有明显发生",
option_d: "不记得 / 不确定",
} as const;
test("choice frames reverse-infer competing relationship vs career when D9 and D10 both differ", () => {
const MOVE_PROBE: DiscriminatingEventProbe = {
year: 2016,
year_label: "2016 年前后",
domain: "relocation",
event_family: "搬家、离乡或长期异地",
source: "dasha_activation",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2016 年前后。事件家族:搬家、离乡或长期异地。请写成一句自然语言是/否题。不得改年份。",
role: "reverse_verify",
};
test("choice frames ask one biographical event from a server probe, not competing charts", () => {
const frame = buildChoiceFrame(
{
method_id: "d9_relationship",
ask_theme: "relationship_style",
domain: "relationship",
method_id: "d4_home",
ask_theme: "home_change",
domain: "relocation",
user_prompt_hint: "unused",
},
{
observations: [
{ layer: "d9", candidates_differ: true, ask_theme: "relationship_style" },
{ layer: "d10", candidates_differ: true, ask_theme: "career_style" },
{ layer: "d4", candidates_differ: true, ask_theme: "home_change" },
],
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}],
probes: [MOVE_PROBE],
},
);
assert.equal(frame.period, "2016 年前后");
assert.match(frame.option_a_hint, /认真关系/);
assert.match(frame.option_b_hint, /职责/);
assert.match(frame.why, /年份锁定/);
assert.match(frame.why, /请写成/);
assert.doesNotMatch(frame.why, /^2016 年前后,有没有明显/);
assert.match(frame.option_a_hint, /是,大概就在那段时间/);
assert.match(frame.option_b_hint, /年份不对或不够重大/);
assert.doesNotMatch(frame.option_a_hint + frame.option_b_hint, /更像哪一件|可能性/);
assert.doesNotMatch(frame.why, /更像哪一件/);
assert.equal(/外貌|疤痕|胎记/.test(frame.option_a_hint + frame.option_b_hint), false);
assert.equal(frame.scoring, true);
assert.equal(mergeChoiceCard(frame, null), null);
@@ -52,17 +74,19 @@ test("choice frames reverse-infer competing relationship vs career when D9 and D
test("the visible card uses Agent copy for A/B/C/D, not the server hint", () => {
const frame = buildChoiceFrame({
method_id: "d9_relationship",
ask_theme: "relationship_style",
domain: "relationship",
method_id: "d4_home",
ask_theme: "home_change",
domain: "relocation",
user_prompt_hint: "unused",
}, {
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}],
probes: [MOVE_PROBE],
});
const card = mergeChoiceCard(frame, SAMPLE_COPY);
assert.equal(card?.prompt, SAMPLE_COPY.prompt);
@@ -70,8 +94,6 @@ test("the visible card uses Agent copy for A/B/C/D, not the server hint", () =>
assert.equal(card?.options[1]?.label, SAMPLE_COPY.option_b);
assert.equal(card?.options[2]?.label, SAMPLE_COPY.option_c);
assert.equal(card?.options[3]?.label, SAMPLE_COPY.option_d);
assert.equal(card?.options[2]?.label === frame.neither_label, false);
assert.equal(card?.options[3]?.label === frame.unsure_label, false);
assert.equal(card?.stop_label, frame.stop_label);
});
@@ -86,11 +108,11 @@ test("holdout messages are prefixed and do not count as scoring quotes", () => {
{ scoring: false },
);
const card = mergeChoiceCard(frame, {
prompt: "家人这条线还没用过,更像哪一件?",
option_a: "家里有一件记得大概年份的变化",
option_b: "有接近的变化,但时间不太准",
option_c: "家里没什么明显变化",
option_d: "不记得家里那几年的事",
prompt: "家人这条线还没用过,有没有一件记得大概年份的变化?",
option_a: "是,大概就在那段时间",
option_b: "有类似,但年份不对或不够重大",
option_c: "没有明显发生",
option_d: "不记得 / 不确定",
});
assert.ok(card);
const message = choiceCardUserMessage(card, "A");
@@ -98,16 +120,108 @@ test("holdout messages are prefixed and do not count as scoring quotes", () => {
assert.equal(isHoldoutVerificationQuote(message), true);
assert.equal(isHoldoutVerificationQuote("A. 认真关系进入或结婚"), false);
assert.equal(card.scoring, false);
assert.match(frame.why, /盘外核对/);
});
test("life period collapses a single dated year and skips unknown dates", () => {
test("reverse-verify after adopt scores the predicted event and invites 改选 on mismatch", () => {
const frame = buildChoiceFrame(
{
method_id: "reverse_verify",
ask_theme: "career_style",
domain: "career",
user_prompt_hint: "unused",
},
{
probes: [{
year: 2018,
year_label: "2018 年前后",
domain: "career",
event_family: "入职、升职或职责明显加重",
source: "dasha_activation",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2018 年前后。",
role: "reverse_verify",
}],
},
);
assert.equal(frame.period, "2018 年前后");
assert.equal(frame.scoring, true);
assert.match(frame.why, /按当前采用时间核对/);
assert.match(frame.why, /改选/);
assert.doesNotMatch(frame.why, /盘外核对/);
const card = mergeChoiceCard(frame, SAMPLE_COPY);
assert.ok(card);
assert.equal(card.scoring, true);
assert.doesNotMatch(choiceCardUserMessage(card, "A"), new RegExp(HOLDOUT_MESSAGE_PREFIX));
});
test("life period only reuses years from the same domain", () => {
assert.equal(lifePeriodLabel([
{ status: "confirmed", datePrecision: "unknown", occurredFrom: null, occurredTo: null },
]), "按还在比的两套盘");
]), "那段时间");
assert.equal(lifePeriodLabel([
{ status: "confirmed", datePrecision: "year", occurredFrom: "2018-01-01", occurredTo: null },
{ status: "confirmed", datePrecision: "year", occurredFrom: "2020-06-01", occurredTo: null },
]), "2018–2020 年这段里");
{ status: "confirmed", domain: "education", datePrecision: "year", occurredFrom: "2016-01-01", occurredTo: null },
{ status: "confirmed", domain: "career", datePrecision: "year", occurredFrom: "2020-06-01", occurredTo: null },
], "education"), "2016 年前后");
assert.equal(lifePeriodLabel([
{ status: "confirmed", domain: "education", datePrecision: "year", occurredFrom: "2016-01-01", occurredTo: null },
], "relocation"), "那段时间");
});
test("known-event quality probe asks 发挥失常 instead of existence", () => {
const frame = buildChoiceFrame({
method_id: "d5_education",
ask_theme: "education_style",
domain: "education",
user_prompt_hint: "unused",
}, {
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2015-06-01",
occurredTo: null,
}],
probes: [{
year: 2015,
year_label: "2015 年前后",
domain: "education",
event_family: "高考或重要考试发挥明显失常、压力很大",
source: "known_event_quality",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2015 年前后。已有高考或考试经历。请写成一句自然语言,问那次是否发挥失常或压力特别大。不得改年份。",
role: "distinguish",
}],
});
assert.equal(frame.period, "2015 年前后");
assert.match(frame.why, /发挥失常/);
assert.match(frame.why, /请写成/);
assert.doesNotMatch(`${frame.why}${frame.option_a_hint}${frame.option_b_hint}`, /更像哪一件/);
});
test("age-band fallback uses birth date, not another event's year", () => {
const frame = buildChoiceFrame({
method_id: "d4_home",
ask_theme: "home_change",
domain: "relocation",
user_prompt_hint: "unused",
}, {
birthDate: "1997-08-08",
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}],
});
assert.equal(frame.period, "2018 年前后");
assert.match(frame.option_a_hint, /是,大概就在那段时间/);
assert.doesNotMatch(frame.period, /2016/);
});
test("agent choice copy rejects appearance, scars, clock times, and incomplete C/D", () => {
@@ -130,10 +244,10 @@ test("agent choice copy rejects appearance, scars, clock times, and incomplete C
assert.ok(parseAgentChoiceCopy(SAMPLE_COPY));
});
test("GET card appears only after the Agent writes choice copy onto the focus", () => {
test("GET card stays hidden on an empty ledger even if the Agent already wrote choice copy", () => {
const withoutCopy = projectRectificationChoiceCard({ evidence: [] });
assert.equal(withoutCopy, null);
const withCopy = projectRectificationChoiceCard({
const leftoverOpening = projectRectificationChoiceCard({
evidence: [],
activeFocus: {
intent: "collect_method_evidence",
@@ -142,16 +256,119 @@ test("GET card appears only after the Agent writes choice copy onto the focus",
expectedAnswerSchema: { choice: SAMPLE_COPY },
},
});
assert.equal(withCopy?.prompt, SAMPLE_COPY.prompt);
assert.equal(withCopy?.options[2]?.label, SAMPLE_COPY.option_c);
assert.ok(parseRectificationChoiceCard(withCopy));
assert.equal(leftoverOpening, null);
const distinguish = projectRectificationChoiceCard({
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "relationship",
datePrecision: "year",
occurredFrom: "2018-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "career",
datePrecision: "year",
occurredFrom: "2019-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "family",
datePrecision: "year",
occurredFrom: "2020-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "occupation",
datePrecision: "unknown",
occurredFrom: null,
occurredTo: null,
}],
observations: [{ layer: "d9", candidates_differ: true, ask_theme: "relationship_style" }],
eventProbes: [{
year: 2018,
year_label: "2018 年前后",
domain: "relationship",
event_family: "认真关系进入、结束或关系观明显转变",
source: "dasha_activation",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2018 年前后。事件家族:认真关系进入、结束或关系观明显转变。请写成一句自然语言是/否题。不得改年份。",
role: "reverse_verify",
}],
activeFocus: {
intent: "distinguish_candidates",
targetDomain: "relationship",
targetKind: "relationship_change",
expectedAnswerSchema: { choice: SAMPLE_COPY },
},
});
assert.equal(distinguish?.prompt, SAMPLE_COPY.prompt);
assert.equal(distinguish?.options[2]?.label, SAMPLE_COPY.option_c);
assert.ok(parseRectificationChoiceCard(distinguish));
});
test("opening follow-up ships a discriminator frame, not a canned user card", () => {
test("opening follow-up asks for a dated event in natural language, not a choice card", () => {
const plan = buildMethodFollowupPlan({ evidence: [] });
assert.equal(plan.next_followup?.method_id, "dasha_events");
assert.ok(plan.next_followup?.choice_frame);
assert.equal(plan.next_followup?.choice_frame.choice_mode, "A/B/C/D");
assert.doesNotMatch(plan.next_followup?.user_prompt_hint ?? "", /请用 A\/B\/C\/D 回答/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /expectedAnswerSchema\.choice/);
assert.equal(plan.next_followup?.choice_frame, null);
assert.doesNotMatch(plan.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /自然语言/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /不要写 expectedAnswerSchema\.choice/);
});
test("distinguish follow-up copy forbids competing-chart ranking", () => {
const plan = buildMethodFollowupPlan({
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "relationship",
datePrecision: "year",
occurredFrom: "2018-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "career",
datePrecision: "year",
occurredFrom: "2019-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "family",
datePrecision: "year",
occurredFrom: "2020-01-01",
occurredTo: null,
}, {
status: "confirmed",
domain: "occupation",
datePrecision: "unknown",
occurredFrom: null,
occurredTo: null,
}, {
status: "confirmed",
domain: "horary",
datePrecision: "day",
occurredFrom: "2024-01-01",
occurredTo: null,
}],
precisionStage: "d4_refine",
eventProbes: [MOVE_PROBE],
birthDate: "1997-08-08",
});
assert.equal(plan.next_followup?.choice_frame?.period, "2016 年前后");
assert.doesNotMatch(plan.next_followup?.choice_frame?.option_a_hint ?? "", /更像哪一件|两套盘|可能性/);
assert.doesNotMatch(plan.next_followup?.choice_frame?.option_b_hint ?? "", /更像哪一件|两套盘|可能性/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /自己写题干/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /不得发明年份/);
});
@@ -4,9 +4,11 @@ import test from "node:test";
import {
SEALED_MINUTE_HOLDOUT,
UNIQUE_MINUTE_CLOSED_COPY,
buildConfirmationGate,
readVedastroMinuteSensitiveStatus,
sessionOutcomeFromGate,
uniqueMinutePath,
} from "../src/lib/rectification-agentic/v9/confirmation-gate.ts";
import { RECTIFICATION_POLICY } from "../src/lib/rectification-policy.ts";
import { RECTIFICATION_SKILL_VERSION } from "../src/lib/rectification-agentic/v9/case-status.ts";
@@ -107,6 +109,10 @@ test("VedAstro not_evaluated is not described as fail and still forbids confirma
assert.equal(adjacent.status, "passed");
assert.equal(holdout.status, "not_ready");
assert.equal(gate.confirmation_allowed, false);
assert.equal(gate.unique_minute_path, "closed_at_representative");
assert.ok(holdout.user_meaning.includes(UNIQUE_MINUTE_CLOSED_COPY));
assert.equal(uniqueMinutePath(false), "closed_at_representative");
assert.equal(uniqueMinutePath(true), "awaiting_user_consent");
});
test("a 25-minute plateau stays confirmation-blocked as an indistinguishable range", () => {
@@ -141,6 +147,12 @@ test("a 25-minute plateau stays confirmation-blocked as an indistinguishable ran
confirmationAllowed: false,
interviewOpen: false,
}).kind, "adopt_representative");
assert.match(sessionOutcomeFromGate({
selectionAllowed: true,
proposeAllowed: true,
confirmationAllowed: false,
interviewOpen: false,
}).user_meaning, /本会话以代表性时间收口,不确认唯一分钟/);
});
test("holdout not_ready forbids unique-minute copy and still blocks confirm", async () => {
@@ -159,6 +171,10 @@ test("holdout not_ready forbids unique-minute copy and still blocks confirm", as
});
const serialized = JSON.stringify(projection);
assert.equal(projection.confirmation_allowed, false);
assert.equal(
(projection.confirmation_gate as ReturnType<typeof buildConfirmationGate>).unique_minute_path,
"closed_at_representative",
);
assert.equal(projection.unique_minute_claim, false);
assert.doesNotMatch(serialized, /±2 分钟/);
assert.match(serialized, /candidate_range_not_birth_time_truth/);
@@ -167,13 +183,15 @@ test("holdout not_ready forbids unique-minute copy and still blocks confirm", as
assert.match(skill, /confirmation_gate/);
assert.match(skill, /not_evaluated/);
assert.match(skill, /session_outcome=adopt_representative/);
assert.match(skill, /还不能确认唯一分钟/);
assert.match(skill, /本会话以代表性时间收口,不确认唯一分钟/);
assert.match(skill, /unique_minute_path=closed_at_representative/);
assert.doesNotMatch(skill, /还不能确认唯一分钟/);
assert.match(candidateComparison, /confirmation_gate/);
assert.match(agentSource, /confirmation_gate/);
assert.match(agentSource, /session_outcome=adopt_representative/);
assert.doesNotMatch(agentSource, /±2 分钟/);
assert.equal(PUBLIC_RECTIFICATION_TOOLS.length, 13);
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.10");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.11");
const accounting = fakeAccounting({
...receiptHandlers,
+155 -15
View File
@@ -137,6 +137,72 @@ test("eight-method routing asks relationship after dated education, not relocati
assert.equal(plan.methods.find((item) => item.method_id === "appearance")?.status, "skipped_by_policy");
});
test("dated evidence plus dasha conflict probe asks that event before method rotation and blocks offer", () => {
const plan = buildMethodFollowupPlan({
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}],
eventProbes: [{
year: 2018,
year_label: "2018 年前后",
domain: "career",
event_family: "入职、升职或职责明显加重",
source: "dasha_activation",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2018 年前后。请写成一句自然语言,问是否入职或职责加重。",
role: "reverse_verify",
}],
});
assert.equal(plan.next_followup?.source, "event_probe");
assert.equal(plan.next_followup?.intent, "distinguish_candidates");
assert.equal(plan.next_followup?.domain, "career");
assert.equal(plan.next_followup?.choice_frame?.scoring, true);
assert.equal(plan.next_followup?.choice_frame?.period, "2018 年前后");
assert.match(plan.next_followup?.user_prompt_hint ?? "", /筛窗/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /不要问两套盘哪个更像/);
assert.equal(isOfferBlockingFollowup(plan.next_followup, plan.methods), true);
assert.equal(conversationalSessionOutcome({
selectionAllowed: true,
proposeAllowed: true,
confirmationAllowed: false,
nextFollowup: plan.next_followup,
methods: plan.methods,
}), "collect_evidence");
});
test("age-band probe does not jump ahead of uncovered relationship", () => {
const plan = buildMethodFollowupPlan({
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "year",
occurredFrom: "2016-01-01",
occurredTo: null,
}],
eventProbes: [{
year: 2018,
year_label: "2018 年前后",
domain: "relocation",
event_family: "搬家、离乡或长期异地",
source: "age_band",
tracks: ["vimshottari", "narayana"],
tracks_agree: false,
unique_minute_claim: false,
user_meaning: "年份锁定 2018 年前后。",
role: "reverse_verify",
}],
});
assert.equal(plan.next_followup?.method_id, "d9_relationship");
assert.equal(plan.next_followup?.source, "method_coverage");
assert.equal(plan.next_followup?.choice_frame, null);
});
test("user-stop action records stated events when the ledger is empty", () => {
const action = buildNextUserAction({
scorableCount: 0,
@@ -179,8 +245,9 @@ test("user-stop action explains the window when follow-up remains but the user s
assert.equal(plan.methods.find((item) => item.method_id === "horary")?.status, "uncovered");
assert.equal(plan.methods.find((item) => item.method_id === "occupation")?.status, "uncovered");
assert.equal(plan.next_followup?.method_id, "d9_relationship");
assert.match(plan.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /D9/);
assert.match(plan.next_followup?.user_prompt_hint ?? "", /自然语言/);
assert.doesNotMatch(plan.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.equal(plan.next_followup?.choice_frame, null);
assert.doesNotMatch(JSON.stringify(plan), UNIQUE_MINUTE_COPY);
});
@@ -287,6 +354,7 @@ test("D9 differ keeps sign names for the type-table report and still forbids uni
assert.equal(plan.next_followup?.source, "varga_observation");
assert.equal(plan.next_followup?.ask_theme, "relationship_style");
assert.match(plan.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.equal(plan.next_followup?.choice_frame?.choice_mode, "A/B/C/D");
assert.doesNotMatch(JSON.stringify(plan), UNIQUE_MINUTE_COPY);
});
@@ -490,7 +558,8 @@ test("read-case follows method plan and keeps D9/D10 type tables when SQL missin
assert.ok(projection.latest_result.indistinguishable_width_minutes >= 25);
assert.equal(projection.latest_result.window_scan?.d9_candidates_differ, true);
assert.doesNotMatch(JSON.stringify(projection), UNIQUE_MINUTE_COPY);
assert.match(JSON.stringify(projection), /A\/B\/C\/D/);
assert.doesNotMatch(JSON.stringify(projection), /A\/B\/C\/D/);
assert.match(JSON.stringify(projection.method_followup_plan.next_followup), /自然语言/);
});
test("accepted batch evidence triggers server rescore without offering adoption", async () => {
@@ -625,9 +694,9 @@ test("rescore failure does not fail the evidence write", async () => {
assert.ok(result.rescore.error_code);
});
test("public tool surface stays at 13 and new cases bind 10.0.10", () => {
test("public tool surface stays at 13 and new cases bind 10.0.11", () => {
assert.equal(PUBLIC_RECTIFICATION_TOOLS.length, 13);
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.10");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.11");
const deprecated = resolveExactSkillPackage(
"jyotish-birth-time-rectification",
"10.0.2",
@@ -685,9 +754,9 @@ test("family then occupation then horary follow the method plan without appearan
nextFollowup: afterFamily.next_followup,
methods: afterFamily.methods,
}), "collect_evidence");
assert.equal(afterFamily.next_followup?.choice_frame.choice_mode, "A/B/C/D");
assert.equal(afterFamily.next_followup?.choice_frame.scoring, true);
assert.match(afterFamily.next_followup?.choice_frame.option_a_hint ?? "", /对外|领导|经营/);
assert.equal(afterFamily.next_followup?.choice_frame, null);
assert.match(afterFamily.next_followup?.user_prompt_hint ?? "", /自然语言/);
assert.doesNotMatch(afterFamily.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
const afterOccupation = buildMethodFollowupPlan({
evidence: [
{ status: "confirmed", domain: "education", datePrecision: "year", occurredFrom: "2016-01-01", occurredTo: null },
@@ -699,7 +768,8 @@ test("family then occupation then horary follow the method plan without appearan
});
assert.equal(afterOccupation.next_followup?.method_id, "horary");
assert.match(afterOccupation.next_followup?.user_prompt_hint ?? "", /第 10 宫|D10|占问/);
assert.match(afterOccupation.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.match(afterOccupation.next_followup?.user_prompt_hint ?? "", /自然语言/);
assert.doesNotMatch(afterOccupation.next_followup?.user_prompt_hint ?? "", /A\/B\/C\/D/);
assert.doesNotMatch(JSON.stringify(afterFamily), /外貌|疤痕|胎记/);
const afterHorary = buildMethodFollowupPlan({
evidence: [
@@ -770,7 +840,19 @@ test("precision stage d4 asks home change not family, and d5 asks education", ()
assert.doesNotMatch(JSON.stringify(d4), UNIQUE_MINUTE_COPY);
});
test("accepted representative time hands off to consultation", () => {
test("accepted representative time reverse-verifies predicted events then hands off", () => {
const careerProbe = {
year: 2018,
year_label: "2018 年前后",
domain: "career" as const,
event_family: "入职、升职或职责明显加重",
source: "dasha_activation" as const,
tracks: ["vimshottari", "narayana"] as const,
tracks_agree: true,
unique_minute_claim: false as const,
user_meaning: "年份锁定 2018 年前后。请写成一句自然语言,问是否入职或职责加重。",
role: "reverse_verify" as const,
};
const plan = buildMethodFollowupPlan({
evidence: [{
status: "confirmed",
@@ -780,28 +862,86 @@ test("accepted representative time hands off to consultation", () => {
occurredTo: null,
}],
accepted: true,
eventProbes: [
{
...careerProbe,
domain: "education",
source: "known_event_quality",
role: "distinguish",
event_family: "高考或重要考试发挥明显失常、压力很大",
},
careerProbe,
],
oosBlindPrompts: [{
domain: "family",
user_meaning: "校时还没用过家人这条线。有没有一件没提过、但记得大概时间的家人变化?",
used_for_scoring: false,
}],
activeFocus: {
intent: "collect_method_evidence",
targetDomain: "relationship",
targetKind: null,
},
});
assert.equal(plan.next_followup, null);
assert.equal(plan.deferred_followup?.method_id, "oos_blind");
assert.equal(plan.deferred_followup?.choice_frame.scoring, false);
assert.match(plan.deferred_followup?.choice_frame.why ?? "", /盘外核对/);
assert.equal(plan.next_followup?.method_id, "reverse_verify");
assert.equal(plan.next_followup?.domain, "career");
assert.equal(plan.next_followup?.choice_frame?.scoring, true);
assert.match(plan.next_followup?.choice_frame?.why ?? "", /按当前采用时间核对/);
assert.equal(plan.deferred_followup, null);
assert.equal(plan.next_followup?.source, "reverse_verify");
const action = buildNextUserAction({
scorableCount: 3,
evidenceCount: 3,
hasLatestResult: true,
selectionAllowed: true,
sessionOutcome: "adopt_representative",
nextFollowup: null,
nextFollowup: plan.next_followup,
workingTime: "05:07",
accepted: true,
});
assert.equal(action.id, "verify_adopted_time");
assert.equal(action.on_user_stop.id, "start_consultation");
assert.doesNotMatch(JSON.stringify({ plan, action }), UNIQUE_MINUTE_COPY);
});
test("accepted representative time without remaining probes hands off to consultation", () => {
const plan = buildMethodFollowupPlan({
evidence: [{
status: "confirmed",
domain: "education",
datePrecision: "month",
occurredFrom: "2016-06-01",
occurredTo: null,
}],
accepted: true,
eventProbes: [{
year: 2016,
year_label: "2016 年前后",
domain: "education",
event_family: "高考或重要考试发挥明显失常、压力很大",
source: "known_event_quality",
tracks: ["vimshottari", "narayana"],
tracks_agree: true,
unique_minute_claim: false,
user_meaning: "年份锁定 2016 年前后。已有高考经历。",
role: "distinguish",
}],
});
assert.equal(plan.next_followup, null);
assert.equal(plan.deferred_followup, null);
const action = buildNextUserAction({
scorableCount: 3,
evidenceCount: 3,
hasLatestResult: true,
selectionAllowed: true,
sessionOutcome: "adopt_representative",
nextFollowup: plan.next_followup,
workingTime: "05:07",
accepted: true,
});
assert.equal(action.id, "start_consultation");
assert.match(action.user_meaning, /看盘/);
assert.match(action.user_meaning, /改选/);
assert.doesNotMatch(JSON.stringify({ plan, action }), UNIQUE_MINUTE_COPY);
});
@@ -206,9 +206,9 @@ test("read-case evidence context keeps day labels and confirm does not rewrite d
assert.equal("p_occurred_from" in confirmCall.args, false);
});
test("new-case skill identity is 10.0.10 and the prompt prefers batch ingest", () => {
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.10");
assert.match(skill, /^version: 10\.0\.10$/m);
test("new-case skill identity is 10.0.11 and the prompt prefers batch ingest", () => {
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.11");
assert.match(skill, /^version: 10\.0\.11$/m);
assert.match(skill, /不要对同一句用户消息里的多件事件逐条 propose\+confirm/);
assert.match(agentSource, /当前轮新事件一律走 rectification-record-evidence-batch/);
assert.doesNotMatch(agentSource, /分别调用 rectification-propose-evidence 和 rectification-confirm-evidence/);
+10 -4
View File
@@ -62,7 +62,8 @@ test("system prompt carries only high-priority boundaries, never the method copy
assert.match(prompt, /不可分区间/);
assert.match(prompt, /confirmation_gate/);
assert.match(prompt, /session_outcome=adopt_representative/);
assert.match(prompt, /还不能确认唯一分钟/);
assert.match(prompt, /本会话以代表性时间收口,不确认唯一分钟/);
assert.match(prompt, /unique_minute_path=closed_at_representative/);
assert.match(prompt, /next_user_action/);
assert.match(prompt, /rectification-offer-candidates/);
assert.match(prompt, /on_user_stop/);
@@ -73,9 +74,14 @@ test("system prompt carries only high-priority boundaries, never the method copy
assert.match(prompt, /精度阶段追问不挡出牌/);
assert.match(prompt, /不得询问外貌、体质、胎记或疤痕/);
assert.match(prompt, /expectedAnswerSchema.choice/);
assert.match(prompt, /option_c、option_d/);
assert.match(prompt, /不要写 choice/);
assert.match(prompt, /「先这样」由服务器补全/);
assert.match(prompt, /盘外核对(不计分)/);
assert.match(prompt, /verify_adopted_time/);
assert.match(prompt, /event_probe/);
assert.match(prompt, /题干由你写成自然语言/);
assert.match(prompt, /不得发明年份/);
assert.doesNotMatch(prompt, /两套盘各自的前事/);
assert.doesNotMatch(prompt, /外貌、体质、胎记或疤痕可以问/);
assert.doesNotMatch(prompt, /分盘句和宫位表由界面展示/);
assert.doesNotMatch(prompt, /不是整张宫位表/);
@@ -87,11 +93,11 @@ test("system prompt carries only high-priority boundaries, never the method copy
test("agent pins the dedicated rectification skill and its fixed version", () => {
assert.equal(RECTIFICATION_V9_SKILL_NAME, "jyotish-birth-time-rectification");
assert.equal(basename(RECTIFICATION_V9_SKILL_PATH), RECTIFICATION_V9_SKILL_NAME);
assert.ok(RECTIFICATION_V9_PACKAGE_PATH.endsWith("skills/jyotish-birth-time-rectification/versions/10.0.10"));
assert.ok(RECTIFICATION_V9_PACKAGE_PATH.endsWith("skills/jyotish-birth-time-rectification/versions/10.0.11"));
assert.notEqual(RECTIFICATION_V9_SKILL_PATH, RECTIFICATION_V9_PACKAGE_PATH);
assert.equal(realpathSync(RECTIFICATION_V9_SKILL_PATH), RECTIFICATION_V9_PACKAGE_PATH);
assert.equal(RECTIFICATION_SKILL_NAME, "jyotish-birth-time-rectification");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.10");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.11");
});
test("step budgets are bounded per action with a hard ceiling", () => {
@@ -94,9 +94,9 @@ test("terminal transitions are one-way and evidence writes stop at terminal", ()
test("the active rectification skill pins the v10 identity and lives in the right directory", () => {
assert.equal(RECTIFICATION_SKILL_NAME, "jyotish-birth-time-rectification");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.10");
assert.equal(RECTIFICATION_SKILL_VERSION, "10.0.11");
assert.match(skill, /^---\nname: jyotish-birth-time-rectification/m);
assert.match(skill, /^version: 10\.0\.10$/m);
assert.match(skill, /^version: 10\.0\.11$/m);
for (const reference of references) {
const content = readFileSync(`${skillDirectory}/references/${reference}`, "utf8");
assert.ok(content.length > 0, `${reference} must be non-empty`);
@@ -209,7 +209,7 @@ test("open RPC passes the pinned skill and server-derived baseline only", async
session_id: SESSION_ID,
status: "draft",
should_start_opening: true,
skill_version: "10.0.10",
skill_version: "10.0.11",
};
}
return null;
@@ -247,11 +247,11 @@ test("open RPC passes the pinned skill and server-derived baseline only", async
});
assert.equal(response.disposition, "created");
assert.equal(response.shouldStartOpening, true);
assert.equal(response.skillVersion, "10.0.10");
assert.equal(response.skillVersion, "10.0.11");
const openCall = accounting.calls.find((call) => call.fn === "open_agentic_rectification_case_v2");
assert.ok(openCall);
assert.equal(openCall.args.p_skill_name, "jyotish-birth-time-rectification");
assert.equal(openCall.args.p_skill_version, "10.0.10");
assert.equal(openCall.args.p_skill_version, "10.0.11");
assert.equal(openCall.args.p_user_id, "user-1");
// The server derives the baseline; the request never carries it from the browser.
assert.equal("birth_date" in openCall.args, false);
@@ -531,7 +531,7 @@ test("English tool-retry narration never becomes the spoken answer", async () =>
});
test("a length-limited spoken answer is not billed or persisted as a completed turn", async () => {
const pinched = "**先看候选结构(还不能确认唯一分钟";
const pinched = "**先看候选结构(本会话以代表性时间收口";
const accounting = fakeAccounting({
...receiptHandlers,
get_agentic_rectification_case_dossier: () => dossierFixture(),
+2 -2
View File
@@ -85,8 +85,8 @@ test("checked-in registry verifies hashed product packages and leaves consult on
[
{
name: "jyotish-birth-time-rectification",
version: "10.0.10",
sha256: "c1c3578afe28b754e5c2e2aa48f9c18097b9d7fea3713f0eabc0bdaf17436846",
version: "10.0.11",
sha256: "66a3282be7b227bb6f77038455b8bc17ddaadaf0279a8b9a94284e9d186975c9",
},
{
name: "jyotish-personal-report",
+6 -1
View File
@@ -170,7 +170,7 @@ def unique_minute_audit_row(allowed: bool) -> dict[str, str]:
return {
"technique": "唯一分钟确认",
"status": "blocked",
"note": "采用不等于确认唯一分钟。",
"note": "本会话以代表性时间收口,不确认唯一分钟。",
}
@@ -218,6 +218,9 @@ def apply_confirmation_decision(receipt: dict[str, Any]) -> dict[str, Any]:
receipt["confirmation_allowed"] = confirmation_allowed
receipt["confirm_allowed"] = confirmation_allowed
receipt["unique_minute_claim"] = False
exact["unique_minute_path"] = (
"awaiting_user_consent" if confirmation_allowed else "closed_at_representative"
)
exact["passed"] = confirmation_allowed
exact["fail_closed"] = True
exact["external_validation_status"] = vedastro_status
@@ -539,6 +542,7 @@ def build_decision_receipt(
"indistinguishable_width_minutes": width,
"max_confirmation_width_minutes": MAX_CONFIRMATION_WIDTH_MINUTES,
"external_validation_status": "not_evaluated",
"unique_minute_path": "closed_at_representative",
"required_scoreable_events": MIN_CONFIRMATION_EVENTS,
"required_scoreable_domains": MIN_CONFIRMATION_DOMAINS,
"reason": "engine_and_external_validation_must_explicitly_pass",
@@ -609,6 +613,7 @@ def build_decision_receipt(
"nakshatra_boundary": packet["nakshatra_boundary"],
"precision_stage": packet["precision_stage"],
"oos_blind_prompts": packet["oos_blind_prompts"],
"discriminating_event_probes": packet.get("discriminating_event_probes") or [],
"horary_observation": build_horary_observation(request),
"unique_minute_claim": False,
})
+590
View File
@@ -0,0 +1,590 @@
"""Public-safe biographical probes from candidate dasha / varga differences.
Inverts event scoring: pick two representative minutes, find calendar years
where Vimshottari + Narayana activation (or true period-start years) differ,
and emit a yes/no life-event question. Never grants a unique minute.
"""
from __future__ import annotations
from datetime import date, datetime, timedelta
from typing import Any, Sequence
from scripts.active_rectification_event_engine import (
DOMAIN_CONFIG,
_active_narayana,
_active_vimshottari,
_score_event,
)
import dasha_analyzer
import narayana_dasha
from scripts.rectification.refinement_packet import match_level
MAX_PROBES = 3
LEVEL_RANK = {"none": 0, "weak": 1, "medium": 2, "strong": 3}
SCORING_LAYERS = ("d1", "d9", "d10", "d4", "d5", "d24", "d7", "d12", "d2", "d11", "d30")
LAYER_DOMAIN = {
"d9": "relationship",
"d10": "career",
"d4": "relocation",
"d5": "education",
"d24": "education",
"d7": "family",
"d12": "family",
"d2": "finance",
"d11": "finance",
"d30": "health_pressure",
}
STAGE_DOMAIN = {
"d9_refine": "relationship",
"d10_refine": "career",
"d4_refine": "relocation",
"theme_refine": "relocation",
"d5_refine": "education",
}
VOLUNTEER_ONLY = frozenset({"finance", "health_pressure"})
DOMAIN_CATALOG: dict[str, dict[str, Any]] = {
"education": {
"event_family": "升学、高考、转学或学习环境变化",
"quality_family": "高考或重要考试发挥明显失常、压力很大",
"kind": "education_milestone",
"age_lo": 16,
"age_hi": 18,
"varga": "D5 / D24",
},
"relocation": {
"event_family": "搬家、离乡或长期异地",
"quality_family": "搬家、离乡或住宿结构明显变化",
"kind": "home_change",
"age_lo": 18,
"age_hi": 24,
"varga": "D4",
},
"relationship": {
"event_family": "认真关系进入、结束或关系观明显转变",
"quality_family": "认真关系进入、结束或关系观明显转变",
"kind": "relationship_change",
"age_lo": 21,
"age_hi": 26,
"varga": "D9",
},
"career": {
"event_family": "入职、升职或职责明显加重",
"quality_family": "入职、升职或职责明显加重",
"kind": "career_change",
"age_lo": 22,
"age_hi": 30,
"varga": "D10",
},
"family": {
"event_family": "家人相关的明显变化",
"quality_family": "家人相关的明显变化",
"kind": "family_event",
"age_lo": 18,
"age_hi": 30,
"varga": "D12 / D7 / D3",
},
"finance": {
"event_family": "收入、资产或财务明显变化",
"quality_family": "收入、资产或财务明显变化",
"kind": "finance_change",
"age_lo": 22,
"age_hi": 32,
"varga": "D2 / D11",
},
"health_pressure": {
"event_family": "健康、事故或持续压力明显变化",
"quality_family": "健康、事故或持续压力明显变化",
"kind": "self_health_event",
"age_lo": 16,
"age_hi": 40,
"varga": "D30",
},
}
def _clock(value: str) -> int:
return int(value[:2]) * 60 + int(value[3:5])
def _context_time(context: dict[str, Any]) -> str | None:
feature = context.get("feature") if isinstance(context.get("feature"), dict) else {}
raw = feature.get("time")
if isinstance(raw, str) and len(raw) >= 5:
return raw[:5]
at = context.get("candidate_at")
if isinstance(at, datetime):
return at.strftime("%H:%M")
return None
def _birth_year(value: object) -> int | None:
text = str(value or "").strip()
if len(text) < 4 or not text[:4].isdigit():
return None
year = int(text[:4])
return year if 1900 <= year <= 2100 else None
def _event_year(event: dict[str, Any]) -> int | None:
for key in ("date", "date_start", "occurred_from"):
year = _birth_year(event.get(key))
if year is not None:
return year
return None
def _year_label(year: int) -> str:
return f"{year} 年前后"
def _age_band_year(birth_year: int, domain: str, today: date) -> int | None:
catalog = DOMAIN_CATALOG.get(domain)
if not catalog:
return None
age = (int(catalog["age_lo"]) + int(catalog["age_hi"])) // 2
year = birth_year + age
latest = min(today.year, birth_year + 80)
earliest = birth_year + 5
if year < earliest or year > latest:
return None
return year
def _probe_domains(
scan: dict[str, Any],
precision_current: str | None,
events: Sequence[dict[str, Any]],
) -> list[str]:
volunteered = {
str(event.get("domain"))
for event in events
if isinstance(event, dict) and event.get("domain")
}
ordered: list[str] = []
stage_domain = STAGE_DOMAIN.get(str(precision_current or ""))
if stage_domain:
ordered.append(stage_domain)
for layer in SCORING_LAYERS:
domain = LAYER_DOMAIN.get(layer)
if not domain or domain in ordered:
continue
if not scan.get(f"{layer}_candidates_differ"):
continue
if domain in VOLUNTEER_ONLY and domain not in volunteered:
continue
ordered.append(domain)
if not ordered and scan.get("d1_candidates_differ"):
ordered.append("education")
return ordered
def _static_contexts(built: dict[str, Any]) -> list[dict[str, Any]]:
rows: list[dict[str, Any]] = []
for context in built.get("static_contexts") or []:
if isinstance(context, dict) and _context_time(context):
rows.append(context)
rows.sort(key=lambda item: _clock(str(_context_time(item))))
return rows
def _pick_representatives(
built: dict[str, Any],
scan: dict[str, Any],
candidate_times: Sequence[str],
representative_time: str | None,
) -> tuple[dict[str, Any], dict[str, Any]] | None:
contexts = _static_contexts(built)
by_time = {_context_time(item): item for item in contexts}
times = [str(_context_time(item)) for item in contexts]
for transition in scan.get("transitions") or []:
if not isinstance(transition, dict):
continue
layer = transition.get("layer")
at = str(transition.get("at") or "")[:5]
if layer not in SCORING_LAYERS or at not in by_time:
continue
index = times.index(at)
left = times[index - 1] if index > 0 else at
if left != at:
return by_time[left], by_time[at]
picked: list[str] = []
for raw in [*candidate_times, representative_time]:
time = str(raw or "")[:5]
if len(time) >= 5 and time in by_time and time not in picked:
picked.append(time)
if len(picked) >= 2:
return by_time[picked[0]], by_time[picked[-1]]
if len(times) >= 2:
return by_time[times[0]], by_time[times[-1]]
return None
def _scoreable(context: dict[str, Any]) -> bool:
chart = context.get("chart")
planets = context.get("planet_longitudes")
vargas = context.get("varga_charts")
return (
isinstance(chart, dict)
and isinstance(planets, dict)
and isinstance(vargas, dict)
and isinstance(planets.get("Moon"), (int, float))
and isinstance(context.get("ascendant_index"), int)
)
def _candidate_at(context: dict[str, Any], birth_date: str) -> datetime | None:
at = context.get("candidate_at")
if isinstance(at, datetime):
return at
time = _context_time(context)
if not time:
return None
try:
return datetime.strptime(f"{birth_date} {time}", "%Y-%m-%d %H:%M")
except ValueError:
return None
def _has_domain_activation(rule_ids: Sequence[str]) -> bool:
return any(
("_domain_" in str(item) or str(item).endswith("_domain_house") or str(item).endswith("_domain_lord") or str(item).endswith("_domain_varga"))
and not str(item).startswith("no_")
for item in rule_ids
)
def _discriminates(left: Sequence[str], right: Sequence[str]) -> bool:
left_rank = LEVEL_RANK.get(match_level(left), 0)
right_rank = LEVEL_RANK.get(match_level(right), 0)
if abs(left_rank - right_rank) >= 2:
return True
return _has_domain_activation(left) != _has_domain_activation(right)
def _tracks_present(rule_ids: Sequence[str]) -> tuple[bool, bool]:
text = [str(item) for item in rule_ids]
return (
any(item.startswith("vim_") for item in text),
any(item.startswith("narayana_") for item in text),
)
def _vim_start_years(birth_date: str, moon_longitude: float, lo: int, hi: int) -> list[int]:
nakshatra, progress, _ = dasha_analyzer.lon_to_nakshatra(float(moon_longitude))
timeline, _, _, _ = dasha_analyzer.build_dasha_timeline(birth_date, nakshatra, progress)
years: list[int] = []
for major in timeline:
start = major.get("start")
if isinstance(start, datetime) and lo <= start.year <= hi:
years.append(start.year)
for minor in dasha_analyzer.build_antardasha(major):
minor_start = minor.get("start")
if isinstance(minor_start, datetime) and lo <= minor_start.year <= hi:
years.append(minor_start.year)
return years
def _narayana_start_years(
ascendant_index: int,
planet_longitudes: dict[str, float],
birth_date: str,
lo: int,
hi: int,
) -> list[int] | None:
periods = narayana_dasha.calc_narayana_mahadasha(ascendant_index, planet_longitudes)
if not periods:
return None
birth = datetime.strptime(birth_date, "%Y-%m-%d")
years: list[int] = []
for major in periods:
start_age = major.get("start_age")
if not isinstance(start_age, (int, float)):
return None
year = (birth + timedelta(days=float(start_age) * 365.2425)).year
if lo <= year <= hi:
years.append(year)
antars = narayana_dasha.calc_narayana_antardasha(periods, int(major["sign_idx"]))
for minor in antars:
minor_age = minor.get("start_age")
if not isinstance(minor_age, (int, float)):
continue
minor_year = (birth + timedelta(days=float(minor_age) * 365.2425)).year
if lo <= minor_year <= hi:
years.append(minor_year)
return years
def _boundary_years(left: list[int], right: list[int]) -> set[int]:
years: set[int] = set()
for one, two in zip(left, right):
if abs(one - two) >= 1:
years.add(one)
years.add(two)
return years
def _score_year(
context: dict[str, Any],
*,
birth_date: str,
domain: str,
year: int,
) -> dict[str, Any] | None:
catalog = DOMAIN_CATALOG[domain]
prefixes, _ = DOMAIN_CONFIG[domain]
varga_charts = context.get("varga_charts") or {}
domain_vargas = [varga_charts.get(prefix) for prefix in prefixes]
if any(item is None for item in domain_vargas):
return None
candidate_at = _candidate_at(context, birth_date)
moon = (context.get("planet_longitudes") or {}).get("Moon")
if candidate_at is None or not isinstance(moon, (int, float)):
return None
event_at = datetime(year, 7, 1)
event = {
"id": f"probe-{domain}-{year}",
"domain": domain,
"event_kind": catalog["kind"],
"date": f"{year}-07-01",
"precision": "year",
"summary": catalog["event_family"],
}
try:
vimshottari = _active_vimshottari(birth_date, float(moon), event_at)
narayana = _active_narayana(
int(context["ascendant_index"]),
context["planet_longitudes"],
candidate_at,
event_at,
)
except (KeyError, TypeError, ValueError):
return None
if narayana[0] is None or narayana[1] is None:
return None
return _score_event(
candidate_time=str(_context_time(context)),
event=event,
natal_chart=context["chart"],
varga_charts=[item for item in domain_vargas if item is not None],
vimshottari=vimshottari,
narayana=narayana,
arudha_padas=context.get("arudha_padas") or {},
)
def _agent_brief(
*,
year_label: str,
family: str,
quality: bool = False,
exam: bool = False,
) -> str:
if exam:
return (
f"年份锁定 {year_label}。已有高考或考试经历。"
"请写成一句自然语言,问那次是否发挥失常或压力特别大。"
"不得改年份。"
)
if quality:
return (
f"年份锁定 {year_label}。已有相关经历。"
f"请写成一句自然语言,问{family}有没有发生过。"
"不得改年份。"
)
return (
f"年份锁定 {year_label}。事件家族:{family}。"
"请写成一句自然语言是/否题。"
"不得改年份。"
)
def _public_probe(
*,
year: int,
domain: str,
source: str,
tracks: Sequence[str],
tracks_agree: bool,
user_meaning: str,
event_family: str,
) -> dict[str, Any]:
return {
"year": year,
"year_label": _year_label(year),
"domain": domain,
"event_family": event_family,
"source": source,
"tracks": list(tracks),
"tracks_agree": tracks_agree,
"unique_minute_claim": False,
"user_meaning": user_meaning,
"role": "distinguish" if source == "known_event_quality" else "reverse_verify",
}
def _quality_probes(
events: Sequence[dict[str, Any]],
domains: Sequence[str],
) -> list[dict[str, Any]]:
rows: list[dict[str, Any]] = []
seen: set[tuple[str, int]] = set()
for event in events:
if not isinstance(event, dict):
continue
domain = str(event.get("domain") or "")
year = _event_year(event)
if domain not in domains or year is None or (domain, year) in seen:
continue
seen.add((domain, year))
summary = str(event.get("summary") or "")
family = str(DOMAIN_CATALOG[domain]["quality_family"])
exam = domain == "education" and ("高考" in summary or "考试" in summary)
rows.append(_public_probe(
year=year,
domain=domain,
source="known_event_quality",
tracks=("vimshottari", "narayana"),
tracks_agree=True,
user_meaning=_agent_brief(
year_label=_year_label(year),
family=family,
quality=True,
exam=exam,
),
event_family=family,
))
return rows
def _evaluate_year(
left: dict[str, Any],
right: dict[str, Any],
*,
birth_date: str,
domain: str,
year: int,
source: str,
) -> dict[str, Any] | None:
scored_left = _score_year(left, birth_date=birth_date, domain=domain, year=year)
scored_right = _score_year(right, birth_date=birth_date, domain=domain, year=year)
if scored_left is None or scored_right is None:
return None
left_rules = scored_left.get("rule_ids") or []
right_rules = scored_right.get("rule_ids") or []
if not _discriminates(left_rules, right_rules):
return None
stronger = left_rules if LEVEL_RANK[match_level(left_rules)] >= LEVEL_RANK[match_level(right_rules)] else right_rules
vim_hit, narayana_hit = _tracks_present(stronger)
return _public_probe(
year=year,
domain=domain,
source=source,
tracks=("vimshottari", "narayana"),
tracks_agree=vim_hit and narayana_hit,
user_meaning=_agent_brief(
year_label=_year_label(year),
family=str(DOMAIN_CATALOG[domain]["event_family"]),
),
event_family=str(DOMAIN_CATALOG[domain]["event_family"]),
)
def discriminating_event_probes(
request: dict[str, Any],
built: dict[str, Any],
*,
scan: dict[str, Any],
candidate_times: Sequence[str],
representative_time: str | None,
precision_current: str | None = None,
today: date | None = None,
) -> list[dict[str, Any]]:
birth_date = str(request.get("birth_date") or "").strip()
birth_year = _birth_year(birth_date)
if birth_year is None:
return []
try:
datetime.strptime(birth_date, "%Y-%m-%d")
except ValueError:
return []
now = today or date.today()
events = [item for item in (request.get("events") or []) if isinstance(item, dict)]
domains = _probe_domains(scan, precision_current, events)
if not domains:
return []
probes = _quality_probes(events, domains)
covered_domains = {row["domain"] for row in probes}
pair = _pick_representatives(built, scan, candidate_times, representative_time)
lo, hi = birth_year + 5, min(now.year, birth_year + 80)
can_score = (
pair is not None
and _scoreable(pair[0])
and _scoreable(pair[1])
)
dasha_domains: set[str] = set()
if can_score and pair is not None:
left, right = pair
left_moon = float(left["planet_longitudes"]["Moon"])
right_moon = float(right["planet_longitudes"]["Moon"])
vim_years = _boundary_years(
_vim_start_years(birth_date, left_moon, lo, hi),
_vim_start_years(birth_date, right_moon, lo, hi),
)
left_narayana = _narayana_start_years(int(left["ascendant_index"]), left["planet_longitudes"], birth_date, lo, hi)
right_narayana = _narayana_start_years(int(right["ascendant_index"]), right["planet_longitudes"], birth_date, lo, hi)
narayana_years: set[int] = set()
if left_narayana is not None and right_narayana is not None:
narayana_years = _boundary_years(left_narayana, right_narayana)
for domain in domains:
if domain in covered_domains:
continue
boundary = sorted((vim_years | narayana_years) & set(range(lo, hi + 1)))
found = None
for year in boundary:
found = _evaluate_year(
left, right, birth_date=birth_date, domain=domain, year=year, source="dasha_boundary",
)
if found:
break
if found is None:
midpoint = _age_band_year(birth_year, domain, now)
if midpoint is not None:
found = _evaluate_year(
left, right, birth_date=birth_date, domain=domain, year=midpoint, source="dasha_activation",
)
if found:
probes.append(found)
dasha_domains.add(domain)
covered_domains.add(domain)
for domain in domains:
if domain in covered_domains or domain in dasha_domains:
continue
year = _age_band_year(birth_year, domain, now)
if year is None:
continue
probes.append(_public_probe(
year=year,
domain=domain,
source="age_band",
tracks=("vimshottari", "narayana"),
tracks_agree=False,
user_meaning=_agent_brief(
year_label=_year_label(year),
family=str(DOMAIN_CATALOG[domain]["event_family"]),
),
event_family=str(DOMAIN_CATALOG[domain]["event_family"]),
))
covered_domains.add(domain)
public: list[dict[str, Any]] = []
seen: set[tuple[str, int, str]] = set()
for row in probes:
key = (str(row["domain"]), int(row["year"]), str(row["source"]))
encoded = str(row)
if key in seen or "points" in encoded:
continue
seen.add(key)
public.append(row)
if len(public) >= MAX_PROBES:
break
return public
+12 -1
View File
@@ -540,6 +540,16 @@ def build_refinement_packet(
cluster = cluster_scan(built, candidate_times, representative_time, cluster_width_minutes)
ledger = event_dasha_ledger(request, built, representative_time)
agreement = dasha_agreement(built, candidate_times)
stage = precision_stage(cluster, len(request.get("events") or []))
from scripts.rectification.event_probes import discriminating_event_probes
probes = discriminating_event_probes(
request,
built,
scan=cluster,
candidate_times=candidate_times,
representative_time=representative_time,
precision_current=str(stage.get("current") or "") or None,
)
return {
"window_scan": scan,
"event_dasha_ledger": ledger,
@@ -547,8 +557,9 @@ def build_refinement_packet(
"dasha_agreement": agreement,
"lagna_contrast": lagna_contrast(built),
"nakshatra_boundary": nakshatra_boundary(built, representative_time),
"precision_stage": precision_stage(cluster, len(request.get("events") or [])),
"precision_stage": stage,
"oos_blind_prompts": oos_blind_prompts(request),
"discriminating_event_probes": probes,
"unique_minute_claim": False,
"confirmation_allowed": False,
}
@@ -1,6 +1,6 @@
---
name: jyotish-birth-time-rectification
version: 10.0.10
version: 10.0.11
description: "生时校正专用 Skill(V10)。以服务器权威 Case、ConversationFocus 与 CaseConversationSummary 驱动低负担访谈;批量证据逐项判定,candidate / accepted / confirmed 严格分离,全部计算与持久化只走服务端工具。触发词:生时校正、出生时间校正、校正出生时间、rectification、birth time correction。"
---
@@ -38,7 +38,7 @@ description: "生时校正专用 Skill(V10)。以服务器权威 Case、Conv
|---|---|
| `draft` / `collecting_evidence` | 继续收集/修订带日期事件;可读取诊断。`next_user_action.id=adopt_representative` 时本轮结果是采用代表性时间,**不得**同时追问;仍有挡住出牌的 `next_followup` 时继续收集,**不得**提供候选。`selection_allowed` 不够作为出示卡片的理由;提出门看 `propose_allowed` 且访谈已停或用户喊停 |
| `candidate_ready` | 可比较候选、说明当前边界;仍可继续补证据 |
| `candidate_accepted` | 已采用候选,但**不等于**唯一分钟确认;可继续补证据或进入确认门 |
| `candidate_accepted` | 已采用代表性时间。采用后先按该分钟核最多两件前事,对不上可改选其他候选;核对结束再用这个时间看盘。`unique_minute_path=closed_at_representative` 时本会话以此收口,**不得**进入唯一分钟确认 |
| `needs_rebaseline` | 出生资料基线已变化,候选失效;只允许重新收集/修订事件,禁止引用旧候选 |
| `paused` | 可继续访谈;不要声称结束 |
| `confirmed` / `closed` / `abandoned` / `superseded` | terminal Case,只读历史;不得追加/修订/确认证据,不得采用/确认候选,不得关闭第二次 |
@@ -75,7 +75,7 @@ description: "生时校正专用 Skill(V10)。以服务器权威 Case、Conv
`CaseConversationSummary` 是长会话的权威记忆,至少投影:confirmed evidence summary、pending revisions、active focus、declined/skipped topics、candidate divergence summary、missing evidence categories、`method_followup_plan`、last result policy。
- 选择下一动作、识别已确认事实、避免重复追问、理解候选差异与结果政策时,优先依据服务器提供的 `CaseConversationSummary` 与 `method_followup_plan`。
- 不要按 `missing_evidence_categories` 轮询迁居。财务与健康只有用户主动说才问,仍可计分。下一问只跟 `method_followup_plan.next_followup`。先走完方法覆盖(感情 → 事业 → 家人 → 职业 → 占问),再对已覆盖领域做精度追问。占问不挡出牌;职业挡出牌。外貌、体质、胎记或疤痕不得追问。`choice_frame` 只提供冲突节点和四选项角色 hint;题干和 A/B/C/D 由你写入 `set-focus.expectedAnswerSchema.choice`,界面出点选卡。正文不要复述选项。「先这样」由服务器补全。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,本轮零追问;`deferred_followup` 留给用户以后再补,不得当成本轮问题。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问,不得 offer。
- 不要按 `missing_evidence_categories` 轮询迁居。财务与健康只有用户主动说才问,仍可计分。下一问只跟 `method_followup_plan.next_followup`。先走完方法覆盖(感情 → 事业 → 家人 → 职业 → 占问),再对已覆盖领域做精度追问。已有带日期事件且存在 `discriminating_event_probes` 大运冲突探针时,先问该前事筛窗,`source=event_probe` 挡住出牌,不要继续轮询方法层,不要 offer。占问不挡出牌;职业挡出牌。外貌、体质、胎记或疤痕不得追问。收集经历用自然语言问一件带大概年份的事,set-focus 不要写 choice。只有 `next_followup` 带 `choice_frame`(冲突探针、候选已经分不开或采用后核对前事)时才写 A/B/C/D 点选卡;题干由你写成自然语言,年份和事件家族以服务器探针为准,不得发明年份,不要问两套盘哪个更像。正文不要复述选项。「先这样」由服务器补全。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,本轮零追问。`next_user_action.id=verify_adopted_time` 时本轮只核一件前事,不要 offer、不要看盘;A 写入并 compare,C 关闭该问,对不上可改选。`id=start_consultation` 时请用户用当前采用时间看盘。`deferred_followup` 留给用户以后再补,不得当成本轮问题。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问,不得 offer。
- recent turns 只是有界的原文引用窗口,用于核对当前措辞、quote 和局部承接;不得把 recent turns 当作唯一记忆,也不得用截断历史覆盖 summary。
- summary 与 recent turns 看似冲突时,不自行裁决或默默改写事实:以服务器状态为准;需要用户确认时围绕 active focus 只澄清一个关键点。
- 超过长会话窗口后仍不得忘记已确认证据、pending revision、拒答主题或 active focus。
@@ -108,11 +108,11 @@ description: "生时校正专用 Skill(V10)。以服务器权威 Case、Conv
- `candidate`:引擎对当前证据的归一化比较结果,称“当前候选 / 相对支持度”,**不得**称概率、置信度或确定性。
- `accepted`:用户明确选择的当前排盘时间,称“校正采用时间”,**不得**称“已确认唯一出生时间”。
- `confirmed`:通过服务器确认门且用户明确同意,称“已确认校正时间”。
- `session_outcome=adopt_representative` / `next_user_action.id=adopt_representative`:本轮**有结果**,结果是采用代表性时间作当前排盘。正文必须说还不能确认唯一分钟。不要调用 confirm。只有这时才调用 `rectification-offer-candidates`。服务器会拒绝访谈未停且用户未喊停的 offer。`collecting_evidence` 且仍有挡住出牌的 `next_followup` 时不得 offer/accept。`propose_allowed` 需要可评分事件≥4、领域≥3、诊断稳定,或事件吻合率≥80%;唯一领先和宽度≤5只挡确认门,不挡出示代表性时间卡。精度阶段追问在方法覆盖完成后才问,且不挡出牌。KP 观察不计分、不挡提出门。
- 确认门以 `latest_result.confirmation_gate` 为准。任一 blocker 未通过时只能说还不能确认;用户仍可 accepted 代表性候选。
- `session_outcome=adopt_representative` / `next_user_action.id=adopt_representative`:本轮**有结果**,结果是采用代表性时间作当前排盘。正文必须说本会话以代表性时间收口,不确认唯一分钟。不要调用 confirm。只有这时才调用 `rectification-offer-candidates`。服务器会拒绝访谈未停且用户未喊停的 offer。`collecting_evidence` 且仍有挡住出牌的 `next_followup` 时不得 offer/accept。`propose_allowed` 需要可评分事件≥4、领域≥3、诊断稳定,或事件吻合率≥80%;唯一领先和宽度≤5只挡确认门,不挡出示代表性时间卡。精度阶段追问在方法覆盖完成后才问,且不挡出牌。KP 观察不计分、不挡提出门。
- 确认门以 `latest_result.confirmation_gate` 为准。`unique_minute_path=closed_at_representative` 或任一 blocker 未通过时,本会话以代表性时间收口,不得把唯一分钟确认当下一步;用户仍可 accepted 代表性候选。
- `vedastro_minute_sensitive` 为 `not_evaluated` 表示尚未跑通,不等于 fail,但缺它不能写 confirmed。
- 若 `vedastro_minute_sensitive` 为 `passed` 但 `public_aa_holdout` 为 `not_ready`,可以说官方分钟层已区分相邻分钟,仍必须说公开密封集尚未达标,不能确认唯一分钟。
- `public_aa_holdout` 为 `not_ready` 时不得声称已校准到精确分钟,也不得把确认门放到更细宽度或发布准确率。
- `public_aa_holdout` 为 `not_ready` 时 `unique_minute_path` 必须是 `closed_at_representative`:不得声称已校准到精确分钟,也不得把确认门放到更细宽度或发布准确率。本会话以代表性时间收口。
- 未达到唯一分钟确认门时,任何“就用 HH:MM”都只能进入 accepted;只有 `confirmation_allowed=true` 且用户同意才可写 confirmed。
- 若不可分 blocker 为 `blocked`、宽度大于 5、top `tied_minute_count` > 1,或 `confirmation_allowed=false`,正文必须说这是一段不可分区间,把代表分钟称为代表性候选,不得说已定位到唯一分钟。
- 分钟窗口扫描只在服务端。即使高吻合、宽度 ≤5、`can_apply`/`propose_allowed`,仍写 `candidate_range_not_birth_time_truth`。
@@ -123,15 +123,15 @@ description: "生时校正专用 Skill(V10)。以服务器权威 Case、Conv
## 10. 输出与停止条件
- 简体中文。访谈按 skill 路径 C:从候选簇差异生成可点选的 A/B/C/D 主题问卷。界面持有选项;正文只说一句时间窗和为何问。允许模糊日期、允许分多轮。**不得**先逼 10–15 条事件长表。
- 简体中文。访谈按 skill 路径 C:先用自然语言收集带大概年份的经历;只有候选已经分不开时才生成可点选的 A/B/C/D 主题问卷。允许模糊日期、允许分多轮。**不得**一进场就出点选卡,也不得先逼 10–15 条事件长表。
- 每轮最多一个主要问题;完整回复可以零问题,不为了延续对话强行追问,不生成三条推荐问题。
- 用户询问“为什么问这个 / 现在到哪一步 / 还需要多少信息”时,基于服务器状态直接回答,不把问题当作事件。
- 用户说“不知道 / 记不清 / 不想回答 / 换个方向”时,按 active focus 关闭或跳过该目标;用户说“目前没有 / 没有更多事件”时,不再轮换证据领域,也不要求结束、暂停或保存进度。
- 不得询问外貌、体质、胎记或疤痕。D9/D10 类型表是校时方法,写「该分钟下 D9/D10 升 X,与用户所述特质的对应/冲突」,不是咨询命运承诺。职业对照本命第 10 宫和 D10,允许类型表。占问只问一次;有问起时间则观察,没有也不挡出牌。`internal_observations` 可用于选题,类型对照写入验证报告。若用户消息以「盘外核对(不计分)」开头,不得写入可评分证据。
- 精度阶段按本命上升 → D9 → D10 → D4 居所 → D5/D24 成就收窄;家人走 D12/D7/D3 方法覆盖。财务走 D2/D11、健康走 D30,仅在用户主动说时计分,均不得混进 D4。Pada / Hora / Ghati / Bhava / Pranapada / KP 子主只展示换升,不确认唯一分钟。
- 采用后本命按采用分钟重算;不得声称唯一分钟,也不自动进入咨询 Agent。
- 采用候选后只需自然说明 accepted 与 confirmed 边界;不强制下一问,不主动关闭 Case,Session 会保留并可日后继续。
- 不再有固定 10–15 个事件长表、外貌/体型/疤痕主评分、或“稳定确定到精确分钟”的承诺。A/B/C/D 主题问卷与 D9/D10 类型表按本 Skill 使用。80%/60% 只描述事件吻合率。
- 采用后按采用分钟核最多两件服务器探针前事;对得上写入并重算,对不上可改选其他候选。不得声称唯一分钟,也不自动进入咨询 Agent。
- 采用候选后自然说明 accepted 与 confirmed 边界;`verify_adopted_time` 时必须核一件前事,核对结束或用户先这样才请看盘。不主动关闭 Case,Session 会保留并可日后继续。
- 不再有固定 10–15 个事件长表、外貌/体型/疤痕主评分、或“稳定确定到精确分钟”的承诺。A/B/C/D 主题问卷只在候选已经分不开或采用后核对前事时使用。80%/60% 只描述事件吻合率。
- 无法验证时如实降级并说明受限,不得把内部一致性伪装成全球顶级精度。
## 11. 上游同步边界
@@ -47,7 +47,7 @@
- `vedastro_minute_sensitive` 为 `not_evaluated` 表示官方分钟敏感校验尚未跑通,不是 fail;缺它不能写 confirmed。
- 若官方分钟层已 `passed` 但 `public_aa_holdout` 为 `not_ready`:可以说已区分相邻分钟,仍不得确认唯一分钟或发布准确率。
- `public_aa_holdout` 为 `not_ready` 时不得声称已校准到精确分钟,也不得把确认门放到更细宽度或发布准确率。
- 用户仍可 accepted 代表性候选;accepted ≠ confirmed。`session_outcome=adopt_representative` 时正文必须说还不能确认唯一分钟。
- 用户仍可 accepted 代表性候选;accepted ≠ confirmed。`session_outcome=adopt_representative` 时正文必须说本会话以代表性时间收口,不确认唯一分钟。`unique_minute_path=closed_at_representative` 时不得把确认当下一步。
- `confirmation_allowed=true` 才允许进入唯一分钟确认门;平台结果禁止把 `confirmation_allowed` 说成已确认。
- 候选卡仍可展示代表性时间;Agent 不得把该时间写成“已校正到 HH:MM”。
@@ -1,6 +1,6 @@
# Conversation Strategy(V10)
生时校正访谈按 skill 路径 C:从候选簇差异生成 A/B/C/D 主题问卷,而不是 10–15 条事件长表,也不是无结构闲聊。服务器持有事实、状态、权限、焦点与长会话记忆;Agent 负责意图理解、把问卷说清楚、并选择一个有信息增益的下一步。
生时校正访谈按 skill 路径 C:先用自然语言收集带大概年份的经历,再在候选已经分不开时由服务器锁定年份和事件家族,由你写成一句具体生平题干(某年是否搬过家、高考是否发挥失常),用 A/B/C/D 点选卡回答同一件事的吻合程度;不是 10–15 条事件长表,也不是无结构闲聊,更不是让用户给两套盘排序。服务器持有事实、状态、权限、焦点与长会话记忆;Agent 负责意图理解、把问卷说清楚、并选择一个有信息增益的下一步。
## 1. 每轮上下文优先级
@@ -17,13 +17,13 @@ recent turns 不是权威记忆,不得依赖“上一条 assistant 问了什
首次开场只使用服务器 opening brief 中的 Case 状态、出生时间不确定类型、已有证据摘要与当前可询问范围,并自然满足:
- 降低回忆负担:从候选簇差异生成 **A/B/C/D 点选卡**。`choice_frame` 只提供冲突节点和四选项角色 hint;题干和 A/B/C/D 由 Agent 写入 `set-focus.expectedAnswerSchema.choice`。正文不要复述选项。「先这样」由服务器补全。不索要 10–15 条事件长表。
- 降低回忆负担:用自然语言问一件最好记、带大概年份的经历。不要一进场就出 A/B/C/D。不索要 10–15 条事件长表。
- 接受“大概某年 / 那几年 / 某个阶段”等模糊日期,不诱导猜月份、日期或精确时点。
- 不要求一次说完,允许分多轮补充、修正、暂停或换方向。
- 至多一个主问题;开场可以零问题。
- 不固定复述身份、流程、领域列表、证据数量要求或 opening brief 原文。
示例方向(不是固定话术):“2016 年前后,更像哪一件?点下面的选项即可。”
示例方向(不是固定话术):“可以先说一件你记得大概年份的事,比如升学、考试或第一份工作。” 区分阶段的题干由你写成自然语言;年份和事件家族以服务器探针为准,不得发明年份。例如把锁定的 2015 年和搬家写成“2015 年前后你是否搬过家?”,把已有高考经历写成“高考的时候是否发挥失常?”
## 3. 一轮的基本形态
@@ -32,7 +32,7 @@ recent turns 不是权威记忆,不得依赖“上一条 assistant 问了什
3. 自然回应本轮内容,不固定以“收到 / 已记录”开头,不机械复读,不擅自解释事件的“人生意义”。
4. 清晰项先处理;若仍需追问,只保留一个最有信息增益的主问题。完整回复可以没有问题。
5. 不允许在同一回复中既要求补证据、又提供采用候选;不生成三条推荐问题。
6. `next_user_action.id=adopt_representative` 时本轮只解释结果并邀请采用,零追问(除非有 active focus)。仍有挡住出牌的 `next_followup` 时不得出示采用卡。提出门看 `propose_allowed`。精度阶段追问和占问不挡出牌;职业仍挡。不得询问外貌、体质、胎记或疤痕。宽度大于 5 仍可出示代表性时间卡,不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。
6. `next_user_action.id=adopt_representative` 时本轮只解释结果并邀请采用,零追问(除非有 active focus)。`id=verify_adopted_time` 时本轮只核一件前事,不要 offer,不要看盘。仍有挡住出牌的 `next_followup` 时不得出示采用卡。提出门看 `propose_allowed`。精度阶段追问和占问不挡出牌;职业仍挡。不得询问外貌、体质、胎记或疤痕。宽度大于 5 仍可出示代表性时间卡,不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。`unique_minute_path=closed_at_representative` 时本会话以代表性时间收口,不得把唯一分钟确认当下一步。
## 4. ConversationFocus
@@ -73,7 +73,7 @@ active `ConversationFocus` 是承接型意图的唯一目标来源。它由服
追问必须能澄清事实、提高真实日期精度、补足必要方法层或区分候选;否则不提。优先级:
1. 服务器 `CaseConversationSummary.active focus` 指定的唯一目标。
2. `method_followup_plan.next_followup` 指定的下一方法层。方法覆盖优先于对已覆盖领域的精度追问:有日期事件 → 感情 → 事业 → 家人(D12/D7/D3)→ 职业(挡出牌,独立于带日期事业事件)→ 占问(只问一次,不挡出牌)→ 再按精度阶段问关系盘/事业盘/居所(D4)/学业成就(D5,D24 换升并入同一问)。迁居不进领域轮询,只在 `d4_refine` 精度阶段问搬家/住处。财务与健康只有用户主动说才问,仍可计分。不得询问外貌、体质、胎记或疤痕。`choice_frame` 只提供冲突节点;题干和 A/B/C/D 由 Agent 写入点选卡,正文不复述选项。Nakshatra pada / Hora / Ghati / Bhava / Pranapada / KP 子主换升只展示,不阻断采用。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,不得把 `deferred_followup` 当成本轮问题。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问。
2. `method_followup_plan.next_followup` 指定的下一方法层。方法覆盖优先于对已覆盖领域的精度追问:有日期事件 → 感情 → 事业 → 家人(D12/D7/D3)→ 职业(挡出牌,独立于带日期事业事件)→ 占问(只问一次,不挡出牌)→ 再按精度阶段问关系盘/事业盘/居所(D4)/学业成就(D5,D24 换升并入同一问)。已有带日期事件且服务器给出大运冲突探针时,先问该前事筛窗,`source=event_probe` 挡住出牌,不要继续轮询方法层。迁居不进领域轮询,只在 `d4_refine` 精度阶段问搬家/住处。财务与健康只有用户主动说才问,仍可计分。不得询问外貌、体质、胎记或疤痕。收集经历用自然语言。只有候选已经分不开、冲突探针或采用后核对前事时,`choice_frame` 才提供冲突节点;年份和事件家族由服务器 `discriminating_event_probes` 锁定(Vimshottari+Narayana 年界差或同年激活差,没有可问年时才用出生年+年龄带)。题干和 A/B/C/D 由你写成自然语言,A/B 是同一件事的吻合程度,不要照抄 hint,不要问两套盘哪个更像或可能性高低,不得发明年份。Nakshatra pada / Hora / Ghati / Bhava / Pranapada / KP 子主换升只展示,不阻断采用。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,不得把 `deferred_followup` 当成本轮问题。`id=verify_adopted_time` 时本轮只核一件前事。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问。
3. candidate divergence / `internal_observations` 显示真正能区分候选的主题。D9/D10 观察用于选题,并在出牌轮写入类型对照(校时方法,不是命运承诺)。
4. pending revision 的一个关键歧义。
5. 已有证据的必要稳定性补强。
@@ -98,8 +98,8 @@ active `ConversationFocus` 是承接型意图的唯一目标来源。它由服
- 出牌/采用轮正文写入 skill 八法验证报告:候选窗、代表分钟、相对支持、事件–Dasha–Gochara 表、D9/D10 类型对照、技法审计表。卡片仍作 adopt 控件。
- `relative_support` 不是概率,不能写“准确率 70%”。80%/60% 只描述事件吻合率。
- candidate、accepted、confirmed 严格分离;accepted 不是 confirmed。
- `next_user_action.id=adopt_representative` 时本轮结果是采用代表性时间;正文必须说还不能确认唯一分钟。仍有 `next_followup` 时不得出示采用卡。
- 确认门以 `confirmation_gate` 为准。`not_evaluated` 不是 fail;holdout `not_ready` 时不得声称精确分钟或发布准确率。官方分钟层 `passed` 仍不能单独打开确认门。
- `next_user_action.id=adopt_representative` 时本轮结果是采用代表性时间;正文必须说本会话以代表性时间收口,不确认唯一分钟。仍有 `next_followup` 时不得出示采用卡。
- 确认门以 `confirmation_gate` 为准。`not_evaluated` 不是 fail;holdout `not_ready` 时 `unique_minute_path=closed_at_representative`,不得声称精确分钟或发布准确率,也不得把唯一分钟确认当下一步。官方分钟层 `passed` 仍不能单独打开确认门。
- 若 `indistinguishable_width_minutes` > 5 或 top `tied_minute_count` > 1,或 `confirmation_allowed=false`,必须说不可分区间 / 代表性候选,不得说已定位到唯一分钟。accepted ≠ confirmed。
- accepted 后自然说明它不是唯一分钟确认即可;不强制追问,不要求用户结束、暂停或保存进度。
- accepted 后按采用分钟核最多两件前事;对得上写入并重算,对不上可改选。不强制看盘,不要求用户结束、暂停或保存进度。核对结束或用户先这样才 `start_consultation`。
- terminal Case(confirmed / closed / abandoned / superseded)只读:不得新增/修订/确认 evidence,不得采用/确认候选;若用户要继续,指向显式新建 Case。
@@ -0,0 +1,139 @@
---
name: jyotish-birth-time-rectification
version: 10.0.11
description: "生时校正专用 Skill(V10)。以服务器权威 Case、ConversationFocus 与 CaseConversationSummary 驱动低负担访谈;批量证据逐项判定,candidate / accepted / confirmed 严格分离,全部计算与持久化只走服务端工具。触发词:生时校正、出生时间校正、校正出生时间、rectification、birth time correction。"
---
# Jyotish 生时校正(V10)
## 1. 触发条件与方法学归属
本 Skill 只服务 `agentic_rectification_cases` 绑定的生时校正会话:
- 服务端 Case 存在且 `skill_name = 'jyotish-birth-time-rectification'`。
- 用户话题是出生时间 / 出生分钟 / 事件发生时间能否定位到某几分钟,而不是普通解盘或推运。
- 普通咨询、推运、合盘、补救问题交给 `jyotish-vedic-astrology`,不要在这里处理。
生时校正的方法学、访谈策略、证据边界与候选表达规则只定义在本 Skill 及其 references。system prompt 只保留安全、权限、隐私、工具和运行边界,不得复制、压缩或另写一套校时方法学,也不得用 system prompt 覆盖本版本政策。
## 2. 必须先读与服务器权威
进入任何一轮实质工作前读取(服务器会随 Dossier 提供投影,缺文件时以服务器 Dossier 为准):
1. `references/evidence-model.md`:证据种类、日期精度、原文引用、修订链、服务器持有 ID。
2. `references/conversation-strategy.md`:OpeningPolicy、ConversationFocus、长会话记忆、批量证据与追问策略。
3. `references/candidate-comparison.md`:candidate / accepted / confirmed 三层语义与表达边界。
4. `references/technique-routing.md`:技法按主题调用,D9/D10 核心,不一次性调用所有分盘。
5. `references/truth-consent-boundaries.md`:真实性、同意与选择政策。
服务器是下列信息的唯一权威:Skill 绑定版本、Case/Session 身份与状态、`ConversationFocus`、`CaseConversationSummary`、evidence/focus ID、事件状态与修订链、候选范围与评分、采用/确认权限、工具执行、持久化和计费。Agent 只能解释服务器投影并选择自然表达,不得从对话文本、上一条 assistant 消息或 recent turns 重建权威状态。
每次 attempt 必须先完成真实 Skill 绑定和 Case 加载,之后才能执行 action。失败或重试 attempt 的部分文本、工具结果与推断不得当作已提交事实;只依据服务器提交成功的 attempt 与 receipt。
## 3. Case 状态与只读边界
服务器 Dossier 会给出当前 `status`。按表行动:
| status | 允许动作 |
|---|---|
| `draft` / `collecting_evidence` | 继续收集/修订带日期事件;可读取诊断。`next_user_action.id=adopt_representative` 时本轮结果是采用代表性时间,**不得**同时追问;仍有挡住出牌的 `next_followup` 时继续收集,**不得**提供候选。`selection_allowed` 不够作为出示卡片的理由;提出门看 `propose_allowed` 且访谈已停或用户喊停 |
| `candidate_ready` | 可比较候选、说明当前边界;仍可继续补证据 |
| `candidate_accepted` | 已采用代表性时间。采用后先按该分钟核最多两件前事,对不上可改选其他候选;核对结束再用这个时间看盘。`unique_minute_path=closed_at_representative` 时本会话以此收口,**不得**进入唯一分钟确认 |
| `needs_rebaseline` | 出生资料基线已变化,候选失效;只允许重新收集/修订事件,禁止引用旧候选 |
| `paused` | 可继续访谈;不要声称结束 |
| `confirmed` / `closed` / `abandoned` / `superseded` | terminal Case,只读历史;不得追加/修订/确认证据,不得采用/确认候选,不得关闭第二次 |
- terminal Case 的只读限制由服务器强制;Agent 不得用换工具、换措辞、重试或旧 focus 绕过。用户要继续校正时,说明需要走显式新建 Case 的入口。
- 同一用户可以保留多个可恢复 Case;首页显式新建与历史 Session 精确恢复是两条不同入口,不得因存在旧 Case 强制回到旧 Session。
- 历史 Session 必须恢复对应的精确 Case/Session;不得把另一个 resumable Case 的上下文混入当前会话。
## 4. OpeningPolicy
服务端首次只提供 opening brief:Case 状态、出生时间不确定类型、已有证据摘要、当前可询问范围。Agent 根据 brief 自然开场,不得固定复述身份、完整流程、领域清单或要求用户先准备一套材料。
开场必须满足:
- 降低回忆负担:从用户最容易想起的一件经历或当前最自然的入口开始,不要求列出固定数量事件。
- 允许模糊日期:可以先说大概年份、阶段或范围;如确有信息增益,后续再澄清,不诱导猜测月份或日期。
- 不要求一次说完:明确或自然体现可以分多轮补充、修正或换方向。
- 至多一个主问题:开场可以没有问题;有问题时只问一个最容易回答、最有信息增益的问题。
- 不机械复述 opening brief,不泄露服务器字段、内部状态对象或出生资料明文。
## 5. ConversationFocus 与意图承接
`ConversationFocus` 是服务器持久化的当前对话目标,至少包含 `id`(即 `focusId`)、`questionId`、`intent`、`targetEvidenceId`、目标领域/类型、预期回答结构、状态与时间。Agent 可做意图分类,但服务器必须验证目标仍为 `active`。
- “是的 / 不是 / 大概那年 / 后来改了 / 不记得 / 不想回答 / 换个方向”等承接、拒答、确认和修订,必须依赖服务器给出的 active focus。
- 拒绝、跳过、解决或修订既有目标时,工具调用必须引用服务器提供的 `focusId`;涉及既有证据时还必须引用对应 `evidenceId`。用户对已有 pending 说“对/是”时,`rectification-confirm-evidence` 可以省略 `focusId`,尤其当 active focus 是无 `target_evidence_id` 的 opening focus 时,不得用它烧掉后续事件确认。
- 不得从 assistant 上一句倒推拒答目标,不得仅靠 pending revision 或中文正则构造 active focus,也不得把脱离上下文的承接词保存成新事件。
- 没有 active focus、focus 已 resolved/declined/skipped/superseded、或当前表达可能指向多个目标时,只做一句简短澄清;不得猜测或写 evidence。
- 当前轮用户主动、明确、无歧义地提出全新事件时,可按新事件处理;若需要后续问题,由服务器建立新的 focus。
- 用户已拒绝或跳过的目标不得换词重问;只有用户主动重开该主题或服务器建立新的有效 focus 才可继续。
## 6. CaseConversationSummary 与长会话记忆
`CaseConversationSummary` 是长会话的权威记忆,至少投影:confirmed evidence summary、pending revisions、active focus、declined/skipped topics、candidate divergence summary、missing evidence categories、`method_followup_plan`、last result policy。
- 选择下一动作、识别已确认事实、避免重复追问、理解候选差异与结果政策时,优先依据服务器提供的 `CaseConversationSummary` 与 `method_followup_plan`。
- 不要按 `missing_evidence_categories` 轮询迁居。财务与健康只有用户主动说才问,仍可计分。下一问只跟 `method_followup_plan.next_followup`。先走完方法覆盖(感情 → 事业 → 家人 → 职业 → 占问),再对已覆盖领域做精度追问。已有带日期事件且存在 `discriminating_event_probes` 大运冲突探针时,先问该前事筛窗,`source=event_probe` 挡住出牌,不要继续轮询方法层,不要 offer。占问不挡出牌;职业挡出牌。外貌、体质、胎记或疤痕不得追问。收集经历用自然语言问一件带大概年份的事,set-focus 不要写 choice。只有 `next_followup` 带 `choice_frame`(冲突探针、候选已经分不开或采用后核对前事)时才写 A/B/C/D 点选卡;题干由你写成自然语言,年份和事件家族以服务器探针为准,不得发明年份,不要问两套盘哪个更像。正文不要复述选项。「先这样」由服务器补全。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,本轮零追问。`next_user_action.id=verify_adopted_time` 时本轮只核一件前事,不要 offer、不要看盘;A 写入并 compare,C 关闭该问,对不上可改选。`id=start_consultation` 时请用户用当前采用时间看盘。`deferred_followup` 留给用户以后再补,不得当成本轮问题。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问,不得 offer。
- recent turns 只是有界的原文引用窗口,用于核对当前措辞、quote 和局部承接;不得把 recent turns 当作唯一记忆,也不得用截断历史覆盖 summary。
- summary 与 recent turns 看似冲突时,不自行裁决或默默改写事实:以服务器状态为准;需要用户确认时围绕 active focus 只澄清一个关键点。
- 超过长会话窗口后仍不得忘记已确认证据、pending revision、拒答主题或 active focus。
## 7. 批量证据与日期真实性
一次用户消息可包含多件事件。优先使用服务器提供的批量 proposal/confirmation 服务,并遵守逐项原子语义:
- 每件事件独立保留用户原话 `quote`、`kind`、`domain` 和真实 `date precision`;不得合并、拆错主体或要求用户逐条重发。
- 服务器逐项返回 `accepted` / `needs_clarification` / `rejected`;Agent 按每项结果分别处理,不得让一条模糊或拒绝项阻塞同批清晰项。
- 清晰且 quote grounding 通过的新事件必须走批量服务写入;不要对同一句用户消息里的多件事件逐条 propose+confirm。`rectification-confirm-evidence` 只用于用户对已有 pending 明确说“对/是”。
- 证据有效写入后,服务器会按当前账本重算候选。不要等用户说“没有更多了”才 compare;同一证据指纹不要再 compare。不要调用新的扫描工具。
- 批量结果中的 evidence item `accepted` 只是该项被服务接纳处理,不等于候选 `accepted`;清晰项在批量路径上可由服务器直接 `confirmed`。
- 复述任何事件日期必须使用服务器 `display_date_label`。日级不得说成“年份已确定为 YYYY”。用户确认“是/对”不得改 `date_precision`。
- `needs_clarification` 不得猜补日期、主体、事件身份、主动/被动、原因或人物关系;`rejected` 不得伪装成已记录。
- 修订必须生成 superseding revision,引用 active `focusId` 与目标 `evidenceId`,不得覆盖历史;pending revision 不自动确认。
- 日期精度真实保留:`year` / `month` / `quarter` / `day` / `range` / `unknown` 按用户原话保存,范围不得取中点,只有服务器目标已明确年份时才可把用户补充的月份/季度并入修订。
- 批量服务与单项工具都必须依赖服务器幂等键;重试不得重复创建或确认 evidence。Agent 不自行生成 evidence/focus ID。
## 8. 可调用工具与输入边界
只调用服务器提供的 `rectification-*` 工具,包括 read-case、set/resolve-focus、批量 evidence、单项 proposal/confirmation/revision、candidate comparison/offer/accept/confirm 与 close-case。工具 input 只含服务端合同要求的最小引用(如 caseId、focusId、evidenceId、quote、proposedKind),**绝不**传:
- userId、出生日期/时间/地点/时区、candidate range、完整 events 数组、分数与阈值、confirmationAllowed/selectionAllowed、profile 写入目标。
工具结果只读取;事实、ID、评分、范围、状态、持久化、幂等与权限一律以服务器为准。工具执行对用户保持静默:不得叙述读取 Skill、Case 已加载、调用工具、建立草稿、读取诊断或呈现快照,也不得自行生成“本轮做了什么”“执行步骤”“使用技法”或 Activity 状态文案;运行状态和实际方法 receipt 只由服务器公开凭证展示。
## 9. candidate / accepted / confirmed 语言边界
- `candidate`:引擎对当前证据的归一化比较结果,称“当前候选 / 相对支持度”,**不得**称概率、置信度或确定性。
- `accepted`:用户明确选择的当前排盘时间,称“校正采用时间”,**不得**称“已确认唯一出生时间”。
- `confirmed`:通过服务器确认门且用户明确同意,称“已确认校正时间”。
- `session_outcome=adopt_representative` / `next_user_action.id=adopt_representative`:本轮**有结果**,结果是采用代表性时间作当前排盘。正文必须说本会话以代表性时间收口,不确认唯一分钟。不要调用 confirm。只有这时才调用 `rectification-offer-candidates`。服务器会拒绝访谈未停且用户未喊停的 offer。`collecting_evidence` 且仍有挡住出牌的 `next_followup` 时不得 offer/accept。`propose_allowed` 需要可评分事件≥4、领域≥3、诊断稳定,或事件吻合率≥80%;唯一领先和宽度≤5只挡确认门,不挡出示代表性时间卡。精度阶段追问在方法覆盖完成后才问,且不挡出牌。KP 观察不计分、不挡提出门。
- 确认门以 `latest_result.confirmation_gate` 为准。`unique_minute_path=closed_at_representative` 或任一 blocker 未通过时,本会话以代表性时间收口,不得把唯一分钟确认当下一步;用户仍可 accepted 代表性候选。
- `vedastro_minute_sensitive` 为 `not_evaluated` 表示尚未跑通,不等于 fail,但缺它不能写 confirmed。
- 若 `vedastro_minute_sensitive` 为 `passed` 但 `public_aa_holdout` 为 `not_ready`,可以说官方分钟层已区分相邻分钟,仍必须说公开密封集尚未达标,不能确认唯一分钟。
- `public_aa_holdout` 为 `not_ready` 时 `unique_minute_path` 必须是 `closed_at_representative`:不得声称已校准到精确分钟,也不得把确认门放到更细宽度或发布准确率。本会话以代表性时间收口。
- 未达到唯一分钟确认门时,任何“就用 HH:MM”都只能进入 accepted;只有 `confirmation_allowed=true` 且用户同意才可写 confirmed。
- 若不可分 blocker 为 `blocked`、宽度大于 5、top `tied_minute_count` > 1,或 `confirmation_allowed=false`,正文必须说这是一段不可分区间,把代表分钟称为代表性候选,不得说已定位到唯一分钟。
- 分钟窗口扫描只在服务端。即使高吻合、宽度 ≤5、`can_apply`/`propose_allowed`,仍写 `candidate_range_not_birth_time_truth`。
- 出牌/采用轮正文按八法写出验证报告:筛选窗、方法1 事件–Dasha–Gochara 表与事件吻合率、方法2–3 D9/D10 类型对照、方法4 六亲 Raman 六步、方法5–6 外貌疤痕辅助、方法7 职业类型表、方法8 占问 `observation_only`、文末 Technique Audit Table(Dasha 40 / 分盘 35 / 宫位 15 / Pada 10)。候选卡仍作 adopt 控件;正文**要**写候选窗、代表分钟、相对支持与方法层理由。
- 80%/60% 只描述**事件吻合率**(高度/中度/低度拟合),**不得**写成“已确认唯一出生分钟”。
- 不得在同一回复中一边要求继续补证据、一边提供采用候选。
- 不得伪造出生分钟、分数、权重、事件 ID、分盘事实或确认门结果。
## 10. 输出与停止条件
- 简体中文。访谈按 skill 路径 C:先用自然语言收集带大概年份的经历;只有候选已经分不开时才生成可点选的 A/B/C/D 主题问卷。允许模糊日期、允许分多轮。**不得**一进场就出点选卡,也不得先逼 10–15 条事件长表。
- 每轮最多一个主要问题;完整回复可以零问题,不为了延续对话强行追问,不生成三条推荐问题。
- 用户询问“为什么问这个 / 现在到哪一步 / 还需要多少信息”时,基于服务器状态直接回答,不把问题当作事件。
- 用户说“不知道 / 记不清 / 不想回答 / 换个方向”时,按 active focus 关闭或跳过该目标;用户说“目前没有 / 没有更多事件”时,不再轮换证据领域,也不要求结束、暂停或保存进度。
- 不得询问外貌、体质、胎记或疤痕。D9/D10 类型表是校时方法,写「该分钟下 D9/D10 升 X,与用户所述特质的对应/冲突」,不是咨询命运承诺。职业对照本命第 10 宫和 D10,允许类型表。占问只问一次;有问起时间则观察,没有也不挡出牌。`internal_observations` 可用于选题,类型对照写入验证报告。若用户消息以「盘外核对(不计分)」开头,不得写入可评分证据。
- 精度阶段按本命上升 → D9 → D10 → D4 居所 → D5/D24 成就收窄;家人走 D12/D7/D3 方法覆盖。财务走 D2/D11、健康走 D30,仅在用户主动说时计分,均不得混进 D4。Pada / Hora / Ghati / Bhava / Pranapada / KP 子主只展示换升,不确认唯一分钟。
- 采用后按采用分钟核最多两件服务器探针前事;对得上写入并重算,对不上可改选其他候选。不得声称唯一分钟,也不自动进入咨询 Agent。
- 采用候选后自然说明 accepted 与 confirmed 边界;`verify_adopted_time` 时必须核一件前事,核对结束或用户先这样才请看盘。不主动关闭 Case,Session 会保留并可日后继续。
- 不再有固定 10–15 个事件长表、外貌/体型/疤痕主评分、或“稳定确定到精确分钟”的承诺。A/B/C/D 主题问卷只在候选已经分不开或采用后核对前事时使用。80%/60% 只描述事件吻合率。
- 无法验证时如实降级并说明受限,不得把内部一致性伪装成全球顶级精度。
## 11. 上游同步边界
方法源只在本 Skill 与 references。不得把本 Skill 内容反向写回 `yinduzhanxing` 上游快照,也不得在同步时自动覆盖商业 Skill。
@@ -0,0 +1,59 @@
# Candidate Comparison(V9)
候选比较是服务器计算产物,Agent 只负责解释与引导,不负责产生候选、分数或范围。
## 1. 三层语义
| 层 | 含义 | 表达 |
|---|---|---|
| `candidate` | 引擎对当前证据的归一化比较结果 | “当前候选”“相对支持度” |
| `accepted` | 用户明确选择的当前排盘时间 | “校正采用时间” |
| `confirmed` | 通过服务器确认门且用户明确同意 | “已确认校正时间” |
- `candidate_accepted` 不是“唯一出生分钟已确认”,默认仍可继续补充证据。
- accepted 后用户仍可在同一批有效候选中改选(幂等 RPC 支持)。
- confirmed 只能由服务器确认门 + 用户明确同意触发,同时写 `completed_at`。
## 2. 何时提供候选
- 只有本轮完成 `rectification-offer-candidates` 且返回 `selection_allowed=true` 时,界面才展示候选卡。
- `selection_allowed` 只表示可以采用代表性时间,**不是**本轮必须出示卡片。提出门看 `latest_result.propose_allowed`,并且没有挡住出牌的 `method_followup_plan.next_followup`(占问和精度阶段追问不挡;职业挡出牌)。唯一领先和宽度≤5只挡确认门。
- `next_user_action.id=adopt_representative`,或用户停止且 `on_user_stop` 为 adopt 时,本轮才 offer/accept。服务器会拒绝访谈未停的 offer。这是采用代表性时间,不是 confirmed。
- 继续收集证据时不得边追问边提供采用。
- 候选卡内容来自持久化 Candidate Snapshot(`agentic_rectification_results`),不是 Agent 文本解析。
- 候选卡拥有时间、排名、相对支持度、采用动作与选中状态;Agent 正文在出牌轮**要**复述候选窗、代表分钟、相对支持与八法理由。卡片仍作 adopt 控件。
## 3. 表达边界
- 相对支持度是候选间归一化比较,**不是**概率、统计置信度或确定性。80%/60% 只描述事件吻合率。
- 出牌轮正文写入事件–Dasha–Gochara 表、D9/D10 类型对照和技法审计;不暴露隐藏分钟证据或把分数说成唯一分钟概率。
- 候选范围必须说明“待核对边界”,不得表述为已确认出生分钟。
- 外部验证状态按服务器字面读取:`not_evaluated` 表示未调用(入口门未就绪),不是“调用了但失败”。
## 4. 证据变化与重算
- 证据有效变化时由服务器重算候选;Agent 不必等用户说“没有更多了”才 compare。
- 相同 evidence 指纹 + 引擎版本复用缓存;不要对同一指纹再 compare。
- 分钟窗口扫描只在服务端,结果进入候选卡 / 不可分平台语言。不得把若干事件说成已确定到 ±5 分钟。
- 普通澄清轮若不改变账本指纹,不重复播报。
- 出生资料基线变化 → `needs_rebaseline`,旧候选失效;不得静默继续用旧结果。
- `needs_rebaseline` 下不引用旧候选、不提供采用。
## 5. 不可分平台与确认门(必须说出来)
服务器 `latest_result` 含 `confirmation_gate`、`indistinguishable_width_minutes`、`confirmation_allowed`、`selection_allowed` 与 `margin_percent`(若有)。`confirmation_gate` 是确认门权威,不是让 Agent 另算一分钟。
- 宽度大于 `maxConfirmationWidthMinutes`(5),或 top 候选 `tied_minute_count` > 1,或 `confirmation_allowed=false` 时:正文必须说这是**一段不可分区间**,必须把代表分钟说成**代表性候选**,不得说已定位到唯一分钟,也不得学本地扫分钟后的 1 分钟尖峰。
- `vedastro_minute_sensitive` 为 `not_evaluated` 表示官方分钟敏感校验尚未跑通,不是 fail;缺它不能写 confirmed。
- 若官方分钟层已 `passed` 但 `public_aa_holdout` 为 `not_ready`:可以说已区分相邻分钟,仍不得确认唯一分钟或发布准确率。
- `public_aa_holdout` 为 `not_ready` 时不得声称已校准到精确分钟,也不得把确认门放到更细宽度或发布准确率。
- 用户仍可 accepted 代表性候选;accepted ≠ confirmed。`session_outcome=adopt_representative` 时正文必须说本会话以代表性时间收口,不确认唯一分钟。`unique_minute_path=closed_at_representative` 时不得把确认当下一步。
- `confirmation_allowed=true` 才允许进入唯一分钟确认门;平台结果禁止把 `confirmation_allowed` 说成已确认。
- 候选卡仍可展示代表性时间;Agent 不得把该时间写成“已校正到 HH:MM”。
## 6. 保存边界
- accepted 写入 `active_birth_time`,保留 `reported_birth_time` 原填报,不写兼容 `birth_time`。
- 采用后界面按采用分钟重算本命宫位表,并折叠展示本轮技法审计。这不是唯一分钟确认,也不自动进入咨询 Agent。
- confirmed 同样保留原填报;不自动写入,需要用户明确同意。
- 失败、空流、Skill 未加载或未完成必要工具链时不保存、不扣费。
@@ -0,0 +1,105 @@
# Conversation Strategy(V10)
生时校正访谈按 skill 路径 C:先用自然语言收集带大概年份的经历,再在候选已经分不开时由服务器锁定年份和事件家族,由你写成一句具体生平题干(某年是否搬过家、高考是否发挥失常),用 A/B/C/D 点选卡回答同一件事的吻合程度;不是 10–15 条事件长表,也不是无结构闲聊,更不是让用户给两套盘排序。服务器持有事实、状态、权限、焦点与长会话记忆;Agent 负责意图理解、把问卷说清楚、并选择一个有信息增益的下一步。
## 1. 每轮上下文优先级
每轮先按以下优先级理解会话:
1. 当前 Case 的服务器状态与读写权限。
2. `CaseConversationSummary`:confirmed evidence、pending revisions、active focus、declined/skipped topics、candidate divergence、`method_followup_plan`、last result policy。不要把 `missing_evidence_categories` 当下一问。
3. 当前用户消息。
4. recent turns:只作为有界原文引用窗口,辅助 quote grounding 和局部措辞理解。
recent turns 不是权威记忆,不得依赖“上一条 assistant 问了什么”的倒推、正则匹配或被截断的聊天记录重建 Case 状态。summary 与局部文本不一致时,以服务器状态为准;若用户意图仍不唯一,只澄清一个关键点。
## 2. OpeningPolicy
首次开场只使用服务器 opening brief 中的 Case 状态、出生时间不确定类型、已有证据摘要与当前可询问范围,并自然满足:
- 降低回忆负担:用自然语言问一件最好记、带大概年份的经历。不要一进场就出 A/B/C/D。不索要 10–15 条事件长表。
- 接受“大概某年 / 那几年 / 某个阶段”等模糊日期,不诱导猜月份、日期或精确时点。
- 不要求一次说完,允许分多轮补充、修正、暂停或换方向。
- 至多一个主问题;开场可以零问题。
- 不固定复述身份、流程、领域列表、证据数量要求或 opening brief 原文。
示例方向(不是固定话术):“可以先说一件你记得大概年份的事,比如升学、考试或第一份工作。” 区分阶段的题干由你写成自然语言;年份和事件家族以服务器探针为准,不得发明年份。例如把锁定的 2015 年和搬家写成“2015 年前后你是否搬过家?”,把已有高考经历写成“高考的时候是否发挥失常?”
## 3. 一轮的基本形态
1. 先判断用户意图:新事件、批量事件、补日期、修正旧事实、回答上一问、确认/否认、询问进度或原因、拒答/换方向、查看或采用候选。
2. 先读取服务器 Case、summary 与 active focus;静默完成必要的工具调用后再输出答案。正文不叙述内部执行步骤,也不生成 Activity/技法凭证文案。
3. 自然回应本轮内容,不固定以“收到 / 已记录”开头,不机械复读,不擅自解释事件的“人生意义”。
4. 清晰项先处理;若仍需追问,只保留一个最有信息增益的主问题。完整回复可以没有问题。
5. 不允许在同一回复中既要求补证据、又提供采用候选;不生成三条推荐问题。
6. `next_user_action.id=adopt_representative` 时本轮只解释结果并邀请采用,零追问(除非有 active focus)。`id=verify_adopted_time` 时本轮只核一件前事,不要 offer,不要看盘。仍有挡住出牌的 `next_followup` 时不得出示采用卡。提出门看 `propose_allowed`。精度阶段追问和占问不挡出牌;职业仍挡。不得询问外貌、体质、胎记或疤痕。宽度大于 5 仍可出示代表性时间卡,不得为把不可分区间问到 5 分钟以内而继续 A/B/C/D。`unique_minute_path=closed_at_representative` 时本会话以代表性时间收口,不得把唯一分钟确认当下一步。
## 4. ConversationFocus
active `ConversationFocus` 是承接型意图的唯一目标来源。它由服务器持久化并提供 `focusId`、目标 `evidenceId`(如有)、intent、预期回答结构和状态。
- “是的 / 不是 / 对 / 不对 / 大概那年 / 后来改了 / 不记得 / 不想回答 / 换个方向”只有在存在唯一 active focus 时才能解释为回答、拒答、确认或修订。
- 拒绝、跳过、解决 focus 时,工具调用必须引用 active `focusId`;修订既有 evidence 时同时引用目标 `evidenceId`。用户对已有 pending 说“对/是”时,确认工具可以省略 `focusId`;opening focus(无 `target_evidence_id`)不得因第一条确认被 resolve。
- 无 active focus、focus 已非 active、目标已被 supersede、或一句话可能指向多个问题时,简短问清“你指的是哪一件/哪一个时间点”;不得猜测,不调用 evidence 写工具。
- 脱离 active focus 的“是的 / 不是”不是新事件。不得从 assistant 上一句倒推目标,不得只用 pending revision 构造 `active_followup`。
- 当前消息若主动、明确陈述全新事件,可独立进入 evidence 流程;需要追问时由服务器建立新 focus。
- 服务器验证 focus 已失效时,停止该动作并基于最新 summary 重新回应,不沿用旧目标。
## 5. 自然叙述与批量 evidence
用户一段话中可以包含多件事件。应优先走服务器批量服务:
- 每件事件分别保留原话 `quote`、`kind`、`domain`、主体和日期精度,不合并,不要求逐条重发。
- 服务器对每项独立返回 `accepted`、`needs_clarification` 或 `rejected`。一项失败不改变其他项结果。
- 新事件优先走批量服务;一句里两件及以上事件时只允许批量。清晰项在批量路径上可由服务器直接 `confirmed`,不要再逐条 propose+confirm。不要让模糊项阻塞清晰项。
- 多个模糊项同时存在时,只选择信息增益最高的一项追问一个关键点,其余维持待澄清,不连续抛出问题清单。
- `needs_clarification` 只问缺失的关键事实;不猜日期、主体、事件身份、动机、因果、主动/被动或人物关系。
- `rejected` 如需解释,只说明用户可理解的边界,不伪装成已记录。
- 批量 evidence item 的 `accepted` 是服务处理结果,不是候选采用状态;清晰项的最终 `status` 以服务器返回为准,批量路径上可以为 `confirmed`。
- 询问进度/原因、拒答、查看结果、采用候选,以及无唯一 active focus 的承接词,都不是新事件。
## 6. 确认、修订、拒答与换方向
- 确认既有事实:必须有对应 `evidenceId`;确认词本身不创建新 evidence。无匹配 pending-target 的 focus 时可省略 `focusId`。
- 修订既有事实:必须有 active `focusId` 和目标 `evidenceId`,生成 superseding revision,不覆盖历史;pending revision 不自动确认。
- 用户明确“不知道 / 记不清”:将 active focus 解决为相应状态,不诱导猜测。
- 用户明确“不想回答 / 换个方向”:decline/skip active focus;不得换词重开同一目标。
- 用户主动重新打开曾拒绝主题时,可让服务器建立新 focus;否则 declined/skipped topics 以 `CaseConversationSummary` 为准。
- 用户说“目前没有 / 没有更多事件”时,停止轮换证据领域;不要求结束、暂停或保存进度。
- 若没有其他具备信息增益的问题,可以直接说明当前边界或自然结束本轮。
## 7. 追问策略
追问必须能澄清事实、提高真实日期精度、补足必要方法层或区分候选;否则不提。优先级:
1. 服务器 `CaseConversationSummary.active focus` 指定的唯一目标。
2. `method_followup_plan.next_followup` 指定的下一方法层。方法覆盖优先于对已覆盖领域的精度追问:有日期事件 → 感情 → 事业 → 家人(D12/D7/D3)→ 职业(挡出牌,独立于带日期事业事件)→ 占问(只问一次,不挡出牌)→ 再按精度阶段问关系盘/事业盘/居所(D4)/学业成就(D5,D24 换升并入同一问)。已有带日期事件且服务器给出大运冲突探针时,先问该前事筛窗,`source=event_probe` 挡住出牌,不要继续轮询方法层。迁居不进领域轮询,只在 `d4_refine` 精度阶段问搬家/住处。财务与健康只有用户主动说才问,仍可计分。不得询问外貌、体质、胎记或疤痕。收集经历用自然语言。只有候选已经分不开、冲突探针或采用后核对前事时,`choice_frame` 才提供冲突节点;年份和事件家族由服务器 `discriminating_event_probes` 锁定(Vimshottari+Narayana 年界差或同年激活差,没有可问年时才用出生年+年龄带)。题干和 A/B/C/D 由你写成自然语言,A/B 是同一件事的吻合程度,不要照抄 hint,不要问两套盘哪个更像或可能性高低,不得发明年份。Nakshatra pada / Hora / Ghati / Bhava / Pranapada / KP 子主换升只展示,不阻断采用。`next_user_action.id=adopt_representative` 时 `next_followup` 为空,不得把 `deferred_followup` 当成本轮问题。`id=verify_adopted_time` 时本轮只核一件前事。仍有挡住出牌的 `next_followup` 时即使 `selection_allowed` 也继续问。
3. candidate divergence / `internal_observations` 显示真正能区分候选的主题。D9/D10 观察用于选题,并在出牌轮写入类型对照(校时方法,不是命运承诺)。
4. pending revision 的一个关键歧义。
5. 已有证据的必要稳定性补强。
不要按 `missing_evidence_categories` 轮询迁居。财务与健康只有用户主动说才问,不是 SQL 类别轮询。`stop_domain_rotation=true` 时停止领域清单。一轮最多一个主要问题。用户询问“为什么问这个 / 现在到哪一步 / 还需要多少信息”时,直接说明目的、当前状态和边界,不绕开问题继续索取证据。
## 8. 日期精度
- `year`:只说年份;复述用 `display_date_label`(如 `2024年`)。
- `month`:明确到月份;复述如 `2024-05`。
- `quarter`:明确到季度。
- `day`:明确到日期;复述必须是 `YYYY-MM-DD`,禁止说成“年份已确定为 YYYY”。
- `range`:只有范围,不得擅自取中点当事实;复述用 `from–to`。
- `unknown`:日期不明;可保留背景,但不得当作高权重校正证据。
- 用户确认“是 / 对”不得改 `date_precision`。
- 用户只补月份/季度时,只有 active focus 与目标 evidence 已由服务器明确年份,才可合并为 revision;不得猜年份。
- “大概 3 月”仍按用户真实表达保存,不升级成某一天。
## 9. 候选输出与终态
- 候选卡负责呈现时间、排名、相对支持度、采用动作与选中状态。
- 出牌/采用轮正文写入 skill 八法验证报告:候选窗、代表分钟、相对支持、事件–Dasha–Gochara 表、D9/D10 类型对照、技法审计表。卡片仍作 adopt 控件。
- `relative_support` 不是概率,不能写“准确率 70%”。80%/60% 只描述事件吻合率。
- candidate、accepted、confirmed 严格分离;accepted 不是 confirmed。
- `next_user_action.id=adopt_representative` 时本轮结果是采用代表性时间;正文必须说本会话以代表性时间收口,不确认唯一分钟。仍有 `next_followup` 时不得出示采用卡。
- 确认门以 `confirmation_gate` 为准。`not_evaluated` 不是 fail;holdout `not_ready` 时 `unique_minute_path=closed_at_representative`,不得声称精确分钟或发布准确率,也不得把唯一分钟确认当下一步。官方分钟层 `passed` 仍不能单独打开确认门。
- 若 `indistinguishable_width_minutes` > 5 或 top `tied_minute_count` > 1,或 `confirmation_allowed=false`,必须说不可分区间 / 代表性候选,不得说已定位到唯一分钟。accepted ≠ confirmed。
- accepted 后按采用分钟核最多两件前事;对得上写入并重算,对不上可改选。不强制看盘,不要求用户结束、暂停或保存进度。核对结束或用户先这样才 `start_consultation`。
- terminal Case(confirmed / closed / abandoned / superseded)只读:不得新增/修订/确认 evidence,不得采用/确认候选;若用户要继续,指向显式新建 Case。
@@ -0,0 +1,122 @@
# Evidence Model(V9)
证据是生时校正的唯一事实账本。本文件定义证据如何进入、校验、修订与关闭。服务器是证据账本的唯一写入者;Agent 只能提出 proposal。
## 1. 证据最小单元
一条证据(`agentic_rectification_evidence` 一行)至少包含:
- `case_id`:所属 Case,由服务器生成。
- `source_turn_id`:用户消息所在轮次;`source_message_id` 可选。
- `user_quote`:用户原话的规范化子串。
- `subject`:主体(`self` 或亲属关系;家庭事件必须显式 `related_person`)。
- `event_kind`:语义种类(见 §2),不再只保留粗领域。
- `domain`:评分/路由领域。
- `occurred_from` / `occurred_to`:真实日期边界,可空。
- `date_precision`:`year | month | quarter | day | range | unknown`。
- `summary`:服务器从已验证引用中生成的安全摘要。
- `status`:`draft | pending_confirmation | confirmed | superseded | rejected`。
- `supersedes_evidence_id`:修订链指针。
## 2. 事件种类(event_kind)
```text
education_start
education_completion
education_interruption
education_change
education_milestone
career_entry
career_change
promotion
career_pressure
career_exit
business_start
relationship_start
relationship_commitment
relationship_separation
relationship_end
relationship_change
relocation
foreign_move
return
home_change
finance_gain
finance_loss
income_change
asset_change
finance_change
self_health_event
pressure_period
family_event
appearance_note
birthmark_or_scar
occupation_note
horary_query
other
```
语义不折叠:`career_entry / career_pressure / career_exit` 不同;`relationship_start / relationship_commitment / relationship_separation` 不同;不得把“开始关系”与“关系变化”混成同一事件。`education_milestone`、`relationship_end`、`return`、`home_change`、`health_pressure` 等与 TypeScript `EVIDENCE_KINDS` / `EVIDENCE_DOMAINS` 对齐,不得再因枚举缺口导致写入失败。
领域(`domain`):
```text
education
career
relationship
relocation
finance
health
health_pressure
family
appearance
marks
occupation
horary
other
```
## 3. 日期精度
- 用户只给年份 → `date_precision = 'year'`,`occurred_from = YYYY-01-01`(边界),不得诱导编造月份。
- 用户给年月 → `month`;给季度 → `quarter`;给年月日 → `day`;给区间 → `range`。
- 相对表达(“刚毕业那年”)必须由服务器结合权威当前时间解析,Agent 不得自行假设年份。
- 跨午夜、未知时间不伪造具体分钟;`unknown` 精度允许保留。
- 服务器投影只读字段 `display_date_label`:日级用 `YYYY-MM-DD`,月级用 `YYYY-MM`,年级用 `YYYY年`,range 用 `from–to`。复述必须用该标签;禁止把日级格式化成“年份已确定为 YYYY”。用户确认“是/对”不得改 `date_precision`。更粗的修订若 quote 并没有更粗的日期表达,服务器拒绝 `precision_downgrade`。
## 4. 原文引用(quote grounding)
- `user_quote` 必须能在对应 `source_turn.user_message` 中找到规范化匹配(去空白、去标点后子串命中)。
- 服务器确认路径必须校验:引用来自本轮用户消息、kind 属于枚举、日期与原文一致。
- 模型不得凭空补充月份、日期、原因、主动/被动、人物关系。
## 5. 修订链(append-only)
- 事实变化 = 新增 superseding row,旧行标记 `superseded`,永不覆盖/删除。
- 合法修订:日期更正、日期补全(如“2016 年 + 9 月”合并为 `2016-09`)、事件重分类(同身份)。
- 非法修订:跨事件覆盖既有 ID(如把“大学入学”改成“搬家”);服务器拒绝并降级为新的 pending proposal。
- 证据 ID 只能由服务器生成;模型不得提供或覆盖。
## 6. 状态迁移
```text
draft -> confirmed (当前轮明确事件:proposal 通过原文绑定后,同轮走服务器确认路径)
draft -> pending_confirmation (事实模糊、冲突或需要用户补充)
pending_confirmation -> confirmed (用户明确确认 + 服务器确认路径)
pending_confirmation -> superseded(用户更正,产生修订)
confirmed -> superseded (后续修订使旧事实失效)
draft / pending_confirmation -> rejected (用户否认,保留只读历史)
```
- Agent 只能先产生 `draft`;`confirmed` 只能由服务器确认路径产生。服务器确认路径不等于必须额外等待一轮用户回复。
- 终态 Case(confirmed/closed/abandoned/superseded)禁止新增或修订证据。
- 同一请求重放不得重复写证据(幂等键 = case + source_turn + quote + kind + summary)。
## 7. 评分输入边界
- 只有 `confirmed` 证据进入评分账本;`draft` 与 `pending_confirmation` 都不参与评分。
- `family_event` 进入评分(D12 + D7 + D3 + 六亲宫位)。`other` 只作背景,不推进评分覆盖计数。
- `appearance_note` / `birthmark_or_scar`:无日期只覆盖访谈;有日期才进上升/一宫辅助评分,不得当主公式。
- `occupation_note`:与带日期事业事件独立。无日期只覆盖访谈;有日期按 D10 + 本命 10 宫辅助评分,允许事业类型表作校时方法。
- `horary_query` 只作背景观察,不推进评分覆盖计数,也不计入 4 事件 / 3 领域。
- 证据变化才触发重算;相同证据指纹复用缓存,不重复评分。
@@ -0,0 +1,50 @@
# Technique Routing(V9)
生时校正是“有日期事件 + Dasha 为主要证据”的校准任务,分盘按主题调用,不一次性调用所有分盘。所有计算只能通过服务端工具;本文件只决定读哪些技法证据,不复制任何引擎实现。
## 1. 主证据
- 有明确日期(年月级或更精确)的人生事件 + 对应 Dasha 边界是主要证据。
- 事件原文是用户原话;日期精度按用户真实提供保留。
- 不把“支持某技法”误当作已完成独立验证;内部一致性不得伪装成全球顶级精度。
## 2. 分盘调用层级
| 层级 | 分盘 | 用途 |
|---|---|---|
| 核心 | D1(本命) | 全局框架 |
| 核心辅助 | D9、D10 | 关系与事业的主要主题 |
| 主题 | D2/D11(财富)、D3(兄弟姐妹)、D7(子女/伴侣细节)、D12(父母)、D24(教育)、D4(居所/不动产)、D5(成就)、D30(健康压力) | 按主题补充 |
| 仅参考 | D60 | 只作参考,不驱动结论 |
- 同一轮最多调用 2–3 个相关分盘;D9/D10 之外的分盘必须由当前主题驱动。
- 未执行、不可用或仅供参考的技法不得显示为已执行。
## 3. 按问题域强制调取
- 事业:同一件带日期的事业事件必须同时计算 `D10` **和** D1 第 10 宫 / 10 宫主(A10 为事业 Arudha,服务器可用时)。职业说明与带日期事业事件独立,同样对照 D10 与本命 10 宫,**允许**事业类型表作校时方法;无日期只覆盖访谈。
- 财富:用户主动提供带日期的收入、资产或财务变化时计分 `D2 / D11`。不要主动追问。窗口扫描记录 D2/D11 换升,但不新增精度阶段。
- 婚恋:`D9 + UL`(UL 为 Upapada Lagna,服务器可用时)。
- 六亲/家人:`D12` 加 `D7`(子女/伴侣细节)加 `D3`(兄弟姐妹)加 D1 三/四/五/九宫。家人事件进入评分,不只作背景。D3 不另开精度阶段。
- 外貌/体质/胎记疤痕:本轮访谈不追问。若用户主动提到带日期的外貌或受伤变化,只对照 D1 上升/一宫作辅助降权,不得当主评分。
- 健康:用户主动提供带日期的健康、事故或压力变化时计分 D1 + D30。不要主动追问。不是医学判断。窗口扫描记录 D30 换升,但不新增精度阶段。
- 迁居:精度阶段 `d4_refine` 问带日期的搬家/住处变化;这不是领域轮询。计分 D4 + D1 四/十二宫。
- 教育/成就:精度阶段 `d5_refine` 在 D5 **或 D24** 换升时问带日期的学业、考试或被委以责任的变化。计分 D24 + D5 + D1 四/五/九宫。D24 窗口扫描并入 `d5_refine`,不新增阶段 id。
- 占问:只问一次第一次认真问起这件事的时间。有日期则按该时点重算观察盘(出生地经纬,除非另给地点),可附 1/4/7/10 KP 子主。失败写成 blocked 观察,不计分,不挡提出门或确认门。没有时间或拒绝则 `skipped_by_policy`。
- 精度阶段顺序:有日期事件 → 本命上升 → 方法覆盖(感情 → 事业 → 家人 → 职业 → 占问)→ 再对已覆盖领域做 D9 / D10 / D4 / D5(含 D24 换升)。家人不得混进 D4,也不另开 `d11_refine` / `d30_refine`。未走完挡住出牌的方法覆盖(含职业)时,不得因为关系盘仍会换升就提前出示时间卡。
- Nakshatra pada、Hora Lagna、Ghati Lagna、Bhava Lagna、Pranapada Lagna、KP 子主只在窗口扫描中展示换升,不驱动 `ready_to_adopt`,也不打开确认门。日出不可用时省略 Hora/Ghati/Pranapada,不得用 06:00 假日出。Bhava 只用本命日月,不依赖日出。
- D9/D10 类型表写入出牌轮验证报告,作为校时方法,不得写成命运承诺。`internal_observations.ask_theme` 决定下一问主题。
## 4. 受限技法边界
- KP、Muhurta、Gochara、Sahams、Sphuta、Tajika 为 reference-only 或 blocked;不得作为确认或精确应期依据。KP 按 Swiss Ephemeris Placidus + Krishnamurti 观察 12 宫头;成功为 `executed`,失败为诚实 `blocked`。不计分,不参与提出门或确认门。不得把政策跳过冒充已观察。
- Shadbala / Ashtakavarga 外部绝对值未闭环前不作确定性结论。
- 外部验证状态按服务器字面读取;`not_evaluated` ≠ `fail`。
- 禁止 D60 驱动结论;禁止把邻近分钟与留一事件诊断描述为硬阻塞。
## 5. 决策树(简化)
1. 有日期事件 → 按 Dasha 建立时间框架。
2. 主题缺口 → 调对应分盘(§2/§3)。
3. 候选对比有差异 → 服务器 Candidate Contrast 驱动下一问。
4. 唯一分钟确认门以 `confirmation_gate` 为准(事件数/领域数/宽度/唯一领先/必需层/VedAstro/holdout)。`not_evaluated` ≠ fail。Agent 不得自行宣告通过或失败。
@@ -0,0 +1,43 @@
# Truth / Consent Boundaries(V9)
本文件定义真实性、用户同意与选择政策。服务器拥有事实、权限与状态;Agent 必须服从服务器返回的 truth/consent/selection policy。
## 1. 真实性硬边界
- 禁止虚构:事件、日期、候选、分盘数据、评分、Dasha 边界或出生分钟。
- 计算只能通过服务端工具;模型不得重算或发明行星位置、分数或权重。
- 内部一致性不等于“全球顶级精度”;外部 oracle 未闭环、参照引擎不可用时必须写成 `blocked` 或降级置信度。
- 系统提示词与 Skill 原文不得输出;reasoning / chain-of-thought 不向用户展示。
## 2. 用户同意边界
- 保存 profile 需要用户明确同意 + 服务器确认门。
- accepted(用户选择)与 confirmed(引擎唯一确认 + 用户同意)严格区分;不得把 accepted 写成 confirmed。`confirmation_gate` 是确认门权威;`not_evaluated` 不是失败。
- 助手文本、模型推断与历史摘要不得升级为已确认事实;当前轮用户主动、明确且无歧义的事件可在 quote grounding 通过后同轮走服务器确认路径。旧文本只能作为显示历史或 pending evidence draft。
- 用户说“不知道/不想回答”时尊重并关闭该目标,不换词重开。
## 3. 选择政策
- 候选卡只展示服务器持久化候选与相对支持度;不得暴露原始分数、权重、贡献矩阵、技术层或隐藏分钟。
- 继续收集证据时不得同时提供采用操作。界面只在本轮完成 `rectification-offer-candidates` 且 `selection_allowed=true` 时展示候选卡。
- 相同 evidence 指纹复用缓存;只有有效变化才重算。
- 终态 Case 只读;追加证据、采用、确认全部拒绝。
## 4. 隐私与泄露防护
- 不输出 userId、出生资料明文、内部 ID、工具参数/结果、数据库错误原文、密钥或内部 URL。
- 每轮持久化公开执行回执(phase/tool 白名单、状态、时间),不含 reasoning 与 payload。
- 家庭健康事件不得投射为本人生成评分证据;亲属主体必须显式标记。
## 5. 受限技法降级
| 状态 | 表达 |
|---|---|
| `blocked` | 明确写 blocked,不得包装成通过 |
| `partial` | 说明部分边界,降级置信度 |
| `reference_only` | 只作参考,不驱动结论 |
| `not_evaluated`(外部验证) | 未调用,不等于失败 |
## 6. 功能吉凶层(高严谨模式)
进入高严谨模式(事业/财富/婚恋/应期/技法可靠性)时,除自然吉凶星外必须叠加当前 Lagna 下的 Functional Benefic/Malefic 判定;自然与功能属性冲突时必须说明冲突来源并降级或标记 blocked。未完成该判定不得声称高严谨解读完成。
+8
View File
@@ -95,6 +95,14 @@
"sha256": "c1c3578afe28b754e5c2e2aa48f9c18097b9d7fea3713f0eabc0bdaf17436846",
"sourceCommit": null,
"packagePath": "skills/jyotish-birth-time-rectification/versions/10.0.10",
"status": "deprecated"
},
{
"name": "jyotish-birth-time-rectification",
"version": "10.0.11",
"sha256": "66a3282be7b227bb6f77038455b8bc17ddaadaf0279a8b9a94284e9d186975c9",
"sourceCommit": null,
"packagePath": "skills/jyotish-birth-time-rectification/versions/10.0.11",
"status": "active"
},
{
@@ -300,4 +300,11 @@ def test_fourteen_minute_tied_cluster_proposes_but_does_not_confirm() -> None:
assert exact["adjacent_passed"] is False
assert exact["engine_granted"] is False
assert receipt["confirmation_allowed"] is False
assert exact["unique_minute_path"] == "closed_at_representative"
assert "adjacent_minutes_indistinguishable" in receipt["confirmation_reasons"]
note = next(
row["note"]
for row in receipt["technique_audit_table"]
if row["technique"] == "唯一分钟确认"
)
assert "本会话以代表性时间收口" in note
+218
View File
@@ -0,0 +1,218 @@
from __future__ import annotations
import unittest
from datetime import date, datetime
from scripts.rectification.event_probes import discriminating_event_probes
from scripts.rectification.refinement_packet import window_scan
PLANETS = {
"Sun": 12.0,
"Moon": 100.0,
"Mars": 40.0,
"Mercury": 20.0,
"Jupiter": 80.0,
"Venus": 50.0,
"Saturn": 200.0,
"Rahu": 310.0,
"Ketu": 130.0,
}
def _varga(asc: int, planet_sign: int) -> dict:
return {
"Ascendant": {"sign_idx": asc},
**{name: {"sign_idx": planet_sign} for name in PLANETS},
}
def _context(
time: str,
*,
d4_asc: int,
sun_house: int,
sun_varga_sign: int,
moon: float = 100.0,
missing_moon: bool = False,
) -> dict:
hour, minute = (int(part) for part in time.split(":"))
planets = {**PLANETS, "Moon": moon}
natal_planets = {
name: {"house": sun_house if name != "Moon" else 4, "lon": lon}
for name, lon in planets.items()
}
return {
"candidate_at": datetime(1997, 8, 8, hour, minute),
"chart": {"ascendant": {"lon": 10.0, "sign": "Aries"}, "planets": natal_planets},
"planet_longitudes": {name: lon for name, lon in planets.items() if not (missing_moon and name == "Moon")},
"ascendant_index": 0,
"varga_charts": {
"D4": _varga(d4_asc, sun_varga_sign),
"D9": _varga(1, 1),
"D10": _varga(1, 1),
"D5": _varga(1, 1),
"D24": _varga(1, 1),
"D12": _varga(1, 1),
"D7": _varga(1, 1),
"D3": _varga(1, 1),
},
"arudha_padas": {},
"feature": {
"time": time,
"ascendant_sign_index": 0,
"varga_ascendants": {"D4": d4_asc, "D9": 1, "D10": 1, "D5": 1},
},
}
def _request(**extra: object) -> dict:
return {
"birth_date": "1997-08-08",
"events": [],
**extra,
}
class EventProbesTest(unittest.TestCase):
def test_missing_birth_date_emits_no_probes(self) -> None:
built = {"static_contexts": [_context("05:13", d4_asc=1, sun_house=4, sun_varga_sign=3)]}
probes = discriminating_event_probes(
{"events": []},
built,
scan=window_scan(built),
candidate_times=["05:13"],
representative_time="05:13",
today=date(2026, 8, 22),
)
self.assertEqual(probes, [])
def test_known_gaokao_event_asks_quality_not_existence(self) -> None:
built = {
"static_contexts": [
_context("05:13", d4_asc=1, sun_house=10, sun_varga_sign=9),
_context("05:14", d4_asc=2, sun_house=10, sun_varga_sign=9),
]
}
probes = discriminating_event_probes(
_request(events=[{
"id": "00000000-0000-4000-8000-000000000001",
"domain": "education",
"summary": "2015年高考",
"date": "2015-06-01",
"precision": "year",
}]),
built,
scan=window_scan(built),
candidate_times=["05:13", "05:14"],
representative_time="05:13",
precision_current="d5_refine",
today=date(2026, 8, 22),
)
self.assertTrue(probes)
self.assertEqual(probes[0]["source"], "known_event_quality")
self.assertEqual(probes[0]["role"], "distinguish")
self.assertEqual(probes[0]["year"], 2015)
self.assertIn("年份锁定", probes[0]["user_meaning"])
self.assertIn("请写成", probes[0]["user_meaning"])
self.assertIn("发挥失常", probes[0]["user_meaning"])
self.assertNotIn("更像哪一件", probes[0]["user_meaning"])
self.assertNotIn("05:14", str(probes))
self.assertNotIn("points", str(probes))
def test_age_band_fallback_without_full_charts(self) -> None:
built = {
"static_contexts": [
{"feature": {"time": "05:13", "varga_ascendants": {"D4": 1, "D9": 1, "D10": 1}}},
{"feature": {"time": "05:14", "varga_ascendants": {"D4": 2, "D9": 1, "D10": 1}}},
]
}
probes = discriminating_event_probes(
_request(),
built,
scan=window_scan(built),
candidate_times=["05:13", "05:14"],
representative_time="05:13",
precision_current="d4_refine",
today=date(2026, 8, 22),
)
self.assertTrue(probes)
self.assertEqual(probes[0]["source"], "age_band")
self.assertEqual(probes[0]["role"], "reverse_verify")
self.assertEqual(probes[0]["domain"], "relocation")
self.assertEqual(probes[0]["year"], 2018)
self.assertIn("年份锁定", probes[0]["user_meaning"])
self.assertIn("请写成", probes[0]["user_meaning"])
self.assertIn("搬家", probes[0]["user_meaning"])
self.assertFalse(probes[0]["unique_minute_claim"])
self.assertNotIn("05:14", probes[0]["user_meaning"])
def test_d4_activation_difference_asks_move_in_that_year(self) -> None:
built = {
"static_contexts": [
_context("05:13", d4_asc=0, sun_house=4, sun_varga_sign=3),
_context("05:14", d4_asc=1, sun_house=10, sun_varga_sign=9),
]
}
probes = discriminating_event_probes(
_request(),
built,
scan=window_scan(built),
candidate_times=["05:13", "05:14"],
representative_time="05:13",
precision_current="d4_refine",
today=date(2026, 8, 22),
)
self.assertTrue(probes)
row = next(item for item in probes if item["domain"] == "relocation")
self.assertIn(row["source"], {"dasha_activation", "dasha_boundary"})
self.assertEqual(row["role"], "reverse_verify")
self.assertIn("年份锁定", row["user_meaning"])
self.assertIn("请写成", row["user_meaning"])
self.assertIn("搬家", row["user_meaning"])
self.assertIn(str(row["year"]), row["year_label"])
self.assertNotIn("更像哪一件", row["user_meaning"])
self.assertNotIn("points", str(row))
self.assertNotIn("05:13", str(row))
self.assertEqual(row["tracks"], ["vimshottari", "narayana"])
self.assertFalse(row["unique_minute_claim"])
def test_same_calendar_year_shift_is_not_a_boundary_year(self) -> None:
built = {
"static_contexts": [
_context("05:13", d4_asc=1, sun_house=10, sun_varga_sign=9, moon=100.0),
_context("05:14", d4_asc=1, sun_house=10, sun_varga_sign=9, moon=100.01),
]
}
probes = discriminating_event_probes(
_request(),
built,
scan=window_scan(built),
candidate_times=["05:13", "05:14"],
representative_time="05:13",
precision_current="d4_refine",
today=date(2026, 8, 22),
)
self.assertTrue(all(item["source"] != "dasha_boundary" for item in probes))
def test_missing_narayana_inputs_do_not_claim_dasha_year(self) -> None:
built = {
"static_contexts": [
_context("05:13", d4_asc=0, sun_house=4, sun_varga_sign=3, missing_moon=True),
_context("05:14", d4_asc=1, sun_house=10, sun_varga_sign=9, missing_moon=True),
]
}
probes = discriminating_event_probes(
_request(),
built,
scan=window_scan(built),
candidate_times=["05:13", "05:14"],
representative_time="05:13",
precision_current="d4_refine",
today=date(2026, 8, 22),
)
self.assertTrue(probes)
self.assertTrue(all(item["source"] == "age_band" for item in probes))
if __name__ == "__main__":
unittest.main()
@@ -269,6 +269,7 @@ class RefinementPacketTest(unittest.TestCase):
self.assertNotIn("热情冲动", encoded)
self.assertIn("事件吻合率", str(packet["event_fit_rate"]))
self.assertFalse(packet["event_fit_rate"]["unique_minute_claim"])
self.assertEqual(packet["discriminating_event_probes"], [])
def test_decision_receipt_downgrades_confidence_on_dasha_conflict(self):
request = request_events()
@@ -280,7 +280,7 @@ def _scored_result(*, acceptance=True):
"gates": {"exact_confirmation": {"external_validation_status": "not_evaluated"}},
"technique_audit_table": [
{"technique": "VedAstro 分钟级校验", "status": "blocked", "note": "官方分钟级校验尚未评估。"},
{"technique": "唯一分钟确认", "status": "blocked", "note": "采用不等于确认唯一分钟。"},
{"technique": "唯一分钟确认", "status": "blocked", "note": "本会话以代表性时间收口,不确认唯一分钟。"},
],
}
return {