bkmr 1.1.1

A Bookmark Manager and Launcher for the Terminal
Documentation

bkmr

Ultrafast Bookmark Manager and Launcher

New Feature: Semantic Search (AI Embeddings)

Elevating Bookmark Management with AI-Driven Semantic Search

Features:

  • semantic search using OpenAI embeddings (requires OpenAI API key)
  • full-text search with semantic ranking (FTS5)
  • fuzzy search --fzf (CTRL-O: copy to clipboard, CTRL-E: edit, CTRL-D: delete, Enter: open)
  • tags for classification
  • knows how to open HTTP URLs, directories, files (e.g. Office, Images, ....)
  • can execute URI strings as shell commands via protocol prefix: 'shell::' URI-Example: shell::vim +/"## SqlAlchemy" $HOME/document.md
  • automatically enriches URLs with title and description from Web
  • manages statistics about bookmark usage

bkmr search --fzf is a great way to quickly find and open bookmarks.

To fully use bkmr's full-text query power see: https://www.sqlite.org/fts5.html (chapter 3).

Usage

bkmr --help

A Bookmark Manager and Launcher for the Terminal

Usage: bkmr [OPTIONS] [NAME] [COMMAND]

Commands:
  search             Searches Bookmarks
  sem-search         Semantic Search with OpenAI
  open               Open/launch bookmarks
  add                Add a bookmark
  delete             Delete bookmarks
  update             Update bookmarks
  edit               Edit bookmarks
  show               Show Bookmarks (list of ids, separated by comma, no blanks)
  surprise           Opens n random URLs
  tags               Tag for which related tags should be shown. No input: all tags are printed
  create-db          Initialize bookmark database
  backfill           Backfill embeddings for bookmarks
  help               Print this message or the help of the given subcommand(s)

Arguments:
  [NAME]  Optional name to operate on

Options:
  -c, --config <FILE>  Sets a custom config file
  -d, --debug...       Turn debugging information on
      --openai         use OpenAI API to embed bookmarks
  -h, --help           Print help
  -V, --version        Print version

Examples

# FTS examples (https://www.sqlite.org/fts5.htm)
bkmr search 'security "single-page"'
bkmr search '"https://securit" *'
bkmr search '^security'
bkmr search 'postgres OR sqlite'
bkmr search 'security NOT keycloak'

# FTS combined with tag filtering
bkmr search -t tag1,tag2 -n notag1 <searchquery>

# Match exact taglist
bkmr search -e tag1,tag2

# Search by any tag and sort by bookmark age ascending
bkmr search -T tag1,tag2 -O

# Give me the 10 oldest bookmarks
bkmr search -O --limit 10

# Adding URI to local files
bkmr add /home/user/presentation.pptx tag1,tag2 --title 'My super Presentation'

# Adding shell commands as URI
bkmr add "shell::vim +/'# SqlAlchemy' sql.md" shell,sql,doc --title 'sqlalchemy snippets'

# Bulk updating bookmarks: all bms with tag 'sa' also get tag 'py'
bkmr update -t py $(bkmr search -t sa --np)
# Bulk updating bookmarks: all bms with tag 'gh' should have 'git' removed
bkmr update -n git $(bkmr search -t gh --np)

# JSON dump of entire database
bkmr search --json

# Semantic Search based on OpenAI Embeddings
bkmr --openai sem-search "python security"  # requires OPENAI_API_KEY

Tags must be separated by comma without blanks.

Upgrade to 1.x.x

  • requires database migration: adds two columns to the bookmarks table for the OpenAI embeddings

Semantic Search

  • embeddings will increase DB size significantly (embeddings size: 1536 dimensions)
  • to use semantic search API key is required: export OPENAI_API_KEY=<your-key>
  • requires the --openai flag!
  • best results when adding context to the URLs via COMMENTS: sem_search

Installation

  1. cargo install bkmr
  2. initialize the database: bkmr create-db db_path
  3. export "BKMR_DB_URL=db-path", location of created sqlite database must be known
  4. add URLs

FZF Customization

You can set (not required) this variable to change --fzf mode default options:

export "BKMR_FZF_OPTS=--reverse --height 20% --show-tags"

Currently available flags:

  • --reverse (defaults to false): show input line on top and reverse alphabetical order
  • --height (defaults to 50%): screen usage of current terminal
  • --show-tags (defaults to false): show tags

Benchmarking

  • ca. 20x faster than the Python original twbm after warming up Python.
time twbm search 'zzz*' --np
0. zzzeek : Asynchronous Python and Databases [343]
   https://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
   async, knowhow, py


Found: 1
343

real    0m0.501s
user    0m0.268s
sys     0m0.070s



time bkmr search 'zzz*' --np
1. zzzeek : Asynchronous Python and Databases [343]
   https://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
   async knowhow py


real    0m0.027s
user    0m0.008s
sys     0m0.016s

sysid blog: bkmr