6.6 KiB
02 - State And Transition Contracts
Purpose
This document defines the objects that must become explicit in project design:
state objectstransition classes
The goal is to stop treating the assistant as a prompt-driven flow with ad hoc carryover and start treating it as a stateful runtime with explicit transitions.
State Model
1. Assistant Session Aggregate
Top-level first-class runtime state:
assistant_session_state
It must aggregate:
living_mode_stateaddress_navigation_stateinvestigation_stateclarification_stateanswer_context_statecoverage_gate_state
This aggregate is the architectural owner of cross-turn continuity.
2. Living Mode State
Purpose:
- remember which major runtime contour is active.
Fields:
living_modemode_reasonmode_sourcemode_entry_turn_id
Allowed values:
address_dataassistant_data_scopechatmeta_followupclarification
3. Root Frame State
Purpose:
- represent the currently active root business slice.
Fields:
domain_idroot_route_idorganization_scopedate_scoperoot_result_set_idroot_answer_object_refframe_status
This state survives more transitions than object state.
4. Selected Object Frame State
Purpose:
- represent the currently active drilldown object.
Fields:
focus_object_reffocus_object_kindsource_result_set_idcompatible_route_familyprovenance_bundle_reftemporal_ceilingframe_status
This state may only survive compatible object-level transitions.
5. Meta Frame State
Purpose:
- support questions about the already returned answer without replaying exact execution blindly.
Fields:
source_answer_object_refmeta_question_kindsource_gate_statusmeta_truth_mode
Allowed meta classes:
evaluationcomparisonmemory_recapboundary_explanationanswer_interpretation
6. Clarification State
Purpose:
- represent unfinished business queries that are waiting for missing anchors or disambiguation.
Fields:
clarification_kindmissing_anchorscandidate_scopesresume_target_routeresume_target_frame
7. Coverage Gate State
Purpose:
- capture whether the exact execution result is admissible for full, partial, or blocked downstream behavior.
Fields:
coverage_statusevidence_gradegrounding_statustruth_modecarryover_eligibilityreason_codes
Allowed values:
coverage_status:full,partial,blockedtruth_mode:confirmed,limited,clarification_required,unsupportedcarryover_eligibility:full,root_only,object_only,meta_only,none
Transition Model
The architecture must distinguish transition classes explicitly.
T1. Root Query Entry
Trigger:
- new root business question
Inputs:
- raw user query
- living mode state
Outputs:
- new
root_frame_state - new
coverage_gate_state
Must not:
- inherit stale
focus_object
T2. Root Follow-Up With Date Or Scope Change
Trigger:
а на март 2020на тот же периодеще раз по этой дате
Inputs:
- existing
root_frame_state - compatible temporal or organization shift
Outputs:
- updated
root_frame_state - new exact route execution
Must preserve:
- root domain
- organization scope if not explicitly changed
Must not:
- downgrade into
unknownif supported root route exists
T3. Explicit Selected Object Drilldown
Trigger:
- item selected from current result set
- UI selected-object wording
- full explicit object mention
Inputs:
- active
root_frame_state - selected object reference
Outputs:
selected_object_frame_state
Must preserve:
- source result set
- compatible temporal ceiling
T4. Short Action Follow-Up On Selected Object
Trigger:
кто поставщикгде купиликому продаликакие документы
Inputs:
- active
selected_object_frame_state - compatible action request
Outputs:
- exact item-level capability route
Must not:
- fall into generic chat
- fall into data-scope selection
- lose selected object because the wording is short
T5. Pronoun Or Compressed Object Follow-Up
Trigger:
по нейпо этой позицииа эта кому ушла
Inputs:
- active
selected_object_frame_state - prior compatible object route
Outputs:
- continued object drilldown
Must not:
- degrade full object anchor into vague semantic noise
T6. Domain Pivot With Root-Only Carryover
Trigger:
- user leaves the current object drilldown but remains in compatible higher business scope
Inputs:
root_frame_state- incompatible
selected_object_frame_state
Outputs:
- preserved root context
- dropped object context
Must preserve:
- organization/date root scope
Must not:
- replay object route into another domain
T7. Clarification Continuation
Trigger:
- user resolves missing anchor or ambiguity
Inputs:
- active
clarification_state
Outputs:
- resumed target route
- cleared or updated clarification state
Must not:
- forget the suspended target route
T8. Meta Follow-Up Over Answer Object
Trigger:
это много или малоэто мы должны или намчто из этого важнее
Inputs:
answer_context_statecoverage_gate_state
Outputs:
- meta answer
Must not:
- blindly replay exact route
T9. Memory Recap
Trigger:
мы это обсуждали?помнишь, о чем говорили
Inputs:
- prior grounded answer context
Outputs:
- truthful recap
Must not:
- invent conversation memory
T10. Unsupported Or Blocked Boundary
Trigger:
- unsupported route
- blocked evidence gate
- execution failure
Inputs:
- exact runtime outcome
coverage_gate_state
Outputs:
- bounded truthful answer or clarification
Must not:
- masquerade blocked execution as confirmed factual answer
Transition Invariants
Every transition must declare:
entry conditionrequired prior stateallowed carryover depthstate mutationsforbidden carryoverexpected answer mode
Required Artifacts
Any future implementation of these contracts should produce:
- transition table or registry;
- state schema definitions;
- transition tests;
- scenario acceptance coverage by transition class.
Done Criteria
This document is only considered implemented in architecture when:
- every major follow-up case maps to a named transition class;
- every transition class has a declared state owner;
- every transition class has a scenario-based regression family;
- no critical follow-up behavior depends only on unnamed heuristic carryover.