Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xwmx/nb/llms.txt

Use this file to discover all available pages before exploring further.

Every nb notebook is a self-contained Git repository stored as a directory under ~/.nb/. You can create as many notebooks as you need — for different projects, clients, topics, or contexts — and nb will track revisions in each one independently. Within each notebook, nested folders let you organize items into any hierarchy you like. Notebooks and folders are complementary to #tags, giving you both a tree-based taxonomy and a flat tag-based one.

Notebooks

Creating a Notebook

# create a new notebook named "example"
nb notebooks add example
The new notebook appears in the nb / nb ls header, above the item list:
nb
# example · home
# --------------
# [3] Title Three
# [2] Title Two
# [1] Title One

Listing Notebooks

nb notebooks
# example
# home

Switching Notebooks

Use nb use (shortcut: nb u) to set the active notebook:
nb use example
After switching, all commands operate on example by default.

Notebook Selectors: Targeting Without Switching

Prefix any command with a notebook name and colon to target that notebook without switching to it:
# list items in "example" without switching
nb example:

# add a note to "example"
nb example:add "This is a note."
nb example:a "This is a note."

# show note 5 in "example"
nb example:show 5
nb example:s 5

# edit note 12 in "example"
nb example:edit 12
nb example:e 12

# search "example" for a query
nb example:search "example query"
nb example:q "example query"
The colon can also be placed on the identifier rather than the subcommand:
# these are equivalent
nb edit example:12
nb example:12 edit
nb example:12 e

Notebook Creation Workflow

1

Create the notebook

nb notebooks add project-alpha
2

Switch to it

nb use project-alpha
3

Add notes

nb add "Initial project notes."
nb add --title "Kickoff Meeting" --tags planning,kickoff
4

Verify the contents

nb
# project-alpha · home
# --------------------
# [2] Kickoff Meeting
# [1] 20240101000000.md

Global and Local Notebooks

Global Notebooks

By default, all notebooks are global — stored in ~/.nb/ (configurable via nb set nb_dir) and accessible from any working directory in your terminal.

Local Notebooks

A local notebook is any folder outside ~/.nb/ that has been initialized as an nb notebook. Local notebooks are great for adding structured Git versioning to an existing project directory. Initialize a local notebook with nb notebooks init:
# initialize the current directory as a local notebook
nb notebooks init

# create a new local notebook at ~/example
nb notebooks init ~/example

# clone a remote Git repo as a local notebook
nb notebooks init ~/example https://github.com/example/example.git
When nb is run from inside a local notebook directory, that notebook becomes the current notebook:
nb
# local · example · home
# ----------------------
# [3] Title Three
# [2] Title Two
# [1] Title One
A local notebook is always referred to by the name local in selectors:
# move a note from home to the local notebook
nb move home:Todos local:

# move a note from local to home
nb move 1 home:

Importing and Exporting Notebooks

Turn any existing directory of files into a global notebook:
nb notebooks init example-directory
nb notebooks import example-directory
Export a global notebook to a local path:
nb notebooks export example ../path/to/destination

Archiving Notebooks

Archive notebooks you are not actively using to hide them from the default list and exclude them from nb search --all and automatic sync:
# archive the current notebook
nb archive
nb ar

# archive a specific notebook
nb archive example
nb ar example
Archived notebooks are still usable — they just do not appear in the default listing:
nb
# example1 · example2 · example3 · [1 archived]
# ----------------------------------------------
# [3] Title Three

Checking Archival Status

# status for the current notebook
nb status
nb st

# status for a named notebook
nb status example
nb notebooks status example

Unarchiving

nb unarchive
nb unarchive example

Folders

Folders let you organize notes into subdirectories within a notebook. They are created automatically when you add a note to a path that does not exist yet.

Adding Notes to Folders

Append a trailing slash to a folder path when calling nb add:
# add a note to the "example" folder
nb add example/

# add a note to "demo" inside "example"
nb add example/demo/
nb creates any intermediate folders that do not yet exist.

Creating Folders Explicitly

# create a folder named "sample"
nb add folder sample
nb folders add sample

# create a folder using --type
nb add demo --type folder

# create a nested folder
nb add example/test --type folder

Listing Folder Contents

Pass a folder path with a trailing slash to any list command:
# list items in example/demo/
nb example/demo/
# home
# ----
# [example/demo/3] Title Three
# [example/demo/2] Title Two
# [example/demo/1] Title One
Folders can also be navigated by their numeric id with a trailing slash:
nb list
# [1] 📂 example

nb list 1/
# [example/2] 📂 demo
# [example/1] document.md

nb list 1/2/
# [example/demo/3] Title Three
# [example/demo/2] Title Two
# [example/demo/1] Title One

Identifying Items in Folders

Items inside folders are addressed using the folder path followed by the item id, filename, or title. Folder names and folder ids are interchangeable:
# list item 1 inside example/demo/
nb list example/demo/1

# edit item using mixed ids and names
nb edit example/2/one.md

# show item using folder ids
nb show 1/2/Title\ One

# delete item
nb delete 1/demo/1

Cross-Notebook Folder Selectors

Combine the notebook name, colon, and folder path:
# list the "sample" folder in the "example" notebook
nb example:sample/

# add a note to "sample/demo" in the "example" notebook
nb add example:sample/demo/

# edit item 3 in "sample/demo" in the "example" notebook
nb edit example:sample/demo/3

Notebooks, Tags, and Taxonomy

Notebooks and #tags work at different levels of granularity and complement each other:
  • Notebooks are good for top-level, high-signal categories: one per project, client, or major life area. Each notebook has its own version history and can be synced to a separate remote.
  • Tags are ad hoc and searchable across notebooks, letting you group related items across multiple notebooks without restructuring your hierarchy.
# search for #tag in the current notebook
nb q --tag tag

# search for #tag across all notebooks
nb q -t tag -a

# search for #tag in the "example" notebook
nb q example: "#tag"

Item Counts

Use nb count to get the number of items in a notebook or folder:
# count items in the current notebook
nb count

# count items in a specific notebook
nb count example:

# count items in a folder
nb count example/demo/

Quick Reference

Create Notebook

nb notebooks add <name>

Switch Notebook

nb use <name>, nb u <name>

Archive / Unarchive

nb archive [<name>], nb unarchive [<name>]

Create Folder

nb add folder <name>, nb folders add <name>

Build docs developers (and LLMs) love