What is a Session, and how does it differ from a chat room?
After several conversations, unrelated appliance questions and automation work can crowd the Session list. This chapter explains what a Session stores, when to split or continue a topic, what Fork is for, and how to export, back up, and clean up old work. By the end, you will be able to organize conversations as naturally as folders.
Why Sessions become hard to manage
A new Pi Agent installation has an empty, tidy Session list. After a week, you may see problems like these:
- A lighting fault and a sunset automation share one Session, so unrelated context begins to affect the answer.
- You want to find last week's vacuum schedule, but several titles use only a vague first message and are hard to identify.
- You want to compare two models from the same starting point but keep copying and pasting the entire prompt.
- A long Session becomes slower and consumes more context.
These are organizational problems caused by putting too many unrelated topics in one Session. This chapter shows when to split or continue a Session, when to branch with Fork, and when to remove old work. Good organization also makes history, model comparisons, and backups easier to manage.
What is a Session?
A Pi Agent Session is more than a transcript. It is a package that can include:
- Every event in the conversation (your messages, model responses, reasoning data, tool cards, and diffs)
- Model information for the Session (including changes between configured model routes)
- Skills loaded for the Session (for example, tool activity and the settings used)
- The Session working directory (cwd) (the folder used for file operations)
- System instructions (the rules, role, and style supplied to the model)
In other words, a Session is an independent workspace with stored context. You can close the browser and reopen the Session later to continue from its saved state. That is stored context, not human-like memory. Available models and Skills may still change if their shared configuration changes.
How a Session differs from a messaging chat
A familiar messaging app is a useful starting analogy, but several differences matter:
| Comparison | Messaging app | Pi Agent Session |
|---|---|---|
| Participants | People in the conversation | You and the selected model route |
| Other party | A person or group | A model route that you can change |
| Storage | Depends on the messaging service | Session data on your Home Assistant host under /data/pi-agent/sessions/ |
| Previous context | People remember independently | Relevant stored history is sent again within the model's context limits |
| Parallel conversations | Separate chat rooms | Separate Sessions with independent histories |
| Copy or branch | Usually forwards messages | Some pi-web versions offer Fork or Duplicate |
| Retention | Controlled by the service | Remains until deleted or lost, subject to your backups |
Where Session files are stored
Pi Agent stores each Session as a .jsonl (JSON Lines) file, with one event per line. The add-on path is:
/data/pi-agent/sessions/<working-directory ID>/<timestamp>_<uuid>.jsonl
Each path segment has a purpose:
| Path segment | Meaning | Why it matters |
|---|---|---|
/data/pi-agent/ | Persistent Pi Agent add-on data, separate from /config/ (the main Home Assistant configuration) | Its protection depends on the add-on backup and restore behavior |
sessions/ | Parent directory for Session records | Contains the saved conversations |
<working-directory ID>/ | Identifier derived from the Session working directory | Groups Sessions that use the same working directory |
<timestamp>_<uuid>.jsonl | One Session file; the timestamp helps identify it by date | Useful when matching a file to a Session that is hard to locate in the interface |
The /data/pi-agent/ directory may be included in a Home Assistant backup, depending on the add-on backup and restore behavior. Follow Chapter 20, create a test backup, and verify restoration rather than assuming these files are protected.
When to split or continue a Session
There is no single correct answer, but this table works for most situations:
| Situation | Action | Reason |
|---|---|---|
| Continue one topic, such as finishing a lighting automation | Continue the same Session and keep asking there | The prior context is relevant; splitting would require repeating it. |
| Move from an appliance fault to an unrelated automation | Start a new Session using the New control shown by your pi-web version | The new topic does not need the old context. |
| Compare models from the same point | Use Fork or Duplicate if your version supports it, then select a different configured model route in each copy | Both branches start with the same stored history. |
| The Session is long or omits earlier details | Create and verify a summary, then start a new Session with that summary | A short summary leaves more context for new work. |
| Share a troubleshooting record | Export a supported format and remove secrets | The recipient does not need access to your Home Assistant instance. |
| An experiment is no longer useful | Export if needed, then Delete | Removing clutter makes active work easier to find. |
Create, name, and classify a Session
Follow this sequence once, then use it whenever you start a new topic.
-
Select the new-Session control
Depending on your pi-web version, it may say + New, New session, or show a plus icon. Selecting it should clear the conversation and Composer fields. The sidebar may show a temporarily untitled Session until you send a message.
-
Write a specific first message
Your first message establishes the direction and may determine the Session's automatically generated title. “Find out why one of three living-room lights is unavailable” is a better starting point than “Check the light.” Some pi-web versions derive and truncate the sidebar title from this message.
-
Rename the Session if the control exists
Open the Session row's ⋮ three-dot or context menu and look for Rename or Edit title. Use searchable wording such as “Living-room light 3 — unavailable.” If your version lacks this action, do not delete useful work merely to change a title; keep the Session and use the organization controls your version provides.
-
Add a tag only if your version supports tags
Some pi-web versions offer Tag / Label in the Session menu. Possible categories include
Home appliance,Automation,Questions and Answers,Video, andBackup/Maintenance. Other versions support only title or message search and have no separate tag field. If you cannot find tags, skip this step and use a consistent title prefix, such as “Appliance/Living-room light 3 — unavailable,” so related Sessions are easy to search. -
Review the title when the work ends
The actual cause may differ from your first guess—for example, a suspected lamp fault may turn out to be a Wi-Fi problem. Rename the Session to the result you will search for later.
What Fork or Duplicate does and when to use it
Where supported, pi-web can copy a Session at its current point. Later messages in the copy should not change the original. Depending on the version, this action may be called Fork, Duplicate, or Copy Session. The exact metadata copied can also vary. Exporting .jsonl creates an archive, not necessarily an equivalent branch or import workflow.
Useful cases include:
| Situation | How to branch | Benefit |
|---|---|---|
| The model proposes options A and B, and you want to investigate each separately | Create one branch for option A and one for option B | The follow-ups do not mix. |
| You want another model to continue from the same point | Branch, then select another configured model route in the copy | The original remains available for comparison. |
| An automation is nearly complete but the next change is risky | Create a checkpoint branch before continuing | You retain the prior conversation state. |
| You want to share only the clean part of a tutorial | Branch at that point, then export the copy | Later experiments stay out of the shared record. |
Typical path: Session row → three-dot or context menu → Fork, Duplicate, or Copy. Confirm the new entry, rename it, and test that a message in the copy does not appear in the original. Labels and list placement vary by pi-web version.
Export a Session
Export creates a file you can read or store outside pi-web. Use it for an offline copy, a support record, or a cleaned transcript.
Typical path: Session row → three-dot or context menu → Export or Download. Formats vary. If no Export action exists, advanced users may copy the relevant file from /data/pi-agent/sessions/<cwd>/ after following safe add-on file-access procedures. Copy the matching .jsonl file rather than modifying the original.
| Format | Contents | Use |
|---|---|---|
.jsonl (raw format) | Structured events that may include messages, roles, reasoning, tool calls, paths, and other metadata | Complete archival copy; inspect it for secrets |
.md (Markdown, if supported) | A human-readable transcript whose exact fields depend on the version. Not every pi-web version supports this export format; if yours does not, use .jsonl and convert a copy with a trusted script or ask the agent to help. | Notes, email, a blog post, or a support conversation |
A Markdown export might resemble the example below. Layout and fields vary by version:
# Living-room light 3 offline troubleshooting
Model: provider/model-id
Exported: 2025-08-14
## User
Help me find out why one of the three living-room lights cannot connect.
## Assistant
First, confirm whether this light never worked or stopped working after a period of normal operation.
If it stopped working, check whether Home Assistant reports it as unavailable or off.
## User
It worked normally until yesterday. Its state is unavailable.
## Assistant
A network or firmware problem is likely. Try these steps:
1. Open the light's device page and check the last communication time.
2. Open the Wi-Fi router dashboard and confirm whether the light is still connected.
3. ...
.jsonl. For a human-readable copy, use .md if supported. Either format can contain prompts, file contents, paths, tool results, and secrets, so review and redact it before sharing.Three ways to clean up Sessions
As Sessions accumulate, choose the least destructive cleanup method that meets your need:
-
Method 1: Delete one Session at a time
Look for Delete. Read the confirmation carefully and export important work first. This is the safest method for routine cleanup.
-
Method 2: Use batch selection only if supported
Some pi-web versions may offer multi-select with Ctrl/Cmd plus click, Shift plus click, or a separate selection mode. Selected rows may then expose batch actions. If your interface does not show this feature, delete Sessions individually instead.
-
Method 3: Remove files under
/data/pi-agent/sessions/only as an advanced recovery operationDo not run a broad
rmcommand casually or directly remove.jsonlfiles without a plan. Important: direct file removal can leave indexes or cached entries inconsistent. Stop the add-on, make a verified backup, identify the exact files, and follow version-specific documentation.
.jsonl or make a separate copy of its .jsonl file, then verify the archive before deleting anything you may need later.How Sessions affect model “memory”
The key point is that the model does not remember a Session like a person. Pi Agent supplies relevant stored history with each new request, subject to context and implementation limits.
At a high level:
-
You send a message
Pi Agent constructs a request containing the new message and relevant Session context, then sends it to the selected model provider.
-
The model processes the supplied context
It generates the next response from that request; it does not independently recall your local Session file.
-
The next turn repeats the process
Newly stored events may become part of the context supplied with the next request.
This has three direct consequences:
- Longer context can increase input usage and latency. More capable models cannot eliminate those physical limits.
- Earlier details can fall outside the effective context. Start a new Session with a verified summary when that happens.
- Deleting a local Session removes Pi Agent's copy. It does not make promises about a cloud provider's retention; consult that provider's current policy.
Common Session problems
-
I cannot find an old Session
Search titles, message text, and tags if your version supports those fields. Then check likely dates. Before inspecting
/data/pi-agent/sessions/, make a backup and follow safe file-access instructions. If the Session was deleted, recover it only from a verified backup. -
A Session opens blank
The file may be damaged. Check Settings → Add-ons → Woow HA Pi Agent → Log for a
parse errororJSONerror that identifies the affected file. Preserve the damaged file before deleting it if recovery matters; other Sessions should remain separate. -
A fork produces a different answer
That is expected. Model output can vary, and the model or route may have changed since the branch point. A branch preserves a starting state; it does not guarantee identical output or travel back in time.
-
I want to back up every Session
Use Home Assistant's current Settings → Backups workflow and include the Pi Agent add-on data under
/data/pi-agent/if that option is available. Test the documented restore process rather than assuming the backup contains every Session and provider or Skill setting. Chapter 20 explains the backup workflow in detail. -
The Session list is slow
Export resolved work as
.jsonland verify the archive before removing entries you no longer need. Performance depends on your pi-web version and host, so there is no universal file-count threshold. -
An old Session has no usable model
The referenced model or provider route may have been removed. Re-add a valid route by following Chapter 6, or select another currently configured model. Future messages then use the newly selected route.
Session FAQ
Is there a Session limit?
/data/pi-agent/sessions/, the size of each .jsonl file, the host resources, and the pi-web version. Archive and remove old work before the list becomes difficult to use.Can I recover a deleted Session?
Can I edit a Session file in a text editor?
.md transcript or start a new Session with the relevant summary. If advanced recovery requires inspection, work on a copy and preserve the original.Does changing one fork affect the other?
Can I move Sessions to another Home Assistant host?
/data/pi-agent/sessions/ with a tool such as tar is an advanced operation: stop the add-on, preserve ownership and paths, and keep a rollback copy. Exporting .jsonl does not prove that your version supports Import; Import is not available in every pi-web version. If version-specific documentation permits manual transfer, place each .jsonl record under sessions/<matching-cwd>/ and restart the add-on as documented.Can two people open the same Session?
.md export.What is the difference between switching models and opening a new Session?
Are reasoning blocks and tool cards stored?
.jsonl record can include messages, reasoning, and tool activity. Exact fields depend on the model route and version. Treat exports as sensitive because they may include prompts, paths, file content, and tool output. See Chapter 9 for guidance on reasoning blocks and diffs.