swaitsandClaude Opus 4.7 ac581fccda spec(routing): align path-learning with upstream and document PATH_RETURN delay
Two changes:

1. CORRECTION. The path-learning subsection previously described the
   reference implementation's path-replacement as "replace only if
   the new path's hash size is not smaller and SNR is not materially
   worse" — but upstream's BaseChatMesh::onContactPathRecv() does an
   UNCONDITIONAL replace, with an inline comment flagging hash-size/
   SNR selection as future work. The spec now reflects upstream's
   actual behavior and notes that quality heuristics are an
   implementation extension, not a reference-implementation behavior.
   Likewise, removed the implication that the reference implementation
   has a cached-path TTL — it doesn't.

2. ADDITION. Document PATH_RETURN scheduling delay
   (TXT_ACK_DELAY=200ms default in upstream BaseChatMesh.cpp:9), with
   the rationale of spacing PATH_RETURN, ACK, and reply across
   distinct slots.

Validated against upstream meshcore-dev/MeshCore @ 1a7b361
(BaseChatMesh.cpp:304-307 unconditional replace; cpp:228, 255
TXT_ACK_DELAY-spaced PATH_RETURN emission).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:25:50 -06:00

MeshCore Spec

A comprehensive specification and conformance test suite for the MeshCore mesh networking protocol.

MeshCore Spec aims to be the authoritative, machine-readable definition of the MeshCore wire format — much like RubySpec became the definitive specification of the Ruby language. Any implementation that passes the full test corpus can claim bit-perfect MeshCore compatibility.

What's Here

  • spec/ — RFC-style protocol specification in Markdown, covering every layer from packet framing to cryptographic operations.
  • corpus/ — JSON test vectors organized by protocol layer. Each vector pairs a structured representation with its exact binary encoding, enabling any implementation to verify encode and decode correctness.
  • tools/ — Validation and generation utilities.

Test Vector Format

Test vectors are JSON files. Binary data is represented as uppercase hex strings (whitespace allowed for readability). Each file contains an array of vectors in one of three modes:

  • encode_decode — Structured input paired with expected binary output. Implementations MUST produce the given binary when encoding, and MUST recover the given structure when decoding.
  • decode_only — Binary input with expected structured output. Used for alternate valid encodings that an encoder need not produce but a decoder MUST accept.
  • invalid — Binary input that MUST be rejected by a conforming decoder.

See corpus/schema/test-vector.schema.json for the full schema.

Using the Corpus

  1. Parse each JSON file in corpus/.
  2. For encode_decode vectors: encode the structured form and compare to binary; decode binary and compare to structured.
  3. For invalid vectors: attempt to decode binary and verify failure.

No special tooling is required — just a JSON parser and your MeshCore implementation.

Project Status

This project is under active development. The specification and corpus are being built from the official MeshCore firmware source code.

Protocol Versions

The corpus covers all known MeshCore protocol versions. Each test vector file includes a protocol_version field. Version 1 (the current production version) has the most comprehensive coverage.

License

MIT — see LICENSE.

Contributing

See CONTRIBUTING.md.

Acknowledgments

Based on the MeshCore firmware by the MeshCore developers. Protocol documentation derived from the official MeshCore docs.

S
Description
An unofficial spec of the MeshCore protocol, derived from the official MeshCore source code.
Readme MIT
221 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 47.4%
JavaScript 18.7%
Just 17.7%
Shell 12.2%
CSS 4%