Skip to content

perf(history-store): saveStore uses JSON.stringify with 2-space indent, bloating file size by 30–50% #77

@github-actions

Description

@github-actions

Problem

apps/desktop/src/main/agent-history/store.ts L78

export function saveStore(store: HistoryStore): void {
  writeFileSync(INDEX_TMP, JSON.stringify(store, null, 2), 'utf8'); // pretty-print
  ...
}

After every history refresh, the entire history index is serialized with 2-space indentation and written to disk. For hundreds of history entries, pretty-printing inflates file size by 30–50%, increases write time (more bytes), and holds a larger string in memory.

Suggested fix

Use JSON.stringify(store) (no indentation). The history index is machine-read; human readability is not a requirement. Any null, 2 occurrences in settings-store.ts writes should be fixed the same way.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions