Skip to content

The meta-skill that builds and improves all your skills, including itself. Watches your work sessions (autonomous or human-led), captures patterns, corrections and judgement calls, and turns them into skill improvements and new skill candidates for your review. Practical application of the Augmented Expertise methodology. Open source: CC BY 4.0.

Gate: fail on version-control metadata in a staged skill

Eoghan Henn4e9f63371759
diff --git a/references/skill-authoring.md b/references/skill-authoring.md
index 415b802..7d81a6c 100644
--- a/references/skill-authoring.md
+++ b/references/skill-authoring.md
@@ -879,7 +879,9 @@ re-check exists, do not record the value — record how to obtain it.
at delivery; run the gate as the last step before presenting.)
Packaging hygiene: before zipping, sweep the staged tree for build
artefacts (`__pycache__/`, `*.pyc`, `.DS_Store`, `.~lock.*`) left by
- in-session checks, and read the archive listing back after zipping —
+ in-session checks and version-control directories (`.git/`, `.hg/`,
+ `.svn/`) a seed from a clone carries in, and read the archive listing
+ back after zipping —
the listing catches two defect classes, leaked artefacts AND wrong
path separators, and it gets read only for the one you name, so check
for both explicitly.
diff --git a/references/weekly-review.md b/references/weekly-review.md
index fe0ba06..5261d9a 100644
--- a/references/weekly-review.md
+++ b/references/weekly-review.md
@@ -1203,10 +1203,11 @@ live="<absolute path to the live skill directory, no trailing slash>"
live=$(cd "$live" && pwd -P) || exit 1 # a symlinked skills entry: find descends nothing, cp -R copies the link
s="[workspace folder]/skill-updates/[today]/[skill-name]"
[ -e "$s" ] && { echo "anchor exists — apply the same-day rule (Delivery) before seeding"; exit 1; }
-find "$live" -type d | while IFS= read -r d; do mkdir -p "$s/${d#$live}"; done
-find "$live" -type f | while IFS= read -r f; do cp "$f" "$s/${f#$live}"; done
+# live may be a clone; the staged copy never carries its VCS metadata
+find "$live" \( -name .git -o -name .hg -o -name .svn \) -prune -o -type d -print | while IFS= read -r d; do mkdir -p "$s/${d#$live}"; done
+find "$live" \( -name .git -o -name .hg -o -name .svn \) -prune -o -type f -print | while IFS= read -r f; do cp "$f" "$s/${f#$live}"; done
chmod -R u+w "$s"
-diff -rq "$live" "$s" # must be identical before any edit
+diff -rq -x .git -x .hg -x .svn "$live" "$s" # must be identical before any edit
[ ! -L "$s" ] && [ "$(stat -c %i "$live/SKILL.md" 2>/dev/null || stat -f %i "$live/SKILL.md")" != "$(stat -c %i "$s/SKILL.md" 2>/dev/null || stat -f %i "$s/SKILL.md")" ] || { echo "staged path is live under another name — not a copy"; exit 1; }
# then make EVERY edit against the staged path
```
@@ -1715,7 +1716,8 @@ but the bypass was the wrong response to it). Where the bundle ships a public ex
confidentiality scan over that extract here too: it is the one file in
the bundle whose content is copied from a private source, so the
authoring-time sweeps never see it. Sweep build artefacts (`__pycache__/`, `*.pyc`, `.DS_Store`,
-`.~lock.*`) before zipping and read the archive listing back after, for
+`.~lock.*`) and version-control directories (`.git/`, `.hg/`, `.svn/`)
+before zipping and read the archive listing back after, for
leaked artefacts and for path separators. **Packing is the LAST write to
a staged skill.** The bundle is the deliverable, so an edit to the
directory after packing leaves two versions: the bundle the user
diff --git a/scripts/validate-skill-bundle.py b/scripts/validate-skill-bundle.py
index d6dc3ab..471a6b7 100644
--- a/scripts/validate-skill-bundle.py
+++ b/scripts/validate-skill-bundle.py
@@ -98,6 +98,10 @@ PATH_RE = re.compile(r"`((?:references|scripts|assets)/[^`\s*?]+\.[A-Za-z0-9]+)`
CMD_PATH_RE = re.compile(r"(?:references|scripts|assets)/[^\s`'\"*?<>;|&]+\.[A-Za-z0-9]+")
CMD_INTERP = {"python3", "python", "bash", "sh", "zsh", "node", "swift", "ruby", "perl", "run", "source"}
BUILD_JUNK = {"__pycache__", ".DS_Store"}
+# Version-control metadata: a live skill can be a clone, a staged copy must
+# not be. The other checks ask what is MISSING; this one asks what is there
+# that should not be (a clone packed its whole history and passed).
+VCS_DIRS = {".git", ".hg", ".svn"}
# Edit residue: strings that only ever enter a file through a failed
# replacement, an unresolved template slot or an unfinished merge. The gate
# checks bundle FORM; this is the one CONTENT assertion, because a literal
@@ -494,6 +498,12 @@ def check_dir(skill_dir, fails):
check_reference_indexes(skill_dir, fails)
check_plugin_manifest(skill_dir, fails)
for p in skill_dir.rglob("*"):
+ parts = p.relative_to(skill_dir).parts
+ if any(part in VCS_DIRS for part in parts):
+ if not any(part in VCS_DIRS for part in parts[:-1]): # report the top only
+ fails.append(f"version-control metadata in staged tree: "
+ f"{p.relative_to(skill_dir)} (seed without it)")
+ continue
if p.name in BUILD_JUNK or p.suffix == ".pyc" or p.name.startswith(".~lock"):
fails.append(f"build artefact in staged tree: {p.relative_to(skill_dir)}")
# content residue in every text file of the bundle, not only SKILL.md
@@ -823,7 +833,8 @@ def quote_frontmatter_name(skill_md):
def is_build_junk(path, root):
rel = path.relative_to(root)
- return (any(part in BUILD_JUNK or part.startswith(".~lock") for part in rel.parts)
+ return (any(part in BUILD_JUNK or part in VCS_DIRS or part.startswith(".~lock")
+ for part in rel.parts)
or path.suffix == ".pyc")
@@ -900,6 +911,9 @@ def check_bundle(path, fails):
n_members += 1
if b"\x5c" in name:
fails.append(f"bundle: backslash in member path {name!r} (installer rejects it)")
+ if re.search(rb"(^|/)\.(git|hg|svn)(/|$)", name):
+ fails.append(f"bundle: contains version-control metadata "
+ f"({name.decode(errors='replace')})")
# The uploader rejects a skill bundle carrying a plugin manifest. The
# release workflow happens to copy three paths by name rather than the
# whole tree, so it never picked this up — an accident, not a design.