Skip to content

feat: make learnings search limits configurable via gstack-config#1514

Open
MrAladdin wants to merge 1 commit into
garrytan:mainfrom
MrAladdin:feat/configurable-learnings-limit
Open

feat: make learnings search limits configurable via gstack-config#1514
MrAladdin wants to merge 1 commit into
garrytan:mainfrom
MrAladdin:feat/configurable-learnings-limit

Conversation

@MrAladdin
Copy link
Copy Markdown

Summary

  • Add learnings_preamble_limit and learnings_skill_limit config keys to gstack-config
  • Preamble and skill-internal learnings searches now read limits dynamically from ~/.gstack/config.yaml instead of using hardcoded values (3 and 10)
  • Users with large-context models (200K+) can increase limits to load more project memory per session

Motivation

The hardcoded --limit 3 (preamble) and --limit 10 (skill) were designed for the lowest-common-denominator model context window. Users running Claude Opus, GPT-4.5, or other large-context models have ample room to load 20-30 learnings without meaningful token pressure (~2000 tokens for 20 entries). Making this configurable lets power users get more value from accumulated project memory.

Changes

File Change
bin/gstack-config Add learnings_preamble_limit (default: 3) and learnings_skill_limit (default: 10) to defaults table, header comments, and list/defaults enumeration
scripts/resolvers/preamble/generate-preamble-bash.ts Replace --limit 3 with dynamic $(gstack-config get learnings_preamble_limit)
scripts/resolvers/learnings.ts Replace --limit 10 with dynamic $(gstack-config get learnings_skill_limit)
test/gen-skill-docs.test.ts Update assertion from literal --limit 3 to --limit "$_LEARN_PREAMBLE_LIMIT"
*/SKILL.md Regenerated (no template changes)

Usage

# Increase preamble learnings (loaded every skill start)
gstack-config set learnings_preamble_limit 20

# Increase skill-internal learnings search
gstack-config set learnings_skill_limit 30

# Check current values
gstack-config defaults | grep learnings

Backwards compatibility

  • Default values match the previous hardcoded behavior (3 and 10)
  • Users who never set these keys see zero behavior change
  • One extra gstack-config get call per preamble (~5ms, same as existing config reads)

Test plan

  • bun test test/gen-skill-docs.test.ts — 385 pass, 0 fail
  • bun test browse/test/gstack-config.test.ts — 17 pass, 3 fail (pre-existing, unrelated)
  • gstack-config get/set/list/defaults all display new keys correctly
  • Generated SKILL.md files contain dynamic limit variable
  • --host hermes generation produces correct $GSTACK_BIN/gstack-config get calls

🤖 Generated with Claude Code

Add two new config keys to ~/.gstack/config.yaml:
- learnings_preamble_limit (default: 3) — controls how many learnings
  are loaded during every skill preamble
- learnings_skill_limit (default: 10) — controls how many learnings
  are loaded inside skill workflows via {{LEARNINGS_SEARCH}}

Previously both values were hardcoded. Users with large context models
(200K+) can now increase limits to load more project memory per session.

Usage:
  gstack-config set learnings_preamble_limit 20
  gstack-config set learnings_skill_limit 30

Changes:
- bin/gstack-config: add defaults, header comment, list/defaults enum
- scripts/resolvers/preamble/generate-preamble-bash.ts: read limit
  from config instead of hardcoded 3
- scripts/resolvers/learnings.ts: read limit from config instead of
  hardcoded 10
- test/gen-skill-docs.test.ts: update assertion for dynamic limit
- All SKILL.md files regenerated

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant