Continue sessions between the CLI and the desktop app
hagent and the desktop app share one session history. A conversation you start in the terminal can be continued in the desktop app, and the other way round.
Continue your last session
hagent -c
-c (--continue) opens the most recently updated session, shows the earlier conversation, and lets you carry on.
Open a specific session
- Find the session ID: type
/sessionsin hagent to list the 20 most recent sessions (/sessions alllists them all). Each line has a number, the session ID, the title and the time. Sessions that are running are marked as running. - Open it by ID:
hagent -r 3f9c2a
-r (--resume) only needs the first few characters of the session ID, as long as they're unique.
You can also switch in interactive mode:
/resume: lists recent sessions; type a number to switch./resume 3or/resume 3f9c2a: switches directly by the number or ID shown in/sessions.
Note
Without -c or -r, hagent starts a new session every time.
Move between the CLI and the desktop app
- Sessions created in the desktop app show up right away when you run
/sessionsor/resumein hagent, because the list is re-read. - hagent saves its session when you exit, and you'll find it in the desktop app's sidebar too.
- Both sides use the same record, so scene change cards, checkpoints and context all carry over.
Manage sessions
| Command | What it does |
|---|---|
/clear (/new) |
Start a new session; the old one stays in the list |
/rename <name> |
Rename the current session |
/fork (/branch) |
Fork a new session from this point |
/delete [number] |
Delete a session (the current one without a number); asks you to confirm first and can't be undone |
/export |
Export the current conversation |
/copy [n] |
Copy the nth-from-last reply |
/find <text> |
Find text in the current session |
Continue the same session from a script
The JSON output of -p includes session_id. Pass it to -r on the next call, and several script calls land in the same session:
$r = hagent -p "List the geometry nodes under /obj" --output json | ConvertFrom-Json
hagent -r $r.session_id -p "Turn on the display flag of the first node"
Was this article helpful?