Sessions
기준일: 2026-07-26
공식 기준: Sessions
Sessions 문서는 OpenClaw 공식 문서(cli/sessions)를 한국어로 정리한 가이드입니다. CLI reference for openclaw sessions (list stored sessions + usage) 명령·설정 키·코드 예시는 공식 문서를 그대로 보존하며, 해석과 절차 안내는 한국어로 제공합니다. 최종 동작은 설치된 CLI 버전과 공식 원문을 확인하세요.
핵심 요약
CLI reference for openclaw sessions (list stored sessions + usage)
한국어 가이드 범위: cli/sessions 경로의 설정·명령·제약·예시를 학습용으로 재구성합니다.
문서 구성
공식 문서의 주요 섹션은 다음과 같습니다.
- Tail trajectory progress
- Export a trajectory bundle
- Cleanup maintenance
- Compact a session
- sessions.compact RPC
- 관련 문서
상세 내용
openclaw sessions
Session lists are not channel/provider liveness checks. They show persisted conversation rows from session stores. A quiet Discord, Slack, Telegram, or other channel can reconnect successfully without creating a new session row until a message is processed. Use openclaw channels status --probe, openclaw status --deep, or openclaw health --verbose when you need live channel connectivity.
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
| Flag | Description |
|---|---|
--agent <id> |
One configured agent store (default: configured default agent). |
--all-agents |
Aggregate all configured agent stores. |
--store <path> |
Explicit store path (cannot combine with --agent or --all-agents). |
--active <minutes> |
Only show sessions updated within the past N minutes. |
--limit <n|all> |
Max rows to output (default 100; all restores full output). |
--json |
Machine-readable output. |
--verbose |
Verbose logging. |
openclaw sessions
openclaw sessions --agent work
openclaw sessions --all-agents
openclaw sessions --active 120
openclaw sessions --limit 25
openclaw sessions --store ./tmp/sessions.json
openclaw sessions --json
{
"path": null,
"stores": [
{ "agentId": "main", "path": "/home/user/.openclaw/agents/main/sessions/sessions.json" },
{ "agentId": "work", "path": "/home/user/.openclaw/agents/work/sessions/sessions.json" }
],
"allAgents": true,
"count": 2,
"totalCount": 2,
"limitApplied": 100,
"hasMore": false,
"activeMinutes": null,
"sessions": [
{ "agentId": "main", "key": "agent:main:main", "model": "openai/gpt-5.6-sol" },
{ "agentId": "work", "key": "agent:work:main", "model": "anthropic/claude-sonnet-4-6" }
]
}
Tail trajectory progress
openclaw sessions tail renders recent runtime trajectory events as compact progress lines. Without --session-key, it tails running sessions first, then the latest stored session. --tail controls how many existing events print before follow mode; default 80, and 0 starts at the current end. --follow keeps watching the selected SQLite-backed session or an explicit legacy trajectory file.
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
openclaw sessions tail
openclaw sessions tail --follow
openclaw sessions tail --session-key "agent:main:telegram:direct:123" --tail 25
openclaw sessions --agent work tail --follow
openclaw sessions --all-agents tail --follow
Export a trajectory bundle
This is the command path used by the /export-trajectory slash command after the owner approves the exec request. The output directory is always resolved inside .openclaw/trajectory-exports/ under the selected workspace.
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --workspace .
openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --output bug-123 --json
Cleanup maintenance
Run maintenance now instead of waiting for the next write cycle:
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
주요 항목:
- Scope note:
openclaw sessions cleanupmaintains session stores, - Cleanup also prunes unreferenced legacy/archive transcript artifacts,
- Cleanup reports short-lived Gateway model-run probe cleanup separately as
| Flag | Description |
|---|---|
--dry-run |
Preview how many entries would be pruned/capped without writing. In text mode, prints a per-session action table (Action, Key, Age, Model, Flags) plus a summary grouped by session label. |
--enforce |
Apply maintenance even when session.maintenance.mode is warn. |
--fix-missing |
Remove legacy entries whose archived transcript artifacts are missing or header-only/empty, even if they would not normally age/count out yet. |
--fix-dm-scope |
When session.dmScope is main, retire stale peer-keyed direct-DM rows left behind by earlier per-peer, per-channel-peer, or per-account-channel-peer routing. Use --dry-run first; applying removes those rows from SQLite and preserves their legacy transcript artifacts as deleted archives. |
--active-key <key> |
Protect a specific active key from disk-budget eviction. Durable external conversation pointers, such as group sessions and thread-scoped chat sessions, are also kept by age/count/disk-budget maintenance. |
--agent <id> |
Run cleanup for one configured agent store. |
--all-agents |
Run cleanup for all configured agent stores. |
--store <path> |
Run against a specific legacy store selector path. |
--json |
Print a JSON summary. With --all-agents, output includes one summary per store. |
openclaw sessions cleanup --dry-run
openclaw sessions cleanup --agent work --dry-run
openclaw sessions cleanup --all-agents --dry-run
openclaw sessions cleanup --enforce
openclaw sessions cleanup --enforce --active-key "agent:main:telegram:direct:123"
openclaw sessions cleanup --dry-run --fix-dm-scope
openclaw sessions cleanup --json
{
"allAgents": true,
"mode": "warn",
"dryRun": true,
"stores": [
{
"agentId": "main",
"storePath": "/home/user/.openclaw/agents/main/sessions/sessions.json",
"beforeCount": 120,
"afterCount": 80,
"missing": 0,
"dmScopeRetired": 0,
"pruned": 40,
"capped": 0
},
{
"agentId": "work",
"storePath": "/home/user/.openclaw/agents/work/sessions/sessions.json",
"beforeCount": 18,
"afterCount": 18,
"missing": 0,
"dmScopeRetired": 0,
"pruned": 0,
"capped": 0
}
]
}
Compact a session
Reclaim context budget for a wedged or oversized session. openclaw sessions compact is the first-class wrapper around the sessions.compact Gateway RPC and requires a running Gateway.
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
주요 항목:
- Without
--max-lines, the Gateway LLM-summarizes the transcript. The CLI - With
--max-lines <n>, it truncates to the lastntranscript lines and --agent <id>: agent that owns the session; required forglobalkeys.--url/--token/--password: Gateway connection overrides.--timeout <ms>: optional client-side RPC timeout in milliseconds.--json: print the raw RPC payload.
openclaw sessions compact "agent:main:main"
openclaw sessions compact "agent:main:main" --max-lines 200
openclaw sessions compact "agent:work:main" --agent work --json
sessions.compact RPC
openclaw gateway call sessions.compact --params '' accepts:
위 내용은 공식 문서의 해당 섹션 요지입니다. 세부 플래그·기본값은 원문과
--help를 확인하세요.
| Field | Type | Required | Description |
|---|---|---|---|
key |
string | yes | Session key to compact (for example agent:main:main). |
agentId |
string | no | Agent id that owns the session (for global keys). |
maxLines |
integer ≥ 1 | no | Truncate to the last N lines instead of LLM summarization. |
{
"ok": true,
"key": "agent:main:main",
"compacted": true,
"result": { "tokensBefore": 243868, "tokensAfter": 34941 }
}
{
"ok": true,
"key": "agent:main:main",
"compacted": true,
"archived": "/home/user/.openclaw/agents/main/sessions/transcripts/<id>.jsonl.bak",
"kept": 200
}
관련 문서
주요 항목:
- Session config
- Session management
- Compaction
- CLI reference
실습 체크리스트
- 공식 문서와 로컬 버전을 대조합니다:
https://docs.openclaw.ai/cli/sessions - 관련 CLI는
openclaw --help및 하위 명령--help로 옵션을 확인합니다. - 설정 변경 시
openclaw config/openclaw doctor로 유효성을 검사합니다. - Gateway·채널·플러그인 변경 후에는 필요 시 Gateway를 재시작합니다.
자주 쓰는 명령·설정 예시
openclaw sessions
openclaw sessions --agent work
openclaw sessions --all-agents
openclaw sessions --active 120
openclaw sessions --limit 25
openclaw sessions --store ./tmp/sessions.json
openclaw sessions --json
{
"path": null,
"stores": [
{ "agentId": "main", "path": "/home/user/.openclaw/agents/main/sessions/sessions.json" },
{ "agentId": "work", "path": "/home/user/.openclaw/agents/work/sessions/sessions.json" }
],
"allAgents": true,
"count": 2,
"totalCount": 2,
"limitApplied": 100,
"hasMore": false,
"activeMinutes": null,
"sessions": [
{ "agentId": "main", "key": "agent:main:main", "model": "openai/gpt-5.6-sol" },
{ "agentId": "work", "key": "agent:work:main", "model": "anthropic/claude-sonnet-4-6" }
]
}
openclaw sessions tail
openclaw sessions tail --follow
openclaw sessions tail --session-key "agent:main:telegram:direct:123" --tail 25
openclaw sessions --agent work tail --follow
openclaw sessions --all-agents tail --follow
openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --workspace .
openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --output bug-123 --json
openclaw sessions cleanup --dry-run
openclaw sessions cleanup --agent work --dry-run
openclaw sessions cleanup --all-agents --dry-run
openclaw sessions cleanup --enforce
openclaw sessions cleanup --enforce --active-key "agent:main:telegram:direct:123"
openclaw sessions cleanup --dry-run --fix-dm-scope
openclaw sessions cleanup --json
{
"allAgents": true,
"mode": "warn",
"dryRun": true,
"stores": [
{
"agentId": "main",
"storePath": "/home/user/.openclaw/agents/main/sessions/sessions.json",
"beforeCount": 120,
"afterCount": 80,
"missing": 0,
"dmScopeRetired": 0,
"pruned": 40,
"capped": 0
},
{
"agentId": "work",
"storePath": "/home/user/.openclaw/agents/work/sessions/sessions.json",
"beforeCount": 18,
"afterCount": 18,
"missing": 0,
"dmScopeRetired": 0,
"pruned": 0,
"capped": 0
}
]
}
관련 링크
- 공식 원문: cli/sessions
- OpenClaw 문서 홈
이 가이드는 공식 문서를 한국어 학습용으로 재구성한 것입니다. 옵션 기본값·플래그 이름은 설치 버전에 따라 달라질 수 있습니다.