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.

Scan: name lost entries left by an interrupted write

Eoghan Hennd000afc7b9a1
diff --git a/SKILL.md b/SKILL.md
index 3ce8f27..4dadd4c 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -163,7 +163,7 @@ skill" (some upload paths keep only `SKILL.md`); its episodes do not run.
```bash
d="[ABSOLUTE PATH]/skill-observations/observation-log" # the pinned workspace path — re-derive in EVERY call, never relative to the cwd; run under bash, not sh
- n=$(find "[ABSOLUTE PATH]/skill-observations/observation-log" -maxdepth 1 -name '[0-9]*.md' | wc -l | tr -d ' ') # literal path: independent of $d; numbered files only, the population the guard measures
+ n=$(find "[ABSOLUTE PATH]/skill-observations/observation-log" -maxdepth 1 -name '[0-9]*.md' ! -empty | wc -l | tr -d ' ') # literal path: independent of $d; numbered, non-empty: what the parse can read
parsed=$(find "$d" -maxdepth 1 -name '[0-9]*.md' -exec awk 'FNR==1 {if (/^---[[:space:]]*$/) print FILENAME; nextfile}' {} + | wc -l | tr -d ' ')
sus='FNR==1 {fm = (/^---[[:space:]]*$/ ? 1 : 0); if (!fm) nextfile; next}
fm && /^---[[:space:]]*$/ {fm=0; nextfile}
@@ -176,7 +176,7 @@ skill" (some upload paths keep only `SKILL.md`); its episodes do not run.
a_sus=0; [ -d "$d/archive" ] && a_sus=$(find "$d/archive" -maxdepth 1 -name '*.md' -exec awk "$sus" {} + | wc -l | tr -d ' ') # archive/ may not exist yet
if [ "$n" -gt 0 ] && [ "$parsed" -eq 0 ]; then
echo "SCAN COMMAND BROKEN — $n files present, 0 headers parsed"; exit 1
- fi
+ fi; lost=$( { find "$d" -maxdepth 1 -name '[0-9]*.md' -empty; find "$d" -maxdepth 1 -name '[0-9]*.md' ! -empty -exec awk 'FNR==1 {if (!/^---[[:space:]]*$/) print FILENAME; nextfile}' {} +; } | sed 's|.*/||' | LC_ALL=C sort | tr '\n' ' '); [ -n "$lost" ] && echo "LOST ENTRIES — no header, an interrupted write; report each, never reuse or delete: $lost"
[ "$suspect" -gt 0 ] || [ "$a_sus" -gt 0 ] && echo "NOTE: $suspect of $n headers (and $a_sus in archive/) look like invalid YAML (an unquoted ': ', text after a closing quote, a value opening with a backtick, @ or %, an undefined escape, a colon in an unquoted list entry) — quote or fix them (File format)"
printf 'files: %s parsed: %s suspect (awk, a floor): %s archive-suspect: %s\n' "$n" "$parsed" "$suspect" "$a_sus"
printf '%s [%s] session-start scan: files=%s parsed=%s\n' "$(date '+%F %H:%M')" "${PWD##*/}" "$n" "$parsed" \
diff --git a/references/observation-log.md b/references/observation-log.md
index 11197e3..360ff2a 100644
--- a/references/observation-log.md
+++ b/references/observation-log.md
@@ -364,7 +364,7 @@ the two ever disagree, the core wins:
```bash
d="[ABSOLUTE PATH]/skill-observations/observation-log" # the pinned workspace path — re-derive in EVERY call, never relative to the cwd; run under bash, not sh
-n=$(find "[ABSOLUTE PATH]/skill-observations/observation-log" -maxdepth 1 -name '[0-9]*.md' | wc -l | tr -d ' ') # literal path: independent of $d; numbered files only, the population the guard measures
+n=$(find "[ABSOLUTE PATH]/skill-observations/observation-log" -maxdepth 1 -name '[0-9]*.md' ! -empty | wc -l | tr -d ' ') # literal path: independent of $d; numbered, non-empty: what the parse can read
parsed=$(find "$d" -maxdepth 1 -name '[0-9]*.md' -exec awk 'FNR==1 {if (/^---[[:space:]]*$/) print FILENAME; nextfile}' {} + | wc -l | tr -d ' ')
sus='FNR==1 {fm = (/^---[[:space:]]*$/ ? 1 : 0); if (!fm) nextfile; next}
fm && /^---[[:space:]]*$/ {fm=0; nextfile}
@@ -377,7 +377,7 @@ suspect=$(find "$d" -maxdepth 1 -name '[0-9]*.md' -exec awk "$sus" {} + | wc -l
a_sus=0; [ -d "$d/archive" ] && a_sus=$(find "$d/archive" -maxdepth 1 -name '*.md' -exec awk "$sus" {} + | wc -l | tr -d ' ') # archive/ may not exist yet
if [ "$n" -gt 0 ] && [ "$parsed" -eq 0 ]; then
echo "SCAN COMMAND BROKEN — $n files present, 0 headers parsed"; exit 1
-fi
+fi; lost=$( { find "$d" -maxdepth 1 -name '[0-9]*.md' -empty; find "$d" -maxdepth 1 -name '[0-9]*.md' ! -empty -exec awk 'FNR==1 {if (!/^---[[:space:]]*$/) print FILENAME; nextfile}' {} +; } | sed 's|.*/||' | LC_ALL=C sort | tr '\n' ' '); [ -n "$lost" ] && echo "LOST ENTRIES — no header, an interrupted write; report each, never reuse or delete: $lost"
[ "$suspect" -gt 0 ] || [ "$a_sus" -gt 0 ] && echo "NOTE: $suspect of $n headers (and $a_sus in archive/) look like invalid YAML (an unquoted ': ', text after a closing quote, a value opening with a backtick, @ or %, an undefined escape, a colon in an unquoted list entry) — quote or fix them (File format)"
printf 'files: %s parsed: %s suspect (awk, a floor): %s archive-suspect: %s\n' "$n" "$parsed" "$suspect" "$a_sus"
printf '%s [%s] session-start scan: files=%s parsed=%s\n' "$(date '+%F %H:%M')" "${PWD##*/}" "$n" "$parsed" \
@@ -494,6 +494,20 @@ reports each rule came from are in "Guard the read, not just the write"
and "Snippets spanning several tool calls must re-derive their own paths"
above.
+**A partial parse is lost entries, not a smaller log.** The guard halts
+only when nothing parsed. A numbered file with no header — zero bytes,
+or text with no opening `---` — is named on the scan's `LOST ENTRIES`
+line instead: it is the trace of a write interrupted between the
+`noclobber` create and the body (a denied write, a context cut, a session
+ending), and it holds an id nobody may reuse. Report each in the start-up
+lines. If the observation can be reconstructed — this session wrote it,
+or the slug and the session record say enough — write the body into
+that file now; otherwise give it a minimal header (`id` from the prefix,
+a `title` naming the slug, `status: declined`, `resolved:` today,
+`resolution: "write interrupted; body lost"`, `siblings_checked:
+"none — lost entry"`) so the archival sweep closes it. Never delete it:
+the id stays issued, and the floor already sits above it.
+
### Every instrument gets the same guard
**Every instrument gets the same guard: an empty or zero result is a