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

TL;DR

Threlmark uses a local-first, disk-based system where files on your device are the source of truth. This approach makes everything faster, safer, and more portable, enabling seamless offline work and multi-device sync without complex databases.

What if your project management app didn’t depend on a server or cloud? Imagine a system that works instantly, even offline, and lets you move your data anywhere without lock-in. That’s the magic of Threlmark’s local-first architecture. It’s a radical rethink that turns your disk into the contract — the single source of truth.

This isn’t just about storage; it’s about building a smarter, more resilient way to coordinate work across devices and tools. In this article, you’ll see how a simple on-disk layout can power a complex, collaborative system that’s fast, flexible, and future-proof.

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

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

offline file synchronization tool

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

JSON file editor for Windows

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

  • Threlmark’s core design hinges on the idea that the on-disk layout *is* the API, making data transparent and flexible.
  • Atomic file operations ensure data safety even during crashes, avoiding corruption or inconsistency.
  • One file per item allows conflict-free updates and simplifies concurrency control.
  • Self-healing lane structures keep the project board consistent without manual intervention.
  • Local-first architecture boosts speed, offline reliability, and multi-device sync—perfect for mobile and remote workflows.

What does ‘disk is the contract’ really mean? Think simple, stay flexible

“Disk is the contract” means that your data lives on your device, and that’s where all the authority resides. No server, no cloud. Just files in a predictable, structured layout. For example, Threlmark stores each project, card, and relationship as individual JSON files. This setup makes the data transparent and easy to manipulate outside the app.

Imagine editing a project file directly in your text editor. You can see exactly what’s stored, make quick fixes, or move things around. That’s the power of a file-based contract. It’s simple but incredibly flexible.

Why does this matter? Because it shifts the control and understanding of your data from opaque server structures to transparent files you can inspect, modify, and understand directly. This transparency reduces reliance on proprietary systems, making your data more portable and resilient to vendor lock-in. For more on this approach, see Disk Is the Contract: Inside Threlmark’s Local-First Architecture.

What does 'disk is the contract' really mean? Think simple, stay flexible
What does ‘disk is the contract’ really mean? Think simple, stay flexible

Why storing data on disk makes your app faster and more reliable

Local storage means no waiting for network responses. When you open Threlmark, it reads JSON files instantly from your disk. No delays, no loading spinners. That immediate responsiveness feels natural—like working directly on paper. You can learn more about how this architecture enhances performance at Disk Is the Contract.

Plus, if your device crashes or loses internet, your work isn’t lost. Everything is already saved locally. You can keep working, confident that your data is safe on your machine.

But there’s more: this approach reduces dependency on network stability, which is often a bottleneck or point of failure in cloud-based apps. It also allows for true offline work—your data is always accessible, regardless of connectivity. The tradeoff is that local storage alone can complicate synchronization and conflict resolution, especially in multi-user scenarios, but for individual or small-team workflows, the speed and resilience benefits outweigh these challenges.

How Threlmark’s file layout keeps everything portable and interoperable

Threlmark’s folder structure is a detailed contract. At the root, you find a manifest (`threlmark.json`) and a dependency graph (`links.json`). Each project gets its own folder with files like `project.json`, `board.json`, and then one file per card under `items/`. This setup allows for easy backup and migration—more details can be found in Disk Is the Contract.

This setup allows you to copy, back up, or move your entire workspace with a simple `cp` or sync. Other tools can read and write these files directly, making integrations straightforward. Want to build your own views or automate updates? Just read or write the JSON files.

Why does this matter? Because having a clear, standardized directory and file structure means your data isn’t locked into a proprietary format or system. It’s inherently portable—easy to back up, migrate, or integrate with other tools. This openness fosters interoperability, giving you flexibility to adapt your workflow or switch tools without losing your data.

How Threlmark’s file layout keeps everything portable and interoperable
How Threlmark’s file layout keeps everything portable and interoperable

How atomic file operations keep your data safe and consistent

Writing to disk might sound risky, but Threlmark uses atomic saves. Each update writes to a temporary file, then renames it over the original. This guarantees that you never end up with a half-written, corrupted file. For more on ensuring data safety, see Disk Is the Contract.

Why is this important? Because in real-world scenarios—power failures, crashes, or interruptions—partial writes can corrupt data, leading to loss or inconsistency. Atomic operations prevent this by ensuring that only fully written files replace the old ones, preserving data integrity.

This pattern is a simple yet powerful safeguard. It guarantees that your project files remain trustworthy even in adverse conditions, reducing the risk of data corruption and making recovery easier when issues occur.

One file per item: how Threlmark avoids conflicts and race conditions

Instead of storing all cards in a big array, Threlmark keeps each card in its own JSON file inside `items/`. This way, external tools can update a single card without touching the rest. Learn more about this approach at Disk Is the Contract.

Imagine two people editing different cards at the same time. Because each file updates independently, they don’t step on each other. This approach eliminates race conditions common in monolithic JSON files, where simultaneous edits can overwrite or corrupt data.

Additionally, this structure simplifies conflict resolution. When the system reads the folder, it can easily detect which files have changed, been added, or deleted, making synchronization more reliable. This setup supports concurrent editing and reduces the risk of data loss, especially in multi-user or multi-device environments.

One file per item: how Threlmark avoids conflicts and race conditions
One file per item: how Threlmark avoids conflicts and race conditions

How the board heals itself: reconciling lane order and card status

The lane order in Threlmark is stored in `board.json`, listing IDs in sequence. When loaded, the system cross-checks the actual files in `items/` and rebuilds the lane order if needed.

This self-healing process is crucial because it allows the system to recover from inconsistencies caused by external modifications or errors. If files are deleted, moved, or corrupted outside the app, the system detects discrepancies and reconstructs the correct order and state based on the available data.

This approach ensures that your visual board remains consistent with the underlying data. It reduces manual correction efforts and prevents display errors, especially after unexpected interruptions or external edits. The tradeoff is a slight overhead during load, but the benefit is a robust, self-correcting system that maintains integrity automatically.

Syncing and conflict resolution: making multi-device work smoothly

Threlmark’s architecture treats sync as a background process. Changes in one device are stored locally, then pushed to other devices when connected. Conflicts are resolved by rules—latest update wins, or manual review.

Why does this matter? Because in multi-device environments, conflicting changes can easily occur. Threlmark’s conflict resolution rules—such as favoring the most recent change or prompting user input—are essential for maintaining data consistency without complex locking mechanisms.

This approach allows seamless multi-device workflows, where each device operates independently yet stays synchronized. The tradeoff is that conflict resolution may require user intervention or predefined rules, but the benefit is a resilient, flexible sync process that doesn’t rely on central servers.

Syncing and conflict resolution: making multi-device work smoothly
Syncing and conflict resolution: making multi-device work smoothly

Securing your data: encryption, backups, and device loss

Storing data locally raises security questions. Threlmark can encrypt files or rely on device encryption to keep data safe. Regular backups are simple—just copy your `~/.threlmark` folder.

But why is this important? Because local storage, while fast and resilient, can be vulnerable if not secured properly. Encryption ensures that even if someone gains access to your files, the data remains protected. Regular backups prevent data loss due to hardware failure, theft, or corruption, ensuring you can restore your workspace quickly.

In practice, combining encryption with regular backups and device security measures creates a comprehensive safety net. This layered approach balances speed and control, giving you confidence that your data is both accessible and protected.

When should you choose local-first architecture? Know the tradeoffs

Local-first works best when responsiveness, offline access, and portability matter most. If your team needs instant updates and can’t depend on always-on internet, this is a game-changer.

However, managing sync conflicts and extra device storage are tradeoffs. For large teams or complex data, a server-based approach might still be better.

Use cases include solo projects, small teams, or highly mobile workflows where speed and independence are priority. Understanding these tradeoffs helps you decide whether the benefits of speed, control, and offline capability outweigh the added complexity of sync and conflict management.

Frequently Asked Questions

What does ‘disk is the contract’ mean?

It means that your data lives directly on your device as files, which serve as the single source of truth. No server or cloud is needed for day-to-day work, making the system simple and resilient.

How does syncing work when I have multiple devices?

Changes are stored locally and then synchronized in the background. Conflicts are resolved by rules or manual review, ensuring all devices stay up-to-date without complex locking.

Is local-first secure if data lives on my device?

Yes. You can encrypt your files or rely on device encryption. Backups are simple—just copy your data folder—keeping your information safe even if your device is lost.

When should I choose local-first over server-based apps?

When responsiveness, offline access, or portability outweigh the need for centralized data. It’s ideal for solo work, remote teams, or mobile workflows where speed matters.

Conclusion

Choosing a disk-based, local-first approach isn’t just a technical decision—it’s a philosophy that puts simplicity, control, and speed at the forefront. Threlmark proves that by making your disk the contract, you gain a system that’s inherently resilient and incredibly flexible.

Imagine your next project tool that’s fast, portable, and always available—without locking you into a cloud or a database. That’s the promise of local-first design. Why settle for less?

When should you choose local-first architecture? Know the tradeoffs
When should you choose local-first architecture? Know the tradeoffs
You May Also Like

New Year Retirement Checklist: Setting Financial Goals for 2026

Harness the power of a New Year Retirement Checklist to set financial goals for 2026 and uncover the key steps to secure your future.

State Tax Implications for IRA Withdrawals: A Guide for Rhode Island

In Rhode Island, IRA withdrawals significantly impact your taxes; discover strategies to minimize your tax burden and safeguard your retirement savings.

State Tax Implications for IRA Withdrawals: A Guide for Connecticut

Learn how Connecticut’s state tax implications on IRA withdrawals can impact your retirement finances and discover strategies to mitigate costs effectively.

State Tax Implications for IRA Withdrawals: A Guide for Mississippi

Mississippi offers tax advantages for IRA withdrawals, but what hidden benefits could enhance your retirement planning even further? Discover more inside!