Skip to content

Session and Memory Formats

This page documents runtime file formats generated by persistence modules. For host-level Android emulator/AVD persistence (disk images, paths, reset/delete), see Filesystem Layout.

All workspace/ and state/ paths on this page are relative to the selected agent instance. In multi-agent installs, each agent has its own isolated copies of these files.

Workspace Onboarding State

Path:

  • workspace/.openpocket/workspace-state.json

Shape:

json
{
  "version": 1,
  "bootstrapSeededAt": "2026-02-22T03:00:00.000Z",
  "onboardingCompletedAt": "2026-02-22T03:05:00.000Z"
}

Semantics:

  • bootstrapSeededAt: bootstrap phase started (BOOTSTRAP.md seeded or observed)
  • onboardingCompletedAt: required onboarding profile completed
  • completion marker is used by chat onboarding gate and workspace bootstrap logic

Session

Path:

  • workspace/sessions/session-<YYYYMMDD-HHMMSS>.md

Header template:

md
# OpenPocket Session

- id: <YYYYMMDD-HHMMSS>
- started_at: <ISO8601>
- model_profile: <profile_key>
- model_name: <model_name>

## Task

<task text>

## Steps

Per-step block template:

md
### Step N

- at: <ISO8601>
- thought:
```text
<thought or (empty)>
```
- action:
```json
<action json>
```
- execution_result:
```text
<result text>
```

execution_result examples:

  • ADB action result (Tapped at (...), Sent keyevent ...)
  • script executor summary (run_script exitCode=...)
  • coding executor output (read path=..., edit path=..., exec started in background ...)
  • memory executor JSON output (memory_search / memory_get)
  • human-auth decision and delegation lines
  • optional local screenshot marker (local_screenshot=...)

Human-auth step may include:

text
Human auth approved|rejected|timeout request_id=<id> message=<summary>
human_artifact=<absolute path, optional>
delegation_result=<runtime apply summary, optional>
delegation_template=<next-step hint, optional>
local_vm_permission=<auto-approval note, optional>

Final block template:

md
## Final

- status: SUCCESS|FAILED
- ended_at: <ISO8601>

### Message

<final message>

Daily Memory

Path:

  • workspace/memory/YYYY-MM-DD.md

Created on first write with:

md
# Memory YYYY-MM-DD

Append format:

text
- [HH:MM:SS] [OK|FAIL] [<modelProfile>] task: <task> | result: <compact_message>

compact_message is whitespace-normalized and truncated to 400 chars.

Root Memory and Search Scope

  • root memory file: workspace/MEMORY.md
  • daily memory files: workspace/memory/*.md

memory_search and memory_get are restricted to this scope only.

Screenshot Format

Saved path format:

text
<screenshots.directory>/<YYYYMMDD-HHMMSS>-session-<sessionId>-step-<NNN>-<safeCurrentApp>.png

Notes:

  • safeCurrentApp keeps only [a-zA-Z0-9._-], others become _
  • retention: keep newest screenshots.maxCount; delete older PNG files

Script Run Artifact

Path per run_script execution:

text
workspace/scripts/runs/run-<runId>/

Files:

  • script.sh
  • stdout.log
  • stderr.log
  • result.json

result.json shape:

json
{
  "ok": true,
  "runId": "20260218-130000-ab12cd",
  "runDir": "...",
  "scriptPath": ".../script.sh",
  "exitCode": 0,
  "timedOut": false,
  "durationMs": 432,
  "stdout": "...",
  "stderr": "..."
}

Auto Artifact Outputs

After successful tasks, runtime may generate reusable artifacts:

  • auto skill: workspace/skills/auto/<timestamp>-<slug>.md
  • auto replay script: workspace/scripts/auto/<timestamp>-<slug>.sh

Auto skill content includes:

  • behavior_fingerprint: <hash>
  • source session path
  • per-step procedure from trace logs
  • optional ui_target semantic hints derived from tap-element context

Runtime may delete older auto artifacts when slug/fingerprint indicates duplicate behavior.

These paths are also returned in AgentRunResult.skillPath / scriptPath.

Human Auth Artifact

When web approval uploads artifact, bridge stores it under:

text
state/human-auth-artifacts/<requestId>.<ext>

Extension mapping by MIME type:

  • image/png -> .png
  • image/jpeg -> .jpg
  • image/webp -> .webp
  • application/json -> .json
  • unknown -> .bin

Common JSON payload shapes:

json
{ "kind": "text", "value": "123456", "capability": "2fa", "capturedAt": "..." }
json
{ "kind": "qr_text", "value": "otpauth://...", "capability": "qr", "capturedAt": "..." }
json
{ "kind": "geo", "lat": 37.7749, "lon": -122.4194, "capability": "location", "capturedAt": "..." }