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

TL;DR

Threlmark uses plain JSON files as the system of record, making the on-disk layout the primary contract. This local-first architecture boosts portability, reliability, and agent automation—no server needed.

Imagine a project management tool that works entirely offline, without a cloud, and still plays nicely with any other tool. Threlmark’s secret? It treats your disk as the ultimate contract—your files are the database. No server, no lock-in, just plain JSON files that do everything.

This isn’t just a clever trick. It’s a fundamental shift in how you think about data, flow, and automation. In this article, you’ll see how Threlmark’s local-first, file-based approach makes your workflow more reliable, portable, and open—and how it powers AI agents to do the heavy lifting without missing a beat.

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 storage device

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

offline project management tool

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 backup software

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

file-based automation tools

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 definitive source of truth—use plain JSON files for maximum transparency.
  • Atomic file writes prevent data corruption, ensuring safety during crashes or interruptions.
  • Design your system to be restartable—avoid in-memory state that can be lost.
  • External tools and AI agents can seamlessly participate by just reading and writing files.
  • Backups and migrations become trivial—just copy folders or sync them with any tool.

Why Using Files Over a Database Creates a Smarter System

Choosing files instead of a traditional database might sound risky—until you see the benefits. Threlmark’s architecture relies on simple JSON files stored right on your disk. This makes the data portable, easy to inspect, and free from server lock-in.

For example, you can back up your entire system with a simple copy or sync. Want to migrate to a new machine? Just copy the folder. It’s like having a physical book of your data—transparent, accessible, and straightforward.

This approach fits perfectly with local-first design, where the system prioritizes working offline and seamlessly syncing changes across devices.

Why Using Files Over a Database Creates a Smarter System
Why Using Files Over a Database Creates a Smarter System

How JSON Files Become Your Single Source of Truth

In Threlmark, every project, card, and dependency lives as a JSON file. The `threlmark.json` at the root acts as the manifest—like the table of contents for your entire setup—while each card gets its own file in the `items/` folder.

This means your data is just a series of plain text files, easy to read and edit. Want to see what’s next? Just open a file. Need to tweak a card? Edit the JSON, save, and it’s updated everywhere.

This simplicity makes the system incredibly flexible. External tools or scripts can join the party just by reading or writing files. No APIs, no special protocols—just plain JSON.

Local-First Design: Why It Powers Reliability and Portability

Local-first means your data lives on your device, not in the cloud. Threlmark’s design ensures you can work anywhere, even offline. When you reconnect, syncing is just copying files—no conflicts, no data loss.

Think of it like having a notebook that you can carry around, add notes to, and then sync with your other notebooks effortlessly. If your laptop crashes? Just restore from your backup—your data is safe, complete, and ready to go.

This approach also simplifies backups. You don’t need complex database dumps. Just copy your folder, and your entire system is preserved.

Local-First Design: Why It Powers Reliability and Portability
Local-First Design: Why It Powers Reliability and Portability

Dealing with Risks and Challenges of File-Based Data

Storing everything in files isn’t without its risks. Concurrency, schema drift, and conflict resolution are real challenges. Threlmark addresses this with atomic writes and tolerant normalization.

Atomic writes mean updates happen in one go—write a temp file, then rename it. That way, crashes never corrupt your data. Tolerant normalization lets older tools read newer files without breaking—unknown fields are preserved, and defaults fill in the gaps.

For example, if two agents update the same card simultaneously, the system gracefully merges changes without clobbering each other. It’s like editing a shared document with your partner—no conflicts, just smooth collaboration.

How External Tools and AI Agents Play Nicely With Files

Threlmark’s design makes it easy for outside tools to participate—no API needed. As long as they can read and write files, they can join the workflow.

Take AI agents. They can analyze, suggest, and even close their own loop by updating JSON files directly. For instance, an AI can mark a card as ‘Done’ by editing its file—no middleman, no API calls, just file manipulation.

This openness accelerates automation and collaboration. External scripts, IDE plugins, or AI assistants can all work together seamlessly, thanks to a common, transparent data format.

How External Tools and AI Agents Play Nicely With Files
How External Tools and AI Agents Play Nicely With Files

What It Means for Your Workflow and Data Safety

With Threlmark’s approach, your data is always inspectable and portable. Backups are a matter of copying a folder. Restoring is just copying back. No vendor lock-in, no proprietary formats.

In practice, this means less downtime, fewer surprises, and more control. You can run your system on a USB stick or a Raspberry Pi—perfect for sensitive projects or environments with limited internet.

And because every change is just a file write, debugging becomes simpler. Want to see what changed? Just run a diff. Need to troubleshoot? Open the files directly.

Key Takeaways: How To Use Threlmark’s File-Based Approach Today

  • Keep your data in plain JSON files for maximum transparency and compatibility.
  • Use atomic write patterns to prevent corruption during updates.
  • Leverage the folder structure for easy backups, restores, and external integrations.
  • Design your system to be restartable: no in-memory state, only files.
  • Enable agents and tools to participate by reading and writing files directly.

Frequently Asked Questions

What does “disk is the contract” really mean?

It means your data lives directly in files on your disk, and those files define the system’s state. The file layout becomes the ultimate interface, making everything transparent, portable, and easy to manage.

Why choose JSON files instead of a database?

JSON files are simple, human-readable, and portable. They avoid lock-in, enable easy backups, and allow external tools or agents to participate without complex APIs or dependencies.

How does Threlmark handle conflicts or concurrent edits?

It uses atomic writes and tolerant normalization—merging changes gracefully and preventing corruption. This way, multiple agents can update files without clobbering each other.

Can external tools or AI agents modify my data safely?

Yes. As long as they can read and write files, they integrate seamlessly. Threlmark’s file structure supports direct editing, automation, and even self-updating AI workflows.

What happens during schema changes or updates?

Threlmark preserves unknown fields and uses defaults for missing data, so schema evolution is forward-compatible. Older tools can still read newer files without breaking.

Conclusion

Threlmark’s approach proves that simplicity can be revolutionary. By making the disk the contract, it transforms your workflow into a transparent, reliable, and open system—ready for automation and collaboration.

Next time you think about data management, ask yourself: could my system run entirely from files? Sometimes, the simplest solution is the strongest—because it’s just plain, honest, and right there on your disk.

Key Takeaways: How To Use Threlmark’s File-Based Approach Today
Key Takeaways: How To Use Threlmark’s File-Based Approach Today
You May Also Like

RC-MC Technique Shows Microcompartments Shape Gene Regulation

Understanding how microcompartments influence gene activity using RC-MC may unlock new avenues for targeted therapies.

Terahertz Spectroscopy on a Chip Reveals Quantum Light Traps

Breakthrough in terahertz chip spectroscopy unveils quantum light traps, opening new horizons in quantum technology—discover how these tiny structures are transforming the field.

Quantum Sensors Combined for Detecting Elusive Matter: Network Design

Investigating elusive matter with combined quantum sensors offers groundbreaking detection potential, but understanding the full network design is crucial to unlocking its secrets.

Southern Ocean Climate Models Underestimated Warming: New Data

Fascinating new data reveals Southern Ocean warming exceeds model predictions, prompting urgent questions about its implications for global climate forecasts.