Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ empty result, not a skipped step.

Do not log obvious facts or one-time transient errors.

## Telemetry (run last)
## Skill end (run last)

After workflow completion, log telemetry with ONE command. OUTCOME is
After workflow completion, run ONE command. OUTCOME is
success/error/abort/unknown; `SESSION_ID` and `TEL_START` are the values the
preamble's skill-start output echoed. It also drains the artifacts-sync queue
(the former skill-end sync step — do not run gstack-brain-sync separately).
preamble's skill-start output echoed. It releases the session lease and drains
the artifacts-sync queue (do not run gstack-brain-sync separately). It records
no telemetry.

**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes telemetry to
`$GSTACK_STATE_ROOT/analytics/`, matching preamble analytics writes.
**PLAN MODE EXCEPTION — ALWAYS RUN:** This only writes local session state.

```bash
~/.claude/skills/gstack/bin/gstack-skill-end --skill "gstack" --outcome OUTCOME \
Expand All @@ -138,7 +138,7 @@ preamble's skill-start output echoed. It also drains the artifacts-sync queue
Replace `OUTCOME` and `USED_BROWSE` (yes/no) before running; substitute
`SESSION_ID`/`TEL_START` from the skill-start echoes. `ERROR_MESSAGE`/`FAILED_STEP`
are "" unless outcome is error. If the command is missing (stale install), skip
telemetry — it never blocks the workflow.
it — it never blocks the workflow.

## Plan Status Footer

Expand All @@ -162,14 +162,6 @@ This is the gstack router. Its one job is to send the request to the right skill
Windows, or Aside closed); on Aside there is nothing to open or import.
3. Otherwise, route by the rules below. If nothing matches, answer directly.

Best-effort, record which way you routed (never block on it). Set `ROUTE_OUTCOME` to
`browse` (sent to /browse), `routed` (sent to another skill), or `direct` (answered
directly, no skill matched), and replace `SESSION_ID` with the value the skill-start
output echoed:
```bash
~/.claude/skills/gstack/bin/gstack-telemetry-log --event-type route --skill gstack --outcome ROUTE_OUTCOME --session-id "SESSION_ID" 2>/dev/null || true
```

If `PROACTIVE` is `false` or `off`: do not proactively invoke or suggest other gstack
skills during this session, including by asking whether to run one ("want me to run /X?").
Only run skills the user explicitly invokes. This preference persists across sessions via
Expand Down
8 changes: 0 additions & 8 deletions SKILL.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ This is the gstack router. Its one job is to send the request to the right skill
Windows, or Aside closed); on Aside there is nothing to open or import.
3. Otherwise, route by the rules below. If nothing matches, answer directly.

Best-effort, record which way you routed (never block on it). Set `ROUTE_OUTCOME` to
`browse` (sent to /browse), `routed` (sent to another skill), or `direct` (answered
directly, no skill matched), and replace `SESSION_ID` with the value the skill-start
output echoed:
```bash
~/.claude/skills/gstack/bin/gstack-telemetry-log --event-type route --skill gstack --outcome ROUTE_OUTCOME --session-id "SESSION_ID" 2>/dev/null || true
```

If `PROACTIVE` is `false` or `off`: do not proactively invoke or suggest other gstack
skills during this session, including by asking whether to run one ("want me to run /X?").
Only run skills the user explicitly invokes. This preference persists across sessions via
Expand Down
18 changes: 9 additions & 9 deletions autoplan/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ BRANCH=$(~/.claude/skills/gstack/bin/gstack-slug --get BRANCH 2>/dev/null)
jq -nc --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg skill "SKILL_NAME" --arg branch "$BRANCH" --arg insight "ONE_LINE_SUMMARY" '{ts:$ts,skill:$skill,branch:$branch,insight:$insight}' >> "$GSTACK_STATE_ROOT/analytics/eureka.jsonl" 2>/dev/null || true
```

## Telemetry (run last)
## Skill end (run last)

After workflow completion, log telemetry with ONE command. OUTCOME is
After workflow completion, run ONE command. OUTCOME is
success/error/abort/unknown; `SESSION_ID` and `TEL_START` are the values the
preamble's skill-start output echoed. It also drains the artifacts-sync queue
(the former skill-end sync step — do not run gstack-brain-sync separately).
preamble's skill-start output echoed. It releases the session lease and drains
the artifacts-sync queue (do not run gstack-brain-sync separately). It records
no telemetry.

**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes telemetry to
`$GSTACK_STATE_ROOT/analytics/`, matching preamble analytics writes.
**PLAN MODE EXCEPTION — ALWAYS RUN:** This only writes local session state.

```bash
~/.claude/skills/gstack/bin/gstack-skill-end --skill "autoplan" --outcome OUTCOME \
Expand All @@ -138,7 +138,7 @@ preamble's skill-start output echoed. It also drains the artifacts-sync queue
Replace `OUTCOME` and `USED_BROWSE` (yes/no) before running; substitute
`SESSION_ID`/`TEL_START` from the skill-start echoes. `ERROR_MESSAGE`/`FAILED_STEP`
are "" unless outcome is error. If the command is missing (stale install), skip
telemetry — it never blocks the workflow.
it — it never blocks the workflow.

## Step 0: Detect platform and base branch

Expand Down Expand Up @@ -227,7 +227,7 @@ Follow its instructions from top to bottom, **skipping these sections when prese
- Shared preamble (load first)
- Search Before Building
- Contributor Mode
- Telemetry (run last)
- Skill end (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
Expand Down Expand Up @@ -478,7 +478,7 @@ the tasks aggregator at Phase 4. Run every applicable skill and lazy section ful
- AskUserQuestion Format
- Shared preamble (load first)
- Search Before Building
- Telemetry (run last)
- Skill end (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
Expand Down
2 changes: 1 addition & 1 deletion autoplan/SKILL.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ the tasks aggregator at Phase 4. Run every applicable skill and lazy section ful
- AskUserQuestion Format
- Shared preamble (load first)
- Search Before Building
- Telemetry (run last)
- Skill end (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
Expand Down
14 changes: 7 additions & 7 deletions benchmark-models/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ empty result, not a skipped step.

Do not log obvious facts or one-time transient errors.

## Telemetry (run last)
## Skill end (run last)

After workflow completion, log telemetry with ONE command. OUTCOME is
After workflow completion, run ONE command. OUTCOME is
success/error/abort/unknown; `SESSION_ID` and `TEL_START` are the values the
preamble's skill-start output echoed. It also drains the artifacts-sync queue
(the former skill-end sync step — do not run gstack-brain-sync separately).
preamble's skill-start output echoed. It releases the session lease and drains
the artifacts-sync queue (do not run gstack-brain-sync separately). It records
no telemetry.

**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes telemetry to
`$GSTACK_STATE_ROOT/analytics/`, matching preamble analytics writes.
**PLAN MODE EXCEPTION — ALWAYS RUN:** This only writes local session state.

```bash
~/.claude/skills/gstack/bin/gstack-skill-end --skill "benchmark-models" --outcome OUTCOME \
Expand All @@ -138,7 +138,7 @@ preamble's skill-start output echoed. It also drains the artifacts-sync queue
Replace `OUTCOME` and `USED_BROWSE` (yes/no) before running; substitute
`SESSION_ID`/`TEL_START` from the skill-start echoes. `ERROR_MESSAGE`/`FAILED_STEP`
are "" unless outcome is error. If the command is missing (stale install), skip
telemetry — it never blocks the workflow.
it — it never blocks the workflow.

## Plan Status Footer

Expand Down
14 changes: 7 additions & 7 deletions benchmark/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ empty result, not a skipped step.

Do not log obvious facts or one-time transient errors.

## Telemetry (run last)
## Skill end (run last)

After workflow completion, log telemetry with ONE command. OUTCOME is
After workflow completion, run ONE command. OUTCOME is
success/error/abort/unknown; `SESSION_ID` and `TEL_START` are the values the
preamble's skill-start output echoed. It also drains the artifacts-sync queue
(the former skill-end sync step — do not run gstack-brain-sync separately).
preamble's skill-start output echoed. It releases the session lease and drains
the artifacts-sync queue (do not run gstack-brain-sync separately). It records
no telemetry.

**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes telemetry to
`$GSTACK_STATE_ROOT/analytics/`, matching preamble analytics writes.
**PLAN MODE EXCEPTION — ALWAYS RUN:** This only writes local session state.

```bash
~/.claude/skills/gstack/bin/gstack-skill-end --skill "benchmark" --outcome OUTCOME \
Expand All @@ -139,7 +139,7 @@ preamble's skill-start output echoed. It also drains the artifacts-sync queue
Replace `OUTCOME` and `USED_BROWSE` (yes/no) before running; substitute
`SESSION_ID`/`TEL_START` from the skill-start echoes. `ERROR_MESSAGE`/`FAILED_STEP`
are "" unless outcome is error. If the command is missing (stale install), skip
telemetry — it never blocks the workflow.
it — it never blocks the workflow.

## Plan Status Footer

Expand Down
4 changes: 2 additions & 2 deletions bin/gstack-config
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ CONFIG_HEADER='# gstack configuration — edit freely, changes take effect on ne
# # telemetry.
#
# ─── Updates ─────────────────────────────────────────────────────────
# auto_upgrade: false # true = silently upgrade on session start
# auto_upgrade: true # true = silently upgrade on session start (fork default)
# update_check: true # false = suppress version check notifications
# update_channel: auto # auto = stable when team_mode is true, else main
# # stable = the weekly tagged release (refs/heads/stable)
Expand Down Expand Up @@ -330,7 +330,7 @@ lookup_default() {
proactive) echo "core" ;; # core | all | off (true = all, false = off); core suggests only /office-hours, /review, /qa, /ship
routing_declined) echo "false" ;;
telemetry) echo "off" ;;
auto_upgrade) echo "false" ;;
auto_upgrade) echo "true" ;; # fork: silent update from cheese-work/gstack (CHE-5564)
update_check) echo "true" ;;
update_channel) echo "auto" ;; # auto | stable | main — bin/gstack-update-channel.sh resolves auto (docs/releases.md)
skill_prefix) echo "false" ;;
Expand Down
14 changes: 1 addition & 13 deletions bin/gstack-skill-end
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _BIN="$_SCRIPT_DIR"
. "$(dirname "$0")/gstack-state-root.sh" 2>/dev/null || { echo "$0: cannot resolve the gstack state root: $(dirname "$0")/gstack-state-root.sh is missing. fix: reinstall with ./setup or /gstack-upgrade (docs/state-root.md)" >&2; exit 1; }
gstack_state_root_select
_GH="$_gstack_sr_root"
_TEL=$("$_BIN/gstack-config" get telemetry 2>/dev/null || echo off)
_TEL=off # fork (CHE-5564): telemetry is hard off
# Plan B1: an unattended session writes no usage, sends no telemetry and never
# drains or pushes the artifacts queue, whatever the inherited settings say. The
# upgrade offer it skipped at start becomes one line here, read from the
Expand Down Expand Up @@ -72,16 +72,4 @@ if [ "$_SESSION_KIND" != "unattended" ]; then
"$_BIN/gstack-brain-sync" --once 2>/dev/null || true
fi

# Local analytics (gated on telemetry setting).
if [ "$_TEL" != "off" ]; then
echo '{"skill":"'"$SKILL_NAME"'","duration_s":"'"$_TEL_DUR"'","outcome":"'"$OUTCOME"'","browse":"'"$USED_BROWSE"'","session":"'"$SESSION_ID"'","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' >> "$_GH/analytics/skill-usage.jsonl" 2>/dev/null || true
fi

# Remote telemetry (opt-in, requires binary).
if [ "$_TEL" != "off" ] && [ -x "$_BIN/gstack-telemetry-log" ]; then
"$_BIN/gstack-telemetry-log" \
--skill "$SKILL_NAME" --duration "$_TEL_DUR" --outcome "$OUTCOME" \
--used-browse "$USED_BROWSE" --session-id "$SESSION_ID" \
--error-message "$ERROR_MESSAGE" --failed-step "$FAILED_STEP" 2>/dev/null &
fi
echo "SKILL_END: recorded outcome=$OUTCOME duration_s=$_TEL_DUR"
43 changes: 16 additions & 27 deletions bin/gstack-skill-start
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ fi
printf 'FIRST_TASK: %s\n' "$_FIRST_TASK" | _sanitize
_LAKE_SEEN=$([ -f "$_GH/.completeness-intro-seen" ] && echo "yes" || echo "no")
echo "LAKE_INTRO: $_LAKE_SEEN"
_TEL=$("$_BIN/gstack-config" get telemetry 2>/dev/null || true)
_TEL_PROMPTED=$([ -f "$_GH/.telemetry-prompted" ] && echo "yes" || echo "no")
# Fork (CHE-5564): telemetry is hard off and never prompted.
_TEL=off
_TEL_PROMPTED=yes
_TEL_START=$(date +%s)
# PID+epoch alone is guessable; a random suffix makes the block-binding token
# unforgeable by content reflected into the same tool result. Falls back to
Expand Down Expand Up @@ -558,11 +559,20 @@ _emit_block() { echo "GSTACK_INSTRUCTION_BEGIN: $1 $_SESSION_ID"; cat; echo "GST
# guard: the former is the gate's inverse, the latter is interactive-only.
if [ "$_NO_HUMAN" != "yes" ]; then

# Upgrade flow (gated: update-check emitted something above).
# Upgrade (fork, CHE-5564): no question. A newer cheese-work/gstack version
# installs silently when auto_upgrade is true (the fork default); a failed
# upgrade stays silent and retries at the next session start.
if [ -n "$_UPD" ]; then
_emit_block upgrade-flow <<EOI
The update-check output above applies. If it shows \`UPGRADE_AVAILABLE <old> <new>\`: read \`$_ROOT_DIR/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 it shows \`JUST_UPGRADED <from> <to>\`: print "Running gstack v{to} (just updated!)". If \`SPAWNED_SESSION\` is true, skip feature discovery. After upgrade prompts, continue the workflow.
case "$_UPD" in
UPGRADE_AVAILABLE*)
[ "$("$_BIN/gstack-config" get auto_upgrade 2>/dev/null || true)" = "true" ] \
&& "$_BIN/gstack-upgrade" >/dev/null 2>&1 || true ;;
JUST_UPGRADED*)
_emit_block upgrade-flow <<EOI
The update-check output above shows \`JUST_UPGRADED <from> <to>\`: print "Running gstack v{to} (just updated!)". If \`SPAWNED_SESSION\` is true, skip feature discovery.
EOI
;;
esac
fi
# Feature discovery (one prompt per session, marker-gated). These are
# machine-local UX acknowledgements, so keep them in GSTACK_HOME rather than
Expand Down Expand Up @@ -597,29 +607,8 @@ Say: "gstack follows the **Boil the Ocean** principle — complete coverage, min
EOI
fi

# Telemetry opt-in (interactive; consent — the model acks after answering).
if [ "$_TEL_PROMPTED" = "no" ] && [ "$_LAKE_SEEN" = "yes" ]; then
_emit_block telemetry-prompt <<EOI
Ask telemetry once via AskUserQuestion:

> Help gstack get better. Yes sends, per skill run: skill name, outcome, duration, gstack version, OS, a redacted error summary and a stable device ID. Never code, file paths, prompts, repo or branch names. Your repo and branch are also logged on this machine (analytics/skill-usage.jsonl) and stripped before upload; off logs nothing. Not covered by this answer: the update check asks GitHub for the latest version about hourly (\`gstack-config set update_check false\`), and outside reviews send code to Codex or Claude Code (\`gstack-config set codex_reviews disabled\`). Details: README "Privacy & Telemetry".

Options:
- A) Help gstack get better! (recommended)
- B) No thanks

If A: run \`$_BIN/gstack-config set telemetry community\`. If B, ask the follow-up:

> Anonymous mode sends only aggregate usage, no unique ID.

Options: A) Sure, anonymous is fine B) No thanks, fully off
If B→A: \`$_BIN/gstack-config set telemetry anonymous\`. If B→B: \`$_BIN/gstack-config set telemetry off\`.
Always run: \`touch "$_GH/.telemetry-prompted"\`.
EOI
fi

# Proactive-suggestions opt-in (interactive; a stored off answered it above).
if [ "$_PROACTIVE_PROMPTED" = "no" ] && [ "$_TEL_PROMPTED" = "yes" ]; then
if [ "$_PROACTIVE_PROMPTED" = "no" ] && [ "$_LAKE_SEEN" = "yes" ]; then
_emit_block proactive-prompt <<EOI
Ask once:

Expand Down
3 changes: 3 additions & 0 deletions bin/gstack-telemetry-log
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#
# NOTE: Uses set -uo pipefail (no -e) — telemetry must never exit non-zero
set -uo pipefail
# cheese-work fork (CHE-5564): telemetry is hard off. No event is written or sent, whatever the config says.
exit 0

GSTACK_BUN_CONFIG=/dev/null; case "${OSTYPE:-}" in msys*|cygwin*) if command -v cygpath >/dev/null 2>&1; then GSTACK_BUN_CONFIG=NUL; fi ;; esac

GSTACK_DIR="${GSTACK_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
Expand Down
3 changes: 3 additions & 0 deletions bin/gstack-telemetry-sync
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# GSTACK_DIR — override auto-detected gstack root
# GSTACK_SUPABASE_URL — override Supabase project URL
set -uo pipefail
# cheese-work fork (CHE-5564): telemetry is hard off. No event is written or sent, whatever the config says.
exit 0


GSTACK_DIR="${GSTACK_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
. "$(dirname "$0")/gstack-state-root.sh" 2>/dev/null || { echo "$0: cannot resolve the gstack state root: $(dirname "$0")/gstack-state-root.sh is missing. fix: reinstall with ./setup or /gstack-upgrade (docs/state-root.md)" >&2; exit 1; }
Expand Down
33 changes: 4 additions & 29 deletions bin/gstack-update-check
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ VERSION_FILE="$GSTACK_DIR/VERSION"
. "$GSTACK_DIR/bin/gstack-update-channel.sh" 2>/dev/null || gstack_update_channel() { echo main; }
CHANNEL=$(gstack_update_channel "$GSTACK_DIR" 2>/dev/null) || CHANNEL=main
case "$CHANNEL" in stable|main) ;; *) CHANNEL=main ;; esac
REMOTE_RAW_BASE="${GSTACK_REMOTE_RAW_BASE:-https://raw.githubusercontent.com/garrytan/gstack}"
REMOTE_RAW_BASE="${GSTACK_REMOTE_RAW_BASE:-https://raw.githubusercontent.com/cheese-work/gstack}"
REMOTE_URL="${GSTACK_REMOTE_URL:-$REMOTE_RAW_BASE/$CHANNEL/VERSION}"
REMOTE_REPO="${GSTACK_REMOTE_REPO:-https://github.com/garrytan/gstack.git}"
COMPARE_API="${GSTACK_COMPARE_API:-https://api.github.com/repos/garrytan/gstack/compare}"
REMOTE_REPO="${GSTACK_REMOTE_REPO:-https://github.com/cheese-work/gstack.git}"
COMPARE_API="${GSTACK_COMPARE_API:-https://api.github.com/repos/cheese-work/gstack/compare}"

# ─── Force flag (busts cache + snooze for standalone /gstack-upgrade) ──
FORCE=0
Expand Down Expand Up @@ -278,32 +278,7 @@ fi
# ─── Step 4: Slow path — fetch remote version ────────────────
mkdir -p "$STATE_DIR"

# Fire Supabase install ping in background (parallel, non-blocking)
# This logs an update check event for community health metrics via edge function.
# If Supabase is not configured or telemetry is off, this is a no-op.
if [ -z "${GSTACK_SUPABASE_URL:-}" ] && [ -f "$GSTACK_DIR/supabase/config.sh" ]; then
. "$GSTACK_DIR/supabase/config.sh"
fi
_SUPA_URL="${GSTACK_SUPABASE_URL:-}"
_SUPA_KEY="${GSTACK_SUPABASE_ANON_KEY:-}"
# Respect telemetry opt-out — don't ping Supabase if user set telemetry: off
_TEL_TIER="$("$GSTACK_DIR/bin/gstack-config" get telemetry 2>/dev/null || true)"
if [ -n "$_SUPA_URL" ] && [ -n "$_SUPA_KEY" ] && [ "${_TEL_TIER:-off}" != "off" ]; then
_OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
# Receipted (fail-open) and fully backgrounded: the receipt write happens
# inside the background subshell, so it can never block this script's exit.
_PING_FILE="$(mktemp "${TMPDIR:-/tmp}/gstack-update-ping-XXXXXX" 2>/dev/null)" || _PING_FILE=""
if [ -n "$_PING_FILE" ]; then
printf '{"version":"%s","os":"%s"}' "$LOCAL" "$_OS" > "$_PING_FILE"
_SUPA_HOST="${_SUPA_URL#*://}"; _SUPA_HOST="${_SUPA_HOST%%/*}"
GSTACK_HOME="$STATE_DIR" _receipted_curl open update-check "$_SUPA_HOST" update-check-ping "telemetry=$_TEL_TIER" "$_PING_FILE" \
curl -sf --max-time 5 \
-X POST "${_SUPA_URL}/functions/v1/update-check" \
-H "Content-Type: application/json" \
-H "apikey: ${_SUPA_KEY}" \
>/dev/null 2>&1 &
fi
fi
# Telemetry is hard off in the fork (CHE-5564): no Supabase update-check ping.

# Resolve VERSION via a SHA-pinned raw URL. GitHub's branch-raw CDN
# (raw.githubusercontent.com/<owner>/<repo>/<branch>/...) can serve stale
Expand Down
Loading
Loading