惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - Franky
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
J
Java Code Geeks
F
Full Disclosure
V
V2EX
The Register - Security
The Register - Security
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
Help Net Security
Help Net Security
P
Privacy & Cybersecurity Law Blog
K
Kaspersky official blog
博客园 - 聂微东
Recorded Future
Recorded Future
I
Intezer
S
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Hacker News: Front Page
SecWiki News
SecWiki News
M
MIT News - Artificial intelligence
Security Latest
Security Latest
Attack and Defense Labs
Attack and Defense Labs
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
T
Tenable Blog
B
Blog
N
News | PayPal Newsroom
P
Proofpoint News Feed
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
MyScale Blog
MyScale Blog
C
Cisco Blogs
A
Arctic Wolf
T
Threat Research - Cisco Blogs
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
GbyAI
GbyAI
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
Latest news
Latest news
Project Zero
Project Zero

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Prior Art: The data structure that shapes Thought OS
sys-ronin · 2026-06-19 · via DEV Community

The Three‑File Architecture

The Foundation of the Entire System


1. The Division

Every notebook repository contains exactly three JSON files:

  • structure.json – the notebook hierarchy: names, UUIDs, parent relationships, and references to notes and subnotebooks.
  • notes.json – content of regular notes, keyed by UUID.
  • files.json – content of file notes (any file type), also keyed by UUID.

This separation is the foundation upon which every other feature is built.


2. Why Three Files, Not One

A single file containing everything (structure and all content) would create a single point of change for any modification. Every note edit would require rewriting the entire file. Git would store a full new version each time, regardless of delta compression, because the file would be completely different.

By separating structure from content:

  • Renaming a notebook or moving a note changes only structure.json.
  • Editing a note changes only notes.json (or files.json).
  • Adding a file changes only files.json and structure.json (but structure is a small addition).

Each file evolves independently. Git stores deltas for each file separately, so a small change in notes.json results in a small delta. The repository size grows with the number of changes, not with the number of versions times the total size.

This is the primary mechanism that keeps the Git storage footprint low over years of use.


3. UUID as the Common Key

All three files use the same UUIDs to refer to notes and files.

  • structure.json contains notes entries with id fields.
  • notes.json has keys equal to those UUIDs.
  • files.json also uses the same UUIDs as keys.

When a note is created, a UUID is generated. That UUID is stored in structure.json (as part of the note’s entry) and also becomes a key in notes.json (or files.json). The two are linked by the UUID.

This allows the system to:

  • Load the structure without loading content.
  • Load a note’s content by looking up its UUID in the appropriate content file.
  • Load content for a list of notes without scanning the structure again.

Because the link is by UUID, the content files are simple dictionaries. No complex mapping is needed.


4. How This Enables Navigation

Navigation (home screen, notebook view, subnotebook view) requires only structure.json. The user sees a list of notes with titles, timestamps, and file indicators. None of that needs the actual content.

  • When the user opens a notebook, structure.json is read. The notes list is built from the notes array. The content of the notes is not loaded.
  • When the user scrolls through the list, only the structure.json data is used.
  • The lock button can unload structure.json when locking a notebook, freeing memory. The content files are not even loaded, so no memory is wasted.

If structure and content were combined, unlocking a notebook would load all content automatically, increasing memory footprint and startup time.


5. How This Enables Git History

Git commits record changes to these files individually. Because they are separate:

  • A commit that renames a note touches only structure.json. The content file remains unchanged.
  • A commit that edits a note touches only notes.json. The structure file remains unchanged.
  • A commit that deletes a note touches structure.json (to remove the entry) and the appropriate content file (to remove the mapping). The two changes are in separate files, but they are part of the same commit.

This separation means that when you view the history of a note, the git log command can be scoped to notes.json. It does not need to filter through commits that only changed structure. Conversely, activity view for a notebook (showing renames) can focus on structure.json.

The commit messages embed the UUID and the action. Git does not need to parse the file content to understand what changed; the metadata is in the message.


6. How This Enables Resurrection

Resurrection requires reconstructing an item from a past commit. Because structure and content are separate:

  • The structure at a given commit is retrieved from structure.json at that commit.
  • The content is retrieved from notes.json or files.json at the same commit.
  • The UUID links the two.

If the files were combined, reconstructing a single note would require loading the entire monolithic file and extracting the relevant parts. With separation, only the necessary parts are loaded: the structure entry for the note and its content entry.

The timeline engine uses this to reconstruct only the requested item, not the whole notebook.


7. How This Enables Precise Deletion with git‑filter‑repo

When erasing a note, git-filter-repo is told to operate only on structure.json, notes.json, and files.json. Because the content is separate from the structure:

  • Removing a note requires removing its entry from structure.json and its key from notes.json (or files.json). Both are in separate files.
  • The UUIDEraseFilter can target these specific files, leaving other files untouched.

If the data were combined, erasing a note would require rewriting a single large file, potentially affecting other notes in the same file. Because of the separation, the operation is scoped and safe.


8. How This Enables Restoration

Restoration is the inverse of deletion. When a note is restored:

  • The structure entry is added back to structure.json.
  • The content entry is added back to notes.json (or files.json).
  • The UUID is reused; no new ID is generated.

Because structure and content are separate, adding them back is a simple insertion. The restore process does not need to merge two different file formats; it just appends to the appropriate JSON dictionaries and writes the files.


9. How This Enables Memory Efficiency

When a notebook is unlocked:

  • structure.json is read and parsed. This gives the entire note list (titles, timestamps, etc.) without loading any content.
  • notes.json and files.json are not read until a note is viewed.

When a note is viewed:

  • The appropriate content file is read and parsed.
  • The entire dictionary is loaded, but only one note’s content is displayed.

When the user returns to the notebook list, the content dictionary can be discarded (in practice, it stays until the notebook is locked or the app exits, but it is not needed for the list). The structure remains in memory, but structure is small compared to content.

If structure and content were combined, unlocking a notebook would load all content automatically, consuming memory proportional to the total size of all notes.


10. How This Enables the Lock Button as Memory Manager

Locking a notebook discards:

  • The parsed structure.json (the note list).
  • The parsed notes.json and files.json (if they were loaded).
  • The encryption key.

Because structure and content are separate, locking can be selective. The system does not need to keep structure in memory once the notebook is locked; it can be reloaded from disk when unlocked again.

If structure and content were combined, locking would either have to keep the combined structure in memory (wasting memory) or discard it entirely (requiring a full reload on unlock, which would reload all content as well). The separation allows fine‑grained control.


11. How This Enables Git Delta Efficiency

Git stores each file independently. Because structure and content are separate:

  • structure.json changes frequently but remains small (a few kilobytes). Git stores deltas for it.
  • notes.json and files.json grow over time but change only when their corresponding notes are edited. Each edit produces a small delta (the change in the encrypted blob, which Git compresses further).

If all data were in one file, every edit would change the entire file. Even with delta compression, the first edit after a large addition would create a large delta because the file would shift. Separation prevents this.


12. How This Enables Deterministic UUID‑Level Synchronisation

The three‑file architecture is the foundation for the sync algorithm. Because each UUID has its own independent chain of commits grouped by UUID, the system can:

  • Collect commits per UUID without parsing content. The commit message contains the UUID, and the raw blobs of the three files are captured as they are.
  • Resolve conflicts by timestamp for each UUID independently. Because notes are stored as key‑value pairs, changes to different UUIDs never interfere with each other.
  • Replay winning commits by simply writing the raw encrypted blobs. Each commit is a complete snapshot of the three files. Writing the blobs overwrites only the changed UUID’s entry, leaving other UUIDs untouched.
  • Preserve non‑conflicting edits automatically. If one side added a note (UUID‑A) and the other side added a different note (UUID‑B), both chains are kept. The final state contains both notes.
  • Avoid merge commits entirely because the sync algorithm rebuilds history on an orphan branch, never creating merge commits.

If structure and content were combined, a single commit would contain changes to multiple UUIDs. Grouping by UUID would be impossible without parsing the entire file. Conflict resolution would require merging file contents, not just comparing timestamps. The sync algorithm would become as complex as Git’s own merge. The three‑file architecture makes UUID‑level sync possible and simple.


13. Why This Design Is the Foundation for Everything

Without this separation:

  • Navigation would require loading content.
  • Git history would be a single file’s history, making it impossible to separate structure changes from content changes.
  • Resurrection would require reconstructing a monolithic file.
  • Deletion with git-filter-repo would be imprecise and risk affecting unrelated data.
  • Restoration would be a full‑file rewrite.
  • Memory would be tied to total note count, not active use.
  • The lock button could not unload structure independently of content.
  • Git storage would grow much faster because each edit would rewrite the entire notebook state.
  • Synchronisation would be impossible without complex file‑level merging, and per‑item conflict resolution would not exist.

This separation is not an implementation detail. It is the central architectural decision that enables every other feature:

  • Navigation – uses structure only.
  • Git history – separate files mean separate history streams.
  • Resurrection – reconstruct by UUID from two separate files.
  • Filter‑repo deletion – target specific files, not the whole notebook.
  • Restoration – append to two separate files.
  • Memory efficiency – load structure without content, load content on demand.
  • Lock button – discard structure, content, and key independently.
  • Storage efficiency – small deltas for small changes.
  • Synchronisation – per‑UUID commit chains, timestamp‑based conflict resolution, linear history reconstruction.

Every feature you built rests on this single decision: keep the notebook’s blueprint separate from its contents, and link them by UUID. Without it, the system would be a conventional note‑taking app. With it, it becomes a versioned, memory‑efficient, resurrectable, securely erasable, and synchronisable knowledge base.

This is why the three‑file architecture is the most important part of the codebase. It is not merely a storage format; it is the enabling structure for everything that follows.

terminal-notes - github
sys_ronin@protonmail.com

sys-ronin