-
Notifications
You must be signed in to change notification settings - Fork 10
Core Concepts
Understanding these core concepts will help you use bkmr effectively.
In bkmr, a bookmark is any piece of content you want to store and retrieve later. The term "bookmark" is used broadly — it covers URLs, code snippets, scripts, documents, and more.
┌─────────────────────────────────────────────────────┐
│ Bookmark │
├──────────────┬──────────────────────────────────────┤
│ id │ Auto-incremented integer │
│ URL/Content │ The payload: a URL, code, script, │
│ │ markdown, or env vars │
│ Title │ Human-readable name │
│ Description │ Optional notes/context │
│ Tags │ User tags + at most one system tag │
│ file_path │ Source file (NULL for regular bkmrs) │
│ open_with │ Custom opener command (optional) │
│ embeddable │ Whether to generate embeddings │
├──────────────┴──────────────────────────────────────┤
│ FTS5 index │ vec_bookmarks (embeddings) │
└─────────────────────────────────────────────────────┘
ADD SEARCH ACT
─── ────── ───
bkmr add ... → bkmr search ... → bkmr open <id>
bkmr import-files bkmr search --fzf (action depends on
bkmr sem-search system tag)
bkmr hsearch
Tags are the primary organization mechanism in bkmr.
- Free-form labels you assign
- Comma-separated, no spaces:
python,security,auth - Used for filtering and organization
- Case-sensitive
Examples:
bkmr add <content> python,web,tutorial
bkmr search -t python,securitySpecial tags that determine how bkmr handles content:
| System Tag | Purpose | Default Action |
|---|---|---|
_snip_ |
Code snippet | Copy to clipboard |
_shell_ |
Shell script | Interactive edit + execute |
_md_ |
Markdown document | Render in browser |
_env_ |
Environment variables | Print for sourcing |
_imported_ |
Imported file content | Copy to clipboard |
_mem_ |
Agent memory | Display content to stdout |
Rules:
- A bookmark can have at most one system tag. Adding a system tag replaces any existing one.
- System tags are enforced at the domain level — attempting to set two system tags raises an error.
Automatic assignment:
- Added with
--type snip→ Gets_snip_tag - Added with
--type shell→ Gets_shell_tag - Added with
-t mem→ Gets_mem_tag - Imported
.mdfiles → Get_md_tag
Agent Memory (_mem_): Bookmarks tagged _mem_ print their content to stdout when opened — no browser, no clipboard. Combined with --json and --np flags, this creates a complete read/write memory interface for AI agents. See Agent Integration for patterns.
Content types determine how bkmr processes and presents your bookmarks. See Content Types for detailed information.
1. URLs
bkmr add https://example.com dev,reference
# Opens in browser when accessed2. Snippets
bkmr add "console.log('test')" javascript,_snip_ --title "Debug Log"
# Copies to clipboard when accessed3. Shell Scripts
bkmr add "#!/bin/bash\necho 'Hello'" utils,_shell_ --title "Greeting"
# Interactive editor before execution4. Markdown
bkmr add "# Title\n\n## Section" docs,_md_ --title "Documentation"
# Renders in browser with TOCbkmr open is a single command that dispatches to the right action based on the system tag:
bkmr open <id>
│
┌─────────┴──────────┐
│ What system tag? │
└─────────┬──────────┘
┌──────┬──────┬─────┼─────┬──────┬──────┐
▼ ▼ ▼ ▼ ▼ ▼ ▼
(none) _snip_ _shell_ _md_ _env_ _imported_ _mem_
│ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼
Open Copy Edit+ Render Print Copy Print
browser clipbd Execute browser stdout clipbd stdout
# Same command, different actions:
bkmr open <url-id> # Opens in browser
bkmr open <snippet-id> # Copies to clipboard
bkmr open <shell-id> # Interactive editor + execute
bkmr open <md-id> # Renders in browser with TOC
bkmr open <env-id> # Prints for eval/sourceThis context-aware behavior means you don't need different commands for different content types.
bkmr stores everything in a local SQLite database:
- Default location:
~/.config/bkmr/bkmr.db - Configurable via
BKMR_DB_URLenvironment variable - Includes full-text search (FTS5) index
- Semantic embeddings for local offline search (via fastembed + sqlite-vec)
bkmr provides four search engines plus an interactive mode:
┌────────────────────────────────────────────────────────────┐
│ Search Methods │
├──────────┬──────────┬────────────┬─────────────────────────┤
│ search │sem-search│ hsearch │ search --fzf │
│ (FTS5) │(vectors) │(FTS+sem) │ (interactive) │
├──────────┼──────────┼────────────┼─────────────────────────┤
│ Keyword │ Meaning │ Both via │ Any of the above + │
│ matching │ matching │ RRF fusion │ fuzzy text filtering │
│ Exact, │ No API │ Best of │ Keyboard shortcuts for │
│ fast │ keys │ both worlds│ open/edit/delete/clone │
└──────────┴──────────┴────────────┴─────────────────────────┘
1. Full-Text Search (FTS)
bkmr search "python security"
bkmr search "containerization"2. Tag Filtering (combinable with any search method)
bkmr search -t python,tutorial # Must have ALL tags (AND)
bkmr search -n python,rust # Must have ANY tag (OR)
bkmr search -N deprecated,old # Exclude if has ANY of these tags3. Fuzzy Finding (Interactive)
bkmr search --fzf # Interactive picker
bkmr search --fzf -t python # Pre-filtered fuzzy search4. Semantic Search (Local, Offline)
bkmr sem-search "deploy automation"
# Finds conceptually similar content — no API keys needed5. Hybrid Search (FTS + Semantic combined)
bkmr hsearch "containerized security"
# Runs both engines, merges with Reciprocal Rank FusionSee Search and Discovery for comprehensive search documentation.
Programmatic access: All search commands support
--jsonfor structured output and--npfor non-interactive operation. For AI agent integration patterns, see Agent Integration.
bkmr can import files with metadata and track changes:
# Import with frontmatter
bkmr import-files ~/scripts/backup.sh
# Smart editing (edits source file)
bkmr edit <imported-id>See Content Types — File Import for details.
Make content dynamic with Jinja2 templates:
# Dynamic date in URL
bkmr add "https://reports.com/{{ current_date | strftime('%Y-%m-%d') }}" reports
# Environment variables in scripts
bkmr add "export PATH={{ env('HOME') }}/bin:\$PATH" env,_env_See Template Interpolation for details.
- Basic Usage - Learn common commands
- Content Types - Deep dive into each content type
- Search and Discovery - Master search techniques
bkmr