TL;DR

Threlmark’s local-first architecture relies on local disk storage as the main data source, enabling offline use, easy sync, and data ownership. It simplifies development and boosts resilience by avoiding central servers and making files the contract.

Imagine working on a project, offline, on your laptop. When you get back online, everything syncs seamlessly, as if magic. That’s the power of Threlmark’s local-first architecture — a radical shift from the cloud-centric model most apps follow.

Instead of relying on a central server, it treats your device’s disk as the single source of truth. This simple idea unlocks a wave of benefits: offline resilience, privacy, and developer simplicity. Today, I’ll walk you through how it works, why it’s a game-changer, and what makes it tick.

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
SANDISK 1TB Extreme Portable SSD (Old Model) - Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware - External Solid State Drive - SDSSDE61-1T00-G25

SANDISK 1TB Extreme Portable SSD (Old Model) – Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware – External Solid State Drive – SDSSDE61-1T00-G25

Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity…

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
Seagate One Touch 8TB External Hard Drive Desktop HDD - USB-C Compatible with Most Windows and macOS, Rescue Recovery (STNB8000400)

Seagate One Touch 8TB External Hard Drive Desktop HDD – USB-C Compatible with Most Windows and macOS, Rescue Recovery (STNB8000400)

No wall warts: Work freely with its bus-powered USB-C. No wall outlet required.

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 storage device

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
NEWQ 2TB External Hard Drive for iPhone, USB-C & Lightning Compatible Photo Storage Device, One-Click Backup Photos/Videos to Free Up Phone Space, Offline Transmission Support, No Computer Required

NEWQ 2TB External Hard Drive for iPhone, USB-C & Lightning Compatible Photo Storage Device, One-Click Backup Photos/Videos to Free Up Phone Space, Offline Transmission Support, No Computer Required

2TB Large Capacity One-Click Backup, Instantly Free Up Your Phone Storage: Running out of phone storage often forces…

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 disk as the ultimate source of truth, making data resilient and portable.
  • Use atomic file writes and tolerant merging to keep data safe during crashes and updates.
  • Design your app’s architecture around a simple, predictable file structure for transparency and ease.
  • Conflict resolution strategies like CRDTs are essential for multi-device sync, even offline.
  • Building with files reduces backend complexity and boosts privacy, control, and longevity.

What Does ‘Disk Is the Contract’ Really Mean?

At its core, ‘disk is the contract’ means your device’s storage holds the definitive version of your data. Unlike traditional apps that keep data in the cloud, this system treats local files as the source of truth. When you open Threlmark, it reads from your disk directly, and all changes happen there first.

For example, if you’re working on a task list, the data lives in JSON files on your machine. When you mark something as done, it writes directly to that file. No server needed. That file is the record everyone trusts — not a remote database or API.

This approach flips the usual model — instead of pushing data to a server and pulling it back, the device’s storage becomes the main hub, and sync happens in the background.

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

How Threlmark’s Local-First Design Outshines Cloud Apps

Traditional cloud apps rely on servers to store and manage data. Your device acts as a thin client, constantly syncing with the cloud. Threlmark, however, puts the disk front and center. Your device’s local files are always up-to-date and authoritative.

Take a real-world scenario: you’re on a plane with no internet. You add a new card to your project. Threlmark writes it instantly to your disk, no lag, no fuss. When you land and reconnect, it syncs with the cloud—automatically and smoothly.

Here’s a quick comparison:

The Mechanics of Sync and Conflict Resolution

Syncing in Threlmark is like a gentle dance—background, automatic, and conflict-aware. The core idea: each device maintains its own set of JSON files. When connected, they reconcile changes using deterministic merge rules.

If two devices edit the same card offline, the system uses conflict-resolution strategies like last-write-wins or CRDTs to merge differences. It’s like two chefs adding ingredients separately—when they come together, the dish still tastes right.

For example, if one device marks a card as ‘done’ and another changes its priority, the system intelligently merges these updates, ensuring all devices converge on the same state without data loss.

The Mechanics of Sync and Conflict Resolution
The Mechanics of Sync and Conflict Resolution

Benefits for You and Your Development Team

Using disk as the contract isn’t just a fancy tech trick — it offers real benefits. For users, it means offline access, better privacy, and control over data. For developers, it simplifies the backend, reduces server costs, and makes the app more resilient.

Imagine a team collaborating on a shared project. Each member’s device keeps a local copy. Changes are merged seamlessly, even if someone’s offline for days. When back online, everything syncs without conflict.

It also means fewer surprises: data persists even if the company behind the app vanishes. Your files stay on your device, always accessible.

Building with Files: The Secrets Behind Threlmark’s Architecture

Threlmark organizes data into a simple, predictable file structure. At the root, you find a manifest (`threlmark.json`) and dependency graph (`links.json`). Each project has its folder with metadata, lanes, and a file per card under `items/`. External suggestions land in `suggestions/`, and reports go into `reports/`.

This setup makes it easy to inspect, migrate, or sync data. For instance, if you want to back up your roadmap, just copy the entire folder. Want to add a new project? Drop a new folder with a `project.json`. All files are human-readable and editable, making the system transparent and resilient.

Building with Files: The Secrets Behind Threlmark’s Architecture
Building with Files: The Secrets Behind Threlmark’s Architecture

Ensuring Safety with Atomic Writes and Tolerant Merging

Writing to files safely is crucial. Threlmark uses atomic writes — writing to a temp file then renaming — avoiding corruption during crashes. It also reads, merges, and writes back data carefully, preserving important fields and tolerating unknown keys.

For example, if a crash happens mid-write, your data stays consistent. The system’s merge logic means you can add new fields or change existing ones without breaking older tools.

This disciplined approach guarantees your data remains reliable, even in unexpected situations.

Why This Approach Simplifies Developer Life

Building with files rather than a database sounds simple — and it is. You can learn more about this approach at nanomachines.net. It removes the need for complex server-side logic, reduces backend costs, and makes your app more flexible.

Developers can focus on the core features, knowing that the data is portable and easily mergeable. Plus, debugging becomes easier — just inspect the JSON files.

For example, you can host the entire app on a static host and still have real-time sync, simply by watching files and running background sync tasks. Check out tools for QA and testing to help with development.

Why This Approach Simplifies Developer Life
Why This Approach Simplifies Developer Life

Common Misconceptions and Real-World Trade-Offs

Some think local-first apps can’t handle real-time collaboration or large datasets. But with conflict-resolution strategies like CRDTs and optimized sync, they can. Still, trade-offs exist.

For instance, conflict resolution adds complexity, and large files can slow down sync. Also, some apps might need server-side logic for compliance or heavy data processing.

Threlmark’s approach is best suited for small to medium projects, where offline use and data ownership matter most.

Getting Started: Tools and Patterns for Local-First Development

If you’re inspired to build or upgrade your app with local-first principles, start with these tools:

  • File-based storage with atomic write techniques.
  • Conflict resolution strategies like CRDTs or deterministic merges.
  • Background sync scripts that run when online.
  • Version control or diff tools for human-readable data.
  • Use a library like Threlmark for structuring your local-first app.ed file management.

Follow a pattern: local database + background sync + conflict resolution. This combo is the backbone of resilient, offline-capable apps.

Frequently Asked Questions

What does ‘local-first’ actually mean?

Local-first means your device’s storage is the primary source of data, with sync happening in the background. It prioritizes offline access, data ownership, and resilience over relying on remote servers.

How is local-first different from offline-first or cloud-first?

Offline-first apps can work without internet, but still rely on a cloud for sync. Cloud-first apps depend on remote servers for everything. Local-first treats disk as the source of truth, with optional sync, making it more resilient and private.

How do devices sync changes when offline?

Devices keep local copies and use conflict resolution strategies like CRDTs or deterministic merge rules. When reconnected, they reconcile differences automatically, ensuring everyone sees the same data.

Is local-first secure and private?

Yes. Data stays on your device unless you choose to sync or share. End-to-end encryption can be added, and the system reduces reliance on third-party servers, boosting privacy.

Can local-first support real-time collaboration?

It can, with conflict-resolution mechanisms. While not as instant as cloud-based systems, well-designed local-first apps can offer near-real-time sync, especially for small to medium projects.

Conclusion

Embracing the idea that disk is the contract turns your device into the ultimate data hub. It’s a clear, simple principle that unlocks offline resilience, privacy, and developer freedom. When you treat files as the source of truth, you build apps that are more robust, portable, and respectful of user ownership.

Imagine a future where your data stays with you, no matter what happens to cloud services. That’s the promise of Threlmark’s local-first architecture — a quiet revolution in how we build and use software.

Getting Started: Tools and Patterns for Local-First Development
Getting Started: Tools and Patterns for Local-First Development
You May Also Like

Best Form Plugins for WordPress in 2026: A Practical Comparison

Discover the top WordPress form plugins in 2026. Compare features, pricing, ease of use, and see which one fits your needs today.

Build vs Buy a Prebuilt AI Workstation

Deciding whether to build or buy your AI workstation? Discover the real costs, performance, and control factors that matter most today.

How Multi-Step Forms Increase Completion Rates by 3x

Discover how breaking forms into steps triples completion rates. Practical tips, real examples, and design secrets to turn visitors into leads.

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

Learn how to turn your tiny closet into a professional-sounding recording space with smart placement, absorption, and the ‘rig in the closet’ setup. Practical tips included!