TL;DR

Threlmark’s local-first architecture makes disk storage the single source of truth, enabling offline work, faster interactions, and seamless multi-device sync—all without a central database. This approach simplifies development and puts data ownership back in users’ hands.

Imagine an app where your data lives right on your device. No cloud, no server, no login required. It’s fast, private, and always available—even offline.

That’s the promise of Threlmark’s local-first architecture. Instead of relying on a central database, it treats your disk as the contract—the single source of truth. In this article, I’ll walk you through how this simple idea rewires everything from concurrency to collaboration, and why it might just be the future of smarter, more trustworthy 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

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

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

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

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

  • Threlmark uses local disk storage as the definitive record, making data portable and transparent.
  • Atomic file operations and merge strategies keep data safe and reduce conflicts.
  • One file per item prevents race conditions and simplifies concurrency handling.
  • The filesystem layout doubles as a human-readable API, easing integration and backups.
  • Local-first design reduces backend complexity, enhances privacy, and improves offline resilience.
SSK Portable SSD 1TB External Solid State Drives, up to 1050MB/s USB C SSD External Hard Drive USB 3.2 Gen2 for iPhone 15/16/17Pro, Windows, Mac, Android Phones and Tablets

SSK Portable SSD 1TB External Solid State Drives, up to 1050MB/s USB C SSD External Hard Drive USB 3.2 Gen2 for iPhone 15/16/17Pro, Windows, Mac, Android Phones and Tablets

  • Capacity Display: Shows 931GB on Windows, full 1TB on Mac
  • Fast Data Transfer: Up to 1050MB/s read, 1000MB/s write
  • Activity Indicator: LED light shows drive activity

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Why Threlmark’s Disk Is the Contract Changes Everything

Threlmark’s core idea is simple but revolutionary: your device’s storage is the definitive record of your data. This means the file layout isn’t just storage; it’s the API. Every tool, script, or app reads or writes directly to these files, making everything transparent and portable.

For example, a project folder might hold a `threlmark.json` manifest, individual card files under `items/`, and a `ROADMAP.md` mirror. This setup means you can back up, sync, or migrate your data by copying files—no vendor lock-in, no proprietary database.

Why Threlmark’s Disk Is the Contract Changes Everything
Why Threlmark’s Disk Is the Contract Changes Everything
Language Translator Pen, Portable Scanning Translator for Language Learners, 134 Languages Offline Use Intelligent Voice Translation Device with 3.0in

Language Translator Pen, Portable Scanning Translator for Language Learners, 134 Languages Offline Use Intelligent Voice Translation Device with 3.0in

  • Fast and Accurate Recognition: Over 98% accuracy in scanning
  • Networked Data Access: Connects to powerful backend server
  • Built-in Dictionaries: Includes professional dictionaries and thesaurus

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

How Threlmark Keeps Data Safe and Consistent with Files

Threlmark uses two key patterns to keep data safe on disk. First, *atomic writes*—every change writes to a temporary file that then `rename()`s over the original. This guarantees no half-written files, even if your system crashes mid-save.

Second, it employs *read-merge-write* strategies. When updating a card, it reads the current file, merges changes, and writes back atomically. This approach allows multiple tools to update data without clobbering each other, even when working offline.

Imagine editing a task in your app while another device adds a linked note. Both changes merge smoothly without conflicts, because each update respects the existing data structure.

MOVE SPEED 1TB USB Drives, ThumbDrive with Dual Ports & Push-Pull Design — 560MB/s Read Speed, Type C + USB 3.2 Drive Portable ssd for iPhone 15/16/17/Android/Mac

MOVE SPEED 1TB USB Drives, ThumbDrive with Dual Ports & Push-Pull Design — 560MB/s Read Speed, Type C + USB 3.2 Drive Portable ssd for iPhone 15/16/17/Android/Mac

  • Dual-Port USB-C and USB 3.2: Plug either side without flipping
  • Fast Data Transfer: 560MB/s read speed for quick file transfers
  • Push-Pull Design: Effortlessly switch between ports with slider

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

One File Per Card: How Threlmark Handles Concurrency and Repair

Instead of a giant JSON array, Threlmark stores each card in its own file (`items/.json`). This design avoids race conditions, because updating one card doesn’t risk overwriting others.

The *board* — the visual lanes of your roadmap — is stored in `board.json` but heals itself on each read. If a card disappears or gets misplaced, the system automatically re-syncs, keeping everything aligned.

For example, if you drag a card between lanes, only that card’s file updates, not the entire list. And if a card is deleted, it gets marked as archived rather than lost, preserving history.

One File Per Card: How Threlmark Handles Concurrency and Repair
One File Per Card: How Threlmark Handles Concurrency and Repair
ELOBOON Fireproof Document Box with 13 Pockets Accordian File Organizer, Water-Resistant File Organizer Box with Lock, Collapsible File Storage Cabinet for Hanging Letter/Legal Folder, Black
  • Fireproof and Water-Resistant Material: Withstands up to 2000°F, SGS certified
  • Fits Letter and Legal Files: Dimensions 15.55"L x 12.2"W x 13"H
  • Multi-Purpose Storage: Stores documents, clothes, toys, and more

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

The Role of the Filesystem as the API — Real Benefits for You

Using the filesystem as the API means everything is inspectable, modifiable, and portable. Want to see your project’s structure? Just `cat` the files. Need to compare versions? Use `diff`. Want to migrate data? Copy the folder. Learn more about disk-based architectures.

For instance, if you want to integrate Threlmark with a script, just read or write the JSON files directly. No special SDK or database driver needed.

This approach also simplifies backups and restores: just copy your entire data directory. It’s like having a raw, human-readable database in your hands.

Sync, Collaboration, and Conflict Resolution Without a Server

Threlmark handles multi-device sync in the background, using a simple folder of files that all devices can access. Changes are merged automatically, thanks to merge strategies that respect the existing data. For more on sync strategies, see this deep dive.

For example, if two devices update the same card at once, the system merges the changes or flags conflicts. This makes collaboration feel seamless, even when offline or on flaky networks.

In more advanced setups, CRDTs (Conflict-free Replicated Data Types) can be employed to resolve concurrent edits gracefully. The key is that the disk layout and merge logic stay the same, regardless of how complex the sync gets.

Sync, Collaboration, and Conflict Resolution Without a Server
Sync, Collaboration, and Conflict Resolution Without a Server

Real-World Benefits for Developers and Users

For users, Threlmark means instant access, offline capabilities, and full data ownership. No login, no cloud dependency. Imagine working on your project during a flight, then syncing once back online, with no data loss or conflicts. Discover more about secure data management.

Developers get a simpler backend. No database migrations, no server-side logic. Just files. This reduces bugs, speeds up iteration, and enhances security—since data never leaves your device unencrypted.

For example, teams can share folders through Dropbox or Git, and everyone stays in sync without server complexity. That simplicity can cut infrastructure costs and reduce maintenance headaches.

Hard Problems & Limitations — What You Need to Watch Out For

File-based systems aren’t magic. Sync conflicts, schema migrations, and data corruption can still happen if you’re not careful. Handling conflict resolution requires thoughtful merge strategies, especially for complex data. For insights on managing such issues, visit this resource.

For example, merging two simultaneous edits to a project’s card requires rules—CRDTs or custom logic—to avoid data loss.

Migration is another challenge: updating schemas without breaking existing data demands careful planning and versioning.

Finally, large files or many small files can slow things down—so consider batching or indexing for bigger projects.

Hard Problems & Limitations — What You Need to Watch Out For
Hard Problems & Limitations — What You Need to Watch Out For

The Future of Local-First Apps: More Than Just Files

As tools evolve, local-first architecture is moving beyond simple file layouts. Integrations with IndexedDB, service workers, or even custom databases are making it easier to build scalable, conflict-free apps.

For example, some apps use CRDTs layered on top of local databases, syncing changes via background jobs. Others employ hybrid models—local storage with optional cloud sync.

What’s clear: treating the device’s disk as the contract is just the start. The principles of openness, safety, and offline-first design are shaping the next wave of resilient, user-centric software.

Frequently Asked Questions

What exactly does “local-first” mean, and how is it different from “offline-first”?

Local-first means your device’s storage is the primary source of truth—data lives on your disk and syncs in the background. Offline-first focuses on your app working without internet; local-first ensures your actual data is always on your device, even if offline.

Where is the source of truth in a local-first app like Threlmark?

The source of truth is the files stored directly on your device. Threlmark’s layout makes these files the definitive record, so copying or backing up these files preserves your entire data set.

How does multi-device sync work without a server?

Devices share the same files, often via cloud sync like Dropbox or Git. Changes are merged locally, and conflict resolution strategies ensure data stays consistent across devices. The system is designed to handle concurrent edits gracefully.

What happens if two people edit the same item at the same time?

Threlmark employs merge strategies—either automatic CRDT-based resolution or conflict markers—to reconcile concurrent changes. This keeps everyone’s work safe and consistent without manual intervention.

Are local-first apps more secure and private?

They can be, since data stays on your device and doesn’t rely on a central server. End-to-end encryption is easier to implement, and you control backups and sync. But security depends on proper implementation.

Conclusion

Thinking of disk as the contract rewires how we build and trust apps. It’s a simple shift—your device is the authority, not some remote server—and it unlocks faster, more private, and more resilient workflows.

Next time you pick a tool, ask: does it treat my disk as the source of truth? If it does, you’re probably on the right path.

You May Also Like

Mobilisiert, nicht ausgegeben: Was von Europas €200-Milliarden-KI-Offensive übrig bleibt

EU’s €200B InvestAI figure relies on private capital, with €50B public money and a July 2026 call for AI gigafactories.

Technology Is Never Neutral: Pope Leo XIV’s AI Encyclical, and the Empty Chairs in the Room

Pope Leo XIV released his first AI encyclical, with Anthropic’s Chris Olah at the Vatican and other frontier labs absent from the panel.

Alphabet to Raise $80 Billion in Equity Capital for AI Spending

Alphabet plans to raise $80 billion via equity offerings, including a deal with Berkshire Hathaway, to fund its AI development efforts.

National Airlines Receives IATA IEnvA Certification At IATA Headquarters

National Airlines has received IATA’s IEnvA certification at IATA Headquarters, marking a significant step in environmental management for the carrier.