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.

Id snippet: count only non-empty files against the sweep

Eoghan Henn9903842efdf3
diff --git a/SKILL.md b/SKILL.md
index a1cbae3..8c9adbf 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -400,7 +400,7 @@ id, not a separate duty (see Archival on Write):
```bash
d="[ABSOLUTE PATH]/skill-observations/observation-log" # the pinned workspace path, never relative to the cwd; it may contain a space, so keep it quoted; bash, not sh
today=$(date +%F) # archival rides inside this command (see below):
-n_files=$(find "$d" -maxdepth 1 -name '*.md' | wc -l | tr -d ' ')
+n_files=$(find "$d" -maxdepth 1 -name '*.md' ! -empty | wc -l | tr -d ' ') # a zero-byte file gives awk no line to count
seen=$(cd "$d" && awk 'FNR==1 {n++; nextfile} END {print n+0}' *.md 2>/dev/null) # files the sweep's glob reaches, counted apart from the sweep
[ "$n_files" -gt 0 ] && [ "${seen:-0}" -eq 0 ] && { echo "ARCHIVAL SWEEP BROKEN — $n_files files present, 0 examined"; exit 1; }
( cd "$d" && awk -v today="$today" 'FNR==1 {st=""; r=""; fm=/^---[[:space:]]*$/; if (!fm) nextfile; next}
diff --git a/references/observation-log.md b/references/observation-log.md
index 62f8581..3e534ee 100644
--- a/references/observation-log.md
+++ b/references/observation-log.md
@@ -958,7 +958,7 @@ two ever disagree, the core wins:
```bash
d="[ABSOLUTE PATH]/skill-observations/observation-log" # the pinned workspace path, never relative to the cwd; it may contain a space, so keep it quoted; bash, not sh
today=$(date +%F) # archival rides inside this command (see below):
-n_files=$(find "$d" -maxdepth 1 -name '*.md' | wc -l | tr -d ' ')
+n_files=$(find "$d" -maxdepth 1 -name '*.md' ! -empty | wc -l | tr -d ' ') # a zero-byte file gives awk no line to count
seen=$(cd "$d" && awk 'FNR==1 {n++; nextfile} END {print n+0}' *.md 2>/dev/null) # files the sweep's glob reaches, counted apart from the sweep
[ "$n_files" -gt 0 ] && [ "${seen:-0}" -eq 0 ] && { echo "ARCHIVAL SWEEP BROKEN — $n_files files present, 0 examined"; exit 1; }
( cd "$d" && awk -v today="$today" 'FNR==1 {st=""; r=""; fm=/^---[[:space:]]*$/; if (!fm) nextfile; next}
diff --git a/scripts/new-observation.sh b/scripts/new-observation.sh
index 1718f83..7d6bef9 100755
--- a/scripts/new-observation.sh
+++ b/scripts/new-observation.sh
@@ -66,7 +66,7 @@ fi
today=$(date +%F)
# --- archival sweep: stale resolved files move before the id is read --------
-n_files=$(find "$d" -maxdepth 1 -name '*.md' | wc -l | tr -d ' ')
+n_files=$(find "$d" -maxdepth 1 -name '*.md' ! -empty | wc -l | tr -d ' ') # a zero-byte file gives awk no line to count
seen=$(cd "$d" && awk 'FNR==1 {n++; nextfile} END {print n+0}' *.md 2>/dev/null) # files the sweep's glob reaches, counted apart from the sweep
if [ "$n_files" -gt 0 ] && [ "${seen:-0}" -eq 0 ]; then
echo "ARCHIVAL SWEEP BROKEN — $n_files files present, 0 examined" >&2; exit 1