From 10cc779de8e2c0474bd77d325f29e8921d60dfef Mon Sep 17 00:00:00 2001 From: dctouch Date: Mon, 15 Jun 2026 20:01:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D1=84=D0=B8=D0=BA=D1=81=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20phase104=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=80=D0=BE=D0=BB=D0=B5=D0=B2=D1=8B=D1=85=20=D1=85=D0=B2=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orchestration/active_domain_contract.json | 309 ++++++++---------- docs/orchestration/detector_registry.json | 2 +- 2 files changed, 134 insertions(+), 177 deletions(-) diff --git a/docs/orchestration/active_domain_contract.json b/docs/orchestration/active_domain_contract.json index 7556355..42f4a92 100644 --- a/docs/orchestration/active_domain_contract.json +++ b/docs/orchestration/active_domain_contract.json @@ -1,10 +1,10 @@ { "schema_version": "domain_scenario_pack_v1", - "pack_id": "active_counterparty_value_flow_boundary_20260615", - "domain": "agent_counterparty_value_flow_boundary", - "runtime_domain": "business_overview_counterparty_value_flow", - "title": "Counterparty value-flow and bank-role boundary", - "description": "Active slice for the autonomous agent loop: verify that company overview, explicit counterparty value-flow, selected counterparty follow-ups, and bank-role caveats stay separated in user-facing answers.", + "pack_id": "active_phase104_generic_role_tail_anchor_hygiene_20260615", + "domain": "address_phase104_generic_role_tail_anchor_hygiene", + "runtime_domain": "business_overview_role_tail_anchor_hygiene", + "title": "Generic role-tail anchor hygiene", + "description": "Active slice for the autonomous agent loop: broad company overview wording may mention customer/supplier roles, but generic role tails must not become counterparty anchors or poison later bank/counterparty drilldowns.", "status": "active", "source_of_truth_policy": { "purpose": "single mutable domain source for the current orchestration target", @@ -21,23 +21,21 @@ }, "analysis_context": { "as_of_date": "2026-06-15", - "source": "agent_loop_next_domain_slice_after_margin_p12" + "source": "phase104_generic_role_tail_anchor_hygiene_after_value_flow_p06" }, "target_score": 88, "bindings": { "main_organization": "ООО Альтернатива Плюс", "control_year": "2020", + "bank_counterparty": "СБЕРБАНК", "svk_counterparty": "Группа СВК" }, "issue_codes_under_test": [ - "counterparty_value_flow_misrouted_to_company_profit", "bank_counterparty_misclassified_as_business_partner", "technical_garbage_in_answer", "business_next_step_missing" ], "detectors_under_test": [ - "counterparty_value_flow_required_surface", - "counterparty_value_flow_profit_accounts_forbidden", "bank_counterparty_boundary_required", "runtime_tokens_in_user_answer", "capability_ids_in_user_answer", @@ -47,186 +45,145 @@ "semantic_answer_review_first": true, "direct_answer_first": true, "business_utility_required": true, - "counterparty_scope_required": true, - "company_profit_boundary_required": true, + "generic_role_tail_must_not_be_anchor": true, "bank_role_boundary_required": true, "technical_garbage_forbidden": true, "do_not_accept_if": [ - "counterparty received/paid/net-flow question is answered as company profit", - "90/91/99 accounts are used as the direct answer for counterparty money flow", - "bank or financial counterparty is presented as an ordinary customer/supplier without role caveat", - "selected counterparty follow-up switches back to the organization", - "documents follow-up loses the active counterparty", + "generic role wording such as 'client or supplier' becomes extracted_filters.counterparty", + "the Sberbank follow-up is answered for a stale role-tail instead of Sberbank", + "Sberbank is presented as an ordinary customer/supplier without a bank/financial-role caveat", + "the real supplier prefix for Группа СВК is erased by the role-tail guard", "final answer leaks route ids, capability ids, runtime enums, or debug payload" ] }, "scenarios": [ { - "scenario_id": "company_business_overview_scope", - "title": "Company overview, money flow, and scope boundary", - "description": "Establish company-level context and verify that later counterparty questions do not inherit company-profit semantics.", + "scenario_id": "generic_role_tail_anchor_hygiene", + "title": "Role-tail overview, bank drilldown, and real supplier canary", + "description": "Validate that business overview role words stay semantic-only, Sberbank remains a bank-role drilldown, and an explicit supplier prefix still preserves a real counterparty.", "steps": [ { - "step_id": "s01_business_overview_2020", - "title": "Direct business overview for the company and year", + "step_id": "step_01_choose_company_scope", + "title": "Bare organization choice binds active company scope", "node_role": "root", - "question": "Дай взрослый бизнес-обзор {{bindings.main_organization}} за {{bindings.control_year}} год по данным 1С: обороты, входящие и исходящие деньги, нетто, НДС, долги, склад, клиенты, поставщики и что пока нельзя утверждать.", - "expected_intents": ["business_overview"], - "semantic_tags": ["business_overview", "money", "vat", "debt", "inventory", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["Альтернатива", "2020"], - "forbidden_answer_patterns": [ - "(?i)capability_id", - "(?i)selected_chain_id", - "(?i)runtime_", - "(?i)business_overview_route_template_v1", - "(?i)mcp_discovery" - ] - }, - { - "step_id": "s02_money_followup", - "title": "Company money follow-up with counterparty highlights", - "question": "Раскрой деньги подробнее: сколько получили, сколько заплатили, какой чистый денежный поток, кто главный клиент и главный поставщик в {{bindings.control_year}}.", - "depends_on": ["s01_business_overview_2020"], - "semantic_tags": ["money", "counterparty", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["2020"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)runtime_"] - } - ] - }, - { - "scenario_id": "svk_counterparty_documents_scope", - "title": "Explicit SVK counterparty money and document scope", - "description": "Validate that an explicit counterparty request is not confused with company overview context and that document evidence is separated from business conclusions.", - "steps": [ - { - "step_id": "s01_svk_money_documents", - "title": "Explicit counterparty money flow and evidence", - "node_role": "root", - "question": "Отдельно по контрагенту {{bindings.svk_counterparty}}, без опоры на прошлый диалог: сколько денег прошло, что входящее, что исходящее и есть ли документы или движения, на которых это основано?", - "expected_intents": ["value_flow"], - "semantic_tags": ["counterparty", "money", "documents", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК"], - "forbidden_answer_patterns": [ - "(?i)capability_id", - "(?i)selected_chain_id", - "(?i)runtime_", - "(?i)mcp_discovery", - "(?i)Альтернатива Плюс.*контрагент", - "(?i)(90[\\./](01|02|09)|91[\\./]|99\\b)" - ] - }, - { - "step_id": "s02_svk_documents_followup", - "title": "Counterparty documents follow-up", - "question": "Покажи документы по этой цепочке и не смешивай {{bindings.svk_counterparty}} с организацией {{bindings.main_organization}}.", - "depends_on": ["s01_svk_money_documents"], - "semantic_tags": ["counterparty", "documents", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК"], - "forbidden_answer_patterns": [ - "(?i)capability_id", - "(?i)runtime_", - "(?i)Альтернатива Плюс.*как контрагент" - ] - }, - { - "step_id": "s03_company_vs_svk_summary", - "title": "Separate company and counterparty conclusions", - "question": "Собери короткий итог: что мы подтвердили по компании, что отдельно по {{bindings.svk_counterparty}}, какие выводы можно делать и какие нельзя.", - "depends_on": ["s01_svk_money_documents", "s02_svk_documents_followup"], - "semantic_tags": ["business_overview", "counterparty", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК", "компан"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)runtime_"] - } - ] - }, - { - "scenario_id": "company_business_overview_colloquial_scope", - "title": "Colloquial company overview and bank-role money follow-up", - "description": "Validate colloquial wording and the bank-role caveat when the user explicitly warns not to call a bank an ordinary customer.", - "steps": [ - { - "step_id": "s01_colloquial_company_overview_2020", - "title": "Colloquial business overview for the company", - "node_role": "root", - "question": "По-человечески посмотри {{bindings.main_organization}} за {{bindings.control_year}}: что по бизнесу видно в 1С по деньгам, НДС, долгам, складу, клиентам/поставщикам и где пока нельзя делать вывод?", - "expected_intents": ["business_overview"], - "semantic_tags": ["business_overview", "colloquial", "money", "vat", "debt", "inventory", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["2020", "НДС"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)selected_chain_id", "(?i)runtime_", "(?i)mcp_discovery"] - }, - { - "step_id": "s02_colloquial_money_leaders", - "title": "Colloquial money leaders with bank-role boundary", - "question": "А по деньгам в этом же году кто больше всего занес и кому больше всего ушло? Банк не называй обычным клиентом без оговорки.", - "depends_on": ["s01_colloquial_company_overview_2020"], - "semantic_tags": ["money", "counterparty", "bank_role_boundary", "colloquial", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["2020"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)runtime_"] - } - ] - }, - { - "scenario_id": "svk_selected_object_followup_scope", - "title": "Selected-object style SVK counterparty follow-up", - "description": "Validate selected-object and pronoun coverage for the SVK counterparty edge: root counterparty money fact, documents by selected object, and separated summary.", - "steps": [ - { - "step_id": "s01_select_svk_counterparty_money", - "title": "Select SVK as the active counterparty", - "node_role": "root", - "question": "Возьми как выбранного контрагента {{bindings.svk_counterparty}}: сколько по нему входящих денег, исходящих денег и расчетное нетто, на чем это основано?", - "expected_intents": ["value_flow"], - "semantic_tags": ["counterparty", "money", "selected_object", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК"], - "forbidden_answer_patterns": [ - "(?i)capability_id", - "(?i)selected_chain_id", - "(?i)runtime_", - "(?i)mcp_discovery", - "(?i)(90[\\./](01|02|09)|91[\\./]|99\\b)" - ] - }, - { - "step_id": "s02_pronoun_documents_for_selected_svk", - "title": "Documents for the selected counterparty by pronoun", - "question": "Теперь по нему покажи документы и не переключайся на организацию.", - "depends_on": ["s01_select_svk_counterparty_money"], - "semantic_tags": ["counterparty", "documents", "selected_object", "pronoun_followup", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК"], - "forbidden_answer_patterns": [ - "(?i)capability_id", - "(?i)runtime_", - "(?i)Альтернатива Плюс.*как контрагент" - ] - }, - { - "step_id": "s03_selected_svk_company_boundary_summary", - "title": "Boundary summary after selected-object document follow-up", - "question": "И коротко сравни: что у нас подтверждено по компании, что отдельно по выбранному контрагенту, и какие выводы нельзя делать?", - "depends_on": ["s01_select_svk_counterparty_money", "s02_pronoun_documents_for_selected_svk"], - "semantic_tags": ["business_overview", "counterparty", "selected_object", "scope_guard"], - "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["СВК", "компан"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)runtime_"] - }, - { - "step_id": "s04_org_clarification_boundary_summary", - "title": "Organization clarification after selected counterparty branch", "question": "{{bindings.main_organization}}", - "depends_on": ["s03_selected_svk_company_boundary_summary"], - "semantic_tags": ["clarification", "organization", "scope_guard"], + "allowed_reply_types": [ + "factual_with_explanation", + "partial_coverage" + ], + "semantic_tags": [ + "bare_org_scope", + "company_scope" + ], "required_answer_shape": "direct_answer_first", - "required_answer_patterns_all": ["Альтернатива"], - "forbidden_answer_patterns": ["(?i)capability_id", "(?i)runtime_"] + "required_answer_patterns_all": [ + "(?i)фиксир|рабоч.*организац|контур", + "(?i)альтернатива" + ], + "forbidden_answer_patterns": [ + "(?i)не могу определить", + "(?i)route_candidate|primitive|planner_|catalog_|snapshot_items|answer_object" + ] + }, + { + "step_id": "step_02_business_overview_role_tail_not_counterparty", + "title": "Business overview role words do not become counterparty anchors", + "question": "Теперь дай взрослый обзор за {{bindings.control_year}} по компании: входящие, исходящие, нетто, топы, но банк в топах отдельно объясни как финансовый поток, если по назначению он не обычный клиент или поставщик.", + "depends_on": [ + "step_01_choose_company_scope" + ], + "expected_intents": [ + "business_overview" + ], + "semantic_tags": [ + "business_overview", + "generic_role_tail_anchor_hygiene", + "financial_role_purpose" + ], + "required_answer_shape": "direct_answer_first", + "forbidden_filter_keys": [ + "counterparty" + ], + "forbidden_filter_values": { + "counterparty": [ + "или поставщик", + "поставщик", + "клиент", + "обычный клиент", + "обычный клиент или поставщик" + ] + }, + "required_answer_patterns_all": [ + "(?i)2020|компан|организац", + "(?i)вход|поступ|исход|списан|нетто", + "(?i)банк|сбербанк|финансов", + "(?i)не.*обычн.*клиент|не.*обычн.*поставщик|не.*выручк|не.*закупк|назначен" + ], + "forbidden_answer_patterns": [ + "(?i)сбербанк.*обычный поставщик", + "(?i)сбербанк.*обычный клиент", + "(?i)чистая прибыль.*точно", + "(?i)route_candidate|primitive|planner_|catalog_|snapshot_items|answer_object" + ] + }, + { + "step_id": "step_03_sberbank_role_after_role_tail_overview", + "title": "Bank-role drilldown still resolves Sberbank after role-tail overview", + "question": "А отдельно по {{bindings.bank_counterparty}}У: он для нас клиент, поставщик или финансовый поток? Дай коротко по подтвержденным строкам.", + "depends_on": [ + "step_02_business_overview_role_tail_not_counterparty" + ], + "semantic_tags": [ + "bank_like_counterparty", + "financial_role_purpose", + "post_overview_anchor_integrity" + ], + "required_answer_shape": "direct_answer_first", + "required_filters": { + "counterparty": "{{bindings.bank_counterparty}}" + }, + "required_answer_patterns_all": [ + "(?i)сбербанк|банк", + "(?i)финансов|банковск|кредит|комисс|возврат|назначен|вид операц", + "(?i)не.*обычн.*клиент|не.*обычн.*поставщик|не.*клиентск.*выручк|нельзя.*читать" + ], + "forbidden_answer_patterns": [ + "(?i)или поставщик", + "(?i)сбербанк.*обычный поставщик", + "(?i)сбербанк.*обычный клиент", + "(?i)route_candidate|primitive|planner_|catalog_|snapshot_items|answer_object" + ] + }, + { + "step_id": "step_04_real_supplier_prefix_still_keeps_counterparty", + "title": "Explicit supplier prefix still preserves a real counterparty", + "question": "А теперь по поставщику {{bindings.svk_counterparty}} за {{bindings.control_year}}: сколько мы ему заплатили и какой общий денежный смысл?", + "depends_on": [ + "step_03_sberbank_role_after_role_tail_overview" + ], + "expected_intents": [ + "value_flow" + ], + "semantic_tags": [ + "counterparty_net_cash_flow", + "supplier_prefix_canary", + "stale_scope_guard" + ], + "required_answer_shape": "direct_answer_first", + "required_filters": { + "counterparty": "{{bindings.svk_counterparty}}" + }, + "required_answer_patterns_all": [ + "(?i)свк|группа", + "(?i)2020", + "(?i)заплат|исход|списан|получ|поступ|нетто|смысл" + ], + "forbidden_answer_patterns": [ + "(?i)или поставщик", + "(?i)сбербанк", + "(?i)уточните организац|какую компанию", + "(?i)route_candidate|primitive|planner_|catalog_|snapshot_items|answer_object" + ] } ] } diff --git a/docs/orchestration/detector_registry.json b/docs/orchestration/detector_registry.json index 003bbc4..553a11c 100644 --- a/docs/orchestration/detector_registry.json +++ b/docs/orchestration/detector_registry.json @@ -239,7 +239,7 @@ "issue_codes": ["bank_counterparty_misclassified_as_business_partner"], "inputs": ["steps//output.md"], "check": { - "artifact_path_include_patterns": ["(?i)s02_colloquial_money_leaders"], + "artifact_path_include_patterns": ["(?i)(s02_colloquial_money_leaders|step_03_sberbank_role_after_role_tail_overview)"], "required_patterns_any": ["(?is)(банк|банковск|финансов|не\\s+обычн|роль|назначени[ея]|плат[её]ж)"] } },