knowledge-model-and-provider-runtime-provider-transport-and-context-adaptation

knowledge-model-and-provider-runtime-provider-transport-and-context-adaptation is a skill for Claude Code, Codex from echoVic/blade-code. It costs 158 tokens per session (1,986 once invoked), scanned A, a copy of knowledge-model-and-provider-runtime-model-catalog-configuration-and-credentials, MIT.

A codebase guide for translating internal chat messages into the formats used by different AI model services, then translating their streamed replies back.

In plain words
What is it for?
Use it when updating provider payloads, tool choices, image history, streamed events, or end-of-stream and idle-timeout behavior.
Why use it?
It helps developers change model requests, tool handling, images, reasoning settings, or stream timeouts without breaking the boundary between the application and its AI providers.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when updating provider payloads, tool choices, image history, streamed events, or end-of-stream and idle-timeout behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/echovic/blade-code/provider-transport-and-context-adaptation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add echoVic/blade-code --skill provider-transport-and-context-adaptation
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for knowledge-model-and-provider-runtime-provider-transport-and-context-adaptation

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/provider-transport-and-context-adaptation.svg)](https://agentmods.dev/skills/echovic/blade-code/provider-transport-and-context-adaptation)
Your own site
<a href="https://agentmods.dev/skills/echovic/blade-code/provider-transport-and-context-adaptation"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/provider-transport-and-context-adaptation.svg" alt="Measured on agentmods" height="20"></a>
Per session 158 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,986 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00158 $0.01986
Opus 5 $0.00079 $0.00993
Sonnet 5 $0.00032 $0.00397
Haiku 4.5 $0.00016 $0.00199

Measured 4d ago against content hash cb9c1d179a87, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

knowledge-model-and-provider-runtime-provider-transport-and-context-adaptation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to knowledge-model-and-provider-runtime-model-catalog-configuration-and-credentials — 88 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.trae/knowledges/model-and-provider-runtime/provider-transport-and-context-adaptation/SKILL.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Module Structure

该节点是 Blade 内部聊天契约与 pi-ai Provider 协议之间的适配边界:先清理历史并构造 Context,再按模型 API 生成请求参数,最后把 pi-ai 语义事件投影成统一 StreamChunk

Directory Layout

  • packages/cli/src/services/ChatServiceInterface.ts — 内部 Message、Tool、ChatConfig 与 StreamChunk 契约
  • packages/cli/src/services/PiAIChatService.ts — 适配步骤的调用顺序和流式提交边界
  • packages/cli/src/services/pi/messageHistory.ts — 工具调用历史完整性过滤
  • packages/cli/src/services/pi/contextAdapter.ts — system/user/assistant/toolResult 与图片转换
  • packages/cli/src/services/pi/requestOptions.ts — thinking、tool choice、tier、verbosity、缓存和响应元数据选项
  • packages/cli/src/services/pi/reasoningEffort.ts — reasoning 能力协商
  • packages/cli/src/services/pi/serviceTier.ts — service tier 能力协商
  • packages/cli/src/services/pi/responseVerbosity.ts — verbosity 能力协商
  • packages/cli/src/services/pi/streamAdapter.ts — pi-ai 事件映射和流活性 watchdog

Key Entry Points

  • createPiContext() in packages/cli/src/services/pi/contextAdapter.ts — 构造 Provider 上下文和工具声明
  • buildPiOptions() in packages/cli/src/services/pi/requestOptions.ts — 生成 wire API 特定请求选项
  • streamPiModel() in packages/cli/src/services/pi/streamAdapter.ts — 将 pi-ai iterator 转为 Blade 流
  • PiAIChatService.streamChat() in packages/cli/src/services/PiAIChatService.ts — 在适配层外建立能力预检和重放边界

Gotchas

  • PiAIChatService 会在转换前扫描过滤后的全部用户历史,只要文本模型遇到任意图片就拒绝请求;createPiContext() 中“历史图片替换为占位文本”的降级只对直接调用适配器有效,不能据此假设完整聊天路径会降级 (packages/cli/src/services/PiAIChatService.ts, packages/cli/src/services/pi/contextAdapter.ts, packages/cli/tests/unit/services/pi-ai-chat-service.test.ts)
  • 工具历史不是逐条容错:assistant 的 tool call 必须紧跟一组 ID 完整且唯一匹配的 tool result,否则 assistant 调用及其相邻 tool result 会整组移除,孤立 tool 消息也直接丢弃 (packages/cli/src/services/pi/messageHistory.ts)
  • required tool 必须先存在于当前工具集合;适配器随后只向 Provider 暴露该工具并仍按名称排序,避免“强制不存在工具”或缓存前缀因注册顺序漂移 (packages/cli/src/services/PiAIChatService.ts, packages/cli/src/services/pi/contextAdapter.ts)
  • required tool continuation 或历史中存在“有 tool call 但没有 reasoning”的 assistant 消息时,会关闭本次 thinking;否则部分 Provider 会因跨轮 reasoning/tool 协议不一致拒绝请求 (packages/cli/src/services/PiAIChatService.ts, packages/cli/src/services/pi/messageHistory.ts, packages/cli/src/services/pi/requestOptions.ts)
  • 历史工具参数 JSON 无效、不是对象或是数组时不会阻断恢复,而是告警并降级为空对象;依赖原始参数字符串做重放会得到不同语义 (packages/cli/src/services/pi/contextAdapter.ts)
  • Provider iterator 未发出 done 就自然结束会转成 ProviderStreamClosedError,而不是成功的空响应;零输出 EOF 可重试,主动 idle timeout 则禁止同 Provider 自动重试 (packages/cli/src/services/pi/streamAdapter.ts, packages/cli/src/services/pi/providerRetry.ts)
  • stall warning 只是同一个 pending iterator.next() 上的观测事件,不会启动第二次读取,也不会越过重放边界;只有真实 text、reasoning、tool、usage 或 finish chunk 才提交该尝试 (packages/cli/src/services/pi/streamAdapter.ts, packages/cli/src/services/PiAIChatService.ts)
  • 显式 response verbosity 会先做模型能力校验,不支持的 fallback 会在构造请求参数时失败;它不是所有 OpenAI-compatible 模型都能接受的透传字段 (packages/cli/src/services/pi/responseVerbosity.ts, packages/cli/src/services/pi/requestOptions.ts)

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 65 lines · 158 tokens per session scan A cb9c1d179a87

Subscribe to this mod's changes

knowledge-model-and-provider-runtime-provider-transport-and-context-adaptation is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 158 tokens to every session and 1,986 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. It is 88% identical to knowledge-model-and-provider-runtime-model-catalog-configuration-and-credentials, differing in 88 lines, and is treated as a copy.

Related

Other skills, from other repositories

histolab

Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.

synthetic-sciences/openscience · 62 tokens

torch-geometric

Graph Neural Networks (PyG). Node/graph classification, link prediction, GCN, GAT, GraphSAGE, heterogeneous graphs, molecular property prediction, for geometric deep learning.

synthetic-sciences/openscience · 41 tokens

zarr-python

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

synthetic-sciences/openscience · 42 tokens

glycobiology

Glycosylation site prediction and glycobiology analysis. N-glycosylation motif finding, O-glycosylation hotspot prediction, glycan structure resources. Lightweight, pure Python. For protein function queries use uniprot-database; for structure analysis use alphafold-database.

synthetic-sciences/openscience · 67 tokens

pyhealth

Comprehensive healthcare AI toolkit for developing, testing, and deploying machine learning models with clinical data. This skill should be used when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, drug recommendation), medical coding systems (ICD, NDC, ATC)…

synthetic-sciences/openscience · 109 tokens

deepchem

Molecular ML with diverse featurizers and pre-built datasets. Use for property prediction (ADMET, toxicity) with traditional ML or GNNs when you want extensive featurization options and MoleculeNet benchmarks. Best for quick experiments with pre-trained models, diverse molecular representations. For graph-first…

synthetic-sciences/openscience · 78 tokens