diff --git a/OKF/ROADMAP.md b/OKF/ROADMAP.md index 4e42b56..462f6dc 100644 --- a/OKF/ROADMAP.md +++ b/OKF/ROADMAP.md @@ -25,7 +25,7 @@ behind that claim, and what it debunked: [LEARNINGS.md](LEARNINGS.md). ## Locked decisions -17 live, in the why-register: [decisions/index.md](decisions/index.md). +18 live, in the why-register: [decisions/index.md](decisions/index.md). Each line is the question its decision settles. Cite by number. ## Architecture @@ -86,10 +86,12 @@ See [ARCHITECTURE.md](ARCHITECTURE.md); loop diagram in `README.md`. (blueprint 002) and 2026-07-22 (003; fixture moored by hand, okf-check clean there and on OKF/, caps hold). Refresh's DRIFT rule is prose — no runner, per 003's out-of-scope. +8. **Rescan on refresh** — refresh proposes a plan delta (new / standing + / unwarranted) the user locks; removal per 018. **Verify:** 006's + fixture — a wholly derived unwarranted page goes, a judgement-bearing + one is superseded, a container proposes nothing. ✅ verified 2026-07-22. -**Execution order: 7 → 6.** Phase 7 is small, closes the cap breach now, -and makes octobot's own OKF *run* the register before phase 6 freezes it -into a contract for other repos. Numbers stay as issued — append-only. +**Executed 7 → 6.** Numbers stay as issued — append-only. ## Risks & gotchas diff --git a/OKF/blueprints/006-rescan-the-page-plan-on-refresh.md b/OKF/blueprints/006-rescan-the-page-plan-on-refresh.md index 5ed0ed2..cf87007 100644 --- a/OKF/blueprints/006-rescan-the-page-plan-on-refresh.md +++ b/OKF/blueprints/006-rescan-the-page-plan-on-refresh.md @@ -1,6 +1,6 @@ --- type: Blueprint -status: locked +status: implemented traces-to: 005's Out of scope (rescan on refresh); ROADMAP.md phase 8, added by this change --- diff --git a/OKF/decisions/018-rescan-deletes-only-derived-pages.md b/OKF/decisions/018-rescan-deletes-only-derived-pages.md new file mode 100644 index 0000000..f5f4a0d --- /dev/null +++ b/OKF/decisions/018-rescan-deletes-only-derived-pages.md @@ -0,0 +1,23 @@ +--- +type: Decision +purpose: Let a rescan drop a page it can rebuild, and only that one. +answers: + - "What happens to a page a rescan no longer proposes?" +cites: + - skills/loop/write-OKF/taxonomy-scan.md + - OKF/decisions/010-two-zone-pages.md +status: live +reversible: supersede every unwarranted page, delete none +--- + +# 018 — a rescan deletes only wholly derived pages + +An **unwarranted** page — listed under `modules/`/`analyses/`, no longer +proposed — is **deleted only if it is wholly derived**: nothing outside +its [010](010-two-zone-pages.md) `okf:derived` fences but frontmatter and +title. Such a page loses nothing a rescan cannot rebuild. One byte of +judgement and it is **superseded** instead, struck with a pointer per +`write-OKF/SKILL.md` refresh step 3; either way +[015](015-moor-collapses-ferry-directory.md) holds — history is the +archive of record, not the OKF. Removal is proposed, never applied +unasked: the user locks it as they lock the plan. diff --git a/OKF/decisions/index.md b/OKF/decisions/index.md index c9c3dcf..65c10b4 100644 --- a/OKF/decisions/index.md +++ b/OKF/decisions/index.md @@ -29,3 +29,4 @@ Format: `NNN — — — `. - [015](015-moor-collapses-ferry-directory.md) — What shape does a ferry take once it is moored? — one page, pinned with `sealed:` — live - [016](016-one-okf-check-validator.md) — How is OKF conformance enforced? — `okf-check`, output pasted — live - [017](017-pin-drift-splits-by-visibility.md) — Why doesn't `okf-check` verify that a `sealed:` pin resolves? — it cannot see the repo; refresh owns resolution — live +- [018](018-rescan-deletes-only-derived-pages.md) — What happens to a page a rescan no longer proposes? — deleted if wholly derived, else superseded — live diff --git a/OKF/index.md b/OKF/index.md index 2f9fdf5..49572f0 100644 --- a/OKF/index.md +++ b/OKF/index.md @@ -18,7 +18,7 @@ your task needs. Humans welcome too. ## Decisions - [decisions/index.md](decisions/index.md) — the why-register, indexed by - the question each decision settles. 17 live. + the question each decision settles. 18 live. ## Blueprints @@ -27,7 +27,7 @@ your task needs. Humans welcome too. - [003](blueprints/003-graduate-and-collapse-ferries.md) — graduate ferry decisions and collapse the moored ferry — implemented - [004](blueprints/004-give-cites-teeth-and-fence-derived-zone.md) — give cites teeth and fence the derived zone — implemented - [005](blueprints/005-propose-the-page-plan-from-a-repo-scan.md) — propose the page plan from a repo scan — implemented -- [006](blueprints/006-rescan-the-page-plan-on-refresh.md) — rescan the page plan on refresh — locked +- [006](blueprints/006-rescan-the-page-plan-on-refresh.md) — rescan the page plan on refresh — implemented ## Ferries diff --git a/skills/loop/write-OKF/SKILL.md b/skills/loop/write-OKF/SKILL.md index 6a0b0c0..b39c084 100644 --- a/skills/loop/write-OKF/SKILL.md +++ b/skills/loop/write-OKF/SKILL.md @@ -50,6 +50,12 @@ contract: [okf-layout.md](okf-layout.md). ## Refresh mode 1. **Diff wiki against reality**: code and manifests on disk, `jj log` (or `git log`) since the last scribe commit, session learnings. + **Rescan the page plan** — `scripts/okf-scan `, sorted + against `index.md`'s `modules/`/`analyses/` lines into new / standing + / unwarranted, and locked by the user as at scaffold; nothing is added + or removed unasked. An unwarranted page is deleted only when wholly + derived, else superseded per step 3. Contract: + [taxonomy-scan.md](taxonomy-scan.md). 2. **Smallest edit per delta** — never rewrite a page wholesale. 3. **Supersede, don't delete**: outdated claims get struck with a pointer to the replacement, mirroring diff --git a/skills/loop/write-OKF/scripts/okf-scan b/skills/loop/write-OKF/scripts/okf-scan index ae266cf..c0ed416 100755 --- a/skills/loop/write-OKF/scripts/okf-scan +++ b/skills/loop/write-OKF/scripts/okf-scan @@ -29,13 +29,21 @@ def directories(root): yield path +def entries(directory): + """Files and directories inside, or none — a permission bit is not a plan.""" + try: + return sorted(directory.iterdir()) + except OSError: + return [] + + def analysis_evidence(directory): """A directory holding a notebook, or one named analysis/analyses. The notebook wins as evidence when both hold — a file is the more concrete warrant. """ - for entry in sorted(directory.iterdir()): + for entry in entries(directory): if entry.is_file() and entry.suffix in NOTEBOOKS: return entry return directory if directory.name in ("analysis", "analyses") else None @@ -45,7 +53,7 @@ def module_evidence(directory, root): """A directory holding code, one level under the root or a source root.""" if str(directory.relative_to(root).parent) not in (".", *SOURCE_ROOTS): return None - for entry in sorted(directory.iterdir()): + for entry in entries(directory): if entry.is_file() and entry.suffix in CODE: return entry return None @@ -60,7 +68,7 @@ def main(argv): print(f"not a directory: {root}", file=sys.stderr) return 2 - plan = {} + plan, containers, warranted = {}, {}, [] for directory in directories(root): evidence, page = analysis_evidence(directory), "analyses" if evidence is None: @@ -70,9 +78,19 @@ def main(argv): page = f"{page}/{directory.name}.md" if page in plan: continue + # Matched by name alone: a container, warranted only until a + # member speaks for itself. + if evidence is directory: + containers[page] = directory + else: + warranted.append(directory) rel = evidence.relative_to(root) plan[page] = f"{rel}/" if evidence.is_dir() else str(rel) + for page, container in containers.items(): + if any(container in member.parents for member in warranted): + del plan[page] + for page in sorted(plan): print(f"{page} — {plan[page]}") return 0 diff --git a/skills/loop/write-OKF/taxonomy-scan.md b/skills/loop/write-OKF/taxonomy-scan.md index 506473a..6755651 100644 --- a/skills/loop/write-OKF/taxonomy-scan.md +++ b/skills/loop/write-OKF/taxonomy-scan.md @@ -16,7 +16,8 @@ index.md-ready, and exits 0 whatever it finds (2 on usage): ``` Every line names the disk evidence that warranted it. **No evidence, no -line.** The scan writes no page, edits no `index.md`, ranks nothing, and +line** — an unreadable directory included, a permission bit being no page +plan. The scan writes no page, edits no `index.md`, ranks nothing, and removes nothing — culling is the user's, at lock time. It is not a validator either; `okf-check` owns conformance. @@ -26,8 +27,9 @@ Both directory-shaped, both language-blind. Dot-directories and the repo's own `OKF/` are skipped. - **`analyses/.md`** — a directory holding a `.ipynb`, `.Rmd`, or - `.qmd`, or one named `analysis`/`analyses`. One page each, named for - the directory; the notebook is the evidence when both hold. + `.qmd`, or one named `analysis`/`analyses` with no candidate beneath it + (*Rescan on refresh*, below). One page each, named for the directory; + the notebook is the evidence when both hold. - **`modules/.md`** — a directory holding at least one code file, one level under the repo root or under a single source root (`src/`, `lib/`, `R/`), and not already an analyses candidate. @@ -62,3 +64,34 @@ shell is written for it. `okf-check` cuts both ways here — an absent link target is skipped, so plan-without-page is legal, while a page nobody lists errors `not reachable from index.md`. An unwritten page cannot be an empty ceremonial one. + +## Rescan on refresh + +**Refresh proposes a plan delta; it still never writes and never culls.** +Rescan runs the scan again and sorts every candidate, and every +`modules/`/`analyses/` line already in `index.md`, into three buckets: + +- **new** — a candidate `index.md` does not list → propose to add. +- **standing** — listed and still proposed → keep. Its derived zone is + regenerated wholesale, its judgement zone untouched, per + [010](../../../OKF/decisions/010-two-zone-pages.md). +- **unwarranted** — listed but no longer proposed → propose to remove or + supersede, below. + +The user locks the delta exactly as at scaffold; no bucket is applied +unasked. **Jurisdiction is `modules/` and `analyses/` only** — a page no +scan can see is never proposed for removal. + +**An unwarranted page is deleted only if it is wholly derived** — +nothing outside its `okf:derived` fences but frontmatter and title, so it +loses nothing a rescan cannot rebuild. One byte of judgement and it is +superseded instead, struck with a pointer per [SKILL.md](SKILL.md) +refresh step 3. Decision +[018](../../../OKF/decisions/018-rescan-deletes-only-derived-pages.md). + +**A container proposes nothing; its members do.** A directory matched by +name alone with a candidate beneath it yields no page: +`analysis/2026-cohort/report.Rmd` proposes `analyses/2026-cohort.md` and +not `analyses/analysis.md`. A directory holding a notebook is a candidate +whatever its name. Without the rule a container culled by hand at +scaffold returns every rescan.