Summary
Three related fixes shipped in v0.6.0 that restore GSD + Claude Code stability on this machine.
Fix 1: PS5.1 Unicode Parse Error (modules/gsd/57-token-save.ps1)
Root cause: A Unicode em-dash — (U+2014) was embedded in a PS5 double-quoted string literal. PowerShell 5.1 reads non-BOM UTF-8 files as ANSI, so the em-dash became mojibake â€", breaking double-quoted string termination. The entire GSD module failed to load with a cryptic parse error.
Fix: Replaced — with ASCII -; switched containing string to single quotes.
Rule established: ASCII-only inside PS5 string literals. Never use Unicode punctuation (em-dash, curly quotes, ellipsis, etc.) in .ps1 files.
Fix 2: Anthropic 128-Tool Hard Cap (HTTP 400)
Root cause: The GSD MCP server registered both canonical tool names AND alias duplicates (e.g., gsd_decision_save AND gsd_save_decision). With 11 such alias pairs, the tool count exceeded Anthropic's hard limit of 128 tools per request, causing HTTP 400 errors.
Fix: 8sync gsd fix-tools-cap — idempotent patch of ~/.gsd/agent/extensions/claude-code-cli/stream-adapter.js to strip alias dupes before the tool list is sent to the Anthropic API.
- Marker
[GSD-FIX-TOOLS-CAP v1] makes re-run a no-op (safe to repeat)
- Backup written to
.bak-toolscap-{timestamp} before patching
node --check validates syntax; rollback on failure
Run: 8sync gsd fix-tools-cap
Dry-run preview: 8sync gsd fix-tools-cap --dry-run
Fix 3: Auth Reset Path
Added 8sync gsd reset-auth command for when auth is broken (OAuth token expired, credential cache corrupted, post-wipe state).
Run: 8sync gsd reset-auth
Dry-run preview: 8sync gsd reset-auth --dry-run
Enhancement: Smart Compact Threshold
8sync gsd token-save now accepts --compact-pct <N> to set the autoCompact trigger threshold.
- Opus 1M-context sessions:
--compact-pct 40 (~400K token threshold)
- Standard ≤400K models: default
--compact-pct 70
Run: 8sync gsd token-save --compact-pct 40
Enhancement: GSD Memory/Token Discipline (max-skill)
8sync agents max-skill now injects 9-rule GSD memory/token optimization discipline into all agent-facing files including CLAUDE.md (so Claude Code itself follows the same rules):
- Use
gsd_resume immediately after compaction/session resume
- Use
memory_query before re-reading broad project history or prior decisions
- Use
gsd_exec for analysis that would read more than 3 files or produce large output
- Use
gsd_exec_search before rerunning expensive analysis
- Use
capture_thought only for reusable project knowledge and architectural lessons
- Use
gsd_graph when a memory relationship matters instead of rediscovering context manually
- Prefer GSD summaries and status tools over raw DB/file spelunking
- Prefer
rtk read, rtk grep, rtk git for shell/file output when available
- Never dump huge tool output into the model context — summarize first, then read narrow slices
Self-Healing Recovery Runbook
Run these in order after a wipe, re-install, or when things break:
# 1. Fix Anthropic 128-tool cap (HTTP 400 errors)
8sync gsd fix-tools-cap
# 2. Fix broken auth (OAuth expired / credential cache corrupt)
8sync gsd reset-auth
# 3. Re-inject memory/token rules after agent wipe or new machine
8sync agents max-skill
# 4. Set smart compact threshold for Opus 1M sessions
8sync gsd token-save --compact-pct 40
Commits
936ca25 — fix(gsd): PS5.1 parse error in token-save + smart compact threshold
cad1a4b — feat(agents): max-skill GSD memory/token discipline + self-applying CLAUDE.md rules
Tag
v0.6.0 — annotated tag with full release notes pushed to origin.
Summary
Three related fixes shipped in v0.6.0 that restore GSD + Claude Code stability on this machine.
Fix 1: PS5.1 Unicode Parse Error (
modules/gsd/57-token-save.ps1)Root cause: A Unicode em-dash
—(U+2014) was embedded in a PS5 double-quoted string literal. PowerShell 5.1 reads non-BOM UTF-8 files as ANSI, so the em-dash became mojibakeâ€", breaking double-quoted string termination. The entire GSD module failed to load with a cryptic parse error.Fix: Replaced
—with ASCII-; switched containing string to single quotes.Rule established: ASCII-only inside PS5 string literals. Never use Unicode punctuation (em-dash, curly quotes, ellipsis, etc.) in
.ps1files.Fix 2: Anthropic 128-Tool Hard Cap (HTTP 400)
Root cause: The GSD MCP server registered both canonical tool names AND alias duplicates (e.g.,
gsd_decision_saveANDgsd_save_decision). With 11 such alias pairs, the tool count exceeded Anthropic's hard limit of 128 tools per request, causing HTTP 400 errors.Fix:
8sync gsd fix-tools-cap— idempotent patch of~/.gsd/agent/extensions/claude-code-cli/stream-adapter.jsto strip alias dupes before the tool list is sent to the Anthropic API.[GSD-FIX-TOOLS-CAP v1]makes re-run a no-op (safe to repeat).bak-toolscap-{timestamp}before patchingnode --checkvalidates syntax; rollback on failureRun:
8sync gsd fix-tools-capDry-run preview:
8sync gsd fix-tools-cap --dry-runFix 3: Auth Reset Path
Added
8sync gsd reset-authcommand for when auth is broken (OAuth token expired, credential cache corrupted, post-wipe state).Run:
8sync gsd reset-authDry-run preview:
8sync gsd reset-auth --dry-runEnhancement: Smart Compact Threshold
8sync gsd token-savenow accepts--compact-pct <N>to set the autoCompact trigger threshold.--compact-pct 40(~400K token threshold)--compact-pct 70Run:
8sync gsd token-save --compact-pct 40Enhancement: GSD Memory/Token Discipline (max-skill)
8sync agents max-skillnow injects 9-rule GSD memory/token optimization discipline into all agent-facing files includingCLAUDE.md(so Claude Code itself follows the same rules):gsd_resumeimmediately after compaction/session resumememory_querybefore re-reading broad project history or prior decisionsgsd_execfor analysis that would read more than 3 files or produce large outputgsd_exec_searchbefore rerunning expensive analysiscapture_thoughtonly for reusable project knowledge and architectural lessonsgsd_graphwhen a memory relationship matters instead of rediscovering context manuallyrtk read,rtk grep,rtk gitfor shell/file output when availableSelf-Healing Recovery Runbook
Run these in order after a wipe, re-install, or when things break:
Commits
936ca25—fix(gsd): PS5.1 parse error in token-save + smart compact thresholdcad1a4b—feat(agents): max-skill GSD memory/token discipline + self-applying CLAUDE.md rulesTag
v0.6.0— annotated tag with full release notes pushed to origin.