From b0875acbc1a5c4a5aa8e31b044f047347cc6e675 Mon Sep 17 00:00:00 2001 From: Vladimir Bragin Date: Sat, 28 Nov 2026 19:55:45 -0600 Subject: [PATCH 1/2] docs: ideas for a fast-forward skill Failure cases seen when updating checkouts after merges, a scan/plan/apply shape, the decisions to batch, cross-PC use and neighbouring skills. Ideas only; nothing is built. Refs scf-zec2b Co-Authored-By: Claude Opus 5.5 --- docs/fast-forward/README.md | 95 +++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 docs/fast-forward/README.md diff --git a/docs/fast-forward/README.md b/docs/fast-forward/README.md new file mode 100644 index 0000000..65a3c6e --- /dev/null +++ b/docs/fast-forward/README.md @@ -0,0 +1,95 @@ +--- +type: Design Note +title: fast-forward skill ideas +description: Ideas for a skill that brings local checkouts to their default branch tip safely, on one PC or several, after PRs merge. +resource: fast-forward/README.md +tags: [docs, skills, git, ideas] +timestamp: 2026-11-28T00:00:00Z +okf_version: 0.1 +--- + +# fast-forward skill: ideas + +Status: ideas only, nothing built. The goal is a skill that brings local checkouts up to their default branch +tip safely, on one PC or several, after PRs merge. It would answer "fetch, pull, merge, fast-forward to main" +without the trial and error that request takes by hand today. + +## What goes wrong today + +Each of these came up in real sessions: + +- **`git pull` fails with "no tracking information"** when `main` has no upstream. Setting one writes + `.git/config`, which some workspaces forbid. `git fetch origin` then `git merge --ff-only origin/` + does the same job without touching config. +- **A generated file blocks the fast-forward.** A tracker snapshot such as `.agent-flow/tickets.jsonl` + is modified locally, and the incoming commit changes the same file. Whether to keep the local copy or the + incoming one is a per-record decision: compare by record id, then version and `updated_at`. +- **Untracked files block switching to `main`.** Typical case: an older copy of a file that `main` now + tracks. If the content matches, or the file is only an older copy of what `main` has, it's safe. Otherwise + it's someone's work. +- **The current branch was squash-merged.** `git branch --merged` doesn't see that. The PR state (merged), + or a tree or patch-id comparison against `main`, does. +- **Noise looks like work.** Line-ending-only changes (empty under `git diff --ignore-cr-at-eol`), and junk + files with mangled names left by a broken shell redirect, make a clean checkout look dirty. +- **Another worktree already has `main` checked out**, so `git checkout main` fails. `git fetch origin + main:main` advances the local ref without a checkout, and refuses when the move isn't a fast-forward. +- **Fast-forwarding doesn't deploy.** A CLI linked from the checkout (an npm global junction, a plugin read + from the folder) can keep running an old untracked `dist/` build. The skill should notice the build step + and offer it, not claim the update is live. +- **Renamed repos.** "This repository moved" on push or fetch is harmless, because GitHub redirects. Rewriting + the remote URL edits `.git/config`, so report it and leave it. +- **Permission layers block discards.** Auto-mode classifiers refuse `git checkout -- ` and `git branch + -D` even after a dialog answer. Prefer non-destructive forms (merge `--ff-only`, a rescue branch) and hand + the rest to the user as paste-ready `!` commands. +- **Shared checkouts.** Another agent session may be working in the same folder. Ask the live sessions first. + +## Shape + +Same pattern as the other harness skills: a stdlib Python script with `scan`, `plan` and `apply`. + +- **scan** (read-only, `--fetch`): for each repo under a root, or the current repo only, record: + - default branch and its origin SHA, current branch, ahead and behind; + - upstream set or not; + - the merged-PR state of the current branch (via `gh` when available); + - tracked changes classified into real edits, EOL-only and known generated snapshots; + - untracked files classified into older copies of tracked files, junk names and unknown; + - worktrees holding the default branch; + - in-progress operations; + - a linked-build hint: a `build` script plus an untracked `dist/` older than `HEAD`. +- **plan**: one row per repo with an action and a reason: + - `ff`: `merge --ff-only`, or `fetch origin main:main` when `main` isn't checked out; + - `switch-and-ff`: the current branch is merged and the tree is clean apart from noise; + - `rescue-then-ff`: real edits move to a `rescue/-` branch, never discarded; + - `needs-human`: diverged, conflicted, unpushed commits, or an unknown untracked file; + - `rebuild`: the follow-up when a linked build is stale. +- **apply**: executes only the `ff`, `switch-and-ff` and `rescue-then-ff` rows. It re-checks each repo's + state first and writes a manifest (old and new SHAs, rescue branches) with undo commands. It never + force-pushes, resets `--hard`, deletes branches or edits `.git/config`. + +## Decisions it should batch into one question + +- Snapshot conflicts: keep incoming or keep local, per record, with a "rescue local first" default. +- Branches already merged by squash: delete the local branch (the user runs the `!` command) or keep it. +- Whether to run a stale build. + +## Across PCs + +- Reuse `repo-inventory`: its `plan` already lists SAFE fast-forwards and NEEDS HUMAN rows per host. This + skill can be the one that executes the SAFE rows locally. +- On a peer, run it through `cross-pc-ssh` (read-only `scan` and `plan`), or send a `cross-pc-messages` + request. Each peer's owner approves its own `apply`. + +## Neighbours + +| Skill | Relationship | +|---|---| +| `merge-pr`, `ship-pr` | They merge; `fast-forward` brings checkouts up to date after a merge. Its natural follow-up step. | +| `projects-housekeeping` | Removes stale worktrees and branches; reuse its rescue and manifest code. | +| `repo-inventory` | Read-only snapshot and plan across PCs; `fast-forward` is the local executor. | +| `commit-and-push` | For real edits found in a checkout, when the user wants them shipped instead of rescued. | + +## Open questions + +- Which generated files count as snapshots? A per-repo config list, or detection by path (`.agent-flow/*.jsonl`)? +- Should `switch-and-ff` also remove a merged worktree, or leave that to `projects-housekeeping`? +- Should it run the project's tests after a fast-forward, or only report the new SHA? From 16699daca3e6948494bcd23f390314b4311b1fa3 Mon Sep 17 00:00:00 2001 From: Vladimir Bragin Date: Sat, 28 Nov 2026 20:02:18 -0600 Subject: [PATCH 2/2] docs(fast-forward): fetch into main fails while a worktree has it checked out Refs scf-zec2b Co-Authored-By: Claude Opus 5.5 --- docs/fast-forward/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/fast-forward/README.md b/docs/fast-forward/README.md index 65a3c6e..171b668 100644 --- a/docs/fast-forward/README.md +++ b/docs/fast-forward/README.md @@ -31,8 +31,11 @@ Each of these came up in real sessions: or a tree or patch-id comparison against `main`, does. - **Noise looks like work.** Line-ending-only changes (empty under `git diff --ignore-cr-at-eol`), and junk files with mangled names left by a broken shell redirect, make a clean checkout look dirty. -- **Another worktree already has `main` checked out**, so `git checkout main` fails. `git fetch origin - main:main` advances the local ref without a checkout, and refuses when the move isn't a fast-forward. +- **Another worktree already has `main` checked out**, so `git checkout main` fails, and so does `git fetch + origin main:main` (git refuses to fetch into a branch checked out anywhere). Find that worktree with + `git worktree list --porcelain`, run `git fetch origin`, then `git -C merge --ff-only + origin/main`. `git fetch origin main:main` is only for a `main` that no worktree has checked out; it + refuses a move that isn't a fast-forward. - **Fast-forwarding doesn't deploy.** A CLI linked from the checkout (an npm global junction, a plugin read from the folder) can keep running an old untracked `dist/` build. The skill should notice the build step and offer it, not claim the update is live. @@ -57,7 +60,8 @@ Same pattern as the other harness skills: a stdlib Python script with `scan`, `p - in-progress operations; - a linked-build hint: a `build` script plus an untracked `dist/` older than `HEAD`. - **plan**: one row per repo with an action and a reason: - - `ff`: `merge --ff-only`, or `fetch origin main:main` when `main` isn't checked out; + - `ff`: `merge --ff-only origin/` in the worktree that has the default branch checked out, or + `fetch origin main:main` when no worktree has it; - `switch-and-ff`: the current branch is merged and the tree is clean apart from noise; - `rescue-then-ff`: real edits move to a `rescue/-` branch, never discarded; - `needs-human`: diverged, conflicted, unpushed commits, or an unknown untracked file;