Disk Is the Contract: Inside Threlmark's Local-First Architecture

TL;DR

Threlmark’s architecture treats the on-disk JSON files as the single source of truth. This design simplifies debugging, enhances offline support, and enables seamless collaboration without a central database.

Imagine a tool that doesn’t rely on a server or cloud to keep your work safe and synchronized. Instead, everything lives on your disk—simple, transparent, and lightning-fast. Threlmark’s approach flips the typical app architecture on its head, making the disk the API. No databases, no complex sync protocols—just plain files, smartly organized.

This isn’t just about saving space. It’s about building apps that are easier to debug, more resilient offline, and more collaborative by design. If you’ve ever wrestled with cloud lock-in or struggled with data loss, this approach will turn your thinking upside down. Let’s explore how treating disk as the contract rewires the entire app ecosystem.

Disk is the contract: inside Threlmark’s architecture — ThorstenMeyerAI.com
ThorstenMeyerAI.com
Threlmark · Technical Deep-Dive
Threlmark · architecture

Disk is the contract: inside a local-first roadmap hub

A Next.js app on top of plain JSON files — no database, no cloud, no accounts. The key decision: the on-disk layout IS the API. Everything else cascades from taking that seriously.

Next.js · TypeScript · JSON-on-disk · MIT · part 2 of the Threlmark series
01The core decision

There is no server-of-record — the files are the record

The UI and any external tool reach the same files through the same discipline. The data root defaults to ~/.threlmark — home-based, because it’s a shared hub every one of your apps points at.

~/.threlmark/ ├─ threlmark.json # manifest ├─ links.json # dependency graph ├─ projects// │ ├─ project.json # meta + wipLimits │ ├─ board.json # lane ordering │ ├─ items/.json # ONE card per file ← source of truth │ ├─ suggestions/ # the Inbox (drop-zone) │ ├─ handoffs/ # recorded agent handoffs │ ├─ reports/ # agent report drop-zone │ └─ ROADMAP.md # human-readable mirror ├─ shared/items/ # cards many projects ref └─ archive/ # archived, still readable

Inspectable

Every artifact is a file you can cat, diff, grep, commit.

Portable · no lock-in

Back up with cp, sync with Dropbox / git, migrate trivially.

Interoperable

Any tool in any language joins by reading / writing files.

Restartable

No in-memory state to lose — stateless over the files.

02Making files safe
SANDISK 1TB Extreme Portable SSD (Old Model) - Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware - External Solid State Drive - SDSSDE61-1T00-G25

SANDISK 1TB Extreme Portable SSD (Old Model) – Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware – External Solid State Drive – SDSSDE61-1T00-G25

Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Two disciplined patterns instead of a database

“Just use files” is easy to get wrong. These two patterns — ported from a battle-tested sibling app — are what make file-based state sound rather than reckless.

Pattern 1

Atomic writes

Write to a temp file in the same dir, then rename() over the target. Rename is atomic on one filesystem — a crash mid-write leaves the complete old file or the complete new one, never a half.

write .tmp-pid-rand fsync rename() over target
Pattern 2 · one file per item

The board heals itself

A single roadmap.json array races when two tools write at once. One file per card makes writes collision-free. Lane order lives in board.json and reconciles on read.

The payoff: an external tool never touches board.json. It writes an item file — the board fixes itself on Threlmark’s next read. Unknown keys are preserved, so the contract is forward-compatible.
03Derived, never stored
8GB Flash Drive 10 Pack Bulk USB Flash Drives, USB2.0 Thumb Drive USB Stick for Data Storage Backup, Jump Drive Pen Drive Zip Drive Memory Stick with Indicator, USB Storage Flash Drive Swivel Design

8GB Flash Drive 10 Pack Bulk USB Flash Drives, USB2.0 Thumb Drive USB Stick for Data Storage Backup, Jump Drive Pen Drive Zip Drive Memory Stick with Indicator, USB Storage Flash Drive Swivel Design

10 Pack USB Sticks: 10 pieces of USB flash drives are fit for a variety of scenarios. Whether…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

The numbers can’t drift from the files

Anything computable from item state is computed — so the displayed numbers can never disagree with the underlying JSON. Priority is the clearest example: it’s calculated on read, never persisted.

priority — computed on read

Impact weighted heaviest; effort the only axis that subtracts. Reused verbatim from the original tool, so imported cards rank identically.

priority = max(0, round(impact·3 + evidence·2 + fit·2effort·1.5))
a 5 / 5 / 5 / 4 card 29
work-item age
now − lane-entry time. Past threshold (dev 7d, ranked 21d, idea 60d) → stale.
cycle time
first DevelopmentDone. Derived from append-only transitions[].
throughput
items reaching Done per ISO week, 8-week window.
WIP
count per lane; over the cap shows 3 / 2 in red.
04The closed agent loop · press play
Music Studio 11 - Music software to edit, convert and mix audio files - Eight music programs in one for Windows 11, 10

Music Studio 11 – Music software to edit, convert and mix audio files – Eight music programs in one for Windows 11, 10

Music software to edit, convert and mix audio files

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

A handoff is a first-class flow event

The genuinely 2026-shaped part: most building is done by AI agents, so Threlmark closes the loop. Watch a card go from ranked to Done without anyone dragging it.

Handoff → report → self-move

The brief carries a reporting protocol. The agent reports through REST or the filesystem — and a done report moves the card itself.

Ranked
Add price-drop alertsscore 31 · ready
Development
Handed off 🤖
Done
▶ preferred — REST
POST /api/projects/:id/
items/:itemId/report

Direct call. Applied immediately.

▶ fallback — filesystem
drop reports/.json
→ ingested on read

Robust even if the server’s down at finish time.

🤖 claude done: price-drop alerts shipped · typecheck + lint + build passed — card moved to Done
05Portfolio score & deployment
USB 3.0 to SATA IDE Bay Docking Station for 2.5 or 3.5in HDD SSD, Support 20TB, Hot Swap, Offline Clone, Tool Installation (US Plug)

USB 3.0 to SATA IDE Bay Docking Station for 2.5 or 3.5in HDD SSD, Support 20TB, Hot Swap, Offline Clone, Tool Installation (US Plug)

6Gbps Transfer Speed: USB transfer interface meets USB 3.0 standard specifications, supports 6Gbps transfer speed, fast file transfer,…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

A small formula, and an honest hosting caveat

Because items are globally addressable (/), the Portfolio ranks everything together by a status-weighted score — finishing beats starting, blockers get a boost.

Portfolio ranking — status-weighted

In-flight work floats to the top; bottlenecks cost the most, so blockers get nudged up.

score = priority · statusWeight (+ 0.1 · blockedCount · priority)
1.3
development
1.0
ranked
0.85
idea
0.15
done
Path 1

Static read-only demo

Seeded data, writes to localStorage. Try-before-you-clone.

Path 2

Personal Node instance

Password-gated, persistent backed-up THRELMARK_DATA_DIR.

Path 3

Multi-tenant SaaS

Add accounts + per-tenant isolation. A separate build.

The elegant part: the store interface src/lib/*/store.ts is the natural seam — the same boundary that keeps the local tool simple is the one you’d extend for multi-tenancy. The architecture doesn’t fight that future; it just doesn’t pay for it until you need it.
ThorstenMeyerAI.com
Threlmark · open source (MIT) · github.com/MeyerThorsten/threlmark · part 2 of a series · file layout, formula, weights & agent-loop channels are Threlmark’s actual mechanics.

Key Takeaways

  • Treat the disk as the system’s API—files are the single source of truth and interface.
  • Atomic file operations prevent corruption and simplify recovery.
  • One file per item reduces conflicts and enables seamless offline work.
  • Reconcile order and relationships dynamically to maintain consistency.
  • This approach makes debugging, migrating, and expanding your app much easier.

What does ‘disk is the contract’ really mean?

At its core, ‘disk is the contract’ means the app’s entire state is stored in files—JSON files in this case—that serve as both the database and the API. Instead of a server mediating data, your app reads, writes, and syncs these files directly. It’s like having a shared whiteboard that everyone can see and edit, with the files acting as the ultimate record.

For example, Threlmark stores each task or card as a separate JSON file. When you update a task, you overwrite that file atomically—no partial writes, no risky transactions. This makes it easy to see what’s changed, debug issues, or even recover from crashes.

According to [1], this approach leverages the fact that filesystem operations like `rename()` are atomic. It’s a way to sidestep the complexity of databases, which often hide the underlying data and make debugging harder.

What does 'disk is the contract' really mean?
What does ‘disk is the contract’ really mean?

How does file-based persistence beat traditional databases?

Feature File-Based Persistence Traditional Database
Inspectability Files are plain text, easy to `cat` or `diff` Data stored in binary blobs, harder to debug directly
Portability Copy files, sync via Dropbox, git, or rsync Database exports needed; less portable
Recovery Atomic file writes prevent corruption Corruption can be complex to detect and fix
Interoperability Any language/tool can read/write files Requires driver/connector
Performance Fast local reads/writes, no network latency Network calls slow; relies on server

For instance, Threlmark’s users can tweak a JSON file directly or use a script to automate updates. The system’s transparency simplifies debugging and recovery, making it more resilient than traditional apps relying on complex database layers. Learn more about this architecture.

Why is ‘disk as the API’ a game-changer for offline apps?

Because the entire system hinges on files, apps can work flawlessly offline. When you’re disconnected, your data stays intact, and your workflow continues without interruption. Sync happens later, just like syncing your photos or documents. Discover more about local-first architecture.

Take Threlmark: you can plan, move cards, and update your roadmap in a subway tunnel with no signal. When you reconnect, the system syncs changes across devices, resolving conflicts based on file timestamps and merge rules [4].

This approach turns the disk into a local-first powerhouse—no cloud dependency, no complex sync protocols, just straightforward file operations.

Why is 'disk as the API' a game-changer for offline apps?
Why is ‘disk as the API’ a game-changer for offline apps?

How does Threlmark handle concurrency without a database?

Concurrency in Threlmark relies on atomic file operations and a careful merge process. Each task or card lives in its own JSON file—no shared array to lock or race over. When you update one card, you overwrite just that file.

For the lane order, the system reads the current `board.json`, compares it to the actual item files, and reconciles any differences on read. This self-healing approach ensures consistency without locks.

For example, if two devices update the same card offline, the last write wins based on file timestamps. When syncing, conflicts can be resolved automatically or flagged for manual review, similar to how Git handles merges [1].

What are the tradeoffs of making disk the main contract?

While this approach simplifies debugging and enhances offline support, it does come with tradeoffs. Handling conflicts becomes critical—imagine two devices editing the same task offline, then syncing. Resolving conflicts gracefully requires thoughtful merge strategies.

Schema evolution also demands discipline. Adding a new field means updating all relevant files or handling missing data gracefully.

According to [4], the main challenge is managing consistency and conflict resolution in multi-device setups. But the upside? A system that’s inherently transparent, resilient, and easy to back up or migrate.

What are the tradeoffs of making disk the main contract?
What are the tradeoffs of making disk the main contract?

How can you get started with a disk-as-the-contract approach?

  1. Design your data as JSON files, one per entity or task.
  2. Implement atomic writes using `rename()` to avoid partial updates.
  3. Use a read-merge-write pattern, merging changes without losing data.
  4. Reconcile orderings or relationships dynamically when reading files.
  5. Build sync logic that compares file timestamps and handles conflicts.

For example, Threlmark’s core code uses simple Node.js scripts to read, write, and sync files, making the whole system transparent and easy to debug. You can see the full approach in the Threlmark GitHub repository.

What makes Threlmark’s architecture stand out in the local-first world?

Threlmark’s key innovation is treating the disk as the definitive API, not just a storage layer. This means every change is directly reflected in files, making the entire system transparent, inspectable, and resilient against crashes or data corruption. Read more about this approach.

Its design supports multi-project roadmaps, open integrations, and AI-driven automation—all layered on a simple, file-based backbone. It’s a blueprint for future-proof, offline-capable apps that can scale wit this architecture.hout complex infrastructure.

By avoiding a central server, Threlmark exemplifies how local-first can be powerful, flexible, and easy to understand. It’s a new paradigm—one where the filesystem becomes the heartbeat of your app’s entire logic.

Frequently Asked Questions

What does ‘disk is the contract’ actually mean?

It means your app’s entire state is stored in files, which serve as both the database and the API. The app reads, writes, and syncs these files directly, making the data transparent and easy to manage.

How is this different from a typical server-backed app?

Instead of relying on a central server, all data lives on your disk. Changes are made directly to files, and sync happens later. This approach improves offline support, debugging, and reduces dependency on network availability.

Why choose JSON files over a traditional database?

JSON files are plain text—inspectable, portable, and easy to merge. They make debugging straightforward and simplify data migration or backup without needing a database driver.

How does Threlmark handle conflicts when multiple devices update offline?

It compares file timestamps and merges changes based on rules. Conflicts can be automatically resolved or flagged for manual review, similar to version control systems like Git.

What are the main benefits of this architecture?

Faster local interactions, easier debugging, better offline support, and simplified migration. Plus, it’s inherently transparent—making understanding and fixing issues much simpler.

Conclusion

In a world obsessed with cloud and databases, Threlmark’s disk-first approach shines a spotlight on simplicity and transparency. Your data becomes a living, breathing part of your filesystem—easy to see, easy to fix, and easy to sync.

Next time you build or choose tools, ask yourself: could the disk really be the API? It’s a bold idea—one that might just make your apps faster, safer, and more resilient.

What makes Threlmark’s architecture stand out in the local-first world?
What makes Threlmark’s architecture stand out in the local-first world?

You May Also Like

A War Room for Your Next Idea: Inside IdeaClyst

Discover how IdeaClyst transforms idea development with a private, structured, and collaborative digital war room—built for founders who want to move faster.

How Anthropic Is Investing $965B in Compute for AI Breakthroughs

Discover why Anthropic’s $65B raise isn’t just a valuation milestone—it’s a massive bet on AI infrastructure, chips, and cloud capacity fueling future growth.

Build vs Buy a Prebuilt AI Workstation

Discover whether building or buying your AI workstation makes sense in 2026. Explore costs, speed, support, and real-world scenarios to make the right call.

Acoustic Dampening, Placement, and the “Rig in the Closet” Setup

Learn how to quiet your workspace with smart placement and acoustic treatment. Discover the secrets to a silent, effective closet studio setup.