Protean Kit · protocol ingredient

SYM-2P

One canonical JSON packet per line.

SYM-2P is a versioned message language for AI agents. Agents write messages as JSON packets, one packet per line, inside plain text files that persist.

A validator checks every packet and reports problems with codes a script can read.

v1.0.0 · MIT · Python ≥3.9, stdlib only · install makes zero network calls
01

Do you need this?

Reach for it

  • Two agents must exchange messages as one JSON packet per line inside text files that persist.
  • A receiver must validate a packet stream and get typed diagnostics, with exit code 0 for valid, 1 for invalid, 2 for usage or IO error.
  • A run needs routing-state rows checked. Install protean-ops alongside; the manifest recommends it.

Skip it

  • The run depends on open items O-1 to O-9. Section 10 of the spec lists them as open and undecided.
  • Only record schemas and gates are needed. Those ship in protean-ops, not here.
02

Install

bash install.sh --target <dir>
bash install.sh --target <dir> --dry-run

Bash and coreutils only. Zero network calls. Every written path is printed, and no --target means no run. The dry run writes nothing.

It installs alone, resolving only its required dependencies. Optional relationships are reported, not fetched.

03

What ships

PathContents
SPEC.mdThe normative specification
skills/sym2p/The usage skill
scripts/protean-sym2p/sym-validate.py and sym-publish.py, stdlib only
templates/protean-sym2p/Canonical brief and receipt packets
examples/protean-sym2p/The worked review, fix, verify, merge loop
AUDIT/protean-sym2p/Evidence and provenance (never normative)
gates/protean-sym2p/The leak gate and the blocklist
04

The packet

A brief packet assigning work, as shipped in templates/:

{
  "v": 2,
  "id": "b441",
  "tk": "mr1",
  "prj": "sym2integration",
  "f": "cos",
  "t": "builder",
  "a": "assign",
  "s": "mr1",
  "st": "proposed",
  "cf": 88,
  "cov": 70,
  "cond": [
    "scope: implement SYM-2P/1.0 sections 3-5 only",
    "constraint: no existing path may be modified",
    "acceptance: validator exits 0 on valid fixtures, non-zero on invalid"
  ],
  "rq": "ack",
  "base": "mr1:v1",
  "exp": 40,
  "ext": { "sym2p": { "rev": "1.0" } }
}
  • Fixed header. The header uses an exact field set in a fixed order (spec section 3).
  • Versioned objects. Objects are written once and versioned in place (section 4).
  • Defined failure handling. Duplicates, stale references, and failures have defined handling (section 5).
  • Protected semantics. Meanings P0 through P9 are reserved. No packet may redefine them (section 6).
  • No latent channels. The protocol forbids hidden side channels in packets (section 8).
05

Validate

python3 scripts/protean-sym2p/sym-validate.py <packet-or-stream>
python3 scripts/protean-sym2p/sym-validate.py --state <receiver-state.json> <packets.jsonl>
python3 scripts/protean-sym2p/sym-validate.py --strict-canonical <packets.jsonl>
python3 scripts/protean-sym2p/sym-validate.py --verify-hashes --kind object <root>/objects/<id>.v2.md
python3 tests/run-tests.py

Exit code 0 means every document is valid. Exit code 1 means at least one is invalid, with a typed diagnostic. Exit code 2 means a usage, IO, or configuration error.

.jsonl is read one object per line. That is the wire carrier.

06

Publish

python3 scripts/protean-sym2p/sym-publish.py --root <delegation-dir> --by <role-id> draft.json
python3 scripts/protean-sym2p/sym-publish.py --root <dir> --by <role-id> --announce --to <recipient> draft.json

The publisher writes the append-only object versions the validator then checks.

07

Fixtures and gates

  • Protocol suite. tests/run-tests.py passes every valid fixture and rejects every malformed, stale, duplicate, or protected-semantic fixture with a typed diagnostic. Twenty invalid fixtures and four valid ones ship under tests/fixtures/. The suite also exercises the publisher's append-only write path end to end.
  • Internal-name gate. gates/protean-sym2p/check-internal-names.py blocks internal names from leaking into published artifacts.
  • CI. The verify workflow runs both gates on every push.
08

Open items

Open items O-1 to O-9 stay open. Section 10 of the spec carries them. This repository closes none of them and presents none as decided.

  • No transport signing (O-1). Integrity is a canonical sha256 computed in process, on a single-machine trust assumption.
  • Reference resolution and expiry need the caller to supply receiver state and a reference clock. Without them, those fields are syntax-checked only.
  • Phase 3 routing predicates (O-3) are named, not implemented.
09

Source

MIT licensed. The committed LICENSE file is authoritative. Requires nothing beyond Python ≥3.9 and git. Recommends protean-ops for the record schemas that carry routing state.