nb session setup

Install session integration for NB_SESSION_ID.

This command detects the current shell, or uses the shell you pass with --shell, and writes the matching initialization file so new shell sessions automatically get NB_SESSION_ID.

If opencode configuration is detected on the machine, it also writes the related plugin integration so the agent runtime can inject its own NB_SESSION_ID.

Usage

nb session setup [flags]

Parameters

ParameterTypeDescription
--shellstringTarget shell. Supported values: bash, zsh, fish, powershell, cmd

Notes

In most cases, you only need to run this once.

After it finishes, open a new shell session or reload your profile so NB_SESSION_ID is initialized automatically.

In agent runtimes such as Codex, if the runtime already injects a context variable such as CODEX_THREAD_ID, the CLI reuses that value first.

Examples

nb session setup
nb session setup --shell zsh
nb session setup --shell powershell