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

TL;DR

Threlmark’s local-first architecture places files on disk as the primary data source, enabling offline use, easy portability, and conflict-free collaboration. This approach reduces backend complexity and empowers user control.

Imagine working on a project, editing tasks, moving cards, and seeing updates instantly—without a cloud connection. That’s what Threlmark’s local-first approach promises. It flips the usual model—your device’s disk becomes the boss, not a server.

This article reveals how Threlmark’s simple yet powerful design makes local data the core, how it handles concurrency without locks, and why this setup simplifies building resilient, privacy-focused apps. If you’re curious about how putting the disk at the center changes everything, you’re in the right place.

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

portable external SSD drive

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 project management software

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 editor for Windows

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 data synchronization 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 your device’s filesystem as the single source of truth—every change is a file update.
  • Use atomic writes and tolerant merging to keep data safe and consistent, even with interruptions.
  • One file per item simplifies concurrency and conflict resolution, avoiding race conditions.
  • Data portability is natural—just copy or sync your folder. No vendor lock-in.
  • Design for offline, privacy, and resilience by prioritizing local storage as the core.

Why Threlmark’s ‘Disk Is the Contract’ Changes How You Build Apps

At its core, Threlmark treats the local disk as the single source of truth. No server, no cloud database. Files on your device are the record—simple, direct, and reliable.

This means every change is a file update, and the system works offline by default. When you reconnect, syncing is just file copying, merging, and conflict resolution. Think of your device as a miniature database, where the filesystem is the data fabric.

For example, a project’s task card is just items/123.json—more about file-based data management. Updating this file atomically ensures no partial writes. Deleting or editing a card is just replacing that one file. Other tools can read or write any file directly—no API, no lock-in.

Why Threlmark’s ‘Disk Is the Contract’ Changes How You Build Apps
Why Threlmark’s ‘Disk Is the Contract’ Changes How You Build Apps

How Threlmark Keeps Data Safe and Consistent with Files

Threlmark uses two key patterns to keep data safe: atomic writes and tolerant merging.

Atomic writes mean you never overwrite a file directly. Instead, you write to a temp file, then rename it. This guarantees that a crash won’t corrupt your data—either the old or the new file exists, never a half-written mess.

For example, when updating a task, the system creates items/123.json.tmp, writes your changes, then renames it to replace the original. It’s quick, safe, and plays well with interruptions.

On top of that, updates read the current file, merge patches, and preserve important fields like id and createdAt. Unknown fields are kept, so tools can evolve without breaking old files. This forward compatibility keeps your system flexible and future-proof.

One File Per Card: Why It Beats Big JSON Arrays

Many apps cram all tasks into one giant JSON array, but Threlmark does better: one file per item. This tiny shift makes a big difference.

Imagine you’re editing a task. Instead of reading a giant list, you just swap out that one file. No locks, no race conditions. Other tools can add, delete, or update cards at the same time without stepping on each other’s toes.

The self-healing board file, board.json, keeps track of the order of cards in each lane. When read, it reconciles against the actual files—any missing or extra files are automatically corrected. That means your view is always accurate, even if external tools make changes.

This approach makes the system highly concurrent and resilient. External tools or scripts can modify individual cards without risking corruption or conflicts.

One File Per Card: Why It Beats Big JSON Arrays
One File Per Card: Why It Beats Big JSON Arrays

Making Data Portable and Interoperable with Files

Threlmark’s architecture makes your data easy to move—just copy a folder or sync it with your favorite tools.

Because all data lives in plain JSON files, no vendor lock-in exists. You can back up, migrate, or share your entire project by copying a folder, syncing with Dropbox, or using git.

For example, if you switch to a new machine, just clone your folder or copy it over. Everything works exactly the same because the files are the contract.

This openness invites integration. Other tools can read or modify your data by just looking at the files, making collaboration across apps straightforward.

Sync and Conflict? Just Files and Merger Rules

Syncing in Threlmark isn’t about complex protocols. It’s about copying, merging, and reconciling files.

When two devices change the same card, the system compares the files. It uses simple rules: latest update wins, or user-defined merge logic. CRDTs or commit graphs can be layered for advanced conflict resolution, but the core is just file diffing and merging.

For example, if you edit a task on your laptop and your phone simultaneously, the system detects the conflict and applies a merge or prompts for manual resolution. The files themselves become the record of what changed.

This model scales well, is easy to reason about, and reduces hidden complexity common in traditional sync systems.

Sync and Conflict? Just Files and Merger Rules
Sync and Conflict? Just Files and Merger Rules

Privacy and Security: How Local-First Protects Your Data

With Threlmark, your data stays on your device unless you choose to sync. Files are inherently private—no central server storing your secrets.

If you add encryption, it’s end-to-end. Your files are encrypted at rest, and only your keys can decrypt them. This drastically reduces risks of breaches or leaks.

For example, sensitive project notes can stay encrypted locally, and only you hold the keys. When syncing, only encrypted blobs move around, keeping your privacy intact.

This model shifts the security paradigm: from trusting a central provider to controlling your own data security.

Why Developers Love It: Simplifying Backend and State Management

For developers, local-first means fewer backend headaches. No need to build and maintain complex APIs or databases. The app’s state lives in files, and sync happens in background.

This reduces server costs and simplifies deployment. Your app can work offline forever, then sync when online, with minimal code.

For example, Threlmark’s architecture lets you focus on features—local storage handles data safety, while the sync layer manages conflicts or collaboration.

It’s a shift toward lean, resilient apps that shift complexity away from the server and onto the client, which is often easier to test and debug.

Why Developers Love It: Simplifying Backend and State Management
Why Developers Love It: Simplifying Backend and State Management

Real-World Use Cases: From Personal Notes to Collaboration Tools

Many apps already embrace local-first principles—note-taking apps, task managers, even CRMs. Threlmark specifically targets multi-project workflows, making it ideal for solo creators and teams alike.

Imagine a designer working on multiple projects, switching devices, and always seeing the latest tasks—offline, fast, and private. Or a remote team syncing shared cards without a central server, reducing latency and data exposure.

By treating disk as the contract, these solutions stay responsive, resilient, and user-controlled. The architecture adapts from small personal apps to complex collaborative tools.

Tradeoffs and Challenges of Going Local-First

While powerful, local-first isn’t perfect. It can be tricky to handle complex conflict resolution for large-scale multi-user systems. Managing sync conflicts beyond simple rules may require extra tools like CRDTs or custom merge logic.

Performance can suffer if files get huge or the number of items skyrockets. Also, initial setup might seem daunting—understanding the file contract and ensuring atomic operations take discipline.

However, many of these challenges are manageable with good patterns and tooling, like Threlmark’s approach to self-healing and safe file writes.

Tradeoffs and Challenges of Going Local-First
Tradeoffs and Challenges of Going Local-First

Tools and Frameworks Supporting Local-First Architecture

Platforms like Threlmark [https://github.com/MeyerThorsten/threlmark] make adopting local-first straightforward. They provide patterns for file atomicity, conflict resolution, and data structure design.

Other tools include CRDT libraries, sync frameworks, and even cloud storage solutions that integrate seamlessly with local-first principles. Expo’s local-first guidance shows how mobile apps can benefit too.

Choosing the right tool depends on your project size, collaboration needs, and privacy requirements. But the core idea remains: treat your disk as the contract, and build from there.

The Future of Local-First: More Than Just Offline

Local-first isn’t just about working offline. It’s about giving users control, reducing backend dependency, and building resilient systems that last.

Thinking like this means apps can survive outages, hardware failures, or even shutdowns of the service provider. Your data stays with you, portable and safe.

As sync tech matures, expect more seamless multi-device experiences, better conflict resolution, and tighter privacy guarantees. The architecture is evolving from a niche to the mainstream.

Frequently Asked Questions

What exactly does ‘disk as the contract’ mean?

It means your app treats files on disk as the authoritative record of data. Changes happen directly to files, and all tools read/write those files without a central server. It simplifies sync, conflict resolution, and data ownership.

How does Threlmark handle conflicts when two devices edit the same card?

Threlmark compares file timestamps and applies simple rules—latest wins or manual merge. Advanced conflict resolution can involve CRDTs or commit graphs, but the core is just diffing and merging files.

Can I move my data easily if I switch devices or stop using Threlmark?

Absolutely. Because all data lives in plain JSON files, you can just copy the folder, sync it with Dropbox, or migrate with git. No vendor lock-in, no proprietary database.

Is local-first architecture suitable for large multi-user apps?

It can be, but it requires careful conflict management and possibly CRDTs for real-time collaboration. For small to medium teams, it offers great resilience and control.

What are the main challenges of building a local-first app?

Handling complex sync conflicts, managing large data sets, and ensuring user-friendly conflict resolution can be tricky. But with patterns like atomic file writes and self-healing, these challenges are manageable.

Conclusion

Threlmark’s approach proves that disk is more than just storage—it’s the contract that keeps your data safe, portable, and conflict-free. By making local storage the heart of your app, you build systems that are resilient, user-controlled, and ready for the future.

Next time you think about data architecture, remember: simplicity and directness often lead to the most powerful solutions. Your device can be the most trustworthy partner—if you let it.

The Future of Local-First: More Than Just Offline
The Future of Local-First: More Than Just Offline
You May Also Like

Synthetic Biology: Engineering Life for Industry

Discover how synthetic biology is transforming industries by engineering life, opening doors to endless possibilities you won’t want to miss.

Immersive Technologies: VR, AR, and XR

Fascinating immersive technologies like VR, AR, and XR are revolutionizing experiences—discover how they could transform your world.

Cybersecurity Mesh Architecture: Protecting Data

Just when you think your security is solid, Cybersecurity Mesh Architecture reveals how to adapt and stay protected—discover the key strategies now.

Quantum‑Safe Encryption Sounds Futuristic—Here’s Why You Need It By Series A

Never underestimate the threat of quantum computers—discover why early adoption of quantum-safe encryption is essential for your company’s future security.