Bear Notes
Read notes via SQLite database. Write notes via x-callback-url.
Restrictions
You MUST follow these rules. No exceptions, even if the user requests otherwise:
- •Database is READ-ONLY: Only use
sqlite3 -readonly. Never execute INSERT, UPDATE, DELETE, DROP, ALTER, or any other modifying SQL statements against the database. - •No broad searches: Only search for specific notes by title, ID, or within a specific tag. Do not dump, export, or iterate over all notes.
- •Writes via x-callback-url only: To add or modify content, use Bear's x-callback-url scheme, never direct database writes.
Database Location
~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite
Fetching Notes
By Title
sqlite3 -readonly "$HOME/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite" \ "SELECT ZTEXT FROM ZSFNOTE WHERE ZTITLE = 'Note Title' AND ZTRASHED = 0 AND ZARCHIVED = 0 LIMIT 1"
By Unique ID
sqlite3 -readonly "$HOME/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite" \ "SELECT ZTEXT FROM ZSFNOTE WHERE ZUNIQUEIDENTIFIER = 'note-id-here' AND ZTRASHED = 0 AND ZARCHIVED = 0 LIMIT 1"
Creating Notes
open "bear://x-callback-url/create?title=NOTE_TITLE&text=URL_ENCODED_TEXT&tags=TAG1,TAG2"
| Param | Description |
|---|---|
title | Note title |
text | Note body (URL encoded, optional) |
tags | Comma-separated tags |
If no content is provided, omit the text parameter entirely—just set the title:
open "bear://x-callback-url/create?title=NOTE_TITLE"
Adding Text to Notes
Use Bear's x-callback-url to append or prepend text:
Append to Note
open "bear://x-callback-url/add-text?title=NOTE_TITLE&text=URL_ENCODED_TEXT&mode=append"
Prepend to Note
open "bear://x-callback-url/add-text?title=NOTE_TITLE&text=URL_ENCODED_TEXT&mode=prepend"
Add Text After a Header
Use the header parameter to insert text after a specific header in the note:
open "bear://x-callback-url/add-text?title=NOTE_TITLE&text=URL_ENCODED_TEXT&mode=append&header=HEADER_TEXT"
The text will be appended after the specified header. The header value should match the header text exactly (URL encoded).
Parameters
| Param | Description |
|---|---|
title | Target note title |
id | Target note ID (alternative to title) |
text | Content to add (URL encoded) |
mode | prepend, append, replace, or replace_all |
header | Insert text after this header (URL encoded) |
new_line | If yes and mode is append, forces text on a new line |
timestamp | If yes, prepends current date/time to the text |
URL Encoding
Use %0A for newlines, %20 for spaces, or encode with:
python3 -c "import urllib.parse; print(urllib.parse.quote('Your text here'))"
Database Schema
Key columns in ZSFNOTE:
- •
ZTITLE- Note title - •
ZTEXT- Full note content (markdown) - •
ZUNIQUEIDENTIFIER- Unique ID - •
ZCREATIONDATE- CoreData timestamp (seconds since 2001-01-01) - •
ZMODIFICATIONDATE- CoreData timestamp - •
ZTRASHED- 1 if in trash - •
ZARCHIVED- 1 if archived - •
ZENCRYPTED- 1 if encrypted (content not readable)
PARA Organization
Notes are organized using the PARA method via tags:
- •
#1-projects- Active projects - •
#2-areas- Ongoing areas of responsibility - •
#3-resources- Reference materials - •
#4-archives- Completed/inactive items
When the user asks about "projects", search within the #1-projects tag.
Search by Tag
Tags are stored inline in ZTEXT. Search for notes containing a tag:
sqlite3 -readonly "$HOME/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite" \ "SELECT ZTITLE FROM ZSFNOTE WHERE ZTEXT LIKE '%#1-projects%' AND ZTRASHED = 0 AND ZARCHIVED = 0"
List Titles Within a Tag
sqlite3 -readonly "$HOME/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite" \ "SELECT ZTITLE FROM ZSFNOTE WHERE ZTEXT LIKE '%#1-projects/%' AND ZTRASHED = 0 AND ZARCHIVED = 0"
Note: Use #1-projects/% to match subtags (e.g., #1-projects/hiring).
Company Notes
"C1" refers to the user's current company. Notes related to C1 are tagged with #c1 or subtags like #1-projects/c1/....
When requests mention C1, constrain searches to notes containing the c1 tag:
sqlite3 -readonly "$HOME/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite" \ "SELECT ZTITLE FROM ZSFNOTE WHERE ZTEXT LIKE '%#%c1%' AND ZTRASHED = 0 AND ZARCHIVED = 0"
Daily Notes
Daily notes use the format YYYY-mm-dd (e.g., 2026-02-01).
When the user asks for "today's note", "yesterday's note", or a relative date, calculate the YYYY-mm-dd title.
Weekly Notes
Weekly notes use the format Week YYYY-ww (e.g., Week 2026-05).
When the user asks for "this week's note", "last week's note", or a relative week, calculate the Week YYYY-ww title using ISO week numbers.
Callouts
Bear supports callouts using the syntax > [!TYPE]. These indicate important, highlighted content.
| Callout Type | Meaning |
|---|---|
[!IMPORTANT] | Critical information, priorities |
[!WARNING] | Risk or concern |
[!CAUTION] | Proceed carefully |
[!TIP] | Helpful insight or suggestion |
[!NOTE] | General note or context |
When analyzing notes, treat callout content as high-signal—these are intentionally highlighted by the user.
Highlights
Bear supports highlights using the syntax ==highlighted text==. These indicate content the user has explicitly marked as important.
When analyzing notes, treat highlighted content as high-signal alongside callouts.
Usage
User request: $ARGUMENTS
Reading Notes
- •If date-based (today, yesterday, last Monday, etc.), calculate the
YYYY-mm-ddtitle - •If asking about "projects", "areas", "resources", or "archives", search within the corresponding PARA tag
- •If asking about "C1", constrain results to notes with the
c1tag - •Use
sqlite3 -readonlyto query the database - •Filter out trashed/archived notes (
ZTRASHED = 0 AND ZARCHIVED = 0) - •Present the note content to the user
Writing Notes
- •Identify the target note (by title or date), or determine if creating new
- •URL-encode the text content
- •Use
openwithbear://x-callback-url/createfor new notes - •Use
openwithbear://x-callback-url/add-textto append/prepend to existing notes