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

TL;DR

Threlmark treats the disk as the ultimate record, using JSON files to manage project data. This design boosts offline resilience, makes data portable, and simplifies debugging, but shifts complexity into syncing and conflict resolution.

Imagine working on a project and knowing your data isn’t stored in some cloud server. Instead, it lives right there on your disk, as simple as a folder of JSON files. That’s the core of Threlmark’s approach — a system built around the idea that the disk is the actual contract. It’s a surprisingly elegant twist in the world of project tools, especially when considering disk as the contract.

Why does this matter? Because it makes your data portable, easy to back up, and simple to debug. No complicated databases, no lock-in. Just files. And those files tell the full story of your project, similar to the principles discussed in disk as the contract. Today, we’ll peek under the hood of this architecture, unpack how it works, and see what makes it a game-changer for local-first, offline-first workflows.

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
Information Technology Project Management (MindTap Course List)

Information Technology Project Management (MindTap Course List)

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
KALIM Needle File Set (10Pcs High Carbon Steel Files) and 1 Wire Cutter in A Carry Bag, File Tools for Soft Metal, Wood, Jewelry, Model, DIY, Hobby, etc.

KALIM Needle File Set (10Pcs High Carbon Steel Files) and 1 Wire Cutter in A Carry Bag, File Tools for Soft Metal, Wood, Jewelry, Model, DIY, Hobby, etc.

【GREAT SMALL SIZE】 10 pcs 6'' high carbon needle files, 1pcs 5'' wire cutter, 1pcs 8'' carrying storage…

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
TANDBERG DATA Overland-Tandberg RDX HDD 5TB Cartridge (Single)

TANDBERG DATA Overland-Tandberg RDX HDD 5TB Cartridge (Single)

Use RDX Manager software and RDX systems to securely encrypt business data, with support for FIPS 140-2 validated…

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 ultimate source of truth, making data portable and easy to recover.
  • Use JSON files for transparency, debugging, and cross-tool compatibility.
  • Atomic file writes prevent corruption and ensure data safety during updates.
  • Design self-healing board layouts that automatically reconcile file state.
  • Conflict resolution relies on file versioning, requiring manual or external merge steps.

How ‘Disk is the Contract’ Changes Everything

In most apps, the server is the boss. It holds the truth, and your device just asks for what it needs. Threlmark flips that. Here, the disk itself is the source of truth. If you open your project folder, you see everything: project metadata, the list of tasks, even what’s being worked on right now.

This isn’t just about storage; it’s about design philosophy. Files are the API. They’re the interface. If a tool writes or reads these files, it’s talking to the app. No special database or API layer needed. Just plain JSON files that everyone can understand and manipulate. This makes data sharing, backup, and recovery straightforward.

Real-world scenario? Imagine you’re working on a big project, and your laptop crashes. When you restart, just opening those JSON files gives you a complete snapshot of where everything stands. No complex recovery process needed. That’s the power of treating disk as the contract.

How 'Disk is the Contract' Changes Everything
How ‘Disk is the Contract’ Changes Everything

Why JSON Files Make Your Data Transparent and Portable

JSON isn’t just a data format; it’s a window into your app’s soul. Threlmark stores every project, card, and lane as individual JSON files. Want to see what’s on your board? Just open a file in your text editor, following the approach outlined in disk as the contract. Want to back it up? Copy a folder. Want to share? Send a zip or sync via Dropbox.

One project might have hundreds of files in the items/ folder. Each file represents a task or card, with all its details. When you edit a file, you’re directly changing the project’s state. No middleman, no API calls, just plain old filesystem operations.

This approach simplifies debugging and adds a layer of transparency. You can grep for keywords, diff versions, or even manually fix conflicts. It’s like having a living, breathing log of your project’s history, always accessible, as explained in disk as the contract.

Why does this matter? Because in a world dominated by opaque databases, JSON files provide clarity. They allow developers and users alike to understand exactly what data exists at any moment. This transparency reduces the learning curve, speeds up troubleshooting, and enables easier data migration or sharing. However, it also means you must be aware of potential issues like file corruption or conflicts, which require careful handling. The tradeoff is simplicity and control versus the need for manual conflict management, but for many, this tradeoff favors transparency and resilience.

File-Based Architecture vs. Traditional Databases

Traditional Database File-Based System (Threlmark)
Stores data in complex, optimized structures Uses plain JSON files, one per item
Requires a server or special engine Works entirely on the filesystem
In-memory state and indexes State is derived directly from files
Risk of corruption or lock-in Atomic file writes keep data safe; portable and easy to migrate
Hard to inspect or modify outside the app Readable and editable with any text editor

Choosing file-based storage isn’t just a throwback; it’s a deliberate move toward transparency, resilience, and simplicity, similar to the ideas discussed on dealsucker.com. It allows for easier debugging and data inspection, because the data lives in plain files that can be opened and understood directly. However, this simplicity also means that handling large datasets or complex relationships can become challenging, requiring careful organization and management by the developer. The tradeoff favors transparency and portability over performance at scale, making it ideal for smaller projects or workflows prioritizing control and offline resilience.

File-Based Architecture vs. Traditional Databases
File-Based Architecture vs. Traditional Databases

Atomic Writes and How They Keep Data Safe

Imagine writing a file, then immediately swapping it out only when the new version is ready. That’s atomic writing in Threlmark — a tiny but powerful trick. It involves saving to a temporary file and then renaming it in one step, a technique often discussed in disk as the contract. On Unix-like systems, rename is atomic, meaning it either happens completely or not at all.

This prevents corruption if your computer crashes mid-write. When you save a card, you’re guaranteed to either have the old data or the new, never a half-baked state. It’s like laying a new tile perfectly in one go instead of patching together worn-out pieces.

The significance? Atomic writes are a cornerstone of data integrity in a disk-based system. They ensure that even in the face of power failures, crashes, or interruptions, your data remains consistent and recoverable. Without this, partial writes could corrupt your project files, leading to data loss or inconsistent states. The tradeoff is that implementing atomic operations requires careful handling of temporary files and filesystem operations, but the benefit—reliable, safe data—is well worth it. This approach underpins the resilience of Threlmark’s architecture, enabling confident offline work and easy recovery from failures.

How ‘Self-Healing’ Boards Keep Your Workflow Smooth

Threlmark’s boards don’t just sit still—they heal themselves. The lane order isn’t stored as a static list; it’s reconstructed each time from the actual items folder. If a card disappears or is moved, the next read automatically updates the lane layout.

Suppose you accidentally delete a task file. When you open your board again, the system notices the missing file and adjusts the lane order accordingly. It’s like a GPS that recalibrates after every turn, always showing the real landscape.

This self-healing mechanism is a direct consequence of the architecture’s transparency. Because the layout is derived from existing files, any inconsistencies are automatically corrected during the read process, reducing manual intervention and errors. This approach ensures your view of the project remains accurate even if external tools or accidental deletions happen. It provides resilience by not relying on a fixed state stored elsewhere, but instead dynamically reconstructing the view from current disk contents. The tradeoff? Slightly more computation each time, but significantly increased robustness and trustworthiness of the project state.

How 'Self-Healing' Boards Keep Your Workflow Smooth
How ‘Self-Healing’ Boards Keep Your Workflow Smooth

Syncing and Conflict Resolution: The Tradeoff

Syncing in Threlmark isn’t automatic; it’s a manual or external process. Because the system’s core relies on files, conflicts happen when multiple devices change the same file. The trick is in how you resolve them.

One approach? Use version control or diff tools to compare changes. If two devices edit the same task, you might see a merge conflict, much like in Git. Threlmark’s architecture doesn’t hide this—conflicts are part of the workflow.

Why does this matter? Because it shifts some responsibility for conflict management to the user or external tools, requiring awareness and deliberate resolution. The benefit is that you maintain full control over what gets merged and when, avoiding hidden or automatic sync errors. However, this also means that managing conflicts can become tedious if not handled carefully, especially as projects grow in complexity. The tradeoff is clear: you gain transparency and control at the expense of requiring manual intervention or external merge tools, which may slow down workflows but ultimately provide a more predictable, resilient system.

When Is This Approach a Good Fit? When Not

Using disk as the contract shines brightest in offline, solo, or small-team setups. If you value direct data control, quick local access, and portability, Threlmark’s approach is perfect.

But for massive teams or real-time collaboration, the lack of built-in sync might be a hurdle. You’ll need additional tools or processes to handle conflicts and sync delays.

In our experience, it works well for developers, writers, and small startups that need control and resilience without cloud lock-in. For large enterprise workflows, a more traditional client-server model might be better, as it can handle scale and real-time updates more efficiently. The key is understanding the tradeoffs: this approach prioritizes simplicity, transparency, and offline resilience over instant collaboration at scale.

Frequently Asked Questions

What does “disk is the contract” mean?

It means the on-disk JSON files are the definitive source of your app’s data. The app reads and writes these files directly, making the disk the ultimate record of truth, without relying on a server or database.

How is Threlmark different from a traditional client-server app?

Threlmark stores all data as files on your device, not in a remote database. It relies on local files that are read and written directly, making it more resilient to offline scenarios and easier to back up or migrate.

Why use JSON on disk instead of a database?

JSON files are simple, human-readable, and easy to inspect or modify. This transparency helps with debugging, backups, and sharing data, all without complex database management.

How does syncing work if the disk is the source of truth?

Syncing involves copying or merging JSON files between devices. Conflicts are detected by comparing file versions, and resolving them often requires manual or tool-assisted merging.

What happens when two devices edit the same data?

Conflicts show up as version differences. You’ll need to compare and merge files manually or with diff tools. The system’s simplicity makes conflicts transparent and manageable.

Conclusion

Threlmark’s disk-centric, local-first design proves that simplicity can be powerful. When data lives right on your disk, you gain transparency, resilience, and control. The tradeoff? You handle conflicts and sync manually, but in return, you get an architecture that’s straightforward, portable, and dead reliable.

Next time you think about building a project tool, ask yourself: could the disk really be the contract? The answer might just change everything.

When Is This Approach a Good Fit? When Not
When Is This Approach a Good Fit? When Not
You May Also Like

Writing Reviews in a Trust-Building Tone With AI Assistance

An insightful guide on crafting authentic reviews using AI assistance awaits, revealing secrets to enhance your credibility and engagement. Discover the art of trust-building today!

How to Choose a Creator Camera Without Paying for Features You Won’t Use

Most creators can find the perfect camera by focusing on essential features and comfort, but knowing what to skip can save you money and frustration.

Freelance Writers: Here's How to Get Published in Top Magazines

Aspiring to see your work in top magazines? Unlock the secrets of successful submissions and editor relationships in this insightful guide.

Transform Your Dreams With New Age Ventures

Awaken your potential with New Age Ventures and discover how to turn your dreams into reality—what transformative journey awaits you?