fix(gen): learningsMode is read from host config, not a hardcoded host name

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 <noreply@anthropic.com>
This commit is contained in:
Garry Tan 2026-08-14 20:22:41 -07:00
parent 85388c66a5
commit 5586f57c62
No known key found for this signature in database
GPG Key ID: C1F69E85C74EFE1D
1 changed files with 5 additions and 2 deletions

View File

@ -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: