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

TL;DR

Threlmark’s architecture treats local files as the primary data source, enabling offline work, easy portability, and seamless sync. It’s a practical shift from server-centric design, leveraging JSON files as the contract for all data.

Imagine a project tool that works perfectly offline, never relies on a server, and makes your data as portable as a USB stick. That’s the core idea behind Threlmark’s local-first architecture. It’s a radical shift—treating the local disk as the contract, not a cloud or database.

This approach transforms how you think about data, flow, and collaboration. And it’s not just theory. It’s a practical, resilient way to build apps that work everywhere, all the time.

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

USB flash drives for data portability

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

offline data synchronization 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

JSON file management software

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

local-first project management tools

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 local filesystem as the primary data source, not a remote server.
  • Use atomic file writes and JSON files for safe, portable, and conflict-resilient data.
  • Design your app to read, write, and merge files directly to simplify offline support.
  • Sync is just copying files—no complicated database locking needed.
  • Ideal for small to medium projects that benefit from offline resilience and simplicity.

What Does ‘Disk Is the Contract’ Actually Mean?

At its heart, ‘disk is the contract’ means the app’s behavior and data integrity depend on files stored on your local filesystem. Instead of a server holding the source of truth, your files are the source—every read, write, and sync is driven by these files.

For example, Threlmark uses plain JSON files that represent project boards, cards, and dependencies. When you open your app, it reads those files directly, making the data instantly accessible, even offline.

This approach shifts the entire model from a cloud-first mindset to a local-first architecture. Your data lives on disk, and everything else is just a way to view or sync that data.

Understanding this is crucial because it emphasizes that the core data is stored in a format that is both human-readable and easily manipulated by a wide range of tools. This flexibility allows for better control, transparency, and resilience, but it also requires developers to think differently about data consistency and versioning. The tradeoff is that you need to manage conflict resolution and synchronization explicitly, rather than relying on a database engine to handle these complexities for you.

What Does ‘Disk Is the Contract’ Actually Mean?
What Does ‘Disk Is the Contract’ Actually Mean?

How Threlmark Uses JSON Files to Keep Data Safe and Portable

Threlmark organizes all data into individual JSON files stored on disk. You can learn more about similar architectures in this article. Each project, card, or link gets its own file under a structured folder hierarchy. For example, each card lives in items/, making it easy to update or replace without touching the rest.

This structure offers four clear benefits, similar to those discussed in this overview:

  • Inspectability: You can open files with any editor and see the data directly.
  • Portability: Moving or copying files is enough to back up or migrate your data.
  • Interoperability: Any tool can join in—just read/write files in the same format.
  • Restartability: No in-memory state to lose; the system always reads from disk.

But beyond these benefits, this approach fundamentally changes how data is managed and perceived, as explored in this analysis. Because each piece of data is isolated, developers can easily track changes, revert to previous states, or integrate with external tools without complex database migrations or vendor lock-in. However, this also means that consistency depends heavily on disciplined file management and conflict resolution strategies during sync. The tradeoff is that while this system is simple and robust for small to medium datasets, scaling to large datasets or highly concurrent environments requires careful planning and additional mechanisms to handle conflicts and ensure data integrity.

Designing for Offline Resilience and Data Integrity

Building on the idea of storing data in JSON files, it’s essential to design your app with offline resilience in mind. For more on offline data strategies, see this resource. This means implementing atomic file operations to prevent corruption during writes and ensuring that your app can handle partial or failed syncs gracefully.

For example, using temporary files during save operations ensures that incomplete writes don’t corrupt your data. Additionally, maintaining versioning within your JSON files or using timestamps can help detect conflicts early and facilitate effective merging strategies.

By thinking carefully about these aspects from the start, you can create a system that remains reliable even when offline or facing network interruptions. This requires a disciplined approach to file management and conflict resolution but results in a highly resilient application that can operate seamlessly in diverse environments.

Designing for Offline Resilience and Data Integrity
Designing for Offline Resilience and Data Integrity

How Threlmark Uses JSON Files to Keep Data Safe and Portable

Threlmark organizes all data into individual JSON files stored on disk. Each project, card, or link gets its own file under a structured folder hierarchy. For example, each card lives in items/, making it easy to update or replace without touching the rest.

This structure offers four clear benefits:

  • Inspectability: You can open files with any editor and see the data directly.
  • Portability: Moving or copying files is enough to back up or migrate your data.
  • Interoperability: Any tool can join in—just read/write files in the same format.
  • Restartability: No in-memory state to lose; the system always reads from disk.

But beyond these benefits, this approach fundamentally changes how data is managed and perceived. Because each piece of data is isolated, developers can easily track changes, revert to previous states, or integrate with external tools without complex database migrations or vendor lock-in. However, this also means that consistency depends heavily on disciplined file management and conflict resolution strategies during sync. The tradeoff is that while this system is simple and robust for small to medium datasets, scaling to large datasets or highly concurrent environments requires careful planning and additional mechanisms to handle conflicts and ensure data integrity.

Frequently Asked Questions

How does ‘disk is the contract’ improve offline work?

Because your data lives directly on disk as JSON files, you can access and edit it anytime, anywhere. No need for a server or internet connection—your files are your truth.

How do conflicts get resolved when two devices edit the same data?

Threlmark compares file versions and merges changes based on timestamps or priorities. Conflicts can be auto-resolved or prompted for manual review, just like merging two notes.

Is this approach suitable for large-scale, real-time apps?

It’s best for small to medium projects. Large apps with many users or real-time collaboration might need more complex sync solutions or hybrid models, but for personal or team apps, it’s a perfect fit.

What about schema changes in my JSON files?

Schema migrations require careful planning—updating old files to new formats can be manual or scripted. The key is to version your files and handle migration gracefully, understanding that schema evolution is a tradeoff in this approach.

How secure is storing data as JSON files on my disk?

Security depends on your disk encryption and access controls. Files stored locally are only as safe as your device protection—consider encryption for sensitive data, and be aware that managing security is a tradeoff for simplicity and control.

Conclusion

Adopting a ‘disk is the contract’ mindset flips the traditional app model on its head. Data stored directly on your disk becomes the single source of truth—robust, portable, and ready for offline work.

It’s a straightforward idea with powerful results: simpler code, better resilience, and total control. Imagine a future where your tools keep working, no matter the network. That’s the promise of local-first architecture.

You May Also Like

.NET (OK, C#) gets union types

C# 15 in .NET 11 preview adds support for union types, enabling safer handling of multiple data types. This marks a significant feature expansion.

Launch HN: Superset (YC P26) – IDE for the agents era

Superset (YC P26) introduces an IDE designed for managing multiple CLI-based coding agents simultaneously, enhancing productivity in the agents era.

Electric Pressure Washer Guide: PSI vs GPM and Safe Patio Cleaning

Brilliantly understanding PSI and GPM is crucial for safe patio cleaning, but mastering their balance can be tricky—keep reading to discover how.

Impact Driver vs Drill: When You Need Each (and What Bits to Buy)

Between impact drivers and drills, understanding their differences and the right bits to use can transform your project—discover which tool is best for your needs.