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

TL;DR

Threlmark treats disk storage as the ultimate contract, making data portable, safe, and accessible without a central server. This approach boosts offline reliability, simplifies collaboration, and enables AI-driven workflows.

Imagine a project management tool that works perfectly offline, never loses data, and plays nice with any external tool you throw at it. That’s what Threlmark is doing. Its secret? It treats disk storage not just as a place to save data, but as the source of truth itself.

This approach might sound simple, but it flips traditional app architecture on its head. Instead of a server, database, or cloud dictating your data, your entire system relies on a well-organized set of files on your local disk. Ready to see how this works and why it might just change your view of data management? Let’s dive in.

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

local storage data management software

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 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 based data storage solutions

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

disk-based data backup and synchronization

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 disk storage as the ultimate source of truth—every file is part of the contract.
  • Use atomic writes and read-merge patterns to keep data safe and forward-compatible.
  • Separate each item into its own file to prevent race conditions and simplify concurrency.
  • Sync by copying files—no server needed—making offline work seamless and resilient.
  • This approach suits personal projects or small teams better than large-scale, real-time apps.

Why Threlmark’s ‘Disk Is the Contract’ Changes Everything

In most apps, the database or server is the ultimate authority. Threlmark says, no. The files on your disk are the real contract. When you open Threlmark, it reads from a folder full of JSON files—each card, project, or link is a separate file. This simple shift means your data is always accessible, portable, and safe from server outages.

For example, if you copy the entire folder onto another machine, Threlmark works just as well. No database migration or cloud sync needed. It’s like carrying your entire project management system on a USB stick—ready to run anywhere.

Why Threlmark’s ‘Disk Is the Contract’ Changes Everything
Why Threlmark’s ‘Disk Is the Contract’ Changes Everything

Threlmark’s on-disk structure is more than just a file system—it’s a contract. The root contains a manifest (`threlmark.json`) and links (`links.json`). Each project has its own folder with metadata (`project.json`), lane info (`board.json`), and individual cards (`items/.json`). External suggestions go into `suggestions/`, reports into `reports/`, and shared items are stored in a dedicated folder.

This layout guarantees that every file is inspectable, portable, and interoperable. You can open, edit, or move files without breaking the system—because everything is just files. This makes backups trivial, integrations seamless, and migrations a breeze.

Making File-Based State Safe and Sound

Handling files safely sounds tricky—crashes, partial writes, corruption. Threlmark solves this with two simple patterns. First, **atomic writes**: updates go to a temporary file, then rename() to replace the original. This guarantees no half-written files, even if your system crashes mid-save.

Second, **read-merge-write**: when updating, Threlmark reads the current file, merges changes (preserving IDs and timestamps), and writes atomically again. Plus, it tolerates unknown fields, making the system flexible and future-proof.

Making File-Based State Safe and Sound
Making File-Based State Safe and Sound

One File Per Card: How Threlmark Handles Concurrency

Ever tried updating a giant JSON array? Race conditions. Threlmark’s trick: one file per item. Each card lives in its own `.json`. When an external tool updates a card, it only touches that one file—no conflicts with others.

The folder `items/` holds all cards. The `board.json` manages lane order, but it’s reconciled every time it’s read. If a card is missing, the board heals itself. This design keeps concurrent updates safe and simple.

How Threlmark Synchronizes Without a Server

Threlmark’s sync model is simple—since all data lives on disk, syncing means copying files. When connected to another device, you just copy the entire folder, or sync via Dropbox, Syncthing, or git. Conflicts are handled with the same principles: last write wins or manual merge.

This local-first approach means you can work offline for weeks and still get everything synchronized later. No waiting for server responses, no complicated conflict resolution algorithms. Just straightforward file copying.

How Threlmark Synchronizes Without a Server
How Threlmark Synchronizes Without a Server

Real-World Benefits: Speed, Resilience, and Flexibility

Think about editing a project on a train—no internet needed. Changes are instant, because they’re just local file edits. When you reconnect, files sync with your team or cloud service, updating everyone seamlessly.

And if your device crashes? No problem. The data is safe on disk. You can recover or migrate your entire project in minutes by copying files. It’s like having a portable, resilient project database in your pocket.

Tradeoffs and When Not to Use This Approach

While simple and resilient, this model isn’t perfect for every case. Large-scale apps requiring real-time collaboration or complex querying might struggle. The approach works best for personal projects, small teams, or scenarios where offline access is critical.

For instance, a SaaS app with millions of users or needing instant updates across thousands of devices might need a more traditional client-server setup.

Tradeoffs and When Not to Use This Approach
Tradeoffs and When Not to Use This Approach

Developer’s Guide: Building with Files, Not Databases

If you want to replicate Threlmark, start with a solid file structure. Use atomic write patterns, keep each entity in its own file, and handle conflicts with read-merge logic. These steps create a system that’s robust, portable, and easy to test.

Check out the [Threlmark GitHub repository](https://github.com/MeyerThorsten/threlmark) for code examples and detailed patterns. Your next app could benefit from this straightforward, resilient approach.

The Future of Local-First: Why It Matters More Than Ever

As connectivity becomes more unreliable and privacy concerns grow, local-first systems like Threlmark are gaining momentum. They promise fast, reliable, and private data handling—no cloud needed.

Imagine managing multiple projects, all stored safely on your device, yet still connected and synchronized with a few clicks. That’s the power of treating disk as the contract—simple, reliable, and future-proof.

Frequently Asked Questions

How does Threlmark handle conflict resolution when multiple devices edit the same card?

Threlmark uses a read-merge approach, preserving IDs and timestamps. When conflicts occur, later writes overwrite earlier ones, but you can implement simple manual merge strategies or more sophisticated conflict resolution if needed.

Can I use Threlmark with cloud sync services like Dropbox or Syncthing?

Absolutely. Threlmark’s file-based system is compatible with any sync service. Just point your cloud folder to your data directory, and your data will stay in sync across devices, with conflicts resolved by your chosen method.

Is this architecture suitable for large teams or real-time collaboration?

For large-scale, real-time apps, this approach might face challenges. While excellent for personal use or small teams, bigger projects often require more complex, server-based solutions for instant updates and querying.

What happens if I lose my device or delete the data folder?

Since all data lives in files, losing the folder means losing everything. Regular backups or external syncing are essential. But restoring is as simple as copying your backup back into place.

Are there existing tools or frameworks that support this kind of architecture?

Yes. Many systems, like GlusterFS for storage, treat disks as the core. For apps, using plain files with atomic operations and careful conflict handling is becoming more popular, especially among offline-first and local-first advocates.

Conclusion

Threlmark’s ‘disk is the contract’ idea isn’t just a technical quirk; it’s a fundamental shift in how we think about data. When storage becomes the entire system’s backbone, everything gets simpler, safer, and more portable.

Next time you build a tool or manage a project, ask yourself: can I make disk my contract? If yes, you’re stepping into a future where your data works for you—offline, everywhere, forever.

The Future of Local-First: Why It Matters More Than Ever
The Future of Local-First: Why It Matters More Than Ever

You May Also Like

Blockchain Technology: A Beginner’s Guide

Discover how blockchain technology is revolutionizing data security and transparency, and why understanding it is essential for the future.

Augmented Reality in Everyday Life: From Shopping to Education

Breathe new life into your daily routines with Augmented Reality, as it revolutionizes shopping and education—discover the endless possibilities that await you.

Energy Experts Warn AI Growth Could Outpace U.S. Electricity Supply

Many energy experts warn AI’s rapid expansion risks overwhelming U.S. power grids, raising urgent questions about infrastructure and environmental impacts.

Enterprise Power Shifts as Big Tech Deploys Armies of Intelligent Agents.

Ontario’s enterprise landscape is transforming as Big Tech deploys armies of intelligent agents—discover how this shift could redefine your industry.