DeepSeek Harness session history: DSH plugin logs and search
DeepSeek Harness stores session logs as uncompressed JSONL under <dsh_home>/sessions; to query them in code, use ctx.sessionQuery's filterSessions, filterEvents, searchSessions, and searchEvents, filtering by id, cwd, time, type, surface, or semantic text (source).
Where DeepSeek Harness session records live: sessions and JSONL
Session persistence lands as uncompressed JSONL under <dsh_home>/sessions, and the logical session corpus prefers live data when it exists (source, source). Separate the two layers first:
- Raw log location — take the Python SDK's
sdk-minimal: session logs are the uncompressed JSONL undersessions/in thedsh_homeyou pass. Expected: mind disk usage and privacy, and never send logs containing sensitive information outward. - Logical source priority — the corpus prefers live data when available and falls back to the persistence backend. Expected: a running session reads current state rather than a stale snapshot.
- Two availability markers —
SessionRecordgives bothlive(whether the id currently exists inctx.sessions) andpersisted(whether the active persistence backend lists the id, including observed-but-not-yet-materialized sessions). Expected: use these two to tell whether a session is live or just on disk.
What a session can do depends on which plugins it loads. To add capabilities to a session, browse community plugins on DSH Plugin Hub.
How to query in DeepSeek Harness: ctx.sessionQuery and filters
ctx.sessionQuery.filterSessions(filters) applies a SessionResultFilter to the full logical session list, and ctx.sessionQuery.filterEvents(sessionId, filters) returns matching documents in ascending seq order; filter array items are AND-combined and values within a clause are OR-combined (source). Available filter dimensions:
- Session-level filters —
id,cwd,created-at,parent,availability. Expected: filter sessions by directory, creation-time range, or parent-child relation. - Event-level filters —
seq,time,type,surface,text. Expected: pinpoint a specific event within a session. - Text filter —
textis a literal, case-insensitive semantic text scan that allows flexible whitespace, independent of the specific search provider. Expected: find events by keyword without building an index first. - What semantic text includes — messages, tool calls and tool results, attachments, plus failure reasons and status details, and also reasoning, blocked prompts, and result events. Expected: you can query by semantics such as "what error did it report then".
- Search scope —
searchSessions()ranks by the strongest-matching event conversation, whilesearchEvents()searches a single session; request strategy is up to the provider. Expected: coarse-filter sessions first, then drill into events.
What state a DeepSeek Harness event has in the session surface
The classification uses the same foldSurface() state transitions as model history derivation, so surface tells you whether an event is current context, replaced, or log-only (source). Three values:
current— present model context. Expected: the model can really see it right now.shadowed— replaced context. Expected: the model can no longer see it, but the log remains.log-only— exists only in the raw log. Expected: used for auditing and backtracking.
For resume pre-checks use SessionLogSnapshot: it is the complete raw log, detached from the runtime and validated by replay. Expected: you get a self-consistent, replayable history rather than a live reference.
Notes and common questions
- JSONL is uncompressed: long runs accumulate it, so plan for cleanup and disk space.
- The SDK does not read
~/.dsh: the session location depends on thedsh_homeyou pass; see Call DeepSeek Harness from Python. - Do not conflate
surfacewithtype: the former is position, the latter is event kind. - Web and terminal sessions interoperate: but that is about handing one session between front ends, see Do dsh web and terminal sessions share state.
- Want to find which plugins a session used: check against DSH Plugin Hub.
Sources: Session query (official docs), Python SDK (official docs)
FAQ
DeepSeek Harness session persistence lands as uncompressed JSONL under <dsh_home>/sessions: the Python SDK's sdk-minimal profile writes session logs there. Note the SDK uses only the dsh_home you pass and never reads ~/.dsh.
In DeepSeek Harness, use the ctx.sessionQuery filters: filterSessions applies a SessionResultFilter to the whole logical session list, and filterEvents returns matching documents of one session in ascending seq order. Filter array items are AND-combined, and values within a clause are OR-combined.
Yes — DeepSeek Harness session search adds searchSessions and searchEvents on the search-result surface: the former ranks by the strongest-matching event conversation, the latter searches a single session. Request strategy is decided by the provider and decoupled from the upper layer.
In a DeepSeek Harness session, they are where an event sits in the folded session surface: current is the present model context, shadowed is replaced context, and log-only exists only in the raw log. The classification uses the same foldSurface() transitions as model history derivation.
In DeepSeek Harness, SessionRecord exposes two availability markers at once: live means the id currently exists in ctx.sessions, and persisted means the active persistence backend lists that id, including sessions it has observed but not yet materialized.
Related Terms
- session-query
- session-query is the DeepSeek Harness session query capability; it defines the query vocabulary over the logical session corpus, preferring live data when present, and handles exact reads, source priority, relationship tracing, and semantic extraction.— DeepSeek Harness Documentation - Session query
- SessionRecord
- SessionRecord is the session record returned by whole-corpus listing; it carries a header taken preferentially from the live source and separately exposes the live and persisted availability markers.— DeepSeek Harness Documentation - Session query
- SessionEventSurface
- SessionEventSurface describes where an event sits in the folded session surface: current (present model context), shadowed (replaced context), or log-only (raw log only).— DeepSeek Harness Documentation - Session query
- SessionLogSnapshot
- SessionLogSnapshot is a complete raw-log observation used for resume pre-checks; it is detached from the runtime and only provided after replay validation.— DeepSeek Harness Documentation - Session query
Sources
- DeepSeek Harness Documentation - Session query· deepseek-harness
- DeepSeek Harness Documentation - Python SDK· deepseek-harness