Compare commits

..

No commits in common. "main" and "v3.0.0" have entirely different histories.

7 changed files with 51 additions and 86 deletions

View file

@ -1,6 +1,6 @@
{
"name": "graceful-handoff",
"version": "3.1.0",
"version": "3.0.0",
"description": "One-command session handoff into the STATE.md continuity system. /graceful-handoff reaches a natural stopping point, overwrites the nearest STATE.md with a complete state-of-play (mandatory '👉 NESTE' block), and commits per remote policy (private → tracked, public mirror → local-only). Skill-only, deterministic STATE helper, no hooks.",
"author": {
"name": "Kjell Tore Guttormsen"

View file

@ -4,20 +4,6 @@ All notable changes to graceful-handoff are documented here.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]
### Changed
- **README brought in line with the org repo standard** (`repo-standard` gate, 0 ERROR). Documentation only — no plugin code, version, or behaviour changed. H1 is now the repo name; the opening line is verbatim the forge description (so description == catalog == README is machine-checkable); `## Install` is a top-level heading on the first screen and carries the CLI command `claude plugin install graceful-handoff@ktg-plugin-marketplace` next to `marketplace add`; `## Non-goals` and `## Changelog` sections added.
- **Dropped the static `tests-30` badge.** This forge has no CI runner, so the badge asserted a run nothing verifies. The Testing section now states the command and says plainly that nothing runs it automatically. Note for the catalog: the tests axis no longer has a badge backing it.
- **Fixed two dead `../../README.md` references** inherited from the monorepo (README lines 7 and the marketplace footer) — both pointed outside a standalone repo and 404'd.
## [3.1.0] - 2026-06-24
### Changed
- **Removed the hardcoded push window — push is now unconditional, Forgejo only.** The regime-wide push-window restriction (mantor 08:0017:00, fre 08:0016:00) was lifted permanently, so SKILL.md no longer gates the push on a weekday/time window — it would otherwise park a push in the middle of working hours. The two other invariants are unchanged: **push is Forgejo only, never GitHub**, and **push stays user-triggered** (the skill is `disable-model-invocation: true` and never auto-pushes outside a user-invoked handoff). `handoff-pipeline.mjs` had no window logic — only its header comment was corrected. If a future repo needs a window again, reintroduce it as per-repo config, never as a hardcoded default.
## [3.0.0] - 2026-06-23
### BREAKING

View file

@ -28,7 +28,7 @@ Bare sesjonsmodellen har konteksten til å fylle «👉 NESTE»-blokken meningsf
| `scripts/handoff-pipeline.mjs` | Slank deterministisk STATE-hjelper. `--plan` (resolver nærmeste STATE.md + klassifiser remote + git-fakta, read-only), `--commit` (stager KUN STATE.md når tracked + eksplisitte `--also`-stier; aldri `git add -A`), `--dry-run`. Returnerer JSON. Testbar uten LLM. |
Rituelet (SKILL.md): nå naturlig stoppunkt → `--plan` → skriv/overskriv STATE.md i fast format
`--commit` → push (Forgejo) → fast avslutningslinje.
`--commit` → push kun i vindu → fast avslutningslinje.
## STATE.md-format (ufravikelig)
@ -70,10 +70,9 @@ remote-klassifisering, staging-disiplin (no-`git add -A`-regresjon), gitignored-
- v2.0.0 (2026-05-01): skill-arkitektur + JSON-pipeline + 3 hooks + auto-trigger (BREAKING)
- v2.1.0 (2026-05-01): modell-bevisst kontekstvindu (4-stegs resolution-kjede)
- v3.0.0 (2026-06-23): **STATE.md-integrasjon (BREAKING).** Fjernet NEXT-SESSION-artefakt + alle 3 hooks; invertert pipeline (modellen skriver STATE.md, skriptet assisterer); remote-aware tracked/local-only-policy; fjernet Sonnet-pin.
- v3.1.0 (2026-06-24): fjernet hardkodet push-vindu — push er nå ubetinget (kun Forgejo, fortsatt user-triggered).
## Release (polyrepo — egen gated handling)
En versjonsbump er ikke fullført før: (1) `v3.0.0`-tag laget + pushet i denne repoen, OG (2)
katalogens `ref` bumpet til samme tag med `check-versions.mjs` grønn. Bruk
`../catalog/scripts/release-plugin.mjs graceful-handoff <versjon>` (atomisk). Krever operatør-go.
`../catalog/scripts/release-plugin.mjs graceful-handoff <versjon>` (atomisk). Krever push-vindu + operatør-go.

View file

@ -1,51 +1,26 @@
# graceful-handoff
# Graceful Handoff Plugin for Claude Code
One-command session handoff into the STATE.md continuity system. Overwrites the nearest STATE.md with a complete state-of-play and commits per remote policy.
> One command to end a session cleanly and hand it to the next one — `/graceful-handoff` reaches a natural stopping point and overwrites the nearest `STATE.md` with a complete, self-standing state-of-play.
> **Solo-maintained, fork-and-own.** This plugin is a starting point, not a vendor product. Issues are welcome as signals; pull requests are not accepted. See [GOVERNANCE.md](GOVERNANCE.md) for the full model and what upstream provides.
*AI-generated: all code produced by Claude Code through dialog-driven development. Every change is human-directed, reviewed, and validated before commit.*
*AI-generated: all code produced by Claude Code through dialog-driven development. [Full disclosure →](../../README.md#ai-generated-code-disclosure)*
![Version](https://img.shields.io/badge/version-3.1.0-blue)
![Version](https://img.shields.io/badge/version-3.0.0-blue)
![Platform](https://img.shields.io/badge/platform-Claude_Code_Plugin-purple)
![Skill](https://img.shields.io/badge/skill-1-green)
![Hooks](https://img.shields.io/badge/hooks-0-lightgrey)
![Pipeline](https://img.shields.io/badge/STATE--helper-deterministic-cyan)
![Tests](https://img.shields.io/badge/tests-30-success)
![License](https://img.shields.io/badge/license-MIT-lightgrey)
A Claude Code plugin that makes session handoff a single deliberate command, fully integrated with a `STATE.md`-based continuity system. When a session is filling up — or you simply want to stop — `/graceful-handoff` reaches a natural stopping point, **overwrites the nearest `STATE.md`** with where you are, the next concrete step, and what to read, then commits per your remote policy. The next session reads that `STATE.md` and stands on its own.
---
## Install
```bash
claude plugin marketplace add https://git.fromaitochitta.com/open/ktg-plugin-marketplace.git
claude plugin install graceful-handoff@ktg-plugin-marketplace
```
Or enable directly in `~/.claude/settings.json`:
```json
{
"enabledPlugins": {
"graceful-handoff@ktg-plugin-marketplace": true
}
}
```
## Requirements
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) v2.x+
- Node.js (any recent LTS — for the helper script)
- A git repository (the helper detects detached HEAD / missing upstream and reports gracefully)
---
## Table of Contents
- [What Is This?](#what-is-this)
- [Non-goals](#non-goals)
- [The Problem](#the-problem)
- [The STATE.md Model](#the-statemd-model)
- [Quick Start](#quick-start)
@ -58,7 +33,6 @@ Or enable directly in `~/.claude/settings.json`:
- [Testing](#testing)
- [What Changed in v3.0 (BREAKING)](#what-changed-in-v30-breaking)
- [Limitations & Open Assumptions](#limitations--open-assumptions)
- [Changelog](#changelog)
- [License](#license)
- [Feedback & Contributing](#feedback--contributing)
@ -73,25 +47,12 @@ Invoke it whenever you want to hand off. The session:
1. **Reaches the first natural stopping point** — finishes the current logical unit, leaves the code working.
2. **Overwrites the nearest `STATE.md`** with a complete state-of-play in a fixed format, headed by a mandatory `👉 NESTE — START HER` block (where we are + the next concrete step + what to read).
3. **Commits per remote policy** — staging *only* `STATE.md` (when tracked), never `git add -A`.
4. **Leaves push to you** — push to Forgejo, you-triggered (no window gate).
4. **Leaves push to you**, gated by your push window.
The skill is `disable-model-invocation: true`: the model cannot trigger a handoff on its own. Handoff is a deliberate, user-initiated moment.
---
## Non-goals
What this plugin deliberately does *not* do — read this before adopting it:
- **It never triggers itself.** No hooks, no Stop auto-trigger, no context-percentage threshold. If you want a handoff written automatically when a session fills up, this is the wrong plugin — v2 did that and v3 removed it on purpose.
- **It does not read `STATE.md` back.** Injecting the nearest `STATE.md` at session start is the job of a global `session-start.sh` hook you own. This plugin only writes.
- **It does not push.** The helper has no push path at all; pushing stays a separate, user-triggered step.
- **It is not a general-purpose commit tool.** `--commit` stages `STATE.md` plus explicitly named `--also` paths, and nothing else. Unrelated dirty files stay dirty — by design.
- **It does not edit `MEMORY.md` or `CLAUDE.md`.** It warns when `MEMORY.md` grows past 200 lines; the edit is yours.
- **It does not publish anything.** `STATE.md` is internal state-of-play, never a public artifact — on a public remote it stays gitignored and uncommitted.
---
## The Problem
Long sessions fill the context window. The classic failure mode is summarizing, committing, and writing a continuation prompt under time pressure — or skipping steps and losing continuity. Earlier versions of this plugin attacked that with auto-trigger hooks that wrote a separate `NEXT-SESSION-PROMPT` artifact.
@ -143,7 +104,29 @@ The `👉 NESTE` block is always first, right after the title — it carries the
## Quick Start
Installed? Then the whole workflow is one command:
### Prerequisites
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) v2.x+
- Node.js (any recent LTS — for the helper script)
- A git repository (the helper detects detached HEAD / missing upstream and reports gracefully)
### Install
```bash
claude plugin marketplace add https://git.fromaitochitta.com/open/ktg-plugin-marketplace.git
```
Or enable directly in `~/.claude/settings.json`:
```json
{
"enabledPlugins": {
"graceful-handoff@ktg-plugin-marketplace": true
}
}
```
### Hand off
```
> /graceful-handoff
@ -171,7 +154,7 @@ flowchart TB
SK -->|2. fetch facts| PLAN
PLAN -->|JSON| SK
SK -->|4. safe commit| COMMIT
User -->|5. git push (Forgejo)| Done((done))
User -->|5. git push, in-window| Done((done))
```
Two pieces, one responsibility each: the **skill** synthesizes `STATE.md` (only it has the context); the **helper** does the deterministic mechanics (path resolution, remote classification, safe staging). The helper has no LLM dependencies and runs under `node:test` in seconds.
@ -186,7 +169,7 @@ Two pieces, one responsibility each: the **skill** synthesizes `STATE.md` (only
2. **`--plan`** — fetch deterministic facts (resolved `STATE.md` path, remote class, git status, recent commits).
3. **Write / overwrite `STATE.md`** in the mandatory format (title → `👉 NESTE` block → fixed sections → short history). Max ~60 lines. Overwrite, never append.
4. **`--commit`** — stage only `STATE.md` (when tracked) plus any explicit `--also` paths the model judges belong to the unit. Never `git add -A`.
5. **Push**Forgejo only, never GitHub. Push is unconditional — no window gate.
5. **Push**check the window (`date '+%u %H:%M'`). In-window: push (Forgejo only, never GitHub). Out-of-window: park it and say so explicitly.
6. **MEMORY.md check** — if it exceeds 200 lines, warn (don't auto-edit).
7. **Fixed closing line** — STATE.md status (path) · next session's first action (= the `👉 NESTE` block) · commit/push status.
@ -257,7 +240,7 @@ Enforced by tests, not convention:
- **Staging is explicit.** `--commit` stages *only* `STATE.md` (plus explicit `--also` paths). `git add -A` is never used — a regression test (`never stages unrelated dirty files`) enforces this.
- **STATE.md never leaks to a public mirror.** On a public/`open/` remote `STATE.md` is gitignored and the helper refuses to commit it (`local-only-skipped`), verified by test.
- **Push is never automatic.** The helper never pushes; push stays user-triggered (no window gate); never automatic.
- **Push is never automatic.** The helper never pushes; push stays user-triggered and window-gated.
- **Pre-commit hooks are respected.** The helper never uses `--no-verify`.
- **No network calls.** No WebSearch, no Agent delegation, no MCP — fully local.
- **Bash sub-scoped.** Skill `allowed-tools` enumerates `Bash(git:*) Bash(node:*) Bash(date:*)`.
@ -278,7 +261,7 @@ node --test 'tests/**/*.test.mjs'
| `tests/scripts/handoff-pipeline.test.mjs` | `--plan`/`--commit`/`--dry-run`, nearest-STATE resolution, remote classification, **no-`git add -A` regression**, gitignored-STATE skip, detached HEAD |
| `tests/plugin-manifest.test.mjs` | plugin.json version + description, CHANGELOG `[3.0.0]` BREAKING + preserved history |
The suite runs in a few seconds — no LLM involvement. **Nothing runs it automatically:** this forge has no CI runner, so the command above from a clean clone is the only verification. That is also why this README carries no test badge — a static one would assert a run nobody performed.
The suite runs in a few seconds — no LLM involvement.
---
@ -290,6 +273,8 @@ The suite runs in a few seconds — no LLM involvement. **Nothing runs it automa
- **Remote-aware tracked/local-only policy** so `STATE.md` never leaks to a public mirror.
- **Removed the Sonnet pin** — handoff synthesis inherits the session model.
Full history in [`CHANGELOG.md`](CHANGELOG.md).
---
## Limitations & Open Assumptions
@ -300,12 +285,6 @@ The suite runs in a few seconds — no LLM involvement. **Nothing runs it automa
---
## Changelog
See [CHANGELOG.md](CHANGELOG.md).
---
## License
MIT. See [`LICENSE`](LICENSE).
@ -316,4 +295,4 @@ MIT. See [`LICENSE`](LICENSE).
- **Bug reports + feature requests:** open an issue on [Forgejo](https://git.fromaitochitta.com/open/ktg-plugin-marketplace)
- **Pull requests:** not accepted on this repo (solo project, dialog-driven development with Claude Code). Fork freely if you need to extend.
- **Marketplace:** part of [ktg-plugin-marketplace](https://git.fromaitochitta.com/open/ktg-plugin-marketplace) — see the catalog for related plugins.
- **Marketplace:** part of [ktg-plugin-marketplace](https://git.fromaitochitta.com/open/ktg-plugin-marketplace) — see the [root README](../../README.md) for related plugins.

View file

@ -12,7 +12,7 @@
// STATE.md.
// --commit : stage STATE.md (ONLY if it is NOT gitignored) plus any
// explicit --also paths, then commit. NEVER `git add -A`.
// Never pushes (push stays user-triggered — no window gate).
// Never pushes (push stays window-gated + user-triggered).
// --dry-run : never writes, never touches git.
//
// Why STATE.md must never be auto-committed on a public mirror: a repo whose only

View file

@ -67,7 +67,7 @@ _Current state-of-play. Overskrives (ikke append) ved sesjonsslutt. Historikk
## <Oppdrag & kjøremodus> ← fast/uforanderlig: hva er målet, hvordan jobbes det
## <Gotchas / ufravikelige regler> ← det neste sesjon MÅ vite for ikke å trå feil
## <Push-status> ← hva er pushet vs parkert (push er fritt — ingen vindu-regel)
## <Push-status> ← hva er pushet vs parkert, og push-vindu-regel
## <Repo & env> ← branch, remote-klasse, tester, sentrale tall
## <Sesjonssekvens / historikk> ← KORT; det meste hører i git
```
@ -92,13 +92,14 @@ node ${CLAUDE_PLUGIN_ROOT}/scripts/handoff-pipeline.mjs --commit [--also <relate
ev. kode-endringer (via `--also`) og sier fra at STATE er local-only.
- Pre-commit hooks respekteres — aldri `--no-verify`.
### 5. Push (Forgejo, aldri automatisk utenfor handoff)
Push er fritt — ingen ukedag/tidspunkt-gate. Etter `--commit`:
- `git push origin <branch>`**kun Forgejo, ALDRI GitHub**.
- Hvis et repo har gitignored STATE.md (offentlig/`open/`-remote) committes/pushes kun
ev. kode (`--also`-stier); STATE selv er local-only.
- Skillen pusher kun innenfor en bruker-invokert handoff (den er
`disable-model-invocation: true`) — aldri spontant.
### 5. Push — vindu-gated, aldri automatisk
```bash
date '+%u %H:%M' # ukedag 1-7 + tid, norsk lokaltid
```
Sperret vindu: **mantor 08:0017:00** og **fre 08:0016:00**. Ellers fritt.
- I vindu: `git push origin <branch>` (kun Forgejo, ALDRI GitHub).
- Utenfor vindu: IKKE push. Hold commiten lokalt og si eksplisitt at pushen er parkert
til neste vindu åpner.
### 6. MEMORY.md-sjekk (lett)
Hvis auto-memory `MEMORY.md` finnes og er > 200 linjer: varsle bruker (flytt detalj til

View file

@ -10,9 +10,9 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
const MANIFEST = join(__dirname, '..', '.claude-plugin', 'plugin.json');
const CHANGELOG = join(__dirname, '..', 'CHANGELOG.md');
test('plugin.json version is 3.1.0', () => {
test('plugin.json version is 3.0.0', () => {
const m = JSON.parse(readFileSync(MANIFEST, 'utf-8'));
assert.equal(m.version, '3.1.0');
assert.equal(m.version, '3.0.0');
});
test('plugin.json description mentions STATE.md', () => {