-
Notifications
You must be signed in to change notification settings - Fork 1
Round 44 batch 6a of 6: DV-2.0 provenance frontmatter — backfill script + 10 skills #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,11 @@ | ||||||
| --- | ||||||
| name: algebra-owner | ||||||
| description: Use this skill as the designated specialist reviewer for Zeta.Core's operator algebra — Z-sets, D/I/z⁻¹/H, retraction-native semantics, the chain rule, nested fixpoints, higher-order differentials. He carries deep advisory authority on the algebra's mathematical shape; final decisions require Architect buy-in or human sign-off (see docs/CONFLICT-RESOLUTION.md). | ||||||
| record_source: "git: Aaron Stainback on 2026-04-18" | ||||||
|
||||||
| record_source: "git: Aaron Stainback on 2026-04-18" | |
| record_source: "git: human maintainer on 2026-04-18" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,207 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # tools/skill-catalog/backfill_dv2_frontmatter.sh — mechanical DV-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| # frontmatter backfill for SKILL.md files. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Phase-1 deliverable of the BACKLOG row "Data Vault 2.0 provenance as | ||||||||||||||||||||||||||||||||||||||||||||||||
| # scope-universal indexing substrate — rollout beyond the skill catalog" | ||||||||||||||||||||||||||||||||||||||||||||||||
| # (landed 2026-04-22, commit a103f08). An audit on the same day found | ||||||||||||||||||||||||||||||||||||||||||||||||
| # 214 of 216 .claude/skills/**/SKILL.md files missing all five DV-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| # fields required by .claude/skills/skill-documentation-standard/SKILL.md: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # record_source "author, round N" — from first-land commit | ||||||||||||||||||||||||||||||||||||||||||||||||
| # load_datetime YYYY-MM-DD — first-land commit date | ||||||||||||||||||||||||||||||||||||||||||||||||
| # last_updated YYYY-MM-DD — most-recent change date | ||||||||||||||||||||||||||||||||||||||||||||||||
| # status active | draft | stub | dormant | retired (default: active) | ||||||||||||||||||||||||||||||||||||||||||||||||
| # bp_rules_cited [BP-NN, ...] — regex of BP-NN mentions in body | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # This script is the mechanical cascade: pass any SKILL.md path and the | ||||||||||||||||||||||||||||||||||||||||||||||||
| # missing fields are computed from git history and injected before the | ||||||||||||||||||||||||||||||||||||||||||||||||
| # closing frontmatter fence. Already-present fields are preserved (the | ||||||||||||||||||||||||||||||||||||||||||||||||
| # script is idempotent — re-running on a compliant file is a no-op). | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # tools/skill-catalog/backfill_dv2_frontmatter.sh [--dry-run] <path>... | ||||||||||||||||||||||||||||||||||||||||||||||||
| # tools/skill-catalog/backfill_dv2_frontmatter.sh [--dry-run] --all | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Flags: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # --dry-run Print the proposed frontmatter to stdout without writing. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # --all Process every .claude/skills/**/SKILL.md non-recursively. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Exit codes: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # 0 success (all files processed or already compliant) | ||||||||||||||||||||||||||||||||||||||||||||||||
| # 1 usage error | ||||||||||||||||||||||||||||||||||||||||||||||||
| # 2 a file was malformed (no closing frontmatter fence found) | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Intentional non-goals: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # - Does NOT infer status beyond the safe "active" default. A skill that | ||||||||||||||||||||||||||||||||||||||||||||||||
| # is actually "stub" or "dormant" keeps the default until a human or | ||||||||||||||||||||||||||||||||||||||||||||||||
| # skill-improver review flips it. This preserves honesty: the default | ||||||||||||||||||||||||||||||||||||||||||||||||
| # is load-bearing, not a guess. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # - Does NOT touch the description field. If the description is stale | ||||||||||||||||||||||||||||||||||||||||||||||||
| # or wrong, that is a skill-tune-up finding, not a mechanical fix. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # - Does NOT delete any existing field. Only appends missing ones. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # - Does NOT run git commit. The caller decides batching and commit | ||||||||||||||||||||||||||||||||||||||||||||||||
| # messages; this script just rewrites files. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| DRY_RUN=0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| ALL=0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| FILES=() | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| while [[ $# -gt 0 ]]; do | ||||||||||||||||||||||||||||||||||||||||||||||||
| case "$1" in | ||||||||||||||||||||||||||||||||||||||||||||||||
| --dry-run) DRY_RUN=1; shift ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| --all) ALL=1; shift ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| -h|--help) | ||||||||||||||||||||||||||||||||||||||||||||||||
| sed -n '3,46p' "$0" | ||||||||||||||||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| -*) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "error: unknown flag: $1" >&2 | ||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| *) | ||||||||||||||||||||||||||||||||||||||||||||||||
| FILES+=("$1"); shift | ||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ $ALL -eq 1 ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ ${#FILES[@]} -gt 0 ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "error: --all is mutually exclusive with explicit paths" >&2 | ||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
| while IFS= read -r -d '' f; do | ||||||||||||||||||||||||||||||||||||||||||||||||
| FILES+=("$f") | ||||||||||||||||||||||||||||||||||||||||||||||||
| done < <(find .claude/skills -maxdepth 2 -name 'SKILL.md' -type f -print0 | sort -z) | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ ${#FILES[@]} -eq 0 ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "usage: $0 [--dry-run] <SKILL.md path>... | --all" >&2 | ||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| TODAY="$(date -u +%Y-%m-%d)" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # field_present FIELD FILE -> 0 if the frontmatter already has this field. | ||||||||||||||||||||||||||||||||||||||||||||||||
| field_present() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| awk -v field="$1" ' | ||||||||||||||||||||||||||||||||||||||||||||||||
| /^---$/ { dash++; if (dash == 2) exit 1; next } | ||||||||||||||||||||||||||||||||||||||||||||||||
| dash == 1 && $0 ~ "^" field ":" { found = 1; exit 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
| END { exit (found ? 0 : 1) } | ||||||||||||||||||||||||||||||||||||||||||||||||
| ' "$2" | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # compute_record_source FILE -> "<author-heuristic>, round N" | ||||||||||||||||||||||||||||||||||||||||||||||||
| compute_record_source() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| local file="$1" subj | ||||||||||||||||||||||||||||||||||||||||||||||||
| subj=$(git log --reverse --format='%s' -- "$file" 2>/dev/null | head -n 1) | ||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ "$subj" =~ [Rr]ound\ *([0-9]+) ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "skill-creator, round ${BASH_REMATCH[1]}" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+97
to
+102
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # compute_record_source FILE -> "<author-heuristic>, round N" | |
| compute_record_source() { | |
| local file="$1" subj | |
| subj=$(git log --reverse --format='%s' -- "$file" 2>/dev/null | head -n 1) | |
| if [[ "$subj" =~ [Rr]ound\ *([0-9]+) ]]; then | |
| echo "skill-creator, round ${BASH_REMATCH[1]}" | |
| # compute_record_source FILE -> "skill-creator/round-N" or "git: <author> on <date>" | |
| compute_record_source() { | |
| local file="$1" subj | |
| subj=$(git log --reverse --format='%s' -- "$file" 2>/dev/null | head -n 1) | |
| if [[ "$subj" =~ [Rr]ound\ *([0-9]+) ]]; then | |
| echo "skill-creator/round-${BASH_REMATCH[1]}" |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compute_record_source’s fallback emits the git author’s personal name (e.g., git: <author> on <date>). This violates the repo’s “no name attribution in code/docs/skills” rule; record_source should use role-based identifiers (e.g., “human maintainer”, “architect”, “skill-creator/round-N”) rather than contributor names.
| # compute_record_source FILE -> "<author-heuristic>, round N" | |
| compute_record_source() { | |
| local file="$1" subj | |
| subj=$(git log --reverse --format='%s' -- "$file" 2>/dev/null | head -n 1) | |
| if [[ "$subj" =~ [Rr]ound\ *([0-9]+) ]]; then | |
| echo "skill-creator, round ${BASH_REMATCH[1]}" | |
| else | |
| # No round marker found — still honest: cite the author and date only. | |
| local author_date | |
| author_date=$(git log --reverse --format='%an on %ai' -- "$file" 2>/dev/null | head -n 1 | awk '{print $1" "$2" on "$4}') | |
| echo "git: ${author_date:-unknown}" | |
| # compute_record_source FILE -> role-based provenance string | |
| compute_record_source() { | |
| local file="$1" subj | |
| subj=$(git log --reverse --format='%s' -- "$file" 2>/dev/null | head -n 1) | |
| if [[ "$subj" =~ [Rr]ound\ *([0-9]+) ]]; then | |
| echo "skill-creator, round ${BASH_REMATCH[1]}" | |
| else | |
| # No round marker found — keep provenance without personal-name attribution. | |
| local first_date | |
| first_date=$(git log --reverse --format='%ai' -- "$file" 2>/dev/null | head -n 1 | awk '{print $1}') | |
| echo "git: human maintainer on ${first_date:-unknown}" |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compute_bp_rules uses grep in a pipeline under set -euo pipefail. When a SKILL.md contains no BP-<NN> matches, grep exits 1, which makes the whole pipeline fail and can abort the script instead of producing []. Make this pipeline non-fatal on “no matches” (e.g., treat exit 1 as empty output) so skills without BP citations can be processed safely.
| local file="$1" rules | |
| rules=$(grep -oE 'BP-[0-9]+' "$file" 2>/dev/null | sort -u | paste -sd, - | sed 's/,/, /g') | |
| if [[ -z "$rules" ]]; then | |
| echo "[]" | |
| else | |
| echo "[${rules}]" | |
| local file="$1" matches rules grep_status | |
| if matches=$(grep -oE 'BP-[0-9]+' "$file" 2>/dev/null); then | |
| : | |
| else | |
| grep_status=$? | |
| if [[ $grep_status -eq 1 ]]; then | |
| matches="" | |
| else | |
| return "$grep_status" | |
| fi | |
| fi | |
| if [[ -n "$matches" ]]; then | |
| rules=$(printf '%s\n' "$matches" | sort -u | paste -sd, - | sed 's/,/, /g') | |
| echo "[${rules}]" | |
| else | |
| echo "[]" |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frontmatter validation counts every --- in the file, so a markdown horizontal rule later in the body can be mistaken for the closing frontmatter fence. This can cause the script to inject fields into the body and corrupt the file. Consider verifying that line 1 is --- and locating the closing fence within the initial frontmatter block (e.g., search only after the first line until the second fence).
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process_one "$f" || RC=$? overwrites RC each time a later file fails, which can mask an earlier, more specific error (e.g., a malformed file returning 2 can be replaced by a later 1). Preserve the first non-zero exit code (or the max) so callers get a stable summary failure code when processing multiple files.
| process_one "$f" || RC=$? | |
| if ! process_one "$f"; then | |
| status=$? | |
| if [[ "$RC" -eq 0 ]]; then | |
| RC=$status | |
| fi | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skill is explicitly described as dormant/gated off (“Currently gated OFF”), but the newly added frontmatter sets
status: active. Per the skill documentation standard,dormantis the intended lifecycle state for gated-off skills (e.g.,ai-jailbreakeruntil activation). Updatestatusto reflect the documented gating.