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

TL;DR

Threlmark uses a local-first design where disk storage is the ultimate source of truth. This approach simplifies data management, boosts resilience, and makes external tools and AI agents easier to integrate without relying on databases or cloud servers.

Imagine a project management tool that works perfectly offline, needs no cloud, and is completely portable—just a folder of JSON files sitting on your disk. That’s the essence of Threlmark’s approach.

At its heart, Threlmark flips the usual architecture on its head. Instead of a server or database as the record keeper, it makes your disk the single source of truth. This simple shift unlocks powerful benefits: total control, easy integration, and rock-solid resilience. No more dependency on external services or complex state management—just the raw files, and everything flows from there.

In this deep dive, I’ll walk you through how this design works, why it’s a game-changer, and what it means for building smarter, more reliable apps.

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 JSON file storage device

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

offline 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

local-first data storage solution

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

disk-based data management tools

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

  • Making disk the contract means the data is always local, durable, and accessible—no databases or cloud needed.
  • Atomic file writes and one file per item make concurrent edits safe, simple, and conflict-free.
  • External tools and AI agents can participate seamlessly since everything is just plain JSON files.
  • This architecture boosts resilience, portability, and flexibility—ideal for offline work and quick backups.
  • While not suited for every app, local-first, disk-as-the-contract design is a powerful pattern for the future.

Why Making Disk the Contract Changes Everything

When your disk is the contract, the data lives where it’s easiest to access and safest from loss. Think of it as writing directly to a notebook instead of relying on cloud servers that might go down.

For example, Threlmark stores each task or card as a separate JSON file in a folder. This means you can open, edit, or transfer these files in any text editor, sync them with Dropbox, or back them up with a simple copy. No special database, no vendor lock-in.

This approach makes your data:

  • Inspectable: You can `cat` or `diff` files to see changes.
  • Portable: Move them anywhere, and they’re still valid.
  • Interoperable: Any tool that reads JSON can join in.
  • Restartable: No in-memory state to lose—just reload the files.
According to Threlmark’s creator, this flat, file-based approach eliminates many common pain points in project management apps, especially when offline.

Why Making Disk the Contract Changes Everything
Why Making Disk the Contract Changes Everything

How Threlmark Keeps Data Safe with Atomic File Operations

Writing data safely on disk can be tricky—crashes or interruptions might corrupt files. Threlmark solves this with atomic writes. It first writes to a temporary file, then renames it—an operation guaranteed to be atomic on most filesystems.

Imagine you’re updating a card. Instead of overwriting the old file directly, Threlmark writes a new version, then swaps it atomically. This way, you never end up with a half-written file, keeping your data consistent even if your system crashes.

Here’s a simplified version of how it works: Learn more about Threlmark’s architecture.

  1. Create a temp file in the same directory.
  2. Write your updated JSON to this temp file.
  3. Use `rename()` to atomically replace the old file with the new one.
Researchers show this pattern reduces corruption risks significantly, making file-based systems as reliable as traditional databases, but with much more flexibility. For details, check out Threlmark’s implementation on GitHub.

The One File per Item Approach: Why It Stops Collisions and Simplifies Sync

Many projects store all their tasks in one giant JSON array—a tempting but risky choice. Threlmark uses one file per item, like having a separate note for each task. This reduces conflicts and makes concurrent edits safe and simple.

For example, if two external tools want to update different cards at the same time, they just write their files independently. Because each file is atomic, they won’t overwrite each other.

Threlmark’s design also includes a self-healing board. Each time you read the lane order, it checks the actual item files. Missing items are gracefully removed from the lane, keeping everything consistent without complicated locks or coordination.

This approach is like having a set of tiny, bulletproof notebooks instead of one giant ledger. When combined with file-based sync tools like Dropbox, it becomes trivial to keep multiple devices in sync without conflicts.

The One File per Item Approach: Why It Stops Collisions and Simplifies Sync
The One File per Item Approach: Why It Stops Collisions and Simplifies Sync

Making External Tools and AI Agents Play Nice With Files

One of Threlmark’s superpowers is how easily external tools can participate—no APIs or special integrations needed. Since everything is just files, external AI agents or automation scripts can read, write, and even suggest changes directly.

For instance, an AI assistant can recommend a new card, drop it into the `suggestions/` folder, and Threlmark will incorporate it seamlessly on next read. Or, an external script can move a card to Done by editing its file, and Threlmark recognizes the update instantly.

This openness speeds up automation, reduces friction, and even allows collaboration across different tools, all built on the simple principle: the files are the contract.

The Real-World Benefits: Resilience, Portability, and Flexibility

Imagine working on a project while offline on a plane, then reconnecting to sync everything without fuss. Threlmark’s architecture makes this effortless.

Developers and teams love how they can back up their entire system with a simple copy command, or migrate to a new machine by copying the folder. There’s no vendor lock-in, no proprietary database, just plain files.

Plus, the system’s simplicity encourages experimentation—try out new tools, integrate with scripts, or build custom interfaces—because the data is always accessible, always portable.

The Real-World Benefits: Resilience, Portability, and Flexibility
The Real-World Benefits: Resilience, Portability, and Flexibility

Tradeoffs and When to Use a File-Based, Local-First System

While simple and powerful, this approach isn’t for every project. It requires careful handling of sync, conflict resolution, and versioning—things that traditional databases handle behind the scenes.

If your team needs real-time collaboration with complex conflict management, a more robust solution might be better. But if resilience, portability, and offline work matter most, Threlmark’s approach shines.

For example, solo developers, small teams, or projects that prioritize data portability will find this architecture a perfect fit. Large-scale, highly concurrent multi-user apps might need additional syncing layers, but even then, the core idea is inspiring.

Why Threlmark’s Approach Is a Glimpse Into the Future of Apps

As software continues to emphasize resilience, offline capability, and user control, Threlmark’s disk-as-contract approach offers a compelling blueprint. It’s a reminder that sometimes, simplicity beats complexity.

More apps will likely adopt local-first principles, using local storage as the primary data source. This makes them more dependable and flexible—especially in a world where connectivity can be unreliable.

Tools like [Threlmark](https://github.com/MeyerThorsten/threlmark) are already demonstrating how a straightforward architecture can handle complex workflows, AI integration, and multi-project management—all with just plain files.

Frequently Asked Questions

What does ‘the disk is the contract’ really mean?

It means that your app’s authoritative data lives directly on disk as files. Once written, it’s durable, accessible, and the single source of truth—no external database or server needed.

How does Threlmark handle conflicts when multiple tools edit the same file?

Threlmark uses atomic writes and separate files per item to prevent conflicts. When multiple edits happen, each tool updates its own file independently, and the system self-heals by reconciling the actual files on each read.

Can external AI tools just drop suggestions into Threlmark?

Yes! Since everything is plain JSON files, AI agents or scripts can directly read, write, or suggest changes in the appropriate folders like `suggestions/`, making automation straightforward and collaborative.

Is this approach suitable for large, multi-user apps?

It works well for solo projects or small teams. For large-scale, real-time multi-user apps, additional sync and conflict resolution layers are needed, but the core idea still provides a solid foundation.

What are the main downsides?

Managing sync, conflicts, and versioning requires extra care. It’s less suited for apps demanding instant collaboration or complex data relationships compared to traditional databases.

Conclusion

Threlmark’s radical idea—that the disk itself is the contract—demonstrates how simplicity can lead to robustness. By treating files as the single source of truth, it turns project management into a portable, resilient, and future-proof system.

For your next project, ask yourself: can I make my data as accessible and safe as a folder of plain files? Because sometimes, the simplest approach is the most powerful.

Why Threlmark’s Approach Is a Glimpse Into the Future of Apps
Why Threlmark’s Approach Is a Glimpse Into the Future of Apps
You May Also Like

Anthropic’s Massive Series H: The Compute Revolution in AI Investment

Anthropic’s $65B raise isn’t just about valuation — it’s a massive bet on the future of compute infrastructure. Learn how this shapes AI’s scaling race.

A War Room for Your Next Idea: Inside IdeaClyst

Discover how IdeaClyst transforms idea management into a powerful, local-first digital war room—helping founders make smarter, faster decisions without the cloud.

Acoustic Dampening, Placement, and the “Rig in the Closet” Setup

Discover how to reduce noise from your AI rig with smart placement, acoustic treatment, and the ‘rig in the closet’ setup. Practical tips for quiet, cool performance.

Build vs Buy a Prebuilt AI Workstation

Deciding whether to build or buy your AI workstation? Discover the real costs, benefits, and what suits your needs in 2026’s AI boom.