Scans activity logs, metrics, crash locks, and doctor diagnostics for
anomalies, generates a structured forensic report, saves it locally,
and hands it to the LLM for interactive root-cause analysis with
optional GitHub issue creation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
YAML frontmatter parsers can return Date objects for ISO date strings
instead of plain strings. This caused a TypeError when calling
.localeCompare() on a Date object in the changelog sort.
Wrap completedAt with String() at both assignment and sort to handle
both native and JS parser paths safely.
Warp terminal (both macOS and Windows) does not emit recognized escape
sequences for Ctrl+Alt key combos. This adds Warp to the unsupported
terminals list so users see the /gsd status fallback hint.
Closes#643
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The roadmap parser regex used (\w+) to capture slice/task IDs, which
only matches [a-zA-Z0-9_]. Fractional IDs like S03.5 (created by
/gsd steer) contain a dot, causing the parser to skip the entire line.
The dispatcher then jumps from S03 to S04, finds S04 blocked by
the unparsed S03.5, and gives up with 'earlier slice is not complete'.
Update the ID capture group to ([\w.]+) in both:
- roadmap-slices.ts (primary roadmap parser)
- files.ts (plan task parser, for consistency)
This allows dots in slice/task IDs while preserving all existing
behavior for standard IDs like S01, S02, T01, etc.
Closes#681
The plan-slice.md template declares {{executorContextConstraints}} but
buildPlanSlicePrompt() never passed this variable, causing loadPrompt()
to throw: 'template declares {{executorContextConstraints}} but no value
was provided.'
Add formatExecutorConstraints() that uses the budget engine
(computeBudgets + resolveExecutorContextWindow) to generate the
executor context constraints block with task count ranges and inline
context budgets based on the configured executor model's context window.
Pass the formatted string to loadPrompt() as executorContextConstraints.
Closes#677
When auto-mode runs in a worktree, .gsd/ metadata (STATE.md, roadmap
checkboxes, slice plans, task summaries) only updates inside the
worktree directory. The project root on main retains stale state.
If auto-mode restarts, startAutoMode() calls deriveState(projectRoot)
which reads the stale .gsd/ from main, sees completed units as
incomplete, and re-dispatches them — causing an infinite loop on
already-finished work.
Add syncStateToProjectRoot() that copies STATE.md and the active
milestone directory from worktree → project root after each unit's
rebuildState + autoCommit. This ensures deriveState(projectRoot) on
restart reads current completion state.
The sync is fully non-fatal (try/catch wrapped). Failure falls back
to existing behavior. Uses cpSync with recursive:true for the
milestone directory tree.
When auto-mode restarts after being stopped, the initial deriveState()
reads from the project root which has stale .gsd/ metadata. Completed
units appear incomplete, causing re-dispatch of finished work.
The auto-worktree (if it exists from the previous run) has the current
state. After the initial deriveState(base), check if an auto-worktree
exists for the active milestone and re-derive from there.
This is safe because:
- Only triggers when worktree isolation is enabled
- Only when not already inside a worktree
- Only when an auto-worktree actually exists for the milestone
- The worktree setup at lines 976+ still runs normally after
Fixes#654
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use separate git commands instead of && chains (fails on Windows).
Configure git user.name/email before commit (not set in CI runners).
Mirrors the pattern from worktree-e2e.test.ts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Three fixes for git worktree usage:
1. Add resolveGitDir() that follows the gitdir: pointer in worktree
.git files. Without this, any code looking for MERGE_HEAD,
SQUASH_MSG, or rebase state checks the wrong path in worktrees.
2. Guard captureIntegrationBranch() with detectWorktreeName() — in a
worktree the base branch is implicit (worktree/<name>), so writing
it to META.json leaves stale metadata that persists after merge-back.
3. Use resolveGitDir() in doctor.ts for corrupt merge state detection.
Previously hardcoded join(basePath, ".git") which misses worktrees.
Includes 7 regression tests covering all three fixes.
Relates to #654 (stale state from main branch instead of worktree)
Relates to #672 (parallel milestone orchestration)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- claude-import-tui.test.ts: add proper mock for ExtensionCommandContext
with all required properties using type assertions
- marketplace-discovery.test.ts: add explicit check for result.error
before accessing it to satisfy strict null checking
Fix type compatibility issues introduced in the JS→TS conversion:
- Restore PageEntry.page to `any` (holds Playwright Page instance)
- Use Record<string, any> for session parameters in
buildFailureHypothesis and summarizeBrowserSession (callers pass
rich objects with extra properties)
- Use Record<string, unknown> for formatTimelineEntries options
- Add explicit type annotations to local variables and callbacks
to satisfy noImplicitAny in tsconfig.extensions.json
Capture the session file path on pause and synthesize a recovery briefing
on resume, so the next agent knows what already happened instead of
restarting the unit from scratch.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract duplicated help text from loader.ts and cli.ts into shared
help-text.ts module (single source of truth)
- Convert validate-pack.sh to Node.js for Windows compatibility
- Fix dev.js using unnecessary npx for tsc (it's a devDependency,
use node_modules/.bin/tsc directly)
When auto-mode loop recovery marks tasks as [x] in the plan file and
auto is restarted, the done count can equal total. The display always
showed done+1 (assuming "currently working on next task"), causing
values like "task 5/4". Clamp to total so it never exceeds the max.
Closes#662
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Convert browser-tools/core.js (1058 lines) to native TypeScript with
full type annotations from the existing .d.ts file. Remove the
separate .d.ts declaration file (types are now inline).
- Add c8 test coverage reporting: `npm run test:coverage` generates
text + lcov reports with 50% statement threshold baseline.
- Add coverage/ to .gitignore
All 712 unit tests, 63 browser-tools tests, and 11 integration tests
pass with zero regressions.
1. Windows: `start` command opens CMD instead of browser during GitHub
Copilot login — pass empty title arg so URL is treated as target
2. Launch banner missing Tavily provider in web search status display
3. MCPorter auto-installs via npm when not found (like ripgrep auto-download)
4. Notification prefs showing [object Object] — guard against non-boolean values
Closes#663
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Agent now cancels in-flight async_bash jobs after editing source files
before re-running them, preventing stale results from polluting context.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix loadStoredEnvKeys divergent provider lists: add telegram_bot and
custom-openai to wizard.ts (the canonical copy used by CLI), remove
dead duplicate from onboarding.ts
- Security: add SAFE_COMMAND_PREFIXES allowlist to resolveConfigValue
to prevent arbitrary RCE via settings.json shell commands
- Security: add TOFU (Trust On First Use) model for project-local
extensions — skip untrusted .pi/extensions/ with stderr warning
- Performance: debounce sql.js MemoryStorage persistence (500ms window)
so rapid mutations coalesce into a single db.export()+writeFileSync
- Fix double lstatSync call in tool-bootstrap.ts isRegularFile
- Add 26 new tests covering all changes
findMilestoneIds() had a bare catch that returned [] on any error,
causing showSmartEntry() to think no milestones exist and restart
the new-project discuss flow in a loop. Add error logging when the
directory exists but scanning fails, and a sanity check that warns
the user instead of looping when the directory has entries that
weren't recognized.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- google-search test: mock getApiKeyForProvider to return JSON string
matching real OAuth provider behavior (token+projectId), instead of
using AuthStorage.inMemory which bypasses the OAuth getApiKey transform
- smoke test: split on /[/\\]/ for Windows path separator compatibility
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On Windows, raw paths like D:\... are interpreted as protocol "d:" by
the ESM loader. Convert via pathToFileURL before dynamic import.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Kept both health gate (main) and debug timer (PR) in auto.ts.
Added agentInstructionsBlock to fullSystem composition in index.ts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Combine budget fields (contextWindowTokens, truncationSections,
continueHereFired) from PR #594 with prompt char tracking fields
(promptCharCount, baselineCharCount) from main.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Telegram Bot API as a third remote questions channel alongside
Discord and Slack. Implements the ChannelAdapter interface with inline
keyboard buttons, callback query handling, text reply polling, and
supergroup message URL generation.
Closes#645
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extension-based providers like pi-claude-cli may not require credentials
in auth.json, causing shouldRunOnboarding() to always return true and
repeat the wizard every launch. Now checks if a defaultProvider is
already set in settings before triggering the wizard.
Merge main into feat/context-window-budget, combining:
- Budget fields (contextWindowTokens, truncationSections, continueHereFired)
from the PR with routing fields (tier, modelDowngraded) from main in
UnitMetrics interface
- Unified opts parameter pattern in snapshotUnitMetrics
- KNOWLEDGE.md step from main with template path references from the PR
in execute-task.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add workflow mode system (solo/team) with /gsd mode command
Introduces a `mode` preference that bundles sensible defaults for solo
developers vs team workflows, replacing the need to manually configure
5-8 individual git preferences.
* fix: resolve TS2339 — use string narrowing for ctx.ui.select return type
Two fixes for the model configuration bleeding between simultaneous
GSD instances that share the same global settings.json.
## Root Cause
1. `setDefaultModelAndProvider()` always persisted to `~/.gsd/agent/settings.json`
(global), so when either instance's interactive mode changed models (via
Ctrl+P or /model), it overwrote the other instance's saved default.
2. When auto-mode dispatched a new unit (after context wipe), if no
per-unit-type model preference was configured, the session picked up
the default from the now-contaminated global settings file.
## Fix 1: Project-scoped model persistence (settings-manager.ts)
`setDefaultModelAndProvider()`, `setDefaultModel()`, and `setDefaultProvider()`
now persist to project-level settings (`.pi/settings.json`) when a project
settings file exists, falling back to global only when no project context
is available. This prevents concurrent instances from overwriting each
other's model choice.
Added `hasProjectSettingsFile()` helper to detect project context.
## Fix 2: Auto-mode model capture (auto.ts)
Captures the session's model at auto-mode start (`autoModeStartModel`).
At each unit dispatch, if no model preference is configured for the unit
type, the captured model is re-applied with `persist: false`. This
ensures each auto-mode session maintains its own model regardless of
what other instances write to the shared settings file.
## Tests
3 new tests covering:
- Project settings file isolates model from global
- Two projects have independent model configs
- autoModeStartModel concept prevents model drift
All 448 existing tests pass.
Fixes#650
* fix: bg_shell ready_port timeout and error handling (#428)
When a server fails to bind to the configured ready_port, the process
would stay in "starting" status indefinitely after the probing interval
cleared, with no error surfaced to the agent. This fixes the hang by:
- Transitioning process to "error" status when port probing times out
- Detecting process exit during port polling and reporting stderr context
- Adding ready_timeout parameter for custom timeout values
- Including stderr output in waitForReady timeout/error responses
- Registering SIGTERM/SIGINT handlers to clean up bg processes on exit
Closes#428
* feat: add /gsd quick command and agent-instructions.md injection (#425)
Implements two features from issue #425:
1. `/gsd quick <task>` — lightweight task execution with GSD guarantees
(atomic commits, state tracking) without the full milestone ceremony.
Creates `.gsd/quick/<num>-<slug>/` directory, a git branch, and
dispatches a focused prompt for in-session execution.
2. Agent instructions file — loads `~/.gsd/agent-instructions.md` (global)
and `.gsd/agent-instructions.md` (project), injects into every GSD
agent session via the before_agent_start hook. Lets users add durable
instructions like notification preferences or environment constraints.
Closes#425
---------
Co-authored-by: TÂCHES <afromanguy@me.com>
* feat(doctor): add 7 runtime health checks with auto-fix
Add comprehensive runtime health monitoring to /gsd doctor:
- stale_crash_lock: detect dead auto.lock from crashed sessions, auto-clear
- orphaned_completed_units: find completed-unit keys referencing missing artifacts, auto-remove
- stale_hook_state: detect residual hook cycle counts with no running session, auto-clear
- activity_log_bloat: flag activity/ dir exceeding 500 files or 100MB, auto-prune (7-day retention)
- state_file_missing: detect missing STATE.md when milestones exist, auto-generate
- state_file_stale: detect STATE.md drift (wrong phase/milestone/slice), auto-rebuild
- gitignore_missing_patterns: detect missing critical GSD runtime patterns in .gitignore, auto-fix
All checks are non-fatal (gracefully degrade on read errors) and respect
the existing fix/fixLevel system. Includes 34 new test assertions across
9 test scenarios in doctor-runtime.test.ts.
* feat(doctor): add proactive healing layer for auto-mode
Three new mechanisms for automatic health monitoring:
1. Pre-dispatch health gate: runs before each unit dispatch in auto-mode.
Checks for stale crash locks (auto-clears) and corrupt merge state
(auto-heals via abortAndReset). Pauses auto-mode if critical issues
can't be resolved.
2. Health score tracking: records error/warning/fix counts after each
post-unit doctor run. Tracks trends (improving/stable/degrading)
across a sliding window of 50 snapshots. Monitors consecutive
error unit streaks.
3. Auto-heal escalation: when deterministic fixes can't resolve errors
after 5 consecutive units AND health trend is not improving,
automatically dispatches LLM-assisted heal (dispatchDoctorHeal).
Single-fire per session to prevent spam. Defers escalation when
trend is improving (fixes are working, just slowly).
Integration points in auto.ts:
- resetProactiveHealing() on start/stop
- preDispatchHealthGate() before deriveState in dispatchNextUnit
- recordHealthSnapshot() + checkHealEscalation() in post-unit hook
- formatHealthSummary() available for dashboard display
Includes 30 test assertions across 15 scenarios.