diff --git a/README.md b/README.md index 54edb0a..0bb7dbf 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ When working with AI assistants on your Obsidian vault, you constantly re-explai - **Prompt templates** with placeholders and conditionals for reusable workflows - **Additional context sources** from freetext, external files, or shell commands - **Frontmatter presets** to configure context per-note via `ai-context` YAML +- **Context diff** to copy only new and modified files since the last export - **Context snapshots** for saving and replaying context recipes - **Granular section selection** to include only the headings you need - **Context history** with diff, search, and one-click restore diff --git a/docs/getting-started.md b/docs/getting-started.md index c736e7a..028034e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -77,6 +77,7 @@ The context is now in your clipboard. Paste it into Claude, ChatGPT, or any AI a | **Copy context (select sections)** | Choose specific headings | | **Copy context from frontmatter preset** | Use note's ai-context config | | **Copy smart context** | Auto-detect related notes via links, tags, and properties | +| **Copy context diff** | Copy only files changed since last export | | **Export context (multi-target)** | One-click export using the active export profile | | **Generate context files** | Open the generator | | **View context history** | Browse past contexts | diff --git a/docs/history.md b/docs/history.md index 451ca18..85216fe 100644 --- a/docs/history.md +++ b/docs/history.md @@ -29,6 +29,40 @@ 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.