agentleFS
matteoepitechmatteoepitech/tonton-claude/.claude/skills/protocol-change/SKILL.md

protocol-change

Skill4 starsChanged 17 days agoMITView on GitHub

Add or change a message or a field exchanged between the agent, the relay and the macOS app (shared/protocol.ts and its Swift mirror). Use for any change to what travels over the WebSocket or the hook endpoint, including new sealed payloads.

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 · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. J3vb/OwnCord★ 11same name

    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 repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Only ids, states, booleans, versions and sizes the relay needs for routing or limits may stay in clear.

    line 16
  2. Very specific:

    Keep shared/ free of Node and Bun APIs: tsc -p shared fails otherwise.

    line 53
  3. Distinctive:

    Write down, in the PR, what happens for each:

    line 57
  4. Distinctive:

    If one of them breaks, either make it degrade gracefully (a missing field shows nothing, an action is greyed out) or add a Rollout section …

    line 65

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
SKILL.md

Changing the wire protocol

A message crosses three codebases in two languages, and the three never update at the same time. Go through every step, even when a change looks local to one side.

1. Decide what the relay may see

  • Anything about what Claude is doing (text, names, paths, tool calls, errors from the machine) is sealed: a plaintext interface in shared/protocol.ts (under "Plaintext payloads, sealed before leaving the machine"), sent as a Sealed string. Its Swift twin goes at the bottom of app/Sources/TontonCore/Wire.swift.
  • Only ids, states, booleans, versions and sizes the relay needs for routing or limits may stay in clear.

2. Edit the protocol

  • shared/protocol.ts: the message unions are AgentMessage (agent → relay), RelayToAgent, HookPost (POST /api/hook), RelayToApp and AppMessage (app → relay).
  • New fields are optional. Never rename, retype or reuse a field: older agents, apps and relays are still out there.

3. Relay

  • relay/src/sockets.ts dispatches socket messages, relay/src/routes.ts HTTP requests. Check every field with the helpers in relay/src/validate.ts (isSealed, isText…) before using it, and drop the message when a check fails.
  • Anything kept in memory or in SQLite needs a cap in relay/src/limits.ts. Live session state is in relay/src/sessions.ts; schema changes are a new entry at the end of MIGRATIONS in relay/src/registry.ts.
  • Unknown message types are already ignored: keep it that way.

4. Agent

  • Socket messages go through agent/src/channel/relay-connection.ts and are built in agent/src/channel/ (the session conversation is in conversation.ts); hook posts are in agent/src/hook.ts.
  • Seal with seal() from shared/crypto.ts, open with open().

5. App

  • Decode in app/Sources/TontonCore/Wire.swift: decodeIfPresent for new fields, and a new case in the switch for a new message type (the default maps unknown types to .unknown, which is what an older app does with yours).
  • Handle it in app/Sources/TontonClaude/Data/SessionStore.swift; messages to the relay are the socket.send([...]) dictionaries there.
  • Open sealed fields with E2E in TontonCore.

6. Client core

The web app and the other clients read the relay through shared/, which mirrors the app:

  • shared/wire.ts checks each relay → app message, like Wire.swift: a new message type or field goes there too.
  • shared/payloads.ts checks a sealed payload once opened, like the Codable types; shared/vault.ts opens them into the models of shared/session.ts, like SessionVault.swift.
  • Keep shared/ free of Node and Bun APIs: tsc -p shared fails otherwise.

7. Check every mix of versions

Write down, in the PR, what happens for each:

RelayAgentApp
oldnewnew
newoldnew
newnewold

If one of them breaks, either make it degrade gracefully (a missing field shows nothing, an action is greyed out) or add a Rollout section saying which part must be updated first.

8. Test both languages

  • test/end-to-end.test.ts runs a real relay and agent with a socket standing in for the app: add a case that goes through the new message.
  • relay/test/ for validation and limits, agent/test/ for agent logic.
  • app/Tests/TontonCoreTests/: decode a JSON sample written exactly as the relay sends it. For a new sealed payload, open a blob sealed by shared/crypto.ts, like agentBlob in E2ETests.swift. If the app seals or reads it, add it to VectorTests.swift and write shared/test/swift-vectors.json again (TONTON_WRITE_VECTORS=1 swift test --filter VectorTests): shared/test/swift-vectors.test.ts checks the client core reads it the same way.
  • Then bun run check && bun test, and in app/: swift format lint --strict --configuration .swift-format --recursive Sources Tests ../agent/tray/macos && swift test.

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.