shadow-frog-update
Skill28 starsChanged 2 months agoMITView on GitHub
Update the shadow knowledge base after code changes and from conversational insights. Detects what changed via git diff, refreshes per-file shadows, captures knowledge shared by the user during the session, and updates cross-cutting discoveries. Invoke manually with /shadow-frog-update; the preToolUse hook will remind the agent when the shadow is behind HEAD.
In this repository7 other files it gives its agents.
- claude.mdCLAUDE.md
- shadow-frog-dreamSkill
- shadow-frog-initSkill
- shadow-frog-meditateSkill
- shadow-frog-napSkill
- shadow-frogSkill
- shadow-frog-viewerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 7 are distinctive, and 19 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Only mark source: user discoveries stale if the symbol is completely removed.
- Distinctive: line 60
When the user shares knowledge during the session, write it immediately.
- Distinctive: line 61
Do not batch for later.
- Very specific: line 94
If the knowledge is a project-wide preference or convention with no code references (e.g., "always use snake_case", "no backward …
- Very specific: line 97
If explicit references found → look up those file::symbol paths in _index.md and the corresponding shadow files.
- Distinctive: line 99
If no explicit references → use context:
- Very specific: line 102
Search shadow files: grep -rl "<keyword>" .shadow/ --include="*.md"
- Very specific: line 103
If multiple candidate locations → pick the most specific symbol that the knowledge applies to.
- Very specific: line 105
If the knowledge spans 3+ files → create a _cross/<slug>.md entry and add back-pointers to each involved file's ## Cross-References.
- Very specific: line 108
If no matching location exists (e.g., the user mentions a concept not yet in the shadow) → place at the file-level ## File-Level section of …
- Distinctive: line 112
Never ask the user "where should I put this?" — always resolve placement yourself.
- Very specific: line 125
Check .shadow/.shadowignore — skip if the file matches an ignore pattern
- Very specific: line 126
Create .shadow/<path>/<file>.md with symbol-organized template
- Very specific: line 131
Add ORPHANED marker to shadow header
- Distinctive: line 132
Keep shadow (discoveries explain history)
- Very specific: line 138
Update all _cross/ Refs: entries (old path → new path)
- Very specific: line 139
Update all Also involves: in other per-file shadows
- Very specific: line 145
Follow the dedup and writing rules in /shadow-frog — read before write, merge or update existing entries, fix bad format in place.
- Very specific: line 155
Check the five core invariants (full 7-invariant set in /shadow-frog):
- Very specific: line 156
Every _cross/<slug>.md ref has a back-pointer in per-file ## Cross-References
- Very specific: line 157
Every ## Cross-References entry has a corresponding _cross/<slug>.md
- Distinctive: line 158
No duplicate cross-cutting filenames
- Distinctive: line 160
No duplicate discoveries (same behavioral claim at same symbol)
- Very specific: line 190
Start new claims/preferences with citation_score: 0.
- Very specific: line 197
If 3+ files involved → create in _cross/<slug>.md instead, add back-pointers
- Very specific: line 198
If project-wide preference with no file reference → write to _prefs.md
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ShadowFrog Update
Updates .shadow/ from two sources: code changes (git diff) and conversational
knowledge (what the user said during the session). Prerequisite: .shadow/ exists.
Triggers
- Hook reminder:
preToolUseinjects a staleness warning when.shadow/_meta/state.json#last_commitdiffers from HEAD. The hook only reminds — it does NOT auto-run update. - Manual: user invokes
/shadow-frog-update
Phase 1: Detect Changes
# Read last_commit defensively: it may be missing, or the literal "none"
# when init ran without git (e.g. inside a container). `git diff none HEAD`
# would abort with "fatal: bad revision 'none'", and a missing key would
# make $LAST_COMMIT empty so `git diff HEAD` silently reports the wrong set.
LAST_COMMIT=$(python3 -c "import json,sys; print(json.load(sys.stdin).get('last_commit','none'))" < .shadow/_meta/state.json 2>/dev/null || echo "none")
if git rev-parse --verify "$LAST_COMMIT" >/dev/null 2>&1; then
git diff --name-only "$LAST_COMMIT" HEAD # committed changes since last update
else
echo "WARNING: state.json has no usable last_commit — falling back to a full re-scan."
fi
git diff --name-only HEAD # uncommitted changes
git diff --name-only --cached # staged changesCategorize: modified, added, deleted, renamed.
Phase 2: Update Per-File Shadows (Symbol-Level)
For each changed file, update its shadow at the symbol level:
| Symbol change | Action |
| Added | Add the appropriate ##/### heading |
| Removed | Mark the section REMOVED; keep discoveries for history |
| Renamed | Move discoveries to the updated heading |
| Modified | Check whether discoveries still hold |
Only mark source: user discoveries stale if the symbol is completely removed.
Lightweight update (auto/hook): re-extract symbols, update headings, flag stale. Deep update (manual/dream): read diffs, generate new discoveries, verify existing ones.
Phase 3: Capture Conversational Knowledge
When the user shares knowledge during the session, write it immediately. Do not batch for later.
Capture warnings, gotchas, design intent, history, deprecations, contracts, and conventions. Representative examples:
| Signal | Example | Category |
| Warning | "Don't change the retry logic, it's subtle" | warning |
| Design intent | "We use this pattern because the API is unreliable" | intent |
| Convention | "Always use the helper in utils.py, not raw SQL" | convention |
Write as:
- <user's words, as close to verbatim as possible>
_(verified, source: user, citation_score: 0)_For knowledge emerging from collaborative work (debugging, refactoring, test failures):
- <what was discovered and how>
_(verified, source: interaction, citation_score: 0)_Anchor to the specific file::symbol. source: user and source: interaction
are always verified.
Auto-Placement
Users will not specify where to store their knowledge. You must find the correct location. Procedure:
- Parse the user's statement for code references — file names, function names, class names, module names, variable names, error messages, CLI flags.
- If the knowledge is a project-wide preference or convention with no code
references (e.g., "always use snake_case", "no backward compatibility",
"prefer small PRs") → write to
_prefs.md. - If explicit references found → look up those
file::symbolpaths in_index.mdand the corresponding shadow files. - If no explicit references → use context:
- What file is the user currently viewing or editing?
- What files were recently modified in this session?
- Search shadow files:
grep -rl "<keyword>" .shadow/ --include="*.md"
- If multiple candidate locations → pick the most specific symbol that the
knowledge applies to. Prefer a single
file::symbolover file-level. - If the knowledge spans 3+ files → create a
_cross/<slug>.mdentry and add back-pointers to each involved file's## Cross-References. For 2-file discoveries, use per-file entries withAlso involves:instead. - If no matching location exists (e.g., the user mentions a concept not yet in
the shadow) → place at the file-level
## File-Levelsection of the most relevant file, or create a new_cross/entry for repo-wide knowledge.
Never ask the user "where should I put this?" — always resolve placement yourself.
Phase 4: Extract Session Insights
At session end or manual trigger, review the session for:
- Files modified and why
- Patterns revealed by the changes
- Unrecorded conversational knowledge (user statements not yet shadowed)
- Cross-cutting discoveries (create in
_cross/<slug>.mdif 3+ files involved)
Phase 5: Handle Structural Changes
Added files:
- Check
.shadow/.shadowignore— skip if the file matches an ignore pattern - Create
.shadow/<path>/<file>.mdwith symbol-organized template - Add
## Cross-Referencessection - Add to
_index.md
Deleted files:
- Add
ORPHANEDmarker to shadow header - Keep shadow (discoveries explain history)
- Mark
[REMOVED]on any_cross/refs pointing to this file - Update
_index.md
Renamed files:
- Move
.shadow/<old>.mdto.shadow/<new>.md - Update all
_cross/**Refs**:entries (old path → new path) - Update all
Also involves:in other per-file shadows - Update
_index.md - Preserve all discoveries
Phase 6: Verify and Dedup
Follow the dedup and writing rules in /shadow-frog — read before
write, merge or update existing entries, fix bad format in place.
Verify exploration discoveries using the observe-based or do-based
methods in /shadow-frog § Verification. source: user and
source: interaction → always verified; only re-verify if the
underlying code changes.
Phase 7: Verify Reference Integrity
Check the five core invariants (full 7-invariant set in /shadow-frog):
- Every
_cross/<slug>.mdref has a back-pointer in per-file## Cross-References - Every
## Cross-Referencesentry has a corresponding_cross/<slug>.md - No duplicate cross-cutting filenames
- All
Also involves:usefile::symbolnotation - No duplicate discoveries (same behavioral claim at same symbol)
Repair any violations before proceeding.
Phase 8: Update Metadata
Preserve dream_cycles_completed from the existing state — only dream-reconcile.py increments it.
{
"version": 1,
"initialized_at": "<preserved>",
"last_update_at": "<now ISO>",
"last_commit": "<full 40-char HEAD SHA>",
"last_update_type": "init|auto|manual|dream|meditate",
"total_files": N,
"total_symbols": N,
"total_discoveries": N,
"dream_cycles_completed": <preserved>
}Refresh _index.md with current counts.
Discovery Writing Rules
See /shadow-frog § Discovery Format for the verbatim per-file,
cross-cutting, and preference formats. Rules to keep in mind during
update sessions:
- Start new claims/preferences with
citation_score: 0; preserve the score when updating the same knowledge. Citation-only edits do not add discoveries. - Record deliberately consulted existing entries once per task using the core
shadow-cite.pyhelper, not a retrieval requirement or a second hidden store. - Be behavioral: "silently returns None on expired tokens" not "handles token expiration"
source: userandsource: interaction→ alwaysverified, use user's own wordssource: exploration→ markuncertainunless verified by code reading or tests- If 3+ files involved → create in
_cross/<slug>.mdinstead, add back-pointers - If project-wide preference with no file reference → write to
_prefs.md - Slug naming: kebab-case derived from title (e.g., "Token expiry config split" →
token-expiry-config-split.md)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

