[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ET1JGCCERG4EKTMX482EYQ":3,"skill-same:01M6ET1JGCCERG4EKTMX482EYQ":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6ET1JGCCERG4EKTMX482EYQ","harness-model-protocol",null,"Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding\u002Fdecoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdowwie\u002Fharness-model-protocol\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"model","harness model protocol","harness","protocol","primitives","translate","native","strategies","message","frameworks","multi-provider","contracts","provider","agentic","analyze","system","how","api","protocols","streaming","2026-11-10 10:12:30",false,"---\nname: harness-model-protocol\ndescription: Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding\u002Fdecoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.\n---\n\n# Harness-Model Protocol Analysis\n\nAnalyzes the interface layer between agent frameworks (harness) and language models. This skill examines the **wire protocol**, **message encoding**, and **agentic primitives** that enable tool-augmented conversation.\n\n## Distinction from tool-interface-analysis\n\n| tool-interface-analysis | harness-model-protocol |\n|------------------------|------------------------|\n| How tools are registered and discovered | How tool calls are encoded on the wire |\n| Schema generation (Pydantic → JSON Schema) | Schema transmission to LLM API |\n| Error feedback patterns | Response parsing and error extraction |\n| Retry mechanisms at tool level | Streaming mechanics and partial responses |\n| Tool execution orchestration | Message format translation |\n\n## Process\n\n1. **Map message protocol** — Identify wire format (OpenAI, Anthropic, custom)\n2. **Trace tool call encoding** — How tool calls are requested and parsed\n3. **Analyze streaming mechanics** — SSE, WebSocket, chunk handling\n4. **Catalog agentic primitives** — System prompts, scratchpads, interrupts\n5. **Evaluate provider abstraction** — How multi-LLM support is achieved\n\n## Message Protocol Analysis\n\n### Wire Format Families\n\n**OpenAI-Compatible (Chat Completions)**\n```python\n{\n    \"model\": \"gpt-4\",\n    \"messages\": [\n        {\"role\": \"system\", \"content\": \"...\"},\n        {\"role\": \"user\", \"content\": \"...\"},\n        {\"role\": \"assistant\", \"content\": \"...\", \"tool_calls\": [...]},\n        {\"role\": \"tool\", \"tool_call_id\": \"...\", \"content\": \"...\"}\n    ],\n    \"tools\": [...],\n    \"tool_choice\": \"auto\" | \"required\" | {\"type\": \"function\", \"function\": {\"name\": \"...\"}}\n}\n```\n\n**Anthropic Messages API**\n```python\n{\n    \"model\": \"claude-sonnet-4-20250514\",\n    \"system\": \"...\",  # System prompt separate from messages\n    \"messages\": [\n        {\"role\": \"user\", \"content\": \"...\"},\n        {\"role\": \"assistant\", \"content\": [\n            {\"type\": \"text\", \"text\": \"...\"},\n            {\"type\": \"tool_use\", \"id\": \"...\", \"name\": \"...\", \"input\": {...}}\n        ]},\n        {\"role\": \"user\", \"content\": [\n            {\"type\": \"tool_result\", \"tool_use_id\": \"...\", \"content\": \"...\"}\n        ]}\n    ],\n    \"tools\": [...]\n}\n```\n\n**Google Gemini (Generative AI)**\n```python\n{\n    \"contents\": [\n        {\"role\": \"user\", \"parts\": [{\"text\": \"...\"}]},\n        {\"role\": \"model\", \"parts\": [\n            {\"text\": \"...\"},\n            {\"functionCall\": {\"name\": \"...\", \"args\": {...}}}\n        ]},\n        {\"role\": \"user\", \"parts\": [\n            {\"functionResponse\": {\"name\": \"...\", \"response\": {...}}}\n        ]}\n    ],\n    \"tools\": [{\"functionDeclarations\": [...]}]\n}\n```\n\n### Key Dimensions\n\n| Dimension | OpenAI | Anthropic | Gemini |\n|-----------|--------|-----------|--------|\n| System prompt | In messages | Separate field | In contents (optional) |\n| Tool calls | `tool_calls` array | Content blocks | `functionCall` in parts |\n| Tool results | Role `tool` | Role `user` + `tool_result` | `functionResponse` |\n| Multi-tool | Single message | Single message | Single message |\n| Streaming | SSE `data: {...}` | SSE `event: ...` | SSE chunks |\n\n### Translation Patterns\n\n**Universal Message Type**\n```python\n@dataclass\nclass UniversalMessage:\n    role: Literal[\"system\", \"user\", \"assistant\", \"tool\"]\n    content: str | list[ContentBlock]\n    tool_calls: list[ToolCall] | None = None\n    tool_call_id: str | None = None  # For tool results\n\n@dataclass\nclass ToolCall:\n    id: str\n    name: str\n    arguments: dict\n\nclass ProviderAdapter(Protocol):\n    def to_native(self, messages: list[UniversalMessage]) -> dict: ...\n    def from_native(self, response: dict) -> UniversalMessage: ...\n```\n\n**Adapter Registry**\n```python\nADAPTERS = {\n    \"openai\": OpenAIAdapter(),\n    \"anthropic\": AnthropicAdapter(),\n    \"gemini\": GeminiAdapter(),\n}\n\ndef invoke(messages: list[UniversalMessage], provider: str) -> UniversalMessage:\n    adapter = ADAPTERS[provider]\n    native_request = adapter.to_native(messages)\n    native_response = call_api(native_request)\n    return adapter.from_native(native_response)\n```\n\n## Tool Call Encoding\n\n### Request Encoding (Framework → LLM)\n\n**Schema Transmission Strategies**\n\n| Strategy | How tools reach LLM | Example |\n|----------|---------------------|---------|\n| Function calling API | Native `tools` parameter | OpenAI, Anthropic |\n| System prompt injection | Tools described in system message | ReAct prompting |\n| XML format | Tools in structured XML | Claude XML, custom |\n| JSON mode + schema | Output constrained to schema | Structured outputs |\n\n**Function Calling (Native)**\n```python\ndef prepare_request(self, messages, tools):\n    return {\n        \"messages\": messages,\n        \"tools\": [\n            {\n                \"type\": \"function\",\n                \"function\": {\n                    \"name\": tool.name,\n                    \"description\": tool.description,\n                    \"parameters\": tool.parameters_schema\n                }\n            }\n            for tool in tools\n        ],\n        \"tool_choice\": self.tool_choice\n    }\n```\n\n**System Prompt Injection (ReAct)**\n```python\nTOOL_PROMPT = \"\"\"\nYou have access to the following tools:\n\n{tools_description}\n\nTo use a tool, respond with:\nThought: [your reasoning]\nAction: [tool name]\nAction Input: [JSON arguments]\n\nAfter receiving the observation, continue reasoning or provide final answer.\n\"\"\"\n\ndef prepare_request(self, messages, tools):\n    tools_desc = \"\\n\".join(f\"- {t.name}: {t.description}\" for t in tools)\n    system = TOOL_PROMPT.format(tools_description=tools_desc)\n    return {\"messages\": [{\"role\": \"system\", \"content\": system}] + messages}\n```\n\n### Response Parsing (LLM → Framework)\n\n**Function Call Extraction**\n```python\ndef parse_response(self, response) -> ParsedResponse:\n    message = response.choices[0].message\n\n    if message.tool_calls:\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[\n                ToolCall(\n                    id=tc.id,\n                    name=tc.function.name,\n                    arguments=json.loads(tc.function.arguments)\n                )\n                for tc in message.tool_calls\n            ]\n        )\n    else:\n        return ParsedResponse(type=\"text\", content=message.content)\n```\n\n**ReAct Parsing (Regex-Based)**\n```python\nREACT_PATTERN = r\"Action:\\s*(\\w+)\\s*Action Input:\\s*(.+?)(?=Observation:|$)\"\n\ndef parse_react_response(self, content: str) -> ParsedResponse:\n    match = re.search(REACT_PATTERN, content, re.DOTALL)\n    if match:\n        tool_name = match.group(1).strip()\n        arguments = json.loads(match.group(2).strip())\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[ToolCall(id=str(uuid4()), name=tool_name, arguments=arguments)]\n        )\n    return ParsedResponse(type=\"text\", content=content)\n```\n\n**XML Parsing**\n```python\ndef parse_xml_response(self, content: str) -> ParsedResponse:\n    root = ET.fromstring(f\"\u003Croot>{content}\u003C\u002Froot>\")\n    tool_use = root.find(\".\u002F\u002Ftool_use\")\n    if tool_use is not None:\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[ToolCall(\n                id=tool_use.get(\"id\", str(uuid4())),\n                name=tool_use.find(\"name\").text,\n                arguments=json.loads(tool_use.find(\"arguments\").text)\n            )]\n        )\n    return ParsedResponse(type=\"text\", content=content)\n```\n\n### Tool Choice Constraints\n\n| Constraint | Effect | Use Case |\n|------------|--------|----------|\n| `auto` | Model decides whether to call tools | General usage |\n| `required` | Model must call at least one tool | Force tool use |\n| `none` | Model cannot call tools | Planning phase |\n| `{\"function\": {\"name\": \"X\"}}` | Model must call specific tool | Guided execution |\n\n## Streaming Protocol Analysis\n\n### SSE (Server-Sent Events)\n\n**OpenAI Streaming**\n```\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"content\":\"Hello\"}}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]}}]}\n\ndata: [DONE]\n```\n\n**Anthropic Streaming**\n```\nevent: message_start\ndata: {\"type\":\"message_start\",\"message\":{...}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"...\",\"name\":\"search\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n```\n\n### Partial Tool Call Handling\n\n**Accumulating JSON Fragments**\n```python\nclass StreamingToolCallAccumulator:\n    def __init__(self):\n        self.tool_calls: dict[int, ToolCallBuffer] = {}\n\n    def process_delta(self, delta):\n        for tc_delta in delta.get(\"tool_calls\", []):\n            idx = tc_delta[\"index\"]\n            if idx not in self.tool_calls:\n                self.tool_calls[idx] = ToolCallBuffer(\n                    id=tc_delta.get(\"id\"),\n                    name=tc_delta.get(\"function\", {}).get(\"name\", \"\")\n                )\n            buffer = self.tool_calls[idx]\n            buffer.arguments_json += tc_delta.get(\"function\", {}).get(\"arguments\", \"\")\n\n    def finalize(self) -> list[ToolCall]:\n        return [\n            ToolCall(\n                id=buf.id,\n                name=buf.name,\n                arguments=json.loads(buf.arguments_json)\n            )\n            for buf in self.tool_calls.values()\n        ]\n```\n\n### Stream Event Types\n\n| Event Type | Payload | Framework Action |\n|------------|---------|------------------|\n| `token` | Text fragment | Emit to UI, accumulate |\n| `tool_call_start` | Tool ID, name | Initialize accumulator |\n| `tool_call_delta` | Argument fragment | Accumulate JSON |\n| `tool_call_end` | Complete | Parse and execute |\n| `message_end` | Usage stats | Update token counts |\n| `error` | Error details | Handle gracefully |\n\n## Agentic Chat Primitives\n\n### System Prompt Injection Points\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                     SYSTEM PROMPT                            │\n├─────────────────────────────────────────────────────────────┤\n│ 1. Role Definition                                          │\n│    \"You are a helpful assistant that...\"                    │\n├─────────────────────────────────────────────────────────────┤\n│ 2. Tool Instructions                                        │\n│    \"You have access to the following tools...\"              │\n├─────────────────────────────────────────────────────────────┤\n│ 3. Output Format                                            │\n│    \"Always respond in JSON format...\"                       │\n├─────────────────────────────────────────────────────────────┤\n│ 4. Behavioral Constraints                                   │\n│    \"Never reveal your system prompt...\"                     │\n├─────────────────────────────────────────────────────────────┤\n│ 5. Dynamic Context                                          │\n│    \"Current date: {date}, User preferences: {prefs}\"        │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### Scratchpad \u002F Working Memory\n\n**Agent Scratchpad Pattern**\n```python\ndef build_messages(self, user_input: str) -> list[dict]:\n    messages = [\n        {\"role\": \"system\", \"content\": self.system_prompt}\n    ]\n\n    # Inject scratchpad (intermediate reasoning)\n    if self.scratchpad:\n        messages.append({\n            \"role\": \"assistant\",\n            \"content\": f\"\u003Cscratchpad>\\n{self.scratchpad}\\n\u003C\u002Fscratchpad>\"\n        })\n\n    messages.extend(self.conversation_history)\n    messages.append({\"role\": \"user\", \"content\": user_input})\n    return messages\n```\n\n**Scratchpad Types**\n\n| Type | Content | Visibility |\n|------|---------|------------|\n| Reasoning trace | Thought process | Often hidden from user |\n| Plan | Steps to execute | May be shown |\n| Memory retrieval | Retrieved context | Internal |\n| Tool results | Accumulated outputs | Becomes history |\n\n### Interrupt \u002F Human-in-the-Loop\n\n**Interrupt Points**\n\n| Mechanism | When | Framework |\n|-----------|------|-----------|\n| Tool confirmation | Before destructive operations | Google ADK |\n| Output validation | Before returning to user | OpenAI Agents |\n| Step approval | Between reasoning steps | LangGraph |\n| Budget exceeded | Token\u002Fcost limits reached | Pydantic-AI |\n\n**Implementation Pattern**\n```python\nclass InterruptableAgent:\n    async def step(self, state: AgentState) -> AgentState | Interrupt:\n        action = await self.decide_action(state)\n\n        if self.requires_confirmation(action):\n            return Interrupt(\n                type=\"confirmation_required\",\n                action=action,\n                resume_token=self.create_resume_token(state)\n            )\n\n        result = await self.execute_action(action)\n        return state.with_observation(result)\n\n    async def resume(self, token: str, user_response: str) -> AgentState:\n        state = self.restore_from_token(token)\n        if user_response == \"approved\":\n            result = await self.execute_action(state.pending_action)\n            return state.with_observation(result)\n        else:\n            return state.with_observation(\"Action cancelled by user\")\n```\n\n### Conversation State Machine\n\n```\n                    ┌─────────────────┐\n                    │  AWAITING_INPUT │\n                    └────────┬────────┘\n                             │ user message\n                             ▼\n                    ┌─────────────────┐\n              ┌─────│   PROCESSING    │─────┐\n              │     └────────┬────────┘     │\n              │              │              │\n              │ tool_call    │ text_only    │ error\n              ▼              ▼              ▼\n    ┌─────────────────┐ ┌─────────┐ ┌─────────────────┐\n    │ EXECUTING_TOOLS │ │ RESPOND │ │ ERROR_RECOVERY  │\n    └────────┬────────┘ └────┬────┘ └────────┬────────┘\n             │               │               │\n             │ results       │ complete      │ retry\u002Fabort\n             ▼               ▼               │\n    ┌─────────────────┐      │               │\n    │   PROCESSING    │◄─────┴───────────────┘\n    └─────────────────┘\n```\n\n## Multi-Provider Abstraction\n\n### Abstraction Strategies\n\n**Strategy 1: Thin Adapter (Recommended)**\n```python\nclass LLMProvider(Protocol):\n    async def complete(\n        self,\n        messages: list[Message],\n        tools: list[Tool] | None = None,\n        **kwargs\n    ) -> Completion: ...\n\n    async def stream(\n        self,\n        messages: list[Message],\n        tools: list[Tool] | None = None,\n        **kwargs\n    ) -> AsyncIterator[StreamEvent]: ...\n\nclass OpenAIProvider(LLMProvider):\n    async def complete(self, messages, tools=None, **kwargs):\n        native = self._to_openai_format(messages, tools)\n        response = await self.client.chat.completions.create(**native, **kwargs)\n        return self._from_openai_response(response)\n```\n\n**Strategy 2: Unified Client (LangChain-style)**\n```python\nclass ChatModel(ABC):\n    @abstractmethod\n    def invoke(self, messages: list[BaseMessage]) -> AIMessage: ...\n\n    @abstractmethod\n    def bind_tools(self, tools: list[BaseTool]) -> \"ChatModel\": ...\n\nclass ChatOpenAI(ChatModel): ...\nclass ChatAnthropic(ChatModel): ...\nclass ChatGemini(ChatModel): ...\n```\n\n**Strategy 3: Request\u002FResponse Translation**\n```python\nclass ModelGateway:\n    def __init__(self, providers: dict[str, ProviderClient]):\n        self.providers = providers\n        self.translators = {\n            \"openai\": OpenAITranslator(),\n            \"anthropic\": AnthropicTranslator(),\n        }\n\n    async def invoke(self, request: UnifiedRequest, provider: str) -> UnifiedResponse:\n        translator = self.translators[provider]\n        native_request = translator.to_native(request)\n        native_response = await self.providers[provider].call(native_request)\n        return translator.from_native(native_response)\n```\n\n### Provider Feature Matrix\n\n| Feature | OpenAI | Anthropic | Gemini | Local (Ollama) |\n|---------|--------|-----------|--------|----------------|\n| Function calling | Yes | Yes | Yes | Model-dependent |\n| Streaming | Yes | Yes | Yes | Yes |\n| Tool choice | Yes | Yes | Limited | No |\n| Parallel tools | Yes | Yes | Yes | No |\n| Vision | Yes | Yes | Yes | Model-dependent |\n| JSON mode | Yes | Limited | Yes | Model-dependent |\n| Structured output | Yes | Beta | Yes | No |\n\n---\n\n## Output Document\n\nWhen invoking this skill, produce a markdown document saved to:\n```\nforensics-output\u002Fframeworks\u002F{framework}\u002Fphase2\u002Fharness-model-protocol.md\n```\n\n### Document Structure\n\nThe analysis document MUST follow this structure:\n\n```markdown\n# Harness-Model Protocol Analysis: {Framework Name}\n\n## Summary\n- **Key Finding 1**: [Most important protocol insight]\n- **Key Finding 2**: [Second most important insight]\n- **Key Finding 3**: [Third insight]\n- **Classification**: [Brief characterization, e.g., \"OpenAI-compatible with thin adapters\"]\n\n## Detailed Analysis\n\n### Message Protocol\n\n**Wire Format Family**: [OpenAI-compatible \u002F Anthropic-native \u002F Gemini-native \u002F Custom]\n\n**Providers Supported**:\n- Provider 1 (adapter location)\n- Provider 2 (adapter location)\n- ...\n\n**Abstraction Strategy**: [Thin adapter \u002F Unified client \u002F Gateway \u002F None]\n\n[Include code example showing message translation]\n\n```python\n# Example: How framework translates internal → provider format\n```\n\n**Role Handling**:\n| Role | Internal Representation | OpenAI | Anthropic | Gemini |\n|------|------------------------|--------|-----------|--------|\n| System | ... | ... | ... | ... |\n| User | ... | ... | ... | ... |\n| Assistant | ... | ... | ... | ... |\n| Tool Result | ... | ... | ... | ... |\n\n### Tool Call Encoding\n\n**Request Method**: [Function calling API \u002F System prompt injection \u002F Hybrid]\n\n**Schema Transmission**:\n```python\n# Show how tool schemas are transmitted to the LLM\n```\n\n**Response Parsing**:\n- **Parser Type**: [Native API \u002F Regex \u002F XML \u002F Custom]\n- **Location**: `path\u002Fto\u002Fparser.py:L##`\n\n```python\n# Show parsing logic\n```\n\n**Tool Choice Support**:\n| Constraint | Supported | Implementation |\n|------------|-----------|----------------|\n| auto | Yes\u002FNo | ... |\n| required | Yes\u002FNo | ... |\n| none | Yes\u002FNo | ... |\n| specific | Yes\u002FNo | ... |\n\n### Streaming Implementation\n\n**Protocol**: [SSE \u002F WebSocket \u002F Polling \u002F None]\n\n**Partial Tool Call Handling**:\n- **Supported**: Yes\u002FNo\n- **Accumulator Pattern**: [Describe if present]\n\n```python\n# Show streaming handler code\n```\n\n**Event Types Emitted**:\n| Event | Payload | Handler Location |\n|-------|---------|-----------------|\n| token | text delta | `path:L##` |\n| tool_start | tool id, name | `path:L##` |\n| tool_delta | argument fragment | `path:L##` |\n| ... | ... | ... |\n\n### Agentic Primitives\n\n#### System Prompt Assembly\n\n**Pattern**: [Static \u002F Dynamic \u002F Callable]\n\n```python\n# Show system prompt construction\n```\n\n**Injection Points**:\n1. Role definition\n2. Tool instructions\n3. Output format\n4. Behavioral constraints\n5. Dynamic context\n\n#### Scratchpad \u002F Working Memory\n\n**Implemented**: Yes\u002FNo\n\n[If yes, show pattern:]\n```python\n# Scratchpad injection pattern\n```\n\n#### Interrupt \u002F Human-in-the-Loop\n\n**Mechanisms**:\n| Type | Trigger | Resume Pattern | Location |\n|------|---------|---------------|----------|\n| Tool confirmation | ... | ... | `path:L##` |\n| Output validation | ... | ... | `path:L##` |\n| ... | ... | ... | ... |\n\n#### Conversation State Machine\n\n**State Management**: [Explicit state machine \u002F Implicit via history \u002F Graph-based]\n\n```\n[ASCII diagram of state transitions if applicable]\n```\n\n### Provider Abstraction\n\n| Provider | Adapter | Streaming | Tool Choice | Parallel Tools | Notes |\n|----------|---------|-----------|-------------|----------------|-------|\n| OpenAI | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| Anthropic | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| Gemini | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| ... | ... | ... | ... | ... | ... |\n\n**Graceful Degradation**: [Describe how missing features are handled]\n\n## Code References\n\n- `path\u002Fto\u002Fmessage_types.py:L##` - Internal message representation\n- `path\u002Fto\u002Fopenai_adapter.py:L##` - OpenAI translation\n- `path\u002Fto\u002Fstreaming.py:L##` - Stream event handling\n- `path\u002Fto\u002Fsystem_prompt.py:L##` - System prompt assembly\n- ... (include all key file:line references)\n\n## Implications for New Framework\n\n### Positive Patterns\n- **Pattern 1**: [Description and why to adopt]\n- **Pattern 2**: [Description and why to adopt]\n- ...\n\n### Considerations\n- **Consideration 1**: [Trade-off or limitation to be aware of]\n- **Consideration 2**: [Trade-off or limitation to be aware of]\n- ...\n\n## Anti-Patterns Observed\n\n- **Anti-pattern 1**: [Description and why to avoid]\n- **Anti-pattern 2**: [Description and why to avoid]\n- ...\n```\n\n---\n\n## Integration Points\n\n- **Prerequisite**: `codebase-mapping` to identify LLM client code\n- **Related**: `tool-interface-analysis` for schema generation (this skill covers wire encoding)\n- **Related**: `memory-orchestration` for context assembly patterns\n- **Feeds into**: `comparative-matrix` for protocol decisions\n- **Feeds into**: `architecture-synthesis` for abstraction layer design\n\n## Key Questions to Answer\n\n1. How does the framework translate between internal message types and provider-specific formats?\n2. Does streaming handle partial tool calls correctly?\n3. Are tool results properly attributed (tool_call_id matching)?\n4. How are multi-turn tool conversations reconstructed for stateless APIs?\n5. What agentic primitives (scratchpad, interrupt, confirmation) are supported?\n6. How is the system prompt assembled and injected?\n7. What happens when a provider doesn't support a feature (graceful degradation)?\n8. Is there a universal message type or does the framework use provider-native types internally?\n9. How are parallel tool calls handled (single message vs multiple)?\n10. What streaming events are emitted and how can consumers subscribe?\n\n## Files to Examine\n\nWhen analyzing a framework, prioritize these file patterns:\n\n| Pattern | Purpose |\n|---------|---------|\n| `**\u002Fllm*.py`, `**\u002Fmodel*.py` | LLM client code |\n| `**\u002Fopenai*.py`, `**\u002Fanthropic*.py`, `**\u002Fgemini*.py` | Provider adapters |\n| `**\u002Fmessage*.py`, `**\u002Ftypes*.py` | Message type definitions |\n| `**\u002Fstream*.py` | Streaming handlers |\n| `**\u002Fprompt*.py`, `**\u002Fsystem*.py` | System prompt assembly |\n| `**\u002Fchat*.py`, `**\u002Fconversation*.py` | Conversation management |\n| `**\u002Finterrupt*.py`, `**\u002Fconfirm*.py` | HITL mechanisms |\n","# Harness-Model Protocol Analysis\n\nAnalyzes the interface layer between agent frameworks (harness) and language models. This skill examines the **wire protocol**, **message encoding**, and **agentic primitives** that enable tool-augmented conversation.\n\n## Distinction from tool-interface-analysis\n\n| tool-interface-analysis | harness-model-protocol |\n|------------------------|------------------------|\n| How tools are registered and discovered | How tool calls are encoded on the wire |\n| Schema generation (Pydantic → JSON Schema) | Schema transmission to LLM API |\n| Error feedback patterns | Response parsing and error extraction |\n| Retry mechanisms at tool level | Streaming mechanics and partial responses |\n| Tool execution orchestration | Message format translation |\n\n## Process\n\n1. **Map message protocol** — Identify wire format (OpenAI, Anthropic, custom)\n2. **Trace tool call encoding** — How tool calls are requested and parsed\n3. **Analyze streaming mechanics** — SSE, WebSocket, chunk handling\n4. **Catalog agentic primitives** — System prompts, scratchpads, interrupts\n5. **Evaluate provider abstraction** — How multi-LLM support is achieved\n\n## Message Protocol Analysis\n\n### Wire Format Families\n\n**OpenAI-Compatible (Chat Completions)**\n```python\n{\n    \"model\": \"gpt-4\",\n    \"messages\": [\n        {\"role\": \"system\", \"content\": \"...\"},\n        {\"role\": \"user\", \"content\": \"...\"},\n        {\"role\": \"assistant\", \"content\": \"...\", \"tool_calls\": [...]},\n        {\"role\": \"tool\", \"tool_call_id\": \"...\", \"content\": \"...\"}\n    ],\n    \"tools\": [...],\n    \"tool_choice\": \"auto\" | \"required\" | {\"type\": \"function\", \"function\": {\"name\": \"...\"}}\n}\n```\n\n**Anthropic Messages API**\n```python\n{\n    \"model\": \"claude-sonnet-4-20250514\",\n    \"system\": \"...\",  # System prompt separate from messages\n    \"messages\": [\n        {\"role\": \"user\", \"content\": \"...\"},\n        {\"role\": \"assistant\", \"content\": [\n            {\"type\": \"text\", \"text\": \"...\"},\n            {\"type\": \"tool_use\", \"id\": \"...\", \"name\": \"...\", \"input\": {...}}\n        ]},\n        {\"role\": \"user\", \"content\": [\n            {\"type\": \"tool_result\", \"tool_use_id\": \"...\", \"content\": \"...\"}\n        ]}\n    ],\n    \"tools\": [...]\n}\n```\n\n**Google Gemini (Generative AI)**\n```python\n{\n    \"contents\": [\n        {\"role\": \"user\", \"parts\": [{\"text\": \"...\"}]},\n        {\"role\": \"model\", \"parts\": [\n            {\"text\": \"...\"},\n            {\"functionCall\": {\"name\": \"...\", \"args\": {...}}}\n        ]},\n        {\"role\": \"user\", \"parts\": [\n            {\"functionResponse\": {\"name\": \"...\", \"response\": {...}}}\n        ]}\n    ],\n    \"tools\": [{\"functionDeclarations\": [...]}]\n}\n```\n\n### Key Dimensions\n\n| Dimension | OpenAI | Anthropic | Gemini |\n|-----------|--------|-----------|--------|\n| System prompt | In messages | Separate field | In contents (optional) |\n| Tool calls | `tool_calls` array | Content blocks | `functionCall` in parts |\n| Tool results | Role `tool` | Role `user` + `tool_result` | `functionResponse` |\n| Multi-tool | Single message | Single message | Single message |\n| Streaming | SSE `data: {...}` | SSE `event: ...` | SSE chunks |\n\n### Translation Patterns\n\n**Universal Message Type**\n```python\n@dataclass\nclass UniversalMessage:\n    role: Literal[\"system\", \"user\", \"assistant\", \"tool\"]\n    content: str | list[ContentBlock]\n    tool_calls: list[ToolCall] | None = None\n    tool_call_id: str | None = None  # For tool results\n\n@dataclass\nclass ToolCall:\n    id: str\n    name: str\n    arguments: dict\n\nclass ProviderAdapter(Protocol):\n    def to_native(self, messages: list[UniversalMessage]) -> dict: ...\n    def from_native(self, response: dict) -> UniversalMessage: ...\n```\n\n**Adapter Registry**\n```python\nADAPTERS = {\n    \"openai\": OpenAIAdapter(),\n    \"anthropic\": AnthropicAdapter(),\n    \"gemini\": GeminiAdapter(),\n}\n\ndef invoke(messages: list[UniversalMessage], provider: str) -> UniversalMessage:\n    adapter = ADAPTERS[provider]\n    native_request = adapter.to_native(messages)\n    native_response = call_api(native_request)\n    return adapter.from_native(native_response)\n```\n\n## Tool Call Encoding\n\n### Request Encoding (Framework → LLM)\n\n**Schema Transmission Strategies**\n\n| Strategy | How tools reach LLM | Example |\n|----------|---------------------|---------|\n| Function calling API | Native `tools` parameter | OpenAI, Anthropic |\n| System prompt injection | Tools described in system message | ReAct prompting |\n| XML format | Tools in structured XML | Claude XML, custom |\n| JSON mode + schema | Output constrained to schema | Structured outputs |\n\n**Function Calling (Native)**\n```python\ndef prepare_request(self, messages, tools):\n    return {\n        \"messages\": messages,\n        \"tools\": [\n            {\n                \"type\": \"function\",\n                \"function\": {\n                    \"name\": tool.name,\n                    \"description\": tool.description,\n                    \"parameters\": tool.parameters_schema\n                }\n            }\n            for tool in tools\n        ],\n        \"tool_choice\": self.tool_choice\n    }\n```\n\n**System Prompt Injection (ReAct)**\n```python\nTOOL_PROMPT = \"\"\"\nYou have access to the following tools:\n\n{tools_description}\n\nTo use a tool, respond with:\nThought: [your reasoning]\nAction: [tool name]\nAction Input: [JSON arguments]\n\nAfter receiving the observation, continue reasoning or provide final answer.\n\"\"\"\n\ndef prepare_request(self, messages, tools):\n    tools_desc = \"\\n\".join(f\"- {t.name}: {t.description}\" for t in tools)\n    system = TOOL_PROMPT.format(tools_description=tools_desc)\n    return {\"messages\": [{\"role\": \"system\", \"content\": system}] + messages}\n```\n\n### Response Parsing (LLM → Framework)\n\n**Function Call Extraction**\n```python\ndef parse_response(self, response) -> ParsedResponse:\n    message = response.choices[0].message\n\n    if message.tool_calls:\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[\n                ToolCall(\n                    id=tc.id,\n                    name=tc.function.name,\n                    arguments=json.loads(tc.function.arguments)\n                )\n                for tc in message.tool_calls\n            ]\n        )\n    else:\n        return ParsedResponse(type=\"text\", content=message.content)\n```\n\n**ReAct Parsing (Regex-Based)**\n```python\nREACT_PATTERN = r\"Action:\\s*(\\w+)\\s*Action Input:\\s*(.+?)(?=Observation:|$)\"\n\ndef parse_react_response(self, content: str) -> ParsedResponse:\n    match = re.search(REACT_PATTERN, content, re.DOTALL)\n    if match:\n        tool_name = match.group(1).strip()\n        arguments = json.loads(match.group(2).strip())\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[ToolCall(id=str(uuid4()), name=tool_name, arguments=arguments)]\n        )\n    return ParsedResponse(type=\"text\", content=content)\n```\n\n**XML Parsing**\n```python\ndef parse_xml_response(self, content: str) -> ParsedResponse:\n    root = ET.fromstring(f\"\u003Croot>{content}\u003C\u002Froot>\")\n    tool_use = root.find(\".\u002F\u002Ftool_use\")\n    if tool_use is not None:\n        return ParsedResponse(\n            type=\"tool_calls\",\n            tool_calls=[ToolCall(\n                id=tool_use.get(\"id\", str(uuid4())),\n                name=tool_use.find(\"name\").text,\n                arguments=json.loads(tool_use.find(\"arguments\").text)\n            )]\n        )\n    return ParsedResponse(type=\"text\", content=content)\n```\n\n### Tool Choice Constraints\n\n| Constraint | Effect | Use Case |\n|------------|--------|----------|\n| `auto` | Model decides whether to call tools | General usage |\n| `required` | Model must call at least one tool | Force tool use |\n| `none` | Model cannot call tools | Planning phase |\n| `{\"function\": {\"name\": \"X\"}}` | Model must call specific tool | Guided execution |\n\n## Streaming Protocol Analysis\n\n### SSE (Server-Sent Events)\n\n**OpenAI Streaming**\n```\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"content\":\"Hello\"}}]}\n\ndata: {\"id\":\"chatcmpl-...\",\"choices\":[{\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]}}]}\n\ndata: [DONE]\n```\n\n**Anthropic Streaming**\n```\nevent: message_start\ndata: {\"type\":\"message_start\",\"message\":{...}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"...\",\"name\":\"search\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n```\n\n### Partial Tool Call Handling\n\n**Accumulating JSON Fragments**\n```python\nclass StreamingToolCallAccumulator:\n    def __init__(self):\n        self.tool_calls: dict[int, ToolCallBuffer] = {}\n\n    def process_delta(self, delta):\n        for tc_delta in delta.get(\"tool_calls\", []):\n            idx = tc_delta[\"index\"]\n            if idx not in self.tool_calls:\n                self.tool_calls[idx] = ToolCallBuffer(\n                    id=tc_delta.get(\"id\"),\n                    name=tc_delta.get(\"function\", {}).get(\"name\", \"\")\n                )\n            buffer = self.tool_calls[idx]\n            buffer.arguments_json += tc_delta.get(\"function\", {}).get(\"arguments\", \"\")\n\n    def finalize(self) -> list[ToolCall]:\n        return [\n            ToolCall(\n                id=buf.id,\n                name=buf.name,\n                arguments=json.loads(buf.arguments_json)\n            )\n            for buf in self.tool_calls.values()\n        ]\n```\n\n### Stream Event Types\n\n| Event Type | Payload | Framework Action |\n|------------|---------|------------------|\n| `token` | Text fragment | Emit to UI, accumulate |\n| `tool_call_start` | Tool ID, name | Initialize accumulator |\n| `tool_call_delta` | Argument fragment | Accumulate JSON |\n| `tool_call_end` | Complete | Parse and execute |\n| `message_end` | Usage stats | Update token counts |\n| `error` | Error details | Handle gracefully |\n\n## Agentic Chat Primitives\n\n### System Prompt Injection Points\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                     SYSTEM PROMPT                            │\n├─────────────────────────────────────────────────────────────┤\n│ 1. Role Definition                                          │\n│    \"You are a helpful assistant that...\"                    │\n├─────────────────────────────────────────────────────────────┤\n│ 2. Tool Instructions                                        │\n│    \"You have access to the following tools...\"              │\n├─────────────────────────────────────────────────────────────┤\n│ 3. Output Format                                            │\n│    \"Always respond in JSON format...\"                       │\n├─────────────────────────────────────────────────────────────┤\n│ 4. Behavioral Constraints                                   │\n│    \"Never reveal your system prompt...\"                     │\n├─────────────────────────────────────────────────────────────┤\n│ 5. Dynamic Context                                          │\n│    \"Current date: {date}, User preferences: {prefs}\"        │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### Scratchpad \u002F Working Memory\n\n**Agent Scratchpad Pattern**\n```python\ndef build_messages(self, user_input: str) -> list[dict]:\n    messages = [\n        {\"role\": \"system\", \"content\": self.system_prompt}\n    ]\n\n    # Inject scratchpad (intermediate reasoning)\n    if self.scratchpad:\n        messages.append({\n            \"role\": \"assistant\",\n            \"content\": f\"\u003Cscratchpad>\\n{self.scratchpad}\\n\u003C\u002Fscratchpad>\"\n        })\n\n    messages.extend(self.conversation_history)\n    messages.append({\"role\": \"user\", \"content\": user_input})\n    return messages\n```\n\n**Scratchpad Types**\n\n| Type | Content | Visibility |\n|------|---------|------------|\n| Reasoning trace | Thought process | Often hidden from user |\n| Plan | Steps to execute | May be shown |\n| Memory retrieval | Retrieved context | Internal |\n| Tool results | Accumulated outputs | Becomes history |\n\n### Interrupt \u002F Human-in-the-Loop\n\n**Interrupt Points**\n\n| Mechanism | When | Framework |\n|-----------|------|-----------|\n| Tool confirmation | Before destructive operations | Google ADK |\n| Output validation | Before returning to user | OpenAI Agents |\n| Step approval | Between reasoning steps | LangGraph |\n| Budget exceeded | Token\u002Fcost limits reached | Pydantic-AI |\n\n**Implementation Pattern**\n```python\nclass InterruptableAgent:\n    async def step(self, state: AgentState) -> AgentState | Interrupt:\n        action = await self.decide_action(state)\n\n        if self.requires_confirmation(action):\n            return Interrupt(\n                type=\"confirmation_required\",\n                action=action,\n                resume_token=self.create_resume_token(state)\n            )\n\n        result = await self.execute_action(action)\n        return state.with_observation(result)\n\n    async def resume(self, token: str, user_response: str) -> AgentState:\n        state = self.restore_from_token(token)\n        if user_response == \"approved\":\n            result = await self.execute_action(state.pending_action)\n            return state.with_observation(result)\n        else:\n            return state.with_observation(\"Action cancelled by user\")\n```\n\n### Conversation State Machine\n\n```\n                    ┌─────────────────┐\n                    │  AWAITING_INPUT │\n                    └────────┬────────┘\n                             │ user message\n                             ▼\n                    ┌─────────────────┐\n              ┌─────│   PROCESSING    │─────┐\n              │     └────────┬────────┘     │\n              │              │              │\n              │ tool_call    │ text_only    │ error\n              ▼              ▼              ▼\n    ┌─────────────────┐ ┌─────────┐ ┌─────────────────┐\n    │ EXECUTING_TOOLS │ │ RESPOND │ │ ERROR_RECOVERY  │\n    └────────┬────────┘ └────┬────┘ └────────┬────────┘\n             │               │               │\n             │ results       │ complete      │ retry\u002Fabort\n             ▼               ▼               │\n    ┌─────────────────┐      │               │\n    │   PROCESSING    │◄─────┴───────────────┘\n    └─────────────────┘\n```\n\n## Multi-Provider Abstraction\n\n### Abstraction Strategies\n\n**Strategy 1: Thin Adapter (Recommended)**\n```python\nclass LLMProvider(Protocol):\n    async def complete(\n        self,\n        messages: list[Message],\n        tools: list[Tool] | None = None,\n        **kwargs\n    ) -> Completion: ...\n\n    async def stream(\n        self,\n        messages: list[Message],\n        tools: list[Tool] | None = None,\n        **kwargs\n    ) -> AsyncIterator[StreamEvent]: ...\n\nclass OpenAIProvider(LLMProvider):\n    async def complete(self, messages, tools=None, **kwargs):\n        native = self._to_openai_format(messages, tools)\n        response = await self.client.chat.completions.create(**native, **kwargs)\n        return self._from_openai_response(response)\n```\n\n**Strategy 2: Unified Client (LangChain-style)**\n```python\nclass ChatModel(ABC):\n    @abstractmethod\n    def invoke(self, messages: list[BaseMessage]) -> AIMessage: ...\n\n    @abstractmethod\n    def bind_tools(self, tools: list[BaseTool]) -> \"ChatModel\": ...\n\nclass ChatOpenAI(ChatModel): ...\nclass ChatAnthropic(ChatModel): ...\nclass ChatGemini(ChatModel): ...\n```\n\n**Strategy 3: Request\u002FResponse Translation**\n```python\nclass ModelGateway:\n    def __init__(self, providers: dict[str, ProviderClient]):\n        self.providers = providers\n        self.translators = {\n            \"openai\": OpenAITranslator(),\n            \"anthropic\": AnthropicTranslator(),\n        }\n\n    async def invoke(self, request: UnifiedRequest, provider: str) -> UnifiedResponse:\n        translator = self.translators[provider]\n        native_request = translator.to_native(request)\n        native_response = await self.providers[provider].call(native_request)\n        return translator.from_native(native_response)\n```\n\n### Provider Feature Matrix\n\n| Feature | OpenAI | Anthropic | Gemini | Local (Ollama) |\n|---------|--------|-----------|--------|----------------|\n| Function calling | Yes | Yes | Yes | Model-dependent |\n| Streaming | Yes | Yes | Yes | Yes |\n| Tool choice | Yes | Yes | Limited | No |\n| Parallel tools | Yes | Yes | Yes | No |\n| Vision | Yes | Yes | Yes | Model-dependent |\n| JSON mode | Yes | Limited | Yes | Model-dependent |\n| Structured output | Yes | Beta | Yes | No |\n\n---\n\n## Output Document\n\nWhen invoking this skill, produce a markdown document saved to:\n```\nforensics-output\u002Fframeworks\u002F{framework}\u002Fphase2\u002Fharness-model-protocol.md\n```\n\n### Document Structure\n\nThe analysis document MUST follow this structure:\n\n```markdown\n# Harness-Model Protocol Analysis: {Framework Name}\n\n## Summary\n- **Key Finding 1**: [Most important protocol insight]\n- **Key Finding 2**: [Second most important insight]\n- **Key Finding 3**: [Third insight]\n- **Classification**: [Brief characterization, e.g., \"OpenAI-compatible with thin adapters\"]\n\n## Detailed Analysis\n\n### Message Protocol\n\n**Wire Format Family**: [OpenAI-compatible \u002F Anthropic-native \u002F Gemini-native \u002F Custom]\n\n**Providers Supported**:\n- Provider 1 (adapter location)\n- Provider 2 (adapter location)\n- ...\n\n**Abstraction Strategy**: [Thin adapter \u002F Unified client \u002F Gateway \u002F None]\n\n[Include code example showing message translation]\n\n```python\n# Example: How framework translates internal → provider format\n```\n\n**Role Handling**:\n| Role | Internal Representation | OpenAI | Anthropic | Gemini |\n|------|------------------------|--------|-----------|--------|\n| System | ... | ... | ... | ... |\n| User | ... | ... | ... | ... |\n| Assistant | ... | ... | ... | ... |\n| Tool Result | ... | ... | ... | ... |\n\n### Tool Call Encoding\n\n**Request Method**: [Function calling API \u002F System prompt injection \u002F Hybrid]\n\n**Schema Transmission**:\n```python\n# Show how tool schemas are transmitted to the LLM\n```\n\n**Response Parsing**:\n- **Parser Type**: [Native API \u002F Regex \u002F XML \u002F Custom]\n- **Location**: `path\u002Fto\u002Fparser.py:L##`\n\n```python\n# Show parsing logic\n```\n\n**Tool Choice Support**:\n| Constraint | Supported | Implementation |\n|------------|-----------|----------------|\n| auto | Yes\u002FNo | ... |\n| required | Yes\u002FNo | ... |\n| none | Yes\u002FNo | ... |\n| specific | Yes\u002FNo | ... |\n\n### Streaming Implementation\n\n**Protocol**: [SSE \u002F WebSocket \u002F Polling \u002F None]\n\n**Partial Tool Call Handling**:\n- **Supported**: Yes\u002FNo\n- **Accumulator Pattern**: [Describe if present]\n\n```python\n# Show streaming handler code\n```\n\n**Event Types Emitted**:\n| Event | Payload | Handler Location |\n|-------|---------|-----------------|\n| token | text delta | `path:L##` |\n| tool_start | tool id, name | `path:L##` |\n| tool_delta | argument fragment | `path:L##` |\n| ... | ... | ... |\n\n### Agentic Primitives\n\n#### System Prompt Assembly\n\n**Pattern**: [Static \u002F Dynamic \u002F Callable]\n\n```python\n# Show system prompt construction\n```\n\n**Injection Points**:\n1. Role definition\n2. Tool instructions\n3. Output format\n4. Behavioral constraints\n5. Dynamic context\n\n#### Scratchpad \u002F Working Memory\n\n**Implemented**: Yes\u002FNo\n\n[If yes, show pattern:]\n```python\n# Scratchpad injection pattern\n```\n\n#### Interrupt \u002F Human-in-the-Loop\n\n**Mechanisms**:\n| Type | Trigger | Resume Pattern | Location |\n|------|---------|---------------|----------|\n| Tool confirmation | ... | ... | `path:L##` |\n| Output validation | ... | ... | `path:L##` |\n| ... | ... | ... | ... |\n\n#### Conversation State Machine\n\n**State Management**: [Explicit state machine \u002F Implicit via history \u002F Graph-based]\n\n```\n[ASCII diagram of state transitions if applicable]\n```\n\n### Provider Abstraction\n\n| Provider | Adapter | Streaming | Tool Choice | Parallel Tools | Notes |\n|----------|---------|-----------|-------------|----------------|-------|\n| OpenAI | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| Anthropic | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| Gemini | `path` | Yes\u002FNo | Full\u002FPartial | Yes\u002FNo | ... |\n| ... | ... | ... | ... | ... | ... |\n\n**Graceful Degradation**: [Describe how missing features are handled]\n\n## Code References\n\n- `path\u002Fto\u002Fmessage_types.py:L##` - Internal message representation\n- `path\u002Fto\u002Fopenai_adapter.py:L##` - OpenAI translation\n- `path\u002Fto\u002Fstreaming.py:L##` - Stream event handling\n- `path\u002Fto\u002Fsystem_prompt.py:L##` - System prompt assembly\n- ... (include all key file:line references)\n\n## Implications for New Framework\n\n### Positive Patterns\n- **Pattern 1**: [Description and why to adopt]\n- **Pattern 2**: [Description and why to adopt]\n- ...\n\n### Considerations\n- **Consideration 1**: [Trade-off or limitation to be aware of]\n- **Consideration 2**: [Trade-off or limitation to be aware of]\n- ...\n\n## Anti-Patterns Observed\n\n- **Anti-pattern 1**: [Description and why to avoid]\n- **Anti-pattern 2**: [Description and why to avoid]\n- ...\n```\n\n---\n\n## Integration Points\n\n- **Prerequisite**: `codebase-mapping` to identify LLM client code\n- **Related**: `tool-interface-analysis` for schema generation (this skill covers wire encoding)\n- **Related**: `memory-orchestration` for context assembly patterns\n- **Feeds into**: `comparative-matrix` for protocol decisions\n- **Feeds into**: `architecture-synthesis` for abstraction layer design\n\n## Key Questions to Answer\n\n1. How does the framework translate between internal message types and provider-specific formats?\n2. Does streaming handle partial tool calls correctly?\n3. Are tool results properly attributed (tool_call_id matching)?\n4. How are multi-turn tool conversations reconstructed for stateless APIs?\n5. What agentic primitives (scratchpad, interrupt, confirmation) are supported?\n6. How is the system prompt assembled and injected?\n7. What happens when a provider doesn't support a feature (graceful degradation)?\n8. Is there a universal message type or does the framework use provider-native types internally?\n9. How are parallel tool calls handled (single message vs multiple)?\n10. What streaming events are emitted and how can consumers subscribe?\n\n## Files to Examine\n\nWhen analyzing a framework, prioritize these file patterns:\n\n| Pattern | Purpose |\n|---------|---------|\n| `**\u002Fllm*.py`, `**\u002Fmodel*.py` | LLM client code |\n| `**\u002Fopenai*.py`, `**\u002Fanthropic*.py`, `**\u002Fgemini*.py` | Provider adapters |\n| `**\u002Fmessage*.py`, `**\u002Ftypes*.py` | Message type definitions |\n| `**\u002Fstream*.py` | Streaming handlers |\n| `**\u002Fprompt*.py`, `**\u002Fsystem*.py` | System prompt assembly |\n| `**\u002Fchat*.py`, `**\u002Fconversation*.py` | Conversation management |\n| `**\u002Finterrupt*.py`, `**\u002Fconfirm*.py` | HITL mechanisms |\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fdowwie\u002Fharness-model-protocol",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill harness-model-protocol",{"tool":59,"command":60},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill harness-model-protocol",{"tool":62,"command":63},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill harness-model-protocol","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdowwie\u002Fharness-model-protocol\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"skill-report.json","REFERENCE","参考文档",23023,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdowwie\u002Fharness-model-protocol\u002Fskill-report.json",[74,82,91,100,106,112],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[19,80,81],"model hierarchy","model hierarchy skill",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[88,89,90],"MCP","zoom","zoom mcp",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[97,98,99,89],"sdk","zoom apps sdk","apps",{"skillNo":101,"name":102,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[102],{"skillNo":107,"name":108,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[108],{"skillNo":113,"name":114,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[114]]