gsd-pi 2.76.0 → 2.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -25
- package/dist/claude-cli-check.js +32 -3
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.js +35 -1
- package/dist/onboarding.js +45 -0
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +2 -8
- package/dist/resources/agents/researcher.md +1 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +31 -8
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +77 -17
- package/dist/resources/extensions/gsd/auto/loop.js +9 -0
- package/dist/resources/extensions/gsd/auto/phases.js +104 -11
- package/dist/resources/extensions/gsd/auto/run-unit.js +38 -2
- package/dist/resources/extensions/gsd/auto/session.js +22 -1
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -3
- package/dist/resources/extensions/gsd/auto-model-selection.js +53 -16
- package/dist/resources/extensions/gsd/auto-post-unit.js +25 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +14 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +32 -1
- package/dist/resources/extensions/gsd/auto-start.js +58 -57
- package/dist/resources/extensions/gsd/auto-verification.js +33 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +51 -53
- package/dist/resources/extensions/gsd/auto.js +70 -28
- package/dist/resources/extensions/gsd/blocked-models.js +68 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +93 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +39 -9
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +93 -0
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +3 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +12 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +52 -6
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +84 -23
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +34 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +93 -0
- package/dist/resources/extensions/gsd/commands-extract-learnings.js +54 -89
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +968 -23
- package/dist/resources/extensions/gsd/compaction-snapshot.js +121 -0
- package/dist/resources/extensions/gsd/complexity-classifier.js +5 -3
- package/dist/resources/extensions/gsd/db-writer.js +88 -16
- package/dist/resources/extensions/gsd/doctor-git-checks.js +23 -29
- package/dist/resources/extensions/gsd/doctor-providers.js +51 -5
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +1 -0
- package/dist/resources/extensions/gsd/error-classifier.js +31 -3
- package/dist/resources/extensions/gsd/exec-history.js +120 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +258 -0
- package/dist/resources/extensions/gsd/gitignore.js +1 -0
- package/dist/resources/extensions/gsd/gsd-db.js +168 -23
- package/dist/resources/extensions/gsd/guided-flow.js +190 -1
- package/dist/resources/extensions/gsd/health-widget.js +4 -1
- package/dist/resources/extensions/gsd/hook-emitter.js +108 -0
- package/dist/resources/extensions/gsd/init-wizard.js +15 -1
- package/dist/resources/extensions/gsd/key-manager.js +28 -0
- package/dist/resources/extensions/gsd/memory-backfill.js +126 -0
- package/dist/resources/extensions/gsd/memory-store.js +19 -0
- package/dist/resources/extensions/gsd/model-router.js +36 -3
- package/dist/resources/extensions/gsd/pre-execution-checks.js +44 -9
- package/dist/resources/extensions/gsd/preferences-types.js +9 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +83 -0
- package/dist/resources/extensions/gsd/preferences.js +17 -17
- package/dist/resources/extensions/gsd/prompt-loader.js +22 -7
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/dist/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +96 -0
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +13 -5
- package/dist/resources/extensions/gsd/safety/safety-harness.js +5 -1
- package/dist/resources/extensions/gsd/state.js +43 -4
- package/dist/resources/extensions/gsd/token-counter.js +22 -5
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +16 -10
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +59 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +126 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +26 -1
- package/dist/resources/extensions/gsd/tools/resume-tool.js +23 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +20 -3
- package/dist/resources/extensions/gsd/workflow-mcp.js +3 -0
- package/dist/resources/extensions/gsd/workflow-templates/spike.md +6 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +50 -10
- package/dist/resources/extensions/search-the-web/command-search-provider.js +5 -4
- package/dist/resources/extensions/search-the-web/native-search.js +45 -13
- package/dist/resources/skills/api-design/SKILL.md +190 -0
- package/dist/resources/skills/create-mcp-server/SKILL.md +121 -0
- package/dist/resources/skills/decompose-into-slices/SKILL.md +139 -0
- package/dist/resources/skills/dependency-upgrade/SKILL.md +158 -0
- package/dist/resources/skills/design-an-interface/SKILL.md +102 -0
- package/dist/resources/skills/forensics/SKILL.md +153 -0
- package/dist/resources/skills/grill-me/SKILL.md +93 -0
- package/dist/resources/skills/handoff/SKILL.md +121 -0
- package/dist/resources/skills/observability/SKILL.md +174 -0
- package/dist/resources/skills/security-review/SKILL.md +181 -0
- package/dist/resources/skills/spike-wrap-up/SKILL.md +138 -0
- package/dist/resources/skills/tdd/SKILL.md +112 -0
- package/dist/resources/skills/verify-before-complete/SKILL.md +98 -0
- package/dist/resources/skills/write-docs/SKILL.md +82 -0
- package/dist/resources/skills/write-milestone-brief/SKILL.md +135 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.js +6 -1
- package/dist/wizard.js +2 -0
- package/package.json +1 -1
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/remote-questions.d.ts +45 -0
- package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -0
- package/packages/mcp-server/dist/remote-questions.js +732 -0
- package/packages/mcp-server/dist/remote-questions.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +7 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +70 -8
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/session-manager.d.ts +14 -0
- package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
- package/packages/mcp-server/dist/session-manager.js +49 -1
- package/packages/mcp-server/dist/session-manager.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +163 -25
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +4 -3
- package/packages/mcp-server/src/mcp-server.test.ts +67 -0
- package/packages/mcp-server/src/remote-questions.test.ts +294 -0
- package/packages/mcp-server/src/remote-questions.ts +916 -0
- package/packages/mcp-server/src/server.ts +89 -14
- package/packages/mcp-server/src/session-manager.ts +43 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +146 -1
- package/packages/mcp-server/src/workflow-tools.ts +215 -43
- package/packages/mcp-server/tsconfig.test.json +19 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +12 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +30 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +14 -0
- package/packages/pi-agent-core/src/types.ts +34 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/models/custom.d.ts +38 -0
- package/packages/pi-ai/dist/models/custom.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/custom.js +41 -0
- package/packages/pi-ai/dist/models/custom.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +13 -0
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +27 -4
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +13 -4
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +80 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +60 -15
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.d.ts +10 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +16 -1
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts +17 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js +75 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.js.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js +41 -0
- package/packages/pi-ai/dist/providers/think-tag-parser.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +12 -2
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +164 -14
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +15 -3
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +67 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +16 -3
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +67 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +289 -0
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/models/custom.ts +42 -0
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +1 -1
- package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +26 -5
- package/packages/pi-ai/src/providers/anthropic.ts +15 -4
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +98 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +57 -16
- package/packages/pi-ai/src/providers/simple-options.ts +17 -1
- package/packages/pi-ai/src/providers/think-tag-parser.test.ts +44 -0
- package/packages/pi-ai/src/providers/think-tag-parser.ts +94 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +200 -23
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +12 -2
- package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +84 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +15 -5
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +84 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +16 -5
- package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +363 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +3 -2
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +32 -2
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +35 -2
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +233 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +205 -2
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts +53 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.js +337 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +234 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts +3 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.js +92 -12
- package/packages/pi-coding-agent/dist/core/model-discovery.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js +16 -1
- package/packages/pi-coding-agent/dist/core/model-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js +40 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-header.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js +203 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js +61 -1
- package/packages/pi-coding-agent/dist/core/model-registry-discovery.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +90 -10
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js +49 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js +67 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +10 -6
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +45 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +5 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js +13 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/provider-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +7 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +29 -21
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +13 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +3 -2
- package/packages/pi-coding-agent/src/core/agent-session.ts +38 -2
- package/packages/pi-coding-agent/src/core/extensions/index.ts +16 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +5 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +351 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +258 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +269 -0
- package/packages/pi-coding-agent/src/core/hooks-runner.ts +460 -0
- package/packages/pi-coding-agent/src/core/index.ts +10 -0
- package/packages/pi-coding-agent/src/core/model-discovery.test.ts +19 -0
- package/packages/pi-coding-agent/src/core/model-discovery.ts +99 -12
- package/packages/pi-coding-agent/src/core/model-registry-auth-header.test.ts +44 -0
- package/packages/pi-coding-agent/src/core/model-registry-custom-caps.test.ts +245 -0
- package/packages/pi-coding-agent/src/core/model-registry-discovery.test.ts +75 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +102 -10
- package/packages/pi-coding-agent/src/core/redact-secrets.test.ts +86 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.ts +58 -0
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +65 -1
- package/packages/pi-coding-agent/src/core/session-manager.ts +10 -6
- package/packages/pi-coding-agent/src/core/settings-manager.ts +57 -0
- package/packages/pi-coding-agent/src/index.ts +16 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +6 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/provider-manager.ts +16 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +36 -22
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +13 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/scripts/link-workspace-packages.cjs +1 -0
- package/src/resources/agents/researcher.md +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +32 -8
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +78 -17
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +149 -5
- package/src/resources/extensions/gsd/auto/loop-deps.ts +14 -0
- package/src/resources/extensions/gsd/auto/loop.ts +9 -0
- package/src/resources/extensions/gsd/auto/phases.ts +131 -10
- package/src/resources/extensions/gsd/auto/run-unit.ts +40 -2
- package/src/resources/extensions/gsd/auto/session.ts +35 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -3
- package/src/resources/extensions/gsd/auto-model-selection.ts +71 -15
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +28 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +26 -1
- package/src/resources/extensions/gsd/auto-start.ts +60 -68
- package/src/resources/extensions/gsd/auto-verification.ts +33 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +62 -63
- package/src/resources/extensions/gsd/auto.ts +73 -28
- package/src/resources/extensions/gsd/blocked-models.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +120 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +40 -9
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +109 -0
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +5 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +54 -6
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +89 -26
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +35 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +111 -0
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +55 -90
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +898 -32
- package/src/resources/extensions/gsd/compaction-snapshot.ts +165 -0
- package/src/resources/extensions/gsd/complexity-classifier.ts +5 -3
- package/src/resources/extensions/gsd/db-writer.ts +88 -17
- package/src/resources/extensions/gsd/doctor-git-checks.ts +23 -27
- package/src/resources/extensions/gsd/doctor-providers.ts +59 -6
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +2 -0
- package/src/resources/extensions/gsd/error-classifier.ts +36 -3
- package/src/resources/extensions/gsd/exec-history.ts +153 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +326 -0
- package/src/resources/extensions/gsd/gitignore.ts +1 -1
- package/src/resources/extensions/gsd/gsd-db.ts +186 -23
- package/src/resources/extensions/gsd/guided-flow.ts +222 -1
- package/src/resources/extensions/gsd/health-widget.ts +3 -1
- package/src/resources/extensions/gsd/hook-emitter.ts +188 -0
- package/src/resources/extensions/gsd/init-wizard.ts +15 -1
- package/src/resources/extensions/gsd/journal.ts +2 -1
- package/src/resources/extensions/gsd/key-manager.ts +28 -0
- package/src/resources/extensions/gsd/memory-backfill.ts +140 -0
- package/src/resources/extensions/gsd/memory-store.ts +26 -0
- package/src/resources/extensions/gsd/model-router.ts +42 -1
- package/src/resources/extensions/gsd/pre-execution-checks.ts +46 -10
- package/src/resources/extensions/gsd/preferences-types.ts +46 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +79 -0
- package/src/resources/extensions/gsd/preferences.ts +17 -17
- package/src/resources/extensions/gsd/prompt-loader.ts +30 -7
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/debug-diagnose.md +2 -0
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/src/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/src/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +119 -0
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +17 -4
- package/src/resources/extensions/gsd/safety/safety-harness.ts +9 -0
- package/src/resources/extensions/gsd/state.ts +45 -4
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +188 -2
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +95 -1
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +141 -0
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +33 -3
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +68 -66
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +148 -3
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +306 -1
- package/src/resources/extensions/gsd/tests/escalation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +237 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +40 -9
- package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +447 -1
- package/src/resources/extensions/gsd/tests/init-wizard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/integration/gitignore-tracked-gsd.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/issue-4540-regressions.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/load-memory-block.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/pre-exec-gate-loop.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +356 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +103 -4
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +388 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/save-gate-result-render.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/schema-v21-sequence.test.ts +413 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +32 -40
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/token-counter.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +65 -2
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +78 -5
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +3 -1
- package/src/resources/extensions/gsd/token-counter.ts +22 -5
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +15 -9
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +81 -0
- package/src/resources/extensions/gsd/tools/exec-tool.ts +183 -0
- package/src/resources/extensions/gsd/tools/memory-tools.ts +31 -1
- package/src/resources/extensions/gsd/tools/resume-tool.ts +40 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +26 -3
- package/src/resources/extensions/gsd/workflow-logger.ts +4 -1
- package/src/resources/extensions/gsd/workflow-mcp.ts +3 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +6 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +54 -9
- package/src/resources/extensions/search-the-web/command-search-provider.ts +5 -4
- package/src/resources/extensions/search-the-web/native-search.ts +48 -12
- package/src/resources/skills/api-design/SKILL.md +190 -0
- package/src/resources/skills/create-mcp-server/SKILL.md +121 -0
- package/src/resources/skills/decompose-into-slices/SKILL.md +139 -0
- package/src/resources/skills/dependency-upgrade/SKILL.md +158 -0
- package/src/resources/skills/design-an-interface/SKILL.md +102 -0
- package/src/resources/skills/forensics/SKILL.md +153 -0
- package/src/resources/skills/grill-me/SKILL.md +93 -0
- package/src/resources/skills/handoff/SKILL.md +121 -0
- package/src/resources/skills/observability/SKILL.md +174 -0
- package/src/resources/skills/security-review/SKILL.md +181 -0
- package/src/resources/skills/spike-wrap-up/SKILL.md +138 -0
- package/src/resources/skills/tdd/SKILL.md +112 -0
- package/src/resources/skills/verify-before-complete/SKILL.md +98 -0
- package/src/resources/skills/write-docs/SKILL.md +82 -0
- package/src/resources/skills/write-milestone-brief/SKILL.md +135 -0
- /package/dist/web/standalone/.next/static/{ssX7BLv3Dw9Fb4CtrCGeR → pV-mPo7rYGb5JBC09C8GG}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ssX7BLv3Dw9Fb4CtrCGeR → pV-mPo7rYGb5JBC09C8GG}/_ssgManifest.js +0 -0
|
@@ -28,6 +28,37 @@ export interface ContextManagementConfig {
|
|
|
28
28
|
compaction_threshold_percent?: number; // default: 0.70, range: 0.5-0.95
|
|
29
29
|
tool_result_max_chars?: number; // default: 800, range: 200-10000
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Opt-in tool-output sandboxing for sub-sessions. When enabled, the gsd_exec
|
|
34
|
+
* MCP tool runs scripts in an isolated subprocess and returns only a short
|
|
35
|
+
* digest to the calling agent's context window; full stdout/stderr persist
|
|
36
|
+
* in the project memory store and can be retrieved by id later.
|
|
37
|
+
*
|
|
38
|
+
* Inspired by mksglu/context-mode (Elastic License 2.0). This is an
|
|
39
|
+
* independent implementation — no upstream code is incorporated.
|
|
40
|
+
*/
|
|
41
|
+
export interface ContextModeConfig {
|
|
42
|
+
/** Master switch. Default: true (opt-out via `enabled: false`). */
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
/** Per-invocation timeout in milliseconds. Default: 30_000. Range: 1_000–600_000. */
|
|
45
|
+
exec_timeout_ms?: number;
|
|
46
|
+
/** Cap on persisted stdout bytes per invocation. Default: 1_048_576 (1 MiB). Range: 4_096–16_777_216. */
|
|
47
|
+
exec_stdout_cap_bytes?: number;
|
|
48
|
+
/** Number of trailing stdout characters returned in the digest. Default: 300. Range: 0–4_000. */
|
|
49
|
+
exec_digest_chars?: number;
|
|
50
|
+
/** Environment variables forwarded to sandboxed processes (case-sensitive names). PATH and HOME are always forwarded. */
|
|
51
|
+
exec_env_allowlist?: string[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resolve whether context-mode features (gsd_exec sandbox + compaction
|
|
56
|
+
* snapshot) should be active. Default is ON: missing config or missing
|
|
57
|
+
* `enabled` is treated as true. Only `enabled: false` disables.
|
|
58
|
+
*/
|
|
59
|
+
export function isContextModeEnabled(prefs: { context_mode?: ContextModeConfig } | null | undefined): boolean {
|
|
60
|
+
return prefs?.context_mode?.enabled !== false;
|
|
61
|
+
}
|
|
31
62
|
import type { GitHubSyncConfig } from "../github-sync/types.js";
|
|
32
63
|
|
|
33
64
|
// ─── Workflow Modes ──────────────────────────────────────────────────────────
|
|
@@ -117,6 +148,7 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
|
|
|
117
148
|
"flat_rate_providers",
|
|
118
149
|
"language",
|
|
119
150
|
"context_window_override",
|
|
151
|
+
"context_mode",
|
|
120
152
|
]);
|
|
121
153
|
|
|
122
154
|
/** Canonical list of all dispatch unit types. */
|
|
@@ -300,6 +332,12 @@ export interface GSDPreferences {
|
|
|
300
332
|
*/
|
|
301
333
|
context_window_override?: number;
|
|
302
334
|
context_management?: ContextManagementConfig;
|
|
335
|
+
/**
|
|
336
|
+
* Tool-output sandboxing via gsd_exec. Keeps sub-session context windows
|
|
337
|
+
* clean by running scripts in a subprocess and only surfacing a short
|
|
338
|
+
* digest. See `ContextModeConfig`. Default: disabled.
|
|
339
|
+
*/
|
|
340
|
+
context_mode?: ContextModeConfig;
|
|
303
341
|
token_profile?: TokenProfile;
|
|
304
342
|
phases?: PhaseSkipPreferences;
|
|
305
343
|
auto_visualize?: boolean;
|
|
@@ -354,6 +392,14 @@ export interface GSDPreferences {
|
|
|
354
392
|
checkpoints?: boolean;
|
|
355
393
|
auto_rollback?: boolean;
|
|
356
394
|
timeout_scale_cap?: number;
|
|
395
|
+
/**
|
|
396
|
+
* Glob patterns for files that are always expected side-effects of any task.
|
|
397
|
+
* Files matching any pattern here are excluded from unexpected-change warnings.
|
|
398
|
+
* Supports standard glob syntax (e.g. `tracking/history/**`, `*.log`).
|
|
399
|
+
* Fixes #4385/#4436 — audit-trail snapshots, build artifacts, and other
|
|
400
|
+
* project-level secondary writes shouldn't require per-task declaration.
|
|
401
|
+
*/
|
|
402
|
+
file_change_allowlist?: string[];
|
|
357
403
|
};
|
|
358
404
|
|
|
359
405
|
|
|
@@ -644,6 +644,50 @@ export function validatePreferences(preferences: GSDPreferences): {
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
647
|
+
// ─── Context Mode (gsd_exec sandbox) ────────────────────────────────────
|
|
648
|
+
if (preferences.context_mode !== undefined) {
|
|
649
|
+
if (typeof preferences.context_mode === "object" && preferences.context_mode !== null) {
|
|
650
|
+
const cmode = preferences.context_mode as unknown as Record<string, unknown>;
|
|
651
|
+
const validCmode: Record<string, unknown> = {};
|
|
652
|
+
|
|
653
|
+
if (cmode.enabled !== undefined) {
|
|
654
|
+
if (typeof cmode.enabled === "boolean") validCmode.enabled = cmode.enabled;
|
|
655
|
+
else errors.push("context_mode.enabled must be a boolean");
|
|
656
|
+
}
|
|
657
|
+
if (cmode.exec_timeout_ms !== undefined) {
|
|
658
|
+
const t = cmode.exec_timeout_ms;
|
|
659
|
+
if (typeof t === "number" && t >= 1000 && t <= 600_000) validCmode.exec_timeout_ms = Math.floor(t);
|
|
660
|
+
else errors.push("context_mode.exec_timeout_ms must be a number between 1000 and 600000");
|
|
661
|
+
}
|
|
662
|
+
if (cmode.exec_stdout_cap_bytes !== undefined) {
|
|
663
|
+
const b = cmode.exec_stdout_cap_bytes;
|
|
664
|
+
if (typeof b === "number" && b >= 4096 && b <= 16_777_216) validCmode.exec_stdout_cap_bytes = Math.floor(b);
|
|
665
|
+
else errors.push("context_mode.exec_stdout_cap_bytes must be a number between 4096 and 16777216");
|
|
666
|
+
}
|
|
667
|
+
if (cmode.exec_digest_chars !== undefined) {
|
|
668
|
+
const c = cmode.exec_digest_chars;
|
|
669
|
+
if (typeof c === "number" && c >= 0 && c <= 4000) validCmode.exec_digest_chars = Math.floor(c);
|
|
670
|
+
else errors.push("context_mode.exec_digest_chars must be a number between 0 and 4000");
|
|
671
|
+
}
|
|
672
|
+
if (cmode.exec_env_allowlist !== undefined) {
|
|
673
|
+
if (
|
|
674
|
+
Array.isArray(cmode.exec_env_allowlist) &&
|
|
675
|
+
cmode.exec_env_allowlist.every((v) => typeof v === "string" && /^[A-Z_][A-Z0-9_]*$/i.test(v))
|
|
676
|
+
) {
|
|
677
|
+
validCmode.exec_env_allowlist = cmode.exec_env_allowlist;
|
|
678
|
+
} else {
|
|
679
|
+
errors.push("context_mode.exec_env_allowlist must be an array of valid env var names");
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (Object.keys(validCmode).length > 0) {
|
|
684
|
+
validated.context_mode = validCmode as any;
|
|
685
|
+
}
|
|
686
|
+
} else {
|
|
687
|
+
errors.push("context_mode must be an object");
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
647
691
|
// ─── Parallel Config ────────────────────────────────────────────────────
|
|
648
692
|
if (preferences.parallel && typeof preferences.parallel === "object") {
|
|
649
693
|
const p = preferences.parallel as unknown as Record<string, unknown>;
|
|
@@ -697,6 +741,41 @@ export function validatePreferences(preferences: GSDPreferences): {
|
|
|
697
741
|
}
|
|
698
742
|
}
|
|
699
743
|
|
|
744
|
+
// ─── Slice Parallel Config ───────────────────────────────────────────────
|
|
745
|
+
if (preferences.slice_parallel !== undefined) {
|
|
746
|
+
if (typeof preferences.slice_parallel === "object" && preferences.slice_parallel !== null) {
|
|
747
|
+
const sp = preferences.slice_parallel as Record<string, unknown>;
|
|
748
|
+
const validSp: NonNullable<GSDPreferences["slice_parallel"]> = {};
|
|
749
|
+
|
|
750
|
+
if (sp.enabled !== undefined) {
|
|
751
|
+
if (typeof sp.enabled === "boolean") validSp.enabled = sp.enabled;
|
|
752
|
+
else errors.push("slice_parallel.enabled must be a boolean");
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
if (sp.max_workers !== undefined) {
|
|
756
|
+
const maxWorkers = typeof sp.max_workers === "number" ? sp.max_workers : Number(sp.max_workers);
|
|
757
|
+
if (Number.isFinite(maxWorkers) && maxWorkers >= 1 && maxWorkers <= 8) {
|
|
758
|
+
validSp.max_workers = Math.floor(maxWorkers);
|
|
759
|
+
} else {
|
|
760
|
+
errors.push("slice_parallel.max_workers must be a number between 1 and 8");
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const knownSliceParallelKeys = new Set(["enabled", "max_workers"]);
|
|
765
|
+
for (const key of Object.keys(sp)) {
|
|
766
|
+
if (!knownSliceParallelKeys.has(key)) {
|
|
767
|
+
warnings.push(`unknown slice_parallel key "${key}" — ignored`);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
if (Object.keys(validSp).length > 0) {
|
|
772
|
+
validated.slice_parallel = validSp;
|
|
773
|
+
}
|
|
774
|
+
} else {
|
|
775
|
+
errors.push("slice_parallel must be an object");
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
700
779
|
// ─── Reactive Execution ─────────────────────────────────────────────────
|
|
701
780
|
if (preferences.reactive_execution !== undefined) {
|
|
702
781
|
if (typeof preferences.reactive_execution === "object" && preferences.reactive_execution !== null) {
|
|
@@ -68,13 +68,13 @@ export { resolveAllSkillReferences } from "./preferences-skills.js";
|
|
|
68
68
|
// These lived in preferences-skills.ts but imported loadEffectiveGSDPreferences
|
|
69
69
|
// back from this file, creating a circular dependency. Moved here since they
|
|
70
70
|
// are trivial wrappers over loadEffectiveGSDPreferences.
|
|
71
|
-
export function resolveSkillDiscoveryMode(): SkillDiscoveryMode {
|
|
72
|
-
const prefs = loadEffectiveGSDPreferences();
|
|
71
|
+
export function resolveSkillDiscoveryMode(basePath?: string): SkillDiscoveryMode {
|
|
72
|
+
const prefs = loadEffectiveGSDPreferences(basePath);
|
|
73
73
|
return prefs?.preferences.skill_discovery ?? "suggest";
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export function resolveSkillStalenessDays(): number {
|
|
77
|
-
const prefs = loadEffectiveGSDPreferences();
|
|
76
|
+
export function resolveSkillStalenessDays(basePath?: string): number {
|
|
77
|
+
const prefs = loadEffectiveGSDPreferences(basePath);
|
|
78
78
|
return prefs?.preferences.skill_staleness_days ?? 60;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -109,16 +109,16 @@ function legacyGlobalPreferencesPath(): string {
|
|
|
109
109
|
return join(homedir(), ".pi", "agent", "gsd-preferences.md");
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function projectPreferencesPath(): string {
|
|
113
|
-
return join(gsdRoot(
|
|
112
|
+
function projectPreferencesPath(basePath: string = process.cwd()): string {
|
|
113
|
+
return join(gsdRoot(basePath), "PREFERENCES.md");
|
|
114
114
|
}
|
|
115
115
|
// Legacy lowercase files can still exist in older projects. Keep them as a
|
|
116
116
|
// compatibility-only fallback, but route new reads/writes through PREFERENCES.md.
|
|
117
117
|
function legacyGlobalPreferencesPathLowercase(): string {
|
|
118
118
|
return join(gsdHome(), "preferences.md");
|
|
119
119
|
}
|
|
120
|
-
function legacyProjectPreferencesPathLowercase(): string {
|
|
121
|
-
return join(gsdRoot(
|
|
120
|
+
function legacyProjectPreferencesPathLowercase(basePath: string = process.cwd()): string {
|
|
121
|
+
return join(gsdRoot(basePath), "preferences.md");
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export function getGlobalGSDPreferencesPath(): string {
|
|
@@ -129,8 +129,8 @@ export function getLegacyGlobalGSDPreferencesPath(): string {
|
|
|
129
129
|
return legacyGlobalPreferencesPath();
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
export function getProjectGSDPreferencesPath(): string {
|
|
133
|
-
return projectPreferencesPath();
|
|
132
|
+
export function getProjectGSDPreferencesPath(basePath?: string): string {
|
|
133
|
+
return projectPreferencesPath(basePath);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// ─── Loading ────────────────────────────────────────────────────────────────
|
|
@@ -141,14 +141,14 @@ export function loadGlobalGSDPreferences(): LoadedGSDPreferences | null {
|
|
|
141
141
|
?? loadPreferencesFile(legacyGlobalPreferencesPath(), "global");
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export function loadProjectGSDPreferences(): LoadedGSDPreferences | null {
|
|
145
|
-
return loadPreferencesFile(projectPreferencesPath(), "project")
|
|
146
|
-
?? loadPreferencesFile(legacyProjectPreferencesPathLowercase(), "project");
|
|
144
|
+
export function loadProjectGSDPreferences(basePath?: string): LoadedGSDPreferences | null {
|
|
145
|
+
return loadPreferencesFile(projectPreferencesPath(basePath), "project")
|
|
146
|
+
?? loadPreferencesFile(legacyProjectPreferencesPathLowercase(basePath), "project");
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export function loadEffectiveGSDPreferences(): LoadedGSDPreferences | null {
|
|
149
|
+
export function loadEffectiveGSDPreferences(basePath?: string): LoadedGSDPreferences | null {
|
|
150
150
|
const globalPreferences = loadGlobalGSDPreferences();
|
|
151
|
-
const projectPreferences = loadProjectGSDPreferences();
|
|
151
|
+
const projectPreferences = loadProjectGSDPreferences(basePath);
|
|
152
152
|
|
|
153
153
|
if (!globalPreferences && !projectPreferences) return null;
|
|
154
154
|
|
|
@@ -603,8 +603,8 @@ export function resolvePreDispatchHooks(): PreDispatchHookConfig[] {
|
|
|
603
603
|
* Worktree isolation requires explicit opt-in because it depends on git
|
|
604
604
|
* branch infrastructure that must be set up before use.
|
|
605
605
|
*/
|
|
606
|
-
export function getIsolationMode(): "none" | "worktree" | "branch" {
|
|
607
|
-
const prefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
606
|
+
export function getIsolationMode(basePath?: string): "none" | "worktree" | "branch" {
|
|
607
|
+
const prefs = loadEffectiveGSDPreferences(basePath)?.preferences?.git;
|
|
608
608
|
if (prefs?.isolation === "worktree") return "worktree";
|
|
609
609
|
if (prefs?.isolation === "branch") return "branch";
|
|
610
610
|
return "none"; // default — no isolation, work on current branch
|
|
@@ -24,6 +24,35 @@ import { fileURLToPath } from "node:url";
|
|
|
24
24
|
import { homedir } from "node:os";
|
|
25
25
|
import { logWarning } from "./workflow-logger.js";
|
|
26
26
|
|
|
27
|
+
type ExistsFn = (path: string) => boolean;
|
|
28
|
+
|
|
29
|
+
function hasRequiredExtensionAssets(rootDir: string, exists: ExistsFn = existsSync): boolean {
|
|
30
|
+
return (
|
|
31
|
+
exists(join(rootDir, "prompts")) &&
|
|
32
|
+
exists(join(rootDir, "templates", "task-summary.md"))
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function resolveExtensionDirFromCandidates(
|
|
37
|
+
moduleDir: string,
|
|
38
|
+
agentGsdDir: string,
|
|
39
|
+
exists: ExistsFn = existsSync,
|
|
40
|
+
): string {
|
|
41
|
+
const moduleUsable = hasRequiredExtensionAssets(moduleDir, exists);
|
|
42
|
+
const agentUsable = hasRequiredExtensionAssets(agentGsdDir, exists);
|
|
43
|
+
|
|
44
|
+
// Prefer the user-local extension tree when both are valid. This avoids
|
|
45
|
+
// leaking npm/global-install paths into prompts on Windows.
|
|
46
|
+
if (agentUsable) return agentGsdDir;
|
|
47
|
+
if (moduleUsable) return moduleDir;
|
|
48
|
+
|
|
49
|
+
// Degraded fallback: if required template is missing in both locations,
|
|
50
|
+
// keep previous behavior and prefer whichever still has prompts/.
|
|
51
|
+
if (exists(join(moduleDir, "prompts"))) return moduleDir;
|
|
52
|
+
if (exists(join(agentGsdDir, "prompts"))) return agentGsdDir;
|
|
53
|
+
return moduleDir;
|
|
54
|
+
}
|
|
55
|
+
|
|
27
56
|
/**
|
|
28
57
|
* Resolve the GSD extension directory.
|
|
29
58
|
*
|
|
@@ -36,15 +65,9 @@ import { logWarning } from "./workflow-logger.js";
|
|
|
36
65
|
*/
|
|
37
66
|
function resolveExtensionDir(): string {
|
|
38
67
|
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
39
|
-
if (existsSync(join(moduleDir, "prompts"))) return moduleDir;
|
|
40
|
-
|
|
41
|
-
// Fallback: user-local agent directory
|
|
42
68
|
const gsdHome = process.env.GSD_HOME || join(homedir(), ".gsd");
|
|
43
69
|
const agentGsdDir = join(gsdHome, "agent", "extensions", "gsd");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Last resort: return the module dir (warmCache will silently handle the miss)
|
|
47
|
-
return moduleDir;
|
|
70
|
+
return resolveExtensionDirFromCandidates(moduleDir, agentGsdDir);
|
|
48
71
|
}
|
|
49
72
|
|
|
50
73
|
const __extensionDir = resolveExtensionDir();
|
|
@@ -59,7 +59,7 @@ Then:
|
|
|
59
59
|
- `followUps` (string) — Follow-up items for future milestones
|
|
60
60
|
- `deviations` (string) — Deviations from the original plan
|
|
61
61
|
11. Update `.gsd/PROJECT.md`: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting milestone completion and current project state. Do NOT use the `edit` tool for this — PROJECT.md is a full-document refresh.
|
|
62
|
-
12. Extract structured learnings from this milestone and persist them to the
|
|
62
|
+
12. Extract structured learnings from this milestone and persist them to the GSD memory store. Follow the procedure block immediately below — it writes `{{milestoneId}}-LEARNINGS.md` as the audit trail and persists Patterns, Lessons, and Decisions via `capture_thought` (categories: pattern, gotcha/convention, architecture). The memory store is the single source of truth for cross-session durable knowledge (ADR-013).
|
|
63
63
|
|
|
64
64
|
{{extractLearningsSteps}}
|
|
65
65
|
|
|
@@ -29,8 +29,8 @@ Then:
|
|
|
29
29
|
6. If this slice produced evidence that a requirement changed status (Active → Validated, Active → Deferred, etc.), call `gsd_requirement_update` with the requirement ID, updated `status`, and `validation` evidence. Do NOT write `.gsd/REQUIREMENTS.md` directly — the engine renders it from the database.
|
|
30
30
|
7. Prepare the slice completion content you will pass to `gsd_complete_slice` using the camelCase fields `milestoneId`, `sliceId`, `sliceTitle`, `oneLiner`, `narrative`, `verification`, and `uatContent`. Do **not** manually write `{{sliceSummaryPath}}`. Do **not** manually write `{{sliceUatPath}}` — the DB-backed tool is the canonical write path for both artifacts.
|
|
31
31
|
8. Draft the UAT content you will pass as `uatContent` — a concrete UAT script with real test cases derived from the slice plan and task summaries. Include preconditions, numbered steps with expected outcomes, and edge cases. This must NOT be a placeholder or generic template — tailor every test case to what this slice actually built.
|
|
32
|
-
9. Review task summaries for `key_decisions`.
|
|
33
|
-
10. Review task summaries for patterns, gotchas, or non-obvious lessons learned.
|
|
32
|
+
9. Review task summaries for `key_decisions`. For each significant decision, call `capture_thought` with `category: "architecture"` (or `"pattern"`) and a `structuredFields` payload of `{ scope, decision, choice, rationale, made_by: "agent", revisable }`.
|
|
33
|
+
10. Review task summaries for patterns, gotchas, or non-obvious lessons learned. For each one that would save future agents from repeating investigation, call `capture_thought` with the matching category (`gotcha`, `convention`, `pattern`, `environment`). The memory store is the single source of truth (ADR-013); do not append to `.gsd/DECISIONS.md` or `.gsd/KNOWLEDGE.md` directly.
|
|
34
34
|
11. Call `gsd_complete_slice` with the camelCase fields `milestoneId`, `sliceId`, `sliceTitle`, `oneLiner`, `narrative`, `verification`, and `uatContent`, plus any optional enrichment fields you have. Do NOT manually mark the roadmap checkbox — the tool writes to the DB, renders `{{sliceSummaryPath}}` and `{{sliceUatPath}}`, and updates the ROADMAP.md projection automatically.
|
|
35
35
|
12. Do not run git commands — the system commits your changes and handles any merge after this unit succeeds.
|
|
36
36
|
13. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed: use the `write` tool with `path: ".gsd/PROJECT.md"` and `content` containing the full updated document reflecting current project state. Do NOT use the `edit` tool for this — PROJECT.md is a full-document refresh.
|
|
@@ -18,8 +18,10 @@ Goal semantics:
|
|
|
18
18
|
## Instructions
|
|
19
19
|
|
|
20
20
|
1. Read `.gsd/debug/sessions/{{slug}}.json` for any prior session context.
|
|
21
|
+
1a. Call `memory_query` with keywords from the issue (error text, subsystem, file paths). A prior session may have captured this exact gotcha — finding it now saves the investigation.
|
|
21
22
|
2. Investigate the reported issue in `{{workingDirectory}}`.
|
|
22
23
|
3. Follow the goal constraint above strictly.
|
|
23
24
|
4. When complete, surface a clear summary: what failed, why, and what was done (or what a fix would require for root-cause-only mode).
|
|
25
|
+
5. Once root cause is identified, call `capture_thought` with `category: "gotcha"` so future debug sessions can find it via `memory_query`. Keep the content to 1–3 sentences — the symptom, the root cause, and the fix or guard.
|
|
24
26
|
|
|
25
27
|
{{skillActivation}}
|
|
@@ -162,6 +162,10 @@ Preserve the specification's exact terminology, emphasis, and specific framing.
|
|
|
162
162
|
6. For each architectural or pattern decision, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
|
|
163
163
|
7. {{commitInstruction}}
|
|
164
164
|
|
|
165
|
+
### Ready-phrase pre-condition (NON-BYPASSABLE)
|
|
166
|
+
|
|
167
|
+
Before emitting the ready phrase, verify in the CURRENT turn that you have written `.gsd/PROJECT.md`, `.gsd/REQUIREMENTS.md`, `{{contextPath}}`, and called `gsd_plan_milestone`. If any is missing, **STOP** — emit the missing tool calls in this same turn. The system rejects premature ready signals and retries are capped.
|
|
168
|
+
|
|
165
169
|
After writing the files, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
|
|
166
170
|
|
|
167
171
|
### Multi-Milestone
|
|
@@ -234,6 +238,10 @@ For single-milestone projects, do NOT write this file.
|
|
|
234
238
|
|
|
235
239
|
7. {{multiMilestoneCommitInstruction}}
|
|
236
240
|
|
|
241
|
+
### Ready-phrase pre-condition (NON-BYPASSABLE)
|
|
242
|
+
|
|
243
|
+
Before emitting the ready phrase, verify in the CURRENT turn that you have written `.gsd/PROJECT.md`, `.gsd/REQUIREMENTS.md`, the primary `CONTEXT.md`, called `gsd_plan_milestone` for the primary milestone, and written `.gsd/DISCUSSION-MANIFEST.json` with `gates_completed === total`. If any is missing, **STOP** — emit the missing tool calls in this same turn. The system rejects premature ready signals and retries are capped.
|
|
244
|
+
|
|
237
245
|
After writing the files, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
|
|
238
246
|
|
|
239
247
|
## Critical Rules
|
|
@@ -339,7 +339,20 @@ These sections are in addition to whatever other context the discussion surfaced
|
|
|
339
339
|
6. For each architectural or pattern decision made during discussion, call `gsd_decision_save` — the tool auto-assigns IDs and regenerates `.gsd/DECISIONS.md` automatically.
|
|
340
340
|
7. {{commitInstruction}}
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
### Ready-phrase pre-condition (NON-BYPASSABLE)
|
|
343
|
+
|
|
344
|
+
Before emitting the ready phrase, verify in the CURRENT turn that you have:
|
|
345
|
+
|
|
346
|
+
- [ ] Written `.gsd/PROJECT.md` (step 2)
|
|
347
|
+
- [ ] Written `.gsd/REQUIREMENTS.md` (step 3)
|
|
348
|
+
- [ ] Written `{{contextPath}}` (step 4)
|
|
349
|
+
- [ ] Called `gsd_plan_milestone` (step 5)
|
|
350
|
+
|
|
351
|
+
If ANY box is unchecked, **STOP**. Do NOT emit the ready phrase. Emit the missing tool calls in this same turn. The system detects missing artifacts and will reject premature ready signals — you will be asked again and retries are capped.
|
|
352
|
+
|
|
353
|
+
Do not announce the ready phrase as something you are "about to" do. Do not narrate "now writing the files" as a substitute for actually writing them. The ready phrase is a post-write signal, not an intent signal.
|
|
354
|
+
|
|
355
|
+
After completing steps 1–7 above, say exactly: "Milestone {{milestoneId}} ready." — nothing else. Auto-mode will start automatically.
|
|
343
356
|
|
|
344
357
|
### Multi-Milestone
|
|
345
358
|
|
|
@@ -418,6 +431,20 @@ For single-milestone projects, do NOT write this file — it is only for multi-m
|
|
|
418
431
|
|
|
419
432
|
7. {{multiMilestoneCommitInstruction}}
|
|
420
433
|
|
|
421
|
-
|
|
434
|
+
### Ready-phrase pre-condition (NON-BYPASSABLE)
|
|
435
|
+
|
|
436
|
+
Before emitting the ready phrase, verify in the CURRENT turn that you have:
|
|
437
|
+
|
|
438
|
+
- [ ] Written `.gsd/PROJECT.md` (Phase 1)
|
|
439
|
+
- [ ] Written `.gsd/REQUIREMENTS.md` (Phase 1)
|
|
440
|
+
- [ ] Written primary-milestone `CONTEXT.md` (Phase 2)
|
|
441
|
+
- [ ] Called `gsd_plan_milestone` for the primary milestone (Phase 2)
|
|
442
|
+
- [ ] Written `.gsd/DISCUSSION-MANIFEST.json` with `gates_completed === total` (Phase 3)
|
|
443
|
+
|
|
444
|
+
If ANY box is unchecked, **STOP**. Do NOT emit the ready phrase. Emit the missing tool calls in this same turn. The system detects missing artifacts and will reject premature ready signals — you will be asked again and retries are capped.
|
|
445
|
+
|
|
446
|
+
Do not announce the ready phrase as something you are "about to" do. Do not narrate "now writing the files" as a substitute for actually writing them. The ready phrase is a post-write signal, not an intent signal.
|
|
447
|
+
|
|
448
|
+
After completing all phases above, say exactly: "Milestone M001 ready." — nothing else. Auto-mode will start automatically.
|
|
422
449
|
|
|
423
450
|
{{inlinedTemplates}}
|
|
@@ -32,6 +32,7 @@ A researcher explored the codebase and a planner decomposed the work — you are
|
|
|
32
32
|
|
|
33
33
|
Then:
|
|
34
34
|
0. Narrate step transitions, key implementation decisions, and verification outcomes as you work. Keep it terse — one line between tool-call clusters, not between every call — but write complete sentences in user-facing prose, not shorthand notes or scratchpad fragments.
|
|
35
|
+
0a. Call `memory_query` with 2-4 keywords drawn from the task title and the files it touches. Surface any prior gotchas, conventions, or architectural decisions before you start changing code. Skip only if the task is trivially mechanical.
|
|
35
36
|
1. {{skillActivation}} Follow any activated skills before writing code. If no skills match this task, skip this step.
|
|
36
37
|
2. Execute the steps in the inlined task plan, adapting minor local mismatches when the surrounding code differs from the planner's snapshot
|
|
37
38
|
3. Before any `Write` that creates an artifact or output file, check whether that path already exists. If it does, read it first and decide whether the work is already done, should be extended, or truly needs replacement. "Create" in the plan does **not** mean the file is missing — a prior session may already have started it.
|
|
@@ -81,8 +82,8 @@ Then:
|
|
|
81
82
|
**Scope:** Escalation is instrumented only in `execute-task`. Refine-slice escalation is deferred. Reactive-execute batches run to completion before escalations are surfaced — the dispatch pause happens on the next loop iteration, not mid-batch.
|
|
82
83
|
|
|
83
84
|
The `escalation` payload is ignored unless `phases.mid_execution_escalation` is enabled; populate it anyway for audit logs.
|
|
84
|
-
17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about,
|
|
85
|
-
18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution,
|
|
85
|
+
17. If you made an architectural, pattern, library, or observability decision during this task that downstream work should know about, call `capture_thought` with `category: "architecture"` (or `"pattern"`). For decisions, populate `structuredFields` with `{ scope, decision, choice, rationale, made_by: "agent", revisable }` so future projection back to a human-visible decisions register stays lossless. Not every task produces decisions — only capture when a meaningful choice was made.
|
|
86
|
+
18. If you discover a non-obvious rule, recurring gotcha, or useful pattern during execution, call `capture_thought` with `category: "gotcha"`, `"convention"`, `"pattern"`, or `"environment"` as appropriate. Only capture entries that would save future agents from repeating your investigation — don't capture obvious things. The memory store is the single source of truth for cross-session knowledge (ADR-013); do not append to `.gsd/DECISIONS.md` or `.gsd/KNOWLEDGE.md` directly.
|
|
86
87
|
19. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
|
|
87
88
|
20. Use that template to prepare the completion content you will pass to `gsd_complete_task` using the camelCase fields `milestoneId`, `sliceId`, `taskId`, `oneLiner`, `narrative`, `verification`, and `verificationEvidence`. Do **not** manually write `{{taskSummaryPath}}` — the DB-backed tool is the canonical write path and renders the summary file for you.
|
|
88
89
|
21. Call `gsd_complete_task` with milestoneId, sliceId, taskId, and the completion fields derived from the template. This is your final required step — do NOT manually edit PLAN.md checkboxes. The tool marks the task complete, updates the DB, renders `{{taskSummaryPath}}`, and updates PLAN.md automatically.
|
|
@@ -15,8 +15,11 @@ Dispatch ALL slices simultaneously using the `subagent` tool in **parallel mode*
|
|
|
15
15
|
1. Call `subagent` with `tasks: [...]` containing one entry per slice below
|
|
16
16
|
2. Wait for ALL subagents to complete
|
|
17
17
|
3. Verify each slice's RESEARCH file was written (check the `.gsd/{{mid}}/` directory)
|
|
18
|
-
4. If
|
|
19
|
-
5.
|
|
18
|
+
4. If a subagent failed to write its RESEARCH file, retry it **once** individually
|
|
19
|
+
5. If it fails a second time, write a partial RESEARCH file for that slice with a `## BLOCKER` section explaining the failure — do NOT retry again
|
|
20
|
+
6. Report which slices completed research and which (if any) needed a blocker note
|
|
21
|
+
|
|
22
|
+
**Important**: Each failed slice gets exactly one retry. After that, write the blocker and move on. Never retry the same slice more than once.
|
|
20
23
|
|
|
21
24
|
## Subagent Prompts
|
|
22
25
|
|
|
@@ -44,6 +44,7 @@ Narrate your decomposition reasoning — why you're grouping work this way, what
|
|
|
44
44
|
|
|
45
45
|
Then:
|
|
46
46
|
0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements the roadmap says this slice owns or supports. These are the requirements this plan must deliver — every owned requirement needs at least one task that directly advances it, and verification must prove the requirement is met.
|
|
47
|
+
0a. Call `memory_query` with keywords from the slice title and the source files listed below. Prior architectural decisions, conventions, and gotchas in this area should inform task decomposition — not be re-derived during execution.
|
|
47
48
|
1. Read the templates:
|
|
48
49
|
- `~/.gsd/agent/extensions/gsd/templates/plan.md`
|
|
49
50
|
- `~/.gsd/agent/extensions/gsd/templates/task-plan.md`
|
|
@@ -42,6 +42,7 @@ An honest "this is straightforward, here's the pattern to follow" is more valuab
|
|
|
42
42
|
|
|
43
43
|
Research what this slice needs. Narrate key findings and surprises as you go — what exists, what's missing, what constrains the approach.
|
|
44
44
|
0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements this slice owns or supports. Research should target these requirements — surfacing risks, unknowns, and implementation constraints that could affect whether the slice actually delivers them.
|
|
45
|
+
0a. Call `memory_query` with keywords from the slice title and scope. Prior slices may have captured architecture notes, conventions, or gotchas in subsystems you're about to explore — pulling them now prevents re-discovering known constraints.
|
|
45
46
|
1. {{skillActivation}} Reference specific rules from loaded skills in your findings where they inform the implementation approach.
|
|
46
47
|
2. **Skill Discovery ({{skillDiscoveryMode}}):**{{skillDiscoveryInstructions}}
|
|
47
48
|
3. Explore relevant code for this slice's scope. For targeted exploration, use `rg`, `find`, and reads. For broad or unfamiliar subsystems, use `scout` to map the relevant area first.
|
|
@@ -3,10 +3,26 @@
|
|
|
3
3
|
* Tracks every bash command, file write, and file edit during a unit execution.
|
|
4
4
|
* Evidence is compared against LLM completion claims in evidence-cross-ref.ts.
|
|
5
5
|
*
|
|
6
|
+
* Evidence is persisted to .gsd/safety/evidence-<mid>-<sid>-<tid>.json so it
|
|
7
|
+
* survives session restarts (pause/resume, crash recovery). On unit start,
|
|
8
|
+
* call resetEvidence() then loadEvidenceFromDisk(). On every new tool call,
|
|
9
|
+
* saveEvidenceToDisk() is called automatically by recordToolCall/recordToolResult.
|
|
10
|
+
*
|
|
6
11
|
* Follows the same module-level Map pattern as auto-tool-tracking.ts.
|
|
7
12
|
* Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
|
8
13
|
*/
|
|
9
14
|
|
|
15
|
+
import {
|
|
16
|
+
existsSync,
|
|
17
|
+
mkdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
writeFileSync,
|
|
20
|
+
renameSync,
|
|
21
|
+
unlinkSync,
|
|
22
|
+
} from "node:fs";
|
|
23
|
+
import { join, dirname } from "node:path";
|
|
24
|
+
import { randomBytes } from "node:crypto";
|
|
25
|
+
|
|
10
26
|
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
11
27
|
|
|
12
28
|
export interface BashEvidence {
|
|
@@ -62,6 +78,109 @@ export function getFilePaths(): string[] {
|
|
|
62
78
|
.map(e => e.path);
|
|
63
79
|
}
|
|
64
80
|
|
|
81
|
+
// ─── Persistence (Bug #4385 — evidence must survive session restarts) ────────
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Build the path for the evidence JSON file for a given unit.
|
|
85
|
+
* Lives under .gsd/safety/ which is gitignored and session-scoped.
|
|
86
|
+
*/
|
|
87
|
+
function evidencePath(basePath: string, milestoneId: string, sliceId: string, taskId: string): string {
|
|
88
|
+
return join(basePath, ".gsd", "safety", `evidence-${milestoneId}-${sliceId}-${taskId}.json`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Validate that a parsed value is an array of EvidenceEntry objects.
|
|
93
|
+
* Rejects corrupt / schema-mismatch data rather than letting it poison state.
|
|
94
|
+
*/
|
|
95
|
+
function isEvidenceArray(data: unknown): data is EvidenceEntry[] {
|
|
96
|
+
if (!Array.isArray(data)) return false;
|
|
97
|
+
return data.every((e) => {
|
|
98
|
+
if (e === null || typeof e !== "object") return false;
|
|
99
|
+
const rec = e as Record<string, unknown>;
|
|
100
|
+
if (typeof rec.toolCallId !== "string") return false;
|
|
101
|
+
if (typeof rec.timestamp !== "number") return false;
|
|
102
|
+
if (rec.kind === "bash") {
|
|
103
|
+
return (
|
|
104
|
+
typeof rec.command === "string" &&
|
|
105
|
+
typeof rec.exitCode === "number" &&
|
|
106
|
+
typeof rec.outputSnippet === "string"
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
if (rec.kind === "write" || rec.kind === "edit") {
|
|
110
|
+
return typeof rec.path === "string";
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Persist the current in-memory evidence to disk so it survives a session
|
|
118
|
+
* restart. Called from saveEvidenceToDisk after recordToolCall/recordToolResult.
|
|
119
|
+
* Non-fatal — persistence failures must never break unit execution.
|
|
120
|
+
*/
|
|
121
|
+
export function saveEvidenceToDisk(
|
|
122
|
+
basePath: string,
|
|
123
|
+
milestoneId: string,
|
|
124
|
+
sliceId: string,
|
|
125
|
+
taskId: string,
|
|
126
|
+
): void {
|
|
127
|
+
try {
|
|
128
|
+
const path = evidencePath(basePath, milestoneId, sliceId, taskId);
|
|
129
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
130
|
+
const tmp = `${path}.tmp.${randomBytes(4).toString("hex")}`;
|
|
131
|
+
writeFileSync(tmp, JSON.stringify(unitEvidence, null, 2) + "\n", "utf-8");
|
|
132
|
+
renameSync(tmp, path);
|
|
133
|
+
} catch {
|
|
134
|
+
// Non-fatal — don't let persistence failures break unit execution
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Load persisted evidence from disk into the in-memory array.
|
|
140
|
+
* Call after resetEvidence() on session resume to restore context for a
|
|
141
|
+
* partially-executed unit. If the file does not exist (fresh unit), this
|
|
142
|
+
* is a no-op — getEvidence() will return [] which is correct.
|
|
143
|
+
*/
|
|
144
|
+
export function loadEvidenceFromDisk(
|
|
145
|
+
basePath: string,
|
|
146
|
+
milestoneId: string,
|
|
147
|
+
sliceId: string,
|
|
148
|
+
taskId: string,
|
|
149
|
+
): void {
|
|
150
|
+
try {
|
|
151
|
+
const path = evidencePath(basePath, milestoneId, sliceId, taskId);
|
|
152
|
+
if (!existsSync(path)) return;
|
|
153
|
+
const raw = readFileSync(path, "utf-8");
|
|
154
|
+
const parsed = JSON.parse(raw);
|
|
155
|
+
if (isEvidenceArray(parsed)) {
|
|
156
|
+
unitEvidence = parsed;
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
// Non-fatal — corrupt / missing file is treated as empty evidence
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Delete the persisted evidence file for a unit after it has been fully
|
|
165
|
+
* processed. Prevents stale evidence from affecting future retries of
|
|
166
|
+
* the same unit ID.
|
|
167
|
+
*/
|
|
168
|
+
export function clearEvidenceFromDisk(
|
|
169
|
+
basePath: string,
|
|
170
|
+
milestoneId: string,
|
|
171
|
+
sliceId: string,
|
|
172
|
+
taskId: string,
|
|
173
|
+
): void {
|
|
174
|
+
try {
|
|
175
|
+
const path = evidencePath(basePath, milestoneId, sliceId, taskId);
|
|
176
|
+
if (existsSync(path)) {
|
|
177
|
+
unlinkSync(path);
|
|
178
|
+
}
|
|
179
|
+
} catch {
|
|
180
|
+
// Non-fatal
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
65
184
|
// ─── Recording (called from register-hooks.ts) ─────────────────────────────
|
|
66
185
|
|
|
67
186
|
/**
|