agentleFS
Prism-ShadowPrism-Shadow/model-message-stream-protocol/.github/copilot-instructions.md

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

  • Other versions1 project uses a version of this.

    Word for word · 1

    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.

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
  1. Distinctive:

    Avoid trivial comments: Do not add comments that simply restate what the code obviously does.

    line 35
  2. Distinctive:

    Follow the Google Python Style Guide

    line 43
  3. Very specific:

    Run make lint and make test from src_py/ before committing

    line 45
  4. Distinctive:

    Use ESLint for code quality

    line 49
  5. Distinctive:

    Follow TypeScript strict mode conventions

    line 50
  6. Distinctive:

    When adding support for new AI models, follow these rules:

    line 62
  7. Distinctive:

    DO NOT: create new files or directories in examples and tests when adding a new model, use test function parameters or environment …

    line 68
  8. Distinctive:

    When adding new functionality, follow these rules:

    line 71
  9. Distinctive:

    DO NOT: create new example files unless the user explicitly requests them.

    line 73
  10. Distinctive:

    When making changes, by default synchronize updates to both Python and TypeScript implementations unless the user explicitly specifies …

    line 74
  11. Very specific:

    When using JSON serialization, ensure that CJK strings are serialized correctly by using ensure_ascii=False.

    line 75
  12. Very specific:

    DO NOT: use the requests library in code.

    line 76
  13. Distinctive:

    DO NOT: add unit test functions or dedicated test suites for a single specific model.

    line 78
  14. Distinctive:

    When writing documentation, follow these rules:

    line 80
  15. Distinctive:

    Always provide clear and concise documentation.

    line 82
  16. Distinctive:

    Ensure that the documentation is accurate and up-to-date.

    line 84
  17. Distinctive:

    When writing tests that require calling AI models, the following secrets are available in GitHub workflows:

    line 89

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 implementation
    • mmsp/ - Main Python package
    • pyproject.toml - Python project configuration
    • Makefile - Python build and test commands
    • tests/ - Python test files
  • src_ts/ - TypeScript implementation
    • src/ - TypeScript source files
    • package.json - Node.js package configuration
    • tsconfig.json - TypeScript compiler configuration
    • Makefile - TypeScript build and test commands
    • tests/ - 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.md indexes them and says when a change needs an RFC
  • 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 temperature before config['temperature'] = 0.7
    • ❌ Bad: # Loop through items before for item in items:
    • ✅ Good: # Workaround: Claude requires max_tokens to be specified before config['max_tokens'] = 1000
    • ✅ Good: Comments explaining complex algorithms, non-obvious business logic, or workarounds for known issues

Python

  • Follow the Google Python Style Guide
  • Maintain Python 3.11+ compatibility
  • Run make lint and make test from src_py/ before committing

TypeScript

  • Use ESLint for code quality
  • Follow TypeScript strict mode conventions
  • Run make lint and make test from src_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 its Updated by line; where no RFC states it, it copies design/0000-template.md to design/rfcs/MMSP-RFC-NNNN-<slug>.md. design/README.md has 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_at is written to a caller's message (MMSP-RFC-0004).

Implementation Rules

When adding support for new AI models, follow these rules:

  1. A client is named by its client_type, and auto_client.py / autoClient.ts create 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's jina-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)
  2. 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 like if "claude" in model.lower(), and keep the older generations working. (MMSP-RFC-0003)
  3. 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 a client_type. A new vendor adds its family to that table. DO NOT add any other routing rule on model ids. (MMSP-RFC-0005)
  4. 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/-fetch on deepseek-webtool, Gemini's generations on google-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: a ClientPlugin subclass in its own file under the client's plugins/ folder, listed in that folder's PLUGINS, enabled where its hosts and models match. (MMSP-RFC-0009)
  5. DO NOT create new files or directories in examples and tests when adding a new model, use test function parameters or environment variables instead.
  6. Always consult the llmsdk_docs/README.md for AI model SDK usage details.

When adding new functionality, follow these rules:

  1. DO NOT create new example files unless the user explicitly requests them.
  2. When making changes, by default synchronize updates to both Python and TypeScript implementations unless the user explicitly specifies otherwise. (MMSP-RFC-0002)
  3. When using JSON serialization, ensure that CJK strings are serialized correctly by using ensure_ascii=False.
  4. DO NOT use the requests library in code. Always use httpx with async methods (httpx.AsyncClient()) to avoid blocking the global event loop.
  5. DO NOT modify files under llmsdk_docs/ unless the user explicitly requests changes to reference SDK documentation.
  6. 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:

  1. Always provide clear and concise documentation.
  2. DO NOT include unnecessary details in the documentation.
  3. Ensure that the documentation is accurate and up-to-date.
  4. 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 Models
  • GEMINI_API_KEY - API key for Google Gemini Models
  • OPENAI_API_KEY - API key for OpenAI GPT Models
  • ZAI_API_KEY - API key for Z.AI GLM Models
  • MOONSHOT_API_KEY - API key for MoonShot Kimi Models
  • MINIMAX_API_KEY - API key or Token Plan Subscription Key for MiniMax Models
  • DEEPSEEK_API_KEY - API key for DeepSeek Models
  • MODELVERSE_API_KEY - API key for ModelVerse Models
  • OPENROUTER_API_KEY - API key for OpenRouter Models
  • SILICONFLOW_API_KEY - API key for SiliconFlow Models
  • BEDROCK_API_KEY - API key for Amazon Bedrock Models
  • VERTEX_API_KEY - API key for Google Vertex AI Models
  • TOKENDANCE_API_KEY - API key for TokenDance Models
  • JINA_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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.