obsidian-promptfire/docs/history.md
2026-02-11 14:44:21 +01:00

78 lines
2.6 KiB
Markdown

# Context History & Snapshots
## History
Track every context you generate over time.
### Features
- **Automatic saving** - Every generated context is saved with a timestamp
- **Search and filter** - Find past contexts quickly
- **Diff comparison** - Compare versions to see what changed
- **One-click restore** - Copy any past context back to clipboard
- **Configurable retention** - Control storage limits and auto-cleanup
### Settings
| Setting | Description | Default |
|---------|-------------|---------|
| **Enabled** | Save generated contexts | On |
| **Storage folder** | Where to store history | `.context-history` |
| **Max entries** | Limit stored entries | 50 |
| **Auto-cleanup** | Delete after X days | 30 |
### Usage
```
Ctrl+P > "Promptfire: View context history"
```
Browse, search, compare, and restore any previous context.
## Context Diff
In iterative LLM workflows you don't want to paste the full vault context every time — only the files that changed. The context diff command compares per-file content hashes against the most recent export and copies only the delta.
### Usage
```
Ctrl+P > "Promptfire: Copy context diff (changes since last export)"
```
### How It Works
1. Every normal export stores a content hash per file in the history entry
2. The diff command finds the most recent history entry with hashes (the "baseline")
3. Current files are hashed and compared against the baseline
4. Only new and modified files are copied, tagged with `[NEW]` or `[MODIFIED]` in the file header
5. The diff entry stores all current hashes, so it becomes the next baseline — enabling chained iterative diffs
Sources (freetext, file, shell) are always included fully since they're external.
### Requirements
- History must be enabled (Settings > History > Enabled)
- At least one prior export with file hashes must exist (any normal copy after the update)
### Edge Cases
| Scenario | Behavior |
|----------|----------|
| No baseline exists | Notice: "Run a normal context copy first" |
| No changes detected | Notice: "No changes since last export" |
| File renamed | Shows as new file + removed file |
| File deleted | Listed in removed count in the notice |
## Snapshots
Snapshots save a context "recipe" — the exact combination of notes, settings, and template — so you can replay it later.
### Usage
```
Ctrl+P > "Promptfire: View context snapshots"
```
Browse, replay, or delete saved snapshots. Replaying a snapshot re-reads the files with current content and re-applies the template, giving you a fresh context from the same recipe.
Snapshots are managed in **Settings > History > Snapshots**.