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

TL;DR

Threlmark’s local-first approach treats disk storage as the primary contract, making data portable, safe, and instantly available. This design simplifies concurrency, enables offline use, and allows seamless external tool participation without a centralized database.

Ever tried to coordinate a team project where everyone’s data lives in different apps, formats, or clouds? It’s chaos. Threlmark flips that chaos into clarity. Its core idea? The disk isn’t just storage — it’s the contract, the source of truth, the backbone of your entire workflow. This means everything from project cards to dependencies lives as simple files on your drive, not in some remote database.

Why does this matter? Because it makes your system incredibly resilient, portable, and open. No lock-in, no server dependency, just a folder of JSON files that anyone can read, write, or extend. We’ll explore how this design shapes everything from concurrency to external integrations — and how it makes your project management smarter and safer.

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
SANDISK 1TB Extreme Portable SSD (Old Model) - Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware - External Solid State Drive - SDSSDE61-1T00-G25

SANDISK 1TB Extreme Portable SSD (Old Model) – Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware – External Solid State Drive – SDSSDE61-1T00-G25

Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity…

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 storage

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

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
MOBILE OFFLINE-FIRST APPLICATION DESIGN: Local persistence sync strategies and resilient connectivity handling

MOBILE OFFLINE-FIRST APPLICATION DESIGN: Local persistence sync strategies and resilient connectivity handling

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 files as the definitive contract — simple, transparent, and portable.
  • Use one file per item with atomic writes to avoid race conditions and conflicts.
  • External tools and AI agents can participate by reading and writing plain JSON files, no special permissions needed.
  • Local-first design makes your app faster, more resilient, and offline-capable, especially for project management and collaboration.
  • Choose storage primitives based on your needs, but prioritize atomicity and simplicity to prevent corruption.

Why Treat the Disk as the Single Source of Truth?

In Threlmark, the disk isn’t just storage — it’s the contract. Every file, every folder, tells the story of your project. Imagine a folder with threlmark.json at the root, a links.json mapping dependencies, and individual .json files for each task card. This setup guarantees that what you see on disk is exactly what everyone else or any tool will read.

Take the scenario of a developer working offline. They add a new task, save it as a JSON file, and instantly see it reflected in their project—no waiting for a server response. When they reconnect, sync is just a matter of updating the files. This direct approach means fewer surprises, more control, and total transparency.

Deeply, this approach underscores the importance of data consistency and user control. When the source of truth is on disk, there’s no ambiguity about what the current state is; everyone works from the same definitive set of files. However, this also shifts the complexity to managing updates and conflicts, which must be handled carefully to prevent divergence. The tradeoff is simplicity and transparency versus the need for disciplined synchronization, but the payoff is a system that is inherently more understandable and debuggable.

Why Treat the Disk as the Single Source of Truth?
Why Treat the Disk as the Single Source of Truth?

How the File Structure Supports Concurrency and Collaboration

Imagine two people editing the same project at once. Traditional systems risk overwrites or conflicts. Threlmark avoids this by using a file-per-item model. Each task gets its own .json file in the items/ folder. When someone updates a task, they overwrite just that file. Because each write is atomic — first writing to a temp file, then renaming — conflicts are minimized.

Moreover, the project’s lane order is stored separately in board.json. Every time it reads, it reconciles against the current set of items, fixing missing or orphaned cards automatically. This self-healing design keeps the data consistent, even if external edits happen out of sync.

Deeply, this structure emphasizes modularity and conflict resilience. By isolating each item into its own file, concurrent edits are less likely to clash directly. The atomicity of file operations ensures that partial updates won’t corrupt data. The reconciliation process, which automatically detects orphaned or missing items, acts as a form of integrity check, reducing manual cleanup and preventing data divergence. Nonetheless, this model assumes a level of discipline in how tools and users perform updates; mismanagement can still lead to conflicts that require manual resolution. The tradeoff favors simplicity and robustness, but it’s essential to understand that conflict management remains an ongoing concern in collaborative environments.

The Power of Atomic Writes and Tolerant Merging

Atomic writes are the backbone of safe file updates. Think of it like flipping a switch: either the old file stays, or the new one takes over — never something in between. Threlmark’s code writes changes to a temporary file and then renames it, ensuring no partial writes corrupt the data. This approach is crucial when multiple tools or devices update files simultaneously.

Alongside this, the system reads existing files, merges updates carefully, and preserves unknown fields. This tolerant normalization means older tools won’t break if new fields appear, and vice versa. It’s like having a flexible contract that grows without tearing.

Deeply, this method recognizes that in collaborative, multi-device environments, updates can come in at unpredictable times and from various sources. Atomicity guarantees that each update is complete and uncorrupted, preventing subtle bugs or data corruption. The merging strategy, which respects unknown fields, ensures that extensions or changes in data structure don’t break compatibility. This flexibility is essential for long-term maintainability, as it allows the system to evolve without forcing all tools and users to upgrade simultaneously. The tradeoff is that merging logic must be carefully designed to handle conflicts gracefully, but when done right, it offers a resilient and adaptable foundation for collaborative workflows.

The Power of Atomic Writes and Tolerant Merging
The Power of Atomic Writes and Tolerant Merging

How Threlmark’s Architecture Empowers External Tools and AI Agents

One of Threlmark’s clever tricks? Its files are open, plain JSON documents anyone can read or write. External tools, like IdeaClyst or AI agents, don’t need special permissions or APIs. They simply modify the files directly in the items/ folder or other designated zones.

For example, an AI agent can scan the suggestions/ folder for new ideas, process them, and drop back completed tasks into reports/. This openness boosts collaboration and automation, as external tools can participate without complex integrations.

This design makes the system highly extensible. Developers can add plugins, scripts, or AI workflows that act on the same set of files, keeping everything transparent and compatible.

Deeply, this openness reduces barriers to integration and encourages innovation. By allowing external entities to read and write files without intermediary APIs, the architecture promotes a plug-and-play ecosystem. However, this approach also requires disciplined file management—without proper safeguards, external tools might overwrite each other or corrupt data. The tradeoff is increased flexibility and simplicity versus the need for careful coordination and versioning in external workflows.

Why Local-First Makes Everything Faster and More Resilient

When your data lives on disk, access becomes lightning-fast. No waiting for network requests, no latency. Imagine clicking a task and instantly seeing it update — that’s the power of local-first architecture.

Plus, if your internet drops, your work doesn’t stop. The data stays available, editable, and safe. When back online, sync is just a matter of updating files, not waiting on a server. This resilience is a game-changer for remote teams, fieldwork, or anywhere connectivity is patchy.

Deeply, this speed and resilience come from removing the dependency on remote servers for everyday operations. It shifts the focus from network reliability to local hardware, which is typically more dependable and faster. Offline capability ensures continuous productivity, reducing frustration and downtime. However, this also means that synchronization strategies must be robust to handle conflicts, delays, or network disruptions. The tradeoff is that local-first architecture emphasizes speed and resilience at the expense of more complex sync management, which must be handled thoughtfully to prevent data inconsistencies.

Why Local-First Makes Everything Faster and More Resilient
Why Local-First Makes Everything Faster and More Resilient

Handling Conflicts and Ensuring Data Integrity

Conflicts are inevitable in distributed systems, but Threlmark handles them gracefully. When two devices edit the same task simultaneously, the last write wins—unless you implement more sophisticated conflict resolution.

Since each file is atomic, conflicts are just overwritten, but you can also add timestamps or versioning in the JSON to detect and resolve issues. The key is transparency: knowing what changed and when helps you decide the best fix.

Deeply, conflict handling in Threlmark relies on understanding the nature of concurrent modifications. Implementing timestamps or version numbers in JSON files can help identify the most recent change, enabling automated or manual resolution strategies. For example, a conflict might be resolved by choosing the latest timestamp or prompting the user to review differences. This transparency is critical for maintaining trust and data integrity, especially when multiple devices or users are involved. While the last-writer-wins approach is simple, it may not suit all scenarios; more complex conflict resolution methods can be integrated as needed, but always with an eye toward clarity and user control. The tradeoff involves balancing simplicity with robustness—more sophisticated conflict resolution can prevent data loss but adds complexity.

Choosing the Right Storage Primitives for Your App

Threlmark relies on plain JSON files, but other storage options exist. For high performance or complex queries, embedded databases like SQLite can work, but they add complexity. The key is atomicity and simplicity — avoid partial writes or corruption.

Tools like Git or Syncthing can sync these files across devices, making your data portable. For larger or more sensitive apps, consider encrypting files or adding version control layers.

Deeply, the choice of storage primitives impacts both the complexity and robustness of your application. Plain JSON files offer maximum simplicity and transparency, facilitating easy external editing and debugging. However, for applications with demanding performance needs or large datasets, layered storage solutions like embedded databases can provide faster queries and richer data structures, but at the cost of increased complexity and potential atomicity challenges. The decision should weigh the importance of simplicity, speed, and data integrity, recognizing that no single solution fits all scenarios. Threlmark demonstrates that with disciplined management, simple files can serve many use cases effectively, but understanding your specific requirements is crucial for optimal architecture.

Choosing the Right Storage Primitives for Your App
Choosing the Right Storage Primitives for Your App

When Local-First Isn’t the Right Fit

While local-first is powerful, it’s not for everything. Apps requiring strict server-side validation, real-time collaboration with tight latency, or compliance with sensitive data laws might need more controlled architectures.

Think of highly regulated financial systems or large-scale enterprise apps. In these cases, centralized databases or hybrid approaches may serve better. The key is understanding your app’s priorities around speed, offline capability, and data control.

Deeply, this caveat reminds us that no architecture is one-size-fits-all. While local-first excels in many scenarios, especially where offline access and user control are paramount, it can introduce challenges in maintaining consistency at scale or meeting strict regulatory requirements. For applications with real-time, multi-user editing or sensitive compliance needs, a more centralized or hybrid approach might be necessary. Recognizing these tradeoffs ensures that developers choose the architecture best suited to their specific context, balancing speed, resilience, and control with complexity and compliance demands.

Frequently Asked Questions

What does ‘disk is the contract’ really mean?

It means that the data stored as files on disk serve as the ultimate source of truth. Any tool or user reads and writes these files directly, making the system simple, transparent, and resilient.

How does this approach handle conflicts from multiple devices?

Each file is updated atomically, so conflicts are minimized. When conflicts do happen, last-writer-wins or versioning can help resolve them automatically or manually, ensuring data integrity.

Can I use this architecture with large datasets?

Yes, but it depends. Plain files work well for smaller, manageable datasets. For larger or more complex data, consider layered storage like embedded databases, but keep atomicity and simplicity in focus.

Is this approach suitable for real-time collaboration?

It can support near-real-time updates if synced frequently. But for ultra-low latency collaboration, a more networked, server-based approach might be better—though Threlmark’s design excels in offline and multi-device scenarios.

How do I start implementing a disk-as-the-contract system?

Begin by structuring your data as separate JSON files, ensure your writes are atomic, and decide on a sync method like Git or Syncthing. Keep the architecture simple, and expand from there.

Conclusion

In the end, Threlmark’s disk-as-contract approach turns complex distributed workflows into straightforward file-based systems that anyone can understand and extend. It’s a reminder that sometimes, the simplest tools—plain files—are the most powerful.

Next time you build a collaborative app or a multi-device workflow, ask yourself: how can I make the data as transparent and resilient as Threlmark’s design? Because in the world of project management, the disk is more than storage — it’s the contract.

You May Also Like

Capture Fall Foliage: Smartphone Photography Tips

I’m here to help you capture breathtaking fall foliage with your smartphone—discover expert tips that will elevate your photos beyond the ordinary.

Noise-Cancelling Headphones Explained: The Tech Behind Peace and Quiet

Noise-cancelling headphones harness advanced technology to block out distractions, offering peace and quiet—discover how these features work together to transform your listening experience.

The Docking Station Ports You’ll Regret Not Checking First

When choosing a docking station, you’ll regret overlooking key ports that could impact your workflow—discover what to check before it’s too late.

Tech Trends 2026: What’s Next in the Gadget World

Uncover the latest in 2026’s gadget innovations that will transform daily life—discover how seamless integration and AI-driven tech will redefine your world.