mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
* feat(skills): absorb pstack's blast radius, transcript recall, vet-the-number and design-twice as lazy sections
/investigate gains sections/blast-radius.md (the one safety fact, the five-rung
evidence ladder, look where grep stops, confirmed and cleared risks apart) with a
Phase 4 pointer, and the shared-premise red flag before the 3-strike rule.
/context-restore is carved for the first time: on NO_CHECKPOINTS, sections/transcripts.md
mines this workspace's own transcripts (host stores declared in hosts/*.ts and rendered
by TRANSCRIPT_SOURCES / TRANSCRIPT_DISCOVERY), a fixed 7-day window, never another
project's folder, subagents return only findings, redaction before anything leaves,
git and gh verify every artifact, a status-tagged brief. /benchmark is carved for the
first time: sections/vet-the-number.md asks the seven questions before Phase 5 reports
a comparison. /plan-eng-review gains sections/design-twice.md (a second structurally
distinct shape compared on interface depth, the eight design red flags), bound by the
autoplan methodology snapshot alongside review-sections.md.
Ideas from pstack (Lauren Tan, MIT), rewritten in gstack's words; NOTICE.md. Garry,
2026-10-26: "Do it, send". Guards: carve-guards entries and measured lines, eleven
plan-eng-review pins re-measured, periodic carve-section-loading cases for the two new
carves, free tests with a fixture transcript.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* fix(pstack-c1): fold design-twice into Section 1 of the eng review section, per-host transcript table, fixture and slice-cap repairs
The remote free run reported nine failures in seven files, all from this
branch: four tests encode plan-eng-review's one companion section
(eng-scope-entry-ap, autoplan-methodology-names, plan-review-cases,
review-checklists), so the design-twice pass now lives inside Section 1 of
sections/review-sections.md with the skeleton, manifest and
bin/gstack-autoplan-snapshot.ts back at main; the Codex render of
context-restore named ~/.claude/ through the all-hosts transcript table, so
{{TRANSCRIPT_SOURCES}} renders this host's row only; the transcript fixture
is declared in FREE_FIXTURES; and the two new periodic cases took the census
to 39 slices, so evals-periodic.yml's eval-slices max-parallel goes 38 -> 40.
Pins: 11 plan-eng-review re-pins at +2,896; maxSizeRatio 1.2400 (measured
1.2389); Codex gpt-5.4 overlay 159,588 bytes.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* fix: pre-landing review fixes
The discovery block takes the none branch from hosts/*.ts's transcripts
declaration instead of a host-name fallthrough, and the resolver header says
where each half lives; the T2 subagent brief frames the transcript as data,
not instructions; the test asserts table/block agreement per host, imports
CAPY_NO_TRANSCRIPTS, and drops the fixture-shape case nothing reads.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* docs: ADDING_A_HOST.md lists the optional transcripts HostConfig field
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
---------
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
94 lines
4.7 KiB
TypeScript
94 lines
4.7 KiB
TypeScript
/**
|
|
* Transcript resolvers for /context-restore's no-checkpoint fallback
|
|
* (context-restore/sections/transcripts.md.tmpl).
|
|
*
|
|
* {{TRANSCRIPT_SOURCES}} → the table of transcript stores for THIS host
|
|
* (its `transcripts` row from hosts/<name>.ts, or
|
|
* a none row) plus the Capy row (none; the harness
|
|
* keeps no transcript on the machine). Only the
|
|
* rendering host's paths appear: a Codex render
|
|
* never names ~/.claude/.
|
|
* {{TRANSCRIPT_DISCOVERY}} → the bash block that lists THIS host's transcript
|
|
* files for the current workspace only, inside the
|
|
* window, and prints `TRANSCRIPTS: none (...)` on
|
|
* Capy, on a host with no declared store, or when
|
|
* the store is missing.
|
|
*
|
|
* hosts/*.ts declares which hosts have a store (`transcripts.root` and
|
|
* `layout` feed the table); the per-host discovery body lives here, keyed by
|
|
* host name, and a host with no declaration gets the none branch. The prose
|
|
* never hand-writes a path. test/context-restore-transcripts.test.ts checks
|
|
* that the table and the block agree for every host and runs the block
|
|
* against fixture transcripts.
|
|
*/
|
|
import { getHostConfig } from '../../hosts/index';
|
|
import type { TemplateContext } from './types';
|
|
|
|
export const CAPY_NO_TRANSCRIPTS = 'TRANSCRIPTS: none (Capy keeps no session transcript on this machine; use the shared record and git)';
|
|
|
|
export function generateTranscriptSources(ctx: TemplateContext): string {
|
|
const host = getHostConfig(ctx.host);
|
|
const row = host.transcripts
|
|
? `| ${host.displayName} | \`${host.transcripts.root}\` | ${host.transcripts.layout} |`
|
|
: `| ${host.displayName} | none | this host declares no transcript store gstack may read; use the shared record and git |`;
|
|
return [
|
|
'| Host | Transcripts | How this workspace\'s files are told apart |',
|
|
'|---|---|---|',
|
|
row,
|
|
'| Capy (any model) | none | the harness keeps no transcript on the machine; say so and use the shared record and git |',
|
|
].join('\n');
|
|
}
|
|
|
|
export function generateTranscriptDiscovery(ctx: TemplateContext): string {
|
|
const host = getHostConfig(ctx.host);
|
|
const slugBin = `${ctx.paths.binDir}/gstack-slug`;
|
|
const head = [
|
|
'TRANSCRIPT_DAYS="${TRANSCRIPT_DAYS:-7}"',
|
|
`PROJECT_ROOT=$(${slugBin} --get PROJECT_ROOT 2>/dev/null) || PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)`,
|
|
'echo "TRANSCRIPT_WINDOW: last $TRANSCRIPT_DAYS days"',
|
|
'echo "TRANSCRIPT_PROJECT: $PROJECT_ROOT"',
|
|
'if [ -n "${GSTACK_CAPY:-}" ]; then',
|
|
` echo "${CAPY_NO_TRANSCRIPTS}"`,
|
|
];
|
|
let body: string[];
|
|
if (!host.transcripts) {
|
|
body = [
|
|
'else',
|
|
` echo "TRANSCRIPTS: none (${host.displayName} declares no transcript store gstack may read; use the shared record and git)"`,
|
|
'fi',
|
|
];
|
|
} else if (ctx.host === 'claude') {
|
|
body = [
|
|
'else',
|
|
' TRANSCRIPT_DIR="$HOME/.claude/projects/$(printf \'%s\' "$PROJECT_ROOT" | sed \'s/[^A-Za-z0-9]/-/g\')"',
|
|
' if [ -d "$TRANSCRIPT_DIR" ]; then',
|
|
' TRANSCRIPT_COUNT=0',
|
|
' while IFS= read -r f; do TRANSCRIPT_COUNT=$((TRANSCRIPT_COUNT + 1)); echo "TRANSCRIPT: $f"; done < <(find "$TRANSCRIPT_DIR" -maxdepth 1 -name \'*.jsonl\' -mtime -"$TRANSCRIPT_DAYS" 2>/dev/null | sort)',
|
|
' echo "TRANSCRIPTS: $TRANSCRIPT_DIR ($TRANSCRIPT_COUNT files in the last $TRANSCRIPT_DAYS days)"',
|
|
' else',
|
|
' echo "TRANSCRIPTS: none ($TRANSCRIPT_DIR is missing; this workspace has no Claude Code transcripts)"',
|
|
' fi',
|
|
'fi',
|
|
];
|
|
} else if (ctx.host === 'codex') {
|
|
body = [
|
|
'else',
|
|
' TRANSCRIPT_DIR="$HOME/.codex/sessions"',
|
|
' if [ -d "$TRANSCRIPT_DIR" ]; then',
|
|
' TRANSCRIPT_COUNT=0',
|
|
' while IFS= read -r f; do',
|
|
' head -c 4096 "$f" 2>/dev/null | grep -qF -- "\\"cwd\\":\\"$PROJECT_ROOT\\"" || continue',
|
|
' TRANSCRIPT_COUNT=$((TRANSCRIPT_COUNT + 1)); echo "TRANSCRIPT: $f"',
|
|
' done < <(find "$TRANSCRIPT_DIR" -type f -name \'rollout-*.jsonl\' -mtime -"$TRANSCRIPT_DAYS" 2>/dev/null | sort)',
|
|
' echo "TRANSCRIPTS: $TRANSCRIPT_DIR ($TRANSCRIPT_COUNT files whose cwd is this workspace, in the last $TRANSCRIPT_DAYS days)"',
|
|
' else',
|
|
' echo "TRANSCRIPTS: none ($TRANSCRIPT_DIR is missing; this machine has no Codex transcripts)"',
|
|
' fi',
|
|
'fi',
|
|
];
|
|
} else {
|
|
throw new Error(`hosts/${ctx.host}.ts declares a transcript store but scripts/resolvers/transcripts.ts has no discovery body for it`);
|
|
}
|
|
return ['```bash', ...head, ...body, '```'].join('\n');
|
|
}
|