Files
nanoclaw/.claude/skills/update-nanoclaw/diagnostics.md
gavrielc f97394656c cross-skill opt-out and gather system info via shell
- "Never ask again" now removes diagnostics from both skills
- Added shell commands to gather version, platform, arch, node version
- Show only properties object to user, not api_key/distinct_id
- Write full PostHog payload to temp file, send with curl -d @file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:47:54 +02:00

2.2 KiB

Diagnostics (Optional)

After the update is complete, offer to send anonymous diagnostics.

1. Gather system info

node -p "require('./package.json').version"
uname -s
uname -m
node -p "process.versions.node.split('.')[0]"
git log -1 --format=%ci HEAD@{1} 2>/dev/null || echo "unknown"

The last command gets the date of the previous HEAD (before the update) to estimate version age.

2. Write the event

Write a JSON file to /tmp/nanoclaw-diagnostics.json. Fill in system info from the commands above and the outcome from the session. Use only non-identifying information — no paths, usernames, hostnames, or IP addresses.

{
  "api_key": "phc_fx1Hhx9ucz8GuaJC8LVZWO8u03yXZZJJ6ObS4yplnaP",
  "event": "update_complete",
  "distinct_id": "<generate a uuid>",
  "properties": {
    "success": true,
    "nanoclaw_version": "1.2.21",
    "os_platform": "darwin",
    "arch": "arm64",
    "node_major_version": 22,
    "version_age_days": 45,
    "update_method": "merge",
    "conflict_count": 0,
    "breaking_changes_found": false,
    "error_count": 0
  }
}

3. Show and ask

Show the contents of the file to the user and ask:

"Would you like to send anonymous diagnostics to help improve NanoClaw? Here's exactly what would be sent:"

(show the properties object only — not the api_key or distinct_id)

Yes / No / Never ask again

Use AskUserQuestion.

4. Handle response

Yes:

curl -s -X POST https://us.i.posthog.com/capture/ -H 'Content-Type: application/json' -d @/tmp/nanoclaw-diagnostics.json
rm /tmp/nanoclaw-diagnostics.json

Confirm: "Diagnostics sent."

No: rm /tmp/nanoclaw-diagnostics.json — do nothing else.

Never ask again: Opt out of diagnostics in both setup and update-nanoclaw:

  1. Replace the contents of .claude/skills/setup/diagnostics.md with just # Diagnostics — opted out
  2. Replace the contents of .claude/skills/update-nanoclaw/diagnostics.md with just # Diagnostics — opted out
  3. Remove the "Diagnostics (Optional)" section from the end of both .claude/skills/setup/SKILL.md and .claude/skills/update-nanoclaw/SKILL.md
  4. rm /tmp/nanoclaw-diagnostics.json

Confirm: "Got it — you won't be asked again."