flameiq.storage — Local Storage

FlameIQ local baseline storage.

All storage is file-based. Zero external services required.

Layout:

.flameiq/
└── baselines/
    ├── current.json   ← active baseline (pretty-printed JSON)
    └── history.jsonl  ← append-only run log (one JSON object per line)

Default root: .flameiq/ in the current working directory. Override via BaselineStore(root=Path("/custom/path")).

class flameiq.storage.baseline_store.BaselineStore(root=None)[source]

Bases: object

Manages local baseline and run-history storage.

Parameters:

root (Path | None) – The .flameiq root directory. Defaults to Path(".flameiq") relative to cwd.

Example:

store = BaselineStore()
store.save_baseline(snapshot)
baseline = store.load_baseline()
history  = store.load_history()

Initialize the store with the given root path.

__init__(root=None)[source]

Initialize the store with the given root path.

Parameters:

root (Path | None)

Return type:

None

property baseline_path: Path

Path to the current.json baseline file.

property history_path: Path

Path to the history.jsonl append-only log.

has_baseline()[source]

Return True if a baseline snapshot file exists.

Return type:

bool

load_baseline()[source]

Load the current baseline snapshot from disk.

Returns:

The stored PerformanceSnapshot.

Raises:
Return type:

PerformanceSnapshot

save_baseline(snapshot)[source]

Save snapshot as the current baseline and append to history.

Parameters:

snapshot (PerformanceSnapshot) – The snapshot to persist.

Raises:

StorageError – On write failure.

Return type:

None

load_history()[source]

Load all historical snapshots from the JSONL log.

Returns:

List of snapshots, oldest first. Empty list if no history file exists.

Return type:

list[PerformanceSnapshot]

clear()[source]

Delete all stored baselines and history.

Warning

Destructive — this cannot be undone.

Raises:

StorageError – On deletion failure.

Return type:

None