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

TL;DR

Threlmark’s architecture treats the disk as the primary contract, making data portable, safe, and easily synchronized. This approach boosts offline resilience and simplifies multi-device workflows without relying on a central server.

Imagine a project tool that doesn’t rely on a cloud or a server. It’s all on your disk. It’s all on your disk. That’s the core idea behind Threlmark’s local-first architecture. Instead of storing data in a database, every piece of information lives as a file. This creates a system that’s simple, resilient, and easy to integrate with other tools. If your computer crashes or you switch devices, your data stays safe and accessible. In this deep dive, I’ll show you exactly how this disk-as-the-contract approach works—and why it’s a game-changer for productivity and collaboration. We’ll explore the mechanics, the benefits, and how it all fits together. Ready to see how a single folder full of JSON files can power a full project management system?
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
Samsung T7 Portable SSD, 1TB External Solid State Drive, Speeds Up to 1,050MB/s, USB 3.2 Gen 2, Reliable Storage for Gaming, Students, Professionals, MU-PC1T0T/AM, Gray

Samsung T7 Portable SSD, 1TB External Solid State Drive, Speeds Up to 1,050MB/s, USB 3.2 Gen 2, Reliable Storage for Gaming, Students, Professionals, MU-PC1T0T/AM, Gray

MADE FOR THE MAKERS: Create; Explore; Store; The T7 Portable SSD delivers fast speeds and durable features to…

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
256GB Flash Drive for iPhone Photo Stick,Thumb Drive USB Stick High Speed Transfer USB Drives External Picture Video Storage Memory Expansion for iPhone/iPad/PC (Blue)

256GB Flash Drive for iPhone Photo Stick,Thumb Drive USB Stick High Speed Transfer USB Drives External Picture Video Storage Memory Expansion for iPhone/iPad/PC (Blue)

Free Up Your iPhone Storage Space – With 256GB of additional storage capacity, you can easily transfer large…

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
Free Fling File Transfer Software for Windows [PC Download]

Free Fling File Transfer Software for Windows [PC Download]

Intuitive interface of a conventional FTP client

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
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 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 the disk as the single source of truth—no database needed, just plain JSON files.
  • Use one file per item to prevent race conditions and make updates atomic.
  • Implement atomic writes by writing to a temp file then renaming, ensuring data safety.
  • Design self-healing structures that reconcile and clean up automatically on each read.
  • Sync changes by comparing file hashes and timestamps, resolving conflicts predictably.

What ‘disk is the contract’ really means in Threlmark

At its core, ‘disk is the contract’ means that the entire system’s state is stored in files on your disk. There’s no central server or database dictating the truth. Instead, your files are the source of truth, and every tool — whether it’s the app or an external script — reads or writes directly to these files.

Understanding this is crucial because it shifts the perspective from traditional centralized systems. Instead of relying on a server to maintain consistency, the system depends on the integrity of the files on your disk. This means that the reliability of your data hinges on proper file management—atomic writes, backups, and conflict resolution become vital. The advantage is that this approach makes the data inherently portable; you can move, copy, or back up your entire project simply by copying files. The tradeoff, however, is that managing consistency and synchronization requires careful design, since there’s no single source controlling the state. This decentralization empowers users with greater control and transparency but demands discipline in handling concurrent changes and conflicts.

What ‘disk is the contract’ really means in Threlmark
What ‘disk is the contract’ really means in Threlmark

How local-first architecture differs from traditional cloud apps

FeatureTraditional Cloud AppsThrelmark’s Local-First
Data storageServer-side databaseLocal JSON files on disk
Offline workLimited, syncs laterFull offline capability
SyncingBackground, often complexManual or automatic file-based sync
ResilienceDependent on server availabilityWorks entirely offline
PortabilityLimited, tied to platform

The mechanics of syncing and conflict resolution

Syncing in Threlmark is built into the design—files are the protocol. When devices connect, they compare file modification timestamps and hashes. Changes are merged intelligently, preserving unknown fields to stay compatible. Conflicts are resolved based on timestamps or user intervention.

Understanding this process is important because it highlights the balance between simplicity and robustness. By relying on file hashes and timestamps, the system can quickly detect changes without complex state tracking. This enables a straightforward conflict resolution process—either automatically favoring the latest change or prompting the user to decide. The tradeoff here is that, while this approach is reliable for many scenarios, it may struggle with extremely high concurrency or complex merges. Nonetheless, for most typical use cases, this file-based sync offers a reliable and transparent way to keep multiple devices in sync, making conflicts predictable and manageable.

The mechanics of syncing and conflict resolution
The mechanics of syncing and conflict resolution

Why one file per item makes everything safer and faster

Instead of a big JSON array for all cards, Threlmark uses one file per item. This prevents race conditions and makes updates atomic. When a change happens, only one file is touched, so external tools can safely update individual cards without locking or coordination.

This design choice is significant because it reduces the risk of data corruption and simplifies recovery. If a file gets corrupted, only that specific item is affected, and restoring it is straightforward—just replace or revert that file. Speed-wise, updating individual files is faster because it avoids rewriting large datasets, and atomic writes ensure that partial updates don’t leave the data in an inconsistent state. The tradeoff is that managing many small files can become complex at scale, but for most projects, this approach offers a clear advantage in safety and speed, especially when combined with proper version control and backups.

How the system heals itself and keeps the board in sync

Threlmark’s board isn’t just a static list; it’s a self-healing structure. Every time you read the board, it compares the list of item IDs to the actual files in `items/`. Missing or orphaned IDs are cleaned up automatically, ensuring the visual representation reflects the true state of your data.

This process is crucial because it maintains consistency without manual intervention. If a file is deleted or corrupted, the system detects discrepancies during the next sync and corrects them—either by removing orphaned IDs or flagging issues for review. This auto-healing capability reduces manual maintenance and prevents inconsistencies from snowballing, which can be common in decentralized systems. It also means that even if external tools or accidental deletions occur, the system can recover gracefully, maintaining the integrity of your project view over time.

How the system heals itself and keeps the board in sync
How the system heals itself and keeps the board in sync

What it takes to build and maintain a disk-first system

Building a disk-first app requires discipline—atomic writes, tolerant merges, and clear folder structure. Threlmark uses a simple pattern: write to a temp file, then rename, to guarantee atomicity. It also merges updates carefully, keeping unknown fields to stay compatible.

Maintaining such a system involves regular backups, version control, and careful handling of external tools to avoid corrupting data. The key is designing processes that respect the file structure and ensure data integrity during concurrent modifications. The advantage is that you avoid the complexity of database migrations and lock management—your entire system remains transparent and portable. However, it demands consistent discipline and good practices, especially as the project scales. If managed well, it offers a resilient, flexible foundation for a variety of workflows.

Real-world example: Threlmark in action

Imagine a team using Threlmark to manage multiple projects. Each project has its own folder with JSON files for cards, boards, and dependencies. They work offline, move cards around, and add new ideas on the fly.

When they reconnect, the system syncs changes across devices—conflicts are resolved automatically or flagged for review. They even use external scripts to analyze data or generate reports by reading the same files.

This setup means their project stays alive and consistent, whether they’re in the office or on the road, with no server dependency.

Real-world example: Threlmark in action
Real-world example: Threlmark in action

Frequently Asked Questions

What does ‘disk is the contract’ mean in practical terms?

It means your data is stored directly as files on your disk, and these files are the single source of truth. No server or database controls the state—everything is simply read and written from the filesystem.

How does Threlmark handle syncing across devices?

It compares file hashes and modification times to detect changes, then merges updates while preserving unknown fields. Conflicts are resolved automatically or flagged for manual review, making multi-device workflow smooth.

Can I recover data if a file gets corrupted?

Yes. Since each item is one file, corruption impacts only that piece. You can inspect or revert individual files easily, and backups or version control help restore lost data.

Is this approach suitable for real-time collaboration?

It can be, especially with careful conflict resolution and sync strategies. However, for highly concurrent editing, additional mechanisms may be needed to handle simultaneous changes.

Conclusion

Threlmark’s disk-is-the-contract approach proves that simplicity beats complexity. By making your data files the ultimate record, you gain transparency, portability, and resilience. Whether you’re managing personal projects or collaborating across devices, this architecture keeps your work safe, accessible, and easy to extend. The next time you think about data storage, remember: sometimes, the simplest solution is the smartest.
You May Also Like

Solar Generator Basics: What You Can and Can’t Run

The truth about solar generators lies in understanding what devices they can power—and what they simply cannot—so keep reading.

The Difference Between Hacked, Spoofed, and Phished

Hacked means someone gains unauthorized access to your accounts or devices using…

Doorbell Camera Placement Mistakes That Ruin Useful Footage

Gaining clear, useful footage depends on proper doorbell camera placement; discover the common mistakes that could be ruining your security.