serial-mcp AGENTS.md

serial-mcp AGENTS.md is an instructions file for Codex, OpenCode from qarnet/serial-mcp. It costs 14,200 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

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.

agentmods
npx agentmods add instructions/qarnet/serial-mcp/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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 14,200 This file is loaded in full into every session.
When invoked 14,200 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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.14200 $0.14200
Opus 5 $0.07100 $0.07100
Sonnet 5 $0.02840 $0.02840
Haiku 4.5 $0.01420 $0.01420

Measured 5d ago against content hash 5e720496209c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 5d 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 · 492 lines

How it starts

The opening of the file, as written. The whole thing — 492 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.
  • 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 · 492 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. 5d 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 (7 stars, last pushed today), licensed MIT. It adds 14,200 tokens to every session, about $0.0710 per session on Opus 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

Other instructions, from other repositories