model-message-stream-protocol
Copilot instructions124 starsChanged 12 days agoApache-2.0View on GitHub
You are a senior software engineer working on the MMSP project. MMSP, the Model Message Stream Protocol: one message format and one streaming grammar for every model provider, in Python and TypeScript. When adding support for new AI models, follow these rules:
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Prism-Shadow/agenthubword for word, first seen Nov 17, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Prism-Shadow/agenthub★ 124100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- mmsp-devSkill
- mmsp-pythonSkill
- mmsp-typescriptSkill
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
17 rules. About 0 are common, 14 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 35
Avoid trivial comments: Do not add comments that simply restate what the code obviously does.
- Distinctive: line 43
Follow the Google Python Style Guide
- Very specific: line 45
Run make lint and make test from src_py/ before committing
- Distinctive: line 49
Use ESLint for code quality
- Distinctive: line 50
Follow TypeScript strict mode conventions
- Distinctive: line 62
When adding support for new AI models, follow these rules:
- Distinctive: line 68
DO NOT: create new files or directories in examples and tests when adding a new model, use test function parameters or environment …
- Distinctive: line 71
When adding new functionality, follow these rules:
- Distinctive: line 73
DO NOT: create new example files unless the user explicitly requests them.
- Distinctive: line 74
When making changes, by default synchronize updates to both Python and TypeScript implementations unless the user explicitly specifies …
- Very specific: line 75
When using JSON serialization, ensure that CJK strings are serialized correctly by using ensure_ascii=False.
- Very specific: line 76
DO NOT: use the requests library in code.
- Distinctive: line 78
DO NOT: add unit test functions or dedicated test suites for a single specific model.
- Distinctive: line 80
When writing documentation, follow these rules:
- Distinctive: line 82
Always provide clear and concise documentation.
- Distinctive: line 84
Ensure that the documentation is accurate and up-to-date.
- Distinctive: line 89
When writing tests that require calling AI models, the following secrets are available in GitHub workflows:
≈ “Common” is an estimate: at least 1 in 5 of the 3,894 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Coding Guidelines
You are a senior software engineer working on the MMSP project.
Project Overview
MMSP, the Model Message Stream Protocol: one message format and one streaming grammar for every model provider, in Python and TypeScript.
Repository Structure
src_py/- Python implementationmmsp/- Main Python packagepyproject.toml- Python project configurationMakefile- Python build and test commandstests/- Python test files
src_ts/- TypeScript implementationsrc/- TypeScript source filespackage.json- Node.js package configurationtsconfig.json- TypeScript compiler configurationMakefile- TypeScript build and test commandstests/- TypeScript test files
site/- The site at mmsp.penguin.ooo (Astro): the overview page, the documentation, and the sources of the artwork in.github/images/design/- The design:rfcs/holds the specifications MMSP conforms to and the decisions that changed it, one RFC per file;design/README.mdindexes them and says when a change needs an RFCllmsdk_docs/- Reference documentation for AI model SDKs- See this directory for detailed development guidelines and code conventions
Coding Standards
General Code Quality
- Avoid trivial comments: Do not add comments that simply restate what the code obviously does. Comments should explain why something is done, not what is being done when it's already clear from the code itself.
- ❌ Bad:
# Add temperaturebeforeconfig['temperature'] = 0.7 - ❌ Bad:
# Loop through itemsbeforefor item in items: - ✅ Good:
# Workaround: Claude requires max_tokens to be specifiedbeforeconfig['max_tokens'] = 1000 - ✅ Good: Comments explaining complex algorithms, non-obvious business logic, or workarounds for known issues
- ❌ Bad:
Python
- Follow the Google Python Style Guide
- Maintain Python 3.11+ compatibility
- Run
make lintandmake testfromsrc_py/before committing
TypeScript
- Use ESLint for code quality
- Follow TypeScript strict mode conventions
- Run
make lintandmake testfromsrc_ts/before committing
Specifications and RFCs
- The specifications every change conforms to are the accepted spec RFCs in the index of
design/README.md. When the code and a specification disagree, the specification wins: fix the code, or change the specification first through an RFC PR. - A change to a specification, to the message or stream shapes, to the public API, to what routing or the credential rule means, or anything breaking, starts as an RFC PR to
dev: it edits the RFC that states the thing in place, in both languages, and adds the PR to itsUpdated byline; where no RFC states it, it copiesdesign/0000-template.mdtodesign/rfcs/MMSP-RFC-NNNN-<slug>.md.design/README.mdhas the process. - A client's transforms are direct (MMSP-RFC-0009) and keep nothing redundant (MMSP-RFC-0002); what a replay must keep is MMSP-RFC-0004, and the usage and finish reason every stream ends with are MMSP-RFC-0003.
- A request can be interrupted: an abort or a closed generator closes the provider's request (MMSP-RFC-0008). The history does not change, and nothing but
created_atis written to a caller's message (MMSP-RFC-0004).
Implementation Rules
When adding support for new AI models, follow these rules:
- A client is named by its
client_type, andauto_client.py/autoClient.tscreate the client that type names from one table. An official client per vendor (openai-official,anthropic-official,google-official,zai-official,moonshot-official,deepseek-official,minimax-official, and Jina'sjina-webtool) lives in a folder named after it (openai_official/) and serves every generation of that vendor's models; a compatible client per wire protocol (openai-chat,openai-responses,ant-messages,deepseek-webtool, ...) serves any endpoint that speaks it. (MMSP-RFC-0005) - A new generation of a vendor's models goes into the vendor's official client. Inside it, tell generations apart by explicit version (e.g.
"4-6" in self._model), never by a bare substring likeif "claude" in model.lower(), and keep the older generations working. (MMSP-RFC-0003) - Without a
client_type, the family a model id begins with (gpt-,claude-,gemini-,glm-,kimi-,deepseek-,minimax-,jina-) names its official client; an id of no known family raises and asks for aclient_type. A new vendor adds its family to that table. DO NOT add any other routing rule on model ids. (MMSP-RFC-0005) - A compatible client speaks its protocol as its reference client does, and its transforms never branch on its base URL, nor on the model id beyond its own protocol's markers (
-search/-fetchondeepseek-webtool, Gemini's generations ongoogle-genai). What one endpoint or one vendor's models need beyond the protocol (Mistral's thinking chunks, OpenRouter's usage counts, GPT-6's effort) is a plugin: aClientPluginsubclass in its own file under the client'splugins/folder, listed in that folder'sPLUGINS, enabled where itshostsandmodelsmatch. (MMSP-RFC-0009) - DO NOT create new files or directories in examples and tests when adding a new model, use test function parameters or environment variables instead.
- Always consult the llmsdk_docs/README.md for AI model SDK usage details.
When adding new functionality, follow these rules:
- DO NOT create new example files unless the user explicitly requests them.
- When making changes, by default synchronize updates to both Python and TypeScript implementations unless the user explicitly specifies otherwise. (MMSP-RFC-0002)
- When using JSON serialization, ensure that CJK strings are serialized correctly by using
ensure_ascii=False. - DO NOT use the
requestslibrary in code. Always usehttpxwith async methods (httpx.AsyncClient()) to avoid blocking the global event loop. - DO NOT modify files under
llmsdk_docs/unless the user explicitly requests changes to reference SDK documentation. - DO NOT add unit test functions or dedicated test suites for a single specific model; use existing parameterized tests, model capability flags, or environment-driven coverage instead.
When writing documentation, follow these rules:
- Always provide clear and concise documentation.
- DO NOT include unnecessary details in the documentation.
- Ensure that the documentation is accurate and up-to-date.
- Remember to update the documentation whenever changes are made to the code.
GitHub Workflow Secrets for Testing
When writing tests that require calling AI models, the following secrets are available in GitHub workflows:
ANTHROPIC_API_KEY- API key for Anthropic Claude ModelsGEMINI_API_KEY- API key for Google Gemini ModelsOPENAI_API_KEY- API key for OpenAI GPT ModelsZAI_API_KEY- API key for Z.AI GLM ModelsMOONSHOT_API_KEY- API key for MoonShot Kimi ModelsMINIMAX_API_KEY- API key or Token Plan Subscription Key for MiniMax ModelsDEEPSEEK_API_KEY- API key for DeepSeek ModelsMODELVERSE_API_KEY- API key for ModelVerse ModelsOPENROUTER_API_KEY- API key for OpenRouter ModelsSILICONFLOW_API_KEY- API key for SiliconFlow ModelsBEDROCK_API_KEY- API key for Amazon Bedrock ModelsVERTEX_API_KEY- API key for Google Vertex AI ModelsTOKENDANCE_API_KEY- API key for TokenDance ModelsJINA_API_KEY- API key for Jina's Reader and Search
To use these secrets in your workflow files, reference them in the env: section:
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }}
MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }}
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
MODELVERSE_API_KEY: ${{ secrets.MODELVERSE_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
SILICONFLOW_API_KEY: ${{ secrets.SILICONFLOW_API_KEY }}
BEDROCK_API_KEY: ${{ secrets.BEDROCK_API_KEY }}
VERTEX_API_KEY: ${{ secrets.VERTEX_API_KEY }}
TOKENDANCE_API_KEY: ${{ secrets.TOKENDANCE_API_KEY }}
JINA_API_KEY: ${{ secrets.JINA_API_KEY }}These secrets can be used in your test code to authenticate with the respective AI model providers. Make sure to handle these credentials securely and never log or expose them in test output.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

