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

TL;DR

Threlmark’s architecture centers on using disk-stored JSON files as the source of truth. This approach makes data portable, safe, and easy to sync, avoiding the complexity of databases. It’s a smart move for local-first apps that need reliability and flexibility.

Imagine a project management tool that works offline, stores every piece of data as plain files, and never needs a server. That’s the promise behind Threlmark’s mission — and it’s more than just a gimmick. Disk is the contract. It’s a shift in how we think about managing data, moving from cloud-centric databases to a simple, resilient disk-based system.

What makes this approach so compelling? It’s the core idea that the disk isn’t just a place to save data — it’s the contract. Every file, every folder, every JSON snapshot forms the living record of your work. No lock-in, no complex sync protocols, just straightforward file operations.

In this article, I’ll walk you through how Threlmark’s local-first architecture works, why it’s powerful, and what it means for your projects.

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 JSON file editor

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

portable disk storage for JSON files

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
Contemporary Project Management (MindTap Course List)

Contemporary Project Management (MindTap Course List)

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
MOBILE OFFLINE-FIRST APPLICATION DESIGN: Local persistence sync strategies and resilient connectivity handling

MOBILE OFFLINE-FIRST APPLICATION DESIGN: Local persistence sync strategies and resilient connectivity handling

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

  • Using the disk as the contract makes your data portable, inspectable, and safe from cloud dependencies.
  • Atomic file writes and tolerant merge updates prevent corruption and support forward compatibility.
  • Small, individual JSON files facilitate conflict resolution, offline work, and multi-device sync.
  • A folder-based structure simplifies backups, migrations, and external integrations.
  • While powerful, this approach requires good conflict handling and security practices for larger or sensitive projects.

What Does ‘Disk Is the Contract’ Actually Mean?

“Disk is the contract” means that all the data’s truth lives in files on your local disk, not in a remote database. When you open Threlmark, it reads from a set of JSON files, and that’s where the entire state lives. It’s like your project’s notebook — every note, task, and link stored as a plain text file.

For example, when you update a task, Threlmark writes a new JSON file for that card. The next time you open the app, it reads that file, sees the latest info, and displays it. If you copy that file somewhere else, you’ve basically moved or shared that piece of your project.

This approach makes data transparent, easy to back up, and simple to move around.

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

Why Threlmark Prefers Files Over Databases

Threlmark chooses files instead of a database because files are inherently portable and inspectable. Unlike a cloud database, files can be copied, backed up, and inspected without special tools. You can open a JSON file in any editor, see exactly what it contains, and trust it’s accurate.

Let’s compare: a database hides your data behind a service, making it harder to see or move. Files, on the other hand, are just plain text that you can manipulate with your tools of choice.

FeatureDatabaseFiles
PortabilityRequires export/import or sync toolsCopy files directly
InspectabilityRequires special tools or UIOpen in any text editor
Lock-inHigh, depends on providerLow, just files

How Threlmark Keeps Data Safe and Consistent with Files

Storing data in files sounds risky, but Threlmark uses two key techniques to stay safe: atomic writes and tolerant merge updates.

Atomic writes mean that every change writes to a temporary file first, then renames it. This avoids corrupting data if your system crashes halfway through. For example, when you save a task, the app writes to `task123.json.tmp` and then renames it to `task123.json`. It’s like sealing a letter before dropping it in the mailbox.

Merge updates mean that when reading a file, Threlmark merges changes instead of overwriting blindly. It keeps track of metadata like `createdAt` and updates `updatedAt`, and it preserves unknown fields. This makes it easy to add new features without breaking older tools and ensures data integrity over time.

How Threlmark Keeps Data Safe and Consistent with Files
How Threlmark Keeps Data Safe and Consistent with Files

How the File Structure Supports Collaboration and Sync

Threlmark’s architecture divides data into many small JSON files, each representing a separate card or project. Every file lives in a dedicated folder, like `items/`, `shared/items/`, or `archive/`. When a team member updates a task, they just overwrite the individual JSON file.

Syncing happens by copying or syncing the entire folder structure. Learn more about Threlmark’s local-first architecture. Because each file is atomic, conflicts are easy to spot — just check which files changed. For example, if two people edit the same task, the last save wins, but you can also manually compare the JSON files to resolve conflicts.

This structure promotes collaboration across devices or even offline work, because everything is stored locally, and sync is just file transfer.

The Real Benefits of a Disk-Based, Local-First System

Choosing disk as the contract yields several clear advantages:

  • Portability: Copy your project folder anywhere—Dropbox, USB, another device—and pick up where you left off.
  • Transparency: Open files directly to see exactly what data is stored, no hidden layers.
  • Resilience: No server downtime or network issues block your work. You stay productive offline.
  • Security: Your data stays on your device unless you choose to sync or share.
These benefits make Threlmark ideal for teams that prioritize control, safety, and flexibility.

The Real Benefits of a Disk-Based, Local-First System
The Real Benefits of a Disk-Based, Local-First System

What Limitations Should You Know About This Approach?

While this design has many perks, it’s not perfect for every scenario. Large projects can make file management cumbersome, and syncing conflicts might get tricky if many devices edit the same file simultaneously. Also, security depends on how well you protect your local files.

For example, if you’re working with a team spread across multiple continents, conflicts might increase, and you’ll need robust sync tools. Plus, without encryption, local files could be vulnerable if someone gains access to your device.

Understanding these limits helps you decide if a disk-based, local-first system suits your project’s scale and security needs.

Practical Tips for Building Your Own File-Based App

If you want to adopt a similar approach, here are quick tips:

  1. Use atomic write techniques—write to a temp file, then rename.
  2. Keep each data item in its own JSON file for easy updates.
  3. Design your folder structure to separate active, shared, and archived data.
  4. Merge updates carefully—preserve metadata and unknown fields.
  5. Test conflict scenarios early, especially if multiple devices or users will edit files.
These practices will keep your local-first app reliable, maintainable, and easy to scale.

Frequently Asked Questions

What does ‘disk is the contract’ really mean?

It means all your project data lives in files on your local disk. These files are the single source of truth, making your data transparent, portable, and easy to manage without relying on a remote server.

Why choose files over a database for my app?

Files are inherently portable and inspectable. You can copy, back up, and modify them directly. This reduces lock-in and simplifies syncing and troubleshooting, especially for local-first workflows.

How does Threlmark handle conflicts when multiple devices edit the same file?

Threlmark uses small, atomic JSON files so conflicts are easy to detect. When conflicts happen, you compare the files manually or set rules to resolve which change wins, making conflict management straightforward.

Can I still work offline with this system?

Absolutely. Since all data is stored locally as files, you can read, edit, and save your work without any network connection. Sync happens later when you’re online.

Is this approach secure for sensitive data?

Data security depends on how you protect your files. Since everything lives on your device, you control access. But if you sync or share, consider encryption to keep sensitive info safe.

Conclusion

Threlmark shows that the simplest idea — the disk is the contract — can lead to a flexible, resilient, and transparent system. It’s a reminder that sometimes, going back to plain files offers the most control and peace of mind.

If you want a project management system that’s easy to back up, move, and understand, this approach is worth considering. Embrace the power of the file, and your data becomes a true, portable asset, not just a cloud token.

Practical Tips for Building Your Own File-Based App
Practical Tips for Building Your Own File-Based App
You May Also Like

Fashion in 2025: Sustainability Vs Fast Fashion on the Global Stage

Will you discover how fashion’s future balances sustainability and fast fashion on the global stage, shaping your choices and the planet’s future?

BRICS+ Rising: How New Members Are Shifting Global Economics

With new members joining BRICS+, the global economic balance is shifting—discover how this transformation could redefine international power dynamics.

Why Desk Stability Matters More Than Fancy Features

Inevitably, a stable desk ensures better posture and health, making it the most crucial factor beyond just fancy features—find out why.

Portable Monitor or Bigger Laptop? The Travel Productivity Dilemma

If you’re often traveling, a portable monitor boosts your workspace without adding…