From 5586f57c6221f88c35f4e3193e37cd199a3fba0e Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 14 Aug 2026 20:22:41 -0700 Subject: [PATCH] fix(gen): learningsMode is read from host config, not a hardcoded host name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolvers/learnings.ts branched on ctx.host === 'codex' while every host declared learningsMode — the field was decorative, and the 7 hosts configured 'basic' (cursor, slate, kiro, opencode, openclaw, hermes, gbrain) silently received the 'full' cross-project flow their runtimes can't execute (it depends on AskUserQuestion + gstack-config plumbing). Output now matches declaration: basic hosts get the project-scoped search block. Blast radius proof: all committed Claude SKILL.md files and the three golden fixtures are byte-identical; the behavior diff lands only in the gitignored external-host trees (hand-verified: .cursor review's learnings section swaps the cross-project AskUserQuestion block for the project-scoped search). Co-Authored-By: Claude Fable 5 --- scripts/resolvers/learnings.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/resolvers/learnings.ts b/scripts/resolvers/learnings.ts index af35d60c4..aefc0fb86 100644 --- a/scripts/resolvers/learnings.ts +++ b/scripts/resolvers/learnings.ts @@ -12,6 +12,7 @@ * AskUserQuestion and persists the preference via gstack-config. */ import type { TemplateContext } from './types'; +import { getHostConfig } from '../../hosts/index'; // Whitelist for query= macro values. Allows alphanumeric, space, hyphen, underscore. // Anything else (e.g. $, backticks, quotes, ;) is a shell-injection vector when the @@ -34,8 +35,10 @@ export function generateLearningsSearch(ctx: TemplateContext, args?: string[]): } const queryFlag = queryArg ? ` --query "${queryArg}"` : ''; - if (ctx.host === 'codex') { - // Codex: simpler version, no cross-project, uses $GSTACK_BIN + if (getHostConfig(ctx.host).learningsMode === 'basic') { + // Basic learnings mode (host config learningsMode: 'basic' — every host + // except claude and factory): simpler version, no cross-project prompt, + // uses $GSTACK_BIN (all basic hosts are env-var hosts) return `## Prior Learnings Search for relevant learnings from previous sessions on this project: