7.3 KiB
Story Intelligence exception review
Investigation
The reported 647 Knowledge and 526 Relationship items were pending candidate counts, not measured ambiguity or conflict counts. The extraction prompts already request broad, scene-backed intelligence. SceneIntelligenceKnowledgeChange and SceneIntelligenceRelationship retain confidence, evidence and domain-specific signals in saved scene JSON. The review builders group knowledge by character, statement and state, and relationships into scene proposals. Neither builder previously assessed whether author intervention was useful.
Migration 177 persisted every candidate with DecisionStatus=Pending. Its page query and the Review Centre summary treated pending as attention. Candidate confidence was displayed as a band but the candidate table's numeric confidence was not populated. Knowledge acceptance writes CharacterKnowledge; relationship acceptance calls the source-key-idempotent procedure from migration 197 to create/reuse a directional relationship and insert a scene event. Consequently, relabelling pending rows alone would not make intelligence available to Story Point, relationship maps, scene histories or the Story Bible. These consumers read canonical records. Saved raw analysis remains available regardless of acceptance.
Locations already separate significance, identity uncertainty and user decisions. Their contextual setting/consequence policy is domain-specific; it is retained rather than copied into knowledge or relationship scoring. Assets already resolve exact canonical matches automatically; remaining proposed identities previously all counted as attention.
Design
StoryIntelligenceReviewPolicy is the common deterministic policy. It produces a persisted priority and readable reasons independently of DecisionStatus. States are Unassessed, Optional, Attention and Tracked. Tracked is assigned only together with a successful canonical write; decision status becomes AutoAccepted. Reviewed author decisions remain distinct. No AI interface is involved in the policy or browser.
The existing High confidence band (0.75–1) is only one gate. Automatic acceptance also requires canonical identities, explicit state/direction, a valid scene, and supporting evidence for every retained appearance. Duplicate aliases block automatic identity resolution. Missing provenance remains optional rather than being guessed from an old High label.
Knowledge retains the existing knowledge-state vocabulary. Ordinary explicitly learned/discovered/confirmed knowledge can be tracked. Beliefs, suspicion, misunderstanding, hearsay and inference stay available for optional interpretation; consequential uncertainty and same-scene awareness contradictions require attention. Original acquisition signals remain in the evidence. First-scene selection now orders by chapter, scene and scene sort order. Accepted knowledge IDs are recorded correctly (previously the candidate decision stored the state lookup ID).
Relationships preserve the existing scene and source-review keys, factual versus changing tracks, reciprocity, emotional intensity and awareness of the other character. Conflict checks compare the same directed track. Reverse-direction disagreement is valid. Opposing states in one scene and weakly supported opposing states between surrounding observations can require attention. A supported change is allowed. Pair journeys are a display grouping, not a merge: all saved proposals and scene evidence remain available.
Assets reuse the same priority model. Existing exact matching remains in place; uncertain consequential asset evidence can require attention, while ordinary proposed objects stay optional. Automatic creation of new asset identities/ownership is deliberately not added.
The Review Centre uses persisted aggregate counts, not raw scene reconstruction. Its category browser opens the attention queue, with optional, tracked, unassessed and all-observation filters. Individual author edits reuse the existing review forms. Canonical views remain linked. Core manuscript completion and the character identity safeguard are unchanged; optional peer review never blocks Return to Book or the Writer Workspace.
Migration and existing imports
This repository uses Dapper and numbered SQL/stored procedures, not EF Core. Apply PlotLine/Sql/200_StoryIntelligenceExceptionReview.sql before deploying the application. It adds priority/reason storage and an idempotent knowledge source key, plus review read/assessment procedures. Existing records start unassessed. The migration does not bulk-accept any manuscript data.
Future preparation assesses saved candidates automatically. Existing imports have an explicit, antiforgery-protected Update review priorities POST. It rebuilds evidence from retained scene results and matches current pending stable keys in place. It does not delete unmatched older candidates or request paid reanalysis. Repeated calls are safe; an interrupted update can resume. Reviewed, ignored and already tracked candidates are not reinterpreted. Original reviewed proposal states are excluded from policy context because the author may have corrected them in canonical editors.
Automatic acceptance and candidate state update share a database transaction. Knowledge inserts are source-key-idempotent, including manual import retries. The existing relationship acceptance procedure is reused. New preparation generations carry settled observations and evidence forward, and candidate saves cannot overwrite them. Historical decisions, including legacy reviewed relationship pairs, take precedence over newly generated proposals. Stale forms are rejected before manual materialisation.
Validation and limits
Run dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj and dotnet build PlotLine.slnx serially. PlotLine.Tests/Sql/ExceptionReview.sql is a development-only integration test requiring migration 200 and existing scene/character fixtures. It asserts canonical materialisation, retries, direction, scene events, author decisions, generation carry-forward and distinct counts; all fixture writes roll back. It must never be run against production.
The actual compiled Review Centre was rendered with synthetic counts in Chromium in light and dark themes, using the existing CSS. These illustrative counts are not classification results for a production manuscript. Development receives migration 200 and the tested build; production is not changed. Existing imports require the explicit priority update to materialise newly eligible observations.
This is a conservative deterministic first policy, not a semantic continuity detector. Equivalent facts expressed differently, missing learning events across distant scenes, overlapping reciprocal/directional tracks and the narrative explanation of every state change need deeper fact/event alignment. Existing unresolved names filtered by upstream import builders remain in raw analysis; this change detects duplicate-alias ambiguity in candidates but does not redesign character resolution. Legacy pair cards whose stable keys cannot be matched remain inspectable and optional. Existing knowledge vocabulary maps beliefs to Partially Knows and preserves reported/inferred acquisition in evidence; no unsupported new certainty/state is invented. Asset significance and new-identity autoacceptance are left for a dedicated asset design.