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

TL;DR

Threlmark treats the local disk as the main contract, making apps faster, offline-friendly, and more transparent. This approach simplifies data management and boosts collaboration without relying on a central server.

Imagine working on a project where your app responds instantly, even when you’re offline. No lag, no waiting for server responses. That’s the power of Threlmark’s local-first architecture. It’s a radical shift from traditional cloud-based tools, turning the local disk into the contract that holds all your data.

In this deep dive, you’ll see how this simple idea cascades into blazing-fast speed, effortless collaboration, and rock-solid reliability. It’s about more than just storage—it’s a new way to think about data, sync, and how tools should work in today’s multi-device world.

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

offline JSON file storage app

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

local-first data synchronization tool

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

disk-based project 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

Next.js JSON file app

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 local disk as the primary contract—files are the API, not a database.
  • Use atomic file writes to prevent corruption, especially during crashes.
  • Store each item in its own file to avoid race conditions and ease syncing.
  • Design your system to self-heal and reconcile differences automatically.
  • Layer sync and conflict resolution on top of a simple, transparent file structure.

Why the Local Disk Is the Real Boss in Threlmark

In Threlmark, the local disk isn’t just where your data lives—it’s the source of truth. That means every file, every JSON record, is a piece of the app’s brain. When you open Threlmark, it reads from your disk instantly—no waiting for network calls.

This setup makes the app feel snappy and reliable. For example, even if your internet drops, you can keep working. Your data doesn’t vanish. It’s all stored safely on your device, ready to sync later.

This approach is a sharp contrast to cloud apps, which depend on servers constantly communicating with your device. Threlmark’s choice turns the traditional model on its head: the disk is the API, not a remote server.

Why the Local Disk Is the Real Boss in Threlmark
Why the Local Disk Is the Real Boss in Threlmark

How Threlmark’s File Layout Turns Data Into an Open Contract

Threlmark’s folder structure is more like a legal contract than a simple directory. At the top, you find a manifest and dependency graph. Each project lives in its own folder, with one file per card, a lane config, and other metadata.

For example, each roadmap item is a JSON file in `items/`. External suggestions land in `suggestions/`, and handoffs go into `handoffs/`. This setup makes every piece of data an inspectable file—easy to read, change, or back up.

Because everything lives as files, you can sync your entire workspace with Dropbox, git, or Syncthing. No lock-in, no proprietary database. Just copy files, and your data travels with you.

Atomic Writes and Safe Data Handling—No More Trashed Files

Using files as a database sounds risky—what if a crash happens during a write? Threlmark beats this problem with atomic file writes. It writes changes to a temp file, then renames it over the real file. This guarantees that your data is never half-baked.

For example, when you save a card, the app creates `card123.json.tmp`, then moves it to `card123.json` once fully written. If your computer crashes, the file is either untouched or fully updated—never corrupted.

This simple trick keeps your data safe, even on shaky hardware. It’s a proven method used in many high-reliability systems.

Atomic Writes and Safe Data Handling—No More Trashed Files
Atomic Writes and Safe Data Handling—No More Trashed Files

Single File Per Item—Why It’s Better Than Big Lists

Instead of a giant `roadmap.json`, Threlmark stores each card separately. This means updating one card doesn’t risk overwriting the whole list. It’s like having a file for each task, instead of one long document.

Say you move a card from ‘In Progress’ to ‘Done’—you only update one file, not the entire list. This avoids race conditions and makes syncing smoother.

Plus, the system self-heals. When reading the lane order, it checks if all cards are accounted for, fixing any discrepancies automatically. No manual cleanup needed.

Syncing and Conflict Resolution—How Multiple Devices Stay in Line

Syncing in Threlmark is about merging files rather than syncing a database. When devices connect, they compare files and merge changes intelligently. Conflicts are resolved by rules—latest update wins, or prompts for manual fix.

Imagine editing a task on your laptop and your phone. Both files update independently, then sync. Threlmark’s merge logic keeps everything consistent without chaos.

This model handles offline edits gracefully. When your device comes back online, it patches together all the changes, avoiding data loss or corruption.

Syncing and Conflict Resolution—How Multiple Devices Stay in Line
Syncing and Conflict Resolution—How Multiple Devices Stay in Line

Why Speed Feels Lightning-Fast with Local Storage

Local storage cuts out the network lag. Reading and writing JSON files on your disk is instant compared to waiting for remote servers. For example, opening a task list takes milliseconds—not seconds.

This speed boosts productivity. You get immediate feedback, quick edits, and a seamless experience even with hundreds of cards.

It’s like the difference between flipping through a paper notebook and waiting for a web page to load. Threlmark’s architecture makes your work feel natural and effortless.

The Hidden Tradeoffs—What You Sacrifice (And Gain)

Switching to files instead of a database shifts complexity. Instead of managing a server, you handle merge conflicts, file corruption, and sync issues. It’s a different kind of challenge.

For example, conflict resolution can get tricky if two devices edit the same card simultaneously. However, the upside is you gain offline reliability, data ownership, and fewer dependencies.

Tradeoffs are real—sometimes you need custom sync logic or conflict prompts. But for many, the clarity and speed outweigh the extra work.

The Hidden Tradeoffs—What You Sacrifice (And Gain)
The Hidden Tradeoffs—What You Sacrifice (And Gain)

Real-World Benefits: Faster, Safer, More Portable

Threlmark’s local-first architecture isn’t just tech talk. It means faster response times, better offline support, and total control over your data. For instance, a team using Threlmark on laptops, tablets, and even offline, can keep working seamlessly.

It also makes backups and migrations easy. Just copy the folder. No vendor lock-in or complicated database exports.

And when collaboration is layered on, syncing becomes a breeze—no server required. It’s all about making your tools more resilient and flexible.

Key Takeaways for Building Your Own Local-First Apps

  • Treat the disk as the API: Use files as your main data interface.
  • Atomic writes matter: Always write to temp files and rename.
  • One file per item: Avoid race conditions and simplify sync.
  • Self-healing systems: Reconcile state automatically on read.
  • Layer sync on top: Focus on merging and conflict resolution, not storage.

Frequently Asked Questions

What does “Disk is the contract” mean in practice?

It means your app treats files on disk as the single source of truth. Reading, writing, and syncing happen directly through these files, making data transparent, portable, and resilient.

Why choose files or JSON over a database?

Files are simple, inspectable, and portable. They make debugging and migration easier. However, they shift complexity into sync and conflict handling—so it’s a tradeoff, but one that favors offline work and transparency.

How does syncing work when multiple devices edit the same data?

Devices compare and merge JSON files, resolving conflicts via rules like ‘latest update wins.’ Changes are incrementally merged, keeping everything consistent without central servers.

What happens if two devices edit the same item at once?

Threlmark’s system detects conflicts during sync and applies rules or prompts for manual resolution. It’s designed to handle offline edits gracefully, avoiding data loss.

Is local-first architecture better for speed and privacy?

Yes. Local storage provides instant access, and since data stays on your device unless you sync, privacy improves. It also reduces server dependencies, making apps more reliable under network issues.

Conclusion

Thinking of data as a contract on your disk rewires how you build apps—faster, safer, more flexible. It’s not just a technical choice; it’s a mindset shift. When your files are the system, you hold the keys to speed, control, and seamless offline work.

Next time you consider a new tool or architecture, ask yourself: can I make the disk the contract? If so, you’re on your way to a simpler, more resilient future.

Key Takeaways for Building Your Own Local-First Apps
Key Takeaways for Building Your Own Local-First Apps
You May Also Like

After three days here I felt like an Olympic athlete: the Montenegro hotel designed for fitness and wellbeing

A new Montenegro hotel boasts state-of-the-art wellness amenities, attracting the Montenegrin Olympic team and offering luxury health experiences for guests.

The pyramid cracks. What agentic AI does to the consulting leverage model.

Thorsten Meyer AI frames agentic AI as a pressure point for consulting firms built on junior labor leverage.

Holographic Campfires? Futuristic Outdoor Experiences Coming Soon

Discover how holographic campfires are revolutionizing outdoor gatherings with eco-friendly, customizable, and immersive experiences that will transform your adventures.