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

TL;DR

Threlmark’s core idea is that the disk’s JSON files serve as the single source of truth. This design simplifies sync, boosts reliability, and keeps your data portable. It’s a game-changer for building resilient, collaborative apps without a central database.

Imagine your project management app, but it lives completely on your disk—no cloud, no central server. Instead, your files are the source of truth, accessible and editable by any tool that can read JSON. That’s the core idea behind Threlmark’s architecture: the disk is the contract. It might seem simple, but it’s revolutionary.

In this deep dive, you’ll learn how treating the disk as the primary interface transforms development, collaboration, and reliability. We’ll explore the nuts and bolts of this approach and why it’s gaining momentum in the world of local-first apps.

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
Amazon

JSON file editor for Windows

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
Amazon

local-first database backup tools

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
Amazon

disk-based project management app

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
Amazon

file synchronization software for JSON files

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 layout itself as the API—files are the source of truth.
  • Use atomic file operations to prevent corruption and race conditions.
  • Separate data into small, manageable JSON files for easy inspection and merging.
  • Sync by copying files, not via a central server, enabling offline work.
  • Conflict resolution relies on timestamps and flexible merge strategies.

What ‘Disk Is the Contract’ Really Means in Practice

At its heart, Threlmark treats the on-disk file structure as the *ultimate authority*. Instead of a database that you query via an API, your data lives in plain JSON files. Think of it as a contract that everyone respects—files are the source of truth, and all tools read and write them directly.

For example, when you update a task in Threlmark, it writes directly to a specific JSON file. No server, no special database. Your editor, a sync tool, or even a script can see the exact same data, because it’s all in those files.

This approach makes debugging easy: just `cat` the JSON files or diff two versions. It’s like having a living, breathing document that’s always up-to-date and transparent.

What ‘Disk Is the Contract’ Really Means in Practice
What ‘Disk Is the Contract’ Really Means in Practice

Why a JSON-on-Disk Model Makes Life Easier for Developers

JSON files are human-readable, easy to manipulate, and widely supported. Learn more about curated lists and reviews. Instead of guessing what a database schema looks like, developers can peek directly into the files. Need to debug? Open the JSON in your editor and see the exact state.

Imagine you’re working on a project where each task is a file named after its ID, stored under `items/`. Updating a task is as simple as editing a JSON file and saving it. No locks, no complicated transactions.

This simplicity speeds up development and reduces bugs. Plus, since files are atomic units, updates don’t clobber each other—no race conditions.

How Threlmark Handles Concurrency and Sync Without a Central Database

Concurrency in a disk-based system sounds tricky, but Threlmark keeps it simple with atomic file writes. When you save a task, it writes to a temporary file, then renames it—an atomic operation that prevents partial writes or corruption.

Syncing across devices happens by copying these JSON files. When your device reconnects, Threlmark compares files and merges changes. Conflicts are resolved based on timestamps or user-defined rules, much like how Git handles merges.

For example, if two devices edit the same task offline, the system can detect conflicts and ask you to choose which version to keep, or automatically merge simple changes.

How Threlmark Handles Concurrency and Sync Without a Central Database
How Threlmark Handles Concurrency and Sync Without a Central Database

How Threlmark’s Structure Facilitates Collaboration and Multi-Device Work

Collaboration becomes straightforward because every device reads and writes the same set of JSON files. No central server or API is needed. Your files are the shared language, and tools like Dropbox or Syncthing keep them in sync.

For example, a team member can add a new feature card on their laptop, and when they save, the file updates. Another team member’s device picks up the change during sync, and the card appears instantly.

This model also respects privacy and security—since data is stored locally, you control exactly what’s shared and when.

The Real Benefits of ‘Disk Is the Contract’ for Reliability and Resilience

When your data’s in plain files, you can back it up, migrate it, or inspect it anytime. If your device goes offline or crashes, your data isn’t lost—just reopen the files and pick up where you left off.

Imagine working on a project while traveling, with no internet. Your files are local, accessible, and ready to go. Once you reconnect, sync merges your changes, and your work continues uninterrupted.

This approach makes apps more resilient—no server downtime or network issues can halt your progress.

The Real Benefits of ‘Disk Is the Contract’ for Reliability and Resilience
The Real Benefits of ‘Disk Is the Contract’ for Reliability and Resilience

Tradeoffs and Why It’s Still Not for Everyone

While the disk-as-contract approach has many perks, it’s not perfect for every scenario. Large datasets can slow down file operations, and conflict resolution can become complex with many concurrent edits.

Imagine a team working on a massive project with thousands of JSON files—performance might suffer. Also, without a central database, enforcing strict data integrity rules gets trickier.

It’s a powerful method for personal projects or small teams, but might need adjustments for enterprise-scale apps.

How to Start Using ‘Disk Is the Contract’ in Your Projects

  1. Design your data as JSON objects stored in files, one per item.
  2. Use atomic write patterns—write to temp files, then rename.
  3. Keep your folder structure simple and consistent.
  4. Implement syncing with tools like Dropbox or Syncthing.
  5. Handle conflicts by timestamps or user prompts.
Start small. Convert a simple app into a file-based setup, then expand from there.

Frequently Asked Questions

What does ‘disk is the contract’ really mean?

It means the on-disk JSON files are the definitive source of truth. All tools, sync, and recovery depend on these files, making the disk the ultimate interface for your data.

How is this different from a normal client-server app?

Instead of relying on a remote database, all data lives locally as files. Syncing happens by copying files between devices, not querying a central server.

Why use JSON on disk instead of a database?

JSON files are simple, readable, and easy to manipulate. They make debugging, backup, and migration straightforward without the complexity of a database system.

How does sync work when devices reconnect?

Changes are merged by comparing files, resolving conflicts with timestamps or rules. Sync tools like Dropbox facilitate seamless updates across devices.

What happens if two devices edit the same file offline?

Threlmark detects conflicts during sync and can prompt you to choose the preferred version or merge simple changes automatically.

Conclusion

In a world dominated by central servers and complex databases, Threlmark’s approach flips the script. By making the disk itself the contract, you gain transparency, resilience, and portability. It’s a simple idea with profound implications for building trustworthy, collaborative apps.

Next time you think about data storage, ask yourself: what if the files on my disk were the only thing I needed? That’s the power—and the promise—of ‘disk is the contract.’

How to Start Using ‘Disk Is the Contract’ in Your Projects
How to Start Using ‘Disk Is the Contract’ in Your Projects
You May Also Like

Pillar‑Cluster Mapping: Your 30‑Day Blueprint to Authority Site Architecture

Create an effective pillar-cluster mapping strategy in just 30 days to boost your site’s authority and SEO—here’s how to get started.

The Smartest Way to Structure a Website for Ads, Affiliates, and Email Growth

Paving the way for website success involves strategic content, seamless ads, and email growth tactics that keep visitors engaged—discover how to do it right.

Why Brand Voice Matters More Than Fancy Design for Small Sites

Ineffective design may catch the eye, but a genuine brand voice builds lasting trust—discover why your words matter more than visuals.