Skip to main content

Reverse Engineering Claude's Undocumented Design API to Cut Sync Token Costs

How a developer built a standalone CLI tool to sync Claude Design projects locally without wasting hundreds of thousands of tokens through LLM context windows.

AI-written
Inewgen
27 Jul 2026Source: Dev.to3 min read (0 views)Last updated 29 Aug 2026
Share
Reverse Engineering Claude's Undocumented Design API to Cut Sync Token Costs

Stock photo for illustration only, not from the actual event

Font size
  • Syncing projects via an AI agent consumed approximately 665,000 tokens per large project.
  • Developed a new CLI tool named dsx to sync files like Git without passing raw bytes through model contexts.
  • Reverse-engineered undocumented endpoints and verified facts against live servers to avoid false mock assumptions.
  • Engineered with zero third-party dependencies and atomic file writes to completely prevent data loss.

Protocol archaeology often begins with confident assumptions that turn out to be completely wrong. One software engineer recently shared their build log detailing how they solved an expensive token problem when attempting to sync cloud-based Claude Design files down to a local directory.

Typically, the obvious way to retrieve files from Claude Design is to ask an AI agent to read every file and write it locally. On one large project measured by the author, this approach cost about 665,000 tokens because every single byte of every file had to pass through the model's context window on the way out.

That token consumption is unnecessary because moving bytes from point A to point B is not a reasoning task. Using an AI model for this is essentially using it as an extremely expensive copy command. The goal was to build a plain Command Line Interface (CLI) that syncs a Claude Design project to a local directory much like Git handles a repository—supporting clone, pull, push, status, and diff—where file bytes never touch a model context at all.

665kTokens spent via previous AI agent
103Files successfully pulled with new CLI
660.1 KBData synced in a single summary line

There was a major catch: the endpoint utilized by Claude Design is entirely undocumented with no public specification available. Although it operates as an MCP server using JSON-RPC and tool calls, the specific tools, arguments, and return values remain unwritten. The only way to discover them is by calling the endpoint directly and recording the server's responses.

Building utilities that interact with undocumented APIs carries inherent risks since server deployments can change at any time and break functionality. Implementing live automated tests that actively query the real endpoint serves as a vital safeguard, ensuring tools fail loudly and report errors rather than guessing when encountering unfamiliar server responses.

Never miss the latest news?

Subscribe to get news summaries by email - not often enough to be annoying.

โฆษณา

software architecture diagram code

Stock photo for illustration only, not from the actual event

The developer caught three major protocol facts they were initially wrong about before measuring them, which a passing mock would have easily hidden: write_files returns a map keyed by path instead of a list, access permission failures trigger an HTTP 403 status code rather than an embedded error object, and binary detection is determined by content bytes rather than file extensions.

"write_files returns a map, not a list. I assumed a list of results, one per file. It's keyed by path. A mock returning a list would have passed my tests and mis-parsed the real server."

Project Developer

Named dsx, the utility is distributed as a single Go binary with zero third-party dependencies, supporting macOS and Linux under an MIT license. It ensures high auditability, allowing developers to point an official OAuth credential at an unofficial endpoint with complete visibility and security.

Source: Dev.to

Comments

Leave a Comment
0/2000

Found something wrong in this article? Report an issue with this article