cases:
  - id: flow-explain-checkout
    query: "Объясни как работает checkout workflow"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "SYSTEM_FLOW_EXPLAIN"
    expected_layers: ["D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/workflows/checkout.md", title: "Checkout flow", content: "Workflow overview"}
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/workflows/checkout.md", title: "Checkout steps", content: "cart -> payment -> confirm"}
  - id: flow-explain-order-process
    query: "Как происходит процесс создания заказа?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "SYSTEM_FLOW_EXPLAIN"
    expected_layers: ["D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/workflows/order-create.md", title: "Order process", content: "collect data -> validate -> save"}
  - id: flow-explain-message-scenario
    query: "Опиши сценарий ручной отправки сообщения"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "SYSTEM_FLOW_EXPLAIN"
    expected_layers: ["D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/scenarios/manual-send.md", title: "Manual send", content: "Scenario"}
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/scenarios/manual-send.md", title: "Manual send steps", content: "open ui -> submit -> worker sends"}
  - id: flow-explain-health-sequence
    query: "Как проходит health-check сценарий?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "SYSTEM_FLOW_EXPLAIN"
    expected_layers: ["D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/workflows/health.md", title: "Health flow", content: "ping -> status -> response"}
  - id: flow-explain-retry-loop
    query: "Опиши flow повторной отправки уведомления"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "SYSTEM_FLOW_EXPLAIN"
    expected_layers: ["D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/workflows/retry-loop.md", title: "Retry loop", content: "attempt -> wait -> retry"}

  - id: component-explain-billing
    query: "Объясни компонент billing"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "COMPONENT_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/components/billing.md", title: "Billing", content: "Billing component"}
      - {layer: "D2_FACT_INDEX", path: "docs/components/billing.md", title: "Billing facts", content: "Handles payments"}
  - id: component-explain-control-plane
    query: "Что делает модуль control plane?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "COMPONENT_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/components/control-plane.md", title: "Control plane", content: "Exposes operator endpoints"}
  - id: component-explain-telegram-channel
    query: "Как работает компонент TelegramControlChannel?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "COMPONENT_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/components/telegram-channel.md", title: "TelegramControlChannel", content: "Telegram control component"}
  - id: component-explain-worker-loop
    query: "Объясни подсистему notification worker"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "COMPONENT_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/components/worker.md", title: "Worker", content: "Schedules notification sending"}
  - id: component-explain-runtime-manager
    query: "Как устроен блок runtime manager?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "COMPONENT_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/components/runtime-manager.md", title: "Runtime manager", content: "Runtime orchestration"}

  - id: api-explain-health
    query: "Объясни API метод /health"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "API_METHOD_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/api/health.md", title: "GET /health", content: "Health endpoint"}
      - {layer: "D2_FACT_INDEX", path: "docs/api/health.md", title: "Health contract", content: "200 and 503", metadata: {endpoint: "/health", http_method: "get"}}
  - id: api-explain-send
    query: "Что делает endpoint /send?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "API_METHOD_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/send.md", title: "POST /send", content: "Sends a message", metadata: {endpoint: "/send", http_method: "post"}}
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/api/send.md", title: "Send usage", content: "request -> queue -> worker"}
  - id: api-explain-create-order
    query: "Как работает API method create order?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "API_METHOD_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/api/orders.md", title: "POST /orders", content: "Create order"}
      - {layer: "D4_WORKFLOW_INDEX", path: "docs/api/orders.md", title: "Order API flow", content: "validate -> create -> respond"}
  - id: api-explain-actions
    query: "Что принимает и возвращает ручка /actions/{action}?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "API_METHOD_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/actions.md", title: "POST /actions/{action}", content: "Action trigger", metadata: {endpoint: "/actions/{action}", http_method: "post"}}
  - id: api-explain-webhook
    query: "Объясни endpoint /webhook"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "API_METHOD_EXPLAIN"
    expected_layers: ["D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/api/webhook.md", title: "POST /webhook", content: "Webhook"}

  - id: entity-explain-order
    query: "Что такое сущность Order?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "ENTITY_EXPLAIN"
    expected_layers: ["D3_ENTITY_CATALOG", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D3_ENTITY_CATALOG", path: "docs/domain/order.md", title: "Order", content: "Business entity", metadata: {entity: "Order"}}
  - id: entity-explain-cart
    query: "Как используется Cart?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "ENTITY_EXPLAIN"
    expected_layers: ["D3_ENTITY_CATALOG", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D3_ENTITY_CATALOG", path: "docs/domain/cart.md", title: "Cart", content: "Shopping cart", metadata: {entity: "Cart"}}
  - id: entity-explain-health
    query: "Что такое WorkerHealth?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "ENTITY_EXPLAIN"
    expected_layers: ["D3_ENTITY_CATALOG", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D3_ENTITY_CATALOG", path: "docs/domain/health.md", title: "WorkerHealth", content: "Worker health entity", metadata: {entity: "WorkerHealth"}}
  - id: entity-explain-status
    query: "Что такое объект WorkerStatus?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "ENTITY_EXPLAIN"
    expected_layers: ["D3_ENTITY_CATALOG", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D3_ENTITY_CATALOG", path: "docs/domain/status.md", title: "WorkerStatus", content: "Status entity", metadata: {entity: "WorkerStatus"}}
  - id: entity-explain-payment
    query: "Объясни бизнес-объект Payment"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "ENTITY_EXPLAIN"
    expected_layers: ["D3_ENTITY_CATALOG", "D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D3_ENTITY_CATALOG", path: "docs/domain/payment.md", title: "Payment", content: "Payment entity", metadata: {entity: "Payment"}}

  - id: related-docs-health
    query: "Что связано с endpoint /health?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "RELATED_DOCS_EXPLAIN"
    expected_layers: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D5_RELATION_GRAPH", path: "docs/api/health.md", title: "Health relations", content: "Related to runtime health", metadata: {endpoint: "/health"}}
  - id: related-docs-order
    query: "Какие страницы связаны с Order?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "RELATED_DOCS_EXPLAIN"
    expected_layers: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D5_RELATION_GRAPH", path: "docs/domain/order.md", title: "Order relations", content: "Order -> Payment -> Cart", metadata: {entity: "Order"}}
  - id: related-docs-billing
    query: "Где еще описано billing?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "RELATED_DOCS_EXPLAIN"
    expected_layers: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D5_RELATION_GRAPH", path: "docs/components/billing.md", title: "Billing links", content: "See payments and orders"}
  - id: related-docs-read-next
    query: "Что еще посмотреть по теме control plane?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "RELATED_DOCS_EXPLAIN"
    expected_layers: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D5_RELATION_GRAPH", path: "docs/components/control-plane.md", title: "Control plane links", content: "See health and actions docs"}
  - id: related-docs-usage
    query: "Где еще используется Cart?"
    expected_intent: "DOCUMENTATION_EXPLAIN"
    expected_sub_intent: "RELATED_DOCS_EXPLAIN"
    expected_layers: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D5_RELATION_GRAPH", path: "docs/domain/cart.md", title: "Cart usage", content: "checkout and order docs", metadata: {entity: "Cart"}}

  - id: openapi-method-health
    query: "Сгенерируй openapi для /health"
    expected_intent: "OPENAPI_GENERATION"
    expected_sub_intent: "OPENAPI_METHOD_GENERATE"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/health.md", title: "GET /health", content: "Health API", metadata: {endpoint: "/health", http_method: "get", response_schema: {type: object, properties: {status: {}}}}}
  - id: openapi-method-orders
    query: "Сделай yaml для метода /orders"
    expected_intent: "OPENAPI_GENERATION"
    expected_sub_intent: "OPENAPI_METHOD_GENERATE"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/orders.md", title: "POST /orders", content: "Create order", metadata: {endpoint: "/orders", http_method: "post", request_schema: {type: object, properties: {customer_id: {}}}, response_schema: {type: object, properties: {order_id: {}}}}}
  - id: openapi-fragment-request
    query: "Сгенерируй request schema для /send"
    expected_intent: "OPENAPI_GENERATION"
    expected_sub_intent: "OPENAPI_FRAGMENT_GENERATE"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/send.md", title: "POST /send", content: "Send API", metadata: {endpoint: "/send", http_method: "post", request_schema: {type: object, properties: {message: {}}}}}
  - id: openapi-fragment-response
    query: "Сгенерируй response schema для /actions/{action}"
    expected_intent: "OPENAPI_GENERATION"
    expected_sub_intent: "OPENAPI_FRAGMENT_GENERATE"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/actions.md", title: "POST /actions/{action}", content: "Actions API", metadata: {endpoint: "/actions/{action}", http_method: "post", response_schema: {type: object, properties: {result: {}}}}}
  - id: openapi-fragment-parameters
    query: "Построй openapi fragment schema parameters для /webhook"
    expected_intent: "OPENAPI_GENERATION"
    expected_sub_intent: "OPENAPI_FRAGMENT_GENERATE"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D2_FACT_INDEX", path: "docs/api/webhook.md", title: "POST /webhook", content: "Webhook API", metadata: {endpoint: "/webhook", http_method: "post", request_schema: {type: object, properties: {event_id: {}}}}}

  - id: general-qa-help
    query: "Помоги понять документацию проекта"
    expected_intent: "GENERAL_QA"
    expected_sub_intent: "GENERIC_QA"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/overview.md", title: "Overview", content: "Project overview"}
  - id: general-qa-start
    query: "С чего начать чтение docs?"
    expected_intent: "GENERAL_QA"
    expected_sub_intent: "GENERIC_QA"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D0_DOC_CHUNKS", path: "docs/overview.md", title: "Start here", content: "Read overview first"}
  - id: general-qa-ambiguous-entity-component
    query: "Расскажи про Order"
    expected_intent: "GENERAL_QA"
    expected_sub_intent: "GENERIC_QA"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/domain/order.md", title: "Order", content: "Order docs"}
  - id: general-qa-ambiguous-api-flow
    query: "Расскажи как работает отправка"
    expected_intent: "GENERAL_QA"
    expected_sub_intent: "GENERIC_QA"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D0_DOC_CHUNKS", path: "docs/api/send.md", title: "Send overview", content: "Send docs"}
  - id: general-qa-ambiguous-related
    query: "Что тут еще важно?"
    expected_intent: "GENERAL_QA"
    expected_sub_intent: "GENERIC_QA"
    expected_layers: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
    rows:
      - {layer: "D1_DOCUMENT_CATALOG", path: "docs/overview.md", title: "Overview", content: "Important sections"}
