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

TL;DR

Threlmark’s core idea is that files on disk are the single source of truth. This design makes data transparent, portable, and easier to work with, especially for offline or multi-device workflows. It’s a fresh take on managing project info without locking into databases or cloud dependencies.

Imagine a project management tool that doesn’t store data in a database or cloud. Instead, it treats your files on disk as the ultimate record of truth. That’s the core idea behind Threlmark’s local-first architecture. It’s a bold move, but it pays off in transparency, control, and resilience. No lock-in, no hidden layers—just plain JSON files that anyone can read, edit, and sync. If you’ve ever felt frustrated by opaque databases or locked-in platforms, this approach might be the fresh perspective you need. Here’s how it all works and why it matters.
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
Music Studio 11 - Music software to edit, convert and mix audio files - Eight music programs in one for Windows 11, 10

Music Studio 11 – Music software to edit, convert and mix audio files – Eight music programs in one for Windows 11, 10

8 solid reasons for the new Music Studio 11!

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 editor

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

  • Threlmark’s core idea is that the on-disk file layout *is* the API, making data transparent and easy to inspect or modify.
  • Using one file per item prevents race conditions and allows external tools and AI agents to safely read and write data without locks.
  • Atomic write techniques and tolerant merging safeguard data integrity even when files are manually edited or corrupted.
  • The folder structure acts as a formal contract, enabling seamless interoperability and simple backups or migrations.
  • Self-healing mechanisms ensure the project view remains consistent, even with manual or automated changes.

What does ‘disk is the contract’ actually mean?

At its heart, ‘disk is the contract’ means the files on your disk are the definitive source of truth. Think of it like a public ledger, where every change is a new line in a plain text file. The system’s rules, structure, and data all live in those files, making the data transparent and accessible. For example, Threlmark stores each project, card, and dependency as individual JSON files, so you can open, edit, or troubleshoot them directly in your editor.

This approach sidesteps the complexity of traditional databases, which hide data behind layers of abstraction. You can learn more about Disk Is the Contract: Inside Threlmark’s Local-First Architecture for a deeper understanding. Instead, you and your tools read and write files directly, trusting that the files are always correct and up-to-date. This transparency allows for easier debugging, manual intervention, and greater confidence in data integrity. However, it also means that managing consistency becomes a shared responsibility: if files are manually edited or corrupted, it can lead to discrepancies that need resolving. The tradeoff is simplicity and control at the expense of requiring some discipline in handling concurrent edits and conflicts.

What does 'disk is the contract' actually mean?
What does ‘disk is the contract’ actually mean?

Why choose plain JSON files over a database?

JSON files are simple, human-readable, and portable—perfect for a local-first app. Unlike databases, which require complex setup, migration, and locking mechanisms, JSON files let you see and manipulate your data directly. For example, if your project has 50 cards, each one lives in its own file, making it easy to edit, back up, or sync.

This simplicity also means that you avoid vendor lock-in and reduce the risk of data corruption or schema migrations that can be complex in traditional databases. For related insights, see Disk Is the Contract: Inside Threlmark’s Local-First Architecture. You can manually edit files to fix issues or inspect data, which is invaluable during debugging or emergencies. However, this approach also shifts some complexity onto the user or developer: managing concurrent edits, resolving conflicts, and ensuring consistency across files require careful handling. The tradeoff favors transparency and flexibility over the robustness and scalability of traditional database systems, making it ideal for small to medium projects that prioritize control and offline capabilities.

How does Threlmark handle multiple devices and conflicts?

Threlmark’s architecture shines in multi-device setups. You can explore similar concepts in Disk Is the Contract: Inside Threlmark’s Local-First Architecture. Each device reads and writes JSON files directly, which means changes are immediately reflected in the file system. When two devices edit the same file independently, conflicts can occur—this is an inherent challenge in distributed systems relying on file synchronization. However, Threlmark is designed to handle these situations gracefully by encouraging conflict-aware workflows. For instance, tools can detect conflicting versions during sync and prompt users to review differences, merge changes manually, or apply conflict resolution strategies.

The implication is that users need to be aware of potential conflicts and manage them consciously. This can be seen as a tradeoff: while it offers offline resilience and avoids complex locking mechanisms, it requires a disciplined workflow to prevent data loss or inconsistency. Automated conflict resolution can be implemented, but it often involves assumptions about how to merge divergent changes, which may not always be perfect. The benefit is a system that supports offline work and multi-device access without reliance on centralized servers, but with the necessity for conflict management strategies.

How does Threlmark handle multiple devices and conflicts?
How does Threlmark handle multiple devices and conflicts?

What role do agents play in this file-centric system?

Agents in Threlmark are automation tools that read and modify files directly. To see how automation integrates with local-first systems, visit Disk Is the Contract: Inside Threlmark’s Local-First Architecture. They can suggest new cards, move items, or mark tasks as done—all by editing the JSON files on disk. For example, an AI agent might scan your backlog, identify high-priority items, and automatically move them into your “Today” lane by updating a file.

This direct file manipulation makes automation transparent and safe. Since files are the source of truth, agents just follow the same rules as your manual edits. They can also participate asynchronously, send reports, or even trigger other tools—all without needing a special API or database layer. This approach ensures that automation remains consistent with manual workflows, reducing the risk of divergence and making it easier to troubleshoot or audit changes since everything is stored in plain files.

How does the folder structure act as a formal contract?

Threlmark’s folder layout isn’t just organization—it’s a formal contract between tools and the system. More details can be found at Disk Is the Contract: Inside Threlmark’s Local-First Architecture. At the root, a manifest file describes overall setup, while each project has its own folder with files for cards, lanes, and dependencies. For example, the `items/` directory contains one JSON file per task, making each piece of work independently accessible.

This structure guarantees that any tool can read or write specific parts of your project without breaking others. It also makes backups, migrations, or manual edits straightforward. By adhering to this folder and file organization, developers and tools can reliably interpret the data format, facilitating seamless interoperability. The tradeoff is that this rigid structure requires discipline in maintaining naming conventions and folder hierarchies, but it ultimately provides a clear, predictable contract that simplifies data management and integration.

How does the folder structure act as a formal contract?
How does the folder structure act as a formal contract?

What safeguards make file-based data safe and reliable?

Using files might seem risky, but Threlmark employs atomic writes and tolerant merging to keep data safe. For more on data safety practices, see Disk Is the Contract: Inside Threlmark’s Local-First Architecture. Atomic writes involve writing to a temporary file first, then renaming it—if something crashes mid-write, the old file remains intact. For example, when saving a card update, the system first writes to `card123.json.tmp`, then swaps it over. This ensures that partial writes do not corrupt existing data, preserving consistency even in the face of crashes or power failures.

Read-merge-write patterns further protect data integrity by carefully merging incoming changes with existing content, respecting the structure and avoiding overwriting important information. Tolerant merging allows the system to handle unknown or extra fields gracefully, supporting schema evolution without breaking compatibility. These safeguards collectively provide a resilient environment that prioritizes data safety while maintaining the flexibility of plain files, although they may introduce some complexity in conflict resolution and version management.

How does Threlmark’s self-healing board work?

The board in Threlmark is stored as a separate JSON file listing item IDs in order. It self-heals on read—if a card exists in `items/` but isn’t listed on the board, it’s added automatically. For example, if a new task is created outside the board file, it appears in the next read cycle, keeping the view consistent.

This automatic reconciliation prevents desynchronization and manual cleanup, making the system more robust. It’s akin to a GPS that recalibrates itself—if files are manually edited or if some data is missing, the system adjusts the view to reflect the actual state, reducing errors and inconsistencies. This approach simplifies manual maintenance and enhances reliability, but it also requires that the self-healing logic is carefully implemented to avoid unintended side effects, such as inadvertently displaying outdated or irrelevant items.

How does Threlmark's self-healing board work?
How does Threlmark’s self-healing board work?

What are the main benefits of this file-based approach?

  • Transparency: you can see and edit data directly.
  • Portability: move files anywhere, no lock-in.
  • Resilience: offline work and manual recovery are straightforward.
  • Interoperability: any language or tool can join the party.
  • Control: no hidden layers—your data lives in plain sight.

Frequently Asked Questions

What exactly does ‘disk is the contract’ mean in practice?

It means the files on your disk are the definitive source of truth. Every change, every state, lives in plain JSON files that any tool can read or write, making your data transparent and portable.

Why use JSON files instead of a database?

JSON files are simple, human-readable, and portable. They make it easy to see what’s happening, manually fix issues, and avoid vendor lock-in, all while supporting offline workflows.

How does sync and conflict resolution work?

Each device reads and writes files independently. Conflicts can be merged or manually reviewed, making the system resilient and offline-friendly. Changes propagate naturally via file sync tools.

Can agents modify the source data directly?

Yes. Agents in Threlmark edit the JSON files directly, enabling automation that’s transparent and safe, since the files are the source of truth.

Is this suitable for team collaboration or only solo work?

It works well for both. The file-based approach simplifies sharing, syncing, and conflict resolution, making it ideal for multi-device and team environments as long as sync is managed carefully.

Conclusion

Thinking of your project data as files on disk turns complexity into clarity. Instead of hiding behind databases, you gain transparency, control, and resilience. That’s the real power of ‘disk is the contract’—a simple idea that rewires how we build and automate. Ready to give it a try? Your files are waiting.

You May Also Like

Weaving Festivals You Can Attend in 2026

Providing a vibrant overview of weaving festivals in 2026, discover exciting events that celebrate textile traditions and innovative artistry waiting for you.

Wines That Entertain as Well as Impress

New wine trends focus on entertaining qualities alongside sophistication, appealing to consumers seeking both fun and quality in their wine choices.

Uluru’s Aboriginal Roots Unveiled | Explore Now

– ad – Come along with us as we explore the Aboriginal…

From Bark Canoes to Fibre Sculpture: Evolution of Indigenous Craft

Like ancient bark canoes transforming into intricate fibre sculptures, discover how indigenous craft evolves while preserving cultural identity.