diff --git a/.agents/skills/rebasing-adapted-skill/SKILL.md b/.agents/skills/rebasing-adapted-skill/SKILL.md index 10007ed385..1bf058d9ca 100644 --- a/.agents/skills/rebasing-adapted-skill/SKILL.md +++ b/.agents/skills/rebasing-adapted-skill/SKILL.md @@ -19,6 +19,8 @@ Two parts carry it: - The front-matter `attributions` **pin** each upstream skill directory to a GitHub tree URL at a full commit SHA. - The `## Deviations` body lists each intentional difference on an upstream-present path as one natural-language bullet, read as merge **policy**: keep what a bullet protects, and where a bullet is silent, match upstream. It is a policy ledger, not a changelog, so it never chronicles the upstream changes a rebase absorbs. + A verbatim vendor with no intentional differences declares that with the single sentinel bullet `- no current deviations`. + Only that exact physical line, with no other nonblank section content, means the same as an empty section - zero deviations - so a byte-for-byte vendor audits clean while keeping that human-readable line. Scaffold pins, validate a directory, or audit it with `scripts/skill-adaptation.py` (read its `--help` for exact commands and exit codes). diff --git a/.agents/skills/rebasing-adapted-skill/scripts/skill-adaptation.py b/.agents/skills/rebasing-adapted-skill/scripts/skill-adaptation.py index d3991d4ff2..c68325f841 100755 --- a/.agents/skills/rebasing-adapted-skill/scripts/skill-adaptation.py +++ b/.agents/skills/rebasing-adapted-skill/scripts/skill-adaptation.py @@ -18,13 +18,10 @@ import urllib.parse import urllib.request from pathlib import Path -from typing import TYPE_CHECKING, NamedTuple +from typing import NamedTuple import yaml -if TYPE_CHECKING: - from collections.abc import Sequence - EXIT_OK = 0 EXIT_INVALID = 1 EXIT_USAGE = 2 @@ -34,6 +31,8 @@ _ADAPTATION_NAME = "ADAPTATION.md" _SKILL_NAME = "SKILL.md" +_NO_DEVIATIONS_SENTINEL = "- no current deviations" + # Environment override: read pinned base files from a local cache tree instead # of the network, so an audit runs deterministically and air-gapped. Layout: # /////. Used by the offline tests. @@ -93,6 +92,11 @@ difference is uncovered (the next rebase would silently revert it); - stale deviations: deviations are declared but NO difference exists, so every bullet maps to nothing. + A ## Deviations section whose sole nonblank content is the exact physical line + "- no current deviations" is the sentinel a verbatim vendor uses to declare + zero intentional differences. It reads as no deviations (never a stale + bullet), so a byte-for-byte vendor audits clean while keeping that + human-readable line instead of an empty section. When both differences and deviations are present, the script cannot prove which covers which, so it presents both sides and exits 0; confirming that each difference has a covering bullet and each bullet a live difference is the @@ -280,13 +284,9 @@ def load_attributions(skill_dir: Path) -> list[Attribution]: return [parse_attribution(url) for url in urls] # type: ignore[union-attr] -def parse_deviation_bullets(body: str) -> list[str]: - """Return the ``## Deviations`` bullet texts, minus angle-bracket stubs. - - A stub bullet like ``- `` is the unedited template - placeholder, not a real declaration, so it does not count as a deviation. - """ - bullets: list[str] = [] +def _deviation_section_lines(body: str) -> list[str]: + """Return physical lines from the exact ``## Deviations`` section.""" + lines: list[str] = [] in_section = False for raw in body.splitlines(): if raw == "## Deviations": @@ -295,8 +295,19 @@ def parse_deviation_bullets(body: str) -> list[str]: if re.match(r"^#{1,6}(?:\s|$)", raw) is not None: in_section = False continue - if not in_section: - continue + if in_section: + lines.append(raw) + return lines + + +def _collect_deviation_bullets(body: str) -> list[str]: + """Return the raw ``## Deviations`` bullet texts, minus angle-bracket stubs. + + A stub bullet like ``- `` is the unedited template + placeholder, not a real declaration, so it does not count as a deviation. + """ + bullets: list[str] = [] + for raw in _deviation_section_lines(body): item = re.match(r"^[-*]\s+(.*)$", raw.strip()) if item is None: continue @@ -308,11 +319,49 @@ def parse_deviation_bullets(body: str) -> list[str]: return bullets -def read_deviation_bullets(skill_dir: Path) -> list[str]: - """Read ``## Deviations`` bullets from a skill directory's ADAPTATION.md.""" +def is_no_deviations_sentinel(body: str) -> bool: + """Whether the deviations section contains the exact sentinel line alone. + + A ``## Deviations`` section whose sole nonblank content is the physical line + ``- no current deviations`` declares that the skill is a verbatim vendor with + zero intentional differences. It is kept as a human-readable line rather than + an empty section, but it means the same thing: no deviations to protect. + """ + content = [line for line in _deviation_section_lines(body) if line.strip()] + return content == [_NO_DEVIATIONS_SENTINEL] + + +def parse_deviation_bullets(body: str) -> list[str]: + """Return the declared ``## Deviations`` bullets, or ``[]`` for none. + + Two forms declare zero deviations, both collapsing to an empty list: the + unedited angle-bracket placeholder, and the sole ``- no current deviations`` + sentinel (see :func:`is_no_deviations_sentinel`). + """ + bullets = _collect_deviation_bullets(body) + if is_no_deviations_sentinel(body): + return [] + return bullets + + +def read_deviation_ledger(skill_dir: Path) -> tuple[list[str], bool]: + """Read a skill's ``## Deviations`` as ``(declared_bullets, is_sentinel)``. + + ``declared_bullets`` is empty when zero deviations are declared, and the + boolean records whether that emptiness came from the ``- no current + deviations`` sentinel so callers can echo the human-readable line. + """ text = (skill_dir / _ADAPTATION_NAME).read_text(encoding="utf-8") _front, body = split_front_matter(text) - return parse_deviation_bullets(body) + bullets = _collect_deviation_bullets(body) + sentinel = is_no_deviations_sentinel(body) + return ([] if sentinel else bullets), sentinel + + +def read_deviation_bullets(skill_dir: Path) -> list[str]: + """Read ``## Deviations`` bullets from a skill directory's ADAPTATION.md.""" + bullets, _sentinel = read_deviation_ledger(skill_dir) + return bullets def _read_base_from_cache( @@ -445,6 +494,7 @@ class AuditResult(NamedTuple): drift: list[Drift] bullets: list[str] + no_deviations_sentinel: bool = False @property def undeclared_drift(self) -> list[Drift]: @@ -468,8 +518,10 @@ def audit_skill_dir(skill_dir: Path) -> AuditResult: for attribution in load_attributions(skill_dir): base_files = fetch_base_files(attribution) drift.extend(compute_drift(attribution, base_files, skill_dir)) - bullets = read_deviation_bullets(skill_dir) - return AuditResult(drift=sorted(drift), bullets=bullets) + bullets, sentinel = read_deviation_ledger(skill_dir) + return AuditResult( + drift=sorted(drift), bullets=bullets, no_deviations_sentinel=sentinel + ) def _render_audit_report(skill_dir: Path, result: AuditResult) -> list[str]: @@ -488,6 +540,9 @@ def _render_audit_report(skill_dir: Path, result: AuditResult) -> list[str]: lines.append("declared deviations (## Deviations):") if result.bullets: lines.extend(f" - {b}" for b in result.bullets) + elif result.no_deviations_sentinel: + lines.append(f" {_NO_DEVIATIONS_SENTINEL}") + lines.append(" (sentinel: declares zero deviations - treated as match-upstream)") else: lines.append(" none") lines.append("") diff --git a/.agents/skills/writing-for-agents/ADAPTATION.md b/.agents/skills/writing-for-agents/ADAPTATION.md new file mode 100644 index 0000000000..4db4336b18 --- /dev/null +++ b/.agents/skills/writing-for-agents/ADAPTATION.md @@ -0,0 +1,8 @@ +--- +attributions: +- https://github.com/mattpocock/skills/tree/4aaccb58d40559d7e3c59a029b2290ae5ba538de/skills/productivity/writing-for-agents +--- + +## Deviations + +- no current deviations diff --git a/.agents/skills/writing-for-agents/SKILL-MECHANICS.md b/.agents/skills/writing-for-agents/SKILL-MECHANICS.md new file mode 100644 index 0000000000..c28e3bf035 --- /dev/null +++ b/.agents/skills/writing-for-agents/SKILL-MECHANICS.md @@ -0,0 +1,22 @@ +# Skill mechanics + +The skill-specific branch of [`writing-for-agents`](SKILL.md): what changes when the document is a skill — frontmatter, the invocation choice, and router skills. Everything else about writing it is the universal reference in `SKILL.md`. + +## Invocation + +Two choices, trading the two loads: + +- A **model-invoked** skill keeps a `description`, so the agent can fire it autonomously — and other skills can reach it. You can still type its name: model-invocation always _includes_ user reach; a description only ever adds agent discovery, never removes the human's. The description is the skill's top-level context pointer, forced to stay loaded at all times — permanent context load in exchange for discoverability. A model-invoked skill whose content is all reference is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Mechanics: omit `disable-model-invocation`, and write a model-facing description carrying the trigger branches (the pointer-writing rules in `SKILL.md` apply in full). +- A **user-invoked** skill strips the description from the agent's reach: only the human typing its name can invoke it, and no other skill can. Zero context load, but it spends cognitive load — you are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing — a one-line summary, trigger lists stripped. + +Pick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load. + +Shared reference that two user-invoked skills both need can live in neither — with no descriptions, neither can fire the other. Push it to a plain file outside the skill system: external reference any skill can point at. + +## Splitting by invocation + +The invocation cut of splitting (the sequence cut lives in `SKILL.md`): split off a model-invoked skill when you have a distinct leading word that should trigger it on its own — a trigger word you actually use in your prompts — or another skill must reach it. You pay context load for the new always-loaded description, so that independent reach has to be worth it. + +## Router skills + +When user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each, so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no description, so nothing but the human can reach them. diff --git a/.agents/skills/writing-for-agents/SKILL.md b/.agents/skills/writing-for-agents/SKILL.md new file mode 100644 index 0000000000..c059d48cd7 --- /dev/null +++ b/.agents/skills/writing-for-agents/SKILL.md @@ -0,0 +1,81 @@ +--- +name: writing-for-agents +description: Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md. +--- + +Reference for writing any document an agent consumes — a skill, an `AGENTS.md` / `CLAUDE.md`, a doc reached by a pointer. The packaging differs; the writing does not: the same levers make each one predictable — the agent taking the same _process_ every run, not producing the same output. + +When the document you're writing is a skill, read [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md) for frontmatter, invocation choice, and router skills. + +## Context pointers + +A **context pointer** is a reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. A skill's description is one; a line in `AGENTS.md` naming a doc is the same object. The pointer's _wording_, not its target, decides when the agent reaches the material — and how reliably. A must-have target behind a weakly worded pointer is a variance bug: sharpen the wording first, and inline the material only if sharpening fails. + +A pointer does two jobs — state what the material is, and list the **branches** that should trigger reaching it (a branch is a distinct case the document handles, so different runs take different paths through it). Every word of an always-loaded pointer costs on every turn, so it earns even harder pruning than the body: + +- **Front-load the leading word** — the pointer is where it does its triggering work. +- **One trigger per branch.** Synonyms that rename a single branch are one branch written twice; collapse them and keep only genuinely distinct branches. +- **Cut identity the body already carries.** + +## The two loads + +Every document and pointer you add spends one of two budgets: + +- **Context load** — the cost of always-loaded material on the agent's window: an `AGENTS.md` line, a skill description, anything sitting in context every turn, spending tokens and attention whether or not it fires. +- **Cognitive load** — the cost on the human: which documents exist and when to reach for each. The human is the index. Not a cost to minimise — it is the price of human agency; spend it where human judgement matters, remove it where it does not. + +Material reached only through a pointer escapes context load at the price of the pointer's own line; material with no pointer at all rides entirely on cognitive load. + +## Information hierarchy + +A document is built from two content types — **steps** (the ordered actions the agent performs) and **reference** (definitions, rules, facts consulted on demand) — that mix freely: all steps (a recipe), all reference (a review's rules, this skill), or both. The core decision is where each piece sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material: + +1. **In-file step** — the primary tier: what the agent does, in order. +2. **In-file reference** — consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung) — a fine arrangement, not a smell. +3. **Disclosed reference** — pushed out into a separate file, reached by a context pointer, loaded only when the pointer fires. Spans a sibling file in the same folder through fully external reference that lives anywhere and any document can point at. + +Push too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision. + +**Progressive disclosure** is the move down the ladder — out of the main file and behind a pointer — so the top stays legible. Not primarily a token optimisation: it is how the hierarchy is protected. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. When a document has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip — a variance lever, not just a legibility one. + +**Co-location** is the within-file companion: where the ladder decides _how far down_ a piece sits, co-location decides _what sits beside it_ once there. Keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it. The test: the document should read like documentation written for the agent — grouped material reads that way; scattered material does not. (Distinct from duplication: that repeats one meaning in two places; scattering fragments one meaning across many.) + +**Sprawl** is the failure mode here: a document simply too long, even when every line is live and unique. Attention thins across the excess, and every extra line is one more to keep relevant. The cure is the ladder: disclose reference behind pointers, and split by branch or sequence so each path carries only what it needs. + +## Steps and completion criteria + +Every step ends on a **completion criterion** — the condition that tells the agent the work is done. Two properties make it a lever: + +- **Clarity** — can the agent tell done from not-done? A vague bound ("understanding reached") invites **premature completion**: ending the step before it is genuinely done, attention slipping to _being done_. The visible steps still ahead — the **post-completion steps** — supply the pull; the criterion's clarity is the resistance. Defend in order: **sharpen the bound first** (local and cheap); only if it is irreducibly fuzzy _and_ you observe the rush, hide the later steps by splitting the sequence — and hiding only works across a real context boundary (a hand-off or a subagent dispatch; an inline call leaves the later steps in context and clears nothing). +- **Demand** — how much it requires. "Every modified model accounted for" forces thorough work where "produce a change list" does not. Demand drives **legwork** — the digging the agent does within the work, latent in the wording rather than written as its own step — and it is not step-bound: "every rule applied" binds a body of flat reference just as "every step done" binds a sequence, which is how an all-reference document still carries an exhaustiveness bar. + +The strongest criteria are both checkable and exhaustive. + +## When to split + +Splitting one document into two spends one of the two loads, so split only when the cut earns it: + +- **By sequence** — split a run of steps where the post-completion steps tempt the agent to rush the one in front of it. Keeping them out of view drives more legwork on the current task. Beware the reverse: merging sequences exposes each step's later steps to what follows, inviting premature completion. +- **By invocation** — skill-specific: see [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md). + +## Leading words + +A **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the document (_lesson_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds. Coining your own works if you define it clearly, but a made-up word recruits no priors — you pay in definition tokens what a pretrained word gives free; reach for an existing word first. + +It anchors twice. In the body, _execution_: the agent reaches for the same behaviour every time the word appears, and inside flat reference it focuses attention on a class of thing to look for. In a pointer, _invocation_: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the material and reaches it more reliably. + +Hunt for opportunities to refactor with leading words. A triad spelled out at three sites, a pointer spending a sentence to gesture at one idea — each is a passage begging to collapse into a single token: + +- "fast, deterministic, low-overhead" → _tight_ (a _tight_ loop). +- "a loop you believe in" → _red_ — a fuzzy gate becomes a binary observable state (the loop goes _red_ on the bug, or it doesn't). + +You win twice: fewer tokens, and a sharper hook for the agent to hang its thinking on. Assume every document is carrying restatements that leading words retire — go find them. + +**Negation** is the failure mode beside this lever: steering by prohibition drags the forbidden behaviour into context and makes it _more_ available, not less. _Don't think of an elephant_, and the elephant is all there is; the negation is a weak modifier the strongly-activated concept overruns, so the ban half-reads as an instruction to do the thing. Prompt the **positive** — state the target behaviour ("write one-line comments") so the banned one is never spoken. A prohibition earns its place only as a hard guardrail you cannot phrase positively; even then, pair it with the positive target so attention lands on what to do. + +## Pruning + +- Keep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit. **Duplication** — the same meaning in more than one place — costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank. (The accidental inverse of a leading word, which repeats a token on purpose, never the meaning.) +- The **environment** is a source of truth too — `package.json` scripts, config files, the directory layout, `--help` output — and a document that restates it is a **cache**: a copy of a lookup, earning its load only when the lookup is expensive. Cache what the agent cannot find by looking: the unwritten convention, the reason behind a choice, the gotcha no config confesses. Leave the one-file, one-command lookups to the environment, where they cannot go stale. +- Check every line for **relevance**: does it still bear on what the document does? A line loses relevance by never bearing on the task (mere exposition, or a branch that should be disclosed) or by going stale as the behaviour or world it describes changes. Shorter documents are easier to keep relevant. Without a pruning discipline the default fate is **sediment**: stale layers that settle because adding feels safe and removing feels risky, until you must core down through them to find what is still live. +- Hunt **no-ops** sentence by sentence: an instruction the model already obeys by default pays load to say nothing. The test — does it change behaviour versus the default? — is model-relative, not reader-relative: two people disagreeing about a no-op disagree about the default, and settle it by running the document, not by debate. When a sentence fails, delete the whole sentence rather than trim words from it. The test also grades leading words: a word too weak to beat the default (_be thorough_ when the agent is already thorough-ish) is a no-op, and the fix is a stronger word (_relentless_), not a different technique. diff --git a/.agents/skills/writing-for-agents/agents/openai.yaml b/.agents/skills/writing-for-agents/agents/openai.yaml new file mode 100644 index 0000000000..079c933b75 --- /dev/null +++ b/.agents/skills/writing-for-agents/agents/openai.yaml @@ -0,0 +1,3 @@ +interface: + display_name: "Writing for Agents" + short_description: "Write documents agents consume" diff --git a/AGENTS.md b/AGENTS.md index 3d4bac5806..5a298dbde8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -515,6 +515,7 @@ These skills are not captain-invocable; load them only at their precise triggers - `firstmate-codexapp` - load before coordinating a visible Codex Desktop thread, evaluating a Codex App backend request, or reconciling Codex Desktop host-tool smoke evidence for Firstmate work. - `firstmate-coding-guidelines` - load before changing firstmate's shared, tracked material, as defined by section 1's list, whether editing directly or briefing a crewmate for a firstmate-repo task. - `rebasing-adapted-skill` - load before rebasing a vendored (upstream-tracked) skill onto a newer upstream tip, or auditing whether its declared deviations are still honest; the skill owns the rebase workflow, and its colocated `scripts/skill-adaptation.py` owns pin validation and audit mechanics. +- `writing-for-agents` - load before creating or editing a skill, or modifying `AGENTS.md` or `CLAUDE.md`. ## 14. X mode diff --git a/docs/documentation-audiences.json b/docs/documentation-audiences.json index 26a029164f..9263ce9de7 100644 --- a/docs/documentation-audiences.json +++ b/docs/documentation-audiences.json @@ -196,6 +196,18 @@ "path": ".agents/skills/updatefirstmate/SKILL.md", "audience": "agent-runtime" }, + { + "path": ".agents/skills/writing-for-agents/ADAPTATION.md", + "audience": "agent-runtime" + }, + { + "path": ".agents/skills/writing-for-agents/SKILL-MECHANICS.md", + "audience": "agent-runtime" + }, + { + "path": ".agents/skills/writing-for-agents/SKILL.md", + "audience": "agent-runtime" + }, { "path": "AGENTS.md", "audience": "agent-runtime" diff --git a/tests/fm-skill-adaptation.test.sh b/tests/fm-skill-adaptation.test.sh index 7f7b3a5a9e..3556fde37f 100755 --- a/tests/fm-skill-adaptation.test.sh +++ b/tests/fm-skill-adaptation.test.sh @@ -133,6 +133,75 @@ test_placeholder_bullet_is_not_a_deviation() { pass "audit: an angle-bracket placeholder bullet is not a declaration" } +test_sentinel_no_deviations_is_clean() { + local sk + sk=$(fresh_case sentinel_clean) + # base == ours (a verbatim vendor) with the "no deviations" sentinel: the + # single literal line means zero deviations, so it must audit clean, not stale. + write_adaptation "$sk" "$ATTR" <<<'- no current deviations' + audit_case sentinel_clean + expect_code 0 "$RC" "the no-deviations sentinel over a clean tree is clean" + assert_contains "$OUT" "clean:" "sentinel is treated as zero declared deviations" + assert_contains "$OUT" "no current deviations" "sentinel line is echoed in the report" + assert_contains "$OUT" "sentinel:" "the report explains the sentinel" + assert_not_contains "$OUT" "STALE DEVIATIONS" "sentinel is never a stale bullet" + pass "audit: a sole '- no current deviations' sentinel audits clean (exit 0)" +} + +test_sentinel_with_drift_is_undeclared() { + local sk + sk=$(fresh_case sentinel_drift) + printf 'local edit\n' >"$sk/SKILL.md" + # The sentinel declares zero deviations, so a real local edit under it is + # undeclared drift the next rebase would revert - not a covered change. + write_adaptation "$sk" "$ATTR" <<<'- no current deviations' + audit_case sentinel_drift + expect_code 1 "$RC" "drift under the sentinel is undeclared" + assert_contains "$OUT" "UNDECLARED DRIFT" "sentinel does not cover a real difference" + pass "audit: real drift under the sentinel is undeclared drift (exit 1)" +} + +test_sentinel_beside_real_bullet_is_not_collapsed() { + local sk stubbed + sk=$(fresh_case sentinel_plus) + # The sentinel only means "none" when it is the section's ONLY bullet; beside a + # real bullet both are ordinary declarations, stale here over a clean tree. + write_adaptation "$sk" "$ATTR" <<<$'- no current deviations\n- keep our stricter opening line' + audit_case sentinel_plus + expect_code 1 "$RC" "sentinel beside another bullet is not the empty sentinel" + assert_contains "$OUT" "STALE DEVIATIONS" "both bullets are real declarations over no diff" + assert_contains "$OUT" "no current deviations" "the non-collapsed sentinel bullet is shown" + + stubbed=$(fresh_case sentinel_plus_stub) + write_adaptation "$stubbed" "$ATTR" <<<$'- no current deviations\n- ' + audit_case sentinel_plus_stub + expect_code 1 "$RC" "a placeholder beside the sentinel prevents collapse" + assert_contains "$OUT" "STALE DEVIATIONS" "placeholder filtering cannot create a sentinel" + pass "audit: the sentinel collapses only when it is the sole bullet" +} + +test_star_sentinel_is_not_collapsed() { + local sk + sk=$(fresh_case sentinel_star) + write_adaptation "$sk" "$ATTR" <<<'* no current deviations' + audit_case sentinel_star + expect_code 1 "$RC" "a star-marked near-miss is an ordinary deviation" + assert_contains "$OUT" "STALE DEVIATIONS" "star marker does not form the literal sentinel" + assert_not_contains "$OUT" "sentinel:" "star near-miss is not reported as the sentinel" + pass "audit: a star-marked sentinel near-miss is rejected" +} + +test_padded_sentinel_is_not_collapsed() { + local sk + sk=$(fresh_case sentinel_padded) + write_adaptation "$sk" "$ATTR" <<<' - no current deviations ' + audit_case sentinel_padded + expect_code 1 "$RC" "a whitespace-padded near-miss is an ordinary deviation" + assert_contains "$OUT" "STALE DEVIATIONS" "padding does not form the literal sentinel" + assert_not_contains "$OUT" "sentinel:" "padded near-miss is not reported as the sentinel" + pass "audit: a whitespace-padded sentinel near-miss is rejected" +} + test_variant_heading_is_not_the_ledger() { local sk sk=$(fresh_case variant_heading) @@ -261,6 +330,11 @@ test_undeclared_removed test_stale_bullet test_mixed_presents_both_sides test_placeholder_bullet_is_not_a_deviation +test_sentinel_no_deviations_is_clean +test_sentinel_with_drift_is_undeclared +test_sentinel_beside_real_bullet_is_not_collapsed +test_star_sentinel_is_not_collapsed +test_padded_sentinel_is_not_collapsed test_variant_heading_is_not_the_ledger test_quiet_predicate test_fetch_failure_fails_loudly