{
  "schema_version": "1.0",
  "app": "Meow Serial",
  "purpose": "Stable browser automation guide for AI agents controlling the web UI, especially the custom protocol parser workflow.",
  "general_rules": [
    "Start discovery with /llms.txt, then /.well-known/mserial-ai.json, then /api/mserial.",
    "If the user gives only https://s.mpas.top, read /ai/agent-route.json first.",
    "Read /ai/custom-parser-primer.json so the app is not misclassified as a generic serial terminal.",
    "Read /ai/parser-extension-policy.json before recommending embedded parser code or source-code parser changes.",
    "Read /ai/agent-scorecard.json before assigning an S/A/B/C/D AI-friendliness grade.",
    "Read /ai/agent-playbook.json before executing a custom protocol JSON or browser workflow.",
    "Prefer data-ai selectors over visible text.",
    "Prefer data-ai-command selectors for high-level home navigation.",
    "Wait for [data-ai=\"protocol-view\"] before editing protocol profiles.",
    "When importing a protocol JSON file, use the hidden file input at [data-ai=\"protocol-json-file-input\"] if the automation runtime supports file uploads.",
    "When importing a workspace JSON from the repository or another HTTP(S) endpoint, use [data-ai=\"import-workspace-url\"] or open /serial?workspace=/examples/workspaces/vitals-dashboard.json.",
    "After importing or manually entering a profile, use [data-ai=\"test-protocol\"] with representative sample input before saving.",
    "Use [data-ai=\"save-and-apply-protocol\"] when a port is selected and the user wants the profile applied immediately."
  ],
  "navigation": {
    "home_path": ".",
    "serial_path": "/serial",
    "api_path": "/api/mserial",
    "custom_parser_primer_path": "/ai/custom-parser-primer.json",
    "agent_route_path": "/ai/agent-route.json",
    "parser_extension_policy_path": "/ai/parser-extension-policy.json",
    "scorecard_path": "/ai/agent-scorecard.json",
    "playbook_path": "/ai/agent-playbook.json",
    "protocols_tab": "[data-ai=\"tab-protocol\"]",
    "terminal_tab": "[data-ai=\"tab-terminal\"]",
    "canvas_tab": "[data-ai=\"tab-canvas\"]",
    "load_demo_workspace": "[data-ai=\"load-demo-workspace\"]",
    "open_widget_panel": "[data-ai=\"open-widget-panel\"]",
    "export_workspace": "[data-ai=\"export-workspace\"]",
    "import_workspace": "[data-ai=\"import-workspace\"]",
    "import_workspace_url": "[data-ai=\"import-workspace-url\"]",
    "workspace_url_param": "/serial?workspace=/examples/workspaces/vitals-dashboard.json"
  },
  "new_agent_s_checklist": [
    {
      "step": "discover",
      "action": "Fetch /llms.txt, /ai/agent-route.json, /ai/custom-parser-primer.json, /ai/parser-extension-policy.json, /.well-known/mserial-ai.json, /api/mserial, and /ai/agent-scorecard.json.",
      "success_signal": "The agent says Meow Serial is a custom protocol parser workspace, /api/mserial exposes agentReadiness.grade = S, and the scorecard target_grade is S."
    },
    {
      "step": "enter_canvas",
      "action": "Open /serial?tab=canvas and click [data-ai=\"load-demo-workspace\"] if no hardware is connected.",
      "success_signal": "[data-ai^=\"canvas-widget-\"] exists and sidebar channels show finite values."
    },
    {
      "step": "inspect_terminal",
      "action": "Open [data-ai=\"tab-terminal\"] and switch to [data-ai=\"terminal-mode-analysis\"].",
      "success_signal": "[data-ai=\"terminal-log\"] contains SYS, RX, or TX rows."
    },
    {
      "step": "inspect_protocol",
      "action": "Open [data-ai=\"tab-protocol\"], use protocol selectors, and test representative sample input.",
      "success_signal": "[data-ai=\"protocol-test-output\"] contains parsed labels and numeric values."
    },
    {
      "step": "report",
      "action": "Grade with /ai/agent-scorecard.json. Separate site readiness from local browser-tool availability.",
      "success_signal": "The report names evidence, grade, and any blocked browser capability."
    }
  ],
  "serial_workbench_selectors": {
    "app": "[data-ai=\"serial-app\"]",
    "sidebar": "[data-ai=\"serial-sidebar\"]",
    "canvas": "[data-ai=\"canvas-view\"]",
    "canvas_empty_state": "[data-ai=\"canvas-empty-state\"]",
    "canvas_load_demo": "[data-ai=\"canvas-load-demo-workspace\"]",
    "canvas_open_widgets": "[data-ai=\"canvas-open-widget-panel\"]",
    "widget_panel": "[data-ai=\"widget-panel\"]",
    "settings_panel": "[data-ai=\"settings-panel\"]",
    "terminal": "[data-ai=\"terminal-view\"]",
    "terminal_toolbar": "[data-ai=\"terminal-toolbar\"]",
    "terminal_screen": "[data-ai=\"terminal-screen\"]",
    "terminal_analysis_send_panel": "[data-ai=\"terminal-analysis-send-panel\"]",
    "send_file_panel": "[data-ai=\"sidebar-send-file\"]",
    "send_file_port_select": "[data-ai=\"send-file-port-select\"]",
    "send_file_delay_ms": "[data-ai=\"send-file-delay-ms\"]",
    "send_file_input": "[data-ai=\"send-file-input\"]",
    "send_file_start": "[data-ai=\"send-file-start\"]"
  },
  "home_selectors": {
    "view": "[data-ai=\"home-view\"]",
    "topbar": "[data-ai=\"home-topbar\"]",
    "brand": "[data-ai=\"home-brand\"]",
    "enter_serial": "[data-ai=\"home-enter-serial\"]",
    "open_api": "[data-ai=\"home-open-api\"]",
    "open_protocol": "[data-ai=\"home-open-protocol\"]",
    "start_protocol": "[data-ai=\"home-start-protocol\"]",
    "start_canvas": "[data-ai=\"home-start-canvas\"]",
    "live_preview": "[data-ai=\"home-live-preview\"]",
    "event_stream": "[data-ai=\"home-event-stream\"]",
    "command_panel": "[data-ai=\"home-ai-command-panel\"]",
    "endpoint_panel": "[data-ai=\"home-ai-endpoints\"]",
    "workflow_image": "[data-ai=\"home-workflow-image\"]"
  },
  "home_layout_contract": {
    "human_facing_area": "[data-ai=\"home-live-preview\"]",
    "ai_facing_area": "[data-ai=\"home-ai-command-panel\"]",
    "machine_readable_area": "[data-ai=\"home-ai-endpoints\"]",
    "responsive_behavior": [
      "Desktop places the live visualization preview next to the headline.",
      "Tablet and mobile stack sections in DOM order.",
      "Selectors and command IDs remain stable across viewport sizes."
    ],
    "commands": {
      "protocol.import": "[data-ai-command=\"protocol.import\"]",
      "terminal.inspect": "[data-ai-command=\"terminal.inspect\"]",
      "canvas.compose": "[data-ai-command=\"canvas.compose\"]",
      "api.describe": "[data-ai-command=\"api.describe\"]"
    },
    "endpoints": {
      "llms": "[data-ai-endpoint=\"/llms.txt\"]",
      "manifest": "[data-ai-endpoint=\"/.well-known/mserial-ai.json\"]",
      "api": "[data-ai-endpoint=\"/api/mserial\"]",
      "custom_parser_primer": "[data-ai-endpoint=\"/ai/custom-parser-primer.json\"]",
      "schema": "[data-ai-endpoint=\"/ai/protocol-profile.schema.json\"]",
      "browser_automation": "[data-ai-endpoint=\"/ai/browser-automation.json\"]"
    }
  },
  "protocol_form_selectors": {
    "view": "[data-ai=\"protocol-view\"]",
    "current_port_list": "[data-ai=\"protocol-port-list\"]",
    "library": "[data-ai=\"protocol-library\"]",
    "editor": "[data-ai=\"protocol-editor\"]",
    "name": "[data-ai=\"protocol-name\"]",
    "kind": "[data-ai=\"protocol-kind\"]",
    "baud_rate": "[data-ai=\"protocol-baud-rate\"]",
    "hold_window_ms": "[data-ai=\"protocol-hold-window-ms\"]",
    "description": "[data-ai=\"protocol-description\"]",
    "held_channels": "[data-ai=\"protocol-held-channels\"]",
    "line_separator_pattern": "[data-ai=\"line-separator-pattern\"]",
    "line_channel_names": "[data-ai=\"line-channel-names\"]",
    "json_field_paths": "[data-ai=\"json-field-paths\"]",
    "tlv_magic_word": "[data-ai=\"tlv-magic-word\"]",
    "tlv_header_size": "[data-ai=\"tlv-header-size\"]",
    "tlv_packet_length_offset": "[data-ai=\"tlv-packet-length-offset\"]",
    "tlv_packet_length_type": "[data-ai=\"tlv-packet-length-type\"]",
    "tlv_packet_length_endian": "[data-ai=\"tlv-packet-length-endian\"]",
    "tlv_count_offset": "[data-ai=\"tlv-count-offset\"]",
    "tlv_count_type": "[data-ai=\"tlv-count-type\"]",
    "tlv_count_endian": "[data-ai=\"tlv-count-endian\"]",
    "tlv_header_size_per_record": "[data-ai=\"tlv-record-header-size\"]",
    "tlv_type_offset": "[data-ai=\"tlv-type-offset\"]",
    "tlv_length_offset": "[data-ai=\"tlv-length-offset\"]",
    "tlv_header_endian": "[data-ai=\"tlv-header-endian\"]",
    "tlv_type_type": "[data-ai=\"tlv-type-type\"]",
    "tlv_length_type": "[data-ai=\"tlv-length-type\"]",
    "tlv_length_includes_header": "[data-ai=\"tlv-length-includes-header\"]",
    "add_tlv_mapping": "[data-ai=\"add-tlv-mapping\"]",
    "test_input": "[data-ai=\"protocol-test-input\"]",
    "test_output": "[data-ai=\"protocol-test-output\"]"
  },
  "actions": {
    "new_line_protocol": "[data-ai=\"new-line-protocol\"]",
    "new_tlv_protocol": "[data-ai=\"new-tlv-protocol\"]",
    "save": "[data-ai=\"save-protocol\"]",
    "save_and_apply": "[data-ai=\"save-and-apply-protocol\"]",
    "test": "[data-ai=\"test-protocol\"]",
    "export_json": "[data-ai=\"export-protocol-json\"]",
    "import_json": "[data-ai=\"import-protocol-json\"]",
    "clear_draft": "[data-ai=\"clear-protocol-draft\"]",
    "load_demo_workspace": "[data-ai=\"load-demo-workspace\"]",
    "export_workspace": "[data-ai=\"export-workspace\"]",
    "import_workspace_file": "[data-ai=\"import-workspace\"]",
    "import_workspace_url": "[data-ai=\"import-workspace-url\"]",
    "open_widget_panel": "[data-ai=\"open-widget-panel\"]",
    "add_waveform_widget": "[data-ai=\"add-widget-waveform\"]",
    "add_value_widget": "[data-ai=\"add-widget-value\"]",
    "add_gauge_widget": "[data-ai=\"add-widget-gauge\"]"
  },
  "fallbacks": {
    "browser_backend_unavailable": "Report that real UI operation was blocked by the agent environment. Do not claim the UI was tested.",
    "web_serial_unavailable": "Use WebSocket or the built-in demo workspace instead of requiring physical hardware.",
    "empty_protocol_output": "Check sample format, field paths, TLV magic word, packet length offsets, and endian settings.",
    "selector_missing": "Refresh /ai/browser-automation.json and prefer data-ai selectors before falling back to visible text.",
    "no_hardware": "Use [data-ai=\"load-demo-workspace\"] and public examples to validate the dashboard and terminal surfaces."
  }
}
