@runchr/gstack-antigravity 0.1.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.
Potentially problematic release.
This version of @runchr/gstack-antigravity might be problematic. Click here for more details.
- package/.agents/rules/ETHOS.md +129 -0
- package/.agents/rules/global-gstack.md +117 -0
- package/.agents/rules/persona-gstack-autoplan.md +14 -0
- package/.agents/rules/persona-gstack-benchmark.md +14 -0
- package/.agents/rules/persona-gstack-browse.md +14 -0
- package/.agents/rules/persona-gstack-canary.md +14 -0
- package/.agents/rules/persona-gstack-careful.md +14 -0
- package/.agents/rules/persona-gstack-codex.md +14 -0
- package/.agents/rules/persona-gstack-cso.md +14 -0
- package/.agents/rules/persona-gstack-design-consultation.md +14 -0
- package/.agents/rules/persona-gstack-design-review.md +14 -0
- package/.agents/rules/persona-gstack-document-release.md +14 -0
- package/.agents/rules/persona-gstack-freeze.md +14 -0
- package/.agents/rules/persona-gstack-gstack-upgrade.md +14 -0
- package/.agents/rules/persona-gstack-guard.md +14 -0
- package/.agents/rules/persona-gstack-investigate.md +14 -0
- package/.agents/rules/persona-gstack-land-and-deploy.md +14 -0
- package/.agents/rules/persona-gstack-office-hours.md +14 -0
- package/.agents/rules/persona-gstack-plan-ceo-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-design-review.md +14 -0
- package/.agents/rules/persona-gstack-plan-eng-review.md +14 -0
- package/.agents/rules/persona-gstack-qa-only.md +14 -0
- package/.agents/rules/persona-gstack-qa.md +14 -0
- package/.agents/rules/persona-gstack-retro.md +14 -0
- package/.agents/rules/persona-gstack-review.md +14 -0
- package/.agents/rules/persona-gstack-setup-browser-cookies.md +14 -0
- package/.agents/rules/persona-gstack-setup-deploy.md +14 -0
- package/.agents/rules/persona-gstack-ship.md +14 -0
- package/.agents/rules/persona-gstack-unfreeze.md +14 -0
- package/.agents/rules/persona-gstack.md +40 -0
- package/.agents/rules/recursive-identities.md +22 -0
- package/.agents/workflows/autoplan.md +30 -0
- package/.agents/workflows/benchmark.md +31 -0
- package/.agents/workflows/browse.md +26 -0
- package/.agents/workflows/canary.md +33 -0
- package/.agents/workflows/careful.md +22 -0
- package/.agents/workflows/codex.md +36 -0
- package/.agents/workflows/cso.md +29 -0
- package/.agents/workflows/design-consultation.md +28 -0
- package/.agents/workflows/design-review.md +28 -0
- package/.agents/workflows/document-release.md +32 -0
- package/.agents/workflows/freeze.md +17 -0
- package/.agents/workflows/gstack-upgrade.md +54 -0
- package/.agents/workflows/gstack.md +56 -0
- package/.agents/workflows/guard.md +18 -0
- package/.agents/workflows/investigate.md +37 -0
- package/.agents/workflows/land-and-deploy.md +35 -0
- package/.agents/workflows/office-hours.md +27 -0
- package/.agents/workflows/plan-ceo-review.md +34 -0
- package/.agents/workflows/plan-design-review.md +31 -0
- package/.agents/workflows/plan-eng-review.md +28 -0
- package/.agents/workflows/qa-only.md +28 -0
- package/.agents/workflows/qa.md +73 -0
- package/.agents/workflows/retro.md +34 -0
- package/.agents/workflows/review.md +30 -0
- package/.agents/workflows/setup-browser-cookies.md +15 -0
- package/.agents/workflows/setup-cookies.md +8 -0
- package/.agents/workflows/setup-deploy.md +21 -0
- package/.agents/workflows/ship.md +93 -0
- package/.agents/workflows/unfreeze.md +12 -0
- package/LICENSE +22 -0
- package/README.md +189 -0
- package/README_KO.md +191 -0
- package/bin/install.js +105 -0
- package/gstack-origin/.agents/skills/gstack/SKILL.md +651 -0
- package/gstack-origin/.agents/skills/gstack-autoplan/SKILL.md +678 -0
- package/gstack-origin/.agents/skills/gstack-benchmark/SKILL.md +482 -0
- package/gstack-origin/.agents/skills/gstack-browse/SKILL.md +511 -0
- package/gstack-origin/.agents/skills/gstack-canary/SKILL.md +486 -0
- package/gstack-origin/.agents/skills/gstack-careful/SKILL.md +50 -0
- package/gstack-origin/.agents/skills/gstack-cso/SKILL.md +607 -0
- package/gstack-origin/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
- package/gstack-origin/.agents/skills/gstack-design-review/SKILL.md +988 -0
- package/gstack-origin/.agents/skills/gstack-document-release/SKILL.md +604 -0
- package/gstack-origin/.agents/skills/gstack-freeze/SKILL.md +67 -0
- package/gstack-origin/.agents/skills/gstack-guard/SKILL.md +62 -0
- package/gstack-origin/.agents/skills/gstack-investigate/SKILL.md +415 -0
- package/gstack-origin/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
- package/gstack-origin/.agents/skills/gstack-office-hours/SKILL.md +986 -0
- package/gstack-origin/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
- package/gstack-origin/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
- package/gstack-origin/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
- package/gstack-origin/.agents/skills/gstack-qa/SKILL.md +1006 -0
- package/gstack-origin/.agents/skills/gstack-qa-only/SKILL.md +626 -0
- package/gstack-origin/.agents/skills/gstack-retro/SKILL.md +1065 -0
- package/gstack-origin/.agents/skills/gstack-review/SKILL.md +704 -0
- package/gstack-origin/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
- package/gstack-origin/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
- package/gstack-origin/.agents/skills/gstack-ship/SKILL.md +1312 -0
- package/gstack-origin/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
- package/gstack-origin/.agents/skills/gstack-upgrade/SKILL.md +220 -0
- package/gstack-origin/.env.example +5 -0
- package/gstack-origin/.github/workflows/skill-docs.yml +17 -0
- package/gstack-origin/AGENTS.md +49 -0
- package/gstack-origin/ARCHITECTURE.md +359 -0
- package/gstack-origin/BROWSER.md +271 -0
- package/gstack-origin/CHANGELOG.md +800 -0
- package/gstack-origin/CLAUDE.md +284 -0
- package/gstack-origin/CONTRIBUTING.md +370 -0
- package/gstack-origin/ETHOS.md +129 -0
- package/gstack-origin/LICENSE +21 -0
- package/gstack-origin/README.md +228 -0
- package/gstack-origin/SKILL.md +657 -0
- package/gstack-origin/SKILL.md.tmpl +281 -0
- package/gstack-origin/TODOS.md +564 -0
- package/gstack-origin/VERSION +1 -0
- package/gstack-origin/autoplan/SKILL.md +689 -0
- package/gstack-origin/autoplan/SKILL.md.tmpl +416 -0
- package/gstack-origin/benchmark/SKILL.md +489 -0
- package/gstack-origin/benchmark/SKILL.md.tmpl +233 -0
- package/gstack-origin/bin/dev-setup +68 -0
- package/gstack-origin/bin/dev-teardown +56 -0
- package/gstack-origin/bin/gstack-analytics +191 -0
- package/gstack-origin/bin/gstack-community-dashboard +113 -0
- package/gstack-origin/bin/gstack-config +38 -0
- package/gstack-origin/bin/gstack-diff-scope +71 -0
- package/gstack-origin/bin/gstack-global-discover.ts +591 -0
- package/gstack-origin/bin/gstack-repo-mode +93 -0
- package/gstack-origin/bin/gstack-review-log +9 -0
- package/gstack-origin/bin/gstack-review-read +12 -0
- package/gstack-origin/bin/gstack-slug +15 -0
- package/gstack-origin/bin/gstack-telemetry-log +158 -0
- package/gstack-origin/bin/gstack-telemetry-sync +127 -0
- package/gstack-origin/bin/gstack-update-check +196 -0
- package/gstack-origin/browse/SKILL.md +517 -0
- package/gstack-origin/browse/SKILL.md.tmpl +141 -0
- package/gstack-origin/browse/bin/find-browse +21 -0
- package/gstack-origin/browse/bin/remote-slug +14 -0
- package/gstack-origin/browse/scripts/build-node-server.sh +48 -0
- package/gstack-origin/browse/src/browser-manager.ts +634 -0
- package/gstack-origin/browse/src/buffers.ts +137 -0
- package/gstack-origin/browse/src/bun-polyfill.cjs +109 -0
- package/gstack-origin/browse/src/cli.ts +420 -0
- package/gstack-origin/browse/src/commands.ts +111 -0
- package/gstack-origin/browse/src/config.ts +150 -0
- package/gstack-origin/browse/src/cookie-import-browser.ts +417 -0
- package/gstack-origin/browse/src/cookie-picker-routes.ts +207 -0
- package/gstack-origin/browse/src/cookie-picker-ui.ts +541 -0
- package/gstack-origin/browse/src/find-browse.ts +61 -0
- package/gstack-origin/browse/src/meta-commands.ts +269 -0
- package/gstack-origin/browse/src/platform.ts +17 -0
- package/gstack-origin/browse/src/read-commands.ts +335 -0
- package/gstack-origin/browse/src/server.ts +369 -0
- package/gstack-origin/browse/src/snapshot.ts +398 -0
- package/gstack-origin/browse/src/url-validation.ts +91 -0
- package/gstack-origin/browse/src/write-commands.ts +352 -0
- package/gstack-origin/browse/test/bun-polyfill.test.ts +72 -0
- package/gstack-origin/browse/test/commands.test.ts +1836 -0
- package/gstack-origin/browse/test/config.test.ts +250 -0
- package/gstack-origin/browse/test/cookie-import-browser.test.ts +397 -0
- package/gstack-origin/browse/test/cookie-picker-routes.test.ts +205 -0
- package/gstack-origin/browse/test/find-browse.test.ts +50 -0
- package/gstack-origin/browse/test/fixtures/basic.html +33 -0
- package/gstack-origin/browse/test/fixtures/cursor-interactive.html +22 -0
- package/gstack-origin/browse/test/fixtures/dialog.html +15 -0
- package/gstack-origin/browse/test/fixtures/empty.html +2 -0
- package/gstack-origin/browse/test/fixtures/forms.html +55 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-checkout.html +108 -0
- package/gstack-origin/browse/test/fixtures/qa-eval-spa.html +98 -0
- package/gstack-origin/browse/test/fixtures/qa-eval.html +51 -0
- package/gstack-origin/browse/test/fixtures/responsive.html +49 -0
- package/gstack-origin/browse/test/fixtures/snapshot.html +55 -0
- package/gstack-origin/browse/test/fixtures/spa.html +24 -0
- package/gstack-origin/browse/test/fixtures/states.html +17 -0
- package/gstack-origin/browse/test/fixtures/upload.html +25 -0
- package/gstack-origin/browse/test/gstack-config.test.ts +125 -0
- package/gstack-origin/browse/test/gstack-update-check.test.ts +467 -0
- package/gstack-origin/browse/test/handoff.test.ts +235 -0
- package/gstack-origin/browse/test/path-validation.test.ts +63 -0
- package/gstack-origin/browse/test/platform.test.ts +37 -0
- package/gstack-origin/browse/test/snapshot.test.ts +467 -0
- package/gstack-origin/browse/test/test-server.ts +57 -0
- package/gstack-origin/browse/test/url-validation.test.ts +72 -0
- package/gstack-origin/canary/SKILL.md +493 -0
- package/gstack-origin/canary/SKILL.md.tmpl +220 -0
- package/gstack-origin/careful/SKILL.md +59 -0
- package/gstack-origin/careful/SKILL.md.tmpl +57 -0
- package/gstack-origin/careful/bin/check-careful.sh +112 -0
- package/gstack-origin/codex/SKILL.md +677 -0
- package/gstack-origin/codex/SKILL.md.tmpl +356 -0
- package/gstack-origin/conductor.json +6 -0
- package/gstack-origin/cso/SKILL.md +615 -0
- package/gstack-origin/cso/SKILL.md.tmpl +376 -0
- package/gstack-origin/design-consultation/SKILL.md +625 -0
- package/gstack-origin/design-consultation/SKILL.md.tmpl +369 -0
- package/gstack-origin/design-review/SKILL.md +998 -0
- package/gstack-origin/design-review/SKILL.md.tmpl +262 -0
- package/gstack-origin/docs/images/github-2013.png +0 -0
- package/gstack-origin/docs/images/github-2026.png +0 -0
- package/gstack-origin/docs/skills.md +877 -0
- package/gstack-origin/document-release/SKILL.md +613 -0
- package/gstack-origin/document-release/SKILL.md.tmpl +357 -0
- package/gstack-origin/freeze/SKILL.md +82 -0
- package/gstack-origin/freeze/SKILL.md.tmpl +80 -0
- package/gstack-origin/freeze/bin/check-freeze.sh +68 -0
- package/gstack-origin/gstack-upgrade/SKILL.md +226 -0
- package/gstack-origin/gstack-upgrade/SKILL.md.tmpl +224 -0
- package/gstack-origin/guard/SKILL.md +82 -0
- package/gstack-origin/guard/SKILL.md.tmpl +80 -0
- package/gstack-origin/investigate/SKILL.md +435 -0
- package/gstack-origin/investigate/SKILL.md.tmpl +196 -0
- package/gstack-origin/land-and-deploy/SKILL.md +880 -0
- package/gstack-origin/land-and-deploy/SKILL.md.tmpl +575 -0
- package/gstack-origin/office-hours/SKILL.md +996 -0
- package/gstack-origin/office-hours/SKILL.md.tmpl +624 -0
- package/gstack-origin/package.json +55 -0
- package/gstack-origin/plan-ceo-review/SKILL.md +1277 -0
- package/gstack-origin/plan-ceo-review/SKILL.md.tmpl +838 -0
- package/gstack-origin/plan-design-review/SKILL.md +676 -0
- package/gstack-origin/plan-design-review/SKILL.md.tmpl +314 -0
- package/gstack-origin/plan-eng-review/SKILL.md +836 -0
- package/gstack-origin/plan-eng-review/SKILL.md.tmpl +279 -0
- package/gstack-origin/qa/SKILL.md +1016 -0
- package/gstack-origin/qa/SKILL.md.tmpl +316 -0
- package/gstack-origin/qa/references/issue-taxonomy.md +85 -0
- package/gstack-origin/qa/templates/qa-report-template.md +126 -0
- package/gstack-origin/qa-only/SKILL.md +633 -0
- package/gstack-origin/qa-only/SKILL.md.tmpl +101 -0
- package/gstack-origin/retro/SKILL.md +1072 -0
- package/gstack-origin/retro/SKILL.md.tmpl +833 -0
- package/gstack-origin/review/SKILL.md +849 -0
- package/gstack-origin/review/SKILL.md.tmpl +259 -0
- package/gstack-origin/review/TODOS-format.md +62 -0
- package/gstack-origin/review/checklist.md +190 -0
- package/gstack-origin/review/design-checklist.md +132 -0
- package/gstack-origin/review/greptile-triage.md +220 -0
- package/gstack-origin/scripts/analytics.ts +190 -0
- package/gstack-origin/scripts/dev-skill.ts +82 -0
- package/gstack-origin/scripts/eval-compare.ts +96 -0
- package/gstack-origin/scripts/eval-list.ts +116 -0
- package/gstack-origin/scripts/eval-select.ts +86 -0
- package/gstack-origin/scripts/eval-summary.ts +187 -0
- package/gstack-origin/scripts/eval-watch.ts +172 -0
- package/gstack-origin/scripts/gen-skill-docs.ts +2414 -0
- package/gstack-origin/scripts/skill-check.ts +167 -0
- package/gstack-origin/setup +269 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md +330 -0
- package/gstack-origin/setup-browser-cookies/SKILL.md.tmpl +74 -0
- package/gstack-origin/setup-deploy/SKILL.md +459 -0
- package/gstack-origin/setup-deploy/SKILL.md.tmpl +220 -0
- package/gstack-origin/ship/SKILL.md +1457 -0
- package/gstack-origin/ship/SKILL.md.tmpl +528 -0
- package/gstack-origin/supabase/config.sh +10 -0
- package/gstack-origin/supabase/functions/community-pulse/index.ts +59 -0
- package/gstack-origin/supabase/functions/telemetry-ingest/index.ts +135 -0
- package/gstack-origin/supabase/functions/update-check/index.ts +37 -0
- package/gstack-origin/supabase/migrations/001_telemetry.sql +89 -0
- package/gstack-origin/test/analytics.test.ts +277 -0
- package/gstack-origin/test/codex-e2e.test.ts +197 -0
- package/gstack-origin/test/fixtures/coverage-audit-fixture.ts +76 -0
- package/gstack-origin/test/fixtures/eval-baselines.json +7 -0
- package/gstack-origin/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.css +86 -0
- package/gstack-origin/test/fixtures/review-eval-design-slop.html +41 -0
- package/gstack-origin/test/fixtures/review-eval-enum-diff.rb +30 -0
- package/gstack-origin/test/fixtures/review-eval-enum.rb +27 -0
- package/gstack-origin/test/fixtures/review-eval-vuln.rb +14 -0
- package/gstack-origin/test/gemini-e2e.test.ts +173 -0
- package/gstack-origin/test/gen-skill-docs.test.ts +1049 -0
- package/gstack-origin/test/global-discover.test.ts +187 -0
- package/gstack-origin/test/helpers/codex-session-runner.ts +282 -0
- package/gstack-origin/test/helpers/e2e-helpers.ts +239 -0
- package/gstack-origin/test/helpers/eval-store.test.ts +548 -0
- package/gstack-origin/test/helpers/eval-store.ts +689 -0
- package/gstack-origin/test/helpers/gemini-session-runner.test.ts +104 -0
- package/gstack-origin/test/helpers/gemini-session-runner.ts +201 -0
- package/gstack-origin/test/helpers/llm-judge.ts +130 -0
- package/gstack-origin/test/helpers/observability.test.ts +283 -0
- package/gstack-origin/test/helpers/session-runner.test.ts +96 -0
- package/gstack-origin/test/helpers/session-runner.ts +357 -0
- package/gstack-origin/test/helpers/skill-parser.ts +206 -0
- package/gstack-origin/test/helpers/touchfiles.ts +260 -0
- package/gstack-origin/test/hook-scripts.test.ts +373 -0
- package/gstack-origin/test/skill-e2e-browse.test.ts +293 -0
- package/gstack-origin/test/skill-e2e-deploy.test.ts +279 -0
- package/gstack-origin/test/skill-e2e-design.test.ts +614 -0
- package/gstack-origin/test/skill-e2e-plan.test.ts +538 -0
- package/gstack-origin/test/skill-e2e-qa-bugs.test.ts +194 -0
- package/gstack-origin/test/skill-e2e-qa-workflow.test.ts +412 -0
- package/gstack-origin/test/skill-e2e-review.test.ts +535 -0
- package/gstack-origin/test/skill-e2e-workflow.test.ts +586 -0
- package/gstack-origin/test/skill-e2e.test.ts +3325 -0
- package/gstack-origin/test/skill-llm-eval.test.ts +787 -0
- package/gstack-origin/test/skill-parser.test.ts +179 -0
- package/gstack-origin/test/skill-routing-e2e.test.ts +605 -0
- package/gstack-origin/test/skill-validation.test.ts +1520 -0
- package/gstack-origin/test/telemetry.test.ts +278 -0
- package/gstack-origin/test/touchfiles.test.ts +262 -0
- package/gstack-origin/unfreeze/SKILL.md +40 -0
- package/gstack-origin/unfreeze/SKILL.md.tmpl +38 -0
- package/package.json +38 -0
- package/scripts/install-antigravity-skill.ps1 +33 -0
- package/scripts/install-antigravity-skill.sh +41 -0
- package/scripts/sync-gstack-origin.ps1 +37 -0
- package/scripts/sync-gstack-origin.sh +35 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: guard
|
|
3
|
+
description: |
|
|
4
|
+
Full safety mode: destructive command warnings + directory-scoped edits.
|
|
5
|
+
Combines /careful (warns before rm -rf, DROP TABLE, force-push, etc.) with
|
|
6
|
+
/freeze (blocks edits outside a specified directory). Use for maximum safety
|
|
7
|
+
when touching prod or debugging live systems. Use when asked to "guard mode",
|
|
8
|
+
"full safety", "lock it down", or "maximum safety".
|
|
9
|
+
---
|
|
10
|
+
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
|
|
11
|
+
<!-- Regenerate: bun run gen:skill-docs -->
|
|
12
|
+
> **Safety Advisory:** This skill includes safety checks that check bash commands for destructive operations (rm -rf, DROP TABLE, force-push, git reset --hard, etc.) before execution, and verify file edits are within the allowed scope boundary before applying, and verify file writes are within the allowed scope boundary before applying. When using this skill, always pause and verify before executing potentially destructive operations. If uncertain about a command's safety, ask the user for confirmation before proceeding.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# /guard — Full Safety Mode
|
|
16
|
+
|
|
17
|
+
Activates both destructive command warnings and directory-scoped edit restrictions.
|
|
18
|
+
This is the combination of `/careful` + `/freeze` in a single command.
|
|
19
|
+
|
|
20
|
+
**Dependency note:** This skill references hook scripts from the sibling `/careful`
|
|
21
|
+
and `/freeze` skill directories. Both must be installed (they are installed together
|
|
22
|
+
by the gstack setup script).
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mkdir -p ~/.gstack/analytics
|
|
26
|
+
echo '{"skill":"guard","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Setup
|
|
30
|
+
|
|
31
|
+
Ask the user which directory to restrict edits to. Use AskUserQuestion:
|
|
32
|
+
|
|
33
|
+
- Question: "Guard mode: which directory should edits be restricted to? Destructive command warnings are always on. Files outside the chosen path will be blocked from editing."
|
|
34
|
+
- Text input (not multiple choice) — the user types a path.
|
|
35
|
+
|
|
36
|
+
Once the user provides a directory path:
|
|
37
|
+
|
|
38
|
+
1. Resolve it to an absolute path:
|
|
39
|
+
```bash
|
|
40
|
+
FREEZE_DIR=$(cd "<user-provided-path>" 2>/dev/null && pwd)
|
|
41
|
+
echo "$FREEZE_DIR"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. Ensure trailing slash and save to the freeze state file:
|
|
45
|
+
```bash
|
|
46
|
+
FREEZE_DIR="${FREEZE_DIR%/}/"
|
|
47
|
+
STATE_DIR="${CLAUDE_PLUGIN_DATA:-$HOME/.gstack}"
|
|
48
|
+
mkdir -p "$STATE_DIR"
|
|
49
|
+
echo "$FREEZE_DIR" > "$STATE_DIR/freeze-dir.txt"
|
|
50
|
+
echo "Freeze boundary set: $FREEZE_DIR"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Tell the user:
|
|
54
|
+
- "**Guard mode active.** Two protections are now running:"
|
|
55
|
+
- "1. **Destructive command warnings** — rm -rf, DROP TABLE, force-push, etc. will warn before executing (you can override)"
|
|
56
|
+
- "2. **Edit boundary** — file edits restricted to `<path>/`. Edits outside this directory are blocked."
|
|
57
|
+
- "To remove the edit boundary, run `/unfreeze`. To deactivate everything, end the session."
|
|
58
|
+
|
|
59
|
+
## What's protected
|
|
60
|
+
|
|
61
|
+
See `/careful` for the full list of destructive command patterns and safe exceptions.
|
|
62
|
+
See `/freeze` for how edit boundary enforcement works.
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: investigate
|
|
3
|
+
description: |
|
|
4
|
+
Systematic debugging with root cause investigation. Four phases: investigate,
|
|
5
|
+
analyze, hypothesize, implement. Iron Law: no fixes without root cause.
|
|
6
|
+
Use when asked to "debug this", "fix this bug", "why is this broken",
|
|
7
|
+
"investigate this error", or "root cause analysis".
|
|
8
|
+
Proactively suggest when the user reports errors, unexpected behavior, or
|
|
9
|
+
is troubleshooting why something stopped working.
|
|
10
|
+
---
|
|
11
|
+
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
|
|
12
|
+
<!-- Regenerate: bun run gen:skill-docs -->
|
|
13
|
+
> **Safety Advisory:** This skill includes safety checks that verify file edits are within the allowed scope boundary before applying, and verify file writes are within the allowed scope boundary before applying. When using this skill, always pause and verify before executing potentially destructive operations. If uncertain about a command's safety, ask the user for confirmation before proceeding.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Preamble (run first)
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
_UPD=$(~/.codex/skills/gstack/bin/gstack-update-check 2>/dev/null || .agents/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
|
20
|
+
[ -n "$_UPD" ] && echo "$_UPD" || true
|
|
21
|
+
mkdir -p ~/.gstack/sessions
|
|
22
|
+
touch ~/.gstack/sessions/"$PPID"
|
|
23
|
+
_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
|
|
24
|
+
find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
|
|
25
|
+
_CONTRIB=$(~/.codex/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
|
|
26
|
+
_PROACTIVE=$(~/.codex/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
|
|
27
|
+
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
28
|
+
echo "BRANCH: $_BRANCH"
|
|
29
|
+
echo "PROACTIVE: $_PROACTIVE"
|
|
30
|
+
source <(~/.codex/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
|
|
31
|
+
REPO_MODE=${REPO_MODE:-unknown}
|
|
32
|
+
echo "REPO_MODE: $REPO_MODE"
|
|
33
|
+
_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
|
|
34
|
+
echo "LAKE_INTRO: $_LAKE_SEEN"
|
|
35
|
+
_TEL=$(~/.codex/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)
|
|
36
|
+
_TEL_PROMPTED=$([ -f ~/.gstack/.telemetry-prompted ] && echo "yes" || echo "no")
|
|
37
|
+
_TEL_START=$(date +%s)
|
|
38
|
+
_SESSION_ID="$$-$(date +%s)"
|
|
39
|
+
echo "TELEMETRY: ${_TEL:-off}"
|
|
40
|
+
echo "TEL_PROMPTED: $_TEL_PROMPTED"
|
|
41
|
+
mkdir -p ~/.gstack/analytics
|
|
42
|
+
echo '{"skill":"investigate","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
|
|
43
|
+
for _PF in ~/.gstack/analytics/.pending-*; do [ -f "$_PF" ] && ~/.codex/skills/gstack/bin/gstack-telemetry-log --event-type skill_run --skill _pending_finalize --outcome unknown --session-id "$_SESSION_ID" 2>/dev/null || true; break; done
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If `PROACTIVE` is `"false"`, do not proactively suggest gstack skills — only invoke
|
|
47
|
+
them when the user explicitly asks. The user opted out of proactive suggestions.
|
|
48
|
+
|
|
49
|
+
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.codex/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
|
50
|
+
|
|
51
|
+
If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
|
|
52
|
+
Tell the user: "gstack follows the **Boil the Lake** principle — always do the complete
|
|
53
|
+
thing when AI makes the marginal cost near-zero. Read more: https://garryslist.org/posts/boil-the-ocean"
|
|
54
|
+
Then offer to open the essay in their default browser:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
open https://garryslist.org/posts/boil-the-ocean
|
|
58
|
+
touch ~/.gstack/.completeness-intro-seen
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Only run `open` if the user says yes. Always run `touch` to mark as seen. This only happens once.
|
|
62
|
+
|
|
63
|
+
If `TEL_PROMPTED` is `no` AND `LAKE_INTRO` is `yes`: After the lake intro is handled,
|
|
64
|
+
ask the user about telemetry. Use AskUserQuestion:
|
|
65
|
+
|
|
66
|
+
> Help gstack get better! Community mode shares usage data (which skills you use, how long
|
|
67
|
+
> they take, crash info) with a stable device ID so we can track trends and fix bugs faster.
|
|
68
|
+
> No code, file paths, or repo names are ever sent.
|
|
69
|
+
> Change anytime with `gstack-config set telemetry off`.
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
- A) Help gstack get better! (recommended)
|
|
73
|
+
- B) No thanks
|
|
74
|
+
|
|
75
|
+
If A: run `~/.codex/skills/gstack/bin/gstack-config set telemetry community`
|
|
76
|
+
|
|
77
|
+
If B: ask a follow-up AskUserQuestion:
|
|
78
|
+
|
|
79
|
+
> How about anonymous mode? We just learn that *someone* used gstack — no unique ID,
|
|
80
|
+
> no way to connect sessions. Just a counter that helps us know if anyone's out there.
|
|
81
|
+
|
|
82
|
+
Options:
|
|
83
|
+
- A) Sure, anonymous is fine
|
|
84
|
+
- B) No thanks, fully off
|
|
85
|
+
|
|
86
|
+
If B→A: run `~/.codex/skills/gstack/bin/gstack-config set telemetry anonymous`
|
|
87
|
+
If B→B: run `~/.codex/skills/gstack/bin/gstack-config set telemetry off`
|
|
88
|
+
|
|
89
|
+
Always run:
|
|
90
|
+
```bash
|
|
91
|
+
touch ~/.gstack/.telemetry-prompted
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This only happens once. If `TEL_PROMPTED` is `yes`, skip this entirely.
|
|
95
|
+
|
|
96
|
+
## AskUserQuestion Format
|
|
97
|
+
|
|
98
|
+
**ALWAYS follow this structure for every AskUserQuestion call:**
|
|
99
|
+
1. **Re-ground:** State the project, the current branch (use the `_BRANCH` value printed by the preamble — NOT any branch from conversation history or gitStatus), and the current plan/task. (1-2 sentences)
|
|
100
|
+
2. **Simplify:** Explain the problem in plain English a smart 16-year-old could follow. No raw function names, no internal jargon, no implementation details. Use concrete examples and analogies. Say what it DOES, not what it's called.
|
|
101
|
+
3. **Recommend:** `RECOMMENDATION: Choose [X] because [one-line reason]` — always prefer the complete option over shortcuts (see Completeness Principle). Include `Completeness: X/10` for each option. Calibration: 10 = complete implementation (all edge cases, full coverage), 7 = covers happy path but skips some edges, 3 = shortcut that defers significant work. If both options are 8+, pick the higher; if one is ≤5, flag it.
|
|
102
|
+
4. **Options:** Lettered options: `A) ... B) ... C) ...` — when an option involves effort, show both scales: `(human: ~X / CC: ~Y)`
|
|
103
|
+
|
|
104
|
+
Assume the user hasn't looked at this window in 20 minutes and doesn't have the code open. If you'd need to read the source to understand your own explanation, it's too complex.
|
|
105
|
+
|
|
106
|
+
Per-skill instructions may add additional formatting rules on top of this baseline.
|
|
107
|
+
|
|
108
|
+
## Completeness Principle — Boil the Lake
|
|
109
|
+
|
|
110
|
+
AI-assisted coding makes the marginal cost of completeness near-zero. When you present options:
|
|
111
|
+
|
|
112
|
+
- If Option A is the complete implementation (full parity, all edge cases, 100% coverage) and Option B is a shortcut that saves modest effort — **always recommend A**. The delta between 80 lines and 150 lines is meaningless with CC+gstack. "Good enough" is the wrong instinct when "complete" costs minutes more.
|
|
113
|
+
- **Lake vs. ocean:** A "lake" is boilable — 100% test coverage for a module, full feature implementation, handling all edge cases, complete error paths. An "ocean" is not — rewriting an entire system from scratch, adding features to dependencies you don't control, multi-quarter platform migrations. Recommend boiling lakes. Flag oceans as out of scope.
|
|
114
|
+
- **When estimating effort**, always show both scales: human team time and CC+gstack time. The compression ratio varies by task type — use this reference:
|
|
115
|
+
|
|
116
|
+
| Task type | Human team | CC+gstack | Compression |
|
|
117
|
+
|-----------|-----------|-----------|-------------|
|
|
118
|
+
| Boilerplate / scaffolding | 2 days | 15 min | ~100x |
|
|
119
|
+
| Test writing | 1 day | 15 min | ~50x |
|
|
120
|
+
| Feature implementation | 1 week | 30 min | ~30x |
|
|
121
|
+
| Bug fix + regression test | 4 hours | 15 min | ~20x |
|
|
122
|
+
| Architecture / design | 2 days | 4 hours | ~5x |
|
|
123
|
+
| Research / exploration | 1 day | 3 hours | ~3x |
|
|
124
|
+
|
|
125
|
+
- This principle applies to test coverage, error handling, documentation, edge cases, and feature completeness. Don't skip the last 10% to "save time" — with AI, that 10% costs seconds.
|
|
126
|
+
|
|
127
|
+
**Anti-patterns — DON'T do this:**
|
|
128
|
+
- BAD: "Choose B — it covers 90% of the value with less code." (If A is only 70 lines more, choose A.)
|
|
129
|
+
- BAD: "We can skip edge case handling to save time." (Edge case handling costs minutes with CC.)
|
|
130
|
+
- BAD: "Let's defer test coverage to a follow-up PR." (Tests are the cheapest lake to boil.)
|
|
131
|
+
- BAD: Quoting only human-team effort: "This would take 2 weeks." (Say: "2 weeks human / ~1 hour CC.")
|
|
132
|
+
|
|
133
|
+
## Repo Ownership Mode — See Something, Say Something
|
|
134
|
+
|
|
135
|
+
`REPO_MODE` from the preamble tells you who owns issues in this repo:
|
|
136
|
+
|
|
137
|
+
- **`solo`** — One person does 80%+ of the work. They own everything. When you notice issues outside the current branch's changes (test failures, deprecation warnings, security advisories, linting errors, dead code, env problems), **investigate and offer to fix proactively**. The solo dev is the only person who will fix it. Default to action.
|
|
138
|
+
- **`collaborative`** — Multiple active contributors. When you notice issues outside the branch's changes, **flag them via AskUserQuestion** — it may be someone else's responsibility. Default to asking, not fixing.
|
|
139
|
+
- **`unknown`** — Treat as collaborative (safer default — ask before fixing).
|
|
140
|
+
|
|
141
|
+
**See Something, Say Something:** Whenever you notice something that looks wrong during ANY workflow step — not just test failures — flag it briefly. One sentence: what you noticed and its impact. In solo mode, follow up with "Want me to fix it?" In collaborative mode, just flag it and move on.
|
|
142
|
+
|
|
143
|
+
Never let a noticed issue silently pass. The whole point is proactive communication.
|
|
144
|
+
|
|
145
|
+
## Search Before Building
|
|
146
|
+
|
|
147
|
+
Before building infrastructure, unfamiliar patterns, or anything the runtime might have a built-in — **search first.** Read `~/.codex/skills/gstack/ETHOS.md` for the full philosophy.
|
|
148
|
+
|
|
149
|
+
**Three layers of knowledge:**
|
|
150
|
+
- **Layer 1** (tried and true — in distribution). Don't reinvent the wheel. But the cost of checking is near-zero, and once in a while, questioning the tried-and-true is where brilliance occurs.
|
|
151
|
+
- **Layer 2** (new and popular — search for these). But scrutinize: humans are subject to mania. Search results are inputs to your thinking, not answers.
|
|
152
|
+
- **Layer 3** (first principles — prize these above all). Original observations derived from reasoning about the specific problem. The most valuable of all.
|
|
153
|
+
|
|
154
|
+
**Eureka moment:** When first-principles reasoning reveals conventional wisdom is wrong, name it:
|
|
155
|
+
"EUREKA: Everyone does X because [assumption]. But [evidence] shows this is wrong. Y is better because [reasoning]."
|
|
156
|
+
|
|
157
|
+
Log eureka moments:
|
|
158
|
+
```bash
|
|
159
|
+
jq -n --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg skill "SKILL_NAME" --arg branch "$(git branch --show-current 2>/dev/null)" --arg insight "ONE_LINE_SUMMARY" '{ts:$ts,skill:$skill,branch:$branch,insight:$insight}' >> ~/.gstack/analytics/eureka.jsonl 2>/dev/null || true
|
|
160
|
+
```
|
|
161
|
+
Replace SKILL_NAME and ONE_LINE_SUMMARY. Runs inline — don't stop the workflow.
|
|
162
|
+
|
|
163
|
+
**WebSearch fallback:** If WebSearch is unavailable, skip the search step and note: "Search unavailable — proceeding with in-distribution knowledge only."
|
|
164
|
+
|
|
165
|
+
## Contributor Mode
|
|
166
|
+
|
|
167
|
+
If `_CONTRIB` is `true`: you are in **contributor mode**. You're a gstack user who also helps make it better.
|
|
168
|
+
|
|
169
|
+
**At the end of each major workflow step** (not after every single command), reflect on the gstack tooling you used. Rate your experience 0 to 10. If it wasn't a 10, think about why. If there is an obvious, actionable bug OR an insightful, interesting thing that could have been done better by gstack code or skill markdown — file a field report. Maybe our contributor will help make us better!
|
|
170
|
+
|
|
171
|
+
**Calibration — this is the bar:** For example, `$B js "await fetch(...)"` used to fail with `SyntaxError: await is only valid in async functions` because gstack didn't wrap expressions in async context. Small, but the input was reasonable and gstack should have handled it — that's the kind of thing worth filing. Things less consequential than this, ignore.
|
|
172
|
+
|
|
173
|
+
**NOT worth filing:** user's app bugs, network errors to user's URL, auth failures on user's site, user's own JS logic bugs.
|
|
174
|
+
|
|
175
|
+
**To file:** write `~/.gstack/contributor-logs/{slug}.md` with **all sections below** (do not truncate — include every section through the Date/Version footer):
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
# {Title}
|
|
179
|
+
|
|
180
|
+
Hey gstack team — ran into this while using /{skill-name}:
|
|
181
|
+
|
|
182
|
+
**What I was trying to do:** {what the user/agent was attempting}
|
|
183
|
+
**What happened instead:** {what actually happened}
|
|
184
|
+
**My rating:** {0-10} — {one sentence on why it wasn't a 10}
|
|
185
|
+
|
|
186
|
+
## Steps to reproduce
|
|
187
|
+
1. {step}
|
|
188
|
+
|
|
189
|
+
## Raw output
|
|
190
|
+
```
|
|
191
|
+
{paste the actual error or unexpected output here}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## What would make this a 10
|
|
195
|
+
{one sentence: what gstack should have done differently}
|
|
196
|
+
|
|
197
|
+
**Date:** {YYYY-MM-DD} | **Version:** {gstack version} | **Skill:** /{skill}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Slug: lowercase, hyphens, max 60 chars (e.g. `browse-js-no-await`). Skip if file already exists. Max 3 reports per session. File inline and continue — don't stop the workflow. Tell user: "Filed gstack field report: {title}"
|
|
201
|
+
|
|
202
|
+
## Completion Status Protocol
|
|
203
|
+
|
|
204
|
+
When completing a skill workflow, report status using one of:
|
|
205
|
+
- **DONE** — All steps completed successfully. Evidence provided for each claim.
|
|
206
|
+
- **DONE_WITH_CONCERNS** — Completed, but with issues the user should know about. List each concern.
|
|
207
|
+
- **BLOCKED** — Cannot proceed. State what is blocking and what was tried.
|
|
208
|
+
- **NEEDS_CONTEXT** — Missing information required to continue. State exactly what you need.
|
|
209
|
+
|
|
210
|
+
### Escalation
|
|
211
|
+
|
|
212
|
+
It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
|
|
213
|
+
|
|
214
|
+
Bad work is worse than no work. You will not be penalized for escalating.
|
|
215
|
+
- If you have attempted a task 3 times without success, STOP and escalate.
|
|
216
|
+
- If you are uncertain about a security-sensitive change, STOP and escalate.
|
|
217
|
+
- If the scope of work exceeds what you can verify, STOP and escalate.
|
|
218
|
+
|
|
219
|
+
Escalation format:
|
|
220
|
+
```
|
|
221
|
+
STATUS: BLOCKED | NEEDS_CONTEXT
|
|
222
|
+
REASON: [1-2 sentences]
|
|
223
|
+
ATTEMPTED: [what you tried]
|
|
224
|
+
RECOMMENDATION: [what the user should do next]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Telemetry (run last)
|
|
228
|
+
|
|
229
|
+
After the skill workflow completes (success, error, or abort), log the telemetry event.
|
|
230
|
+
Determine the skill name from the `name:` field in this file's YAML frontmatter.
|
|
231
|
+
Determine the outcome from the workflow result (success if completed normally, error
|
|
232
|
+
if it failed, abort if the user interrupted).
|
|
233
|
+
|
|
234
|
+
**PLAN MODE EXCEPTION — ALWAYS RUN:** This command writes telemetry to
|
|
235
|
+
`~/.gstack/analytics/` (user config directory, not project files). The skill
|
|
236
|
+
preamble already writes to the same directory — this is the same pattern.
|
|
237
|
+
Skipping this command loses session duration and outcome data.
|
|
238
|
+
|
|
239
|
+
Run this bash:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
_TEL_END=$(date +%s)
|
|
243
|
+
_TEL_DUR=$(( _TEL_END - _TEL_START ))
|
|
244
|
+
rm -f ~/.gstack/analytics/.pending-"$_SESSION_ID" 2>/dev/null || true
|
|
245
|
+
~/.codex/skills/gstack/bin/gstack-telemetry-log \
|
|
246
|
+
--skill "SKILL_NAME" --duration "$_TEL_DUR" --outcome "OUTCOME" \
|
|
247
|
+
--used-browse "USED_BROWSE" --session-id "$_SESSION_ID" 2>/dev/null &
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Replace `SKILL_NAME` with the actual skill name from frontmatter, `OUTCOME` with
|
|
251
|
+
success/error/abort, and `USED_BROWSE` with true/false based on whether `$B` was used.
|
|
252
|
+
If you cannot determine the outcome, use "unknown". This runs in the background and
|
|
253
|
+
never blocks the user.
|
|
254
|
+
|
|
255
|
+
# Systematic Debugging
|
|
256
|
+
|
|
257
|
+
## Iron Law
|
|
258
|
+
|
|
259
|
+
**NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
|
|
260
|
+
|
|
261
|
+
Fixing symptoms creates whack-a-mole debugging. Every fix that doesn't address root cause makes the next bug harder to find. Find the root cause, then fix it.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Phase 1: Root Cause Investigation
|
|
266
|
+
|
|
267
|
+
Gather context before forming any hypothesis.
|
|
268
|
+
|
|
269
|
+
1. **Collect symptoms:** Read the error messages, stack traces, and reproduction steps. If the user hasn't provided enough context, ask ONE question at a time via AskUserQuestion.
|
|
270
|
+
|
|
271
|
+
2. **Read the code:** Trace the code path from the symptom back to potential causes. Use Grep to find all references, Read to understand the logic.
|
|
272
|
+
|
|
273
|
+
3. **Check recent changes:**
|
|
274
|
+
```bash
|
|
275
|
+
git log --oneline -20 -- <affected-files>
|
|
276
|
+
```
|
|
277
|
+
Was this working before? What changed? A regression means the root cause is in the diff.
|
|
278
|
+
|
|
279
|
+
4. **Reproduce:** Can you trigger the bug deterministically? If not, gather more evidence before proceeding.
|
|
280
|
+
|
|
281
|
+
Output: **"Root cause hypothesis: ..."** — a specific, testable claim about what is wrong and why.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Scope Lock
|
|
286
|
+
|
|
287
|
+
After forming your root cause hypothesis, lock edits to the affected module to prevent scope creep.
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
[ -x "${CLAUDE_SKILL_DIR}/../freeze/bin/check-freeze.sh" ] && echo "FREEZE_AVAILABLE" || echo "FREEZE_UNAVAILABLE"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**If FREEZE_AVAILABLE:** Identify the narrowest directory containing the affected files. Write it to the freeze state file:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
STATE_DIR="${CLAUDE_PLUGIN_DATA:-$HOME/.gstack}"
|
|
297
|
+
mkdir -p "$STATE_DIR"
|
|
298
|
+
echo "<detected-directory>/" > "$STATE_DIR/freeze-dir.txt"
|
|
299
|
+
echo "Debug scope locked to: <detected-directory>/"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Substitute `<detected-directory>` with the actual directory path (e.g., `src/auth/`). Tell the user: "Edits restricted to `<dir>/` for this debug session. This prevents changes to unrelated code. Run `/unfreeze` to remove the restriction."
|
|
303
|
+
|
|
304
|
+
If the bug spans the entire repo or the scope is genuinely unclear, skip the lock and note why.
|
|
305
|
+
|
|
306
|
+
**If FREEZE_UNAVAILABLE:** Skip scope lock. Edits are unrestricted.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Phase 2: Pattern Analysis
|
|
311
|
+
|
|
312
|
+
Check if this bug matches a known pattern:
|
|
313
|
+
|
|
314
|
+
| Pattern | Signature | Where to look |
|
|
315
|
+
|---------|-----------|---------------|
|
|
316
|
+
| Race condition | Intermittent, timing-dependent | Concurrent access to shared state |
|
|
317
|
+
| Nil/null propagation | NoMethodError, TypeError | Missing guards on optional values |
|
|
318
|
+
| State corruption | Inconsistent data, partial updates | Transactions, callbacks, hooks |
|
|
319
|
+
| Integration failure | Timeout, unexpected response | External API calls, service boundaries |
|
|
320
|
+
| Configuration drift | Works locally, fails in staging/prod | Env vars, feature flags, DB state |
|
|
321
|
+
| Stale cache | Shows old data, fixes on cache clear | Redis, CDN, browser cache, Turbo |
|
|
322
|
+
|
|
323
|
+
Also check:
|
|
324
|
+
- `TODOS.md` for related known issues
|
|
325
|
+
- `git log` for prior fixes in the same area — **recurring bugs in the same files are an architectural smell**, not a coincidence
|
|
326
|
+
|
|
327
|
+
**External pattern search:** If the bug doesn't match a known pattern above, WebSearch for:
|
|
328
|
+
- "{framework} {generic error type}" — **sanitize first:** strip hostnames, IPs, file paths, SQL, customer data. Search the error category, not the raw message.
|
|
329
|
+
- "{library} {component} known issues"
|
|
330
|
+
|
|
331
|
+
If WebSearch is unavailable, skip this search and proceed with hypothesis testing. If a documented solution or known dependency bug surfaces, present it as a candidate hypothesis in Phase 3.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Phase 3: Hypothesis Testing
|
|
336
|
+
|
|
337
|
+
Before writing ANY fix, verify your hypothesis.
|
|
338
|
+
|
|
339
|
+
1. **Confirm the hypothesis:** Add a temporary log statement, assertion, or debug output at the suspected root cause. Run the reproduction. Does the evidence match?
|
|
340
|
+
|
|
341
|
+
2. **If the hypothesis is wrong:** Before forming the next hypothesis, consider searching for the error. **Sanitize first** — strip hostnames, IPs, file paths, SQL fragments, customer identifiers, and any internal/proprietary data from the error message. Search only the generic error type and framework context: "{component} {sanitized error type} {framework version}". If the error message is too specific to sanitize safely, skip the search. If WebSearch is unavailable, skip and proceed. Then return to Phase 1. Gather more evidence. Do not guess.
|
|
342
|
+
|
|
343
|
+
3. **3-strike rule:** If 3 hypotheses fail, **STOP**. Use AskUserQuestion:
|
|
344
|
+
```
|
|
345
|
+
3 hypotheses tested, none match. This may be an architectural issue
|
|
346
|
+
rather than a simple bug.
|
|
347
|
+
|
|
348
|
+
A) Continue investigating — I have a new hypothesis: [describe]
|
|
349
|
+
B) Escalate for human review — this needs someone who knows the system
|
|
350
|
+
C) Add logging and wait — instrument the area and catch it next time
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Red flags** — if you see any of these, slow down:
|
|
354
|
+
- "Quick fix for now" — there is no "for now." Fix it right or escalate.
|
|
355
|
+
- Proposing a fix before tracing data flow — you're guessing.
|
|
356
|
+
- Each fix reveals a new problem elsewhere — wrong layer, not wrong code.
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Phase 4: Implementation
|
|
361
|
+
|
|
362
|
+
Once root cause is confirmed:
|
|
363
|
+
|
|
364
|
+
1. **Fix the root cause, not the symptom.** The smallest change that eliminates the actual problem.
|
|
365
|
+
|
|
366
|
+
2. **Minimal diff:** Fewest files touched, fewest lines changed. Resist the urge to refactor adjacent code.
|
|
367
|
+
|
|
368
|
+
3. **Write a regression test** that:
|
|
369
|
+
- **Fails** without the fix (proves the test is meaningful)
|
|
370
|
+
- **Passes** with the fix (proves the fix works)
|
|
371
|
+
|
|
372
|
+
4. **Run the full test suite.** Paste the output. No regressions allowed.
|
|
373
|
+
|
|
374
|
+
5. **If the fix touches >5 files:** Use AskUserQuestion to flag the blast radius:
|
|
375
|
+
```
|
|
376
|
+
This fix touches N files. That's a large blast radius for a bug fix.
|
|
377
|
+
A) Proceed — the root cause genuinely spans these files
|
|
378
|
+
B) Split — fix the critical path now, defer the rest
|
|
379
|
+
C) Rethink — maybe there's a more targeted approach
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Phase 5: Verification & Report
|
|
385
|
+
|
|
386
|
+
**Fresh verification:** Reproduce the original bug scenario and confirm it's fixed. This is not optional.
|
|
387
|
+
|
|
388
|
+
Run the test suite and paste the output.
|
|
389
|
+
|
|
390
|
+
Output a structured debug report:
|
|
391
|
+
```
|
|
392
|
+
DEBUG REPORT
|
|
393
|
+
════════════════════════════════════════
|
|
394
|
+
Symptom: [what the user observed]
|
|
395
|
+
Root cause: [what was actually wrong]
|
|
396
|
+
Fix: [what was changed, with file:line references]
|
|
397
|
+
Evidence: [test output, reproduction attempt showing fix works]
|
|
398
|
+
Regression test: [file:line of the new test]
|
|
399
|
+
Related: [TODOS.md items, prior bugs in same area, architectural notes]
|
|
400
|
+
Status: DONE | DONE_WITH_CONCERNS | BLOCKED
|
|
401
|
+
════════════════════════════════════════
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## Important Rules
|
|
407
|
+
|
|
408
|
+
- **3+ failed fix attempts → STOP and question the architecture.** Wrong architecture, not failed hypothesis.
|
|
409
|
+
- **Never apply a fix you cannot verify.** If you can't reproduce and confirm, don't ship it.
|
|
410
|
+
- **Never say "this should fix it."** Verify and prove it. Run the tests.
|
|
411
|
+
- **If fix touches >5 files → AskUserQuestion** about blast radius before proceeding.
|
|
412
|
+
- **Completion status:**
|
|
413
|
+
- DONE — root cause found, fix applied, regression test written, all tests pass
|
|
414
|
+
- DONE_WITH_CONCERNS — fixed but cannot fully verify (e.g., intermittent bug, requires staging)
|
|
415
|
+
- BLOCKED — root cause unclear after investigation, escalated
|