Write up a failed or shelved attempt before closing it (GST-3576) (#4735)

gstack now asks for a short write-up before any attempt is closed as
failed, shelved, cut, null or not now, and the close links to it.

Why: a failed attempt is paid-for knowledge; without a page of notes the
next person repeats it or never learns which part worked.

To do: nothing. Workflows that close an attempt now point at the new
template, docs/shelved-attempt.md.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-23 05:50:32 +00:00
1 parent 71c5e34d70
commit 8143a91809
13 files changed
+117 -6

No files matched your search

+3 -1
View File
@@ -327,7 +327,9 @@ or from an unmasked arm is a lead, not a verdict.
When a fair test shows an existing part doesn't help, it gets one "Why null?"
cycle: did the model use the part, did the task fit, was there enough power and
room below the ceiling, and does today's model do the job without it. Then
keep it, fix the method, or cut it, and say which plainly.
keep it, fix the method, or cut it, and say which plainly. A cut, like any
attempt that fails or is shelved, gets a short write-up before it closes
(docs/shelved-attempt.md).
Safety and security guards (careful, freeze, guard, unfreeze, cso) stay on
their stated reason: they stop the rare bad run that an average score can't see.
+2 -1
View File
@@ -428,7 +428,8 @@ A lane that finishes writes `reports/<code>.md` (`captain/templates/report.md`):
with its `Unverified:` line (after `Failed or skipped:` and `Also changed:`), PR (number, head, version, checks), Needs (what the owner
must do), Cost, Lesson, and the Approvals table. The controller reads reports before
chat and turns each Lesson into a rule, a standing-rules line (`captain/templates/AGENTS.md`)
or a filed tool fix. Its log (`captain/templates/NOTES.md`) is append-only and timestamped;
or a filed tool fix. Work that closes as failed, shelved, cut, null or not now gets a
write-up first (`docs/shelved-attempt.md`), and the report, issue and PR close link it. Its log (`captain/templates/NOTES.md`) is append-only and timestamped;
the digest comes from it. After a revert or S1 fix of a merged crew PR, the controller writes a
postmortem (`captain/templates/postmortem.md`): why did the lane and every reviewer believe
it was right? Its rule change ships as a gstack PR.
+2 -1
View File
@@ -349,7 +349,8 @@ A lane that finishes writes `reports/<code>.md` (`captain/templates/report.md`):
with its `Unverified:` line (after `Failed or skipped:` and `Also changed:`), PR (number, head, version, checks), Needs (what the owner
must do), Cost, Lesson, and the Approvals table. The controller reads reports before
chat and turns each Lesson into a rule, a standing-rules line (`captain/templates/AGENTS.md`)
or a filed tool fix. Its log (`captain/templates/NOTES.md`) is append-only and timestamped;
or a filed tool fix. Work that closes as failed, shelved, cut, null or not now gets a
write-up first (`docs/shelved-attempt.md`), and the report, issue and PR close link it. Its log (`captain/templates/NOTES.md`) is append-only and timestamped;
the digest comes from it. After a revert or S1 fix of a merged crew PR, the controller writes a
postmortem (`captain/templates/postmortem.md`): why did the lane and every reviewer believe
it was right? Its rule change ships as a gstack PR.
+1 -1
View File
@@ -4,7 +4,7 @@ Written by the lane when it finishes. The controller reads this before chat.
## Outcome
<first a `Failed or skipped:` line naming each test, check or step that failed or never ran, or none, and an `Also changed:` line for config, CI or files outside the ask, or none; then what shipped, in two or three sentences; what was out of scope and where it went>
<first a `Failed or skipped:` line naming each test, check or step that failed or never ran, or none, and an `Also changed:` line for config, CI or files outside the ask, or none; then what shipped, in two or three sentences; what was out of scope and where it went; for work that closed as failed, shelved, cut, null or not now, the link to its write-up (docs/shelved-attempt.md)>
Unverified: <none | each claim above that the lane did not check itself, and why>
+1
View File
@@ -18,3 +18,4 @@ Your crew's CREW.md and recorded approvals decide who may merge, update a base,
14. **Finish before starting.** No new fix thread in a repo while more than 10 finished PRs (green, reviewed, waiting only to merge) sit in its queue: merge or close them first. Severe hotfixes are exempt: security, data loss, red main, a broken install. [crew/docs/captain.md: New threads join the crew]
15. **Subagents earn their context.** Start one only for parallel work you can throw away, a fresh-eyes review or another model family, never for a step of your own procedure; name the compact result it returns. [crew/docs/captain.md: Lane context]
16. **Drain the queue.** Captains run `gstack-ship-queue count` every sweep and standing wake; a `DRAIN:` line means drain that turn: low-risk PRs land alone, risky ones in bundles of 3 to 6, idle owners get their next step. [crew/docs/captain.md: Drain the queue]
17. **Write it up before you shelve it.** Before an attempt closes as failed, shelved, cut, null or not now, a short write-up of what worked, what didn't and what would reopen it exists, and the close links it. [docs/shelved-attempt.md]
@@ -0,0 +1 @@
**gstack now writes up a failed or shelved attempt before closing it.** Any experiment, eval arm, prototype or PR that closes as failed, shelved, cut, null or not now first gets a short write-up (takeaways, what worked, what didn't with its numbers, why it stopped, what would reopen it, where the data is, cost), and the close links it. The template is docs/shelved-attempt.md; the factory page, ETHOS.md's "Why null?" verdict, /eval-plan's results step, /captain's report and close rules, and the lane report template all point at it, and `gstack-archive-check thread` prints a `NOTE:` for each PR that closed without merging so the archive step checks the link.
+13 -1
View File
@@ -327,12 +327,24 @@ went stale and conflicting, and started to look like junk.
outside PRs with no verdict after 5 days, and re-own each one. Nothing is closed for
being old.
- **Close only as landed, superseded or dropped.** A crew PR closes only as landed (link
the merge commit), superseded (link the replacement) or dropped (quote the decision).
the merge commit), superseded (link the replacement) or dropped (quote the decision, and
link the write-up when an attempt was shelved: [Write it up before you shelve it](#write-it-up-before-you-shelve-it)).
Anything else is salvage: a live owner rebuilds it onto current main, in the area's next
wave when the queue is long. Old and conflicting is how finished work looks when its
owner went away, not a reason to close it. Age a PR by its `createdAt`: bots touch every
PR, so "last updated" means nothing.
## Write it up before you shelve it
When an attempt closes as failed, shelved, cut, null or not now (an experiment, an eval
arm, a prototype, a dropped PR), the lane writes a short write-up first, from
[docs/shelved-attempt.md](../../docs/shelved-attempt.md): takeaways, what worked, what
didn't with its numbers, why it's shelved, what would reopen it, where the data is, what
wasn't done, what went wrong on our side, and cost. Every close links it: the issue's
Canceled comment, the PR's close comment, the lane's report and a "Why null?" verdict.
Before archiving, `gstack-archive-check thread` prints a `NOTE:` for each PR that closed
without merging; when that close was a shelve, check the write-up is linked.
## Keep issues tidy
Issues show what the crew is really doing, so keep them true:
+66
View File
@@ -0,0 +1,66 @@
# Write it up before you shelve it
When we try something and it doesn't work out, we write down what happened before we
put it away. That covers any attempt closed as failed, shelved, cut, null or not now: an
experiment, an eval arm, a prototype, a PR we drop, a tool we stop using. The write-up
is short, it exists before the close, and the close (the issue, the PR, the report, the
eval verdict) links to it.
Garry Tan, 2026-11-23: "when we try things and fail we must document it before we shelve.
Remember this. Make it a gstack directive that is our default thing we do."
Why: a failed attempt is paid-for knowledge. Without a write-up the next person retries
the same thing, or never learns which part worked. A page of notes costs minutes; a
repeated experiment costs days.
Where it goes: beside the project's other findings (an eval's results file, a research
findings folder, or `docs/` in the repo), with one line in that folder's index when it
has one. An eval's results file already is the write-up when it carries these sections.
## Template
Keep each section to a few lines. Lead with what helps the reader, put mechanics last,
and never round a number in our favor.
```markdown
# <What we tried>: <one-line outcome>. Shelved.
status: <failed | shelved | cut | null | not now> on <date>, by <who decided>
## Takeaways
<two or three lines: "We learned X. You should do Y.">
## What we tried, and why
<the question, the setup and the versions every number below was measured on>
## What worked
<parts worth keeping, each with its number>
## What didn't
<each failure with its number and how far it was checked (one run, a full pass, a guess)>
## Why it's shelved
<the deciding reason, and the verdict if a rule asked for one (KEEP, FIX-METHOD, CUT-CANDIDATE)>
## What would reopen it
<concrete conditions, each checkable>
## Where the data and scripts are
<paths or links to results, scripts, datasets and checkpoints, and anything still left running>
## Not done, and unverified
<steps skipped and claims nobody checked>
## What went wrong on our side
<mistakes, wasted spend, wrong turns; "none" if none>
## Cost
<paid spend and meter spend, by provider>
```
## The close
The issue, PR or report that closes the attempt links the write-up in its close reason
(`Shelved: <link>`). Before a Captain archives a crew thread, `gstack-archive-check thread`
prints a `NOTE:` line for each of its PRs that closed without merging, as a reminder to
link the write-up when that close was a shelve.
+5
View File
@@ -437,6 +437,11 @@ The results file opens with two or three plain takeaways ("We learned X. You sho
X."): what works first, then what didn't, with its number. Cost appears only as part of a
lesson, and nothing is opened without a stated reason (ETHOS.md, Explain the Number).
A run that ends null, as a cut candidate, at option C of the approval ask, or on
`budget_exhausted` is shelved work: before the question closes, its results file also says
why it's shelved, what would reopen it and where the data is (`docs/shelved-attempt.md` in
gstack), and the verdict links it.
## Tier 3, after P7 (not in this skill yet)
Each of these waits for the adoption number in the multi-agent wave plan (P7); one line each so the shape is known:
+5
View File
@@ -345,6 +345,11 @@ The results file opens with two or three plain takeaways ("We learned X. You sho
X."): what works first, then what didn't, with its number. Cost appears only as part of a
lesson, and nothing is opened without a stated reason (ETHOS.md, Explain the Number).
A run that ends null, as a cut candidate, at option C of the approval ask, or on
`budget_exhausted` is shelved work: before the question closes, its results file also says
why it's shelved, what would reopen it and where the data is (`docs/shelved-attempt.md` in
gstack), and the verdict links it.
## Tier 3, after P7 (not in this skill yet)
Each of these waits for the adoption number in the multi-agent wave plan (P7); one line each so the shape is known:
+5
View File
@@ -10,6 +10,8 @@
* An open issue still assigned to the thread refuses too until it is
* re-assigned to a live thread or closed. Every run prints a handoff stub
* (PR, branch, head, CI at that head, open issues) for a successor brief.
* A PR that closed without merging prints a NOTE, never a refusal: if the
* close was a shelve, it links a write-up (docs/shelved-attempt.md).
*
* landedIssues serves the land step: the tracker codes in a merged PR's
* trailing title group (R76), which the Captain then closes with
@@ -137,9 +139,11 @@ export function checkThread(raw: unknown, o: CheckOptions): CheckResult {
if (isFailure(list)) return fail(list);
const live: LivePr[] = [];
const unmerged: string[] = [];
for (const p of thread.prs) {
const pr = readPr(o.ghFor(p.repo), p.repo, p.number);
if (isFailure(pr)) return fail(pr);
if (pr.state === 'CLOSED') unmerged.push(p.repo + '#' + p.number);
if (pr.state !== 'OPEN') continue;
let ci: string;
try {
@@ -158,6 +162,7 @@ export function checkThread(raw: unknown, o: CheckOptions): CheckResult {
...live.map(p => 'ORPHAN: pr ' + p.repo + '#' + p.number + ' open head=' + p.head.slice(0, 12) + ' ci=' + p.ci + ' (R91: never archive a thread that holds an open PR; it stays until the PR merges or closes)'),
...work.map(i => 'ORPHAN: issue ' + i.code + ' ' + i.state + ' (re-assign it to a live thread or close it)'),
...openIssues.filter(i => NOT_WORK.has(i.state)).map(i => 'NOTE: issue ' + i.code + ' ' + i.state + ' (not live work; re-assign or close it when the work is dropped)'),
...unmerged.map(ref => 'NOTE: pr ' + ref + ' closed without merging (if it was shelved, cut or null, its close links a write-up: docs/shelved-attempt.md)'),
];
const verdict = live.length || work.length ? 'refused' : 'clean';
lines.push('ARCHIVE_CHECK: ' + verdict + ' thread=' + o.thread + ' prs=' + live.length + ' issues=' + work.length);
+10
View File
@@ -85,6 +85,16 @@ describe('archive check (reads and verdict)', () => {
expect(ci.lines.some(l => l.includes('ci=unknown'))).toBe(true);
});
// Value: protects=a PR closed without merging reminds the Captain to link the shelved-attempt write-up and never refuses the archive; fails_when=the note is missing, fires on a merged PR, or changes the verdict
test('a PR closed without merging prints a write-up NOTE; a merged one prints none', () => {
const r = checkThread(reads({ thread: thread('GSTA-1', 'idle', [pr(12), pr(13)]) }), opts({ 'garrytan/gstack#12': { state: 'CLOSED' }, 'garrytan/gstack#13': { state: 'MERGED' } }));
expect(r.verdict).toBe('clean');
expect(r.lines.filter(l => l.startsWith('NOTE: pr'))).toEqual(['NOTE: pr garrytan/gstack#12 closed without merging (if it was shelved, cut or null, its close links a write-up: docs/shelved-attempt.md)']);
expect(r.json.notes).toContain(r.lines[0]);
expect(r.lines.at(-1)).toBe('ARCHIVE_CHECK: clean thread=GSTA-1 prs=0 issues=0');
expect(fs.existsSync(path.join(import.meta.dir, '..', 'docs', 'shelved-attempt.md'))).toBe(true);
});
// Value: protects=only OPEN, CLOSED and MERGED are PR states, anything else fails closed; fails_when=an empty or unknown gh state is read as closed and the thread archives clean
test('an unknown or empty live PR state is unreadable, never closed', () => {
const t = thread('GSTA-1', 'idle', [pr(7)]);
+3 -1
View File
@@ -696,7 +696,9 @@ describe('capy skill: factory.md, the auto-loaded "how we work" page', () => {
// what its name says (the second batch of crew rules, G4 and G10, each reached by three crews on their own).
// 5,300 for point 16's queue drain (R119, Garry's rule of 2026-11-22: every Captain that lands PRs runs a standing process
// that stops finished PRs piling up; the procedure is crew/docs/captain.md's Drain the queue).
expect(Buffer.byteLength(text)).toBeLessThanOrEqual(5300);
// 5,550 for point 17's write-up before a shelve (Garry's "do it" of 2026-11-23: an attempt that fails or is shelved is
// documented first, as gstack's default; the template is docs/shelved-attempt.md).
expect(Buffer.byteLength(text)).toBeLessThanOrEqual(5550);
expect(text).toMatch(/^# How we work/);
expect(citationProblems(text)).toEqual([]);
});