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

TL;DR

Threlmark treats the local disk as the primary record, making data portable and safe without relying on a database or server. This design simplifies concurrency, enhances safety, and promotes interoperability, enabling seamless multi-tool collaboration.

Imagine a tool that never breaks because of a server crash. One that works offline, syncs smoothly across devices, and lets you peek into every piece of data—no hidden databases, no cloud lock-in. That’s the beauty of Threlmark’s local-first architecture, where the disk isn’t just storage—it’s the contract.

In this article, you’ll see how this simple yet powerful idea shapes everything from concurrency to external integrations. If you care about data portability, safety, and a system that just works, you’ll want to understand how Threlmark’s design turns the traditional model upside down.

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

external SSD portable storage

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 backup 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 synchronization tools

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

offline data management software

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 disk as the definitive source—no central server needed.
  • Use atomic file writes to keep data safe and prevent corruption.
  • One file per item simplifies concurrency and makes updates quick.
  • Organize files and folders as a formal contract—any tool can join in.
  • External tools and AI agents can just read/write files for seamless integration.

Why Treating the Disk as the Single Source of Truth Changes Everything

In Threlmark, the disk isn’t just where data lives—it’s the ultimate authority. No server, no cloud, just files that you can read, edit, and share directly. This approach makes the system incredibly resilient: if your app crashes, your data stays safe and accessible. Learn more about local-first architecture.

For example, a developer working on a complex multi-project roadmap can back up their entire setup by copying a folder. No need for complicated database exports or worrying about sync conflicts—everything is a plain file.

This decision simplifies collaboration. External tools, scripts, or even AI agents can participate just by reading and writing files, making the whole ecosystem more flexible and open. It’s like turning your computer into a tiny, self-contained database that’s always in your hands.

However, this approach also implies a tradeoff: it shifts complexity from runtime to the design of the file structure and versioning. Ensuring data consistency, especially across multiple concurrent edits, requires thoughtful organization and atomic operations. It’s a deliberate choice to favor transparency and resilience over the convenience of traditional databases, which may hide complexity but at the cost of lock-in and opacity.

Why Treating the Disk as the Single Source of Truth Changes Everything
Why Treating the Disk as the Single Source of Truth Changes Everything

How Threlmark Keeps Data Safe with Atomic File Operations

Atomic writes are the secret sauce here. Every change to a file first gets saved as a temporary file, then renamed over the original. If your computer crashes mid-write, you’re left with either the old or the new file—never a half-baked mess. Discover more about atomic file operations.

Imagine updating a roadmap card: instead of overwriting the file directly, Threlmark creates a temp file, then swaps it in. This guarantees data integrity, even during power outages or system errors.

But why does this matter? Because in distributed or offline environments, partial writes can corrupt data, leading to inconsistencies or loss. Atomic operations prevent this, ensuring that each change is either fully applied or not at all. This tradeoff means your data remains reliable, but it requires disciplined implementation—every write must be atomic, and the system must handle potential failures gracefully.

In practice, this approach enables robust offline editing, seamless recovery, and straightforward synchronization, because each file change is a discrete, consistent operation. It’s a fundamental enabler of the system’s resilience and safety.

One File Per Item: Why It Beats a Big List

Instead of a giant JSON array for the whole roadmap, Threlmark uses one file per item. This tiny change reduces race conditions and makes updates lightning-fast. See how file-per-item design improves concurrency.

Picture editing a task: you just replace a single file. No need to read or write the entire list. Multiple tools can update different cards simultaneously without stepping on each other.

This approach also facilitates easier conflict resolution. When multiple sources modify different files, conflicts are less likely because each change is isolated. If a conflict does occur, it’s easier to identify and resolve since each item is a separate file.

Moreover, this design enhances reliability: if a single file becomes corrupted, only that item is affected, not the entire dataset. This modularity makes the system more robust and easier to maintain, especially as the data set grows or becomes more complex.

In essence, storing one item per file is a tradeoff that favors concurrency, fault tolerance, and simplicity over the convenience of bulk operations, which can be slower and more error-prone when dealing with large datasets.

One File Per Item: Why It Beats a Big List
One File Per Item: Why It Beats a Big List

How the Directory Structure Acts as a Contract, Not Just Files

The way files are organized in Threlmark is a formal contract. The root has a manifest (`threlmark.json`), project folders, and special directories like `items/`, `suggestions/`, and `handoffs/`. Each piece of data lives in a predictable spot. Learn about directory structures as data contracts.

This structure lets any external tool or script understand the system without custom APIs. Want to add a new card? Just drop a file in `items/`. Need to suggest a change? Place it in `suggestions/`. It’s all about clarity and openness.

Beyond simplicity, this directory layout acts as an explicit protocol that defines how data is organized, shared, and understood. It reduces ambiguity and dependency on proprietary APIs, making the system more adaptable and resilient. If you copy the folder elsewhere, the structure itself guides the system’s interpretation, ensuring compatibility without additional configuration.

This approach embodies a philosophy: clear, predictable, and open data organization can replace complex API contracts, fostering a more flexible ecosystem where external tools can easily participate without bespoke integrations.

External Tools and AI Agents? Just Read and Write Files

Threlmark’s design makes external integrations straightforward. Any script or AI agent can participate by reading or writing files in the designated folders. No special APIs, no permissions—just plain files. Explore how file-based integrations work.

For instance, an AI code assistant can scan `reports/` for completed tasks, then decide what to do next. Or an external script can suggest new cards by dropping JSON files into `suggestions/`. This open approach fosters collaboration across tools and platforms.

However, this openness also means that external tools must respect the file conventions and handle conflicts gracefully. Since there are no built-in locking mechanisms, tools need to coordinate or accept occasional conflicts, emphasizing the importance of atomic operations and versioning. This tradeoff favors simplicity and openness but requires careful design of external integrations to prevent data corruption or inconsistency.

External Tools and AI Agents? Just Read and Write Files
External Tools and AI Agents? Just Read and Write Files

How Threlmark Handles Concurrency Without a Database

Concurrency is often a headache in traditional apps—locks, transactions, race conditions. Threlmark sidesteps all that by using single-file atomic writes and read-merge strategies.

When two tools update different cards, they write their changes independently. Threlmark’s read-merge preserves each update, and atomic writes prevent conflicts from corrupting data.

But why does this work? Because atomic file operations guarantee that each change is either fully applied or not at all, preventing partial or conflicting updates. The read-merge strategy allows multiple tools to work asynchronously, combining their changes in a way that preserves data integrity. This approach is especially powerful in offline scenarios, where conflicts are inevitable but manageable, provided the system is designed to handle merges intelligently.

In essence, this design trades the complexity of locking and transactions for disciplined file operations and merging logic, which simplifies development and enhances robustness in multi-tool environments.

Why This Matters for Your Workflow and Data Safety

Choosing disk as the contract means your data isn’t trapped in a cloud or a proprietary database. You can back it up, migrate it, or even edit it manually without losing compatibility.

This model also means your data is more resilient to failures. Since files are plain and accessible, a system crash doesn’t corrupt your data—just leave the files as they are, and you can recover or restore easily. External tools can step in during downtime or emergencies without breaking the system, fostering a resilient, open ecosystem.

Furthermore, this approach encourages a mindset of transparency and control. You can see exactly how your data is stored, modify it directly if needed, and understand every change. This openness enhances trust and security, as you’re not relying on opaque proprietary systems.

Why This Matters for Your Workflow and Data Safety
Why This Matters for Your Workflow and Data Safety

When Local-First Fails and What to Watch Out For

Local-first isn’t perfect for every app. Highly transactional systems with strict consistency needs might struggle with conflict resolution or sync delays.

If your app requires real-time, multi-user updates with zero conflicts, this architecture might need adjustments or supplementary synchronization layers.

For example, a banking app or stock trading platform demands absolute consistency—something that’s harder to guarantee with file-based syncs, especially when offline scenarios are frequent. In such cases, the tradeoffs of simplicity and resilience might not align with the strict requirements for immediate consistency.

Always weigh your data’s criticality, collaboration needs, and offline requirements before choosing this approach. Sometimes, hybrid solutions—combining local files with additional synchronization mechanisms—are more appropriate.

Frequently Asked Questions

How does Threlmark handle syncing between devices?

Threlmark doesn’t sync automatically. Instead, it relies on copying the entire folder or using external sync tools like Dropbox. Changes are in plain files, so syncing is as simple as syncing files across devices.

Can I manually edit or recover data from the files?

Absolutely. Since all data is stored as JSON files, you can open, edit, or recover data manually with any text editor or JSON tool. This makes backups and recovery straightforward.

What if two tools modify the same file at once?

Threlmark uses atomic writes and read-merge strategies to prevent corruption. If two tools update different parts, the system merges changes safely. Conflicts are rare and manageable, thanks to file-level operations.

Is this approach suitable for real-time multi-user collaboration?

It depends. For simple, asynchronous collaboration, yes. For real-time, zero-conflict editing, a more robust system might be needed. Local-first works best when offline resilience and portability are priorities.

Conclusion

Threlmark’s local-first architecture proves that simplicity can be powerful. When the disk is the contract, your data becomes portable, safe, and easy to work with—no lock-in, no fuss.

Next time you build a tool, ask yourself: can I make the disk the single source of truth? It’s a small change with huge potential. Your data, your rules, your system—built on plain files.

You May Also Like

The Impact of Demographics: Aging Population’s Effect on Markets

The Impact of Demographics: Aging Population’s Effect on Markets explores how shifting demographics are transforming industries and shaping future economic opportunities—discover the full story.

Router and Modem Backup Basics: The Family Planning Detail That Prevents Chaos

Keenly prepared with router and modem backups, you can avoid chaos—discover the essential family planning details that ensure seamless connectivity during hardware failures.

Emergency Preparedness Checklists for Retirees: What to Set Up Before a Crisis Hits

Before a crisis hits, set up a thorough emergency plan by securing…

Should Seniors Keep Buying Gold After Age 70½? Experts Weigh In

Keeping gold in your retirement portfolio after age 70½ offers benefits and risks; discover what experts recommend to make the best decision.