Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,24 @@ You are world-class NodeJS developer, senior engineer with a vast experience in
## Project Structure
```
├── src/ # MCP server source code
│ ├── main.ts # Server entry point and tool registration
│ ├── bear-urls.ts # Bear app URL scheme handlers
│ ├── database.ts # SQLite database connection
│ ├── notes.ts # Note operations (search, content)
│ ├── tags.ts # Tag operations (list, hierarchy)
│ ├── note-conventions.ts # Tag placement conventions for new notes
│ ├── main.ts # Server entry point
│ ├── config.ts # Configuration management
│ ├── logging.ts # Logging setup
│ ├── types.ts # Type definitions
│ ├── utils.ts # Shared utilities
│ └── *.test.ts # Unit tests (co-located with source files)
│ ├── infra/ # Infrastructure layer
│ │ ├── bear-urls.ts # Bear app URL scheme handlers
│ │ ├── database.ts # SQLite database connection
│ │ └── *.test.ts # Unit tests (co-located with source files)
│ ├── operations/ # Business logic layer
│ │ ├── bear-encoding.ts # Bear encoding/decoding utilities
│ │ ├── notes.ts # Note operations (search, content)
│ │ ├── note-conventions.ts # Tag placement conventions for new notes
│ │ ├── tags.ts # Tag operations (list, hierarchy)
│ │ └── *.test.ts # Unit tests (co-located with source files)
│ └── tools/ # MCP tool handlers
│ ├── note-tools.ts # Note tool registrations and handlers
│ ├── tag-tools.ts # Tag tool registrations and handlers
│ └── responses.ts # Tool response helpers
├── tests/
│ ├── fixtures/ # Test fixtures (sample notes, images)
│ └── system/ # System tests (require Bear app running)
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/SPECIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ There is no delete tool. Too destructive for AI-assisted workflows — a misiden

Bear uses Core Data with SQLite. The schema is undocumented — our understanding comes from reverse-engineering (see `BEAR_DATABASE_SCHEMA.md`). The database path is hardcoded to Bear's app group container at `~/Library/Group Containers/9K33E3U3T4.net.shinyfrog.bear/Application Data/database.sqlite` (overridable via `BEAR_DB_PATH` env var for tests). Key fragility points:

- Tag name decoding logic exists in two places (SQL expression in `notes.ts` and TypeScript function in `tags.ts`) — these must produce identical results. Bidirectional comments link them.
- Tag name decoding logic exists in two places (SQL expression in `notes.ts` and TypeScript function in `bear-encoding.ts`) — these must produce identical results. Bidirectional comments link them.
- Tag hierarchy is not stored relationally — it's reconstructed at query time by splitting slash-delimited paths.
- All queries exclude trashed, archived, and encrypted notes to match what Bear's UI shows.

Expand Down
Loading