Skip to content

fix: PS5.1 parse error + Anthropic 128-tool cap + max-skill memory discipline [v0.6.0] #16

Description

@8syncdev

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

  1. Use gsd_resume immediately after compaction/session resume
  2. Use memory_query before re-reading broad project history or prior decisions
  3. Use gsd_exec for analysis that would read more than 3 files or produce large output
  4. Use gsd_exec_search before rerunning expensive analysis
  5. Use capture_thought only for reusable project knowledge and architectural lessons
  6. Use gsd_graph when a memory relationship matters instead of rediscovering context manually
  7. Prefer GSD summaries and status tools over raw DB/file spelunking
  8. Prefer rtk read, rtk grep, rtk git for shell/file output when available
  9. 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

  • 936ca25fix(gsd): PS5.1 parse error in token-save + smart compact threshold
  • cad1a4bfeat(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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions