ARCH: ввести data-need graph и довести open-scope comparison до live replay

This commit is contained in:
2026-04-22 20:38:36 +03:00
parent dca49ef4e1
commit f2bd2dfdb1
27 changed files with 2832 additions and 43 deletions
@@ -199,3 +199,50 @@ The next move is larger:
- make the assistant able to look into 1C through bounded MCP discovery,
- choose its path through reviewed primitives,
- and answer from proved evidence instead of memorized route scripts.
## Status Update - 2026-04-22
The reset above is no longer only directional.
Its first three large blocks are now considered closed:
- `Big Block A. Metadata-First Self-Navigation`
- `Big Block B. Entity And Schema Grounding`
- `Big Block C. Planner-Selected Primitive Chains`
What is now materially real in code and replay-backed:
- metadata wording can start a live `inspect_1c_metadata` discovery path instead of collapsing into a hand-written route;
- metadata ambiguity can be held as a bounded clarification and resumed into `documents` or `movements`;
- grounded entity resolution can continue into `incoming`, `payout`, `net`, `documents`, and `movements` without repeating the entity name on every turn;
- planner-selected chains now survive year-switch, lane-switch, and direct follow-up pivots under the guarded evidence gate.
Current replay anchors for this closure:
- `address_truth_harness_phase24_metadata_lane_choice_loop_live_rerun5` accepted;
- `address_truth_harness_phase25_entity_resolution_chain_live_rerun_full_chain` accepted;
- `address_truth_harness_phase32_planner_selected_chain_end_to_end_live_rerun2` accepted `6/6`.
What is **not** complete yet:
- a general open-world understanding layer for structurally new 1C questions;
- planner selection from a broader primitive search space without pre-reviewed family scaffolding;
- a multi-hop evidence loop that can keep exploring, pause for clarification, and resume on unfamiliar contours.
That means the reset succeeded at building the bounded autonomy foundation.
It does **not** yet mean:
- unrestricted navigation through arbitrary 1C schemas;
- no-more-domain-thinking;
- "ask anything about 1C and the system will figure it out".
The next mainline now moves to:
- [16 - data_need_graph_and_open_world_mcp_plan_2026-04-22.md](./16%20-%20data_need_graph_and_open_world_mcp_plan_2026-04-22.md)
That document formalizes the next three blocks:
- `D. Question -> Data Need Graph`
- `E. Dynamic Schema Traversal And Primitive Search`
- `F. Multi-Hop Evidence Loop`
@@ -0,0 +1,223 @@
# 16 - Data Need Graph And Open-World MCP Plan (2026-04-22)
## Purpose
This note opens the next architecture phase after the completion of bounded-autonomy foundation blocks `A/B/C`.
It is not a restart.
It is the formal hand-off from:
- metadata-first self-navigation;
- entity/schema grounding;
- planner-selected primitive chains;
to the next problem:
- how the assistant starts understanding structurally new 1C questions without waiting for one more domain-specific route.
## Baseline Entering This Phase
The following is now treated as implemented baseline rather than future intent:
- live metadata inspection through reviewed MCP primitives;
- bounded schema grounding with honest ambiguity handling;
- planner-selected reviewed chains across entity resolution, value flow, documents, and movements;
- continuity that can preserve grounded entity and period context across the validated chain families.
Replay-backed anchors for that baseline include:
- `address_truth_harness_phase24_metadata_lane_choice_loop_live_rerun5`;
- `address_truth_harness_phase25_entity_resolution_chain_live_rerun_full_chain`;
- `address_truth_harness_phase32_planner_selected_chain_end_to_end_live_rerun2`.
This is enough to say:
- the assistant is no longer only a deterministic route bundle;
- the system already has a bounded MCP discovery substrate.
This is **not** enough to say:
- the assistant already understands arbitrary 1C questions;
- the planner already walks open-world 1C structure on its own;
- the system can already derive the correct probe sequence for unfamiliar asks without more architecture.
## Main Remaining Gap
The current system still understands many turns through a reviewed family scaffold.
That scaffold is much healthier than old route hardcoding, but it is still a scaffold.
The next large gap is:
- new questions must stop depending on whether their wording already resembles one of the preworked families;
- the runtime must first understand the user's data need as a machine-readable object;
- then search for a safe path through the MCP primitive catalog and observed 1C surface;
- then keep iterating until the answer is either proved, honestly bounded, or blocked for a concrete reason.
In short:
- move from `reviewed chain families`
- toward `open-world bounded evidence planning`.
## Big Block D. Question -> Data Need Graph
### Goal
Create one runtime object that represents the user's business data need independently from any one preworked domain route.
### Why This Block Comes First
Without this layer the planner still starts too low:
- it knows primitive families;
- it knows reviewed chains;
- but it does not yet have one explicit object saying what kind of business fact the user is asking to prove.
That means unfamiliar wording still risks falling back into:
- a nearby known family;
- a shallow unsupported verdict;
- or a hand-added route patch.
### Target Object
`assistant_data_need_graph_v1`
### Minimum Axes
- `subject_candidates`
- `business_fact_family`
- `action_family`
- `aggregation_need`
- `time_scope_need`
- `comparison_need`
- `ranking_need`
- `proof_expectation`
- `clarification_gaps`
- `decomposition_candidates`
- `forbidden_overclaim_flags`
### Scope
- normalize user wording into a business-meaning graph before primitive selection;
- distinguish direct fact asks from ranking, comparison, trend, list, drilldown, and explanation asks;
- carry explicit versus inherited axes separately;
- represent "understood but not yet grounded" without forcing a wrong domain route;
- give the planner one shared contract that survives wording variation.
### Acceptance
- structurally similar questions with different wording build equivalent data-need graphs;
- unfamiliar but intelligible questions stop collapsing into nearest-route guessing;
- the planner consumes the graph rather than ad hoc route-only hints;
- unsupported cases become "understood but missing evidence path", not "question not understood".
## Big Block E. Dynamic Schema Traversal And Primitive Search
### Goal
Teach the planner to search a broader reviewed primitive space against the observed 1C surface instead of depending on a fixed set of precomposed chain families.
### Why This Block Matters
Today the system can chain reviewed primitives well inside validated families.
What it still cannot do broadly enough is:
- look at the current data-need graph;
- inspect the schema surface;
- score plausible objects and primitives;
- assemble the next safe probe path dynamically.
That is the step from `good bounded recipes` to `bounded open-world navigation`.
### Scope
- introduce machine-readable primitive capability descriptors and prerequisites;
- rank candidate schema objects against the data-need graph;
- score document/register/catalog surfaces dynamically;
- let the planner build candidate chains from the catalog instead of picking from a short reviewed list only;
- preserve ambiguity when the schema does not yet justify a single path;
- keep traversal bounded by budget, proof rules, and reviewed primitive availability.
### Acceptance
- the planner can assemble a safe next chain without a dedicated per-family recipe;
- new questions can move from metadata into plausible schema traversal without route-per-wording work;
- ambiguity is retained honestly when multiple schema paths compete;
- no chain may bypass the evidence gate or invent unsupported primitives.
## Big Block F. Multi-Hop Evidence Loop And Clarifying Recovery
### Goal
Turn one-shot chain execution into a bounded evidence loop that can probe, detect missing axes, ask for clarification, resume, and stop honestly.
### Why This Block Is Separate
Even with a strong data-need graph and better primitive search, the assistant will still fail on unfamiliar asks if it cannot keep iterating safely.
Open-world bounded autonomy is not one magic route choice.
It is:
- execute;
- inspect what is still missing;
- clarify if needed;
- resume the same proof path;
- answer only with the evidence that survived the loop.
### Scope
- multi-step probe execution with explicit stop conditions;
- gap detection for missing organization, period, subject, or surface choice;
- clarification turns that preserve the active data-need graph and current probe state;
- resume logic that continues the same evidence loop rather than restarting from scratch;
- final answer shaping that separates:
- proved;
- inferred from evidence;
- still unknown.
### Acceptance
- a new question can survive more than one evidence hop without losing its meaning;
- clarification resumes the same proof path instead of resetting into local heuristics;
- the assistant can explain what is proved, what is inferred, and what remains unproved;
- unfamiliar asks no longer fail just because the first probe was incomplete.
## Execution Order
The next module should now be executed in this order:
1. `D. Question -> Data Need Graph`
2. `E. Dynamic Schema Traversal And Primitive Search`
3. `F. Multi-Hop Evidence Loop And Clarifying Recovery`
The order matters.
Doing `E` without `D` would create smarter probing without a stable representation of the user ask.
Doing `F` before `D/E` would create a more complex loop still attached to narrow reviewed families.
## Non-Goals
This phase should **not** be implemented as:
- another wave of domain-by-domain route stitching;
- a hidden prompt wrapper that pretends to be agentic;
- unrestricted free exploration of 1C without reviewed primitive boundaries;
- answer-time improvisation that bypasses the evidence gate;
- a stealth rewrite of the whole orchestration stack.
## Success Condition
This phase is successful only when a new human user can ask a structurally new but intelligible 1C data question and the assistant can:
1. understand the data need in machine-readable form;
2. search for a safe path through reviewed MCP primitives and observed schema surface;
3. iterate through bounded evidence steps;
4. ask a bounded clarification when needed;
5. answer honestly from proved evidence without pretending certainty it does not have.
That is the first point where the assistant will start to feel like it can actually walk 1C on its own within the reviewed MCP boundaries.
@@ -32,38 +32,46 @@ This package answers the next question:
12. [12 - manual_run_system_analysis_3NilqwT1G2_2026-04-18.md](./12%20-%20manual_run_system_analysis_3NilqwT1G2_2026-04-18.md)
13. [13 - pre_multidomain_readiness_audit_2026-04-18.md](./13%20-%20pre_multidomain_readiness_audit_2026-04-18.md)
14. [14 - semantic_dialog_authority_recovery_plan_2026-04-19.md](./14%20-%20semantic_dialog_authority_recovery_plan_2026-04-19.md)
15. [15 - mcp_bounded_autonomy_reset_plan_2026-04-21.md](./15%20-%20mcp_bounded_autonomy_reset_plan_2026-04-21.md)
16. [16 - data_need_graph_and_open_world_mcp_plan_2026-04-22.md](./16%20-%20data_need_graph_and_open_world_mcp_plan_2026-04-22.md)
## Current Status Snapshot (2026-04-19)
## Current Status Snapshot (2026-04-22)
This package is no longer planning-only.
It now documents a turnaround that is already operational in code, already materially past the acute regression breakpoint, but still not ready for wide multi-domain expansion:
It now documents a turnaround that is already operational in code, already materially past the acute regression breakpoint, and already moved into bounded MCP autonomy work beyond the first stabilization wave:
- route, transition, boundary, meta, memory, and provider policy owners exist as separate modules;
- exact-lane truth and coverage/evidence contracts exist as explicit runtime artifacts;
- scenario acceptance writes machine-readable `scenario_acceptance_matrix.json` and `pack_state.json`;
- AGENT semantic packs and source catalogs already exist for mixed domain/meta validation.
- the reset toward `MCP-first bounded autonomy` is now formalized;
- `Big Block A/B/C` of that reset are now closed in runtime code and replay-backed;
- the next architecture mainline is no longer continuity polishing, but `D/E/F`:
- `Question -> Data Need Graph`
- dynamic schema traversal and primitive search
- multi-hop evidence loop with bounded clarification recovery
Current honest status:
- turnaround implementation progress: `~96%`
- exit-from-danger-zone readiness: `~91%`
- pre-multidomain readiness: `~78%`
- graph snapshot after latest rebuild: `5372 nodes`, `11525 edges`, `135 communities`
- bounded-autonomy foundation readiness: `~60%`
- graph snapshot after latest rebuild: `5741 nodes`, `12385 edges`, `137 communities`
- current breakpoint:
- the validated hot paths are no longer structurally broken;
- flagship continuity collapse is no longer the primary risk;
- the main remaining risk is no longer clarification-resume collapse, but the unfinished final convergence toward one true runtime authority plus replay breadth still below the intended multi-domain blast radius;
- pure wording polish is now secondary debt, but semantic robustness of user-facing answers is now a first-class blocker;
- the practical product risk is no longer "the route collapsed", but "a new user can still feel that the assistant is glitchy, misses intent, or answers the wrong thing on short live wording".
- the main remaining risk is no longer clarification-resume collapse, but the unfinished shift from bounded reviewed chains toward open-world data-need-driven MCP planning;
- pure wording polish is now secondary debt, but semantic robustness plus open-world evidence navigation is now a first-class blocker;
- the practical product risk is no longer only "the route collapsed", but "the assistant still cannot yet understand and explore many non-preworked 1C questions on its own".
- main remaining architectural pressure:
- no single fully authoritative continuity contract consumed by every hot runtime owner
- residual coordinator/legacy pressure inside `assistantService.ts`
- no general `Question -> Data Need Graph` authority yet
- planner chain selection is still reviewed-family bounded rather than open-world over the primitive catalog
- schema traversal is still narrower than the intended arbitrary 1C blast radius
- multi-hop evidence recovery is still too shallow for unfamiliar asks
- central domain-intent pressure inside `resolveAddressIntent()`
- replay breadth still narrower than the intended multi-domain rollout surface beyond the flagship and late-switch families
- remaining answer-semantics pressure inside `composeStage.ts` / `answerComposer.ts`
- insufficient semantic robustness on live user wording, especially short follow-up retarget, typo tolerance, and intent-faithful human answers
- no guarded MCP semantic discovery lane yet for understood long-tail 1C questions that should not require one-off route hardcoding
- replay breadth is still below the future open-world autonomy surface
Latest live proof now includes:
@@ -72,14 +80,17 @@ Latest live proof now includes:
- `address_truth_harness_phase15_answer_inspection_followup_live_20260419_rerun11` accepted `9/9`
- `address_truth_harness_phase16_multicompany_late_pivot_live_20260419_rerun10` accepted
- `address_truth_harness_phase17_clarification_resume_and_counterparty_tail_live_20260419_rerun5` accepted `10/10`
- `address_truth_harness_phase24_metadata_lane_choice_loop_live_rerun5` accepted
- `address_truth_harness_phase25_entity_resolution_chain_live_rerun_full_chain` accepted
- `address_truth_harness_phase32_planner_selected_chain_end_to_end_live_rerun2` accepted `6/6`
Current architectural reading:
- the system is already materially past the dangerous regression breakpoint;
- it is now safe for continued architecture hardening and controlled domain-by-domain enablement under replay gates;
- it is now materially closer to pre-multidomain stability, but still not safe to declare broad low-risk multi-domain expansion.
- the practical next target is now `90%+ pre-multidomain readiness`, and the remaining gap should be treated as five large architecture iterations rather than as cosmetic cleanup.
- from this point onward, readiness must be judged not only by route truth and replay pass rate, but also by whether a new human user would feel that the assistant understands the intent and responds meaningfully in live wording.
- the practical next target is no longer only `90%+ pre-multidomain readiness`, but the first believable `open-world bounded autonomy` over 1C evidence.
- from this point onward, readiness must be judged not only by route truth and replay pass rate, but also by whether a new human user can ask a structurally new 1C data question and still get a bounded, evidence-honest answer path.
For the detailed audit, current percentages, and remaining debt, read:
@@ -90,6 +101,8 @@ For the detailed audit, current percentages, and remaining debt, read:
- [12 - manual_run_system_analysis_3NilqwT1G2_2026-04-18.md](./12%20-%20manual_run_system_analysis_3NilqwT1G2_2026-04-18.md)
- [13 - pre_multidomain_readiness_audit_2026-04-18.md](./13%20-%20pre_multidomain_readiness_audit_2026-04-18.md)
- [14 - semantic_dialog_authority_recovery_plan_2026-04-19.md](./14%20-%20semantic_dialog_authority_recovery_plan_2026-04-19.md)
- [15 - mcp_bounded_autonomy_reset_plan_2026-04-21.md](./15%20-%20mcp_bounded_autonomy_reset_plan_2026-04-21.md)
- [16 - data_need_graph_and_open_world_mcp_plan_2026-04-22.md](./16%20-%20data_need_graph_and_open_world_mcp_plan_2026-04-22.md)
## Architectural Objects Of Planning
@@ -122,6 +135,8 @@ Read in this order:
13. `12 - manual_run_system_analysis_3NilqwT1G2_2026-04-18.md`
14. `13 - pre_multidomain_readiness_audit_2026-04-18.md`
15. `14 - semantic_dialog_authority_recovery_plan_2026-04-19.md`
16. `15 - mcp_bounded_autonomy_reset_plan_2026-04-21.md`
17. `16 - data_need_graph_and_open_world_mcp_plan_2026-04-22.md`
## Planning Rules
@@ -141,15 +156,14 @@ and start being described as:
- "a stateful exact-data assistant with explicit transition contracts and isolated truth gating."
As of `2026-04-19`, the project is already materially closer to the target description and is no longer in the same acute collapse state. The remaining blocker is no longer the original continuity failure itself, but the unfinished convergence toward one runtime authority plus still-insufficient replay breadth for low-risk multi-domain expansion.
As of `2026-04-22`, the project is already materially closer to the target description and is no longer in the same acute collapse state. The remaining blocker is no longer the original continuity failure itself, but the unfinished convergence from reviewed bounded MCP chains toward open-world data-need-driven autonomy with replay breadth still below the future blast radius.
The biggest remaining blockers are:
- split continuity ownership across route / transition / recap / coordinator glue;
- saved-session acceptance still too narrow compared with the intended domain-expansion blast radius outside the repaired flagship + late-pivot families;
- clarification precedence is much better than before, but still not yet proven widely enough outside the repaired replay family;
- no general `Question -> Data Need Graph` runtime authority yet;
- planner-selected primitive chains are real, but still narrower than open-world primitive search;
- dynamic schema traversal is not yet broad enough for unfamiliar 1C asks outside the repaired families;
- multi-hop evidence recovery still depends on bounded reviewed seams and not yet on a general exploration loop;
- residual `assistantService` overload;
- central intent pressure in `resolveAddressIntent()`;
- remaining answer-semantics pressure in `composeStage.ts` and `answerComposer.ts`.
- semantic robustness gaps where already-supported questions can still look broken to a human user because of typo sensitivity, short follow-up retarget loss, or human-answer mismatch.
- missing MCP semantic data-discovery layer where Qwen3 can help plan controlled 1C evidence search without bypassing runtime truth gates.
@@ -0,0 +1,35 @@
{
"schema_version": "domain_truth_harness_spec_v1",
"scenario_id": "address_truth_harness_phase33_open_scope_value_flow_comparison",
"domain": "address_phase33_open_scope_value_flow_comparison",
"title": "Phase 33 open-scope value-flow comparison replay",
"description": "Targeted AGENT replay for Big Block D where an open-scope incoming-vs-outgoing money question must be understood as a bounded comparison need, not as a missing-counterparty fact ask.",
"bindings": {},
"steps": [
{
"step_id": "step_01_compare_incoming_vs_outgoing_for_org",
"title": "Raw organization-scoped comparison wording produces a bounded incoming-vs-outgoing answer without inventing a counterparty",
"question": "что больше: входящие или исходящие деньги за 2020 год по ООО Альтернатива Плюс?",
"allowed_reply_types": ["factual_with_explanation", "partial_coverage"],
"required_answer_patterns_all": [
"(?i)2020",
"(?i)входящ|получили|поступ",
"(?i)исходящ|заплатили|списан|платеж",
"(?i)руб"
],
"required_answer_patterns_any": [
"(?i)нетто|сальдо",
"(?i)больше|превыш",
"(?i)альтернатива"
],
"forbidden_answer_patterns": [
"(?i)уточните контрагента",
"(?i)не найден контрагент",
"(?i)по какому контрагенту",
"(?i)не найдено контрагента"
],
"criticality": "critical",
"semantic_tags": ["value_flow_comparison", "open_scope", "organization_scoped", "bounded_autonomy"]
}
]
}