# Show current session
contreesession
# List all sessions
contreesessionlist
# Show full history
contreesessionshow
# Create and switch to a branch
contreesessionbranchexperiment
contreesessioncheckoutexperiment
# Switch back
contreesessioncheckoutmain
# Create a branch from another branch
contreesessionbranchhotfix--frommain
# List branches (* marks active)
contreesessionbranch
# Undo last operation
contreesessionrollback
# Undo last 3 operations (`--` stops argparse from eating `-3` as a flag)
contreesessionrollback---3
# Forward one entry
contreesessionrollback+1
# Absolute jump to a specific history id (use `session show` first)
contreesessionrollback42# Import image from another session
contreesessionuseother-session
# Delete a session
contreesessiondeletemy-old-session
contreesessionrmmy-old-session-y
$ contree session --helpusage: contree session [-h] {list,ls,use,branch,br,checkout,co,rollback,rb,show,wait,delete,rm,del} ...Manage session branches and history.Without a subcommand, shows the current session info (key, branch,image, last operation).Subcommands: list (ls) List all sessions use KEY Import another session's current image branch (br) List or create branches (--from to fork) checkout (co) Switch active branch rollback (rb) Navigate history: N=absolute, -N=back, +N=forward show Display the session history DAGpositional arguments: {list,ls,use,branch,br,checkout,co,rollback,rb,show,wait,delete,rm,del} list (ls) List all sessions use Import another session's image branch (br) List, create, delete, or prune branches checkout (co) Switch active branch rollback (rb) Navigate history: N=absolute, -N=back, +N=forward show Show session history wait Drain detached ops in the current session delete (rm, del) Delete sessions by keyoptions: -h, --help show this help message and exitfor coding agents: session (no subcommand) is read-only branch/checkout/rollback/session use mutates local session pointers `session show` defaults to last 20 history entries; pass -a/--all for full DAG use `session show` to inspect history DAG before destructive navigation `session wait [OPS...]` waits for active or specified operationsagent note: Before using this command in an automated workflow, read: contree agent
Each non-disposable contreerun creates a new history entry and advances
the branch pointer. Branches share the underlying history – creating a
branch just adds a new pointer at the current position.
Rollback moves the branch pointer backwards. History entries are preserved
and can be recovered by creating a new branch.
contreesessionlist (alias ls) prints every session known to the
current profile, with the active session marked. The optional
--filter flag narrows the list by substring match against the session
key, which is handy when you keep many disposable sessions named after
features or tickets.
$ contree session list --helpusage: contree session list [-h] [--filter FILTER_TEXT]List locally known sessions and their current branch/image.options: -h, --help show this help message and exit --filter FILTER_TEXT Filter session keys containing this textfor coding agents: read-only command
contreesessionuseKEY imports the current image of another
session into the active session as a new history entry. The source
session is not modified; this is a “fork the snapshot, keep working
here” operation, distinct from the top-level contreeuse which starts
or resumes a session against an image reference.
$ contree session use --helpusage: contree session use [-h] session_nameSet current session image to another session's tip image. Accepts exact key or key suffix.positional arguments: session_name Session key or suffix to matchoptions: -h, --help show this help message and exitfor coding agents: mutates current session history
contreesessionbranch (alias br) lists branches with * marking
the active one. Pass a name to create a new branch pointing at the
current history position, or combine with --fromBRANCH to fork off a
different branch. The -U/--prune flag removes branches that no
longer reference live history.
$ contree session branch --helpusage: contree session branch [-h] [--from FROM_BRANCH] [-U] [--prune] [branch_name]List branches (no args). Create with NAME (optionally --from). Delete with --delete NAME. Prunedisposable-/detached- branches with --prune.positional arguments: branch_name Branch name (create/delete target)options: -h, --help show this help message and exit --from FROM_BRANCH Source branch (default: active branch) -U, --delete, --rm Delete the specified branch (NAME required, must not be active) --prune Prune disposable-/detached- branches (non-active only)for coding agents: read-only when NAME/--delete/--prune omitted mutating whencreating/deleting/pruning
contreesessioncheckoutBRANCH (alias co) switches the active
branch pointer. Working directory, pending files, and the current
image are all reset to whatever the target branch currently points at,
so it is the safe way to bounce between parallel experiments.
$ contree session checkout --helpusage: contree session checkout [-h] checkout_branchMove current session to another existing branch tip.positional arguments: checkout_branch Branch to switch tooptions: -h, --help show this help message and exitfor coding agents: mutates active branch pointer
contreesessionrollback[TARGET] (alias rb) navigates the history
of the current branch. With no argument it steps back one entry; a
positive number jumps to that absolute history index, -N steps back
N entries, and +N steps forward. History entries are preserved –
rollback only moves the branch pointer.
$ contree session rollback --helpusage: contree session rollback [-h] [target]Move branch pointer in session history. Supports absolute ID, relative backward (-N), and forward(+N).positional arguments: target History target: ID (absolute), -N (back), +N (forward) — use `-- -N` for negative valuesoptions: -h, --help show this help message and exitfor coding agents: mutates active branch history pointer
contreesessionshow prints the session history DAG with one row per
entry, including operation IDs, image UUIDs, branch pointers, and
relative timestamps. Use -a to include hidden entries, -kKIND to
filter by entry kind (e.g. run, cd), and -lLAST to show only the
last N rows.
$ contree session show --helpusage: contree session show [-h] [-a] [-k KIND] [-l LAST] [--since SINCE] [--until UNTIL] [session_name]Print session history DAG entries and branch labels. By default shows last 20 entries; use-a/--all for full history.positional arguments: session_name Session key or suffix (default: current session)options: -h, --help show this help message and exit -a, --all Show full history (default: last 20 entries) -k KIND, --kind KIND Filter history entries by kind (e.g., run, use, cd) -l LAST, --last LAST Show last N entries after filtering --since SINCE Show entries since. Parse +/- intervals (bare seconds or smhdMy) or ISO/date to UTC datetime. --until UNTIL Show entries before. Parse +/- intervals (bare seconds or smhdMy) or ISO/date to UTC datetime.for coding agents: read-only command
contreesessionwait[OP_ID...] blocks until the specified operations
reach a terminal state (SUCCESS, FAILED, or CANCELLED). When no
IDs are given it waits for every active operation in the session, which
is the canonical way to drain background contreerun-d jobs before
moving on.
$ contree session wait --helpusage: contree session wait [-h] [UUID_OR_REF ...]Drain detached operations in the current session. With no arguments, reads the session's pending-ops cache, polls each to a terminal status, and advances the active branch to each non-disposableresult image (recording `disposable-<uuid>` branches for disposable runs). With explicit UUIDs,this command degrades to a plain polling loop: it prints completion rows but does NOT touch theactive branch, because the pending metadata is not loaded for explicit UUIDs.positional arguments: UUID_OR_REF Operations to wait for (default: all active in this session). Accepts UUIDs and session-history references (HEAD, HEAD~N, @, @N, @-N, @+N, :N, bare N).options: -h, --help show this help message and exitfor coding agents: no-arg form mutates session history (advances active branch) UUID form is apure polling observer if you need result images from explicit UUIDs, use `op show UUID | jq -r.image` and `contree use`
contreesessiondeleteKEY[KEY...] (aliases rm, del) removes
sessions and all their data – history, branches, pending files, shell
history. The command prompts before deleting unless -y is passed.
Use this to garbage-collect throwaway sessions; the disk savings on
the SQLite database can be substantial when many short-lived sessions
accumulate.
$ contree session delete --helpusage: contree session delete [-h] [-y] KEY [KEY ...]positional arguments: KEY Session keys to deleteoptions: -h, --help show this help message and exit -y, --force Do not ask for confirmation