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.

Portable, loud-on-failure snippets; version control as a mutation surface

Eoghan Henn8f19700541ef
diff --git a/SKILL.md b/SKILL.md
index 9ed859d..9b21f4e 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -210,10 +210,13 @@ when the active directory is empty):
d=skill-observations/observation-log
hi=$( { ls "$d" "$d/archive" 2>/dev/null | grep -oE '^[0-9]+'; cat "$d/archive/.id-floor" 2>/dev/null; } \
| sort -n | tail -1); : "${hi:=0}"
+[ "$hi" -eq 0 ] && [ -n "$(ls "$d"/*.md 2>/dev/null)" ] && { echo "ID COMMAND BROKEN — log is non-empty but no ids extracted"; exit 1; }
next_id=$(( hi + 1 )); echo "$next_id" > "$d/archive/.id-floor"
```
-A new file never touches another entry's bytes, so it cannot truncate,
+The guard line distinguishes "the log says zero" from "I could not read
+the log": a command that fails to empty rather than to error would
+otherwise propose id 1 in a populated log. A new file never touches another entry's bytes, so it cannot truncate,
overwrite or renumber anyone else's work. If two parallel sessions pick the
same id, two files share a number — harmless; the next review renumbers one
and logs a meta-observation.
diff --git a/references/observation-log.md b/references/observation-log.md
index 2e997b8..ae74e62 100644
--- a/references/observation-log.md
+++ b/references/observation-log.md
@@ -75,12 +75,18 @@ it whenever you issue an id above it.
d=skill-observations/observation-log
hi=$( { ls "$d" "$d/archive" 2>/dev/null | grep -oE '^[0-9]+'; cat "$d/archive/.id-floor" 2>/dev/null; } \
| sort -n | tail -1); : "${hi:=0}"
+[ "$hi" -eq 0 ] && [ -n "$(ls "$d"/*.md 2>/dev/null)" ] && { echo "ID COMMAND BROKEN — log is non-empty but no ids extracted"; exit 1; }
next_id=$(( hi + 1 )); echo "$next_id" > "$d/archive/.id-floor"
printf '%04d\n' "$next_id" # filename prefix
```
`ls`, `grep -oE`, `sort -n` and `printf` are POSIX; the snippet runs
-unchanged on macOS, Linux and Git Bash.
+unchanged on macOS, Linux and Git Bash. A skill that hands the agent a
+shell command owns that command's portability: lead with the portable
+form, never offer it as a footnote the agent reaches for after the primary
+has failed — and make any command that derives a number from a file fail
+loudly on an empty result, because a command that fails to empty rather
+than to error may never announce that it failed at all.
### Why this is the entire concurrency story
@@ -112,6 +118,29 @@ ownership fence: an explicit in-scope list by id, an explicit out-of-scope
list, and the instruction that each session edits status only on its own
ids.
+## When the workspace is under version control
+
+Versioning the workspace folder is good practice — it gives the rollback
+the skill cares about — and it adds a mutation surface that does not look
+like one. `git checkout -- <path>`, `git stash`, `git reset --hard`, a
+branch switch carrying local modifications, a rebase that drops a hunk,
+and above all `git clean -fd` destroy observation files as thoroughly as
+any edit; the newest files are the most exposed, because a just-written
+observation is an *untracked* file until someone commits it, and
+`git clean` exists to delete exactly those. These commands get run
+reflexively as housekeeping ("make the tree clean enough to switch
+branches"), and a continuously written log is almost always what makes the
+tree dirty.
+
+Rules: before any git operation that can discard working-tree state, copy
+`observation-log/` somewhere outside the repository, and afterwards
+confirm every file this session wrote still exists, re-creating from the
+copy if not. **Prefer committing pending observations over reverting
+them** — when the dirt in the tree is the log, a commit is always the
+cheaper way to get clean. Scope any dirty-tree guard to exclude
+`skill-observations/` rather than teaching sessions to clear it, and never
+run `git clean` with that directory in scope.
+
## Archival
On every write, first move already-resolved files from `observation-log/`
diff --git a/references/skill-authoring.md b/references/skill-authoring.md
index ea478ae..7946ee8 100644
--- a/references/skill-authoring.md
+++ b/references/skill-authoring.md
@@ -380,8 +380,12 @@ a two-tier check:
1. Enumerate every added/moved line via `diff` of the old base vs the new
base.
-2. Exact-match each non-empty line against the restructured file set
- (`grep -F`).
+2. Exact-match each non-empty line against the restructured file set:
+ `grep -qF -- "$line" "$file"` — the `--` is required, because markdown
+ lines starting with `-` are otherwise parsed as options, `grep` errors
+ out, and the line is scored as missing (31 false losses beside 35 real
+ ones in one run). The same applies to every embedded snippet that
+ interpolates file content into an argument position.
3. For misses, substance-check via a distinctive mid-line substring before
concluding loss — most misses are container artifacts (heading-level
changes, list-to-prose adaptation, re-wrapped lines splitting a phrase
@@ -389,7 +393,14 @@ a two-tier check:
4. Word-count sanity check per file.
One tier alone either misses losses (substance-only) or cries wolf
-(exact-only). Additionally, inventory the original's enforcement
+(exact-only). **The checker is code too, and the least-tested code in the
+pipeline** — written once, for one run, never exercised against a fixture.
+Count record headers by matching per line (split, then anchor), not with a
+`^`-anchored regex over whole-file text, whose multiline-flag semantics
+vary by language and fail silently to "1". Before trusting any checker's
+verdict, calibrate it: assert that it reproduces a KNOWN count on the
+untouched original. A checker that fails calibration is a false alarm
+today and a silent pass tomorrow. Additionally, inventory the original's enforcement
mechanisms (checkpoints, assertions, invariants, mandatory-write rules,
defaults) as an explicit checklist — compression preferentially destroys
enforcement machinery because it reads as redundancy — and sweep any "pure