# Session

Start by creating or selecting your session.
Create it once, then reuse it.
Do not create a new session for every command or subtask.

Session stores captured inputs, saved outputs, aliases, and prefs.

Prefer short session names:
aa, tr, qa, a2

Create:
session init --name <name>

Follow the command output.
If aib says multiple sessions exist, use the session you created explicitly:
aib -s <name> <command>

Or bind this shell:
AIB=<name>

If you want to prune session inputs/outputs, use:
session clear

After clear, keep using the same session.

Check:
session status

Handles:
Commands may return handles for hidden output or reusable indexes.

Hidden output:
aib:res_<id>

Use view to fetch only the hidden part without repeating the original request:
aib view aib:res_<id>

Reusable indexes:
aib:usages:<name>
aib:graph:<name>

Usages and graph handles store computed indexes.
Use them with --from-file to focus or expand the saved result:

inspect usages --from-file aib:usages:service-usages --focus createService --detail code
inspect graph --from-file aib:graph:services-graph --focus src/service.ts

Escape hatch for latest mutation status/result:
aib execution status last

Every JSON stdin/from request is captured.

Latest input per kind:
<session-dir>/inputs/<kind>/_last.json

Handle:
aib:input:<kind>:last

Use --from when editing the captured input costs less than rebuilding the request.
For small one-off requests, write a corrected request instead.
Do not read input handles into context unless you specifically need to inspect the payload.

Examples:
rename preview --from aib:input:rename:last
refactor batch <command> --from aib:input:refactor:last

Prefs are stored in the session.
Use prefs when you want repeated CLI behavior without repeating request fields.

Set several prefs:
session prefs set inspect.graph.hubs false inspect.graph.leaves false

Show current overrides:
session prefs get

See help prefs for the full list.
