apple-notes-db-guardrails

Inspect and patch Apple Notes sqlite databases with backup and fingerprint safety gates.

Updated May 18, 2026
One-click install
npx skills add https://github.com/Joey-Tools/codex-private-workflows --skill apple-notes-db-guardrails-joey-tools
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apple-notes-db-guardrails
Source: https://github.com/Joey-Tools/codex-private-workflows/tree/main/.agents/skills/apple-notes-db-guardrails
Command: npx skills add https://github.com/Joey-Tools/codex-private-workflows --skill apple-notes-db-guardrails-joey-tools

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working directly on the Apple Notes container database (NoteStore.sqlite) on macOS is risky: TCC permissions block access, open Notes.app makes copies unreliable, and naive writebacks can corrupt the live database. This Skill enforces a safe workflow for probing authorization, copying the database to /tmp, analyzing tags and metadata, and gating any writeback behind verified backups and source fingerprints. ## Core Features & Use Cases - Authorization Probing: Verifies real access to the Notes group container before planning any database work, distinguishing live container access from user-provided /tmp copies. - Copy-First Analysis: Copies NoteStore.sqlite plus WAL/SHM files into a timestamped /tmp directory, merges them via sqlite3 .backup, and inspects hashtag rows (ZALTTEXT, ZTOKENCONTENTIDENTIFIER) and gzip-compressed note-data blobs without touching production. - Writeback Guardrails: Requires Notes.app to stay quit, validates backups twice, captures and rechecks SHA-256 fingerprints of the live file set, and aborts on any mismatch before replacing the whole file set. - Use Case: You need to check whether a specific note contains an inline hashtag that AppleScript cannot expose. The Skill copies the database, merges the WAL, queries ZICCLOUDSYNCINGOBJECT for hashtag child rows, and reports tag placement without ever modifying the live database. ## Quick Start Use the apple-notes-db-guardrails skill to copy my Apple Notes database to /tmp and check whether a specific note contains a given hashtag, without modifying the live database.

Frequently Asked Questions about apple-notes-db-guardrails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inspect the Apple Notes sqlite database on macOS?

Copy NoteStore.sqlite along with its -wal and -shm files from ~/Library/Group Containers/group.com.apple.notes into a timestamped /tmp directory, then run sqlite3 .backup to create a merged analysis copy. Perform all queries against the merged copy, never the live file.

How do I find hashtags in Apple Notes that AppleScript does not show?

Query the ZICCLOUDSYNCINGOBJECT table for child rows where ZTYPEUTI1 is com.apple.notes.inlinetextattachment.hashtag and ZNOTE1 matches the note's primary key. Read ZALTTEXT for the visible tag and ZTOKENCONTENTIDENTIFIER for the normalized token form.

Why do I get Operation not permitted when accessing the Apple Notes container?

macOS TCC or Full Disk Access restrictions block terminal access to the Notes group container. You must grant the terminal the required macOS permission or copy the files from a privileged terminal before any database analysis can proceed.

Can I analyze the Apple Notes database while Notes.app is open?

A copy taken while Notes is open is acceptable only for tentative read-only triage. It must not be used for absence checks, exact tag counts, or writeback planning; recopy after quitting Notes before any critical judgment.

How do I safely write changes back to the Apple Notes database?

Keep Notes quit, create and double-validate a fresh backup, capture SHA-256 fingerprints of the sqlite, wal, and shm files, and recheck them right before replacement. Replace the whole file set from the prepared copy and abort if any fingerprint changed.

What are the limitations of reading Apple Notes note-data blobs?

The ZDATA blob in ZICNOTEDATA is gzip-compressed on tested Notes versions and must be decompressed before inspection. Inline tags appear as U+FFFC placeholders in the text stream, so a specific hashtag row cannot be mapped to a placeholder without additional structural evidence.