Editing State File Format - NiclasOlofsson/remember-mcp-vscode GitHub Wiki
title: Editing State File Format description: Structure and semantics of chat editing state timeline (linearHistory/stops/entries) with telemetryInfo correlations.
This document explains the fine-grained editing timeline file that coexists with (but is separate from) the canonical chatSessions history. It captures incremental multi-file edit evolution, undo boundaries, and per-file telemetry request identifiers.
Provide a replayable timeline of an editing turn's internal phases: which files changed, at which undo boundary, and under which underlying model request (telemetryInfo.requestId). Enables:
- Accurate counting of model (HTTP) calls that led to persisted edits.
- Distinguishing context (unchanged) files from actively modified ones.
- Reconstructing per-file diff progression across "stops".
{
version: number,
sessionId: string,
linearHistory: [ TurnTimeline, ... ]
}
TurnTimeline (conceptual turn): {
requestId: string, // turnId (high-level)
stops: [ Stop, ... ]
}
Stop (undo boundary): {
stopId?: string, // absent for initial placeholder stop
entries: [ FileEntry, ... ]
}
FileEntry: {
resource: string, // file URI
languageId: string,
originalHash: string, // file content hash before this turn (empty sentinel possible)
currentHash: string, // hash after this stop
state: number, // small status flag (0/1 observed)
snapshotUri: string, // internal snapshot reference
telemetryInfo: { requestId: string, agentId: string }
}
| Layer | Role | Cardinality |
|---|---|---|
Turn (requestId) |
High-level editing/chat turn | 1..N per session |
| Stop | Undo/redo boundary (phase) inside a turn | 1..M per turn |
| Entry | Per-file snapshot at that boundary | 1..K per stop |
Turn (requestId) groups user-visible action; model request (telemetryInfo.requestId) is the underlying backend invocation that produced specific file modifications. A turn may reference multiple distinct model requestIds (retries, staged generations, refinement phases) or inherit untouched files from prior turns retaining their original telemetry IDs.
Each stop represents a cohesive batch of changes such that one editor undo would revert the group. Multiple stops appear as the agent refines output or files are sequentially updated.
An entry captures the file's state after applying changes for that stop. Re-emission across stops allows full reconstruction without computing cumulative diffs.
Change detection logic for enrichment:
changed = (
firstAppearance && originalHash !== currentHash
) || (
previousStopHash !== currentHash
)
Only entries producing changed = true should count toward model request attribution (to avoid inflating counts with carry-over context entries).
| Field | Meaning |
|---|---|
telemetryInfo.requestId |
Backend model invocation ID (matches logs’ requestId field). Use this to correlate with log scanner output. |
telemetryInfo.agentId |
Agent persona responsible for the edit (e.g., github.copilot.editsAgent). |
Model Request → File Entries: 1 → many (one model invocation can modify multiple files in a stop or across consecutive stops if the same invocation ID persists). Turn → Model Requests: 1 → many (retries, staged passes) BUT the file may retain older telemetry IDs for unchanged context.
Context (carry-over) entry heuristics:
-
originalHash === currentHashon first appearance AND never changes in later stops. - All appearances of that resource share a telemetryInfo.requestId ≠ parent turnId and the file never changes → purely contextual.
Active edit entries are those where at least one stop yields changed = true.
For each turn (top-level requestId):
modelRequestIds: string[] // unique telemetryInfo.requestIds for *changed* files only
allModelRequestIds?: string[] // (optional) including context
modelRequestsCount: number // modelRequestIds.length
contextOnlyRequestIds?: string[] // telemetry IDs seen but no file changes
changedFiles: number // number of files with >=1 change
stops: number // total stops for this turn
| Goal | Fields Used | Notes |
|---|---|---|
| True model call count per day | Σ modelRequestsCount |
More accurate than counting turns. |
| Materialization rate | modelRequestsCount vs log model requests | Measures how many backend calls produce persisted edits. |
| Retry detection | Multiple telemetry IDs within a single turn | Distinguish sequential vs parallel attempts. |
| File churn | changedFiles per turn / day | Indicates scope of edits. |
| Pitfall | Mitigation |
|---|---|
| Counting context telemetry IDs as active | Filter by hash change. |
| Assuming stopId globally unique | Treat stopId as turn-scoped helper only. |
| Over-attributing unchanged re-emissions | Track last seen hash per resource. |
| Missing state file (deleted/rotated) | Skip enrichment gracefully; keep base event. |
- Implement
EditStateScannerto locate and parse state files. - Build per-turn summaries (hash tracking + telemetry sets).
- Enrich existing usage events post
SessionDataTransformerusing (sessionId, requestId) key. - Add debug command to dump correlation vs logs.
- (Optional) Feature flag the enrichment initially.
| Enhancement | Description |
|---|---|
| Net-effect diff classification | Classify changes as additive / refactor / revert using before/after hashes content inspection. |
| Latency attribution per model request | Combine with log timing to produce phased latency breakdown within a turn. |
| Context utilization score | Ratio of referenced but unchanged files to changed files. |
Revision History:
- v1 (initial extraction) – codifies observed semantics & enrichment strategy.