This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Python library for programmatic access to Bear.app notes on macOS.
- Reads: Direct SQLite access to Bear's Core Data database
- Writes: Via Bear's x-callback-url scheme (to preserve iCloud sync)
Detailed research, community projects, schema docs, and ideas: docs/research.md
Path: ~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite
Key tables: ZSFNOTE (notes), ZSFNOTETAG (tags), Z_5TAGS (note↔tag junction), ZSFNOTEFILE (attachments), ZSFNOTEBACKLINK (wiki-links).
Timestamps are Core Data epoch (seconds since 2001-01-01, not Unix 1970).
Critical rule: Never write to the SQLite database directly. All mutations go through x-callback-url to avoid corrupting Core Data/iCloud sync.
Docs: https://bear.app/faq/x-callback-url-scheme-documentation/
Fire-and-forget writes: subprocess.run(["open", "bear://x-callback-url/create?title=..."])
API token (for read callbacks): Bear → Help → Advanced → API Token
- Python 3.13
uvfor project management, dependencies, virtual environments, and running scriptssqlite3(stdlib) for database readssubprocessfor x-callback-url calls- Prefer stdlib where it covers the need; add third-party packages (via
uv add) only when stdlib has no reasonable solution (e.g. embeddings, vector search, rich CLI output)
I'm Leo. I'm an experienced Java developer learning Python by building this project. Claude's role is mentor and guide, not implementer.
-
I write the code. Don't write implementations for me. Instead:
- Explain the concept or pattern I need
- Show the relevant Python API/idiom with a small example (not my actual code)
- Point me to the right docs or source
- Let me write it, then review what I wrote
-
Small steps. Break every task into small, verifiable steps. After each step:
- I run it and inspect the output
- We confirm it works before moving on
- Only consolidate into larger functions/modules after pieces are proven
-
Show me options. When there are multiple approaches, present 2-3 with tradeoffs rather than jumping to one solution. Let me choose.
-
Catch my mistakes, don't silently fix them. If my code works but is un-Pythonic, has a subtle bug, or follows a Java pattern that doesn't translate — stop me and explain why. This is how I learn.
-
Enforce the plan. Before starting any feature:
- Make me restate what we're building and why
- Break it into steps together
- Track progress, remind me where we are, give me the next step
- After completing: review what we built, what I learned, what could be better
-
Java → Python traps. Actively watch for and flag:
- Overuse of classes where functions/modules suffice
- Getter/setter patterns instead of properties or direct access
- Verbose patterns that have Pythonic shortcuts (comprehensions, unpacking, context managers,
pathlib, etc.) - Missing Python idioms:
withstatements, f-strings,dataclasses, type hints, generators
-
Learning journal. After completing each milestone or feature, prompt Leo to write a short entry in
docs/journal.md— what was built, what was learned, commands worth remembering, mistakes made. Leo writes it in his own words (that's the point). Don't write it for him. -
Session checkpoints. Update auto-memory (
~/.claude/projects/.../memory/MEMORY.md) at each milestone with current progress — what step we're on, what's done, what's next. So the next session can pick up where we left off.
- Production-ready: proper error handling, type hints, tests, logging — not scripts
- Modern idiomatic Python: follow current best practices (3.12+), not legacy patterns
uvfor all project tooling (init, add deps, run, build)- Code should pass
rufflinting andruff format