Skip to content
Skills Library
Programming · Automation

restore-context

/restore-context

Restore what is already known about this repo and task from ~/.knowledge/<repo>/ (architecture notes, decisions, task history) before exploring code, and verify each note against git so stale knowledge is never trusted. Use at the start of work in a repo that has ~/.knowledge/<repo>/, when a session-start reminder or a brief says so, or when the user asks to restore context. Optional argument - task ID.

Licence
MIT
Last repository change
05.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: kb.py

What it does and when to use it

Restore what is already known about this repo and task from ~/.knowledge/<repo>/ (architecture notes, decisions, task history) before exploring code, and verify each note against git so stale knowledge is never trusted. Use at the start of work in a repo that has ~/.knowledge/<repo>/, when a session-start reminder or a brief says so, or when the user asks to restore context. Optional argument - task ID.

Original author description

Restore what is already known about this repo and task from ~/.knowledge/<repo>/ (architecture notes, decisions, task history) before exploring code, and verify each note against git so stale knowledge is never trusted. Use at the start of work in a repo that has ~/.knowledge/<repo>/, when a session-start reminder or a brief says so, or when the user asks to restore context. Optional argument - task ID.

How it works

  1. Steps
Original SKILL.md headings · 45 lines, 426 words
SKILL.md preview
---
name: restore-context
description: Restore what is already known about this repo and task from ~/.knowledge/<repo>/ (architecture notes, decisions, task history) before exploring code, and verify each note against git so stale knowledge is never trusted. Use at the start of work in a repo that has ~/.knowledge/<repo>/, when a session-start reminder or a brief says so, or when the user asks to restore context. Optional argument - task ID.
---

# Restore context

Goal: do not re-explore what is already known. Read the notes, trust each one exactly as far as git confirms it, and explore code only where knowledge is missing or stale.

## Steps

1. **Locate the knowledge base.**
   ```bash
   repo=$(basename "$(git rev-parse --show-toplevel)"); K=~/.knowledge/$repo
   ```
   If `$K` does not exist, say "no saved knowledge for this repo" and stop. Work as usual; the `save-context` skill will create it at the end.

2. **Read `$K/index.md`.** Its first line `base: <ref>` is the branch notes are verified against (for example `origin/main`).

3. **Task.** Task ID = the argument, otherwise the current branch name if it looks like a ticket (`[A-Z]+-\d+`). If `$K/tasks/<ID>.md` exists, read it fully: brief, implementation, earlier revisions. Then look at the work already done: `git diff <base>...HEAD --stat` and `git status --short`. Read the diff of a specific file only when the current change needs it.

4. **Find relevant notes.** Semantic search (needs `uv`; `kb.py` sits in the same directory as this SKILL.md):
   ```bash
   uv run --script "<directory of this SKILL.md>/kb.py" search "<the task in your own words>" -k 8
   ```
   Add `--all` when the task touches a neighbouring repo/service. The first run downloads the embedding model (~2 GB) and may take a few minutes; later runs take about a second.
   If `uv` is missing or the search fails, fall back to `rg -il '<keyword>|<keyword>' "$K"`.
   Merge the results with whatever in `index.md` obviously relates to the task. Keep only what is relevant. e5 scores are high for everything (0.75+), so judge by the gap from the rest and by the heading, not by the absolute number.

5. **Verify freshness** of every selected `architecture/*` and `decisions/*` note (front matter `paths`, `verified_at`):
   ```bash
   git log --oneline <verified_at>..<base> -- <paths...>
   ```
   - Empty: trust the note; do not read code under those paths just to understand it.
   - Commits listed: read `git diff <verified_at>..<base> -- <paths...>`, fix the note to match, set `verified_at: $(git rev-parse <base>)`.
   - Unknown sha (`git cat-file -e <sha>` fails): `git fetch`; if still unknown, re-check the note against the code and update the sha.

6. **Commit note fixes**, if any:
   ```bash
   git -C ~/.knowledge add -A && git -C ~/.knowledge commit -qm "<repo>: refresh <notes>"
   ```

7. **Summarize for yourself** (short, not a retelling):
   - what is known and verified (with note paths);
   - what was corrected;
   - **what is not covered**: explore those areas normally and remember what you learn, so `save-context` can store it at the end.

Never echo secrets if they ended up in a note.
Files in this package (2)
  • SKILL.md 3 KB
  • kb.py 5 KB

Versions

The database has no other skills named restore-context.

Database snapshot: 13.11.2026 · package version b412d6250886 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 96code-refactoring-context-restore
    Use when working with code refactoring context restore
  • 96context-management-context-restore
    Use when working with context management context restore
  • 96context-management-context-restore
    Use when working with context management context restore
  • 100project-knowledge
    Generate project knowledge for any git repo: code graph, knowledge graph, code wiki, and AI-written domain docs under .ai/. Use when onboarding to a repo, asked to document a codebase, or to refresh stale .ai/ knowledge.
  • 90start-work
    Use when someone wants to work on something in claude-session-restore ("let's do #12", "pick up the restore bug", "make it work on macOS", "fix Y"), before any code or docs change. Finds or creates the issue, reads the code and the APIs it touches, decides whether it needs a…
  • 86restore-point
    Save, list or restore a working-tree snapshot on a private local git ref without touching the index, branch or HEAD. Run only when the user asks.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.