TL;DR

Threlmark’s local-first system treats disk storage as the definitive record, enabling offline work, easy sync, and zero lock-in. This design makes apps faster, more reliable, and easier to extend—no database needed.

Imagine a productivity app that keeps working perfectly—even without internet. No lag, no error messages about server timeouts. That’s the promise of Threlmark’s architecture. It’s built on a simple idea: your disk is the contract. The files on your device aren’t just storage—they’re the single source of truth that drives the entire system.

In this article, you’ll learn how this approach transforms the developer experience, boosts resilience, and enables new kinds of collaboration. For more on local-first architecture, see this detailed overview. We’ll explore what “disk is the contract” really means, how Threlmark uses plain JSON files instead of a database, and why this matters for modern apps that want to work offline and sync seamlessly.

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

external SSD for offline storage

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

JSON file editor for Windows

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

local-first data synchronization tools

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

portable hard drive for developers

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 on-disk JSON files as the single source of truth to simplify development and increase reliability.
  • Use atomic file writes to prevent corruption and race conditions, enabling safe concurrent updates.
  • Design the directory structure to be transparent and portable—backups and sync are just file copies.
  • Implement self-healing logic to automatically reconcile and repair data inconsistencies.
  • Choose this approach for offline-first, collaborative tools where user control and simplicity matter most.

Why ‘Disk Is the Contract’ Means Your App Works Offline and Smarter

‘Disk is the contract’ is a fancy way to say your app’s data lives on your local device’s storage, not hidden behind a server. It means you can keep working—reading, writing, updating—without waiting for a network. Imagine editing a project on a plane, then resuming where you left off once you land. That’s the power of local-first design.

According to Expo’s local-first guide, this approach makes apps faster, more resilient, and simpler to reason about. It removes the fragile layer of server dependency, letting your device be the source of truth. When connectivity returns, syncing is just a matter of reconciling your local files with others.

Why ‘Disk Is the Contract’ Means Your App Works Offline and Smarter
Why ‘Disk Is the Contract’ Means Your App Works Offline and Smarter

How Threlmark Turns Disk Storage into an Instant API

Threlmark’s genius is in its simplicity: the on-disk JSON files are the API. You can learn more about similar architectures in this article. Each card, project, or roadmap is a plain JSON file stored in a well-defined directory structure. When you open your app, it reads these files directly. When you make an update, it writes back to the file system atomically.

This means no server, no database, no complicated sync protocol—just files. For example, every roadmap item lives in items/ as an individual JSON file. The app knows exactly where to find each piece of data, and external tools can read or write files without permission barriers.

The Power of Plain JSON Files and No Database

Using plain JSON files instead of a database might seem odd at first, but it’s a powerful approach discussed in this write-up. But it’s powerful. Files are human-readable, easy to diff, and portable. You can back them up, move them, or sync them with any tool—Dropbox, Syncthing, or even version control.

Threlmark’s architecture relies on each item being a separate JSON file, like individual notes in a notebook. This approach avoids the complexity of traditional databases, reduces lock-in, and makes the data accessible to any language or tool that can read files.

For example, when you want to see what’s changed, you just diff the files. When you want to migrate, you copy the whole folder. This transparency empowers users and developers alike.

The Power of Plain JSON Files and No Database
The Power of Plain JSON Files and No Database

Handling Sync, Conflicts, and Collaboration with Files

Syncing in Threlmark is about keeping files consistent across devices. For a deeper dive into local-first sync strategies, see this article. When updates happen, the system merges changes intelligently, preserving unknown fields and avoiding data loss. Think of it like a friendly editor that combines edits without overwriting each other.

When two devices edit the same card offline, the system detects conflicts and can prompt for resolution or do it automatically based on timestamps. This makes collaboration across devices seamless, even in flaky networks.

For example, you could update a task on your laptop while offline, then see that change reflected on your phone once you reconnect—no manual sync needed.

Why Making Each Item a Single File Boosts Concurrency and Safety

Instead of one big list of cards, each item in Threlmark lives in its own JSON file. This tiny change solves race conditions and makes concurrent editing safe. When you update a card, you’re just overwriting one small file, not the whole project.

Imagine a shared Google Doc—editing different parts simultaneously is easy. The same applies here. Because each file is atomic, multiple tools or devices can update different cards without stepping on each other.

This approach is a big win for reliability. If your system crashes, only a few files might be affected, not the entire data set.

Why Making Each Item a Single File Boosts Concurrency and Safety
Why Making Each Item a Single File Boosts Concurrency and Safety

Self-Healing and Reconciliation: Keeping Your Board in Sync

The lane order and project status are stored separately in JSON files, which are read and reconciled every time you open the app. If a card disappears or a lane gets out of sync, Threlmark automatically heals the data—no manual intervention needed.

For example, if a card was accidentally deleted or moved, the system detects the mismatch between the files and corrects it on the fly. This self-healing makes your data always consistent and trustworthy.

It’s like having an invisible editor who tidies up your workspace every time you look away.

Practical Tips for Building with File-Based Data

If you’re inspired to try this approach, here are some concrete steps:

  1. Design your data as individual JSON files, one per item.
  2. Use atomic write patterns—write to a temp file, then rename—to avoid corruption.
  3. Keep your directory structure predictable, with separate folders for items, reports, and suggestions.
  4. Reconcile stored states on read to handle missing or out-of-sync files.
  5. Leverage diff tools to track changes easily and back up your data.

This pattern scales from small projects to complex apps. Learn more about scalable file-based systems at this resource.

Practical Tips for Building with File-Based Data
Practical Tips for Building with File-Based Data

When Is This Approach a Good Fit—and When Not

Using disk as the contract shines brightest in scenarios where offline resilience, transparency, and simple sync matter. Think personal productivity, solo tools, or small-team collaboration where lock-in is a concern.

It’s less suited for apps requiring real-time updates to thousands of users or complex querying capabilities. Large-scale databases or high-frequency trading apps, for example, still need traditional backends.

For instance, Threlmark is perfect for a multi-project roadmap that you want to keep portable and accessible offline. But if your app needs instant global sync or complex analytics, a server-backed database might be better.

Frequently Asked Questions

What problem does ‘disk is the contract’ solve?

It ensures your app remains usable offline, reduces complexity, and avoids lock-in by making local storage the definitive source of truth.

How is this different from traditional client-server architecture?

Traditional apps rely on a central server or database; ‘disk is the contract’ makes local files the primary data source, enabling offline work and seamless sync.

Why use files instead of a database?

Files are human-readable, portable, and easy to sync with any tool. They also eliminate lock-in and simplify data management.

How do sync and conflict resolution work?

Changes are merged based on timestamps, and conflicts are automatically resolved or flagged, allowing smooth collaboration across devices.

What happens when two devices edit the same data offline?

The system detects conflicts during sync and can merge or prompt for resolution, keeping your data consistent across devices.

Conclusion

In a world obsessed with servers and databases, Threlmark reminds us that simplicity often wins. By making disk the contract, you build apps that are faster, more resilient, and more flexible. It’s about trusting your local device, not a remote database, to be the ultimate keeper of your data.

So next time you design a tool, ask: could the disk be the contract? You might just find it makes everything easier—and more reliable—than you ever imagined.

You May Also Like

When a Content Network Starts Publishing to Itself

Discover what happens when a publishing network begins to publish to its own sites. Learn why this shifts value, creates risks, and how to manage a connected content ecosystem effectively.

Build vs Buy a Prebuilt AI Workstation

Struggling to choose between building or buying an AI workstation? Discover the real costs, benefits, and hidden factors to make the right call in 2026.

QAtrial Launches Enterprise-Ready Open-Source Quality Management Platform

QAtrial releases version 3.0.0, offering Docker deployment, SSO, validation docs, webhooks, and Jira/GitHub integrations under AGPL-3.0 license for regulated industries.

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

Discover how to turn a closet into a killer vocal booth with smart placement, acoustic dampening, and strategic design. Perfect for DIY creators!