fix(rectification): score family events and allow appearance follow-up
Independent Staging Quality Gate / validate (push) Successful in 10m19s
Independent Staging Quality Gate / publish (push) Successful in 8m7s

Dated family evidence now moves candidates via D12 and kin houses, career receipts expose both D1-10 and D10, and appearance/marks may be asked as auxiliary first-house scores. New cases bind Skill 10.0.4.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-20 08:35:46 +08:00
co-authored by Cursor
parent a3196584d2
commit b1b4f5fac9
41 changed files with 1159 additions and 79 deletions
+27 -7
View File
@@ -12,7 +12,7 @@ from scripts.active_rectification_event_engine import compute_candidate_static_c
from scripts.active_rectification_events import CandidateScoreRow
from scripts.rectification.contracts import LifeEvent, RectificationRequest, is_scoreable_event
ALGORITHM_VERSION = "rectification-v5-matrix-scoring-2"
ALGORITHM_VERSION = "rectification-v5-matrix-scoring-3"
INPUT_CONTRACT_VERSION = "rectification-calculation-spec-v4"
PRECISION_WEIGHTS = {
"day": 1.0,
@@ -50,6 +50,9 @@ _ENGINE_KIND_BY_NATIVE_KIND: dict[str, tuple[str, str]] = {
"finance_change": ("finance", "finance_change"),
"self_health_event": ("health_pressure", "self_health_event"),
"pressure_period": ("health_pressure", "self_health_event"),
"family_event": ("family", "family_event"),
"appearance_note": ("appearance", "appearance_note"),
"birthmark_or_scar": ("appearance", "birthmark_or_scar"),
}
@@ -161,6 +164,9 @@ _KIND_SEMANTICS: dict[str, tuple[int, float]] = {
"asset_change": (0, 1.0),
"self_health_event": (-1, 1.0),
"pressure_period": (-1, 1.2),
"family_event": (0, 1.0),
"appearance_note": (0, 0.8),
"birthmark_or_scar": (-1, 0.8),
}
@@ -168,6 +174,22 @@ def precision_weight(precision: str) -> float:
return PRECISION_WEIGHTS[precision]
def public_technique_layers(domain: str, rule_ids: Sequence[str]) -> list[str]:
"""Public methods actually computed for this event. Career always lists D1-10 and D10."""
layers = {
rule.split(":", 1)[0]
for rule in rule_ids
if not rule.startswith(("event_kind:", "event_kind_profile:"))
}
if domain == "career":
layers.update({"d1-rashi", "d10-dashamsa"})
elif domain == "family":
layers.update({"d1-rashi", "d12-dwadashamsha"})
elif domain in {"appearance", "marks"}:
layers.add("d1-rashi")
return sorted(layers)
def _event_kind_factor(event_kind: str, rule_ids: Sequence[str]) -> float:
direction, intensity = _KIND_SEMANTICS.get(event_kind, (0, 1.0))
support = sum(any(rule.endswith(marker) for marker in _SUPPORT_RULES) for rule in rule_ids)
@@ -237,12 +259,10 @@ def build_event_contribution_matrix(
matrix[event["id"]][candidate_time] = {
"points": round(sum(points) / len(points), 4),
"rule_ids": sorted({rule for item in evidences for rule in item["rule_ids"]}),
"technique_layers": sorted({
rule.split(":", 1)[0]
for item in evidences
for rule in item["rule_ids"]
if not rule.startswith(("event_kind:", "event_kind_profile:"))
}),
"technique_layers": public_technique_layers(
event["domain"],
[rule for item in evidences for rule in item["rule_ids"]],
),
}
winner = max(set(winners), key=winners.count)
mean = sum(matrix[event["id"]][time]["points"] for time in candidate_grid) / len(candidate_grid)