OpenHome Abilities can read and write files that persist across sessions. This is how you build voice journals, running logs, long-term preferences, alarms, grocery lists, and any Ability that needs to remember something beyond the current conversation.Documentation Index
Fetch the complete documentation index at: https://docs.openhome.com/llms.txt
Use this file to discover all available pages before exploring further.
If you specifically need an Ability to influence the Agent’s prompt (inject context the Agent can see), see Agent Memory & Context Injection — that page covers the
.md-file → Agent-prompt pipeline. This page is about general-purpose file storage.The API
Four methods, all fromself.capability_worker:
| Parameter | Meaning |
|---|---|
name | Filename, including extension |
content | String payload (serialize JSON/CSV yourself) |
temp=False | Persistent across sessions |
temp=True | Cleared when the session ends |
Storage patterns
Four patterns cover 90% of use cases. Pick the one that matches your data’s shape.1. Journal / append log
For things that grow forever and don’t need to be read in structured form — voice journals, event logs, debug traces.write_file appends by default for text-like files — no read-modify-write needed.
Read later:
2. Latest state / replaceable file
For a single current value that gets overwritten — user preferences, the latest mood reading, the current “focus mode” flag..md context files that inject into the Agent prompt.
3. Key-value JSON
For structured data with multiple fields — alarms, reminders, a grocery list, user settings.4. Rolling window
For recent-N data — last 100 sensor readings, last 24 hours of transcripts, recent commands.Persistent vs temp
temp=False (default) | temp=True |
|---|---|
| Survives session end | Deleted when session ends |
| User preferences, alarms, journals | Conversation scratch space, session flags |
| Read on next session | Gone after the current call |
temp=False. Only use temp=True when you need to remember something within a session but want it cleared after.
Best practices
Namespace your filenames
Avoid generic names. They collide across Abilities.- ❌
data.json,state.md,list.txt - ✅
smarthub_prefs.json,alarm_active.md,grocery_list.txt
Keep each file focused
One logical object per file. Split a shared concern across files when the single file gets past ~1 MB or starts holding multiple unrelated concepts.Always check existence before read
read_file() on a missing file throws. Always:
Serialize JSON yourself
write_file() takes a string. Use json.dumps() when writing, json.loads() when reading. Wrap json.loads in a try/except json.JSONDecodeError to recover from corrupt files.
Bound your data
Rolling windows, journal rotation, log truncation — pick a cap and enforce it at write time. Unbounded files fill disk and slow down every future read.Handle missing files as “first run”
On the first call, every file is missing. Design for that:When to use main.py + background.py together
If you need to write from main.py and react to that write from a background daemon — like alarms or reminders — see the Coordination Pattern in Background Abilities. Both files read and write to the same shared file storage.
See also
- Agent Memory & Context Injection —
.mdfiles that get injected into the Agent’s live prompt - Background Abilities — daemons that poll shared storage
- SDK Reference — the full file API and sandbox rules

