Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

docs(loop-repair): a filmed ghost is a round of video-loop's jump repair; the ghost guard and source-restoration-v5

Soohong Kime51fa6dc5463
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ba36bd..40e775c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,11 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **Correction to 2.43.0's cross-fade measure:** "the windows step by half their size, so one lost pixel is counted in up to four of them" holds where the window is an even number of pixels wide. The step is half the width rounded down, so an odd-width window counts one pixel in up to nine. The `rife.crossfade` docstring and `docs/loop-repair.md` section 4 now say "up to four of them (nine where the window is an odd number of pixels wide)". The measure is unchanged.
- **Output change: a filmed ghost with no clean frame beside it is a take to film again — `retake` reason `filmed-ghost`.** Since 2.43.0 `video-cycle-align` delivers a filmed ghost only where the source frames on both sides of its time are ghosts too, and said so in a warning line alone: the loop's `retake` stayed `null`, so a pipeline that films a direction again on `retake` delivered the ghost. Such a loop is now named: its row's `retake` (and the report's, and `video-set`'s) reads `reason: "filmed-ghost"` with `ghost` — the cells `kept`, their frames of `cycle.source/` (`sources`), the highest reading (`ghost_max`) and the screen's `limit` — and `limits.ghost_kept_min` (one cell, `align.RETAKE_GHOST_KEPT_MIN`), with a line "film this direction again (filmed-ghost) — …". `retake` stays one object: `reason` is the first that applies (`held-drawings`, then `filmed-ghost`), the new `reasons` lists every one (`["held-drawings"]` for a held loop as before), and the held numbers stand only where that reason applies. Each `ghost_at` cell that keeps its ghost says why (`kept`: `no-clean-frame`, under any `--between`, or `between-rife` where `--between rife` kept it beside a clean frame — the aligner's choice, not counted). The set is aligned as before (`applied: true`, exit 0). Docs: `docs/loop-repair.md` section 4 (filmed ghost), `docs/video-pipeline.md`.
- **Fix: a made frame given way at a cell that keeps its ghost no longer says the nearer source frame settled it.** Its line said "so the nearer source frame was taken there" where that frame was itself a filmed ghost, delivered for want of a clean one; it now says "the nearer source frame, a filmed ghost, was kept there, the frames beside it being filmed ghosts too". A ghost `--between rife` kept with no clean frame beside it is named "film this direction again", no longer told to align with `auto` for a clean frame that is not there.
+- **Output change: a walk delivered as cut gives its filmed ghost way — `video-loop`'s jump repair stage.** A walk filmed in one direction never meets `video-cycle-align`, which takes a clean frame beside a filmed ghost, so its strip, GIF and WebP delivered the ghost as cut: 2.43.0 named it in a `warning:` line and changed no pixel, and only a band wide enough to read as a jump was replaced, by the jump repair, by chance. The ghost screen now reads the cut as filmed, before the jump repair (`ghost_screen` names a ghost the repair replaced, where it was read after it before), and each ghost it names is a round of that repair, first and outside its three-call budget (`why: "ghost"`; the jump rounds now say `why: "jump"`): RIFE's frame between the two frames beside it where both are clean and the frame has no fault (`taken: "rife"`), else the clean frame beside it — the one after, else the one before, the alignment's own choice at a time on a ghost (`interpolation_quality.clean_beside`, `taken: {"source": k}`) — else, both being filmed ghosts too, the ghost kept (`taken: null`). A ghost round also records `neighbours`, `outcome` (`accepted`, `given-way`, `kept`) and `no_proposal` where no frame was made. A cell given way is in `jump_repair.replaced`, so the seam gate reads rendered cells, the jumps are read after it and never made beside it, and the source projection reads it as a repair hint. The report and its summary carry `ghost_given_way` (`frame`, `ghost`, `taken`) and `ghost_kept` (`frame`, `ghost`), and the strip metadata each where it is not empty — `cycle/` is the alignment's `cycle.source/`, whose screen no longer sees a ghost given way, so an alignment carries the record over. A `warning:` line names each ("… a filmed ghost; given way to RIFE's frame between frames 9 and 11", "given way to frame 11 beside it, shown twice in a row", "kept … — film this direction again"). Without RIFE, `--repair auto` still gives each ghost way to the clean frame beside it and says a jump frame was not repaired only where a jump was left (`unmade`: the step, target and score the jump search stopped at; `repair.repair_jumps` with no interpolator no longer raises on a jump); `--repair on` refuses a ghost between two clean frames as it refuses a jump. `--repair off` and the states other than walk and run are unchanged. A loop with no filmed ghost is cut as before: the same cells and strip metadata, its report adding the two records empty. [docs/loop-repair.md](docs/loop-repair.md) section 2.
+- **Fix: a GIF or WebP that holds a frame shown twice in a row passes its check.** Both formats hold two identical frames in a row as one frame of twice the delay, and `video-loop` checked its GIF and WebP for one frame per cell: a cut with two identical frames in a row — what giving a ghost way to the frame beside it leaves — failed (`walk.gif failed verification: 19 frames, expected 20`). `video-loop` and `video-follow` now check for one frame per run of identical cells, as `video-cycle-align` already did (`loop.shown_runs`), and the restoration's playback check (`playback.verify`) reads such a run as one frame held for the sum of its delays (in hundredths of a second in the GIF, as it stores it); its `strip_indices` still lists every scheduled cell.
+- **Output change: source restoration reads the ghost — the ghost guard.** A cell `video-loop` gave a filmed ghost way is a cell the jump repair replaced, and its source frame is the ghost: the source's pixels clear any fault the cell carries, the smear and outline faults measure a frame only against its neighbours, and partial coverage was read only beyond the source reference's own, which is the ghost — so `source-restoration-v4` could propose the cell and accept the ghost back. Now no cell whose source frame the cut's ghost screen names (`interpolation_quality.ghost_screen` on the cropped source frames, at their own size, as the cut read them) is a target; every final cell's faults carry its own ghost reading where the screen reads the loop; and the comparison's new `axes.ghost` reads each cell's own `rife.ghost` on final pixels (`baseline`, `candidate`, `reference`, `threshold` 0.003, `filmed` — the screen), any rise of the excess over the limit `regressed` with `ghost:regressed`. A loop the screen does not read is not judged (`reason: "loop-drawn-part-covered"`). [docs/loop-comparison.md](docs/loop-comparison.md#the-ghost-guard).
+- **Contract versions: repair report schema 4, comparison schema 6, metric `source-restoration-v5`, policy `key-protected-source-copy-one-step-cap-jump-ghost-guard-v1`.** A restored cell's pixels are made as in v4. Evidence and receipts of `source-restoration-v4` (2.40.0 – 2.43.0) are refused, never read as v5: a v4 repair report given to `video-loop-compare` is an input error, and a request whose baseline carries a v4 receipt in its loop report is shared `unknown`, `restoration-receipt-policy-unsupported`. The origin itself is still a valid first request. Proposal IDs change with the versions. `video-loop-compare` without the origin and the source (`same-sample-defects-v1`) is unchanged.
+- **`tests/video/test_ghost_given_way.py`** draws the walk of `tests/video/test_cycle_align.py` with a band of 0.3 coverage beside the foot: a small one, four times the ghost limit and no jump, delivered as cut before and now given way to RIFE's frame between its neighbours (a stand-in that draws the walk's true frame) or, without RIFE, to the frame after it, the GIF and WebP holding it as one frame; two identical frames in a row passing the check; three ghosts in a row, the middle one kept and named; a wide band that also reads as a jump, named by the screen read before the repair; `--repair off` and `--repair on` without RIFE; an alignment reading the cut given way and carrying its record; the side walker of `tests/video/test_one_step_cut.py` cut with the application's walk flags (`--anchor motion-auto --size-hold auto --body-height 160`), through a stand-in and through the real RIFE (marked `real_rife`); and the cut's source projection proving every other cell and listing the cell given way, a restoration request reading its playback and proposing nothing there. `tests/video/test_source_restoration.py` adds a source frame that is a filmed ghost the smear and outline faults pass, whose cell v4 proposed first: it is no target, and the ghost restored there regresses.
- **`tests/video/test_ghost_retake.py`** reproduces on the synthetic legs of `tests/video/test_ghost_screen.py` a ghost kept at a whole time (three in a row), one kept at a time made between two (the stand-in RIFE, and the real one, marked `real_rife`), and a held loop on twos that keeps ghosts too (both reasons, `held-drawings` first); under `--between rife` only the ghost with no clean frame beside it is counted; the fault line names the kept cell as it is.
## v2.43.0 - No loop delivers a ghost frame unmeasured; a cross-fade inside one silhouette is named, not judged
diff --git a/SKILL.md b/SKILL.md
index 440a5d4..42c4a51 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -138,7 +138,7 @@ Scene creation consumes finished assets and remains optional. Asset metadata own
## RIFE for walk and run loops
-`video-loop` repairs a walk's or run's jump frames and `video-set` gives a direction set one cycle length, both with RIFE in-betweens. Install it once per machine: `$SPRITE_GEN_ROOT/.venv/bin/sprite-gen rife install` (pinned rife-ncnn-vulkan 20221029 and model rife-v4.6, SHA-256 checked, into the user data directory, ending with a check frame; Linux without a GPU first needs `libvulkan1 mesa-vulkan-drivers`). Without it every loop is still cut, as filmed, and says so: a `warning:` line on stderr, `jump_repair.applied: false` in the loop report, `cycle_align.<state>.applied: false` and `warnings` in `set.report.json`. When that happens, tell the user which loops went unrepaired and offer the install; after it, cut those loops again and run `video-cycle-align`. `video-loop --repair on` and `video-cycle-align` fail without RIFE instead. [loop-repair](docs/loop-repair.md).
+`video-loop` repairs a walk's or run's jump frames and gives its filmed ghosts way (a half-drawn frame the video model left, `ghost_given_way`), and `video-set` gives a direction set one cycle length, both with RIFE in-betweens. Install it once per machine: `$SPRITE_GEN_ROOT/.venv/bin/sprite-gen rife install` (pinned rife-ncnn-vulkan 20221029 and model rife-v4.6, SHA-256 checked, into the user data directory, ending with a check frame; Linux without a GPU first needs `libvulkan1 mesa-vulkan-drivers`). Without it every loop is still cut, a jump as filmed (each filmed ghost given way to the clean frame beside it), and says so: a `warning:` line on stderr, `jump_repair.applied: false` in the loop report, `cycle_align.<state>.applied: false` and `warnings` in `set.report.json`. When that happens, tell the user which loops went unrepaired and offer the install; after it, cut those loops again and run `video-cycle-align`. `video-loop --repair on` and `video-cycle-align` fail without RIFE instead. [loop-repair](docs/loop-repair.md).
## Contracts and advanced tools
diff --git a/docs/loop-comparison.md b/docs/loop-comparison.md
index cef7dbc..e8f67a4 100644
--- a/docs/loop-comparison.md
+++ b/docs/loop-comparison.md
@@ -117,15 +117,22 @@ quality bounds, and [video pipeline](video-pipeline.md) for processing stages.
`video-loop-repair` proposes a separate output for one damaged interior cell.
It preserves the cut, metadata, normal cells, boundary cells, and actual GIF/WebP
schedule. No interpolation is called. This operation has its own contract:
-repair report `schema_version: 3`, comparison `schema_version: 5`,
-`metric_version: source-restoration-v4`, `policy_version:
-key-protected-source-copy-one-step-cap-jump-guard-v1`, `scope:
+repair report `schema_version: 4`, comparison `schema_version: 6`,
+`metric_version: source-restoration-v5`, `policy_version:
+key-protected-source-copy-one-step-cap-jump-ghost-guard-v1`, `scope:
processing-defect-restoration`, `operation: restore_active_cut`. The v1
comparison above is unchanged. Earlier versions are not this contract:
-`source-restoration-v3` (2.39.0) made the same cell and accepted it without
-[the jump guard](#the-jump-guard), and two unreleased drafts,
-`source-restoration-v1` and `-v2`, copied the whole source cell and never capped
-a pixel. Their evidence and receipts are refused, never read as v4.
+`source-restoration-v4` (2.40.0 – 2.43.0) made the same cell without [the ghost
+guard](#the-ghost-guard), so it could take a filmed ghost back where the cut
+gave it way; `source-restoration-v3` (2.39.0) also accepted it without [the
+jump guard](#the-jump-guard); and two unreleased drafts, `source-restoration-v1`
+and `-v2`, copied the whole source cell and never capped a pixel. Their evidence
+and receipts are refused, never read as v5: a v4 repair report given to
+`video-loop-compare` is an input error, and a request whose baseline carries a
+v4 receipt in its loop report is shared `unknown`,
+`restoration-receipt-policy-unsupported`. The origin itself is still a valid
+first request. A restored cell's pixels are made as in v4; proposal IDs change
+with the versions.
### What a restored cell is
@@ -273,7 +280,8 @@ as `non_regressing`. If the legacy recipe cannot uniquely explain every
unmodified cell of the origin, the result is shared `unknown` without a
candidate. Historical repair indices are hints only: a target must have a final
and source-relative interpolation fault, and its source reference must pass the
-common policy. A request whose proposals exist but are each refused stays
+common policy, its ghost reading included, and not be a frame the cut's ghost
+screen names ([the ghost guard](#the-ghost-guard)). A request whose proposals exist but are each refused stays
`unknown` or `regressed` per proposal and keeps the active result; it is not
reported as `no_change`.
@@ -372,7 +380,7 @@ The report carries `origin`, `baseline` and `candidate` (each with its five
made from the origin and the source, its coverage the source's, the candidate's
receipt the recomputed one, at least one cleared actual fault, unchanged normal
cells and metadata bytes, and no worsening protected axis, the jump around the
-changed cell included. A changed cell that
+changed cell and each cell's ghost included. A changed cell that
is not that copy (a pixel outside the masks, a capped place left uncapped or
capped further) returns `regressed` with
`changed-cell-is-not-the-verified-source-copy`; a receipt that differs returns
@@ -386,7 +394,11 @@ quantity is excess over the fixed source reference with common source
neighbours. Restoring natural antialiasing may increase raw partial coverage.
Boundary pixels and actual playback intervals stay identical. GIF quantization
and WebP decoding are checked against the strip export mapping, with their
-actual integer delays recorded separately from fractional strip timing.
+actual integer delays recorded separately from fractional strip timing. A cell
+the mapping shows again right after an identical one (a filmed ghost the cut
+gave way to the frame beside it) is one frame of both files, held for the sum
+of its delays — in hundredths of a second in the GIF, which stores the sum so —
+and is checked as one; `strip_indices` still lists every scheduled cell.
Key-colour protection is read again from the final strip, whatever the masks
promised. `axes.key_colour.introduced_excess` sums only the positive per-pixel
@@ -453,6 +465,46 @@ seen only through the jump it came with: where the in-between jumped more, the
source frame is restored with its colour, right or wrong. The comparison reads
no colour bound beyond the key colour's.
+### The ghost guard
+
+`video-loop` gives a filmed ghost way in its jump repair stage ([loop
+repair](loop-repair.md), section 2): the cell then shows RIFE's frame between
+the two clean frames beside it, or one of them, and is listed in
+`jump_repair.replaced` like a frame made for a jump. Its source frame at that
+time is the ghost. The source's pixels clear any fault the cell carries, and
+before this guard nothing read the ghost: the smear and outline faults measure
+a frame against its neighbours, and partial coverage was read only beyond the
+source reference's own, which is the ghost. So `source-restoration-v4` could
+propose such a cell and accept the ghost back.
+
+```text
+filmed = interpolation_quality.ghost_screen(the cut's source frames, cropped, at their own size)
+ghost(f) = rife.ghost(f) part coverage at least 5 px thick, over the solid pixels
+target never a cell whose source frame `filmed` names
+faults smear and outline as before, and `ghost` over 0.003 where `filmed` reads the loop
+regressed where max(0, ghost(candidate) - 0.003) > max(0, ghost(baseline) - 0.003) at any cell
+```
+
+The screen is the one `video-loop` read the cut with, on the frames each cell
+was resampled from, so a cell is no target where the cut named its source
+frame a ghost. The faults every final cell is judged by now carry its own ghost
+reading, and `axes.ghost` reads it on final pixels as `outline_loss` and
+`dark_excess` are read: excess over the limit, any rise `regressed` with
+`ghost:regressed`. A loop the screen does not read (drawn part-covered, a glow,
+a translucent cape) is not judged: no `ghost` in the faults, and `axes.ghost`
+is `non_regressing` with `reason: "loop-drawn-part-covered"`.
+
+| `axes.ghost` field | Meaning |
+|---|---|
+| `filmed` | The screen of the cut's source frames: `limit`, `thick_px`, `level`, `reads`, `ghosts` (each `frame` and its reading), `why` where it does not read |
+| `baseline`, `candidate`, `reference` | Each cell's own reading on that loop's final cells and on the source reference cells |
+| `threshold` | 0.003 (`interpolation_quality.GHOST_WARN`) |
+| `status` | `regressed` when a cell's excess rises, `improved` when one falls and none rises, else `non_regressing` |
+
+The reading thins with the cell: a band a few pixels thick in the source frame
+can read under the limit in a cell scaled down, so the target rule reads the
+source frames, where the cut read them.
+
For an outline-specific UI success message, require `verdict == improved` and
an `outline` entry in `cleared_faults[].faults`. `axes` contains raw baseline,
reference and candidate values for outline/smear, source-relative partial
diff --git a/docs/loop-repair.md b/docs/loop-repair.md
index b8db669..208c4b6 100644
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@ -175,6 +175,44 @@ over the loop — and the larger is the step's score.
Re-making every frame (an offset of half a frame) is not offered: it softens the frames that
were fine, and it was judged "not corrected" (2026-10-03).
+**A filmed ghost is a target of the same stage, first.** A walk filmed in one direction is
+delivered as cut — it never meets the cycle alignment, which takes a clean frame beside a ghost
+(section 4) — so the cut gives its filmed ghosts way itself. The ghost screen reads the cut as
+filmed, before the repair (`ghost_screen` in the report); each frame it names is a round of its
+own (`why: "ghost"`), in frame order, before the jumps are read:
+
+| A filmed ghost at frame j | Taken there | `taken` |
+|---|---|---|
+| both frames beside it clean, and RIFE's frame half way between them has no fault (`ghost` included, as above) | RIFE's frame | `"rife"` |
+| RIFE's frame has a fault, a frame beside it is a filmed ghost too, or no RIFE is installed | the clean frame beside it: the one after, else the one before (`interpolation_quality.clean_beside`, the alignment's own choice at a time on a ghost) | `{"source": k}` |
+| both frames beside it are filmed ghosts too | nothing: the ghost is kept, named, and the direction is to be filmed again | `null` |
+
+Ghost rounds are outside the three-call budget, which is the jumps'. A cell given way is in
+`replaced` like a jump frame made, so the rule "never next to a frame already made" holds around
+it too, and the jumps are then read on the loop as the ghosts left it. A cell given way to the
+frame beside it is that frame shown twice in a row — a step of nothing and a step of two — and the
+jolt index (section 3) measures it as it plays; the GIF and WebP hold it as one frame of twice the
+delay, and are checked for one frame per run of identical cells. A loop the screen does not read
+(drawn part-covered, `reads: false`) has no ghost round.
+
+The report's `jump_repair` carries `replaced` (cycle frame indices, ghost and jump rounds alike), `attempts` (the jumps' calls),
+`blocked` targets, and each round's `why` (`ghost` or `jump`), target, `original` and `proposal`
+measurements (with each one's `ghost`, and the proposal's `crossfade`), `faults`, `look` and
+`outcome`. A jump round adds its step, score and whole/hair parts, its `outcome` `accepted` or
+`rejected`. A ghost round adds its `neighbours`, `taken` and `outcome` (`accepted` for RIFE's
+frame, `given-way` for the frame beside it, `kept`), and `no_proposal` where no frame was made
+("a frame beside it is a filmed ghost too", "no interpolator"); its `original.ghost` is the
+screen's reading. The report and its summary also carry `ghost_given_way` (`frame`, `ghost`,
+`taken`) and `ghost_kept` (`frame`, `ghost`), and the strip metadata carries each where it is not
+empty: `cycle/` is what `video-cycle-align` reads as `cycle.source/`, and its screen no longer
+sees a ghost given way, so the strip says what the cut gave way, in frames of the cut. A
+`warning:` line names each: "frame 10 of the cut carries a part-covered band … a filmed ghost;
+given way to RIFE's frame between frames 9 and 11", "given way to frame 11 beside it, shown twice
+in a row", or "kept … — film this direction again". A cell given way is a cell the jump repair
+made for the source projection and for restoration, which never restores it ([the ghost
+guard](loop-comparison.md#the-ghost-guard)). `--repair off` gives nothing way: the cut's ghosts are
+delivered as filmed, named (section 4).
+
Blocked targets are skipped while independent candidates remain. Scores are re-read
after adoption; a rejected target is never retried in that run. The circular last/first
adjacency rule and call budget still apply. The shared `interpolation_quality` policy
@@ -186,11 +224,8 @@ proposal is also rejected. A proposal that cross-fades two drawings inside its s
a `warning:` line names the frame.
The original middle frame is retained, not a duplicate of either neighbour.
-The report's `jump_repair` carries `replaced` (cycle frame indices), `attempts`,
-`blocked` targets, and each round's step, target, score, whole/hair parts,
-`original` and `proposal` measurements (with each one's `ghost`, and the proposal's `crossfade`), `faults`, `look`, and `outcome` (`accepted` or
-`rejected`). It also records `score_max_before` / `score_max_after`, why it stopped,
-and which interpolator made the proposals. Rejection is not overall quality failure
+The jump rounds' record is above; `jump_repair` also records `score_max_before` (the cut as
+filmed) / `score_max_after`, why it stopped, and which interpolator made the proposals. Rejection is not overall quality failure
or success: original drawing changes and normal gait motion can remain.
When a frame was replaced the seam gate measures the rendered cells
(`seam_measurement: rendered-cells`), because the source frames no longer say what plays.
@@ -202,7 +237,11 @@ same scores around it, with the recorded `facing`: a restoration that brings
the jump back is not an improvement ([the jump guard](loop-comparison.md#the-jump-guard)).
RIFE is located only when a frame is to be made. A loop with a jump and no RIFE is cut as filmed
-with a warning under `--repair auto`, and fails under `--repair on` (section 1, "Without RIFE").
+with a warning under `--repair auto`, and fails under `--repair on` (section 1, "Without RIFE");
+so does a filmed ghost between two clean frames under `--repair on`. Under `--repair auto` each
+filmed ghost then gives way to the clean frame beside it (`no_proposal: "no interpolator"`), and
+only a jump left (`unmade`: the step, target and score the search stopped at) sets `why`, `rife`
+and `install`.
`--repair off` cuts the loop as filmed and records `jump_repair: {"applied": false, "why":
"--repair off"}`. Other states are not touched (`"why": "not a gait state (…)"`).
@@ -635,12 +674,20 @@ sprite-gen video-cycle-align --loop-dir set/front-walk/loop --loop-dir set/side-
- What it does not see: a frame RIFE made that blends two drawings inside one silhouette — the
near and far boots cross-faded while the outline stays whole — has no part coverage to read
and is not a ghost here; the cross-fade reading below names it.
- - `video-loop` records the same screen of the cut it delivers, for a walk or run
- (`ghost_screen` in its report, and a `warning:` line per ghost naming `cycle/frame-NNN.png`):
- a loop delivered as cut — one direction, never aligned — shows its ghost, and the alignment
- screens `cycle.source/` again and takes a clean frame beside it. The jump repair (section 2)
- rejects a proposal that is a ghost. `video-loop-compare` and `video-loop-repair` keep their own
- versioned measures (`rife.smear`, [loop comparison](loop-comparison.md)) and do not read it.
+ - `video-loop` reads the same screen on the cut as filmed, for a walk or run (`ghost_screen` in
+ its report), before its jump repair, and gives each ghost it names way there (section 2): a
+ loop delivered as cut — one direction, never aligned, as a run of one direction is — would
+ show it otherwise. RIFE's frame between the two clean frames beside it, else the clean frame
+ beside it, else the ghost kept and named (`ghost_given_way`, `ghost_kept`, a `warning:` line
+ each). The cut it writes is the alignment's `cycle.source/`, so a set aligned later reads a cut
+ already given way; the strip metadata says what was. Under `--repair off` the cut is delivered
+ as filmed and each ghost is a `warning:` line naming `cycle/frame-NNN.png`; the alignment
+ screens `cycle.source/` again and takes a clean frame beside it. The jump repair also rejects
+ a proposal that is a ghost. `video-loop-compare` keeps its versioned measure (`rife.smear`,
+ [loop comparison](loop-comparison.md)) and does not read it; `video-loop-repair` reads it since
+ `source-restoration-v5` ([the ghost guard](loop-comparison.md#the-ghost-guard)): a cell the cut
+ gave a ghost way is never restored to it. Its evidence and receipts of `source-restoration-v4`
+ are refused, never read as v5, as v3's were by v4.
- **A cross-fade inside the silhouette — named, not judged** (`rife.crossfade`,
`interpolation_quality.looks`): where two drawings differ more than the flow can follow — the legs
trading places across a gap two or three frames wide — RIFE can move the coverage and cross-fade
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index ff61837..c0d4b80 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -906,9 +906,14 @@ transparent corners, no RGB under alpha 0 in the WebP).
A walk or run loop then has its jump frames repaired before the strip is built: a frame that
breaks a step 1.4× the loop's median (whole body, or the hair behind it) is replaced by RIFE's
frame between its two neighbours, at most three and never two side by side (`--repair auto`,
-the default; `--repair off` cuts as filmed). The report's `jump_repair` names the frames. RIFE
+the default; `--repair off` cuts as filmed). A frame the ghost screen names a filmed ghost, read on
+the cut as filmed, is replaced in the same stage first: by RIFE's frame between the two clean
+frames beside it, else by the clean frame beside it, else kept and named (`ghost_given_way`,
+`ghost_kept`) — a walk of one direction is delivered as cut and never meets the alignment that would
+take a clean frame there. The report's `jump_repair` names the frames. RIFE
is installed once with `sprite-gen rife install`; without it a loop that needs a frame is cut as
-filmed with a warning (`--repair on` fails instead). See [loop repair](loop-repair.md). The repaired loop's jolt index and the head's frame-to-frame
+filmed with a warning, each filmed ghost given way to the clean frame beside it (`--repair on`
+fails instead). A frame shown twice in a row is one frame of the GIF and WebP, checked so. See [loop repair](loop-repair.md). The repaired loop's jolt index and the head's frame-to-frame
moves are reported (`jolt`); beyond the reference bounds that is a warning line, and a gate
(`video-loop: loop jolts — …`) only when `--jolt-max` / `--head-step-max` are passed.