From 1a8c02bfe5ea4b3d7f83dc423f9853197d35abf6 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 25 Nov 2026 06:02:10 -0500 Subject: [PATCH] feat(7836): lessons and rules are no longer paired by arriving together The co-arrival recorder counted a lesson and a rule shown in one response as evidence that the lesson is an instance of the rule, and asked the reader to judge the pair once three situations had gathered. Two records that resemble the same prompts arrive together whether or not one is an instance of the other, and the outcome bore that out (2,317 pairs suggested, 23 confirmed). It no longer runs: - neither the prompt door nor the write path records co-arrivals or carries a proposal line; - a rule read lists the lessons judged against it, confirmed first, and a lesson read the rules it was judged against: suggested rows stay in the table and no read shows them; - the lesson page and the rule editor drop the suggested section. The situation-counting helpers stay; rule moment judgments use them. Co-Authored-By: Claude Opus 5.5 --- frontend/src/api/lessons.ts | 13 +- frontend/src/api/rulebooks.ts | 6 +- .../components/rules/RuleEditorSlideOver.vue | 6 +- frontend/src/views/LessonDetailView.vue | 74 +------- src/grimoire/mcp/tools/lessons.py | 12 +- src/grimoire/routes/plugin.py | 13 +- src/grimoire/services/lesson_rules.py | 161 +++--------------- src/grimoire/services/plugin_context.py | 33 +--- .../services/rule_moment_judgments.py | 2 +- tests/conftest.py | 1 - tests/test_integration_lesson_rule_links.py | 81 ++------- tests/test_lesson_rule_soft_links.py | 24 --- tests/test_reply_shape_turn.py | 1 - 13 files changed, 69 insertions(+), 358 deletions(-) diff --git a/frontend/src/api/lessons.ts b/frontend/src/api/lessons.ts index 4de28443..b17c22e5 100644 --- a/frontend/src/api/lessons.ts +++ b/frontend/src/api/lessons.ts @@ -11,8 +11,8 @@ import type { RuleKind } from "@/api/rulebooks"; * another one fits. */ export type RuleJudgment = "linked" | "no_rule" | "unjudged"; -/** A link's state (`models/lesson_rule_link.py` LINK_STATES). */ -export type LinkState = "suggested" | "confirmed" | "rejected"; +/** A judged link's state; the reads list only these two. */ +export type LinkState = "confirmed" | "rejected"; /** One link from a lesson to a rule, in the reader's view: only rules the * reader owns are listed (`rules_for_lessons`). */ @@ -20,14 +20,11 @@ export interface LessonRuleLink { id: number; title: string; kind: RuleKind; - /** `suggested` carries nothing in retrieval until it is judged; only - * `confirmed` changes what surfaces; `rejected` is kept so the pair is - * never proposed again. */ + /** `confirmed` changes what surfaces; `rejected` is kept so the reason + * stays readable. */ state: LinkState; /** Why it was confirmed or rejected. */ note: string; - /** What a suggestion rests on — sent on suggested links only. */ - evidence?: { situations: number; projects: number; co_surfaced: number }; } /** A lesson: a transferable insight, retrievable by the SITUATION it applies @@ -79,7 +76,7 @@ export interface Lesson { updated_at: string | null; systems?: { id: number; name: string }[]; usage?: RecordUsage; - /** The rules this lesson points at, confirmed first, then suggested, then + /** The rules this lesson was judged against, confirmed first, then * rejected. Absent (with `rule_judgment`) when the links could not be read * — which is "not attached", never "no rule". */ rules?: LessonRuleLink[]; diff --git a/frontend/src/api/rulebooks.ts b/frontend/src/api/rulebooks.ts index e38fff40..9bf03581 100644 --- a/frontend/src/api/rulebooks.ts +++ b/frontend/src/api/rulebooks.ts @@ -120,9 +120,9 @@ export interface Rule { /** Present only when the rule has triggers. */ triggers?: RuleTrigger[]; relations?: RuleRelation[]; - /** The lessons that point at this rule — the concrete - * situations judged instances of it, plus any suggested and awaiting a - * judgment. Readable lessons only; omitted when there are none. */ + /** The lessons judged against this rule — confirmed instances of it + * first, then those judged not to be. Readable lessons only; omitted when + * there are none. */ lessons?: { id: number; title: string; state: LinkState; note: string }[]; } diff --git a/frontend/src/components/rules/RuleEditorSlideOver.vue b/frontend/src/components/rules/RuleEditorSlideOver.vue index 41d6c76b..baf88863 100644 --- a/frontend/src/components/rules/RuleEditorSlideOver.vue +++ b/frontend/src/components/rules/RuleEditorSlideOver.vue @@ -570,13 +570,13 @@ watch(() => props.ruleId, load);

The situations that keep proving this rule. A confirmed lesson brings the rule along - when it surfaces; a suggested one waits for a judgment on the lesson's page. + when it surfaces, and arrives with the rule when you open it.

@@ -603,7 +603,7 @@ watch(() => props.ruleId, load); -