Commit graph

29 commits

Author SHA1 Message Date
Tom Boucher
7d5bf63b2d feat: GSD context optimization with model routing and context masking
* docs: add context optimization design spec, implementation plan, and pi-layer research

- Spec: 6-change design for GSD extension context optimization
- Plan: 9-task TDD implementation plan with exact file paths and code
- Pi-layer doc: 10 infrastructure opportunities (research only, not planned)

Part of #3171, #3406, #3452, #3433.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(context): add observation masking for auto-mode sessions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(context): add phase handoff anchors for auto-mode

Introduces PhaseAnchor read/write utilities so downstream agents can
inherit decisions, blockers, and intent written at phase boundaries
without re-inferring from conversation history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(context): add capability-aware model routing and context management preferences

Implement ADR-004 Phase 2 capability scoring with 7-dimension model
profiles, task requirement vectors, and weighted scoring. Add
ContextManagementConfig preferences for observation masking thresholds.
Wire capability scoring into auto-model-selection dispatch path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(context): wire observation masking, phase anchors, and tool truncation

Register observation masker in before_provider_request hook to replace
old tool results with placeholders during auto-mode. Add tool result
truncation (configurable via context_management.tool_result_max_chars).
Inject phase handoff anchors into prompt builders so downstream phases
inherit decisions from research/planning. Write anchors after successful
phase completion. Update ADR-004 status to Implemented.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: remove internal planning artifacts from PR

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add capability routing, observation masking, and context management

Update dynamic-model-routing.md with capability-aware scoring section.
Update token-optimization.md with observation masking, tool truncation,
and phase handoff anchor documentation. Update configuration.md with
context_management preference block and capability_routing flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Merge branch 'main' into feat/gsd-context-optimization

* fix: add context_management to known keys and prevent tool truncation state corruption

- Add missing 'context_management' to KNOWN_PREFERENCE_KEYS set so users
  don't get spurious unknown-key warnings when configuring it.
- Replace in-place mutation of tool result content with immutable spread
  to prevent corrupting shared conversation message objects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add stop and backtrack to triage-ui classification labels

The Classification type gained stop and backtrack variants from main
but triage-ui.ts was not updated, causing a TypeScript build failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: context masker and tool truncation operate on correct pi-ai message format

The observation masker and tool result truncation in before_provider_request
were checking m.type === "toolResult" but the actual pi-ai payload uses
m.role === "toolResult" with content as TextContent[] arrays (not strings).
bashExecution messages are converted to {role:"user"} by convertToLlm before
the hook fires, so checking m.type === "bashExecution" was a no-op.

- Fix context-masker to match on role, handle array content, detect bash
  results by their "Ran `" prefix
- Fix register-hooks truncation to operate on role:"toolResult" with
  array content blocks
- Update tests to use correct pi-ai LLM payload format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 01:02:35 -04:00
Justin Wyer
5ae78d8f8b docs: document command allowlist and fetch_page URL blocking
- custom-models.md: add Command Allowlist section under Value Resolution
  explaining the restriction, default list, and how to override via
  allowedCommandPrefixes setting or GSD_ALLOWED_COMMAND_PREFIXES env var

- configuration.md: add URL Blocking (fetch_page) section documenting
  what's blocked by default, why, and how to allowlist specific hosts
  via fetchAllowedUrls setting or GSD_FETCH_ALLOWED_URLS env var

- configuration.md: add both env vars to the Environment Variables table
2026-04-02 13:55:07 +02:00
Jeremy McSpadden
ff2c2605f3 feat(gsd): enable safety mechanisms by default (snapshots, pre-merge checks) (#2678)
Flip two safety mechanisms from opt-in to opt-out so all users benefit
from rollback protection and merge regression checks without manual
configuration.

- git.snapshots: false → true (creates recovery refs before destructive ops)
- git.pre_merge_check: false → "auto" in solo mode (auto-detects test runner)

Both remain configurable; users can explicitly disable with snapshots: false
or pre_merge_check: false.

Closes #2677
2026-03-26 18:15:31 -06:00
Iouri Goussev
a952391b33 chore: rename preferences.md to PREFERENCES.md for consistency (#2700) (#2738)
All other .gsd/ state files use uppercase naming (DECISIONS.md,
REQUIREMENTS.md, PROJECT.md, etc). This renames the canonical
preferences file to PREFERENCES.md while keeping a migration
fallback — the loader checks PREFERENCES.md first, then falls
back to lowercase preferences.md for existing installations.

Closes #2700

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 16:09:59 -06:00
Yang Yang
665e2aa1cb fix(notifications): prefer terminal-notifier over osascript on macOS (#2633)
osascript display notification is silently swallowed by macOS when the
calling terminal app (Ghostty, iTerm2, etc.) lacks notification
permissions in System Settings. The command exits 0 with no error,
making the failure invisible.

terminal-notifier registers as its own Notification Center app, so
macOS prompts the user for permission on first use — the expected UX.

Changes:
- Add findExecutable() helper to locate terminal-notifier on PATH
- buildDesktopNotificationCommand() prefers terminal-notifier when
  available, falls back to osascript (preserving existing behavior)
- Update tests to handle both terminal-notifier and osascript paths
- Add macOS delivery note to docs/configuration.md notifications section
- Add troubleshooting entry for notifications not appearing on macOS

Fixes #2632

Co-authored-by: Yang Yang(NYC) <Yang.Yang2@bcg.com>
2026-03-26 09:24:32 -06:00
Jeremy McSpadden
f8c6ab0c54 chore: consolidate docs, remove stale artifacts, and repo hygiene (#2665)
* fix(vscode): add extensionKind and error handler for Remote SSH support

* fix(vscode): reject failed RPC startup

* docs: consolidate docs, remove stale artifacts, and repo hygiene

- Remove docs-internal/ (duplicate of docs/); update pr-risk-check.mjs path
- Sync 9 diverged files to latest content (commands, config, troubleshooting, etc.)
- Fix pi --web → gsd --web naming in docs/README.md
- Copy FRONTIER-TECHNIQUES.md and ADR-004 to docs/ before removal
- Delete orphaned PR screenshot folders (pr-876/, pr-1530/) — unreferenced
- Remove committed pnpm-lock.yaml files (project uses npm)
- Move PLAN.md → .plans/doctor-cleanup-consolidation.md
- Move web/left-native-tui-main-session-plan.md → .plans/
- Delete .DS_Store and vscode-extension/dist/ from disk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 09:13:41 -06:00
Lex Christopherson
9f4bf8c452 fix: restore PR files lost during merge conflict resolution
Files added by PR #2008 that were not in main were dropped during
the merge. Restore all src/, docs/, and scripts/ files from the
pre-merge PR head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:39:33 -06:00
Lex Christopherson
d20d5e8fb5 docs: add Mintlify documentation site and move internal docs
Add a proper public-facing documentation site using Mintlify with 19 MDX
pages covering getting started, auto mode, commands, configuration, and
all user-facing features. Move internal/SDK documentation (Pi SDK, TUI,
context & hooks, research notes, ADRs) to docs-internal/ since they
should not be part of the public documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 09:54:41 -06:00
Tom Boucher
3e68acfa11 docs: sync documentation with codebase through v2.44.0 (#2415) 2026-03-24 21:36:25 -06:00
Tom Boucher
7385cf4bb8 docs: update documentation for v2.39.0–v2.40.0 release (#1696)
Cover all new features across README, commands, configuration,
auto-mode, and getting-started docs: GitHub sync extension, Skill
tool resolution, health check phase 2, forensics debugger upgrade,
auto PR on milestone completion, RUNTIME.md template, welcome screen,
GSD_HOME/GSD_PROJECT_ID env vars, browser/runtime UAT types, pipeline
decomposition, sliding-window stuck detection, and data-loss recovery.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 08:38:05 -06:00
Italo Almeida
e4c23f9c28 feat(docs): add Custom Models guide and update related documentation (#1670) 2026-03-21 08:35:31 -06:00
Glen
869e037202 feat: add GSD_HOME env var to override global ~/.gsd directory (#1566)
Centralise all ~/.gsd path construction through app-paths.ts (compiled
code) or a module-level `gsdHome` const (runtime extensions that cannot
import app-paths). When GSD_HOME is set, every path that previously
resolved under ~/.gsd now resolves under the override.

Existing overrides (GSD_STATE_DIR, GSD_CODING_AGENT_DIR) continue to
take precedence when set.
2026-03-20 08:29:01 -06:00
TÂCHES
c2d46a951b fix: wire dead token-profile defaults and add /gsd rate command (#1505) (#1516)
- Wire resolveProfileDefaults into loadEffectiveGSDPreferences so
  token_profile: budget actually sets cheaper models and skips phases
- Add /gsd rate <over|ok|under> command to submit user feedback on
  model tier assignments, completing the adaptive routing feedback loop
- Document that models config is required for dynamic routing activation
- Document ceiling behavior when dynamic routing is active
- Document reassess_after_slice as required for reassessment

Closes #1505 (partial — escalateTier wiring deferred to follow-up)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 17:53:00 -06:00
John Brahy
0c83046a51 docs: add guidance for local custom MCP setup 2026-03-19 01:27:37 -07:00
Tom Boucher
41186ad9b0 docs: document /gsd config for global API keys (#1079)
* docs: add Node LTS pinning guide for macOS Homebrew users

New doc (docs/node-lts-macos.md) explains how to pin Node 24 LTS
via Homebrew to avoid running on odd-numbered development releases.
Covers brew install/link/pin, version managers as alternatives,
and verification steps.

Added notice banner in README linking to the guide.

* docs: document /gsd config for global API keys

Added Global API Keys section to configuration.md explaining:
- /gsd config saves keys to ~/.gsd/agent/auth.json
- Keys apply to all projects automatically
- Three supported keys: Tavily, Brave, Context7
- How precedence works (env vars > saved keys)
- Anthropic models don't need search keys

Updated commands.md gsd config entry to link to the new section.
Added Set up API keys section to getting-started.md for first-run.
2026-03-17 22:03:10 -06:00
Tom Boucher
41ebc6b643 docs: recommend pi-dashscope extension for DashScope models (#1056)
* docs: add Node LTS pinning guide for macOS Homebrew users

New doc (docs/node-lts-macos.md) explains how to pin Node 24 LTS
via Homebrew to avoid running on odd-numbered development releases.
Covers brew install/link/pin, version managers as alternatives,
and verification steps.

Added notice banner in README linking to the guide.

* docs: recommend pi-dashscope extension for DashScope models

The built-in alibaba-coding-plan provider uses the Anthropic-compat
endpoint and lacks per-model thinking format and compatibility flags,
causing issues like #1003 (MiniMax-M2.5 thinking loop).

The community pi-dashscope extension uses the correct OpenAI-compat
endpoint, sets thinkingFormat per model (qwen/zai), includes compat
flags (supportsDeveloperRole, supportsReasoningEffort), and provides
an interactive /dashscope-configure command.

Added Community Provider Extensions section to configuration docs
recommending pi-dashscope over the built-in provider.
2026-03-17 21:59:01 -06:00
Tom Boucher
c5739f1282 feat: auto-create PR on milestone completion (#687) (#1084)
* docs: add Node LTS pinning guide for macOS Homebrew users

New doc (docs/node-lts-macos.md) explains how to pin Node 24 LTS
via Homebrew to avoid running on odd-numbered development releases.
Covers brew install/link/pin, version managers as alternatives,
and verification steps.

Added notice banner in README linking to the guide.

* feat: auto-create PR on milestone completion (#687)

New git preferences:
- git.auto_pr (boolean, default false): create a PR when a
  milestone completes via gh CLI
- git.pr_target_branch (string, default main branch): target
  branch for auto-created PRs (e.g. develop, qa, staging)

Implementation:
- GitPreferences: added auto_pr and pr_target_branch fields
- preferences.ts: added validation for both fields
- auto-worktree.ts: after push, pushes milestone branch and
  creates PR via 'gh pr create' (non-fatal on failure)

Documentation:
- configuration.md: added fields to git config block, table,
  and new git.auto_pr section with requirements and flow
- git-strategy.md: added Automatic Pull Requests section with
  Gitflow example config
2026-03-17 21:45:29 -06:00
Tom Boucher
d2a9ee6024 docs: update documentation for v2.26 features (#958)
Updated 6 files with 114 lines covering new v2.26 features:

auto-mode.md:
- Headless auto-restart on crash with exponential backoff
- Provider error classification and auto-resume (rate limit + server errors)
- Incremental memory system (KNOWLEDGE.md)
- Context pressure monitor (70% wrap-up signal)
- Meaningful commit messages from task summaries
- Verification enforcement with auto-fix retries
- Slice discussion gate (require_slice_discussion)
- HTML report generation (auto_report)

configuration.md:
- git.manage_gitignore preference (opt out of .gitignore changes)
- verification_commands, verification_auto_fix, verification_max_retries
- auto_report preference

troubleshooting.md:
- Provider error recovery table (transient vs permanent classification)
- Headless auto-restart for overnight unattended execution

commands.md:
- /gsd export --html command
- --max-restarts flag for headless mode

visualizer.md:
- HTML export and auto_report preference

README.md:
- git.manage_gitignore in preferences table
- git.isolation updated to include 'branch' option
2026-03-17 15:42:18 -06:00
Tom Boucher
33fff7bab0 feat: add require_slice_discussion option to pause auto-mode before each slice (#789) (#845) 2026-03-17 08:00:41 -06:00
Tom Boucher
59134fa426 docs: update documentation for v2.23 release features (#788)
New v2.23 features documented:

- getting-started.md: Add VS Code extension install section (chat participant,
  sidebar dashboard, command palette, RPC requirement)
- README.md: Add VS Code extension to documentation index, update troubleshooting
  link to include forensics
- docs/README.md: Add VS Code extension to user documentation table
- architecture.md: Add headless mode, MCP server mode, and VS Code extension to
  system structure diagram; expand Browser Tools description to cover 10 new tools
  (PDF export, device emulation, visual regression, structured extraction, route
  mocking, etc.); add missing extensions (Async Jobs, Remote Questions, TTSR,
  Universal Config)
- auto-mode.md: Add validate-milestone phase to the pipeline diagram and phase
  descriptions — reconciliation gate before milestone completion
- configuration.md: Add models.json resolution section — custom model definitions
  with ~/.gsd/agent/models.json and ~/.pi/agent/models.json fallback

Co-authored-by: TÂCHES <afromanguy@me.com>
2026-03-16 21:56:00 -06:00
Tom Boucher
2f2d0507c1 docs: update documentation for v2.22 features (#787)
New v2.22 features documented:

- commands.md: Add /gsd forensics (post-mortem investigation) and /gsd cleanup
- commands.md: Add MCP Server Mode section for --mode mcp
- configuration.md: Add /gsd prefs import-claude commands for Claude marketplace import
- skills.md: Add review, test, and lint skills to bundled skills table
- auto-mode.md: Add Post-Mortem Investigation section referencing /gsd forensics
- troubleshooting.md: Add forensics to Getting Help section, fix corrupted duplicate line
- README.md: Update troubleshooting link description to include forensics
2026-03-16 21:47:20 -06:00
Jeremy McSpadden
01b0d530c8 docs: parallel milestone orchestration documentation
New: docs/parallel-orchestration.md — comprehensive guide covering:
- Architecture overview with coordinator/worker diagram
- Worker isolation model (process, worktree, state, context)
- Eligibility analysis (dependencies + file overlap)
- Configuration reference (all parallel.* keys)
- Commands reference (/gsd parallel start|status|stop|pause|resume|merge)
- Signal lifecycle (coordinator → worker communication)
- Merge reconciliation with conflict handling
- Budget management across workers
- Doctor integration and health monitoring
- Safety model breakdown
- File layout (.gsd/parallel/ and .gsd/worktrees/)
- Troubleshooting guide

Updated existing docs:
- auto-mode.md: cross-reference to parallel orchestration
- configuration.md: parallel config block with all keys
- commands.md: parallel commands table
- git-strategy.md: parallel worktree branching diagram
- README.md: added to documentation index
2026-03-16 20:32:10 -06:00
TÂCHES
feccaf2998 Merge pull request #674 from trek-e/chore/docs-v2.20.0
docs: update documentation for v2.20.0 release
2026-03-16 13:11:50 -06:00
Adam Dry
6aaace9838 feat: add git.isolation "none" mode
Adds git.isolation: "none" so developers can use GSD's full planning/execution
methodology with all work happening directly on their current branch — no worktree,
no milestone branch, no merge step.

- Preference plumbing: "none" accepted/validated, getIsolationMode() helper
- Core bypass: all worktree/branch gates in auto.ts skip in none mode
- Peripheral: doctor skips worktree checks, system prompt omits worktree context
- Docs: git-strategy, configuration, auto-mode, troubleshooting, system prompt updated
- Tests: 11 new tests, 621/621 pass
2026-03-16 19:02:32 +00:00
Tom Boucher
18a0abbfe3 docs: update documentation for v2.20.0 release
Update README and docs/ to cover new features and changes in v2.20.0:

- commands.md: Added /gsd quick, /gsd mode, /gsd help, /gsd skill-health,
  /gsd hooks, /gsd run-hook, gsd --debug flag. Reorganized into
  Session Commands, Configuration & Diagnostics, Git, and Session Management.
- skills.md: Added Skill Lifecycle Management section covering telemetry,
  health dashboard (/gsd skill-health), staleness detection, and heal-skill
  post-unit analysis.
- remote-questions.md: Added Telegram as a third channel alongside
  Slack and Discord, with setup instructions and bot requirements.
- configuration.md: Added skill_staleness_days preference.
- README.md: Added skill_staleness_days to key settings table, new
  Agent Instructions section, and Debug Mode section.
2026-03-16 14:50:36 -04:00
Jeremy McSpadden
30b688bee0 feat: add worktree post-create hook for environment setup (#597) (#617)
* feat: add worktree post-create hook for environment setup (#597)

Add git.worktree_post_create preference — a script path that GSD
runs after creating any worktree (both auto-mode and manual /worktree).
The script receives SOURCE_DIR and WORKTREE_DIR as environment
variables, enabling users to copy .env files, symlink asset
directories, or run other setup commands that git worktrees don't
inherit from the main tree.

Implementation:
- Add worktree_post_create field to GitPreferences interface
- Add validation in validatePreferences (must be non-empty string)
- Add runWorktreePostCreateHook() in auto-worktree.ts — resolves
  relative paths against project root, runs with 30s timeout,
  failure is non-fatal (warning only)
- Integrate hook call in createAutoWorktree() (auto-mode path)
- Integrate hook call in worktree-command.ts (manual /worktree path)
- Update docs/configuration.md with full usage guide and example
  hook script
- Update preferences-reference.md with field documentation

Example configuration:
  git:
    worktree_post_create: .gsd/hooks/post-worktree-create

Example hook script:
  #!/bin/bash
  cp "$SOURCE_DIR/.env" "$WORKTREE_DIR/.env"
  ln -sf "$SOURCE_DIR/assets" "$WORKTREE_DIR/assets"

Closes #597

* fix: use Node.js scripts in hook tests for Windows compatibility

Replace bash hook scripts with cross-platform Node.js scripts in
worktree-post-create-hook.test.ts. On macOS/Linux, scripts use
#!/usr/bin/env node shebang. On Windows, generates batch files
that invoke node -e. Fixes windows-portability CI failures.

* fix: Windows CI failures in worktree post-create hook tests

- Use path.isAbsolute() instead of startsWith("/") to detect absolute
  paths on Windows (fixes double-path bug like C:\...\C:\...)
- Add .bat extension to hook scripts on Windows so they are recognized
  as executable by cmd.exe
- Extract isWin constant and hookPath() helper for consistent
  platform-aware test setup

Fixes 3 failing tests in windows-portability CI job:
  - executes hook script with correct env vars
  - supports absolute hook paths
  - hook can copy files from source to worktree

* fix: adopt main's help command and error message in commands.ts

The auto-merge missed main's addition of the help handler, showHelp
function, and updated description/subcommands array. Added them
manually and updated the visualizer help text to reflect 7-tab TUI.

* fix: write Windows hook scripts as .bat + companion .js file

The previous approach embedded multi-line JavaScript in a node -e "..."
argument inside the .bat file. cmd.exe splits on newlines, so each JS
line was interpreted as a separate batch command ('const' is not
recognized...).

Now writes the JS code to a companion .js file and the .bat invokes
it with `node "%~dp0<file>.js"`, which works reliably on Windows.

---------

Co-authored-by: TÂCHES <afromanguy@me.com>
2026-03-16 09:50:45 -06:00
Tom Boucher
330e5200bc docs: add v2.18/v2.19 feature documentation (#631)
New docs:
- dynamic-model-routing.md — complexity classification, tier models,
  escalation, budget pressure, cost table, adaptive learning
- captures-triage.md — fire-and-forget capture, triage pipeline,
  classification types, dashboard integration, worktree awareness
- visualizer.md — four-tab TUI overlay (progress, deps, metrics,
  timeline), controls, auto-refresh, auto_visualize preference

Updated docs:
- README.md — added links to three new docs
- commands.md — added capture, triage, visualize, knowledge, queue reorder
- configuration.md — added dynamic_routing and auto_visualize settings,
  updated full example with new config options
- auto-mode.md — added capture, visualize sections, dashboard badge,
  dynamic model routing reference
- architecture.md — updated dispatch pipeline (routing + captures steps),
  added key modules table for v2.19
- cost-management.md — added dynamic routing and visualizer tips
2026-03-16 09:00:58 -06:00
Flux Labs
6998ef2ae4 docs: comprehensive update to preferences reference and configuration guide (#614)
Update both docs/configuration.md (user-facing) and
src/resources/extensions/gsd/docs/preferences-reference.md (internal)
with complete coverage of all GSD preferences:

- Add /gsd prefs subcommands table (global, project, status, wizard, setup)
- Document token_profile (budget/balanced/quality) and phases settings
- Document context_pause_threshold field
- Document remote_questions configuration (Slack/Discord)
- Document git.merge_strategy (squash/merge) and git.isolation (worktree/branch)
- Expand post_unit_hooks with missing agent field
- Expand pre_dispatch_hooks with skip_if, unit_type, model fields
  and action validation rules
- Add known unit types list for hook before/after arrays
- Add examples for pre-dispatch hooks (modify/skip/replace)
- Add examples for token profile, phases, and remote questions
- Update models to show all 6 phases (research, planning, execution,
  execution_simple, completion, subagent)
- Add full example combining all major settings
2026-03-16 07:09:50 -06:00
Tom Boucher
2ae4633d05 docs: add comprehensive documentation set and update README (#605) 2026-03-16 06:21:43 -06:00