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.

Merge pull request #35: store observations as one file per entry

Eoghan Henn54c0511e5ccc
diff --cc SKILL.md
index 565424b,81216d8..bed8981
--- a/SKILL.md
+++ b/SKILL.md
@@@ -39,9 -39,10 +39,12 @@@ Code, the stable project identity (e.g
`~/.claude/projects/<project-id>/`), NOT the current working directory. A
cwd inside an ephemeral checkout — a git worktree under
`.claude/worktrees/`, a temporary clone — is torn down with the checkout
- and takes the observation log with it. The observation log lives at
- `[workspace folder]/skill-observations/log.md` unless the user's
- configuration pins it elsewhere.
-and takes the observations with it. Each observation is its own file under
-`[workspace folder]/skill-observations/observations/` — one Markdown file
-with a YAML frontmatter header per observation — unless the user's
-configuration pins the directory elsewhere.
++and takes the observations with it. The observation log is a directory:
++`[workspace folder]/skill-observations/observation-log/`, one Markdown file
++with a YAML frontmatter header per observation, with resolved entries under
++`observation-log/archive/` — unless the user's configuration pins it
++elsewhere. "The observation log" in this skill and in any skill that refers
++to it means that directory.
## Reference files — load on demand, not up front
@@@ -72,18 -72,36 +75,37 @@@ above)
## Session Start Protocol
- 1. If `skill-observations/log.md` or `cross-cutting-principles.md` don't
- exist, create them (templates below / in the principles section of
-1. If `skill-observations/observations/` or `cross-cutting-principles.md`
- don't exist, create them (`observations/` is the directory where the
- per-observation files live; the principles template is in the principles
- section of `references/skill-authoring.md`). Also create
++1. If `skill-observations/observation-log/` (with its `archive/`
++ subdirectory) or `cross-cutting-principles.md` don't exist, create them
++ (the principles template is in the principles section of
+ `references/skill-authoring.md`). Also create
`skill-observations/last-review-date.txt` containing the literal value
`never` if it doesn't exist — never write a date into it at setup; a
- date means a review actually ran. Before creating or writing anything:
+ date means a review actually ran. If a legacy single-file
- `skill-observations/log.md` exists but `observations/` is empty, offer
- the one-time conversion in "Migrating a legacy log.md" below before
- proceeding. Before creating or writing anything:
++ `skill-observations/log.md` exists and `observation-log/` does not, this
++ is an upgrade from a pre-3.0 install: load `references/migration.md` and
++ run the scripted conversion before writing anything else. Before creating
++ or writing anything:
if the resolved workspace folder sits under an ephemeral path (e.g.
`.claude/worktrees/`, a temporary clone), warn the user and re-anchor
on the stable project path first — state written to an ephemeral
checkout is lost at teardown.
- 2. Scan OPEN observations and active principles; hold them in awareness,
- don't surface unprompted.
+ 2. Scan OPEN observations by reading only the frontmatter of each file in
- `observations/` — the header block between the first two `---` lines,
++ `observation-log/` — the header block between the first two `---` lines,
+ never the bodies. Build awareness from the `status`, `skill`, and
+ `title` fields; also read active principles. Hold them in awareness,
+ don't surface unprompted. Reading frontmatter only is the whole point of
+ the per-file format: it keeps this always-on scan cheap even once
+ hundreds of observations have accumulated.
+
+ ```bash
+ # Frontmatter-only scan — print each observation's header, skip the body
- for f in skill-observations/observations/*.md; do
++ for f in skill-observations/observation-log/*.md; do
+ awk 'NR==1 && /^---[[:space:]]*$/ {fm=1; next}
+ fm && /^---[[:space:]]*$/ {print "---"; exit}
+ fm' "$f"
+ done
+ ```
3. Read `skill-observations/last-review-date.txt`. The value carries the
truth: a date = when the last review actually ran; `never` = no review
has run yet. A missing file is abnormal (step 1 creates it) — recreate
@@@ -177,131 -199,61 +203,68 @@@ checkpoints; piggy-backing the flush on
side effect of work you were doing anyway, rather than depending on a separate
act of memory.
- **Numbering discipline (mandatory, every append):**
-
- 1. *Pre-check:* read the actual log and find the highest existing number —
- never trust session memory:
-
- ```bash
- # GNU grep:
- grep -oP '### Observation \K\d+' log.md | sort -n | tail -1
- # macOS / POSIX:
- grep -o '### Observation [0-9]*' log.md | grep -o '[0-9]*' | sort -n | tail -1
- ```
-
- 2. *Pre-write assertion:* immediately before appending, confirm the proposed
- number doesn't already exist:
-
- ```bash
- PROPOSED=$(( $(grep -oP '### Observation \K\d+' log.md | sort -n | tail -1) + 1 ))
- grep -qE "^### Observation ${PROPOSED}:" log.md && {
- echo "COLLISION on #${PROPOSED}"; exit 1; }
- ```
+ **Assigning an id (lightweight — no shared-file dance):** each observation
+ is its own file named `NNNN-short-slug.md` (zero-padded id + a kebab-case
-slug from the title). Compute the id as the highest numeric filename prefix
-across `observations/` and `archive/`, plus one:
++slug from the title). Compute the id as the highest of three values, plus
++one: the highest numeric filename prefix in `observation-log/`, the highest
++in `observation-log/archive/`, and the number in
++`observation-log/archive/.id-floor` — a one-line file holding the highest id
++ever issued, so the counter can never restart from 1 when the active
++directory happens to be empty (update it whenever you issue an id above it):
+
+ ```bash
-hi=$(ls skill-observations/observations skill-observations/archive 2>/dev/null \
- | grep -oE '^[0-9]+' | sort -n | tail -1); : "${hi:=0}"
-next_id=$(( hi + 1 ))
++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}"
++next_id=$(( hi + 1 )); echo "$next_id" > "$d/archive/.id-floor"
+ ```
- If it fires, increment past all existing numbers and re-check (and log a
- meta-observation — it signals a parallel-session collision).
-
- 3. *Post-write verification:* after appending, count occurrences of the
- number; if >1, a parallel writer collided between check and write —
- renumber YOUR entry to max+1. Identify your entry from your own append
- operation (capture the file's line count immediately before and after
- your `>>`; your entry starts at the old line count + 1) — do NOT
- re-grep and take the last occurrence, which may be a colliding writer's
- entry appended after yours. After any `sed` renumber, re-read the
- affected line to confirm the substitution actually took effect — a
- line-addressed `s///` whose target shifted finds no match and still
- exits 0. Pre-write catches stale reads; only a post-write check catches
- the race. The pattern for shared logs written by parallel agents is
- check-then-act-then-verify.
-
- **Log-write safety — never let a mutation span entry boundaries:** When
- mutating the log programmatically (marking entries ACTIONED/DECLINED,
- archiving, renumbering), a greedy or DOTALL pattern over the whole file can
- silently swallow everything from one match to EOF. This has happened: a
- `.*$` under `re.S` over the multi-entry file captured from one entry's
- Status line to end-of-file and overwrote 16 later entries in a single
- substitution. The log is shared state across many entries; mutate it one
- bounded entry at a time and verify every mutation.
-
- 1. **Re-read and merge immediately before any write-back.** Any full-file
- rewrite (archival, renumbering, reassembly from chunks) built from a
- snapshot destroys whatever concurrent sessions appended after that
- snapshot — the write-back succeeds, the victim gets no error, and the
- loss is invisible. This has happened in production: a parallel session's
- write-back erased two entries appended minutes earlier, hours after the
- exact failure mode had been documented. So: take the snapshot, prepare
- the mutation, then — immediately before writing — re-read the live log
- and diff against the snapshot. If new entries appeared, merge them into
- the write-back (or rebuild from the fresh read). Never write back a
- stale snapshot.
-
- 2. **Isolate the target entry, or anchor to a single line.** Either split
- the log on `### Observation N:` headers, edit the TARGET entry's chunk in
- isolation, and reassemble — OR, for a status-only edit, use a strictly
- line-anchored multiline substitution that cannot cross a newline, e.g.
- `re.sub(r'(?m)^(\s*-?\s*)\*\*Status:\*\*.*$', ...)` (multiline `^...$`
- bounds the match to one line). NEVER use a DOTALL/greedy pattern across
- the multi-entry file.
-
- 3. **Assert a structural invariant against the LIVE pre-write file.** Count
- `### Observation` headers in the live file immediately before writing and
- again after. For a status-only edit the count MUST be unchanged; for
- archival or append it must change by exactly the expected number. The
- baseline must be the live file at write time, NOT your session's earlier
- snapshot — an invariant computed against a stale snapshot validates that
- you wrote what you intended while still destroying what others wrote in
- between. Fail loudly if the count is off.
-
- 4. **Keep the pre-write backup.** Copy `log.md` before any programmatic
- mutation. This is what made full recovery trivial when the truncation
- above occurred — it turned a destructive bug into a non-event.
-
- 5. **Verify your entries SURVIVED, not just that they were written.** A
- successful append proves nothing an hour later — a concurrent session's
- write-back can silently delete it, and only the destroying session gets
- any signal (none). Before surfacing observations at session end, grep
- the log for every entry number this session wrote and confirm each still
- exists exactly once; re-append any that are missing (with fresh numbers)
- and log a meta-observation about the collision.
-
- 6. **Splitting the backlog across parallel sessions needs an ownership
- fence.** Rules 1–5 are the mechanical layer: they stop writes destroying
- each other. They cannot stop two sessions legitimately resolving the same
- entry in different ways (both marking it ACTIONED with different accounts
- of what was done). So when work on one log is divided between sessions,
- the handoff must carry: an explicit in-scope list by observation number,
- an explicit OUT-of-scope list, a standing instruction that neither
- session archives for the duration of the split (archival is the
- read-filter-rewrite that has destroyed concurrent appends in production),
- and a warning that a second session is live. Each session verifies its
- own entries survived before finishing. Appending stays safe under a
- split; only archival must be deferred. The ownership fence is a
- coordination artefact, not a file-locking one — it has to be exchanged in
- the handoff, because no amount of careful writing recovers it afterwards.
-
- Principle: a log shared across many entries must be mutated one bounded
- entry at a time; every rewrite must be based on a fresh read, verified by a
- structural invariant against the live pre-write file, and backed up. Writers
- must verify survival, not just successful writes — in a concurrent erase,
- the victim gets no error.
-
- **Format and insertion:** always `### Observation NNN:`, always appended to
- the END of the log, never mid-file, never alternative ID formats. One
- format, one insertion point. **Every new observation MUST include
- `**Status:** OPEN` as its first field — this is mandatory at write time, not
- optional.** Reviews classify entries by their Status line; an observation
- written without one is invisible to any status-filtered pass and risks being
- silently skipped instead of triaged.
-Then write `observations/$(printf '%04d' "$next_id")-<slug>.md`. Because
++Then write `observation-log/$(printf '%04d' "$next_id")-<slug>.md`. Because
+ every observation lives in its own file, the elaborate
+ check-then-act-then-verify numbering ritual the single-file log required is
+ gone: a new observation never touches another entry's bytes, so it cannot
+ truncate, overwrite, or renumber anyone else's work. In the rare case two
+ parallel sessions pick the same id, the result is two files sharing a
+ number — harmless (distinct files, nothing lost); the next review renumbers
+ one and logs a meta-observation. That benign outcome is the entire
+ concurrency story now.
+
+ **Editing an existing observation's file safely:** status changes and
+ archival touch exactly one file. Re-read that file immediately before
+ editing it (a parallel review may have resolved it), then edit only the
+ frontmatter fields you're changing (`status`, `resolved`, `resolution`).
+ Never rewrite a file you don't own, and never batch-rewrite the whole
+ directory: the single-file log's DOTALL/greedy truncation hazard — which
+ once overwrote 16 entries from a single Status line to end-of-file in one
+ substitution — is structurally impossible when each observation is isolated
+ in its own file. For the same reason, the old backup / re-read-and-merge /
+ structural-invariant / survival-check sequence is no longer needed; one file
+ cannot be erased by another session writing elsewhere. Archival is a plain
+ `mv` into `archive/`, not a read-filter-rewrite (see "Archival on Write").
+
+ **File format:** every observation file is YAML frontmatter (the metadata
+ the scan reads) followed by the Issue → Improvement → Principle body. **The
+ frontmatter is mandatory and drives every status-filtered pass; an
+ observation written without a `status` field is treated as OPEN by reviews,
+ never as nonexistent** — so always write `status: open` at creation time.
```markdown
- ### Observation [N]: [Short descriptive title]
-
- **Status:** OPEN
- **Date:** [date]
- **Session context:** [what task was being worked on]
- **Skill:** [existing skill name, or "New skill candidate: [working name]"]
- **Type:** [open-source | internal]
- **Phase/Area:** [which part of the skill or workflow]
+ ---
+ id: [N]
+ title: [Short descriptive title]
+ status: open # open | actioned | declined
+ type: open-source # open-source | internal
-skill: [existing skill name, or "new-skill-candidate"]
-new_skill: [working name — only when skill is "new-skill-candidate"]
++skill: [list of existing skills this improves — always a list, even with
++ one entry; first entry is primary; may be empty]
++proposes_skill: [list of new skills this argues for, by working name;
++ may be empty — an observation can fill either list or both]
+ area: [which part of the skill or workflow]
+ date: [YYYY-MM-DD]
+ session_context: [what task was being worked on]
+ resolved: # date resolved; leave empty while OPEN
+ resolution: # what was done — set only when actioned/declined
+ reference: # optional: path to saved session-local evidence
+ ---
**Issue:** [What happened — specific enough to understand weeks later
without the original conversation.]
@@@ -325,24 -277,13 +288,14 @@@ authoring: `references/skill-authoring.
## Referencing Observations
- When citing an observation by number — in conversation, in a review report,
- or from within another observation — the number must come from the entry's
- literal `### Observation N:` header line. Never cite an observation number
- that wasn't read from that header.
-
- - **Search-tool line numbers are positional metadata, not IDs.** `grep -n`
- prefixes every match with a line number; when a match lands mid-entry
- (e.g., on a Session context or Principle line rather than the header),
- that line number is NOT the observation number. Resolve to the owning
- header first — scan backwards from the matched line to the nearest
- preceding `### Observation N:` header and take the number from there
- (e.g., an awk backwards-scan, or re-grep for `^### Observation` and pick
- the last header line before the match).
- - **Plausibility check (cheap second layer):** before quoting any
- observation number, compare it against the known counter range — the
- highest `### Observation N:` header in the log. A number outside that
- range (e.g., citing #1365 when the log's counter is at #766) is almost
- certainly a line number or other positional artefact misread as an ID.
+ Cite an observation by the `id` field in its frontmatter, which matches the
+ `NNNN-` prefix of its filename. Never cite a `grep -n` line number as if it
+ were the id — search-tool line numbers are positional metadata, not
+ identifiers. Cheap plausibility check: a cited id should fall within the
-range of ids that actually exist across `observations/` and `archive/`; a
++range of ids that actually exist across `observation-log/`, its `archive/`
++and `.id-floor`; a
+ number far outside that range (e.g. citing #1365 when the highest id is
+ #766) is almost certainly a line number misread as an id.
The general rule: IDs must come from the record's own identifier field,
never from the positional metadata of the search tool that found it.
@@@ -357,56 -298,66 +310,59 @@@ requirements (attribution, licensing, s
## Archival on Write
- On every log write, first move already-resolved entries to
- `skill-observations/archive/log-[YYYY-MM-DD].md` (preserving the log header
- in the archive). "Already resolved" is decided by date, read from the file:
- a resolved status MUST record its date — `ACTIONED (YYYY-MM-DD) — [what was
- done]` / `DECLINED (YYYY-MM-DD) — [reason]` — and archival moves only
- entries whose recorded date is before today. Entries resolved today stay in
- the active log until the next day, no matter which session resolved them:
+ On every write, first move already-resolved observation files from
-`observations/` to `skill-observations/archive/` (a flat directory; the
++`observation-log/` to `observation-log/archive/` (a flat directory; the
+ resolution date lives in each file's `resolved:` field, so no dated archive
+ filename is needed). "Already resolved" is decided by the file's own
+ frontmatter: a resolved observation MUST carry `status: actioned` or
+ `status: declined` AND a `resolved:` date, and archival moves only files
+ whose `resolved:` date is before today. Entries resolved today stay in
-`observations/` until the next day, no matter which session resolved them:
++`observation-log/` until the next day, no matter which session resolved them:
the grace period lives in the file, never in session memory, so it holds
- across parallel and subsequent sessions. A resolved entry with no readable
- date gets today's date added instead of being archived. The active log
- keeps its header, status key, all OPEN entries, and the same-day-resolved
- ones.
-
- Archival is a read-filter-rewrite — the highest-risk mutation the log
- undergoes, and the one that has destroyed concurrent appends in production.
- Before the backup, probe for live concurrent writers: record the log's
- `### Observation` header count and its mtime. An mtime only minutes old, or
- a count above what this session's own writes account for, is evidence that
- another session is appending right now. Under that evidence, DEFER archival
- to a later write — do not proceed carefully. The safety rules protect a
- rewrite from a stale snapshot; they cannot protect against a writer
- appending during the rewrite itself. The probe covers the uncoordinated
- case: rule 6's ownership fence handles a known split, but only a handoff
- can carry it, and nobody hands off a session they don't know exists.
-
- If the probe is clean, archival MUST follow the full Log-write safety
- sequence above: backup, re-read the live log immediately before writing
- back and merge any entries that appeared since the snapshot, then verify
- the post-write header count equals the live pre-write count minus exactly
- the number of archived entries.
-
- ## Log Structure
-
- ```markdown
- # Skill Observation Log
+ across parallel and subsequent sessions. A resolved file with no readable
+ `resolved:` date gets today's date written to that field instead of being
+ archived.
+
+ Archival is now a set of plain `mv` operations, one file at a time — not the
+ read-filter-rewrite of a shared multi-entry file that once destroyed
+ concurrent appends in production. Moving one resolved file cannot affect any
+ other observation, so the old backup / re-read-and-merge / structural-
+ invariant sequence no longer applies. Compare a `resolved:` date to today
+ portably (ISO dates sort lexically):
+
+ ```bash
+ older_than_today() { # $1 = a YYYY-MM-DD date
+ today=$(date +%F)
+ [ "$(printf '%s\n%s\n' "$1" "$today" | sort | head -1)" = "$1" ] \
+ && [ "$1" != "$today" ]
+ }
+ ```
- Observations captured during task-oriented work.
+ ## Storage Layout
- **Status key:** OPEN = not yet actioned | ACTIONED (YYYY-MM-DD) = skill
- updated/created | DECLINED (YYYY-MM-DD) = user decided not to pursue —
- resolved statuses always carry their resolution date
+ ```
+ skill-observations/
- observations/ # active observations, one Markdown file each
++ observation-log/ # the log IS this directory: one file per observation
+ 0001-short-slug.md
+ 0002-short-slug.md
- archive/ # resolved observations, moved here after the grace period
++ archive/ # resolved observations, moved here after the grace period
++ .id-floor # highest id ever issued; the counter never drops below it
++ log-YYYY-MM-DD.md # legacy monolithic archives from pre-3.0 installs, if any
+ cross-cutting-principles.md
+ last-review-date.txt
+ checkpoints.log # append-only acknowledgement markers (optional)
+ ```
- ---
-Each file in `observations/` follows the frontmatter format under "How to
-Log". There is no central index to keep in sync: the directory listing is
-the index, and the frontmatter is the metadata.
++Each file in `observation-log/` follows the frontmatter format under "How
++to Log". There is no central index to keep in sync: the directory listing
++is the index, and the frontmatter is the metadata.
- ## [Date]
+ ## Migrating a legacy log.md
- ### Observation 1: [Title]
- **Status:** OPEN
- [... full format ...]
- ```
-If a single-file `skill-observations/log.md` exists from an earlier version,
-convert it once. For each `### Observation N:` block, create
-`observations/NNNN-<slug>.md` mapping the old fields to frontmatter: `N` →
-`id`, the header title → `title`, `**Status:**` → `status` (`OPEN` →
-`open`; `ACTIONED (date) — note` → `status: actioned` + `resolved: date` +
-`resolution: note`; likewise for `DECLINED`), `**Date:**` → `date`,
-`**Skill:**` → `skill` (`New skill candidate: X` → `skill: new-skill-candidate`
-+ `new_skill: X`), `**Type:**` → `type`, `**Phase/Area:**` → `area`, and
-keep the Issue/Improvement/Principle body plus any `**Session context:**` in
-`session_context`. Do this as a bounded, one-file-at-a-time pass; verify the
-file count matches the number of `### Observation` headers; spot-check a few
-results; then rename the old file to `log.md.migrated` so it is no longer
-scanned.
++Installs upgrading from a pre-3.0 version convert their single-file
++`skill-observations/log.md` once, with the bundled script
++`scripts/migrate-log.py` — see `references/migration.md`. Fresh installs
++never need this section.
## Surfacing Protocol
@@@ -481,12 -412,12 +436,13 @@@ same reference)
| Question | Answer |
|----------|--------|
| When do I observe? | The whole session, including feedback and reflection phases |
- | How do I log? | Silently, immediately, appended to the end, with the 3-step numbering discipline |
+ | How do I log? | Silently, immediately, as one file per observation named `NNNN-slug.md`; id = highest existing prefix + 1 |
| When do I surface? | End of session, or earlier if needed |
- | Status line? | Mandatory `**Status:** OPEN` as the first field of every new observation; reviews treat statusless entries as OPEN, never as nonexistent |
- | Citing an observation number? | Only from its literal `### Observation N:` header — `grep -n` line numbers are positional metadata, not IDs; sanity-check against the known counter range |
+ | Status field? | Mandatory `status: open` frontmatter on every new observation; reviews treat a missing status as OPEN, never as nonexistent |
+ | Citing an observation number? | From the `id:` frontmatter field (matches the `NNNN-` filename prefix); never a `grep -n` line number; sanity-check against the known id range |
| Open-source or internal? | Default open-source; the boundary is confidential |
| Small fix or substantial? | Additive → apply directly; restructuring/new skill → `references/skill-authoring.md` |
- | Rewriting the log (archival/renumber/status)? | Liveness probe (recent mtime or unaccounted-for count → defer archival) → backup → re-read live and merge → bounded mutation → verify count against live pre-write file → confirm own entries survived |
-| Changing an observation (status/archival)? | Re-read that one file, edit only its frontmatter, or `mv` it to `archive/` — no shared-file rewrite, no survival check |
++| Changing an observation (status/archival)? | Re-read that one file, edit only its frontmatter, or `mv` it to `observation-log/archive/` — no shared-file rewrite, no survival check |
++| Upgrading from a single-file `log.md`? | Scripted, once — `references/migration.md` |
| Weekly review? | Trigger check at session start; procedure in `references/weekly-review.md` |
| No filesystem? | Handoff-doc mode — `references/environments.md` |
diff --cc references/environments.md
index dee150b,ae1064d..2cf91e4
--- a/references/environments.md
+++ b/references/environments.md
@@@ -53,10 -53,12 +53,12 @@@ governance-tracked config — many setu
When context compacts mid-task, the CLAUDE.md structural trigger re-invokes
this skill on the resumed session automatically (the resumed session reads
- CLAUDE.md anew). Observations before and after compaction append to the
- same log with continuous numbering. This is the main reason the structural
- trigger exists — a resumed session's opening message may not match the
- description triggers.
+ CLAUDE.md anew). Observations before and after compaction are written as
-separate files under the same `observations/` directory, each with its own
++separate files under the same `observation-log/` directory, each with its own
+ id (the id counter is derived from existing filenames, so it continues
+ seamlessly across the compaction boundary). This is the main reason the
+ structural trigger exists — a resumed session's opening message may not
+ match the description triggers.
## User-facing documentation
@@@ -102,7 -89,8 +104,8 @@@ work
[numbered]
## Observations Logged
- [full entries in standard format]
+ [each observation in the frontmatter format from SKILL.md → How to Log; the
-next session writes each as its own file in `observations/`]
++next session writes each as its own file in `observation-log/`]
## Cross-Cutting Principles (current)
[active or newly added]
diff --cc references/weekly-review.md
index 6a541be,5cd1318..be7d30b
--- a/references/weekly-review.md
+++ b/references/weekly-review.md
@@@ -84,30 -80,30 +84,30 @@@ fallback active. No → write today's d
firings within the window re-surface the offer). No scheduler available in
this environment → skip silently.
- **Step 1 — load.** Archive entries resolved in *previous* sessions (see
- Archival on Write in SKILL.md — including its liveness probe: a minutes-old
- mtime or an unaccounted-for entry count means another session may be
- writing, so defer archival). Read the observation log.
-
- Build the work queue from the structural identifiers, not from a status
- filter. The OPEN set is defined as: **status is literally OPEN, OR the
- observation has no Status line at all.** Concretely:
-
- 1. Enumerate all `### Observation N:` headers first — this is the
- authoritative list of entries in the log.
- 2. For each header, classify the entry's status by looking for a
- `**Status:**` line within its body. Treat a missing, blank, or any
- non-ACTIONED / non-DECLINED status as OPEN.
- 3. Never derive the work queue from a `grep '**Status:** OPEN'` alone.
- Derive it from the header list minus the resolved (ACTIONED /
- DECLINED) entries. A grep on an optional field silently drops every
- entry missing that field — the review then confidently reports a
- clean log while a backlog of untriaged observations is skipped.
+ **Step 1 — load.** Archive observation files resolved in *previous*
+ sessions (see Archival on Write in SKILL.md). Read only the frontmatter of
-each file in `observations/` — not the bodies — to build the work queue;
++each file in `observation-log/` — not the bodies — to build the work queue;
+ load a body only when you actually action that observation in Step 5. This
+ frontmatter-first pass is what keeps the review cheap as the backlog grows.
+
+ Build the work queue from the files themselves, not from a status filter.
+ The OPEN set is defined as: **`status` is literally `open`, OR the file has
+ no `status` field at all.** Concretely:
+
-1. Enumerate every file in `observations/` — the directory listing is the
++1. Enumerate every file in `observation-log/` — the directory listing is the
+ authoritative list of entries.
+ 2. For each file, read the `status` field from its frontmatter. Treat a
+ missing, blank, or any non-`actioned` / non-`declined` status as OPEN.
+ 3. Never derive the work queue from a `grep 'status: open'` alone. Derive
+ it from the file list minus the resolved (`actioned` / `declined`)
+ files. A grep on an optional field silently drops every file missing
+ that field — the review then confidently reports a clean backlog while
+ untriaged observations are skipped.
**Reconciliation guard:** before proceeding, assert that
- `count(### Observation headers) == count(status-classified entries)`.
- If the counts differ, the delta is statusless entries — surface and
- triage them (as OPEN) rather than proceeding as if the log were clean.
-`count(files in observations/) == count(status-classified files)`. If the
++`count(files in observation-log/) == count(status-classified files)`. If the
+ counts differ, the delta is statusless files — surface and triage them (as
+ OPEN) rather than proceeding as if the backlog were clean.
Also read all active cross-cutting principles. If there are no OPEN
observations and no outstanding principles: report "no open observations
@@@ -123,8 -119,8 +123,12 @@@ only the delta, creating it if needed a
configuration.
**Step 3 — cross-check observations.** Evaluate every OPEN observation
--against every skill — not just the skill named in its header; Principles
--often generalise. Build skill → [relevant observations]. Interactive:
++against every skill — not just the skills named in its `skill:` list;
++Principles often generalise. Build skill → [relevant observations], seeding
++it from the frontmatter: every entry in an observation's `skill:` list puts
++it in that skill's bucket (the first entry is primary), and every entry in
++`proposes_skill:` puts it under a new-skill candidate of that name. An
++observation may appear in both. Interactive:
present all of it and await approval. Autonomous: apply the approval policy
above and continue.
@@@ -159,28 -134,13 +163,28 @@@ structure, voice, and attribution; plac
live. Follow the editing rules in `references/skill-authoring.md` (live
file as base, staging, diff-before-overwrite).
+**Scaling note — fan out when the apply-phase is large.** When the
+apply-phase spans more than ~3 skills or ~10 observations, delegate Step 5
+to parallel subagents clustered by skill rather than applying everything
- in the main session. Brief each subagent with: the observation numbers to
- read from the log, the live-mount path, the staging path, the
++in the main session. Brief each subagent with: the observation ids (files) to
++read, the live-mount path, the staging path, the
+mkdir/per-file-cp/`chmod -R u+w` seeding sequence, the integration logic
+for observation interdependencies (which observation supersedes, refines,
+or folds into which — the parent must state this per cluster explicitly,
+or subagents applying observations sequentially produce patch-on-patch
+instead of coherent final state), the confidentiality rules for
- open-source skills, and an explicit do-not-touch-the-log rule. Reserve
- ALL observation-log writes (status marking, archival) for the parent
- session. The principle: the apply-phase is embarrassingly parallel across
- skills but strictly serial on the shared log — split the work along that
- seam.
-
- **Step 6 — mark ACTIONED.** Update each applied observation's status:
- `ACTIONED (YYYY-MM-DD) — Applied to [skill-name] (weekly review)`. The
- date immediately after the status word is load-bearing: archival is gated
- on it (entries archive only when it's before today), so a dateless mark
++open-source skills, and an explicit rule that subagents do not change any observation's
++status. Reserve status marking and archival for the parent session. The principle: the apply-phase is embarrassingly parallel across
++skills but the bookkeeping must have one owner — split the work along
++that seam.
++
+ **Step 6 — mark ACTIONED.** In each applied observation's frontmatter set
+ `status: actioned`, `resolved: YYYY-MM-DD` (today), and
+ `resolution: Applied to [skill-name] (weekly review)` — editing only those
+ fields, in that one file. The `resolved:` date is load-bearing: archival is
+ gated on it (files archive only when it's before today), so a dateless mark
breaks the cross-session grace period. Do NOT archive same-session — the
- next log write on a later day archives them.
+ next write on a later day archives them.
**Step 7 — timestamp.** Write today's date to
`skill-observations/last-review-date.txt`.