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

TL;DR

Threlmark’s local-first system uses the disk as the contract — meaning all data is stored directly on your filesystem, making it portable, safe, and easy to extend. This approach removes the need for a central database, improving resilience and collaboration.

Imagine a project management tool that feels lightning-fast, works offline without missing a beat, and plays nicely with any external tool or device. That’s what Threlmark accomplishes by making the disk the contract. Instead of relying on a distant server or a complex database, every piece of data lives in plain JSON files on your local machine. It’s a simple idea, but one that flips the entire architecture on its head — turning a filesystem into the backbone of your workflow.

This approach isn’t just about storage; it’s about creating a system that’s transparent, flexible, and resilient. You’ll see how making the disk the single source of truth simplifies concurrency, enhances portability, and even allows AI agents to work more effectively. If you’re curious about building tools that are as robust as they are simple, this deep dive into Threlmark’s local-first architecture will give you a fresh perspective.

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
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.

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
File Manager

File Manager

User friendly, simple yet powerful.

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 filesystem as your app’s API — making data transparent, portable, and easy to extend.
  • Atomic file writes combined with merge strategies prevent corruption and support forward compatibility.
  • One file per item simplifies concurrency, collaboration, and recovery.
  • Directory structure forms a formal contract, enabling any tool to participate without custom APIs.
  • File-based storage is ideal for small to medium projects valuing transparency and portability, but not for massive datasets or high concurrency.

Why Making the Disk the Heart of Your App Changes Everything

When your app treats the disk as the contract, it’s like building on a foundation you can see and touch. Instead of a cloud database or API, the files on disk become the single source of truth. This means every external tool, script, or AI agent can read and write directly to the same files, no middleman needed.

For example, Threlmark stores each project card as a separate JSON file inside an `items/` folder. When you update a card, the app writes a new file atomically, ensuring no data loss even if your computer crashes mid-save. This setup makes the entire system transparent, so you can open your file explorer and see exactly what’s happening behind the scenes.

It’s like having a bookshelf where each book is a self-contained JSON document — easy to read, modify, backup, or migrate. This simplicity unlocks powerful benefits like interoperation with other tools, straightforward conflict resolution, and zero lock-in.

Why Making the Disk the Heart of Your App Changes Everything
Why Making the Disk the Heart of Your App Changes Everything

How Threlmark Keeps Data Safe and Consistent Using Files

File-based storage sounds risky until you see the details. Threlmark uses atomic writes: each update first writes to a temporary file, then renames it over the original. This guarantees that at no point do you get a half-written, corrupt file. It’s the same atomic operation that databases rely on, but applied to plain files.

For example, if you’re updating a roadmap card, the system reads the current file, merges in your changes, and writes it back atomically. Even if your laptop crashes right after, the data remains consistent — either the old version or the new one. This approach makes the entire system resilient, even in the face of power outages or hardware hiccups.

Plus, by designing updates to merge with existing data rather than overwrite blindly, Threlmark preserves unknown or newer fields. This forward compatibility means you can extend your data model without breaking existing tools.

One File per Item — Why That’s a Game-Changer

Most tools try to keep all data in one massive JSON array. That’s simple to code but dangerous for concurrency. Threlmark sidesteps this by storing each item as its own file — like one page per note in a notebook.

This means multiple tools or scripts can update different cards simultaneously without clobbering each other. When a change happens, only that specific file updates, avoiding race conditions. The system then reads all item files to reconstruct the current state, fixing inconsistencies on the fly.

Imagine working on a team, each person editing different cards. No locks, no conflicts — just smooth, independent updates. When you open the app, it reads every file, merges the latest changes, and displays a clean, consistent view.

One File per Item — Why That’s a Game-Changer
One File per Item — Why That’s a Game-Changer

How the Layout Acts as a Contract — Making Your Data Interoperable

The directory structure in Threlmark isn’t just organized — it’s a contract. At the root, you find a manifest (`threlmark.json`), links (`links.json`), and folders for projects, shared items, suggestions, and reports. Each piece of data has a dedicated file, making it easy for any tool to understand and manipulate.

For example, if you want to build an external dashboard, you can just read all the JSON files in `items/` and `shared/items/`. No API calls, no special permissions. This openness means your project can grow without vendor lock-in or complex integrations.

It’s like a blueprint for data exchange — simple, explicit, and universal.

Why This Architecture is Perfect for AI and Automation

AI agents love files. They read, modify, and save data without needing complex APIs or database drivers. Threlmark’s design lets AI tools like IdeaClyst participate directly by dropping or updating JSON files, then observing changes in real time.

Imagine an AI that scans your `suggestions/` folder, picks up a new task, and then moves it to `reports/` after completion — all by just reading and writing files. There’s no middle layer, no API, just straightforward file operations.

This setup also supports robust automation: scripts can run anywhere, from a browser extension to a shell script, with no dependencies beyond standard file IO.

Why This Architecture is Perfect for AI and Automation
Why This Architecture is Perfect for AI and Automation

The Real Benefits: Portability, Inspection, and No Lock-in

When your data lives in plain JSON files, you gain instant portability. You can back it up with a simple copy, sync it with Dropbox, or migrate to another system. Want to see how a card changes? Just diff the files. Want to extend your data? Add new fields without breaking anything.

This transparency means you’re never locked into a vendor or platform. Your data always stays yours, in a format anyone can understand and modify.

Plus, if you ever need to switch tools or upgrade, you simply move or copy the files. No complicated migration scripts, no vendor lock-in.

What Are the Tradeoffs? When Files Might Not Be Enough

While the file-centric approach has many perks, it’s not a silver bullet. Large datasets, very high concurrency, or real-time multi-user editing can challenge this model.

For example, if you’re managing thousands of cards, reading and merging all files might slow down. Or, in a scenario with many simultaneous editors, conflicts could pile up without a proper conflict-resolution layer.

In those cases, a traditional database might still make sense. But for most small-to-medium projects that value transparency, portability, and simplicity, this architecture shines.

What Are the Tradeoffs? When Files Might Not Be Enough
What Are the Tradeoffs? When Files Might Not Be Enough

How to Implement Your Own Local-First System Like Threlmark

Here’s a quick step-by-step to build a similar setup:

  1. Design your data as JSON objects, each in its own file.
  2. Use atomic write techniques: write to a temp file, then rename.
  3. Structure your directory with clear, predictable paths.
  4. Implement read-merge-write cycles that preserve unknown fields.
  5. Build your UI to read files directly, then update files on user actions.
  6. Ensure your system can handle conflicts and partial updates gracefully.

Want to see a real example? Check out the open-source project [Threlmark on GitHub](https://github.com/MeyerThorsten/threlmark). It’s a treasure trove of ideas and code.

Frequently Asked Questions

What does it mean to treat disk as the contract?

It means designing your app so that the filesystem—the files and folders—becomes the definitive source of truth. Instead of relying on a server or database, all data is stored in plain files, making it transparent, portable, and easy to manipulate with any tool.

How does Threlmark handle conflicts when multiple devices edit the same data?

Threlmark uses a merge strategy that preserves unknown fields and only updates specific parts of each JSON file. Atomic writes ensure that each individual file update is safe, and the system’s reconciliation on read fixes inconsistencies automatically.

Can I build my own app like Threlmark?

Absolutely. Start by modeling your data as JSON files, use atomic write patterns, and structure your directories as a contract. Follow the step-by-step guide in the article, and check out the Threlmark GitHub repo for real-world inspiration.

When might file-based storage not be enough?

In cases with very large datasets, intense multi-user editing, or real-time collaboration, a traditional database might be better. But for many small-to-medium projects, the simplicity and transparency of files are a huge advantage.

Conclusion

By making the disk the contract, Threlmark shows us that simplicity and transparency can power powerful, resilient tools. When your data lives right on your filesystem, you gain control, flexibility, and peace of mind. That vivid, accessible foundation could be the key to building the next generation of project tools — ones that are as open and adaptable as your workflow demands.

So, next time you build or choose a tool, ask yourself: could the disk be the contract? The answer might just change everything.

You May Also Like

Brain‑Inspired Neuromorphic Computing: Replicating the Human Brain in Silicon

Learning from the human brain, neuromorphic computing in silicon promises revolutionary advances, but the true potential remains to be fully unlocked.

How Your Horoscope Can Shape the Way You Use Artificial Intelligence.

Precisely how your belief in astrology influences your interaction with AI horoscopes can reveal surprising insights into your decision-making.

How Advanced Chips Changed the Limits of Personal Tech

The transformative power of advanced chips is pushing personal tech boundaries further than ever—discover how they are shaping your digital future.

Why Smart Rings Keep Attracting Curious Buyers

Meticulously designed and packed with features, smart rings continue to attract curious buyers eager to discover how they can seamlessly enhance daily life.