Query DeepSeek Harness Sessions and Events
DeepSeek Harness exposes existing sessions through the ctx.sessionQuery service: list or filter the logical corpus, then read a selected session's raw events, current surface or search results according to the question you need answered.
DeepSeek Harness: what is the session corpus?
The session-query reference describes a live-preferred logical corpus. A SessionRecord includes a cloned header and independent live and persisted availability flags. A live session can also be persisted; those flags are not mutually exclusive. The header is selected from the live-preferred source. A record can also indicate migration-required when the persistence format reports that status.
The session reference describes an append-only typed event log. Model history is derived from that log. Consequently, the raw event history and what the model currently sees are related but different views.
DeepSeek Harness: which operation answers which question?
| Question | Service operation | Result |
|---|---|---|
| Which sessions exist? | listSessions() | Newest-first logical records |
| Which sessions match metadata? | filterSessions(filters) | Matching records |
| What is the complete raw log? | readSession(sessionId) | Replay-validated detached snapshot |
| What is the current model surface? | readSurface(sessionId) | Surface events and capture sequence |
| Which events match filters? | filterEvents(sessionId, filters) | Semantic documents in ascending sequence |
| Where does text occur? | searchSessions() or searchEvents() | Ranked, cursor-paginated hits |
These are service APIs for a deployment that provides ctx.sessionQuery, not documented shell commands. Exact reads and filters are backend-independent; full-text search depends on a provider. Check the service's availability in your composition before building a consumer.
DeepSeek Harness: how can I narrow down a session and its events?
- Call
listSessions()or usefilterSessions(filters)to narrow by documented metadata such as id, working directory, creation range, parent or availability. Keep the selected session identity and its availability flags together. - Select the view you need.
readSession(sessionId)reads the complete raw log without making the session live;readSurface(sessionId)reads the current model surface. Neither should be described as a subscription. - For a targeted scan, use
filterEvents(sessionId, filters). Filters can constrain sequence, time, event type, surface and literal text. Filter clauses are ANDed; values inside a list clause are ORed, and ranges are inclusive. - Inspect event sequence and type before drawing conclusions.
current,shadowedandlog-onlyindicate whether an event is in current model context, replaced context or raw-log-only. An absent event in the current surface may still exist in the raw log. - For a specific raw event and nearby context, use
readEvent(request); usetraceEvent(request)when investigating replacement or source relationships. Preserve the returned session header alongside the observation.
The text filter scans extracted semantic text case-insensitively with flexible whitespace. Messages, tool calls and results, todos, and failure or status detail contribute; reasoning blocks, blocked prompts, structural events and stream chunks do not. An empty result is therefore not proof that a string cannot appear anywhere in every raw event.
DeepSeek Harness: how is full-text search different from filtering?
searchSessions() groups cross-session results by the strongest matching event. searchEvents() searches one session and returns the observed target header even if there are no hits. A hit includes a bounded plain-text snippet. Requests treat the query as data rather than executable full-text syntax. The opaque continuation cursor is bound to the normalized query, metadata filters and limit; reuse it only with the identical request. A final page has no nextCursor.
Filtering and full-text ranking solve different problems. A time or type filter can constrain a search, but the event literal-text scan is not a provider metadata filter. The SQLite provider owns its index lifecycle; the interface does not promise that every deployment enables search. Handle deployment-disabled search and backend failures separately from a valid empty result.
How do snapshots help a consumer avoid mixing observations?
A session can change while a client is inspecting it. readSurface returns the cloned header, the current surface and capturedThroughSeq from one observation. The latter is the highest raw sequence included, or null for an empty log. It describes the observation's boundary rather than promising no later events. Likewise, an event-search page carries the target header from the same indexed generation as its hits. Preserve these values together when presenting or processing the result.
The complete log snapshot also exposes inheritedEventCount, the number of fork-inherited events in the observed log. A consumer should not silently treat inherited history as newly authored events of the child. Session lineage and event relationships are separate traces: one follows parent and descendant sessions, while the other describes relationships between events. Both have validation and failure conditions, so handle incomplete or invalid observations explicitly.
For full-text pagination, keep the query and metadata filters unchanged while following nextCursor. Changing the request asks a different question and the documented cursor is bound to the original normalized request. For an exact ordered scan, use the provider-independent filter instead of treating ranked hits as a complete chronological transcript. The choice of operation should follow the user's question and the source's availability.
DeepSeek Harness: what are the limits and safety boundaries?
The query reference defines errors for missing targets, malformed logs, optional backend failures and other conditions. A failed read is not an empty session. readSession can fail on persistence, header compatibility or replay validation. A lineage trace can report an unresolved parent; do not infer a complete ancestry from the known portion alone.
Session logs and snippets can include message text, tool arguments, results and workspace information. Apply your application's authorization before presenting results, and review exported evidence before sharing. The query interface and a successful read are not a guarantee that the contents are appropriate to disclose. The cited references describe service contracts, not a universal Web interface or command for querying every installation.
DeepSeek Harness: what do the terms mean?
- Logical session: a session observed across available live and persistence sources.
- Sequence: an event's monotonic position within a session.
- Surface: the event view used for current model history.
- Snapshot: a detached observation, not a continuing subscription.
- Cursor: an opaque token for continuing the same search request.
Frequently asked questions
Is a raw log the current model surface?
Not necessarily. The model surface is derived from the event log.
Does an empty text filter search every raw event?
No. The filter scans extracted semantic text, which excludes some event content.
Is full-text search always available?
No. Search depends on a provider and may be disabled in a deployment.
Sources
Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.
This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.