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

TL;DR

Threlmark treats on-disk JSON files as the single source of truth, enabling offline use, easy synchronization, and full transparency. This simple, file-based approach challenges conventional database reliance and enhances resilience and control.

Imagine a project management tool that works entirely offline, keeps your data transparent and portable, and requires no server at all. That’s what Threlmark does, leveraging a file-based approach. It’s a different way to think about data, where your disk isn’t just storage — it’s the contract, the API, and the single source of truth.

In this article, you’ll see how Threlmark’s architecture turns the idea of “disk as the contract” into a practical, powerful reality. We’ll unpack how plain JSON files on your disk power everything — from speed and resilience to collaboration and AI automation. If you’re tired of opaque databases and want a clear, flexible approach, this deep dive is for you.

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 editor

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

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

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
Local Data Storage in Kotlin: Managing Databases in Android Environments (The Android Developer's Playbook)

Local Data Storage in Kotlin: Managing Databases in Android Environments (The Android Developer's Playbook)

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 source of truth — files are both data and API.
  • Use one JSON file per item to prevent race conditions and enable concurrent edits.
  • Atomic write patterns keep data safe even when crashes happen mid-update.
  • A simple folder structure makes data inspection, migration, and backup straightforward.
  • Local-first design boosts speed, resilience, and control, especially offline.

Why Threlmark’s ‘disk is the contract’ flips the script

At the core, Threlmark treats your disk as the definitive record of all data. No central server, no cloud database. Instead, every project, card, and dependency lives in plain JSON files that you can open, edit, and understand. This makes the system transparent and easy to debug, similar to how disk as the contract emphasizes transparency.

For example, a card’s metadata is stored in a file like items/abc123.json. When you update it, the change is just a file write. No need to worry about database schemas or API contracts. The files are both the data and the API.

This approach aligns perfectly with the principles of local-first systems, where offline access, speed, and simplicity matter most. Threlmark’s design ensures your data is always available, always understandable, and always under your control.

While this model offers significant benefits, it also comes with tradeoffs. For instance, managing data consistency across multiple devices requires careful synchronization logic, and handling large datasets might become less efficient compared to optimized databases. However, the transparency and control gained often outweigh these challenges for many use cases.

Why Threlmark’s ‘disk is the contract’ flips the script
Why Threlmark’s ‘disk is the contract’ flips the script

How the JSON-on-disk model keeps your data human-friendly and flexible

Plain JSON files are like open notebooks: easy to read, edit, and manage. Threlmark uses one JSON file per item, making each task or card a tiny, self-contained document. This setup allows you to peek inside your project’s brain at any moment, much like the principles discussed in local-first architecture.

For example, if you want to see all tasks, just open the items/ folder. You’ll see individual files with fields like id, title, status, and createdAt. No special tools needed.

This format also makes evolving your data schema straightforward. You can add new fields or tools without breaking existing files, because JSON is inherently flexible. This flexibility is crucial for iterative development, where requirements often change, and schemas need to adapt without disrupting existing data. Moreover, developers can write scripts or use editors to manipulate data directly, fostering transparency and empowering users to understand and modify their data as needed.

However, this flexibility requires discipline. Without proper validation, inconsistent data can creep in, so implementing validation routines or conventions is essential to maintain data integrity over time. This approach emphasizes transparency and adaptability but demands attention to data quality as your system evolves.

Making file-based state safe: atomic writes and tolerant merging

Writing files might sound risky, but Threlmark uses two smart patterns to keep data safe. First, it writes to a temporary file and then atomically renames it. This way, crashes or interruptions never corrupt your data.

Second, when updating, it reads the current file, merges changes, preserves important fields, and writes back atomically. This read-merge-write cycle keeps your files consistent and forward-compatible.

For example, if a task’s status changes from ‘In Progress’ to ‘Done’, the system reads the existing file, updates the status field, and writes it safely without risking partial updates or data loss. This pattern ensures data integrity even in unpredictable environments, such as power failures or abrupt shutdowns, which are common in real-world scenarios. For more on resilient data handling, see local-first systems. It also simplifies error recovery and minimizes the need for complex locking mechanisms typically used in databases, making the system more resilient and easier to reason about.

Making file-based state safe: atomic writes and tolerant merging
Making file-based state safe: atomic writes and tolerant merging

One file per item: how Threlmark avoids race conditions and keeps things moving

Instead of a giant list of tasks in a single file, Threlmark creates one JSON file per card. This design prevents race conditions — multiple tools can update different cards simultaneously without clobbering each other.

Every write is atomic, so no lock or negotiation is needed. External tools can add, change, or move individual cards independently. The system then reconciles the actual files with the project’s lane order on each read.

This approach significantly reduces the complexity of concurrent editing, aligning with strategies discussed in local-first architecture. It allows multiple users or tools to work on different parts of the data without locking or waiting. This is especially important in collaborative environments where real-time updates are desirable but locking mechanisms can hinder performance. By isolating each item into its own file, Threlmark simplifies concurrency management, enabling a smoother, more scalable workflow.

How Threlmark’s architecture handles sync, conflict, and offline use

Threlmark’s system is designed for offline-first work. Changes happen locally, and sync happens in the background. When connected, it can merge updates from multiple devices smoothly.

Conflicts are managed by simple merge strategies—if two devices edit the same file, the system can merge or flag conflicts for manual resolution. Learn more about conflict resolution in local-first systems. This keeps data consistent without complicated locking.

For example, if two team members update the same task differently, Threlmark’s tolerant merge preserves both changes initially, then prompts for resolution if needed. This approach emphasizes flexibility and user control, allowing seamless operation in environments with intermittent connectivity. It also reduces the complexity typically associated with conflict resolution, making the system more resilient and easier to troubleshoot.

How Threlmark’s architecture handles sync, conflict, and offline use
How Threlmark’s architecture handles sync, conflict, and offline use

Why this approach boosts speed, resilience, and control

By avoiding network calls and using local files, Threlmark feels instant. You see updates right away, without waiting for server round-trips. This makes the whole experience snappy and reliable.

Resilience comes naturally — if your internet drops, your data is still there, and your work continues without interruption. Plus, full control over your files means you can back up, migrate, or inspect your data anytime.

While this approach offers significant advantages, it also requires careful management of local data. Users must be mindful of syncing and conflicts, especially in collaborative scenarios. The tradeoff is that you gain speed and resilience at the cost of some added complexity in synchronization management, which can be mitigated with good tooling and clear workflows.

Practical tips for building with a file-based, local-first mindset

  • Use atomic file writes for all data updates.
  • Design your data as self-contained JSON files per item.
  • Implement background sync that merges changes from multiple devices.
  • Keep your directory structure simple and inspectable.
  • Preserve unknown fields for schema flexibility and future growth.

How Threlmark stacks up against traditional server-based apps

FeatureThrelmark (File-based)Traditional (Server-based)
Data storagePlain JSON files on diskSQL/NoSQL database
Offline useFull, local accessLimited, depends on connectivity
SyncBackground, merge-basedNetwork round-trip, API calls
SpeedInstant, localVariable, network-dependent
TransparencyHigh — files are inspectableOpaque, internal database

Building with this model: when it works best

If your project demands offline capability, transparency, or simple collaboration, Threlmark’s approach shines. It’s ideal for solo developers, small teams, or complex systems needing full control.

However, for extremely large datasets or high-concurrency environments, the simplicity might hit limits. Think of it as a toolbox for the right problems — not a one-size-fits-all solution.

Frequently Asked Questions

What does ‘disk is the contract’ really mean?

It means your application’s core data lives directly in files on your disk, and these files define everything — they are both the storage and the interface. No middle-layer database required.

Why use JSON files instead of a database?

JSON files are human-readable, easy to inspect, and simple to manipulate with scripts. They make the system transparent and flexible, perfect for local-first, offline-capable apps.

How does the app stay consistent across devices?

By syncing JSON files between devices using background processes that merge changes. Conflicts are handled with simple merge strategies, keeping data consistent without locks.

What happens when two devices edit the same data?

Threlmark merges changes intelligently, preserving both updates initially. If conflicts arise, it prompts for manual resolution, ensuring no data is lost.

Is this approach good for collaboration?

Yes, especially for small teams or projects needing offline access. The file-based system supports concurrent edits and easy sync, making collaboration straightforward.

Conclusion

Threlmark’s approach proves that simplicity can be powerful. By making your disk the contract, you gain transparency, speed, and resilience that traditional databases struggle to match. It’s a reminder that sometimes, the best architecture is the one you can see and understand.

If you want your apps to be faster, more resilient, and more under your control, consider how a plain JSON file might be all you need to build something truly robust. Your data, your rules, your way.

Building with this model: when it works best
Building with this model: when it works best
You May Also Like

QAtrial Launches Enterprise-Ready Open-Source Quality Management Platform

QAtrial’s latest release offers Docker deployment, SSO, validation docs, webhooks, and Jira/GitHub integrations under AGPL-3.0 license, enabling enterprise-grade quality management.

Uber’s COO says it’s getting harder to justify money spent on tokenmaxxing

Uber’s operations chief Andrew Macdonald states that it is increasingly hard to justify AI investment costs amid questionable returns, signaling a shift in company priorities.

Private equity bought America’s essential services

Private equity firms have acquired and consolidated critical industries like fire trucks, raising concerns over service quality, pricing, and public safety.

When a Content Network Starts Publishing to Itself

Discover how content networks are shifting from relying on external publishers to self-publishing, gaining control, speed, and higher margins. Learn the keys to success.