serial-mcp: Instructions file for Codex

AGENTS.md

serial-mcp AGENTS.md is an instructions file for Codex, OpenCode from qarnet/serial-mcp. It costs 15,020 tokens per session, scanned A, original, MIT.

Project instructions for serial-mcp, a Rust server that exposes tools and data through the Model Context Protocol (MCP), a standard way for AI clients to call external tools.

In plain words
What is it for?
Use them to find the server entry point, tool handlers, prompts, resources, transport options, and version-policy code.
Why use it?
They point developers to the code areas and protocol rules that control the server, including supported protocol versions and request lifecycles.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions Claude Code; mentions AGENTS.md; mentions Codex.

This is qarnet/serial-mcp's own configuration. It tells Codex and OpenCode how to work on serial-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything serial-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to qarnet/serial-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/qarnet/serial-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/qarnet/serial-mcp

Made for: Codex, OpenCode.

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 serial-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/qarnet/serial-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/qarnet/serial-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/qarnet/serial-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/qarnet/serial-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for serial-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/qarnet/serial-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/qarnet/serial-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15,020 This file is loaded in full into every session.
When invoked 15,020 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.15020 $0.15020
Opus 5.5 $0.06008 $0.06008
Sonnet 5.5 $0.03004 $0.03004
Haiku 4.5 $0.01502 $0.01502

Measured 28d ago against content hash 6428569c366c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

serial-mcp AGENTS.md 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 28d 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.

AGENTS.md · 537 lines

How it starts

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

AGENTS.md — serial-mcp

Fast truth

  • Root server: src/main.rs selects stdio vs HTTP transport, parses CLI limits (--profiles-path, --capture-dir + capture quotas included), and mounts HTTP at /mcp.
  • HTTP mounting uses src/http_transport.rs::router in production and the test harness. With rmcp 3.5, an exact discovery/stateless policy-row header disables legacy session mode on a per-request service clone, preserving modern initialize HTTP 404 / -32601 with no session allocation. Other headers keep SDK routing; SDK validation remains intact. ServerConfig / ClientConfig replace deprecated aliases; initialized test clients explicitly advertise 2025-11-25, never SDK LATEST (now modern).
  • MCP surface lives in src/server.rs; tool handlers are split under src/tools/, prompts under src/prompts/, resources under src/resources/.
  • MCP version policy (src/mcp_protocol.rs): the product-owned SUPPORTED_PROTOCOLS table is the SINGLE source for advertised versions, lifecycle admission, capability views, and cache shaping. Exactly two rows — 2026-07-28 (preferred, DiscoverStateless, ImmediatePrivate cache, subscriptions on) and permanent 2025-11-25 (InitializeSession, Omit cache, subscriptions off). Lookup is exact-match only (policy_for); cache_fields_for(Option<ProtocolVersion>) grants fields ONLY to rows with CachePolicy::ImmediatePrivate — never by date/range, and unknown/future versions inherit no policy. supported_protocol_versions() / preferred policy derive from the table, never from ProtocolVersion::KNOWN_VERSIONS.
  • Dual MCP lifecycle (src/server.rs): preferred modern 2026-07-28 discovery/stateless requests (server/discover + self-contained per-request _meta) and compatible legacy 2025-11-25 initialize/session requests. get_info() serves the MODERN view (rmcp intersects subscriptions/listen filters against get_info().capabilities), initialize() returns the legacy view with subscription disabled, discover() the modern view with resources.subscribe: true. Common surface: tools/resources/prompts/completions (no logging, list-change, or tasks). accepted_subscription_filter/listen are backed by one process-wide ResourceEventHub (src/resource_events.rs, capacity 256) shared by every stdio/HTTP handler and the port hotplug watcher; legacy subscriptions/listen stays -32601.
  • SerialHandler is built via SerialHandler::builder()...build() (src/server.rs); the old with_manager* telescoping constructors are gone and with_profiles() is gone. The builder defaults profile_store to an ephemeral store and capture_store to disabled. SerialHandler::new() tries the OS default profile store and falls back to an ephemeral store with a warning. Production main.rs injects the resolved profile_store, a CaptureStore built from --capture-dir + quota flags (disabled by default), and SystemPortProvider through the builder.
  • Profiles live in a process-wide Arc<ProfileStore> (src/profile_store.rs), shared by every stdio/HTTP session handler. main.rs resolves the path (--profiles-path or the OS user-config default, failing startup on an unavailable config dir or invalid file) and injects one store. Persistent mutations take a process-local async mutex, then spawn_blocking + an advisory lock on <file>.lock, reload-under-lock, NamedTempFile + sync_all + rename; the cache (shared Arc<RwLock>) is published from inside the blocking transaction right after the durable write, before the lock is released — so a cancelled awaiting tool still converges (cache never changes on failed write). update_defaults_preserving_selector returns the effective profile atomically (no racy second lookup). File format is schema-versioned TOML (v1 legacy auto-migrates in memory; schema_version == 0 or > 2 rejects startup). Profile carries metadata (revision/timestamps/generated/use_count) and a bounded revisions history (max 5 prior snapshots) for the profile-session feature.
  • Shared RX framing lives in src/tools/rx_consume.rs (consume_frames + RxFrameSink trait + disconnect_state); read routes framing through it, but its raw (no-framing) path stays per-tool by design (see "Invariants easy to break").
  • Connection lifecycle is in src/serial/; shared RX/TX coordination is in src/rx_session.rs (always-on pump + ring buffer), src/tx_session.rs, and src/stop_controller.rs. The pump appends all received bytes to src/rx_ring.rs; read reads from the ring via cursors. ConnectionManager's connection-opening boundary is an injectable ConnectionOpener (with_opener): production uses SystemConnectionOpener (SerialConnection::open); tests inject in-memory backends (tests/common/controlled.rs::ControlledConnectionOpener) so the public MCP surface runs cross-platform without an OS serial port. Linux production-path PTY tests use real PTYs; macOS and Windows use normal Rust and controlled-backend coverage.
  • Low-level shared primitives: src/util.rs (find_subsequence, the byte-substring search imported directly by framing and the matcher) and src/precedence.rs (resolve_field, the four-layer framing/parser/protocol precedence helper shared by io_ops). Both pub(crate).
  • build.rs injects GIT_HASH / GIT_HASH_AVAILABLE / BUILD_TARGET.

Read the full file on GitHub · 537 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. 28d ago Changed · +3 lines · +140 tokens per session 6428569c366c
  2. 2mo ago Changed · +1 lines · +60 tokens per session c54ea3c16b5b
  3. 2mo ago Changed · +41 lines · +620 tokens per session 525409dbf0ee
  4. 2mo ago First seen · 492 lines · 14,200 tokens per session scan A 5e720496209c

Subscribe to this mod's changes

serial-mcp AGENTS.md is an instructions file published in the GitHub repository qarnet/serial-mcp (19 stars, last pushed 7d ago), licensed MIT. It adds 15,020 tokens to every session, about $0.0601 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

serial-mcp AGENTS.md compared with instructions from other repositories

serial-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
serial-mcp AGENTS.mdqarnet/serial-mcpInstructions file197d agoMITA15,020Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode ai-customization.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA1,907GitHub Copilot