mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 13:45:35 +02:00
feat: context health soft directive in preamble (T2+)
Adds a "periodically self-summarize" nudge to long-running skills. Soft directive only — no thresholds, no enforcement, no auto-commit. Goal: self-awareness during /qa, /investigate, /cso etc. If you notice yourself going in circles, STOP and reassess instead of thrashing. Codex review caught that fake precision thresholds (15/30/45 tool calls) were unimplementable — SKILL.md is a static prompt, not runtime code. This ships the soft version only. Changes: - scripts/resolvers/preamble.ts: add generateContextHealth(), wire into T2+ tier. Format: [PROGRESS] ... summary line. Explicit rule that progress reporting must never mutate git state. - All T2+ skill SKILL.md files regenerated to include the new section. - Golden ship fixtures updated (T4 skill, picks up the change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -704,6 +704,23 @@ are shown, synthesize a one-paragraph welcome briefing before proceeding:
|
||||
available]. [Health score if available]." Keep it to 2-3 sentences.`;
|
||||
}
|
||||
|
||||
function generateContextHealth(): string {
|
||||
return `## Context Health (soft directive)
|
||||
|
||||
During long-running skill sessions, periodically write a brief \`[PROGRESS]\` summary
|
||||
(2-3 sentences: what's done, what's next, any surprises). Example:
|
||||
|
||||
\`[PROGRESS] Found 3 auth bugs. Fixed 2. Remaining: session expiry race in auth.ts:147. Next: write regression test.\`
|
||||
|
||||
If you notice you're going in circles — repeating the same diagnostic, re-reading the
|
||||
same file, or trying variants of a failed fix — STOP and reassess. Consider escalating
|
||||
or calling /checkpoint to save progress and start fresh.
|
||||
|
||||
This is a soft nudge, not a measurable feature. No thresholds, no enforcement. The
|
||||
goal is self-awareness during long sessions. If the session stays short, skip it.
|
||||
Progress summaries must NEVER mutate git state — they are reporting, not committing.`;
|
||||
}
|
||||
|
||||
// Preamble Composition (tier → sections)
|
||||
// ─────────────────────────────────────────────
|
||||
// T1: core + upgrade + lake + telemetry + voice(trimmed) + completion
|
||||
@@ -731,7 +748,7 @@ export function generatePreamble(ctx: TemplateContext): string {
|
||||
generateVendoringDeprecation(ctx),
|
||||
generateSpawnedSessionCheck(),
|
||||
generateVoiceDirective(tier),
|
||||
...(tier >= 2 ? [generateContextRecovery(ctx), generateAskUserFormat(ctx), generateCompletenessSection()] : []),
|
||||
...(tier >= 2 ? [generateContextRecovery(ctx), generateAskUserFormat(ctx), generateCompletenessSection(), generateContextHealth()] : []),
|
||||
...(tier >= 3 ? [generateRepoModeSection(), generateSearchBeforeBuildingSection(ctx)] : []),
|
||||
generateCompletionStatus(ctx),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user