MCPcopy
hub / github.com/claude-code-best/claude-code / materializeSessionFile

Method materializeSessionFile

src/utils/sessionStorage.ts:998–1013  ·  view source on GitHub ↗

* Create the session file, write cached startup metadata, and flush * buffered entries. Called on the first user/assistant message.

()

Source from the content-addressed store, hash-verified

996 * buffered entries. Called on the first user/assistant message.
997 */
998 private async materializeSessionFile(): Promise<void> {
999 // Guard here too — reAppendSessionMetadata writes via appendEntryToFile
1000 // (not appendEntry) so it would bypass the per-entry persistence check
1001 // and create a metadata-only file despite --no-session-persistence.
1002 if (this.shouldSkipPersistence()) return
1003 this.ensureCurrentSessionFile()
1004 // mode/agentSetting are cache-only pre-materialization; write them now.
1005 this.reAppendSessionMetadata()
1006 if (this.pendingEntries.length > 0) {
1007 const buffered = this.pendingEntries
1008 this.pendingEntries = []
1009 for (const entry of buffered) {
1010 await this.appendEntry(entry)
1011 }
1012 }
1013 }
1014
1015 async insertMessageChain(
1016 messages: Transcript,

Callers 1

insertMessageChainMethod · 0.95

Calls 4

shouldSkipPersistenceMethod · 0.95
appendEntryMethod · 0.95

Tested by

no test coverage detected