Skip to content

Chat session backup and recovery

Use the Command Palette for chat storage recovery. Choose the action that matches the problem.

Situation Action
Preserve chat history before upgrading or moving a profile Run Kodik: Back Up Chat Sessions. Keep the whole backup directory.
Save a readable copy of conversations Run Kodik: Export Chat Sessions. The JSON export is for reading or sharing conversation history. Use a backup to preserve attachments, checkpoints, and continuation data.
Restore a complete chat backup Run Kodik: Restore Chat Sessions From Backup. Kodik validates the backup before asking you to confirm replacement of the current store. Preserve newer chats first if you can still open them.
Chats from an old JSON store are missing after an upgrade Run Kodik: Recover Legacy JSON Chat Sessions to import supported records into the current store.
A single turn failed Open that chat and read the error card. If it offers Retry, fix the reported cause before continuing.

For one chat, use Export Chat as Markdown to save a readable transcript.

See Back up, export, and restore for backup and export details or Damaged chat storage if the sidebar reports corruption.

If setup is interrupted immediately after saving your latest message, reopening the chat offers Retry before any model request runs. The message and its attachments remain in the conversation. Retry uses the saved input once, without adding another copy of your message; recovery waits for your action.

When a model request fails, its saved error and Retry action appear on one card while the live chat updates. Reloading keeps that same saved failure; errors from different turns remain separate.

Chat storage can save up to 256 updates per batch. A batch can include updates to sessions, messages, and file review. If you hit this limit during a bulk action, split the action into smaller batches and try again. The error card omits Retry for this failure because it would repeat the same batch.

If the requested model is unavailable, the error card names it when known. If Auto cannot find a model for the request, the card explains that as well. Use Choose Model to pick a replacement for the chat, then Retry to send the saved message. If a provider’s API URL may be wrong, the card also points you to the provider settings.

After an interrupted workspace edit, turn recovery preserves any edit result that storage recovery has already saved. Taking ownership of the interrupted turn does not put a settled edit back into an executing state or replace newer saved cancellation state.

On Windows, repeated attempts to open chat storage reuse the verified identity of the current Kodik process. Checks of another writer still run before taking ownership, and unavailable process checks can be retried.

In Kodik-hosted chats, if the bounded recovery completes its dedicated summary but the resumed model request still exceeds the context limit, the provider error keeps its original reason and Retry, including after reload. A summary that fails keeps the failed-summary card. Kodik does not start another automatic recovery attempt when that bounded route is exhausted.

Kodik controls maintenance and shutdown of shared chat storage. Individual chat connections cannot invoke these operations; normal shutdown and busy-store recovery remain available to the app.

Creating chat storage for a new profile requires fewer waits for disk writes. Directory preparation and cleanup wait for their required writes to finish even when one fails. A retry acknowledges unfinished directory preparation.

When the sidebar cannot load saved chats, it shows the known storage cause in your interface language alongside Retry. A disk read failure is described as a reading problem. Unclassified failures use general loading guidance; internal database details stay out of the banner.

Large saved messages and tool cards remain available when you reload or reopen a chat, including after Kodik has released its in-memory history. The requested history page loads its content in chunks and releases temporary storage handles afterward.

If you disable kodik.chat.storage.persistToolProgress, interim tool-card details may be lost after reload or a crash. Completed results and background completion updates still remain saved. Interrupted execution without a confirmed result can still be marked unverified; skipping interim details does not make an interrupted tool appear completed. See chat storage settings.

If a local background command finishes while the chat window is unavailable, the agent process saves its exit code and output. Reopening the chat after a crash delivers the saved result to the agent.

With the experimental kodik.chat.storage.combineCompletionWrites enabled, a crash before the final save can leave the turn marked interrupted. An answer whose final save completed remains recoverable, and tool results already saved stay in history. This option is off by default and takes effect after restarting Kodik.

Checks for large saved text take less time, reducing delays to other chats saving while that text is read. Existing checks for damaged or incompatible data remain in place.

History search includes workspace names, including older folders beyond the first page of folder metadata. Non-English title searches also work while storage is read-only.

Known read failures give reading-specific guidance. Generic storage-access errors give retry guidance without guessing whether the failed operation was a read or a save. A generic error alone does not confirm whether the latest step was saved or whether a repair is running. Check the saved conversation after storage becomes available before continuing.

When reopening after interrupted summarization, Kodik reuses the already saved summary and verifies its history before continuing.

Kodik spends less time waiting on disk when preparing a model change after inactivity or a conversation restore. Interrupted preparation retains its saved data and recovery checks.

Saving a new reply or tool result uses the latest saved provider item to determine its position. Long chats no longer require a full history scan for each appended item.

Kodik upgrades live chat stores in formats 3 through 17 in place. The current default format is 18. Enabling kodik.chat.storage.sparseTurnIndex uses format 19 after a full restart. Older chats can require a one-time preparation that saves its progress in batches. Other chats can continue saving, and reopening resumes interrupted preparation.

Eligible new change details use compact storage with the same logical recovery window. Older receipts are left intact during the upgrade. Freed pages remain reusable; the existing space-reclaim action controls when unused allocation is returned to the filesystem.

Restart recovery reads one live sub-agent at a time and skips deleted-chat candidates in bounded batches. Recovering saved Goals skips unrelated drafts and other saved documents. Unrelated saved chat records are outside that lookup. Creating the recovery index during the first upgrade still depends on the amount of saved data.

During preparation, the chat pane shows its loading spinner and keeps waiting while its storage updates arrive. You can use the sidebar and other chats during this wait. If updates stop, the pane offers Retry; retrying resumes the saved preparation progress.

When a window reloads, the sidebar and selected chat can become available while Kodik restores queued inputs for other chats. Each restored chat waits for its own queue and saved presentation before its composer appears. Edits, removals and sends made while a queue read is pending remain intact; unchanged restored rows follow changes saved by another window.

Recovery of interrupted turns also waits only for the selected chat’s own saved state before accepting a reply. A failure confined to another chat does not block it; a storage-wide failure still prevents new saves until recovery succeeds. If that failure arrives while an edit is waiting to save, Kodik reports it before applying the edit. Retry the action after storage recovers.

A turn left running by a Kodik process that has since exited is marked interrupted when Kodik starts again, even if the storage lock that recorded the exit was lost, for example after a failed startup. The chat then accepts new messages, and restored sub-agent reports and session mail are delivered. A turn whose Kodik process is still running is left untouched.

New message saves take priority over queued background cleanup. Automatic cleanup frees pages incrementally or leaves freed space available for reuse on older storage; it does not rewrite the whole storage file during an idle pass. Validation of a rebuilt chat index runs alongside saved replies. Repeated history pages keep their cache when another chat changes.

Unused-file verification runs in resumable chunks, so messages and attachments can still be saved while cleanup checks a large file. Before deleting it, cleanup rechecks live references and open-read or finalized-upload pins. Cancelling verification leaves the file intact, and shutdown waits for any active file read to finish.

If this build encounters chat storage written by a newer Kodik, the sidebar says This chat storage was written by a newer Kodik. Update Kodik to open it; nothing was changed. The storage stays in place, and no Reset action is offered for that incompatibility. Open it with a compatible newer build. Older releases that predate this safeguard can still set newer storage aside and start an empty history.

An individual chat may require a newer storage feature even when the rest of storage opens. Kodik checks compatibility before writing large save bodies; incompatible chats stay read-only while other compatible chats remain writable.

A fork retains checkpoint notices from its saved prefix even if the original chat later changes that checkpoint.

Other chats can save while Kodik reads a long saved provider history to start or finish a turn. Running turns also avoid repeated processing of the same saved messages. Stored content and the chat’s current state are still checked before that history is used.

An invalid or unreadable storage path is reported as unavailable. Words in a folder name, such as reclaim, do not make a filesystem failure appear to be contention with another writer.

On slower computers, or with a large chat history, Chat keeps its loading spinner until your chats are ready and then opens automatically. A slow open never shows an error or a Retry button. After a crash or quitting while an agent was still working, Chat opens right away and applies the changes the chat index missed in the background. If the index is missing or damaged, or an update changes its format, Chat also opens right away: the chat list and your conversations are read straight from saved history while a new index builds in the background. If you quit Kodik during that build, the next launch continues it instead of starting over. If the background agent process stops and cannot restart automatically, its recovery screen appears immediately with Retry.

When you open a chat that takes more than a second to load, its pane shows the loading spinner instead of staying empty; a chat that opens sooner appears without one. If the chat’s saved history still has not arrived after about 12 seconds, the pane offers Retry.

With Continue interrupted chats enabled, Kodik can resume an eligible interrupted turn when its window opens again. This setting is on by default and uses a five-minute window from the turn’s last recorded activity. If the chat waits for you, reopen it and use Retry when the interruption card offers it, or send a message to continue manually. Check Agents settings for the time limit and cases that require your action. For crash diagnostics, note the time and check the renderer exit reason and code in main.log.

When a chat saves while another chat is storing tool output, the writes take turns on the shared database connection. Chat saves continue as soon as the active transaction finishes.

After a large burst of chat activity, Kodik distinguishes new journal data from disk space retained for reuse, avoiding redundant storage maintenance. Outstanding data and the regular commit-count deadline still trigger checkpoints.

Once saved journal data has been folded and history readers allow a reset, the next write retains at most 16 MiB of journal capacity for reuse. The journal can still grow beyond that size during active writes or while history readers hold older data; the limit does not discard saved data or interrupt readers.

An oversized completed journal also releases unused space automatically after it remains unchanged for at least a minute between maintenance checks. Small journals retain their reusable capacity. Active history readers or a backup can defer cleanup, and external readers do not make it wait for the ordinary writer timeout.

An idle journal restart leaves the journal’s bytes unchanged if a reader still needs them. Maintenance can restart the journal for reuse once that reader finishes. Normal chat saves can continue while this restart is deferred.

Kodik flushes saved state to disk before a tool runs or the agent edits a file, before the first model request in a turn, and when it saves the finished answer. Drafts and titles normally flush about once a second. Normal shutdown waits for pending storage work. If power is lost or the operating system crashes, changes still waiting for a flush can be lost. Reopen the chat to see which progress was saved.

When a model ends a response with thinking but no answer or tool call, Kodik keeps the task active and automatically asks it to continue. Completed reasoning and tool results remain available, including in sub-agent runs. Stop cancels the continuation, and task budgets and permanent failures still apply. A genuinely empty finish after completed tools can end a request that needs no explanation. Explicit output-token limits keep their separate recovery behavior.

If a model repeats the same text, reasoning, or tool calls, Kodik stops the repeating response and can resume with guidance or compact the conversation. The second repeat in a row warns the model that a third will compact the conversation, and the third compacts it. Mistakes are not repeats: invalid tool arguments, a call to a cancelled command, or a check of a terminal that has printed nothing new each get their normal answer and never lead to a compaction. A visible repetition error explains what happened and offers Choose Model when available. You can also rephrase your request.

If an active turn cannot save its progress, or a permanent host or tool runtime failure ends the request, it stops with the error. Kodik preserves the progress already available and waits for your next action instead of sending another model request automatically. After the local problem is resolved, you can retry or send a new message. Recognized transient transport interruptions keep their normal recovery. Worker errors preserve the storage or provider cause, including when a saved answer cannot be read. A finished answer whose final save fails remains available under the saved-answer recovery rules below.

A local failure while declining a disabled or invalid question or delivering a tool result also stops the turn, even after earlier tool work. A refused result keeps the local cause instead of triggering a new model request. If automatic recovery cannot start because storage or the local host fails, the error shows that new cause instead of the original stream interruption.

If a queued write fails while Kodik prepares a tool continuation, the turn stops with that storage cause and keeps queued guidance and unread worker messages for later delivery. A local submission failure after partial output also keeps its cause instead of starting model recovery. If context attached to an approval decision cannot be prepared, the turn shows the error rather than waiting on an approval it has already consumed; no tool runs from that failed decision. Stop or a history change during this preparation prevents late feedback and actions from entering the retired turn.

A local failure while preparing or accepting a held final answer also stops with its original cause and keeps undelivered worker reports available. Stop or a history rewrite prevents late continuation receipts from consuming those reports. Rejecting a tool that is still waiting for its streamed batch respects the same cancellation boundary; no rejected result is delivered after the turn retires.

If the local runtime cannot submit a request, accept a tool batch or save a held answer, chat keeps the storage or provider cause. A known storage failure stays a storage error; a provider rejection keeps the account or model details needed to resolve it. Untyped tool-admission failures retain the existing stopped-turn message, and a late failure cannot replace a completed cancellation.

Tool preparation and approval continuation failures also keep their local cause. If a tool throws a known storage failure or permanent host failure, the turn stops with that error instead of giving it to the model as an ordinary tool result. Ordinary failed tool results keep their existing continuation behavior. A failed streamed-tool hook stops promptly even while an earlier hook is still waiting; late failures cannot replace a stopped turn or its successor.

A local preparation or chat-creation failure also ends the host-owned turn with its original error. Kodik waits for that terminal settlement before releasing the hosted listener, so an old tool wait cannot leave the next message queued behind a failed turn. If the local connection is interrupted, your next message first finishes retiring the failed turn without repeating its model request. The saved error survives Reload Window, and you can send a new message once the local problem is resolved.

Temporary SQLite read failures receive a bounded retry. If the chat index falls behind, Kodik reads a consistent snapshot of the canonical history, preserving paging and fork boundaries. When the storage process restarts during the first history load, the directory retries automatically after reconnection.

On Windows, saving chat content retries brief file-sharing conflicts for about one second. If another process releases the file during that interval, saving continues automatically. Persistent locks and other disk errors still stop the save rather than replacing the existing file with incomplete data.

On Windows, opening stored chat content checks that it is still the same file. A replacement during that check stops the operation, even if its size and bytes match. Retrying against a stable file can succeed without advancing the rejected operation.

Cleanup of consumed staging manifests retries the same brief Windows sharing conflicts. Removing a staging manifest does not remove the canonical blob bytes; a persistent cleanup failure is still reported.

Short diagnostic previews keep only their displayed prefix in memory. This does not truncate saved chat history or exact provider continuation; incomplete diagnostic previews remain unsuitable for replay.

The live recovery ledger keeps the latest conversation snapshot for each unfinished request. Replaced snapshots and snapshots of finished requests are released while lifecycle events remain available. This does not remove messages from saved history.

While the writer is unavailable, published chat history remains readable across a window reload. Sending pauses and the composer keeps its text. Saved unsent text and image or file attachments also reload from the readable chat database, without changing the saved draft. Pending File Review entries and their saved before/after content remain readable too. Changing a review or loading its exact diff requires storage write access. Saved session settings and other details reload when the writer returns; temporary display defaults do not overwrite them.

If the saved chat index is missing or damaged during this read-only period, Kodik reads the conversations directly from the intact chat database. It does not need to reset history or rebuild the index before showing your chats. When the writer becomes available, sending resumes automatically.

On Windows, an older writer lock can refer to a process ID that the operating system has since reused. Kodik retries the process creation-time check and recovers the lock when the current process started after it was created. A live owner or an inconclusive check keeps the lock in place; the age of the lock alone does not authorize recovery. These checks also work when System32 is missing from PATH.

On Linux, Kodik can resume saving as soon as it verifies that the previous writer and all its threads have exited, even while its process ID is still listed by the system.

If Kodik is closed or crashes at the moment it takes over the writer lock from an earlier run, it can leave an unfinished takeover behind. Kodik clears it automatically about two minutes after the crash, once no running process can still be completing it, and saving resumes without a restart. A live writer stays protected throughout.

Chat recovery keeps newly saved restart metadata valid when the system clock moves backward. Kodik preserves the previous writer identities and still blocks another writer while an owner is live or its death is unproven.

Prepared saved history also pages directly from its published copy when the canonical database cannot be opened. It reads the requested cards instead of rebuilding the whole conversation. After storage recovers, a history refresh preserves a newly submitted message and its stable identity, including when submission finishes before that refresh does. The message and reply are saved together. Live answers and thinking text stay in one row each when saved history catches up. A full-history read overlapping submission can be retried once sending finishes.

When a chat history index rebuild continues in the background after startup, Kodik shows its progress in the status bar while you use your chats. The indicator clears when the build ends, and later launches reuse the completed index.

Turning off kodik.chat.storage.maintainProjection stops maintaining the extra read index and message copies. Turning off only kodik.chat.storage.maintainTranscriptMirror skips the extra prepared history index. Both settings default to true; disabling the full projection takes priority. With either option off, read-only recovery requires the original chat database to remain readable and may take longer. Re-enabling and restarting rebuilds the copy once the writer is available; until then recovery uses the original database, rather than a stale copy from before maintenance was disabled.

A new chat whose first message was refused before it was accepted stays out of history and the sidebar, including after a window reload: the message returns to the composer, and sending it again delivers it once in that same chat.

Brief storage-open failures are retried during startup before entering read-only mode. If access is still blocked, Kodik shows no notice: you can keep typing, and Send stays unavailable until access returns. Background recovery starts after one second and backs off to at most one attempt per minute while the problem persists. When access returns, sending becomes available automatically; your draft is not sent without your action. A read-only state alone is not reported as a lost message. The chat list and each chat’s status keep loading from the last saved copy of your history while access is blocked.

If startup fails while an interrupted turn prevents the writer from closing, or SQLite cannot close a connection during startup or a storage upgrade, Kodik automatically restarts the storage process before retrying. Recovery preserves saved chats and the writer’s ownership evidence until the old process exits. This does not require reloading the window.

Database readers also remain tracked until they close successfully. If cleanup fails, Kodik prevents replacement readers from accumulating and requests automatic storage-process recovery. Normal shutdown waits for admitted reads to finish before releasing storage ownership.

Restart recovery discovers interrupted turn owners without loading unrelated saved documents. Longer recovery reads use a separate budget of at most four snapshot readers, leaving normal history reads available. When a journal checkpoint finishes only partially, diagnostic logs show how many frames remain and which chat readers were active. If Kodik cannot identify a reader, the log records the holder as unknown. Kodik retries once the tracked readers finish. Idle maintenance also retries and can release excess disk space after the journal is folded.

When the storage process takes too long to answer a checkpoint request, Kodik reuses the outstanding request for checkpoints of the same kind. Once the reply arrives, the diagnostic log records whether the journal was folded and how long queueing, the disk flush, and the checkpoint took.

Background index builds, backups and exports track completed work. If an owner makes no progress for two minutes, it expires before publication and joins SQLite cleanup before releasing storage. Cancelling a backup stops between copied page batches. Multi-chat Markdown exports publish the complete selected directory together, so expiry while reading a later chat cannot leave a partial selection.

Complete transcript reads can continue while a draft, chat title, or another chat is saved. If messages or restored history change between pages, Kodik restarts the read instead of combining different histories. A conversation that keeps changing can still prevent a complete read from finishing.

Persistent writer-open failures leave a bounded storage-open-failure-*.json diagnostic beside the store, including failures before the database itself opens. It records the failure code and filesystem access evidence without chat content. Existing report throttling and retention limit repeated diagnostics. Storage checks recognize these retained reports: their presence alone does not mark healthy storage as degraded. A live writer’s lock remains protected; automatic retries do not force it open or reset chat history.

Automatic repair prepares and verifies its replacement before moving the damaged database. If the process stops between those steps, the next start resumes the recorded repair; it does not interpret the missing active file as an empty history. Temporary I/O failures during salvage stop that attempt instead of being treated as unreadable records. The damaged original remains available for recovery.

Backup retention protects the verified copy with the most chat history in addition to the three newest copies and the newest copy from an earlier week. It gives the latest compatible copy from before a format upgrade extra protection for up to 30 days. When newer copies are compressed, the latest uncompressed copy gets the same protection for older releases. The same retention applies to a configured secondary destination. Kodik verifies and flushes copies and their directory before pruning older secondary copies. A failed flush preserves them. Restore and reset wait for confirmed storage-process exit before replacing the active root. On Windows, moving the storage folders during a restore retries for about one second while a file inside is briefly in use, for example by antivirus. If the folder stays locked, the restore fails and puts the previous chats back.

Kodik keeps each profile’s chat transcripts, exact provider continuation, drafts, attachments, checkpoints, Goals, plans, worker runs, and Team Board records in one local canonical store. It does not dual-write a second session format or silently fall back to older history.

If the machine stops after SQLite commits data to its write-ahead log but before it folds those pages into the base database, startup verifies the complete composed database and checkpoints that committed state. This is not a migration or a hidden best-effort repair: the composed view must still match the exact SessionStore schema, capabilities, foreign keys, and integrity checks. Otherwise Kodik leaves the files unchanged and refuses to open the store.

In main.log, a completed chat index rebuild, a successful storage format upgrade, and an SQLite journal recovery appear as [info]. SQLite warnings appear as [warning].

The agent host measures event-loop delays with a monotonic clock and resets the measurement when your computer wakes. Heartbeat warnings report slow ping replies and stalls recorded while Kodik is awake.

Opening a large chat loads a bounded newest page first. Older rows load as you scroll, while exact provider continuation stays private to the background host and is read only when execution needs it. Opening a chat reads the saved changes of only the edits on that page, and each step of a turn reads only the chat’s latest saved context, so a long chat costs the same per step as a short one. A chat that no pane shows releases its loaded messages after a few idle minutes, including a chat left open in a background tab; beyond the eight such chats you showed most recently, it releases them right away. Opening it again, or switching to its tab, loads its newest page. A chat with a Goal opens on its newest page as well, and a running Goal continues from there: the background host builds each Goal step’s context from the saved history itself.

Restoring a checkpoint, its Redo, and editing a sent message update the saved history index in place, touching only the messages they hide or bring back, so the chat shows again right away. A fork starts from the messages its source shows and takes over the source’s index when it is created, for chats of up to about 10,000 messages; a longer fork, or a chat deleted for good, prepares the index again in the background only for the chats that changed. Every other chat keeps its index, so these actions cost the same however many chats you have.

On Windows, opening chat storage no longer starts PowerShell to check the disk and the process; the disk check is remembered for each drive. After an unexpected exit, Kodik checks the pages and links of small stores before opening and finishes those checks for larger stores in the background. If a background check finds a problem, the next start runs both checks before opening.

Chat history can finish loading while other chats continue saving updates. Later changes keep appearing in the list without requiring another reload.

If Kodik quits while an answer is still streaming, reopening the chat marks that turn as interrupted and keeps the earlier history. When the chat does not continue by itself, the interrupted turn ends with Interrupted after utility restart. and Retry, which continues from the saved work without repeating completed tool calls. You can also send the next message in the same chat once recovery finishes. If saving a message fails, the composer keeps its text and shows a readable reason with Retry.

Reloading the window restores tool cards from their canonical presentation records rather than reconstructing them from short text previews. Search match groups and paging details, shell commands and output, sub-agent identity and reports, file paths and read ranges, edit summaries, memory details, and browser screenshots therefore remain available after reload. If reload interrupts a running tool, its recovery status is combined with the last rich card snapshot shown before shutdown, so captured shell output is not replaced by a generic canceled card.

Deleting a task also retires any unfinished turn ownership in the same storage commit. On restart, recovery ignores tombstoned tasks, so a deleted task that previously showed Working cannot block requests in new or existing chats.

Newly created forks retain the result of their original request even after deleted history is cleaned up. If delivery of that result is interrupted, retrying the same request does not recreate a deleted chat. Choosing to fork again starts a new request and can create a new chat.

Background cleanup keeps up to 1,000 recent change details within a 2 MiB target. Saved conversations, operation receipts and deleted-chat identities remain. Details needed by an unfinished turn or the chat index are protected even when they exceed that target. A window that falls behind reloads a current snapshot. This can make database pages reusable without immediately shrinking its file; Reclaim Unused Chat Storage Space keeps its existing safety checks. An explicit WAL truncate does not wait for an external SQLite reader: it reports the journal as busy so queued saves can continue. The committed data stays in the journal until a later checkpoint can finish.

After a restart, sending waits for chat recovery to finish. A temporary recovery failure is retried automatically before the send is rejected. If recovery was already saved but its acknowledgment was lost, Kodik resumes from that saved result rather than repeating the interrupted provider request or tool action. Recovery checks only the chats an unexpected exit left an interrupted turn or a reserved message in, and finds the Goals to resume without reading every chat, so it does not take longer the more chats you keep.

New notices that a chat service restart interrupted or canceled an answer use the interface language, including after Reload Window. The model’s answer and saved provider history retain their original text. Older notices saved without a recovery identity keep their original wording.

All connections to a chat share its active turn, so Stop reaches the connection that owns the running request. A long agent run has no limit on the number of messages or tool calls it keeps in its context; only the model’s token window triggers summarizing. If a chat’s saved turn can no longer be read, Kodik repairs it from the chat’s own stored history, or closes that turn as interrupted so the chat accepts new messages. That chat never blocks other chats or new ones, and no reset is needed; only physical database damage can affect the whole store. If preparation fails, Chat retains the actual cause for the error and Retry action.

Chats can continue saving during a backup. If a save briefly keeps a copy step busy, Kodik uses a 2.5-second retry window for consecutive contention. Cancelling the backup still stops it, and persistent storage errors are reported instead of publishing a partial copy.

Backups with many saved attachments and tool results synchronize their changed folders together after copying the objects. Each copied file is still flushed and checked before publication; the backup is published only as a complete directory.

An I/O or disk-full error while saving a backup’s folder entries stops the operation. Kodik reports unavailable storage or a full disk and retains the original diagnostic in the agent-host log. Unsupported directory synchronization keeps its platform fallback. If handle cleanup also fails, the original storage failure remains the reason reported to you.

If an unfinished backup or export cannot be deleted, Kodik keeps its existing cleanup record. Once the copy is over an hour old, a later backup or export in the same parent folder retries removal when the storage allows it. The original operation error remains visible even when cleanup also fails.

Open the Command Palette and run one of these commands:

  • Kodik: Back Up Chat Sessions creates a new self-contained backup directory with the canonical database, a manifest, and every stored content object the database references. The backup is captured at one consistent boundary and every file is verified before publication. An existing destination is never overwritten or merged. If the destination folder is missing or can’t be written, the backup fails with a storage error and Chat keeps working.
  • Kodik: Export Chat Sessions creates a portable JSON file containing readable conversation history. This format is intentionally lossy: it omits provider continuation, attachments, workspace links, checkpoints, and feature-private state, and records the relevant losses in each exported session.
  • Kodik: Restore Chat Sessions From Backup validates the complete selected backup before showing the destructive confirmation. After you confirm, Kodik replaces the live session root and reloads it. A crash or validation failure leaves either the previous complete store or the restored complete store, never a partial mixture. On Windows, switching the saved data into place retries brief file-sharing locks for about one second. A persistent lock stops the operation; Kodik keeps the original data for recovery.

Backups and portable exports contain chat text in plaintext. They are not encrypted or signed, so protect them like any other sensitive local file.

The confirmation shows the verified backup’s creation time. Restore returns chat history to that point. If Kodik reports a running chat, pending tool approval, or another storage operation, stop the turn or wait for the operation to finish, then retry.

After an accepted restore, open conversations refresh in place and continue to sync across windows. Session drafts, including drafts in hidden tabs, return to their state in the backup. Unbound new-chat drafts keep their local content. Kodik stops any pending save or Send preparation tied to the previous store. Start a new edit or send again from the restored history.

When the same Session is open in several windows, an untouched composer follows the saved draft. Sending that draft in one window clears it in the other untouched composers. New unsaved local edits remain available while draft changes are reconciled.

Select the complete backup directory. If verification finds missing files, corruption, or symbolic links, Kodik leaves live storage in place.

This build restores backup formats 3 through 16, 18, and 19. Live format-17 stores upgrade in place. Format-17 backups fail validation in this build. Keep the whole backup directory and use a compatible build in a separate profile.

The Restore command remains available when the current database is too damaged to open. It validates the selected backup independently; canceling leaves the damaged data unchanged. After a successful recovery, Kodik retains the displaced damaged files beside the restored store for manual recovery or inspection. The recovered history refreshes in the open window and remains available after restarting Kodik.

Use a separate profile when returning to an older version. Open a complete profile copy from before the upgrade or restore a backup that the older build supports. Check the session-backups folder in your profile for pre-upgrade copies. Builds with the newer-format safeguard keep incompatible storage in place and ask you to update. Older builds without that safeguard can move the storage aside and show an empty history. Keep the updated profile for chats created after the upgrade.

Preserve your whole profile before an upgrade

Section titled “Preserve your whole profile before an upgrade”

Before upgrading, keep the installer for your current version and make a chat backup using Kodik: Back Up Chat Sessions. Quit every Kodik window and wait for its background processes to stop before copying the complete profile, extensions, global Kodik assets and projects to a private backup. Include unsaved-editor backups and the entire chat database, its journals and referenced content files. A chat JSON export does not replace this full backup. Protect copied credentials and chat contents; a profile copy alone does not copy the operating system’s credential store.

Run Kodik: Reveal Chat Storage Folder to show the current profile’s sessions folder in your file manager. By default, automatic backups live beside it in session-backups.

If you need to return to the previous version, close Kodik and keep a copy of the updated profile and changed projects. Recover the pre-upgrade copy in a separate profile with the exact previous installer. Do not let the previous version open the updated profile or replace it with an old snapshot after creating new work: that snapshot cannot contain your new chats, edits or unsaved buffers. Keep the complete updated profile for repair with a compatible build. Exported readable history can rescue text, but it does not preserve all continuation, attachment and checkpoint state.

When Kodik detects a damaged chat database, the Sessions sidebar shows Chat storage is damaged and a Reset Corrupt Chat Storage button. Other loading failures keep their retry message.

A damaged SQLite header in a nonempty database also enters this recovery flow. Kodik keeps the original files in place; it does not treat an unreadable signature as proof that the history is empty. Restore a validated backup or explicitly reset the damaged storage.

To start fresh, click the reset button and confirm Reset Chat Storage. Cancel leaves the damaged data unchanged. Reset removes existing chats from the active history, preserves the old storage in a separate sessions.corrupt-<operation-id> folder beside sessions, and opens fresh chat storage immediately. You can start a new conversation without reloading the window. The preserved copy is available for manual inspection or recovery; resetting does not repair its contents.

When only part of the database is damaged, Kodik keeps the chats it can still read: on startup it repairs the storage automatically, and the reset confirmation says how many chats will be kept. Only the damaged chats are removed.

If you have a valid backup and want to recover those chats, use Kodik: Restore Chat Sessions From Backup instead.

Reset requires damaged storage. If Kodik detects corruption while it is already running, fully quit and reopen the app before restoring or resetting. Reload Window leaves the storage process running.

Startup also checks committed recovery data before deciding that the base database has a different format. If the main database is missing but a recovery journal remains, Kodik preserves it and refuses to create a new database beside it.

Each chat stores its title, status, last activity, and workspace. The sidebar reads these details page by page. If you close Kodik during a storage upgrade, the next launch starts the upgrade again from the unchanged store.

If a temporary storage failure happens before your message is saved, Retry saves the original message together with the new turn. Both your message and the answer survive reload and restart; an earlier message with the same text is kept separately.

Saved chats become readable while Kodik continues recovering unrelated chats and sub-agents. Sending a message or changing a chat waits for that chat’s recovery; unfinished work and storage errors retain their existing safeguards. Cancelling a waiting action stops that action without abandoning the shared recovery.

When history reads delay journal maintenance, Kodik follows up after those reads and any current write finish. This helps reuse the journal’s allocated space during parallel chats without interrupting saved-history reads.

Kodik checks chat storage after an unclean shutdown, periodically verifies it while idle, and creates automatic backups on version changes or when the backup interval has elapsed. The startup check and backup wait two minutes after a window opens, so they do not compete with loading your chats, and a check that finds only a chat index to rebuild does not take an extra backup. These background checks and backups do not show maintenance, recovery, or backup-failure notifications; diagnostic details stay in the logs. Normal shutdown saves the clean-exit state before settings storage closes.

Automatic backups continue daily while the app remains open and also protect normal development profiles. Windows of the same profile share a daily backup. A failed backup is eligible to retry after five minutes. Background scans retry after five minutes when another archive operation is active. Copies live in session-backups inside the profile’s data directory. Copies share each attachment that has not changed and store the chat database compressed, so an extra copy costs about a seventh of the database’s size. Set kodik.chat.storage.compressBackups to false to keep automatic copies uncompressed; backups you create with Kodik: Back Up Chat Sessions are never compressed. Retention keeps the three newest usable copies and the newest one from an earlier week, and rechecks a copy’s database and attachment bytes when its last check is more than a week old. Unfinished or damaged backups do not count toward those copies and remain available for inspection. When you quit, Kodik can take a backup if history changed and the database and journal together are at most 32 MiB. Quit gives that backup up to 2.5 seconds, then cancels unfinished archive work and waits for cleanup within the store shutdown budget.

Manual maintenance and recovery remain available from the Command Palette:

  • Kodik: Show Chat Storage Usage reports database/WAL allocation, reusable pages, pending WAL data, available disk space, saved chats, retained deleted-chat records, operation receipts and local backup files. Shared hardlinked files are counted once in unique totals; bounded or unavailable measurements are marked.

  • Kodik: Reclaim Unused Chat Storage Space explicitly reclaims eligible unused database space. It keeps saved history, receipts, forks and backups, refuses while a chat or conflicting storage operation is active, and needs temporary free space in the profile and usable temporary folders. Saving pauses during a rewrite; once started, the native work finishes before ownership is released. A lost completion is not automatically repeated.

  • Kodik: Check Chat Session Storage runs a bounded quick integrity scan.

  • Kodik: Verify Chat Session Storage (Full) also re-reads and verifies stored content.

  • Kodik: Rebuild Chat Session Index rebuilds disposable views without changing canonical messages. Brief Windows file-sharing locks are handled automatically; a failure or cancellation before publication keeps the existing readable index.

  • Kodik: Clean Up Expired Chat Uploads removes abandoned staging data.

  • Kodik: Collect Unused Chat Content removes content only after it has remained provably unreferenced for the required grace period. Kodik also removes unused attachment files on its own, a day after they were added at the earliest.

  • Kodik: Purge Deleted Chat Sessions permanently removes the contents of sessions you already deleted, in bounded restart-safe batches. Kodik also does this on its own about a minute after you delete a chat; the command does it right away. Cleanup yields between bounded batches so waiting message saves can run. Large attachment-reference lists and blocked stream prefixes resume from persisted progress after restart. A record stays in place while another record depends on it, and its saved payload remains intact until its references can be removed safely.

Chat storage returns free pages incrementally where the file supports it and keeps other freed space for reuse. Detailed change rows are retained only for recent changes; every change receipt remains. Removing old change details pauses between bounded batches so waiting message saves can run. Automatic idle cleanup does not rewrite the whole file, including files created by older Kodik versions.

New saves use smaller operation receipts where the representation saves enough space. Background maintenance gradually packs eligible older receipts in bounded batches, keeping their original results and retry identities. Receipts containing fields introduced by another build stay unchanged. Packing frees space inside the database for reuse; it does not necessarily reduce the file size. Kodik: Reclaim Unused Chat Storage Space follows the same eligibility and free-space checks as before.

If Kodik refuses the store or a backup, preserve the named evidence and fix the exact problem it reports. Restore permissions, stop the process holding the profile lock, move the profile to a supported local filesystem, or choose a valid backup/source. Do not manually replace the database, delete refused evidence, redirect one identity through a symlink or network share, or copy files into the live store.

Session recovery is different from a conversation checkpoint: checkpoints rewind one task and its workspace edits, while backup and restore protect the complete local canonical session store.

Run Kodik: Recover Legacy JSON Chat Sessions in the Command Palette after upgrading from a version such as 2.1.1. The command reads the old JSON chat records in this installation’s application storage and adds them to SQLite. It reports recovered chats, chats already present, and records it could not recover. You can run it again safely: existing chat IDs are skipped, and the original JSON is retained.

Recovery preserves readable messages, reasoning, titles, model choices, and workspace labels. Historical tool activity is recovered as read-only text. Provider replay, active requests, attachment bytes, plans, memory, and workspace checkpoints are not migrated; a follow-up starts fresh model context. The separate session-engine.json and .json.d execution logs are not used as a substitute for the visible chat records.

Recovery adapts old metadata before validating the complete transcript. Non-UUID IDs receive stable IDs, so repeated recovery remains safe. Empty or invalid titles use the first user message or “Recovered chat”; long titles are shortened without changing message text. Invalid timestamps use a fallback, unknown modes (including act and agent) recover as Code, and invalid optional model or reasoning metadata uses defaults. Auto and retired model IDs do not need to appear in the current catalog. Unsupported workspace paths are detached from the recovered chat; the original metadata remains in the source JSON.

If a current split row is damaged, or the current index references a missing row, recovery checks that exact row in state.vscdb.backup. A newly recovered backup includes a note in your interface language that recent messages may be missing; the note stays translated after reopening or reloading the chat. Existing unmarked notes and matching model text keep their original wording. Healthy current rows take precedence, and chats found only in the backup are not imported. Missing indexed chats without a usable backup are included in the failure count. An empty current index does not restore the retained older snapshot.

Recovery has no fixed cap on source-row size, total transcript size, or message count. Large conversations are processed in small batches inside one transaction, and oversized messages are preserved as consecutive text parts without losing their content. Available memory and disk space still matter. Unreadable transcripts and conflicting identities are skipped as a whole. Cancelling or failing an import rolls back the entire current chat; completed imports stay available. A destination storage or filesystem failure stops recovery instead of attempting more writes. Both the original JSON and the backup remain unchanged.

If you see SessionStore archive request is invalid, fully quit and reopen Kodik before retrying. Reload Window updates the window but leaves the main process running. The command now checks that both background processes support recovery before importing and reports a full-restart instruction when they do not.

kodik.chat.storage.archiveLegacyData defaults to false. Enable it in user settings, then run Kodik: Archive Legacy Chat Storage. The native confirmation shows the amount to move and warns that older Kodik versions will no longer see those records. Nothing is archived automatically at startup. Cancelling leaves the originals in place.

Kodik writes and verifies a local archive before releasing retired chat keys from application storage and compacting the settings database. Current chats, unrelated settings, and legacy fields still needed for settings or provider-key migration are kept. The complete original values remain in the archive, including old data that the chat importer cannot interpret. Temporary free disk space is required; a failed attempt leaves the originals in application storage or their verified archive. Restart and retry after correcting the problem.

Archives live under User/globalStorage/kodik.chat-native/legacy-storage in this installation’s user-data directory, with a separate folder for each snapshot. Keep those folders and their state.vscdb files. Repeating the command after completion does not create another copy. A failure during compaction can be retried without copying again.

Recover Legacy JSON Chat Sessions can read supported chats from these archives even after you turn the setting off. If live legacy chat records remain, they take precedence, including an explicitly empty index. Otherwise the command offers the latest verified archive or a native picker for another snapshot. If the latest snapshot or its pointer is missing or damaged, only explicit selection is offered; Kodik verifies the selected archive before importing. Current chats remain intact, and existing chat IDs are skipped. The recovery limitations above still apply.

This message could not be displayed means Kodik could not show one transcript row. This message does not itself stop the agent. If the agent ends its turn with an error, its cause and available action appear separately.

Errors retain their meaning after Reload Window and a full app restart. Error rows show the message and an available Retry action without extra navigation buttons or diagnostic labels. Provider request IDs remain in the saved error data. Reopening a historical error does not itself retry the request. Tool failures and detail-loading failures stay inside the tool disclosure; retrying a detail load does not execute the tool again. When saving a message fails because of chat storage, the failure card and the composer show recovery copy for the actual cause, such as a busy disk or a chat in an unexpected state, never the internal message text. If a chat’s goal, plan, memory or usage details cannot be read for a moment, the transcript still opens and the details fill in on the next load.

If the saved record of a turn ends while the agent is still working, for example because chat storage could not save a step, the agent stops at once and the error shows that cause. It does not keep sending requests to the model or report a lost tool batch instead.

The same cause is shown when storage fails after the model has already answered, while a tool’s result or your answer to a question is being saved, or for longer than the turn’s final save can wait, for example because the disk is full. The turn ends with that error instead of appearing to run until Kodik restarts, and the chat accepts new messages again as soon as storage recovers. This also applies when storage stops responding instead of failing.

A finished answer is never replaced by that error, and Kodik does not ask the model for it again. If the answer was saved but its token usage and Goal progress were not, a note under the answer says so. If the answer could only be saved together with the error, the error appears below it. If nothing could be saved, the answer stays in the chat above the error, and Open saved answer opens a copy Kodik wrote to the sessions/unsaved-answers folder of its data directory; the answer returns to the chat when storage recovers or Kodik restarts. A tool whose result could not be saved keeps the output it returned, marked unverified, and a sub-agent whose answer could not be saved still reports it to the main agent.

A turn waits while chat storage is busy writing, for example while it clears a deleted chat. A turn that makes no progress while storage is idle, or that waits on storage for more than ten minutes, ends with The turn stopped making progress and was ended. A turn that cannot start in time reports that chat storage is busy; send the message again. Where the turn stalled is written to the agent host log, not to the chat.

A failure to reach the model is not saved as an error at all while it can still be waited out. A connection failure, a timeout, a dropped stream, an unavailable or overloaded provider and a rate limit are retried for as long as they last, whether they happen before the reply starts or in the middle of it, with the wait between attempts growing to thirty seconds. Press Stop to end it. A refusal the provider meant — expired credentials, no access, an unknown model, a request it will reject identically every time — stops on a Retry action instead, because repeating it cannot change the answer.

Large compressible compaction requests can be stored in a smaller lossless representation. The dedicated summary route saves its actual normalized request. Exact original request bytes are restored for recovery; clients that understand the store format but not that representation keep affected chats read-only. Summarization reduces model context, while retained history and recovery metadata can still occupy disk space.

When summarization saves a new copy of a retained message or tool record in provider history, the copy keeps the source timestamp. Newly generated summaries and notes are dated when the compaction is saved.