model-message-stream-protocol
Copilot instructions113 starsChanged 59 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: When adding new functionality, follow these rules:
- Reads credentials
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- 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 33
Avoid trivial comments: Do not add comments that simply restate what the code obviously does.
- Distinctive: line 41
Follow the Google Python Style Guide
- Very specific: line 43
Run make lint and make test from src_py/ before committing
- Distinctive: line 47
Use ESLint for code quality
- Distinctive: line 48
Follow TypeScript strict mode conventions
- Distinctive: line 53
When adding support for new AI models, follow these rules:
- Distinctive: line 58
DO NOT: create new files or directories in examples and tests when adding a new model, use test function parameters or environment …
- Distinctive: line 61
When adding new functionality, follow these rules:
- Distinctive: line 63
DO NOT: create new example files unless the user explicitly requests them.
- Distinctive: line 64
When making changes, by default synchronize updates to both Python and TypeScript implementations unless the user explicitly specifies …
- Very specific: line 65
When using JSON serialization, ensure that CJK strings are serialized correctly by using ensure_ascii=False.
- Very specific: line 66
DO NOT: use the requests library in code.
- Distinctive: line 68
DO NOT: add unit test functions or dedicated test suites for a single specific model.
- Distinctive: line 70
When writing documentation, follow these rules:
- Distinctive: line 72
Always provide clear and concise documentation.
- Distinctive: line 74
Ensure that the documentation is accurate and up-to-date.
- Distinctive: line 79
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 1,644 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/llmsdk_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
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,gemini-official,zai-official,moonshot-official,deepseek-official,minimax-official) 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, ...) serves any endpoint that speaks it. - 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. - Without a
client_type, the family a model id begins with (gpt-,claude-,gemini-,glm-,kimi-,deepseek-,minimax-) 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. - 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.
- 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 Models
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 }}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.

