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

TL;DR

Threlmark’s architecture centers on the idea that your disk is the ultimate source of truth. It’s a local-first system where data is stored in human-readable JSON files, making it durable, portable, and easy to sync across devices, even offline. This approach simplifies development and boosts resilience. Disk Is the Contract: Inside Threlmark’s Local-First Architecture

Imagine a project management tool that works perfectly offline, is easy to back up, and can be hacked apart and rebuilt with a simple text editor. That’s the promise of Threlmark’s unique approach. Instead of a traditional database or cloud backend, it treats your disk as the contract—where your data lives and breathes.

This isn’t just a cool trick. It’s a radical shift. By making the filesystem the foundation, Threlmark sidesteps many headaches of modern cloud apps—lock-in, complex sync conflicts, and opaque data formats. Instead, it offers a transparent, resilient, and portable way to manage your work. This article explores how this architecture works, why it matters, and what it means for your 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
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

JSON file 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 data 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

local-first project management app

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 your disk as the single source of truth—your ‘contract’—by storing data in human-readable JSON files.
  • Atomic file writes and tolerant read-merge cycles keep data safe and forward-compatible, even during crashes or schema changes.
  • One file per item prevents race conditions and makes external editing, backups, and recovery straightforward.
  • The architecture naturally supports offline work and simple sync via file copying, ideal for small teams or solo projects.
  • While simple and resilient, this approach works best for moderate datasets and collaborative scenarios where real-time updates aren’t critical.

What Does ‘Disk Is the Contract’ Really Mean?

At its core, ‘disk is the contract’ means your data’s authority lives on your machine’s filesystem. Instead of a server or cloud database dictating what’s true, the files themselves are the source of truth. When you open Threlmark, it reads these JSON files directly, and any external tool can do the same.

For example, a card in your project is just a JSON file under items/. If you edit that file, the app immediately sees the change. This simple, transparent approach eliminates layers of abstraction—no ORM, no complicated sync protocols. It’s like writing on a whiteboard, then having your app read that whiteboard directly. Disk Is the Contract: Inside Threlmark’s Local-First Architecture

What Does 'Disk Is the Contract' Really Mean?
What Does ‘Disk Is the Contract’ Really Mean?

How Threlmark Keeps Data Safe and Reliable Using Files

Using files might sound risky. What if the disk writes get interrupted? Threlmark handles this with two smart techniques: atomic writes and tolerant read-merge cycles.

Atomic writes mean each change is first saved to a temporary file, then renamed over the original. If your computer crashes during a save, the old file remains intact. It’s like slipping a new page into a binder—nothing gets lost or corrupted.

For example, updating a task card involves writing a new JSON file with a unique temp name, then replacing the old one in one atomic step. This guarantees no half-finished data.

Read-merge means the system reads the current file, updates only what’s needed, and preserves unknown fields. This makes future-proofing easy—new versions can add fields without breaking older tools.

Why JSON Files Over a Database? Real-World Benefits

Choosing JSON files for storage isn’t just about simplicity. It offers tangible advantages, especially for small teams or solo workflows. JSON is human-readable, so you can peek inside your data with a text editor, making debugging straightforward.

It also means no vendor lock-in. You can back up your entire project by copying files or sync folders with Dropbox or Syncthing—no special connectors needed. Plus, the format is flexible enough to evolve without breaking compatibility. Disk Is the Contract: Inside Threlmark’s Local-First Architecture

For instance, when Threlmark updates its data schema, it preserves old data intact, and tools can ignore unknown fields, making upgrades smooth.

Why JSON Files Over a Database? Real-World Benefits
Why JSON Files Over a Database? Real-World Benefits

One File Per Item: How It Handles Concurrency and Recovery

Imagine trying to edit a giant spreadsheet—everyone’s racing to change the same cell. Threlmark sidesteps this chaos by giving each card its own JSON file. This means multiple tools can edit different cards simultaneously without conflict.

When the app reads the list of cards, it dynamically checks the items/ folder to see what’s there. If a file is missing or corrupted, the system just skips it or shows a warning. This makes recovery easy—just delete or restore the file. smartcr.org auto-blogging.com

For example, if two external tools update different cards, both changes stick because they’re separate files. No need for complex locking or coordination.

The Self-Healing Board and Lane Management

Threlmark’s board isn’t just a static list. It’s a self-healing system that compares the lane order against actual items every time you load it. If a card gets moved or deleted, the board updates itself.

Imagine a kanban where a card accidentally gets dragged out of a lane. When you refresh, that gap closes, and the lane’s order restores based on the actual files present.

This approach keeps your workflow consistent without manual cleanup, even if external tools or scripts mess with your files.

The Self-Healing Board and Lane Management
The Self-Healing Board and Lane Management

Sync, Collaboration, and Offline Resilience

Threlmark’s architecture naturally supports offline work. Because data lives on your disk, you can keep editing, adding, or moving cards without the internet. When you’re back online, syncing is just copying files between devices.

Conflicts are rare because each file is atomic. But when overlaps happen—say, two devices edit the same card—Threlmark can resolve conflicts by timestamp or user choice. It’s a simple, reliable model that scales from solo projects to small teams.

For example, syncing a project via Dropbox ensures your team’s updates propagate smoothly, and offline edits stay intact.

Comparing Threlmark’s Approach to Traditional Apps

FeatureThrelmark (File-Based)
Data StorageJSON files on disk
Sync MethodFile copying / sync tools
Conflict ResolutionTimestamps / merge
Offline UseFull offline access
Schema FlexibilityForward-compatible, preserves unknown fields

What This Means for Your Workflow and Data Control

Using disk as the contract puts you in the driver’s seat. You back up by copying files. You migrate data by moving folders. Your data is transparent and portable.

For example, if you want to switch from Threlmark to another tool, just point it at the same JSON files. No APIs, no vendor lock-in, no cloud dependency.

This approach also boosts resilience: if your app crashes or your disk gets corrupted, you can recover by restoring files—no complex recovery procedures needed.

What Are the Tradeoffs? When This Architecture Might Not Fit

This design isn’t perfect for every case. Large datasets can slow down performance, since JSON parsing gets heavier with size. Schema evolution needs careful planning. And, if your team needs real-time collaboration at scale, a server-based system might be better.

For example, a massive project with thousands of cards might see slow load times. Or, a multi-user real-time editing environment might require a more traditional database approach.

Frequently Asked Questions

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

Syncing is as simple as copying files between devices using tools like Dropbox or Syncthing. Because each file is atomic, conflicts are minimized, and you can resolve them manually or via timestamps.

What happens if two devices edit the same card at the same time?

Threlmark resolves these conflicts by timestamp, with the latest change winning. For more complex scenarios, manual review or conflict markers can be used, but in general, the system favors simplicity and safety.

Why choose JSON over a traditional database?

JSON offers transparency, portability, and simplicity. You can directly read, edit, or back up your data without vendor lock-in. It’s ideal for small to medium projects that value control and resilience.

Is this architecture suitable for large-scale or real-time collaboration?

Not necessarily. For projects with thousands of items or those requiring instant multi-user edits, a server or CRDT-based system might be more appropriate. But for personal, small team, or offline workflows, this model shines.

Conclusion

Choosing to make your disk the contract rewires how you think about data. It’s no longer just storage—it becomes the entire interface, the backup, and the collaboration layer.

If you want control, resilience, and simplicity in your tools, this architecture offers a compelling blueprint. Your files are more than just data—they’re your project’s backbone. Imagine the possibilities when your work is just a folder away from being portable, editable, and unstoppable.

What Are the Tradeoffs? When This Architecture Might Not Fit
What Are the Tradeoffs? When This Architecture Might Not Fit
You May Also Like

Build vs Buy a Prebuilt AI Workstation

Thorsten Meyer AI says shortages and vendor pricing have weakened the old DIY cost edge for AI workstations, making build vs buy case-specific.

One upload in. A whole channel’s worth of content out.

ChannelHelm v1.5 adds A/B testing, thumbnail learning and retention-based clip selection for creators using one video across platforms.

Different Game, or Already Lost? Reading Mistral’s Sovereignty Bet

Explore if Mistral’s focus on sovereignty, open weights, and enterprise control is a strategic advantage or a sign of falling behind in the AI race. Get the full picture.

A War Room for Your Next Idea: Inside IdeaClyst

Thorsten Meyer AI details IdeaClyst, a local-first AI workspace for testing startup ideas through debate, research and private output.