mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-09 02:08:19 +01:00
* docs: approved reliability follow-ups plan (Oct 2026)
* D1: score overlay wrong answers as comparison results (contract v4)
A completed answer that fails the fixture's output check is now a valid
measurement with taskCorrect false and answerError set, in either arm.
Only execution, scope and metric failures invalidate a trial. ON
correctness still gates the case, so an OFF wrong answer stays in the
comparison. OVERLAY_CONTRACT moves to v4; v3 verdicts are not
reinterpreted. Replays the 37198445662 sonnet trials (OFF-0 wrong).
* C4: score auq-matrix substance with a 3-sample judge panel
Each skill keeps one native capture in the same execution; the
recommendation-substance grader now runs as a JUDGE_PANEL_SAMPLES panel on
that capture and gates on the mean against the unchanged minimum of 4. A
failed sample fails the panel without resampling. Approved at the gate
2026-10-04 for censuses after this change.
* E1: one Bun version source; setup refuses below the 1.3.3 floor, updater checks before advancing
bin/gstack-bun-version.sh holds the security floor (1.3.3) and the tested
version (1.4.0, the CI pin and engines.bun). setup refuses Bun below the
floor before writing anything, warns between floor and tested, warns and
continues on an unparseable version, and prints a 1.4.0 install hint.
Prereleases sort below their release (semver).
gstack-session-update now fetches, reads the incoming release's floor and
checks the bun setup will run before fast-forwarding to that exact
revision; below it the update is held with reason bun-too-old and a
resume command, leaving the revision and installs untouched.
Fixture copies of setup (team-mode, claude-code migration) now include the
sourced file; the slow-git lock test sleeps on fetch, the updater's
network step.
* E3: record the owned Chromium's PID over CDP so the #2709 reap runs on Playwright 1.62
Playwright 1.62's Browser has no process(), so chromiumProcInfo was always
null and browse stop never reaped a surviving headless Chromium. The owned
headless launch now reads the browser PID from CDP SystemInfo.getProcessInfo
(bounded at 2s; a hung or failed call logs once and records nothing). The
reaper's start-time and cmdline identity checks are unchanged, so a recycled
PID or an externally owned browser is never signalled.
* A1: ship docs gate records post-child hashes with gstack-docs-candidate, saves each record once
Stored transcripts (37198445662 gate-census-2) show the parent's reads of
release files take ~1 s; the parent's own model time dominates (completion
268 s of 392 s, store ~270 s of 387 s), and 45-78 s of it is retyping hash
maps, child output and records into several artifacts after the child
returns. The child contract is unchanged.
* A2: /plan-ceo-review sends the mode handoff line before any other tool call
plan-ceo-mode-routing's HOLD SCOPE session spends its 240 s post-selection
window on model work: 37176837432 skipped the handoff helper and paraphrased
the mode, 37198445662 ran it, then wrote the plan, loaded sections and probed
Codex for 114 s before the posture chat. The handoff line is the posture.
* B3: accept wrapped unchanged rows in the cropped Edit preview
PR run 37176835584 timed out with the floor's owned Edit menu on screen:
unchanged diff rows soft-wrap under their gutter with a blank marker
column, and a trimmed empty unchanged row keeps only its number. The
parser accepted wrapped +/- rows only, so it never verified the owned
edit. Both forms are now parsed and still compared with the exact source
lines; the captured viewport is replayed with negative controls.
* A3: record per-phase headroom diagnosis for docsync, plan-mode-no-op, mode-routing and gate slice 11
* E4: /review Step 1 keeps going when the base fetch fails and reports stale base coverage
Under Codex's read-only .git, 'git fetch && merge-base && diff --stat'
stopped at the fetch, so the empty output read as 'Nothing to review'.
The fetch is now separate, prints BASE_REFRESH fresh or stale with the
local base revision, and the review states stale coverage.
* D2: reword the format-approach question prompt
Both plan-ceo-review-format-approach refusals in census 37195203538
(Fable 5.1 model_refusal_no_fallback, category reasoning_extraction:
"duplicating model outputs") were anchored on the session prompt, whose
capture instruction asked for the "verbatim" question and "the exact
prose you would have shown" in a "format-capture test". The approach
case now asks for the same question in the same file as the step's
output, without that wording. The other three plan-format cases keep
their unchanged prompt (no refusals in 72 trials).
* C2: /qa defines its outcome filename fields; QA report templates name the measured timing fields
Low judge samples in failing panels named both: qa workflow (37186854666)
'an undefined {user} in the outcome filename', and qa-only workflow
(37198445662) 'template asks for Duration / durationMs totals while
reporting.md mandates Probe budget and Guarded command time'. The qa
union stays under its 1.11 size ratio (93292 of 93294 bytes).
* 0.1: session ledger written by the claude -p, Agent SDK, PTY and Codex runners
Each armed model session appends one best-effort line to
$GSTACK_EVAL_DIR/session-ledger.jsonl: a stable session key, the timeout it
armed, monotonic elapsed time, its end reason (completed, session_timeout,
observer_timeout, api_error, refusal, aborted, error), one sanitized evidence
line and, for stream-JSON runners, a compact liveness summary (longest
in-request silence with nothing outstanding, last event kind, tool open at
end). Partial messages now stream for every claude -p session and for SDK
sessions without a custom query provider (runSharedInteractive opts in); their
rows feed only the summary, so transcripts keep their size unless
publicStreamDiagnostics is set. Structured refusal and API-error signals win
over phrases, and tool results are never read for them.
* 0.2: failure_cause beside failure_class, from runner facts and the session ledger
One pure failureCauseOf() beside failureClassOf() sets failure_cause
(contract > pre_turn_infra > api_error > refusal > provider_stall >
session_timeout > observer_timeout > assertion > unknown; no machine-set
'detector') with one bounded evidence line, and failureDetailOf() keeps a
Bun matcher's Expected/Received or a judge's failing dimensions in
failure_detail. Both record builders (classifyTrialShard, junitCensus) call
them and attach the trial's ledger sessions. failure_class, error and
TRIAL_ERROR_MAX are computed exactly as before; the new fields are optional,
bounded and validated only when present, and a frozen copy of the v1 reader
accepts every new record. A provider stall needs partial messages and
STALL_WINDOW_MS (120 s, eval-budgets.ts beside HEADROOM_WARN/FAIL) of
in-request silence with nothing outstanding; it stays a failure under
EVAL_POLICY v1.
* E4: fingerprint under a read-only .git via a private object dir owned by review-log
Codex's sandbox mounts .git read-only, so gstack-wtree's git add -A could not
write blobs and /review lost its start capture. gstack-review-log now creates
a private 0700 object directory under TMPDIR, passes it to gstack-wtree (which
writes new objects there with the common-dir object store, resolved before
exporting, as an alternate, so linked worktrees work), exposes it to the
bindReview/checkSharedLibsReuse consumers that read the tree and blobs, and
removes it on EXIT/INT/TERM after they finish. gstack-wtree prints one stderr
line and exits 1 on a failed write or unwritable TMPDIR instead of printing a
partial hash; review-log no longer swallows that line. Standalone gstack-wtree
keeps writing to the repository store so git diff between saved snapshots
(/ship) still works.
* 0.3: red lines name their values, evidence and an after-a-repair command; one published-text sanitizer
Each red line in the census report keeps its stored error and adds the
machine cause with its evidence, the failure_detail values (Expected/Received,
or each failing judge dimension with its mean, sample count and the sample
sentence naming it), the slice artifact and shard directory that hold the
transcript, a fetch command (eval:pass-rates --run <id> --case <id>), and
'after a repair:' with a command that selects only that case (E2E ids via
--case, judges via their selection and an exact test-name filter). A
session that completed and failed a check says so instead of 'assertion
(success)'. Report text that reaches a PR comment, issue or committed file
goes through scripts/lib/published-text.ts: control and bidi characters
stripped, credential-scan patterns redacted, mentions neutralized, HTML and
link brackets escaped inline, blocks in a fence longer than any backtick run,
length capped. Verdicts and collector verdict objects are unchanged.
* E2: one make-pdf resolver for readiness and every $P block on env-var hosts
make-pdf exported $P from its readiness block, which Codex and the other
env-var hosts lose between blocks. binaryAssignment gains 'make-pdf': the
MAKE-PDF SETUP readiness check and the runtime prelude both use it, so every
block that runs $P derives the same make-pdf/dist/pdf binary, with
MAKE_PDF_BIN (dev builds) winning when it is executable. Claude output keeps
its repo-local-first probe; only the false 'subsequent blocks' comment
changed. Root plus P=... fits the 400-byte prelude budget; the fixed
MAKE_PDF_OVERRIDE segment is the one exemption, named in runtime-root.ts and
the conformance test.
* 0.1: eval:pass-rates --headroom, --reds and --run report views; 85% headroom alarm in --gate
A new pure module, scripts/lib/eval-history.ts, reports per case the slowest
armed session against the timeout it armed (censored when it timed out,
insufficient below 3 samples, unknown without a session ledger, with the
case wall shown separately as an upper bound), the census critical path from
the slice jobs' timings, the verdict red ledger per census by failure class
and machine cause with shrunk per-case rates, and the all-green probability
(an approximation: the product of 1 - p_i, with an interval). --run <id>
lists one census's reds with their values and history and downloads only the
slice artifacts those reds name, reporting any over 64 MB instead of skipping
them. eval-flake-rank.ts only routes flags: --help works offline, an unknown
flag or case id exits 2 before any fetch, --case narrows the JSON and the
alarms, every view prints its run/branch scope, and --gate also alarms on a
session above HEADROOM_FAIL (85%) of its budget.
* E5: GSTACK_DESIGN_IMAGE_MODEL override; the live model check always tests the defaults
The image_generation tool model gains an env override validated against a
conservative gpt-image-<version> pattern; a bad value fails before any
request and the error names the variable. Pairing and rejection hints name
the tool model actually requested. design/scripts/live-model-check.ts now
ignores GSTACK_DESIGN_MODEL and GSTACK_DESIGN_IMAGE_MODEL (and says so), so
an override cannot mask a retirement of a default, and its exit 2 (no key)
says nothing was checked.
* C3: /deslop-shared-libs names a concrete risk for each recommendation, never 'none'
Both shared-libs-opportunity-judgment reds (37193478719 t3, 37195203538 t1)
failed adoption_and_risk because the top recommendation said 'Main risk:
none found inside the repo' / 'none in behavior'. The skill asked to 'name
the main risk or uncertainty' without saying what counts.
* B4: --case selects loop-registered cases; an unknown id exits before any process
caseSelection() resolves the one paid file that registers a case and how a
trial selects it: by its literal Bun test name, by the id a registration loop
names its test at runtime (coverage audits, TPA, journeys), or by running the
whole file when it registers no other case (plan-mode-no-op, whose test names
are not the id, so the old name pattern ran nothing). A whole-file case runs
one file shard per trial and is judged by shard status, as CI judges it.
--list prints the selection. Every E2E_TIERS id now resolves except
carve-section-loading, which fifteen files register (CI runs each as its own
shard) and which still fails with the owning files named.
* 0.3: after-a-repair runs the shard file when --case cannot resolve a case
A case that several files register (carve-section-loading) cannot be selected
by --case; its red line now prints the bun test command for the shard file
that went red, so every printed command selects exactly one case.
* C1: pre-register workflow-judge control bundles for qa, qa-only, review and setup-deploy
Positive (production bundle), negative (headings only) and one targeted
execution-blocking defect per judge, one 3-sample panel each, built with the
eval's own reader, prompt builder, options and floors.
* F: cost_known: a trial whose harness captured no billing says so; totals never hide it
cost_usd stays a finite number. Trial and eval records gain an optional
cost_known boolean (absent means known, so old records still parse; the
validator accepts only a boolean). Session-ledger rows record whether the
session's terminal result carried total_cost_usd; PTY and Codex sessions
never do, and SDK captures without a terminal result do not. A trial is
cost-known only when it has eval records and every record and session
captured billing, so JUnit-only PTY cases (125 of 298 trials in run
37198445662 recorded 0) now read cost unknown. The census headline prints the
known sum plus the unknown count, never a bare total over unknown costs, and
no total when every cost is unknown; the history import keeps the flag.
PTY transcripts are not priced: test/helpers/pricing.ts estimates exclude
cache writes, so they cannot give the billed cost.
* B1: replay corpora for the five repeat-offender cases
shared-libs-plan-callers, plan-ceo-section-loading, auto-decide-preserved,
plan-design-review-plan-mode and ship-docsync-late-result each get an
inventory of every wave census in scope (all artifacts still available)
and minimal, redacted detector or actor inputs replayed through the real
detector in the free suite: census passes, every distinct census red, and
derived negative controls labelled as derived. Fixed false reds stay as
expected passes with their history; the two genuine auto-decide product
failures (37176837432, 37179171083) stay refused. A contract test bounds
each entry at 64 KB, scans it for HIGH credentials, requires a pass and a
refusal per case, and reports entries whose series identity is stale.
Building the auto-decide corpus exposed a latent native detector misread:
a bold 'Mode application and rationale.' heading was parsed as a
withdrawn Mode field (37186854666). A field status now ends at its
sentence.
* B2: read approved stale-fill decisions from more valid ledger records
The structured ledger reader is authoritative before the prose fallback,
but it missed two valid approved records in passing censuses
(37186854666: a camelCase writeProfile subject; 37195203538: a
slash-joined 'D1 / STALE-FILL' row id), which then rested on the prose
detector that caused both historical reds. Both forms are accepted; an
unresolved row, an unrelated decision, the copied fixture plan and
non-write camelCase words stay refused.
* C1: record workflow-judge control results (negatives separated; qa and review miss a removed step)
* C2: record every low workflow-judge sample in the wave censuses with its disposition
* 0.3: published lines cannot break a fixed fence
evals.yml wraps collector-outcomes failures in a fixed three-backtick fence
for the PR comment, so those lines (and eval:pass-rates output meant for the
tracking issue) go through sanitizeFixedFenceLine: cleaned like every
published line, with backticks turned into quotes. Inline published text
also neutralizes backticks.
* A1: fit the post-child record wording under ship's 1.428 parity size cap
* E4: inline the Step 1 base refresh to fit review's 1.199 parity size cap
* B2: inventory of gate and periodic phrase-only detector checks
docs/evals/detector-inventory.md lists every pass/fail decision in gate
and periodic E2E cases that rests on phrases in model free text, with
its structured source (if any), whether the contract is user-visible,
and a disposition: already structured-first, convert candidate, phrase
witness required, or no structured source. Convert candidates are
ordered by census red history.
* 0.2: failureCauseOf takes the stall window instead of importing it; the PTY ledger never throws
eval-store.ts imported STALL_WINDOW_MS from eval-budgets.ts, which free tests
replace with mock.module stubs (review-finalization-budget, office-hours,
qa-fix-loop, qa-only), so loading eval-store failed there. failureCauseOf is
now dependency-free: the record builders pass STALL_WINDOW_MS. A PTY session
whose handle cannot show its text (test doubles) records no panel instead of
throwing from runPtySession's cleanup. The 37186854666 replay also runs
through classifyTrialShard.
* A2/auto-decide: the CEO handoff chat repeats the helper's printed line verbatim
Claude Code 2.1.284 collapses the helper's Bash output ('Ran 1 shell
command'), so the 'Auto-decided review mode → …' line reaches the user only
through chat. In lane D's auto-decide-preserved corpus every passing capture's
chat starts with that line, and the reds paraphrased it ('HOLD SCOPE was
auto-selected…', 'Mode decision done…', "I'm defaulting to HOLD SCOPE…").
The template now says verbatim and why.
* C2: record the judge panels rerun on the final ship and review wording
* integrate: touchfiles and module-size ratchet entries for the wave's new modules
GLOBAL_TOUCHFILES gains session-ledger.ts, published-text.ts and
auq-substance-panel.ts; bin/gstack-bun-version.sh joins every entry that
lists setup or the updater; auq-matrix stays a rule case with its C4
evidence beside E2E_KINDS; eval-history, published-text and session-ledger
are registered new modules.
* E1: BROWSE SETUP install hint pins the tested Bun (1.4.0)
* E2: quote "$P" in make-pdf commands so install paths with spaces work
* E1: /gstack-upgrade checks the incoming Bun floor before pulling
gstack_bun_incoming_hold (bin/gstack-bun-version.sh) is now the one
pre-advance check: the auto-updater calls it before its fast-forward and
/gstack-upgrade's git path calls it after fetching. Below the incoming
release's floor the upgrade stops with BUN_TOO_OLD and the checkout,
VERSION and installs stay untouched. Vendored installs were already safe:
setup refuses before writing and the swap restores the previous install.
* 0.3: only main posts or closes tracking issues; reports carry alarms, red ledger, headroom and all-green
A branch-dispatched periodic or marathon run writes its report to the step
summary and a report artifact; the upsert and close steps run only on
refs/heads/main. The periodic body now keeps every pass-rate alarm line (the
old grep kept only the header), adds the red ledger and session headroom read
with an explicit --branch, the all-green estimate and the triage guide link,
and routes report text through scripts/lib/published-text.ts. The marathon
lane gains the matching close-on-green step.
Migrated: evals-workflow-wiring pinned report-summary.md in the upsert step;
the body is now written by 'Write the census report'.
* C3: prosons neutral-posture detector ignores a negated "taste call"
Both plan-review-prosons-neutral-neg reds (37179171083 t3, 37193478719 t3)
recommended A and closed with "a coverage call, not a taste call"; the
old /taste call/i matched the negation. The detector moves to a helper so
the two census captures replay free as negatives, with positive controls.
* B2: credit the CEO mode handoff only when the chat shows its line
Claude Code 2.1.284 collapses the gstack-ceo-mode-handoff Bash result, so
the printed AUTO_DECIDE line is user-visible only when a later chat message
of the session begins with it. The native detector now requires that
witness; the helper's tool result locates it but no longer replaces it, and
a generic mode statement cannot stand in once a handoff ran. Census
37182865432 is relabelled a genuine miss (expected: refused): the chat said
"I'm defaulting to HOLD SCOPE…" and "Mode decided: HOLD SCOPE". Corpus
replay: 5 credited, 3 refused. ceo-mode-handoff tests migrated to the
witness rule (deliberate behavior change).
* test: baseline the wave's approved detector and harness replay tests
B1 corpora, B3, C3, C4 and D2 replay captures through paid-case detectors,
actors or fixtures (test code by design); each entry carries its reason.
* E6: live Codex multi-block periodic case in the host-run Codex job
test/codex-e2e-multiblock-live.test.ts runs ./setup --host codex once from the
job's checkout into a fresh HOME and CODEX_HOME (auth.json copied from the CI
login home), asserts codex debug prompt-input lists the gstack router as a
real file, seeds one learning, and runs /learn's Show recent block through
codex exec: that later block must root itself through its prelude, run the
installed gstack-learnings-search and print the seeded learning; no block may
report a missing install or an unresolved gstack helper path.
The file joins CODEX_CI_FILES so the planner gives it to the host-run Codex
job. paid-test-durations.json carries a 180 s packing estimate (refreshed by
--write-durations after the first census) so the plan keeps every slice
within max-parallel. Oracles live in test/helpers/codex-multiblock.ts with
free replays in test/codex-multiblock.test.ts. Registration (E2E_TOUCHFILES,
E2E_TIERS periodic, E2E_KINDS rule) is the integrator's.
* E5: design live-model check as a periodic case
test/skill-e2e-design-model-smoke.test.ts runs design/scripts/live-model-check.ts
(default models only) under a temp HOME. Without OPENAI_API_KEY the case is a
Bun skip that the census lists as SKIPPED with no coverage credit; with a key,
exit 0 passes and any other exit fails with the script output (exit 2 under a
present key fails as 'nothing was checked'). paid-test-durations.json carries
a 90 s packing estimate. Registration (E2E_TOUCHFILES, E2E_TIERS periodic,
E2E_KINDS rule) is the integrator's.
* A1: docsync parent points children at a saved interface file
The /ship docsync fixture saved its observation interface only in the
parent prompt and told the parent to copy it into every child prompt,
about 30-40 s of parent generation per session (lane S, 37198445662).
docsSessionOptions now writes it to <home>/fixture-interface.md (0600) and
the parent tells each child to Read that file first. Fault-actor prompts,
which prepare already writes to a file, are unchanged. Fixture-only.
* A3: a JUnit case's recorded wall is capped by its shard's wall
junitCensus summed a case's JUnit test times as duration_ms; for
plan-mode-no-op's concurrent PTY tests that is 346 s inside a 176 s shard
(the "432-613 s" history). The case wall headroom shows is now
min(sum, shard elapsed), a true upper bound. Session headroom already
used the ledger's per-session clocks.
* A3: refresh paid-test durations from census 37198445662
Recorded 2026-09-29 estimates under-packed gate slice 11 (17 files
estimated 1078 s ran 1353 s; plan-review-report 76 s -> 198 s,
plan-ceo-plan-mode 37 s -> 112 s, safety-codex-consult 83 s -> 150 s).
Refreshed both tiers with --report --write-durations from the latest
census's slice walls. Old plan re-costed with observed walls: worst slice
~677 s (slice 11); refreshed plan: every slice estimated <= 539 s.
* C2: Browser Quick gets a feasible budget; QA loop names its directory and stop path
Judge rationales on the qa-only panels (2 of the last 3) cited the 30 s
Browser Quick budget: homepage + 5 targets, each a checkpoint write and a
guarded command, left ~5 s per probe. Quick is now 180 s (method text: 3
minutes); the qa-only-no-fix paid check expects the same native deadline.
PROBE_DIR points at its source line, a stopped loop goes to the final
report steps (annotations, materialize, Markdown), and /review and /ship
say that after smoke expiry only plan checks rerun in revalidation.
* C2: name the flows judges found implicit in review resolvers
Structured outside review: MISSING COVERAGE asks no fix question and is
never reported clean (was "preserve the existing user decision flow").
/review's HIGH-impact plan gate: spawned or non-interactive runs report
REQUIREMENTS MISSING and continue, writing no TODOs. Value cards: the byte
clamp applies to card lines; JSON records you write keep full values.
* C1: a free test catches a removed workflow step, which the judges missed
C1 controls showed the qa workflow judge passing /qa without Phase 10 and
the review judge passing /review without Step 3. The new test pins every
step/phase heading of qa, qa-only, review, ship, plan-ceo-review,
plan-eng-review and setup-deploy (derived from the templates' step
headings) and names any that goes missing or out of order; new step
headings must be pinned. The judge rubric is unchanged (EVAL_POLICY).
* size: fit the wave's wording under ship, review and qa parity caps
Measured after all lane merges: ship -79, review -210, qa -68 bytes over.
Trimmed the added wording first (post-expiry rule, MISSING COVERAGE,
plan-gate default, value-card JSON, stop line) and folded /review's
redundant INFORMATIONAL sentence and findings bullet. ship 268,036 (room
8), review 130,118 (room 1). qa needed 11 more bytes: cap 1.11 -> 1.1102
with the measured 93,305 / 84,049 = 1.11013 and its reason beside it.
* docs: troubleshooting sections for the wave's new messages
Bun floor (setup, auto-update, /gstack-upgrade), /review stale base and
fingerprint temp-dir errors, the design image model override, the
unrecorded Chromium PID, and a contributor section for census report
lines (pass-rates flags, failure causes, headroom, cost unknown, overlay
v4, stale corpora, auq substance). A free test checks every
troubleshooting.md#anchor printed by setup or bin scripts exists.
* TODOS: reliability follow-ups deferrals; close the Bun floor, make-pdf $P and #2709 reap
* 0.4: 'A census went red' guide; docs for causes, session ledger, headroom and new messages
docs/evals/census-red.md walks one red line to a diagnosis: prerequisites, the
report fields, eval:pass-rates --run/--reds/--headroom with expected output,
what unknown/insufficient/unrecorded data means, free replay, and the single
'after a repair' paid run allowed by TESTING_INTERNALS. Linked from
CONTRIBUTING, TESTING_INTERNALS and both census reports.
TESTING_INTERNALS documents the failure_cause glossary (one row per
FAILURE_CAUSES value, diagnostic only under EVAL_POLICY v1), failure_detail,
sessions[], cost_known, the session ledger, the pass-rates views and the 85%
headroom alarm, main-only tracking issues, overlay contract v4, auq-matrix's
3-sample substance panel and the E5/E6 periodic cases. troubleshooting.md
gains #bun-too-old and an anchor per new user-facing message from lanes P, D
and F. README names GSTACK_DESIGN_IMAGE_MODEL. test/census-red-docs.test.ts
pins the glossary to FAILURE_CAUSES, parses every guide command and checks the
links.
* v1.91.20.0: CHANGELOG and version for the reliability follow-ups
* regen: SKILL.md and sections for all hosts, digest, context-budget fixture
bun run gen:skill-docs --host all; goldens and llms.txt re-rendered
unchanged; bun test/helpers/capture-context-budget.ts.
* integrate: register codex-multiblock-live and design-model-smoke (periodic, rule)
* 0.4: census report and eval:pass-rates views link the census-red guide
* test: cookie approval fixture reverses the Bun install-hint pin (E1)
The historical approved cookie-workflow prompt carried BUN_VERSION=1.3.10;
the regenerated install hint now pins 1.4.0, so the fixture's reversal
list gains that edit like the earlier waves' entries.
* test: release floor counts the two new periodic cases (E5, E6)
* fix: /freeze, /guard, /unfreeze and /investigate work on Codex and other env-var hosts
Templates quoted "$HOME/.claude/skills/gstack/...", which the env-var hosts'
rewrites turned into "$HOME/.agents/skills/gstack/..." on Codex (a path a
global install never has; same class on the other hosts), and setup's
runtime roots had no freeze/bin. Quoted runtime paths now use
{{RUNTIME_ROOT}}: $GSTACK_ROOT on env-var hosts (the fence gets the
runtime prelude), the unchanged $HOME path on Claude. _link_runtime_dists
links freeze/bin and the careful/bin helper it sources into every
env-var host's root. Also fixes the same guess in /benchmark-models,
/retro and /diagram. test/env-host-runtime-assets.test.ts fails on the
previous code: no fence guesses a $HOME/<dir>/skills/gstack path, every
$GSTACK_ROOT path a fence uses is in the host's runtime root, and the
installed Codex /freeze and /unfreeze fences run from a fresh shell.
Template-reading tests now read the Claude render or expect the
placeholder (deliberate change).
* CHANGELOG/TODOS: lane W's workflow, cases and guide; the env-var host freeze fix
* E6: a block that reads a SKILL.md is not a missing install
The first live codex-multiblock-live run passed its real check (the /learn
block found the install and printed the seeded learning) but the oracle
flagged a sed of the learn SKILL.md, whose prelude source quotes the
'gstack: no install found (tried $_r)' text. Only an emitted line that
starts with the message and names a real root counts now; free replay
negative added.
* test: qa-only fixture keeps its caller-set 30 s deadline
The qa-only-no-fix fixture tells the model to start the guard with 30 s
(a caller limit), so its deadline assertion's default stays 30 000 ms; the
product's Browser Quick default (180 s) does not apply to it. Reverts the
helper and its test to their base.
* C2: keep PROBE_DIR 'owned' (qa-functional-prompt pins it); qa measured 93,311
* test: paid file count and periodic floor include the two new periodic cases
* test: ship docs freshness pin checks meaning after A1's wording trim
The snapshot still hashes selected release paths (--select narrows them),
generated outputs and docs; the pin now checks that instead of the
pre-trim sentence.
* E3: reap the recorded Chromium only after the daemon has exited
With the PID now recorded (E3), browse stop reaped Chromium while the
daemon was still shutting down; the daemon read that as a crash, exited 1
and left its state file (chromium-profile-isolation's headless stop test
failed 3/3 locally, passes on base). The CLI waits up to 5 s for the daemon
to exit before reaping a survivor.
* regen: qa and qa-only exploratory sections (PROBE_DIR wording)
* B1: batching counter reads a target declared mid-line; replay corpus
GSTA-23's census 37228573062 failed plan-eng-multi-finding-batching with
reviewCount=0 after 975 s although D1-D10 were asked one per finding,
each with its saved decision-ledger record. The report wrote 'Report
destination requested by the user. Review target (fixed): `PLAN.md` ...'
and the counter read target fields only at a line start, so no brief
inherited the plan identity. A target field may now open any sentence of
its line; a mid-sentence mention or another file still gives no identity.
Floor (3), budget and kind unchanged. Corpus: 9 earlier passing censuses,
the red (now credited at D5), and a derived batching refusal; 975 s noted
in the headroom diagnosis.
* B1: shared-libs corpus labels its git path and covers the supported shape
Every census entry was recorded in CI's eval image (git 2.43), where
gstack-safe-git falls back because --no-lazy-fetch is rejected; each entry
now says so (git_path: fallback). Two synthetic supported-path entries
(HEAD and a history citation in the brief, as git >= 2.44 produces) keep
the 37193478719 pass and the 37195203538 refusal, and a test asserts both
shapes are covered and the actor reads no git-path-specific text.
* v1.91.21.0: move off v1.91.20.0 (claimed by #3031)
* test: settle nav-guard commands before asserting; make two new tests Windows-safe
navigation-guard: Bun's expect(promise).rejects slows each Playwright round-trip
to ~1s while it waits (50 page.evaluate: 43ms plain vs 46.6s inside the matcher),
so the click's 5s timeout expired before the guard saw the link-local request
(CI: 'click: Timeout 5000ms exceeded ... waiting for scheduled navigations').
Settle the command first, then assert on the refusal; a source check keeps it so.
env-host-runtime-assets: PROBE_FILES now matches either path separator.
detector-corpus ship-docsync-late-result: JSON-escape the <ROOT> substitution so a
Windows temp path's backslashes do not break JSON.parse.
* fix: CI run/job ids are not phone numbers; context-recovery fixture gets the full runtime bin
pii.phone.e164 redacted the run id in the published eval report's fetch command
(--run 37235771700), breaking the command it prints. Digit-only spans in a run/job
flag, gh run argument, actions/runs/ or /job/ URL segment, or run_id/job_id key are
now exempt; the same digits elsewhere still report.
context-recovery-artifacts: the fixture's ./bin/ lacked gstack-skill-start and
gstack-context-recovery (the preamble's runtime scripts since v1.71), so the agent
spent its 10 turns hunting for them and hit error_max_turns with no final message
(run 37235771700, 11 turns). Link the whole runtime bin; diagnostic rerun passed
in 6 turns.
* test: replay run 37237194905's late-result capture through the docs authority detector
The only failure was call 20's write to a mistyped shard root (3GanyY for 3GanyU),
which the model disclosed; the detector is correct and the A1 post-snapshot
--out under the fixture home stays permitted. Named red recorded in TODOS.
* test: keep docsync-authority in the Windows profile
The replay test's literal helper path tripped the Windows curator's shebang-spawn
pattern, dropping the whole file from the Windows profile (test-free-shards
invariant). The snapshot --out case is already covered by docsync-command-grammar,
so it is removed here, and the Linux-path replay skips on win32.
* fix: gstack-docs-candidate --help works; docs gate red lines name the denying tool failure
PR run 37239016858 ship-docsync-completion: the parent ran
'gstack-docs-candidate --help' (the helper's usage error points at --help, which
failed). That undeclared command made docsToolFailures non-empty, which denied
the atomic-replacement proof of the child's legitimate native Edit, so the red
line blamed the Edit's temp file. A replay of the capture proves the atomic
replace once --help is declared.
- the helper prints its usage for --help/-h and exits 0
- the fixture interface and command grammar admit the helper's bare --help
- the atomic-proof denial names its check and the tool failures behind it
(deny labels renumbered to their lines)
- replay with negative controls (undeclared command, temp left behind, renamed
elsewhere); diagnostic rerun of ship-docsync-completion passed
* test: retro-base-branch fixture uses main and a shallow report path
PR run 37241493377: the agent wrote retro-output.md one directory above the
requested <tmp>/retro-base/retro-output.md (it dropped the retro-base segment),
so the report check found nothing. The fixture also ran plain git init, which
makes master on CI's git while the prompt says the repo is on main; the agent
logged that mismatch as a learning. Init on main and use the temp dir itself as
the repo. Diagnostic rerun passed (18 turns, 203s).
* test: qa-quick sets a caller probe limit and drains past its session budget
C2 raised Browser Quick's native budget to 180 s. qa-quick is the only gate case
on the native budget, and its wall went 194 s (main periodic, pre-C2) -> 254 s and
274 s (this PR's runs) -> 300 s session timeout (run 37242691913): the agent now
probes every navigation target with a checkpoint, then needs ~80 s to report.
Like qa-only-no-fix, the eval now sets a caller probe limit (30 s), scopes the
fixture, and gives bun's outer timeout the session drain margin instead of racing
the 300 s session. The product's 180 s budget and the session budget are unchanged.
Diagnostic rerun passed in 195 s.
* review/ship: use main's post-expiry smoke sentence; v1.91.24.0
GSTA-23's measurement on the review workflow judge: main's 'Post-expiry smoke
rechecks are not-run.' passed 10/10; the C2 wording passed 6/10 and the
'..., even in 4c.' variant failed in PR run 37248650879. qa-probe-gates pins
main's sentence before step 4c.
* test: record the plan-design corpus test in the test-of-test baseline
#3031's ratchet now counts tests that slice a paid test file's source; the B1
plan-design-review-plan-mode replay corpus reads test/skill-e2e-design.test.ts
like its sibling corpora already listed.
* fix: --case no longer deadlocks importing the running CLI
runCaseDiagnosis loaded runPaidShards with a dynamic import of
scripts/test-paid-shards.ts; when that file is the entry it is still in its
top-level await, so the import never resolved and `--case` hung after its
first line (on main since #3031, found by the per-case measurement runs). The
CLI now passes its runner in; library callers keep the lazy import.
* test: name the in-flight file and the native error when bun dies before its summary (#3037)
* Bun 1.4.2 everywhere CI and setup pin the tested version
Bun 1.4.0 on Windows aborts about 3% of free-suite shards with native
bad-handle errors (main too; #3037); the same head on 1.4.2 had none in 180
shard runs. Every current 1.4.0 pin moves together, as bun-version-drift
requires: setup-bun in every workflow (CSO orchestration included), the eval
image (sha256 from bun-v1.4.2's SHASUMS256.txt, re-hashed locally), GitLab,
the Ubicloud free-suite setup, gstack-bun-version.sh's tested version,
engines.bun and @types/bun, the install hint in generated skills, the Dia and
cookie native-qualification pins, and docs and tests that state the current
pin. Recorded 1.4.0 observations, fixtures, CHANGELOG history and the CSO
images' oven/bun:1.3.10 base stay.
* fix: --case runs a single-case file whole
A session option naming the case (testName: 'office-hours-section-loading')
made caseSelection pick test-name mode, whose filter matched no Bun test, so
every trial would run hollow. A file that registers only this case now runs
whole before any name match is tried.
* fix(office-hours): reviewer returns a hash-bound receipt instead of echoing its verdict
The spec reviewer now Writes its verdict once, seals it with
gstack-office-hours-review seal (validates the saved JSON and prints
OFFICE_HOURS_VERDICT round=N sha256=<hash> path=<verdict>), and returns
only that line. check --receipt recomputes the hash and fails closed on a
missing, malformed, stale-round, wrong-path or mismatched receipt. The
saved file stays the sole findings inventory; validators bind the receipt
to the saved bytes and the judge reads those bytes.
* fix(office-hours): only blocking findings send a design back for another review round
Review findings carry severity blocking|minor (verdict schema v2). PASS when
no blocking findings remain; minor findings are recorded in Reviewer
Concerns and the Spec Review table, never a reason for another round.
CONVERGENCE needs a persisting blocking prior. A persisting or unverified
blocking prior cannot be relabeled minor. The 3-round cap is unchanged.
* fix(office-hours): rounds 2 and 3 are delta re-reviews of the captured design diff
prepare saves each reviewed design as round-N.design.md and gives later
reviewers the exact line diff since the previous round. A new later-round
blocking finding must cite (changed_text) an excerpt of a changed line;
seal, check and the validators verify it against the snapshots and fail
closed when a citation or snapshot is missing. Other new observations are
minor. Severity, anti-downgrade and CONVERGENCE rules are unchanged.
* test(office-hours): preservation judge accepts COMPLETED with recorded minor findings
* fix(office-hours): parent fixes only blocking findings; callers may set --max-rounds
Between rounds the parent edits for blocking findings only; minor findings
stay recorded. gstack-office-hours-review takes --max-rounds 1|2|3 (default
3) on every command; reaching it stops at MAX_ITERATIONS. The marathon
fixture sets 2 rounds so round 1 (full) and round 2 (delta) run live.
* docs(changelog): office-hours review loop changes in v1.91.28.0
* fix(cso): helper JSON keeps run URLs only in the validated workflow slot
The shared redactor now treats GitHub Actions run ids as CI metadata
(c245d1bc2), so main's #3041 invariant that the same run digits stay
redacted outside qualification.workflow held only through the phone
false positive. Make it explicit in the CSO sanitizer.
* test(plan-ceo): split-overflow progress detector accepts the skill's candidate wording
Collection never ended when the model wrote 'E1 Slack:' / 'E1-SLACK:' or
labels like 'Include in this quarter' / 'Defer with flip trigger', so the
session ran the whole review (930-1464 s) and failed on its extra findings
or the case deadline (6 of 21 runs). The candidate check now accepts a
platform-bound E-id and the action is the bucket's leading verb, as the
skill names them (Include/Defer/Cut/Hold). The semantic judge, call floor
and include/defer/cut validation are unchanged. Replays the captured CI
37374526437, t2, t9 and t15 menus with negative controls.
* test(plan-ceo): split-overflow candidate identity is the one E1-E5 token
The skill fixes no header or question wording, and shape-matching kept
missing new forms (header 'D1.1 Slack' with 'SCOPE-E1:', 'D1.1 E1 Slack',
'E1 Slack DM bot ...:', a misspelled 'Mattermst'). Identity is now exactly
one E1-E5 token across the header and the question's first line, with no
other candidate's platform named. Options rules, judge, call floor and
include/defer/cut validation are unchanged. Replays all 31 measured runs;
the quoted-row controls now quote a second ledger id.
* v1.91.30.0: move past #3044's claimed 1.91.29.0
* test: register the split-overflow wording replay as a free fixture
* fix(skills): resolve judge-cited ambiguities in /qa and /plan-eng-review
- tasks JSONL keeps the raw branch as GIT_BRANCH instead of overwriting
gstack-slug's sanitized BRANCH used for artifact names
- the Codex outside-voice block runs for ready or unverified, matching
its routing rule
- plan-eng startup names the preamble's own setup prompts; the
cross-project question waits for Step 0
- /qa 8c: a fix that applies but leaves the finding reproducing gets one
revised fix, else it is reverted; browser verification names its before
screenshot; the exploratory loop drops its duplicate 3-step summary
* fix(plan-eng): keep the startup steps in their pinned order
* fix(plan-eng): explicit spawned sessions follow the spawned rule at the scope gate; one announcement rule
A missing tool still sends the prose menu whatever the session type, but a
session the caller or host explicitly marks spawned selects the menu's
Recommendation without prose or BLOCKED. The pre-load announcement
sentence now states Step 0's single check.
* eval policy v3: judge panels gate on the per-dimension median of 3 samples
A judge dimension now passes when at least 2 of its 3 samples meet the
unchanged threshold (judgePanelMedian); any other sample count or a
non-numeric sample fails closed. Thresholds, sample count, judge model and
prompts are unchanged; panel logs show every sample and the mean, and name
the median as the gate. Applies to the skill-llm-eval panels, the
workflow-judge cache, the auq-matrix substance panel and the calibration
replicas. EVAL_POLICY 2 -> 3 and HARNESS_VERSION 1 -> 2 (verdicts change),
so every case starts a new pass-rate series. Replays the captured panels
from jobs 112032744416 and 112049856586 as replayed evidence.
763 lines
38 KiB
Cheetah
763 lines
38 KiB
Cheetah
---
|
||
name: retro
|
||
preamble-tier: 2
|
||
version: 2.0.0
|
||
description: |
|
||
Weekly engineering retrospective. Analyzes commit history, work patterns,
|
||
and code quality metrics with persistent history and trend tracking.
|
||
Team-aware: breaks down per-person contributions with praise and growth areas.
|
||
Use when asked to "weekly retro", "what did we ship", or "engineering retrospective".
|
||
Proactively suggest at the end of a work week or sprint. (gstack)
|
||
allowed-tools:
|
||
- Bash
|
||
- Read
|
||
- Write
|
||
- Glob
|
||
- AskUserQuestion
|
||
triggers:
|
||
- weekly retro
|
||
- what did we ship
|
||
- engineering retrospective
|
||
gbrain:
|
||
schema: 1
|
||
context_queries:
|
||
- id: prior-retros
|
||
kind: filesystem
|
||
# /retro writes .context/retros/*.json (repo-local; see Step 13).
|
||
glob: ".context/retros/*.json"
|
||
sort: mtime_desc
|
||
limit: 5
|
||
render_as: "## Prior retros for this project"
|
||
- id: recent-timeline
|
||
kind: filesystem
|
||
glob: "{gstack_state_root}/projects/{repo_slug}/timeline.jsonl"
|
||
tail: 30
|
||
render_as: "## Recent timeline events"
|
||
- id: recent-learnings
|
||
kind: filesystem
|
||
glob: "{gstack_state_root}/projects/{repo_slug}/learnings.jsonl"
|
||
tail: 10
|
||
render_as: "## Recent learnings"
|
||
---
|
||
|
||
{{PREAMBLE}}
|
||
|
||
{{BASE_BRANCH_DETECT}}
|
||
|
||
# /retro — Weekly Engineering Retrospective
|
||
|
||
Analyze commit history, work patterns, and code quality for the current user and every contributor, with evidence-backed praise and growth opportunities.
|
||
|
||
## User-invocable
|
||
When the user types `/retro`, run this skill.
|
||
|
||
## Arguments
|
||
- `/retro` — default: last 7 days
|
||
- `/retro 24h` — last 24 hours
|
||
- `/retro 14d` — last 14 days
|
||
- `/retro 30d` — last 30 days
|
||
- `/retro compare` — compare current window vs prior same-length window
|
||
- `/retro compare 14d` — compare with explicit window
|
||
- `/retro global` — cross-project retro across all AI coding tools (7d default)
|
||
- `/retro global 14d` — cross-project retro with explicit window
|
||
|
||
{{GBRAIN_CONTEXT_LOAD}}
|
||
|
||
{{SECTION_INDEX:retro}}
|
||
|
||
## Instructions
|
||
|
||
Parse the argument to determine the time window. Default to 7 days if no argument given. All times should be reported in the user's **local timezone** (use the system default — do NOT set `TZ`).
|
||
|
||
**Midnight-aligned windows:** For day (`d`) and week (`w`) units, compute an absolute start date at local midnight, not a relative string. For example, if today is 2026-03-18 and the window is 7 days: the start date is 2026-03-11. Use `--since "2026-03-11T00:00:00"` — the explicit `T00:00:00` suffix ensures git starts from midnight. Without it, git uses the current wall-clock time (e.g., `--since "2026-03-11"` at 11pm means 11pm, not midnight). For week units, multiply by 7 to get days (e.g., `2w` = 14 days back). For hour (`h`) units, use `--since "N hours ago"` since midnight alignment does not apply to sub-day windows. Compute "today" from the user-visible `## currentDate` tag in the session reminder — NEVER from `date` (the system clock can be hours off in containerized harnesses). If you cannot reliably compute "today", stop and ask the user via AskUserQuestion rather than proceeding.
|
||
|
||
**Argument validation:** If the argument doesn't match a number followed by `d`, `h`, or `w`, the word `compare` (optionally followed by a window), or the word `global` (optionally followed by a window), show this usage and stop:
|
||
```
|
||
Usage: /retro [window | compare | global]
|
||
/retro — last 7 days (default)
|
||
/retro 24h — last 24 hours
|
||
/retro 14d — last 14 days
|
||
/retro 30d — last 30 days
|
||
/retro compare — compare this period vs prior period
|
||
/retro compare 14d — compare with explicit window
|
||
/retro global — cross-project retro across all AI tools (7d default)
|
||
/retro global 14d — cross-project retro with explicit window
|
||
```
|
||
|
||
**Routing:** `global` skips all repo-scoped steps, including Prior Learnings, Step 0.5, and post-report capture; follow **Global Retrospective Mode** (no git repo required). `compare` follows **Compare Mode**. Both accept an optional window (default 7d). Otherwise run the repo-scoped flow below.
|
||
|
||
`<default>` is the base branch from the preceding **Step 0: Detect platform and base branch**. `<today>` is the session-reminder date; reuse it in all snapshot filenames, never re-read the clock.
|
||
|
||
{{LEARNINGS_SEARCH}}
|
||
|
||
### Step 0.5: Freshness pre-flight (fetch)
|
||
|
||
Refresh `origin/<default>` so the retro doesn't misreport against a stale local ref. If the repo has no `origin` remote this fails harmlessly — the metrics script (Step 1) falls back to the local branch and its guard lines disclose it:
|
||
|
||
```bash
|
||
git fetch origin <default> --quiet 2>/dev/null \
|
||
|| echo "RETRO_FETCH: failed (offline or no remote) — proceeding against last-known refs"
|
||
```
|
||
|
||
Remember whether the fetch succeeded — the stale-base guard in Step 1 only BLOCKs when it did.
|
||
|
||
### Step 1: Gather Metrics (one command)
|
||
|
||
Run `gstack-retro-metrics` with the detected base branch and computed start:
|
||
|
||
```bash
|
||
_RM="{{RUNTIME_ROOT}}/bin/gstack-retro-metrics"
|
||
[ -x "$_RM" ] || _RM=".claude/skills/gstack/bin/gstack-retro-metrics"
|
||
"$_RM" --base "<default>" --since "<since>" \
|
||
|| echo "RETRO_METRICS: unavailable — stale install (read the helper source for manual computation)"
|
||
```
|
||
|
||
Read the `METRIC_NAME: value` lines. **Degraded mode:** without `RETRO_METRICS_PROTO: 1`, reproduce computations from the installed `bin/gstack-retro-metrics` source, not the presentation steps below. If source or metrics are unavailable, say so; never invent values. Suggest `/gstack-upgrade` to restore the helper.
|
||
|
||
**Identity:** `USER_NAME` is **"you"** — the person reading this retro. All other authors are teammates. Orient the narrative around this: "your" commits vs teammate contributions.
|
||
|
||
**Stale-base + bad-today-anchor guard.** `GUARD_LATEST_COMMIT: <DATE>` is the newest commit on the analyzed ref. A wrong "today" or stale ref can produce an empty window. Evaluate in order:
|
||
|
||
1. If `GUARD_REMOTE: none` or `GUARD_HEAD: detached` or the Step 0.5 fetch failed: proceed, but carry the disclosure into the narrative ("offline run, window not freshness-verified") rather than silently misreporting.
|
||
2. If the Step 0.5 fetch succeeded AND the `GUARD_LATEST_COMMIT` date is **older than (today − window-days)**: BLOCK with: "Retro window is stale. Latest commit on `origin/<default>` was `<DATE>`, but the window covers `<since>` to `<today>`. This usually means either (a) today's date is wrong in this session or (b) `origin/<default>` is materially behind the remote. Confirm today's date via the session reminder; if today is correct, run `git fetch origin <default>` manually and re-run /retro." Stop the skill until the user resolves.
|
||
3. Otherwise, write: "RETRO_GUARD: latest commit `<DATE>` within window — proceeding."
|
||
|
||
Also check `RETRO_REF`: if it is not `origin/<default>` (local-only repo, missing remote branch), disclose which ref the retro analyzed.
|
||
|
||
**Metric line reference** (what the script emits):
|
||
|
||
| Line | Meaning |
|
||
|------|---------|
|
||
| `COMMIT: hash\|author\|datetime\|+ins/-del\|subject` | One per commit, newest first (capped at 300) — the raw material for narrative anchoring |
|
||
| `COMMITS` / `MERGE_COMMITS` / `CONTRIBUTORS` | Window totals on the analyzed ref |
|
||
| `INSERTIONS` / `DELETIONS` / `NET_LOC` | Raw LOC |
|
||
| `LOGICAL_SLOC_ADDED` | Non-blank, non-comment added lines — the primary code-volume metric |
|
||
| `TEST_INSERTIONS` / `TEST_RATIO` | Test LOC (test/spec paths + .test./.spec. suffixes) and its share of insertions |
|
||
| `WEIGHTED_COMMITS` | Commits × files-touched, capped at 20 per commit |
|
||
| `ACTIVE_DAYS` | Distinct local dates with commits |
|
||
| `SESSIONS` / `DEEP_SESSIONS` / `MEDIUM_SESSIONS` / `MICRO_SESSIONS` | 45-minute-gap session detection: deep 50+ min, medium 20-50, micro <20 |
|
||
| `TOTAL_ACTIVE_MINUTES` / `AVG_SESSION_MINUTES` / `LOC_PER_SESSION_HOUR` | Session time aggregates (LOC/hour pre-rounded to nearest 50) |
|
||
| `COMMIT_TYPES` / `FIX_RATIO` | Conventional-commit prefix mix |
|
||
| `COMMIT_SIZE_BUCKETS` | small <100 / medium 100-500 / large 500-1500 / xl 1500+ LOC per commit |
|
||
| `HOURS` / `PEAK_HOUR` | Hourly commit histogram (local time), nonzero hours only |
|
||
| `FOCUS_SCORE` | % of file changes in the single busiest top-level directory |
|
||
| `BIGGEST_COMMIT` | Highest-LOC commit in the window (ship-of-the-week candidate) |
|
||
| `HOTSPOT: count file` | Top 10 most-changed files |
|
||
| `AUTHOR: name\|commits\|ins\|del\|test_ratio\|top_areas\|types\|peak_hour` | Per-contributor rollup, sorted by commits desc |
|
||
| `AUTHOR_BIGGEST: name\|hash\|loc\|subject` | Each contributor's biggest ship |
|
||
| `COAUTHOR: hash\|name` / `AI_ASSISTED_COMMITS` | Human co-author credit lines; count of commits with AI trailers |
|
||
| `WEEK: wN\|commits\|ins\|del\|test_ratio` | Weekly buckets, w0 = newest (for Step 10 trends) |
|
||
| `PR_REFS` / `PRS_REFERENCED` | PR/MR numbers from commit subjects (GitHub #NNN, GitLab !NNN) |
|
||
| `TEST_FILES_TOTAL` / `TEST_FILES_CHANGED` / `REGRESSION_TEST_COMMITS` / `REGRESSION_COMMIT` | Test health: repo-wide test file count, test files changed in window, `test(qa):` / `test(design):` / `test: coverage` commits |
|
||
| `VERSION_RANGE` | First → last VERSION file value in the window (when tracked) |
|
||
| `TEAM_STREAK` / `USER_STREAK` | Consecutive commit days with anchor date (Step 11) |
|
||
| `RETRO_CONTEXT` / `GREPTILE_HISTORY` / `TODOS_FILE` / `SKILL_USAGE_LOG` / `EUREKA_LOG` | Presence of optional inputs — Read the ones marked present |
|
||
|
||
**Optional inputs** (Read each file the script marks `present`):
|
||
|
||
- `RETRO_CONTEXT: present` → Read the `retro-context.md` path that line printed. It is user-authored and may contain meeting notes, calendar events, decisions, and other context that doesn't appear in git history. Incorporate it into the retro narrative where relevant.
|
||
- `GREPTILE_HISTORY: present` → Read the `greptile-history.md` path that line printed. Filter entries to the retro window by date. Count by type: `fix`, `fp`, `already-fixed`. Signal ratio = `(fix + already-fixed) / (fix + already-fixed + fp)`. Skip unparseable lines silently; if no entries fall in the window, skip the Greptile metric row.
|
||
- `TODOS_FILE: present` → Read `TODOS.md`. Compute: total open TODOs (exclude the `## Completed` section), P0/P1 count, P2 count, items completed this period (Completed entries dated within the window), items added this period (cross-reference `COMMIT:` lines that touched TODOS.md).
|
||
- `SKILL_USAGE_LOG: present` → Read the path it prints (`$GSTACK_STATE_ROOT/analytics/skill-usage.jsonl`). Filter to the window by `ts`. Separate skill activations (no `event` field) from hook fires (`event: "hook_fire"`). Aggregate by skill name.
|
||
- `EUREKA_LOG: present` → Read the path it prints (`$GSTACK_STATE_ROOT/analytics/eureka.jsonl`). Filter to the window by `ts`. For each eureka moment note the skill that flagged it, the branch, and a one-line summary of the insight.
|
||
|
||
### Step 2: Compute Metrics
|
||
|
||
Most rows come directly from the metric lines. Gather the two shipping outcomes separately before building the table:
|
||
|
||
- **Merged PRs:** On GitHub, run `gh pr list --state merged --base "<default>" --search "merged:>=<start-date>" --limit 1000 --json number,title,mergedAt`. Filter `mergedAt` to the exact requested window, including its upper bound in compare mode. If the result hits the limit, paginate via the hosting API or label the count partial. On GitLab use the equivalent merged-MR listing. If hosting data is unavailable, show **PRs referenced** = `PRS_REFERENCED` instead; these are not verified merges. Save `prs_merged: null` in that case.
|
||
- **Features shipped:** Read CHANGELOG changes on `RETRO_REF` in the same window (`git log <ref> --since "<since>" -p -- CHANGELOG.md`, adding `--until` for the prior window). Combine newly added user-visible capabilities with verified merged PR titles. Deduplicate entries referring to the same capability, excluding fixes, chores, and reverted work. Keep a short list of feature names with their source commit/PR beside the count. If neither source is available, show unavailable, not zero. This is an evidence-backed classification, not a metric-script line.
|
||
|
||
Use the analyzed ref in the commit-count label (not always `main`). Test health counts **files changed**, not tests added or test cases; use `TEST_FILES_TOTAL`, `TEST_FILES_CHANGED`, and `REGRESSION_TEST_COMMITS` respectively.
|
||
|
||
| Metric | Value |
|
||
|--------|-------|
|
||
| **Features shipped** (from CHANGELOG + merged PR titles) | N |
|
||
| Commits to analyzed ref | N |
|
||
| Weighted commits (`WEIGHTED_COMMITS`) | N |
|
||
| Contributors | N |
|
||
| PRs merged | N |
|
||
| **Logical SLOC added** (`LOGICAL_SLOC_ADDED` — primary code-volume metric) | N |
|
||
| Raw LOC: insertions | N |
|
||
| Raw LOC: deletions | N |
|
||
| Raw LOC: net | N |
|
||
| Test LOC (insertions) | N |
|
||
| Test LOC ratio | N% |
|
||
| Version range | vX.Y.Z.W → vX.Y.Z.W |
|
||
| Active days | N |
|
||
| Detected sessions | N |
|
||
| Avg raw LOC/session-hour | N |
|
||
| Greptile signal | N% (Y catches, Z FPs) |
|
||
| Test Health | N test files · M changed this period · K regression test commits |
|
||
|
||
Lead with user-visible features, then commit and logical-SLOC metrics; raw LOC
|
||
is only context, not impact.
|
||
|
||
Then show a **per-author leaderboard** immediately below, from the `AUTHOR:` lines:
|
||
|
||
```
|
||
Contributor Commits +/- Top area
|
||
You (garry) 32 +2400/-300 browse/
|
||
alice 12 +800/-150 app/services/
|
||
bob 3 +120/-40 tests/
|
||
```
|
||
|
||
Sort by commits descending. The current user (`USER_NAME`) always appears first, labeled "You (name)".
|
||
|
||
Conditional rows (skip each when its input is absent or empty in the window):
|
||
|
||
```
|
||
| Backlog Health | N open (X P0/P1, Y P2) · Z completed this period |
|
||
| Skill Usage | /ship(12) /qa(8) /review(5) · 3 safety hook fires |
|
||
| Eureka Moments | 2 this period |
|
||
```
|
||
|
||
If eureka moments exist, list them:
|
||
```
|
||
EUREKA /office-hours (branch: garrytan/auth-rethink): "Session tokens don't need server storage — browser crypto API makes client-side JWT validation viable"
|
||
EUREKA /plan-eng-review (branch: garrytan/cache-layer): "Redis isn't needed here — Bun's built-in LRU cache handles this workload"
|
||
```
|
||
|
||
### Step 3: Commit Time Distribution
|
||
|
||
Render the `HOURS` line as an hourly histogram in local time:
|
||
|
||
```
|
||
Hour Commits ████████████████
|
||
00: 4 ████
|
||
07: 5 █████
|
||
...
|
||
```
|
||
|
||
Identify and call out:
|
||
- Peak hours
|
||
- Dead zones
|
||
- Whether pattern is bimodal (morning/evening) or continuous
|
||
- Late-night coding clusters (after 10pm)
|
||
|
||
### Step 4: Work Session Detection
|
||
|
||
Sessions are pre-computed with a **45-minute gap** threshold between consecutive commits (`SESSIONS`, `DEEP_SESSIONS` 50+ min, `MEDIUM_SESSIONS` 20-50 min, `MICRO_SESSIONS` <20 min — typically single-commit fire-and-forget). Report:
|
||
- Session count and the deep/medium/micro split
|
||
- Total active coding time (`TOTAL_ACTIVE_MINUTES`) and average session length
|
||
- LOC per hour of active time (`LOC_PER_SESSION_HOUR`)
|
||
|
||
### Step 5: Commit Type Breakdown
|
||
|
||
Render `COMMIT_TYPES` (feat/fix/refactor/test/chore/docs) as a percentage bar:
|
||
|
||
```
|
||
feat: 20 (40%) ████████████████████
|
||
fix: 27 (54%) ███████████████████████████
|
||
refactor: 2 ( 4%) ██
|
||
```
|
||
|
||
Flag if `FIX_RATIO` exceeds 50% — this signals a "ship fast, fix fast" pattern that may indicate review gaps.
|
||
|
||
### Step 6: Hotspot Analysis
|
||
|
||
Show the `HOTSPOT` lines (top 10 most-changed files). Flag:
|
||
- Files changed 5+ times (churn hotspots)
|
||
- Test files vs production files in the hotspot list
|
||
- VERSION/CHANGELOG frequency (version discipline indicator)
|
||
|
||
### Step 7: PR Size Distribution
|
||
|
||
Report `COMMIT_SIZE_BUCKETS`:
|
||
- **Small** (<100 LOC)
|
||
- **Medium** (100-500 LOC)
|
||
- **Large** (500-1500 LOC)
|
||
- **XL** (1500+ LOC)
|
||
|
||
### Step 8: Focus Score + Ship of the Week
|
||
|
||
**Focus score:** `FOCUS_SCORE` is the percentage of file changes touching the single most-changed top-level directory (e.g., `app/services/`). Higher score = deeper focused work. Lower score = scattered context-switching. Report as: "Focus score: 62% (app/services/)"
|
||
|
||
**Ship of the week:** `BIGGEST_COMMIT` is the highest-LOC change in the window. Highlight it:
|
||
- PR number (match against `PR_REFS` / the subject) and title
|
||
- LOC changed
|
||
- Why it matters (infer from commit messages and files touched)
|
||
|
||
### Step 9: Team Member Analysis
|
||
|
||
For each contributor (including the current user), the `AUTHOR:` line carries commits, insertions, deletions, test ratio, top areas, commit type mix, and peak hour; `AUTHOR_BIGGEST:` carries their single highest-impact commit. Use the `COMMIT:` lines to anchor everything in actual work.
|
||
|
||
**For the current user ("You"):** Include session analysis, time patterns, and focus score: "Your peak hours...", "Your biggest ship..."
|
||
|
||
**For each teammate:** Write 2-3 sentences covering what they worked on and their pattern. Then:
|
||
|
||
- **Praise** (1-2 specifics): cite commits and what was good, not generic praise.
|
||
- **Opportunity for growth** (1 specific): tie an actionable suggestion to data, not criticism. Step 14 supplies examples.
|
||
|
||
**If only one contributor (solo repo):** Skip the team breakdown — the retro is personal.
|
||
|
||
**Co-author credit:** `COAUTHOR:` lines carry human `Co-Authored-By:` trailers — credit those authors for the commit alongside the primary author. AI co-authors (e.g., `noreply@anthropic.com`) are counted in `AI_ASSISTED_COMMITS` instead — track "AI-assisted commits" as a separate metric, never as a team member.
|
||
|
||
### Step 10: Week-over-Week Trends (if window >= 14d)
|
||
|
||
If the time window is 14 days or more, use the `WEEK:` lines (w0 = the week containing the newest commit) to show trends:
|
||
- Commits per week (total; per-author from the `COMMIT:` lines)
|
||
- LOC per week
|
||
- Test ratio per week
|
||
- Fix ratio per week
|
||
|
||
### Step 11: Streak Tracking
|
||
|
||
`TEAM_STREAK` and `USER_STREAK` count consecutive days with at least 1 commit (full history, no cutoff), anchored at the **newest commit date** — not at today, because the script never trusts the system clock. Interpret against today from the session reminder:
|
||
- If the anchor date is today or yesterday, the streak is live: "Team shipping streak: 47 consecutive days" / "Your shipping streak: 32 consecutive days"
|
||
- If the anchor is older, the streak is broken: report 0 days and note the last shipping day.
|
||
|
||
### Step 11.5: Shortcut Debt Ledger
|
||
|
||
Harvest deliberate `gstack-shortcut(...)` markers — the trail left when the user
|
||
accepted a Completeness ≤ 7 option (see the AskUserQuestion Format section). Zero
|
||
matches is the healthy case, not a failure:
|
||
|
||
```bash
|
||
grep -rn "gstack-shortcut(" . \
|
||
--exclude-dir=.git --exclude-dir=node_modules --exclude-dir=vendor \
|
||
--exclude-dir=.claude --exclude-dir=dist \
|
||
--exclude="SKILL.md" --exclude="*.md.tmpl" 2>/dev/null \
|
||
| grep -vE "gstack-shortcut\(dec-(<|\*)" || true
|
||
```
|
||
|
||
Discard remaining hits that only document or test the convention (checklists,
|
||
resolver examples, tests). Count only real shortcuts in this repo's code.
|
||
|
||
For each hit, one ledger row: `<file>:<line>, <what was simplified>. ceiling: <X>. upgrade: <Y>.`
|
||
- Markers carry a decision id (`dec-<id>`): join against `gstack-decision-search`
|
||
output — the ledger entry is the source of truth; never double-count a marker
|
||
against its resurfaced decision.
|
||
- Markers WITHOUT an id: tag `unlinked`.
|
||
- Markers naming no upgrade trigger: tag `no-trigger` — those are the ones that
|
||
silently rot.
|
||
|
||
End the section with: `N markers, M with no trigger.` If none: `No shortcut debt. Clean ledger.`
|
||
|
||
### Step 12: Load History & Compare
|
||
|
||
Before saving the new snapshot, check for prior retro history:
|
||
|
||
```bash
|
||
setopt +o nomatch 2>/dev/null || true # zsh compat
|
||
ls -t .context/retros/*.json 2>/dev/null
|
||
```
|
||
|
||
**If prior retros exist:** Load the most recent one with the same `window` using the Read tool; if none matches, disclose that and skip historical deltas. Calculate deltas for available key metrics and include a **Trends vs Last Retro** section (in `compare` mode use the freshly computed prior period instead):
|
||
```
|
||
Last Now Delta
|
||
Test ratio: 22% → 41% ↑19pp
|
||
Sessions: 10 → 14 ↑4
|
||
LOC/hour: 200 → 350 ↑75%
|
||
Fix ratio: 54% → 30% ↓24pp (improving)
|
||
Commits: 32 → 47 ↑47%
|
||
Deep sessions: 3 → 5 ↑2
|
||
```
|
||
|
||
**If no prior retros exist:** Skip the comparison section and append: "First retro recorded — run again next week to see trends."
|
||
|
||
### Step 13: Save Retro History
|
||
|
||
After computing all metrics (including streak) and loading any prior history for comparison, draft the tweetable summary using the format in Step 14, then save a JSON snapshot. The Step 14 narrative must reuse this exact summary. `streak_days` is the live **team** streak from Step 11 (0 when broken); put the personal streak in `user_streak_days`.
|
||
|
||
```bash
|
||
mkdir -p .context/retros
|
||
```
|
||
|
||
Determine the next unused sequence number for today (substitute the session-reminder date for `<today>`):
|
||
```bash
|
||
setopt +o nomatch 2>/dev/null || true # zsh compat
|
||
today="<today>"
|
||
next=1
|
||
while [ -e ".context/retros/${today}-${next}.json" ]; do next=$((next + 1)); done
|
||
# Save as .context/retros/${today}-${next}.json
|
||
```
|
||
|
||
Use the Write tool to save the JSON file with this schema:
|
||
```json
|
||
{
|
||
"date": "2026-03-08",
|
||
"window": "7d",
|
||
"metrics": {
|
||
"commits": 47,
|
||
"contributors": 3,
|
||
"prs_merged": 12,
|
||
"insertions": 3200,
|
||
"deletions": 800,
|
||
"net_loc": 2400,
|
||
"test_loc": 1300,
|
||
"test_ratio": 0.41,
|
||
"active_days": 6,
|
||
"sessions": 14,
|
||
"deep_sessions": 5,
|
||
"avg_session_minutes": 42,
|
||
"loc_per_session_hour": 350,
|
||
"feat_pct": 0.40,
|
||
"fix_pct": 0.30,
|
||
"peak_hour": 22,
|
||
"ai_assisted_commits": 32
|
||
},
|
||
"authors": {
|
||
"Garry Tan": { "commits": 32, "insertions": 2400, "deletions": 300, "test_ratio": 0.41, "top_area": "browse/" },
|
||
"Alice": { "commits": 12, "insertions": 800, "deletions": 150, "test_ratio": 0.35, "top_area": "app/services/" }
|
||
},
|
||
"version_range": ["1.16.0.0", "1.16.1.0"],
|
||
"streak_days": 47,
|
||
"user_streak_days": 32,
|
||
"tweetable": "Week of Mar 1: 47 commits (3 contributors), 3.2k LOC, 38% tests, 12 PRs, peak: 10pm",
|
||
"greptile": {
|
||
"fixes": 3,
|
||
"fps": 1,
|
||
"already_fixed": 2,
|
||
"signal_pct": 83
|
||
}
|
||
}
|
||
```
|
||
|
||
**Note:** Only include the `greptile` field if `greptile-history.md` (the path `GREPTILE_HISTORY` printed) exists and has entries within the time window. Only include the `backlog` field if `TODOS.md` exists. Only include the `test_health` field if test files were found (`TEST_FILES_TOTAL` > 0). If any has no data, omit the field entirely.
|
||
|
||
Include test health data in the JSON when test files exist:
|
||
```json
|
||
"test_health": {
|
||
"total_test_files": 47,
|
||
"regression_test_commits": 3,
|
||
"test_files_changed": 8
|
||
}
|
||
```
|
||
|
||
Include backlog data in the JSON when TODOS.md exists:
|
||
```json
|
||
"backlog": {
|
||
"total_open": 28,
|
||
"p0_p1": 2,
|
||
"p2": 8,
|
||
"completed_this_period": 3,
|
||
"added_this_period": 1
|
||
}
|
||
```
|
||
|
||
### Step 14: Write the Narrative
|
||
|
||
{{SECTION:report-format}}
|
||
|
||
After delivering the repo-scoped report, run the following learning capture and result-save steps, then stop. Do not fall through into Global Retrospective Mode.
|
||
|
||
{{LEARNINGS_LOG}}
|
||
|
||
{{GBRAIN_SAVE_RESULTS}}
|
||
|
||
---
|
||
|
||
## Global Retrospective Mode
|
||
|
||
`/retro global [window]` follows only this flow and works outside a git repo.
|
||
|
||
### Global Step 1: Compute time window
|
||
|
||
Same midnight-aligned logic as the regular retro. Default 7d. The second argument after `global` is the window (e.g., `14d`, `30d`, `24h`).
|
||
|
||
### Global Step 2: Run discovery
|
||
|
||
Locate and run the discovery script using this fallback chain:
|
||
|
||
```bash
|
||
DISCOVER_BIN=""
|
||
[ -x ~/.claude/skills/gstack/bin/gstack-global-discover ] && DISCOVER_BIN=~/.claude/skills/gstack/bin/gstack-global-discover
|
||
[ -z "$DISCOVER_BIN" ] && [ -x .claude/skills/gstack/bin/gstack-global-discover ] && DISCOVER_BIN=.claude/skills/gstack/bin/gstack-global-discover
|
||
[ -z "$DISCOVER_BIN" ] && which gstack-global-discover >/dev/null 2>&1 && DISCOVER_BIN=$(which gstack-global-discover)
|
||
[ -z "$DISCOVER_BIN" ] && [ -f bin/gstack-global-discover.ts ] && DISCOVER_BIN="bun run bin/gstack-global-discover.ts"
|
||
echo "DISCOVER_BIN: $DISCOVER_BIN"
|
||
```
|
||
|
||
If no binary is found, tell the user: "Discovery script not found. Run `bun run build` in the gstack directory to compile it." and stop.
|
||
|
||
Run the discovery:
|
||
```bash
|
||
$DISCOVER_BIN --since "<window>" --format json 2>/tmp/gstack-discover-stderr
|
||
```
|
||
|
||
Read the stderr output from `/tmp/gstack-discover-stderr` for diagnostic info. Parse the JSON output from stdout.
|
||
|
||
If `total_sessions` is 0, say: "No AI coding sessions found in the last <window>. Try a longer window: `/retro global 30d`" and stop.
|
||
|
||
### Global Step 3: Run git log on each discovered repo
|
||
|
||
For each repo in the discovery JSON's `repos` array, find the first valid path in `paths[]` (directory exists with `.git/`). If no valid path exists, skip the repo and note it.
|
||
|
||
**For local-only repos** (where `remote` starts with `local:`): skip `git fetch` and use the local default branch. Use `git log HEAD` instead of `git log origin/$DEFAULT`.
|
||
|
||
**For repos with remotes:**
|
||
|
||
```bash
|
||
git -C <path> fetch origin --quiet 2>/dev/null
|
||
```
|
||
|
||
Detect the default branch for each repo: first try `git symbolic-ref refs/remotes/origin/HEAD`, then check common branch names (`main`, `master`), then fall back to `git rev-parse --abbrev-ref HEAD`. Use the detected branch as `<default>` in the commands below.
|
||
|
||
```bash
|
||
# Commits with stats
|
||
git -C <path> log origin/$DEFAULT --since="<start_date>T00:00:00" --format="%H|%aN|%ai|%s" --shortstat
|
||
|
||
# Commit timestamps for session detection, streak, and context switching
|
||
git -C <path> log origin/$DEFAULT --since="<start_date>T00:00:00" --format="%at|%aN|%ai|%s" | sort -n
|
||
|
||
# Per-author commit counts
|
||
git -C <path> shortlog origin/$DEFAULT --since="<start_date>T00:00:00" -sn --no-merges
|
||
|
||
# PR/MR numbers from commit messages (GitHub #NNN, GitLab !NNN)
|
||
git -C <path> log origin/$DEFAULT --since="<start_date>T00:00:00" --format="%s" | grep -oE '[#!][0-9]+' | sort -t'#' -k1 | uniq
|
||
```
|
||
|
||
For repos that fail (deleted paths, network errors): skip and note "N repos could not be reached."
|
||
|
||
### Global Step 4: Compute global shipping streak
|
||
|
||
For each repo, get commit dates (capped at 365 days):
|
||
|
||
```bash
|
||
git -C <path> log origin/$DEFAULT --since="365 days ago" --format="%ad" --date=format:"%Y-%m-%d" | sort -u
|
||
```
|
||
|
||
Union all dates across all repos. Count backward from today — how many consecutive days have at least one commit to ANY repo? If the streak hits 365 days, display as "365+ days".
|
||
|
||
### Global Step 5: Compute context switching metric
|
||
|
||
From the commit timestamps gathered in Step 3, group by date. For each date, count how many distinct repos had commits that day. Report:
|
||
- Average repos/day
|
||
- Maximum repos/day
|
||
- Which days were focused (1 repo) vs. fragmented (3+ repos)
|
||
|
||
### Global Step 6: Per-tool productivity patterns
|
||
|
||
From the discovery JSON, analyze tool usage patterns:
|
||
- Which AI tool is used for which repos (exclusive vs. shared)
|
||
- Session count per tool
|
||
- Behavioral patterns (e.g., "Codex used exclusively for myapp, Claude Code for everything else")
|
||
|
||
### Global Step 7: Aggregate and draft narrative
|
||
|
||
Draft the report below without publishing it yet. Load history in Global Step 8, insert its trends table after **All Projects Overview**, then save the completed snapshot in Global Step 9 and deliver the report. Reuse the drafted tweetable summary in the snapshot.
|
||
|
||
Output the screenshot-friendly **personal card first**, then the team/project breakdown.
|
||
|
||
---
|
||
|
||
**Tweetable summary** (first line, before everything else):
|
||
```
|
||
Week of Mar 14: 5 projects, 138 commits, 250k LOC across 5 repos | 48 AI sessions | Streak: 52d 🔥
|
||
```
|
||
|
||
## 🚀 Your Week: [user name] — [date range]
|
||
|
||
Filter per-repo data by `git config user.name` and aggregate personal totals.
|
||
The card contains only this user's stats, not team totals. Use a left border only;
|
||
pad names to the longest name and never truncate them.
|
||
|
||
```
|
||
╔═══════════════════════════════════════════════════════════════
|
||
║ [USER NAME] — Week of [date]
|
||
╠═══════════════════════════════════════════════════════════════
|
||
║
|
||
║ [N] commits across [M] projects
|
||
║ +[X]k LOC added · [Y]k LOC deleted · [Z]k net
|
||
║ [N] AI coding sessions (CC: X, Codex: Y, Gemini: Z)
|
||
║ [N]-day shipping streak 🔥
|
||
║
|
||
║ PROJECTS
|
||
║ ─────────────────────────────────────────────────────────
|
||
║ [repo_name_full] [N] commits +[X]k LOC [solo/team]
|
||
║ [repo_name_full] [N] commits +[X]k LOC [solo/team]
|
||
║ [repo_name_full] [N] commits +[X]k LOC [solo/team]
|
||
║
|
||
║ SHIP OF THE WEEK
|
||
║ [PR title] — [LOC] lines across [N] files
|
||
║
|
||
║ TOP WORK
|
||
║ • [1-line description of biggest theme]
|
||
║ • [1-line description of second theme]
|
||
║ • [1-line description of third theme]
|
||
║
|
||
║ Powered by gstack
|
||
╚═══════════════════════════════════════════════════════════════
|
||
```
|
||
|
||
**Rules for the personal card:**
|
||
- Only show repos where the user has commits. Skip repos with 0 commits.
|
||
- Sort repos by user's commit count descending.
|
||
- Widen the card to fit full repo names; align columns.
|
||
- For LOC, use "k" formatting for thousands (e.g., "+64.0k" not "+64010").
|
||
- Role: "solo" if user is the only contributor, "team" if others contributed.
|
||
- Ship of the Week: the user's single highest-LOC PR across ALL repos.
|
||
- Top Work: 3 themes synthesized from commit messages, not a list of commits.
|
||
- The card must explain the user's week without surrounding context.
|
||
- Do NOT include team members, project totals, or context switching data here.
|
||
|
||
**Personal streak:** Use the user's own commits across all repos (filtered by
|
||
`--author`) to compute a personal streak, separate from the team streak.
|
||
|
||
---
|
||
|
||
## Global Engineering Retro: [date range]
|
||
|
||
Full team/project analysis follows the personal card.
|
||
|
||
### All Projects Overview
|
||
| Metric | Value |
|
||
|--------|-------|
|
||
| Projects active | N |
|
||
| Total commits (all repos, all contributors) | N |
|
||
| Total LOC | +N / -N |
|
||
| AI coding sessions | N (CC: X, Codex: Y, Gemini: Z) |
|
||
| Active days | N |
|
||
| Global shipping streak (any contributor, any repo) | N consecutive days |
|
||
| Context switches/day | N avg (max: M) |
|
||
|
||
### Per-Project Breakdown
|
||
For each repo (sorted by commits descending):
|
||
- Repo name (with % of total commits)
|
||
- Commits, LOC, PRs merged, top contributor
|
||
- Key work (inferred from commit messages)
|
||
- AI sessions by tool
|
||
|
||
**Your Contributions** (sub-section within each project):
|
||
For each project, filter by `git config user.name` and include:
|
||
- Your commits / total commits (with %)
|
||
- Your LOC (+insertions / -deletions)
|
||
- Your key work (inferred from YOUR commit messages only)
|
||
- Your commit type mix (feat/fix/refactor/chore/docs breakdown)
|
||
- Your biggest ship in this repo (highest-LOC commit or PR)
|
||
|
||
If the user is the only contributor, say "Solo project — all commits are yours."
|
||
If the user has 0 commits in a repo (team project they didn't touch this period),
|
||
say "No commits this period — [N] AI sessions only." and skip the breakdown.
|
||
|
||
Format:
|
||
```
|
||
**Your contributions:** 47/244 commits (19%), +4.2k/-0.3k LOC
|
||
Key work: Writer Chat, email blocking, security hardening
|
||
Biggest ship: PR #605 — Writer Chat eats the admin bar (2,457 ins, 46 files)
|
||
Mix: feat(3) fix(2) chore(1)
|
||
```
|
||
|
||
### Cross-Project Patterns
|
||
- Time allocation across projects (% breakdown, use YOUR commits not total)
|
||
- Peak productivity hours aggregated across all repos
|
||
- Focused vs. fragmented days
|
||
- Context switching trends
|
||
|
||
### Tool Usage Analysis
|
||
Per-tool breakdown with behavioral patterns:
|
||
- Claude Code: N sessions across M repos — patterns observed
|
||
- Codex: N sessions across M repos — patterns observed
|
||
- Gemini: N sessions across M repos — patterns observed
|
||
|
||
### Ship of the Week (Global)
|
||
Highest-impact PR across ALL projects. Identify by LOC and commit messages.
|
||
|
||
### 3 Cross-Project Insights
|
||
What the global view reveals that no single-repo retro could show.
|
||
|
||
### 3 Habits for Next Week
|
||
Considering the full cross-project picture.
|
||
|
||
---
|
||
|
||
### Global Step 8: Load history & compare
|
||
|
||
```bash
|
||
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
||
setopt +o nomatch 2>/dev/null || true # zsh compat
|
||
ls -t "$GSTACK_STATE_ROOT"/retros/global-*.json 2>/dev/null | head -5
|
||
```
|
||
|
||
**Only compare against a prior retro with the same `window` value** (e.g., 7d vs 7d). If the most recent prior retro has a different window, skip comparison and note: "Prior global retro used a different window — skipping comparison."
|
||
|
||
If a matching prior retro exists, load it with the Read tool. Show a **Trends vs Last Global Retro** table with deltas for key metrics: total commits, LOC, sessions, streak, context switches/day.
|
||
|
||
If no prior global retros exist, append: "First global retro recorded — run again next week to see trends."
|
||
|
||
### Global Step 9: Save snapshot
|
||
|
||
```bash
|
||
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
||
mkdir -p "$GSTACK_STATE_ROOT"/retros
|
||
```
|
||
|
||
Determine the next unused sequence number for today, using the same session-reminder date as Global Step 1:
|
||
```bash
|
||
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
||
setopt +o nomatch 2>/dev/null || true # zsh compat
|
||
today="<today>"
|
||
next=1
|
||
while [ -e "$GSTACK_STATE_ROOT/retros/global-${today}-${next}.json" ]; do next=$((next + 1)); done
|
||
echo "RETRO_FILE: $GSTACK_STATE_ROOT/retros/global-${today}-${next}.json"
|
||
```
|
||
|
||
Use the Write tool to save JSON to the printed `RETRO_FILE`:
|
||
|
||
```json
|
||
{
|
||
"type": "global",
|
||
"date": "2026-03-21",
|
||
"window": "7d",
|
||
"projects": [
|
||
{
|
||
"name": "gstack",
|
||
"remote": "<detected from git remote get-url origin, normalized to HTTPS>",
|
||
"commits": 47,
|
||
"insertions": 3200,
|
||
"deletions": 800,
|
||
"sessions": { "claude_code": 15, "codex": 3, "gemini": 0 }
|
||
}
|
||
],
|
||
"totals": {
|
||
"commits": 182,
|
||
"insertions": 15300,
|
||
"deletions": 4200,
|
||
"projects": 5,
|
||
"active_days": 6,
|
||
"sessions": { "claude_code": 48, "codex": 8, "gemini": 3 },
|
||
"global_streak_days": 52,
|
||
"avg_context_switches_per_day": 2.1
|
||
},
|
||
"tweetable": "Week of Mar 14: 5 projects, 182 commits, 15.3k LOC | CC: 48, Codex: 8, Gemini: 3 | Focus: gstack (58%) | Streak: 52d"
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## Compare Mode
|
||
|
||
When the user runs `/retro compare` (or `/retro compare 14d`):
|
||
|
||
1. Run Steps 0.5-1 for the current window (default 7d) using the midnight-aligned start date (same logic as the main retro — e.g., if today is 2026-03-18 and window is 7d, `--since "2026-03-11T00:00:00"`)
|
||
2. Run `gstack-retro-metrics` a second time for the immediately prior same-length window, using both `--since` and `--until` (e.g., for a 7d window starting 2026-03-11: `--since "2026-03-04T00:00:00" --until "2026-03-10T23:59:59"`)
|
||
3. Compute the windowed metrics in Steps 2-10 for each dataset, keeping current and prior values separate. Run Steps 11-11.5 only for the current report: streaks use full history and the shortcut ledger scans the current tree, so neither is a prior-window metric. Apply the freshness guard only to the current window; an inactive prior window is valid comparison data. For hour windows, capture one explicit end timestamp, then subtract the requested hours twice for the two starts. Git includes `--until`, so use one second before the current start for the prior end to avoid counting the boundary commit twice.
|
||
4. In place of Step 12's saved-history comparison, show a **Current vs Prior Period** table for commits, logical SLOC, test ratio, sessions, and fix ratio. Show absolute deltas and percentage changes (ratio changes in percentage points); if the prior value is zero, report absolute change and percentage change as N/A. Highlight the biggest improvements and regressions in the Step 14 narrative.
|
||
5. Run Steps 13-14 and the post-report capture for the current window only; do **not** persist the prior-window metrics. This comparison works on the first run and does not require saved history.
|
||
|
||
## Tone
|
||
|
||
- Encouraging but candid, no coddling
|
||
- Specific and concrete — always anchor in actual commits/code
|
||
- Skip generic praise ("great job!") — say exactly what was good and why
|
||
- Frame improvements as leveling up, not criticism
|
||
- **Praise should feel like something you'd actually say in a 1:1** — specific, earned, genuine
|
||
- **Growth suggestions should feel like investment advice** — "this is worth your time because..." not "you failed at..."
|
||
- Never compare teammates against each other negatively. Each person's section stands on its own.
|
||
- Size the report to the window and the team: every section carries specific evidence, and a section with nothing to say is cut, not padded
|
||
- Use markdown tables and code blocks for data, prose for narrative
|
||
- Output the narrative directly to the conversation; the only report file is the JSON snapshot (`.context/retros/` for repo retros, `$GSTACK_STATE_ROOT/retros/` for global)
|
||
|
||
## Important Rules
|
||
|
||
- ALL narrative output goes directly to the user in the conversation. Besides the JSON snapshot, only the learnings and gbrain capture steps write anything.
|
||
- The metrics script analyzes `origin/<default>` (not local main which may be stale); when `RETRO_REF` says otherwise, disclose it
|
||
- Display all timestamps in the user's local timezone (do not override `TZ`)
|
||
- If `COMMITS: 0`, say so and suggest a different window
|
||
- Round LOC/hour to nearest 50 (the script pre-rounds `LOC_PER_SESSION_HOUR`)
|
||
- Treat merge commits as PR boundaries
|
||
- Do not read CLAUDE.md or unrelated docs — this skill is self-contained; the CHANGELOG and optional inputs explicitly named above are exceptions
|
||
- On first run (no prior retros), skip saved-history comparisons gracefully; explicit `compare` mode still computes its prior window
|
||
- **Global mode:** Does NOT require being inside a git repo. Saves snapshots to `~/.gstack/retros/` (not `.context/retros/`). Gracefully skip AI tools that aren't installed. Only compare against prior global retros with the same window value. If streak hits 365d cap, display as "365+ days".
|