feat(telemetry): add GDPR-compliant telemetry and TypeScript Ralph scripts - #101
Conversation
Add core telemetry module with privacy-preserving anonymous usage tracking: - TelemetryState interface with enabled, consentGiven, anonymousId, createdAt, and rotatedAt fields - Anonymous ID generation using crypto.randomUUID() (UUID v4) - State persistence to ~/.local/share/atomic/telemetry.json - Monthly ID rotation for enhanced privacy - Priority-based opt-out: CI detection (ci-info) > ATOMIC_TELEMETRY env > DO_NOT_TRACK env > config file - ATOMIC_COMMANDS constant for slash command tracking - Comprehensive test suite with 100% coverage of core functions Dependencies: ci-info ^4.3.1, @types/ci-info ^3.1.4 Ref: specs/anonymous-telemetry-implementation.md (Phase 1) Assistant-model: Claude Code
Add telemetry tracking for Atomic CLI commands (init, update, uninstall, run). - Create telemetry-cli.ts module with trackAtomicCommand function - Implement JSONL event buffering to ~/.local/share/atomic/telemetry-events.jsonl - Add AtomicCommandEvent interface matching spec Section 5.3.1 schema - Integrate tracking into init, update, uninstall, and run-agent commands - Add comprehensive unit tests for telemetry-cli module - Add integration tests for end-to-end command tracking - Update feature-list.json with Phase 2 completion status Events track command name, agent type, success status, platform, and version. All tracking respects opt-out mechanisms (ATOMIC_TELEMETRY=0, DO_NOT_TRACK=1). Assistant-model: Claude Code
Add tracking for slash commands passed via CLI invocation (e.g., `atomic -a claude -- /research-codebase src/`). This complements Phase 2 atomic command tracking by capturing skill usage analytics. Changes: - Add CliCommandEvent type and TelemetryEvent union type - Implement extractCommandsFromArgs() to parse slash commands from CLI args - Implement trackCliInvocation() function for cli_command events - Integrate tracking into run-agent.ts before Bun.spawn() - Export new types and functions from telemetry/index.ts - Add comprehensive unit tests (11 extraction, 13 tracking tests) - Add integration tests (9 tests for full CLI flow) - Update feature-list.json with Phase 3 tasks - Add progress.txt documenting implementation status All 439 tests pass, lint passes, TypeScript compilation passes. Refs: specs/anonymous-telemetry-implementation.md Section 5.3.2 Assistant-model: Claude Code
Add AgentSessionEvent type and session tracking utilities for hook-based telemetry collection across all agent platforms. - Add AgentSessionEvent interface with sessionId, sessionStartedAt, commands tracking (preserves duplicates for usage frequency) - Create telemetry-session.ts with extractCommandsFromTranscript, createSessionEvent, and trackAgentSession functions - Export session tracking functions from telemetry/index.ts - Update test files with safer optional chaining - Add comprehensive unit and integration tests (776+ lines) Assistant-model: Claude Code
Implement Phase 4 session tracking hooks for Claude Code, Copilot CLI, and OpenCode agents with three-hook accumulation strategy. Claude Code: - .claude/hooks/telemetry-stop.sh parses transcript_path from stdin JSON - .claude/hooks/hooks.json registers Stop hook Copilot CLI (three-hook accumulation): - .github/hooks/prompt-hook.sh accumulates commands via userPromptSubmitted - .github/hooks/stop-hook.sh writes event at sessionEnd - .github/scripts/start-ralph-session.sh initializes temp files OpenCode: - .opencode/plugin/telemetry.ts tracks sessions via SDK Shared: - bin/telemetry-helper.sh provides common shell functions for hooks Assistant-model: Claude Code
Document completed Phase 4 agent session tracking implementation: - Update architecture diagram with Copilot three-hook strategy - Add Copilot CLI userPromptSubmitted hook details - Document command preservation (no deduplication) for usage frequency - Mark Phase 4 checklist items as complete - Add code references for new files - Resolve open questions about Copilot transcript access and deduplication Assistant-model: Claude Code
Add opt-in consent prompt during first-run and config command for managing telemetry preferences at any time. - Add telemetry-consent.ts module with consent prompt using @clack/prompts - Add 'atomic config set telemetry <true|false>' command - Integrate consent prompt into init command (skipped in --yes mode) - Update README.md with telemetry documentation section - Add unit tests for consent flow and config command Assistant-model: Claude Code
Mock ci-info module in existing telemetry tests to prevent CI detection from disabling telemetry during test execution. Add dedicated telemetry-ci-detection.test.ts to verify telemetry is correctly disabled when running in CI environments. Assistant-model: Claude Code
PR Review: feat(telemetry): implement privacy-preserving anonymous usage trackingThanks for this comprehensive telemetry implementation! I've reviewed the code and have detailed feedback organized by category. ✅ Strengths
|
PR Review: Privacy-Preserving Anonymous Telemetry ImplementationThis is a comprehensive review of the telemetry system implementation. Overall, this is a well-architected feature with strong privacy guarantees and extensive test coverage. ✅ What's Done Well1. Privacy-First Design
2. Architecture
3. Test Coverage
4. Documentation
|
| Check | Status |
|---|---|
| No PII collection | ✅ |
| Anonymous ID rotation | ✅ |
| Opt-out mechanisms | ✅ |
| HTTPS for upload | ✅ (assumed, endpoint TBD) |
| No secrets in hooks | ✅ |
| Input validation |
Summary
Recommendation: Approve with minor changes
This is a well-designed telemetry implementation that prioritizes user privacy. The test coverage is excellent and the documentation is thorough. The issues noted above are minor and can be addressed in a follow-up PR if needed.
Key strengths:
- Privacy-first design with explicit consent
- Comprehensive test coverage
- Clean modular architecture
- Fail-safe operation
Please address the shell script command injection risk before merging, as that's the most significant security concern.
Add consentGiven field to telemetry state and require both enabled and consentGiven to be true before telemetry is sent. Also add createdAt and rotatedAt fields to track anonymous ID lifecycle. Assistant-model: Claude Code
PR Review: Privacy-Preserving Anonymous Telemetry SystemSummaryThis is a well-designed, comprehensive implementation of privacy-preserving telemetry for the Atomic CLI. The PR adds ~7,000 lines across 36 files, implementing a triple-collection strategy (CLI commands, slash command tracking, agent session hooks) with strong privacy guarantees. ✅ StrengthsArchitecture & Design
Code Quality
Security
🔍 Areas for Improvement1. Potential Race Condition in JSONL Writes (Low Risk)
Recommendation: Consider using file locking for concurrent-safe writes, or document that this is acceptable given the low collision probability. 2. Shell Script Security HardeningIn # Current:
commands_json=$(echo "$commands_str" | tr ',' '\n' | jq -R . | jq -s .)
# Consider adding null check:
if [[ -z "$commands_str" ]]; then
commands_json="[]"
else
commands_json=$(echo "$commands_str" | tr ',' '\n' | jq -R . | jq -s .)
fi3. Missing
|
Simplify telemetry implementation by removing sessionStartedAt field and session duration tracking. This reduces complexity without losing critical command usage data. Changes: - Remove sessionStartedAt from AgentSessionEvent interface - Remove session start timestamp storage in hooks - Remove session duration metric from observability strategy - Update spec to reflect simplified event schema - Clean up temp file handling (removed SESSION_START_FILE) Session end timestamp is still tracked via the timestamp field. Assistant-model: Claude Code
PR Review: Anonymous Telemetry ImplementationThank you for this comprehensive telemetry implementation. This is a well-architected feature with strong privacy considerations. Here's my detailed review: ✅ StrengthsPrivacy-First Design
Architecture
Code Quality
Documentation
🔍 Suggestions for Improvement1. Security: Hardcoded Commands List Duplication The
Consider generating the bash/TypeScript versions from a single source of truth to prevent drift. 2. Potential Race Condition in JSONL Writes In appendFileSync(eventsPath, line, "utf-8");While 3. OpenCode Plugin: Missing Dependency Check
const atomicPath = ...
if (existsSync(atomicPath)) {The Windows path construction may be incorrect: process.platform === "win32"
? join(process.env.USERPROFILE || "", ".local", "bin", "atomic.exe")On Windows, the standard install path is 4. Copilot CLI Temp File Location
COMMANDS_TEMP_FILE=".github/telemetry-session-commands.tmp"This creates a temp file in the project directory. Consider using
5. Missing Add the temp file to 6. Consent Prompt Timing In 7. Test: Environment Variable Restoration Several tests save/restore const originalEnv = { ...process.env };
// ...
afterEach(() => {
process.env = { ...originalEnv };
});This shallow copy may not fully restore if tests delete keys. Consider: afterEach(() => {
Object.keys(process.env).forEach(key => delete process.env[key]);
Object.assign(process.env, originalEnv);
});8. Version Fallback in OpenCode Plugin
function getAtomicVersion(): string {
return "unknown" // Plugin doesn't have easy access to atomic version
}Consider reading from
|
Add a guard at the top of all telemetry hook scripts to check for jq availability before attempting any JSON parsing operations. This ensures the hooks fail silently on systems without jq installed rather than producing errors that could disrupt the user's workflow. Assistant-model: Claude Code
PR Review: Privacy-Preserving Anonymous Telemetry ImplementationOverviewThis is a well-structured and comprehensive telemetry implementation that demonstrates strong privacy-first design principles. The implementation follows GDPR compliance requirements with explicit opt-in consent and provides multiple opt-out mechanisms. ✅ Strengths1. Privacy-First Architecture
2. Robust Design Patterns
3. Excellent Test Coverage
4. Multi-Platform Support
5. Good Documentation
|
Reorder the init flow so users confirm their target directory before being prompted for telemetry consent. This provides a better user experience by validating the primary action first. Assistant-model: Claude Code
Pull Request Review: Anonymous Telemetry ImplementationSummaryThis PR implements a comprehensive, privacy-first anonymous telemetry system for the Atomic CLI. The implementation is well-designed, thoroughly documented, and follows industry best practices. ✅ StrengthsPrivacy & Security
Code Quality
Testing
Documentation
|
The telemetry hook was writing pretty-printed JSON (multi-line) to the events file, which broke JSONL format parsing in the upload handler. This caused all events to be skipped during upload, preventing any telemetry data from reaching Azure Application Insights. Changed jq command from 'jq -n' to 'jq -nc' to output compact single-line JSON, which is the correct format for JSONL files. Reference: bin/telemetry-helper.sh:209
Add Copilot agent detection by parsing events.jsonl from session state: - Detect agents via task tool calls, tool execution telemetry, and instruction headers in transformedContent - Move telemetry tracking to run before Ralph loop check - Remove userPromptSubmitted hook (replaced by sessionEnd detection) Add background telemetry upload infrastructure: - Spawn detached upload process on CLI exit via --upload-telemetry flag - Add telemetry-upload.ts module with Azure Application Insights client - Add telemetry-errors.ts and telemetry-file-io.ts for modular design - Track nested --agent flags in copilot invocations Refactor telemetry helpers: - Add telemetry-helper.ps1 for Windows PowerShell support - Enhance detect_copilot_agents function with three detection methods - Add spawn_upload_process for non-blocking upload triggering - Update events file path to include agent type suffix Remove outdated test files: - Tests moved to tests/ directory structure - Will be refactored in separate commit Assistant-model: Claude Code
Assistant-model: Claude Code
Add E2E bash tests for Copilot agent detection: - copilot-agent-detection.test.sh: comprehensive agent detection tests - test-agent-detection-e2e.sh: end-to-end validation - test-copilot-agent-detection.sh: detection method verification Reorganize test structure: - Move config.test.ts from src/commands/ to tests/commands/ - Add refactored telemetry tests in tests/telemetry/ - Add test-utils.ts for shared telemetry test utilities - Add atomic-commands-sync.test.ts for command list validation Assistant-model: Claude Code
Remove dead code (getAtomicVersion stub) from telemetry.ts and normalize version output in helper scripts by stripping "atomic v" prefix to match the TypeScript VERSION constant format. Assistant-model: Claude Code
Update feature-list.json with new detection implementation tasks and progress.txt with implementation status (22/25 passing). Documents that code is working but hooks execution needs investigation. Assistant-model: Claude Code
Add leading slash to agent names when detected to match the format used when agents are invoked (e.g., /code-review instead of code-review). Assistant-model: Claude Code
Move jq availability checks from top-level early exits to individual functions that require jq. This allows scripts that source the helper to continue executing even when jq is unavailable, improving graceful degradation. Also removes unused telemetry initialization from start-ralph-session.sh and adds documentation explaining appendFileSync atomicity guarantees. Assistant-model: Claude Code
…le format - Changed state file path from .local.json to .local.md - Added parseRalphState() function using regex pattern for YAML frontmatter - Added writeRalphState() function to write YAML frontmatter format - Updated archive file format to use YAML frontmatter with completion metadata - Removed unused checkCompletionPromise() function (handled by OpenCode plugin) - Removed unused RalphState interface (replaced by ParsedRalphState) This completes the migration from JSON to YAML frontmatter format for Ralph loop state files, enabling consistent state file format across all scripts. Assistant-model: Claude Code
- Changed sessionStart bash command to use bun run with start-ralph-session.ts - Changed sessionStart powershell command to use bun run with start-ralph-session.ts - Both sessionStart and sessionEnd hooks now use TypeScript consistently This completes the migration of session hooks from shell scripts to TypeScript, ensuring consistent behavior across platforms via Bun runtime. Assistant-model: Claude Code
Delete shell scripts that have been replaced by TypeScript equivalents: - .github/scripts/cancel-ralph.sh -> cancel-ralph.ts - .github/scripts/setup-ralph-loop.sh -> ralph-loop.ts - .github/scripts/start-ralph-session.sh -> start-ralph-session.ts - .github/scripts/log-ralph-prompt.sh (no longer needed) Update agent files to use the new TypeScript scripts: - cancel-ralph.md: use bun run cancel-ralph.ts - ralph-loop.md: use bun run ralph-loop.ts, update monitoring commands This completes the migration from shell scripts to TypeScript for cross-platform compatibility using Bun runtime. Assistant-model: Claude Code
Add 46 unit tests for YAML frontmatter parsing and writing in tests/ralph/yaml-frontmatter.test.ts covering: - Parsing valid YAML frontmatter with all field combinations - Handling missing optional fields with defaults - Empty/malformed frontmatter error handling - Completion promise variations (null, quoted, spaces) - Cross-platform line ending normalization (CRLF/LF) - Special characters (unicode, markdown, YAML-like content) - Round-trip consistency across multiple cycles - Edge cases (empty prompts, large values, --- delimiters) All 534 tests pass. Assistant-model: Claude Code
Add 41 unit tests for CLI argument parsing in tests/ralph/ralph-loop-cli.test.ts covering: - Help flags (-h, --help) and precedence - Default values (prompt, iterations, completion promise) - --max-iterations validation (positive integers, errors) - --completion-promise handling (strings, spaces, warnings) - --feature-list custom paths and validation - Positional prompt arguments (single, multi-word, interspersed) - State file creation (.local.md, .flag files) - Output messages and orchestrator instructions - Combined options in different orders All 575 tests pass. Assistant-model: Claude Code
Add 31 integration tests in tests/ralph/ralph-loop-integration.test.ts covering the complete Ralph loop workflow: - Loop setup: state file creation, continue flag, config options - Session start hook: iteration increment on resume/startup - Stop hook: session end logging, graceful missing state handling - Cancel operation: archive creation, cleanup, no-op when inactive - Max iterations: tracking, increment per session, unlimited mode - Completion promise: storage, null handling, special characters - Cross-platform: CRLF handling, Bun shebang, UTF-8 encoding - Full lifecycle: setup -> cycles -> cancel, log accumulation - Error handling: malformed JSON, empty input, missing directories All 606 tests pass. Assistant-model: Claude Code
- Update cancel-ralph.md with YAML frontmatter state file format - Remove jq dependency documentation (uses grep-based parsing) - Update slash-commands.md with .local.md state file paths - Add migration note for legacy .local.json state files - Mark Feature 10 as complete in feature-list.json - Document completion of all 10 TypeScript conversion features Assistant-model: Claude Code
…ependencies Replace shell-based telemetry hooks with TypeScript implementations that inline all dependencies. This eliminates cross-file imports that don't work when plugins/hooks run in isolation from the main CLI binary. Changes: - Add .claude/hooks/telemetry-stop.ts (replaces telemetry-stop.sh) - Update .opencode/plugin/telemetry.ts to inline all dependencies - Update settings.json to use bun for TypeScript hook - Update sync tests for new TypeScript-only architecture - Remove obsolete shell scripts and documentation: - bin/telemetry-helper.sh, bin/telemetry-helper.ps1 - .github/hooks/stop-hook.sh, .github/hooks/stop-hook.ps1 - .claude/hooks/telemetry-stop.sh - docs/windows-telemetry.md - test/copilot-agent-detection.test.sh and related tests Assistant-model: Claude Code
Add proper null checks and non-null assertions to satisfy TypeScript's strict mode. Includes adding ParsedState interface, optional chaining for regex matches, and null coalescing for potentially undefined values. Assistant-model: Claude Code
PR Review: Privacy-Preserving Anonymous TelemetryOverviewThis is a large PR (17,000+ additions) that implements an opt-in telemetry system for Atomic CLI and converts several shell scripts to TypeScript. The PR demonstrates significant effort in privacy design, documentation, and testing. StrengthsPrivacy Design
Code Quality
Documentation
Issues to Address1. Hardcoded Azure Connection String (Medium Priority)In src/utils/telemetry/telemetry-upload.ts:52-53, the Azure connection string is hardcoded. While the comments explain this is write-only and safe to commit, consider using an environment variable override for flexibility. If this key ever needs rotation, all users would need to update. Recommendation: Use process.env.ATOMIC_TELEMETRY_ENDPOINT as a fallback/override option. 2. Duplicated Code Across Hooks (Medium Priority)The telemetry helper functions are duplicated across multiple files:
Each file has identical getTelemetryDataDir(), isTelemetryEnabled() functions, and ATOMIC_COMMANDS arrays with synchronization comments. Recommendation: Create a shared bin/telemetry-helpers.ts module that can be imported, or generate these files from a single source of truth. 3. Error Handling in Background Process Spawn (Low Priority)The background telemetry upload silently discards all errors (redirects to /dev/null). Consider logging to a debug file for troubleshooting. 4. Missing Cleanup for Legacy Files (Low Priority)The PR adds per-agent telemetry files but findAllEventFiles() also looks for legacy telemetry-events.jsonl. Consider adding migration documentation. Security Considerations
Suggestions
Test CoverageThe test coverage looks comprehensive:
SummaryThis is a well-designed telemetry implementation with strong privacy guarantees. The opt-in approach with explicit consent is the right choice. The main concerns are:
Recommendation: Address the code duplication concern before merge to prevent synchronization issues as the codebase evolves. The other items can be addressed in follow-up PRs. |
…ndencies
Remove backwards-compatible handling for legacy telemetry-events.jsonl
files since the 30-day grace period (Feb 22, 2025) has passed. Now only
agent-specific files (telemetry-events-{agent}.jsonl) are supported.
Also updates typescript, @azure/monitor-opentelemetry, and
@opentelemetry/api-logs to latest patch versions.
Assistant-model: Claude Code
PR Review: feat(telemetry): implement privacy-preserving anonymous usage trackingOverall AssessmentThis is a well-structured, comprehensive implementation of an opt-in anonymous telemetry system. The code demonstrates thoughtful privacy-by-design principles, thorough documentation, and extensive test coverage. The TypeScript conversion of shell scripts is also well-executed. ✅ StrengthsPrivacy & Security
Code Quality
Testing
Documentation
|
…nection string flexibility - Standardize timestamp format in OpenCode plugin to match other hooks (truncate milliseconds for consistency across all telemetry sources) - Add APPLICATIONINSIGHTS_CONNECTION_STRING env var override for flexibility (allows testing against different environments and key rotation)
PR Review: feat(telemetry): implement privacy-preserving telemetry and TypeScript Ralph conversionOverall AssessmentThis is a well-structured, comprehensive PR that implements anonymous telemetry with strong privacy guarantees. The architecture follows good practices and the code is generally high quality. The TypeScript conversion of shell scripts improves maintainability and eliminates the jq dependency. ✅ StrengthsPrivacy & Security
Architecture
Testing
TypeScript Conversion
|
Update bun.lock to reflect minor version updates for @azure/monitor-opentelemetry, @opentelemetry/api-logs, and typescript. Assistant-model: Claude Code
Code Review: PR 101 - Anonymous Telemetry and TypeScript Ralph ConversionI have reviewed this PR thoroughly. Here is my feedback organized by category: StrengthsPrivacy-First Design
Code Quality
Architecture
Concerns and Suggestions1. Code Duplication in Hooks 2. YAML Frontmatter Parsing Edge Cases 3. Shell Command Injection in Copilot Hook 4. Process Killing in cancel-ralph.ts 5. Missing Atomic File Operations Security Assessment
SummaryThis is a well-designed privacy-preserving telemetry system with good test coverage. The TypeScript conversion of shell scripts is a solid improvement. Address the code duplication concern and the shell injection edge case, and this should be good to merge. Recommendation: Approve with minor changes (address shell escaping concern in stop-hook.ts) |
Split the monolithic stop-hook.ts into three focused modules: - telemetry-session.ts: incremental command logging on userPromptSubmitted - telemetry-stop.ts: session end telemetry and upload spawning - ralph-stop.ts: Ralph loop state tracking and session restart logic Also removed unused .github/scripts/run.cmd and updated hooks.json to wire up the new hooks with proper event triggers. Assistant-model: Claude Code
There was a problem hiding this comment.
Pull request overview
This pull request implements GDPR-compliant anonymous telemetry and converts Ralph loop shell scripts to TypeScript, representing a significant architectural improvement to the Atomic CLI.
Changes:
- Adds privacy-first telemetry system with explicit consent, monthly UUID rotation, and multiple opt-out mechanisms
- Converts Ralph loop shell scripts to TypeScript for cross-platform compatibility and type safety
- Integrates telemetry hooks across Claude Code, OpenCode, and GitHub Copilot platforms
Reviewed changes
Copilot reviewed 69 out of 71 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/telemetry/*.ts | Comprehensive test suites with 2,800+ lines covering telemetry functionality |
| tests/ralph/*.ts | Integration tests for TypeScript Ralph loop conversion (1,900+ lines) |
| tests/commands/config.test.ts | Tests for new telemetry config command |
| src/utils/telemetry/*.ts | Core telemetry implementation (11 modules) |
| src/commands/config.ts | New config command for telemetry management |
| src/commands/*.ts | Integration of telemetry tracking in init, update, uninstall, run-agent |
| src/index.ts | Telemetry upload spawning and config command integration |
| .opencode/plugin/telemetry.ts | Self-contained OpenCode telemetry plugin (418 lines) |
| .claude/hooks/telemetry-stop.ts | Claude Code session end hook for telemetry |
| .github/hooks/*.ts | GitHub Copilot telemetry hooks (session and stop) |
| .github/scripts/*.ts | TypeScript Ralph loop scripts replacing shell scripts |
| package.json | New dependencies for Azure App Insights and CI detection |
| README.md | Telemetry documentation section |
| research/*.md | Extensive research documentation (5,100+ lines) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| agentType, | ||
| success, | ||
| platform: process.platform, | ||
| atomicVersion: "0.1.0", |
There was a problem hiding this comment.
The hardcoded version "0.1.0" in test fixtures should match the actual VERSION constant from src/version.ts to avoid inconsistencies. Consider importing and using the actual VERSION constant in tests.
| * Read events from JSONL file | ||
| */ | ||
| export function readEvents(agentType?: string | null): TelemetryEvent[] { | ||
| const eventsPath = getEventsFilePath(agentType as any); |
There was a problem hiding this comment.
The type assertion 'as any' bypasses TypeScript's type safety. Consider defining a proper type for the agentType parameter or using a more specific assertion like 'as AgentType | null' to maintain type safety.
| } from "./types"; | ||
| import { VERSION } from "../../version"; | ||
| import { ATOMIC_COMMANDS } from "./constants"; | ||
| import { appendEvent, getEventsFilePath } from "./telemetry-file-io"; |
There was a problem hiding this comment.
Unused import getEventsFilePath.
| import { VERSION } from "../../version"; | ||
| import { ATOMIC_COMMANDS } from "./constants"; | ||
| import { appendEvent, getEventsFilePath } from "./telemetry-file-io"; | ||
| import { handleTelemetryError } from "./telemetry-errors"; |
There was a problem hiding this comment.
Unused import handleTelemetryError.
| * Reference: Spec Section 5.3.3 | ||
| */ | ||
|
|
||
| import { readFileSync } from "fs"; |
There was a problem hiding this comment.
Unused import readFileSync.
| extractCommandsFromArgs, | ||
| getEventsFilePath, | ||
| } from "../../src/utils/telemetry/telemetry-cli"; | ||
| import { writeTelemetryState, getTelemetryFilePath } from "../../src/utils/telemetry/telemetry"; |
There was a problem hiding this comment.
Unused import getTelemetryFilePath.
| } | ||
|
|
||
| // Helper to read all CliCommandEvents from all files | ||
| function readAllCliEvents(): CliCommandEvent[] { |
There was a problem hiding this comment.
Unused function readAllCliEvents.
| createSessionEvent, | ||
| trackAgentSession, | ||
| } from "../../src/utils/telemetry/telemetry-session"; | ||
| import { writeTelemetryState, getTelemetryFilePath } from "../../src/utils/telemetry/telemetry"; |
There was a problem hiding this comment.
Unused import getTelemetryFilePath.
| * - State initialization and lazy creation | ||
| */ | ||
|
|
||
| import { describe, test, expect, beforeEach, afterEach, mock, spyOn } from "bun:test"; |
There was a problem hiding this comment.
Unused import spyOn.
| import { | ||
| generateAnonymousId, | ||
| getTelemetryFilePath, | ||
| readTelemetryState, | ||
| writeTelemetryState, | ||
| shouldRotateId, | ||
| rotateAnonymousId, | ||
| initializeTelemetryState, | ||
| getOrCreateTelemetryState, | ||
| isTelemetryEnabled, | ||
| isTelemetryEnabledSync, | ||
| setTelemetryEnabled, | ||
| } from "../../src/utils/telemetry/telemetry"; |
There was a problem hiding this comment.
Unused import isTelemetryEnabledSync.
Update test file references to use the new modular hook filenames introduced in the stop-hook refactoring. Assistant-model: Claude Code
PR Review: GDPR-Compliant Telemetry + TypeScript Shell Script ConversionThis is a substantial PR (17,087 additions) implementing anonymous telemetry with GDPR compliance and converting Ralph loop shell scripts to TypeScript. Overall, the implementation demonstrates strong privacy engineering practices and thorough documentation. Here is my detailed review: ✅ StrengthsPrivacy & GDPR Compliance
Code Quality
Documentation
|
feat(telemetry): add GDPR-compliant telemetry and TypeScript Ralph scripts
Summary
Implements a GDPR-compliant, privacy-first anonymous telemetry system for Atomic CLI that tracks command usage patterns without collecting any personally identifiable information. Additionally, converts Ralph loop shell scripts to TypeScript for improved type safety, cross-platform compatibility, and elimination of the jq dependency.
Privacy & Compliance
✅ Privacy-First Design
atomic initor viaatomic configATOMIC_TELEMETRY=0,DO_NOT_TRACK=1, config command, automatic CI disable❌ What We DON'T Collect
✅ What We DO Collect
init,/research-codebase, etc.)claude,opencode,copilot)Features
🔒 Telemetry System
Event Tracking (3 Types):
init,update,uninstall,runatomic -a claude -- /research-codebase)Multi-Platform Hook Integration:
.claude/hooks/telemetry-stop.tsparses transcripts on session end.opencode/plugin/telemetry.tsSDK integrationUser Control:
Data Flow:
🔄 TypeScript Conversion
Converted Shell Scripts (
.github/scripts/):cancel-ralph.sh→cancel-ralph.ts(222 lines)setup-ralph-loop.sh+log-ralph-prompt.sh→ralph-loop.ts(366 lines)start-ralph-session.sh→start-ralph-session.ts(206 lines)Benefits:
.sh/.ps1files.claude/and.github/hooks/State File Migration:
.local.json).local.md) matching.opencode/and.claude/conventionsImplementation Details
Event Schema
All events include:
anonymousId: UUID v4 (rotated monthly)eventId: Unique UUID v4 per eventeventType:atomic_command|cli_command|agent_sessiontimestamp: ISO 8601Backend Integration
Dependencies Added
ci-info@^4.3.1: CI environment detection@types/ci-info@^3.1.4: TypeScript definitions@azure/monitor-opentelemetry@^1.15.0: Azure App Insights SDK@opentelemetry/api@^1.9.0: OpenTelemetry core API@opentelemetry/api-logs@^0.52.0: OpenTelemetry logs APIFile Changes
src/utils/telemetry/(11 TypeScript modules + test suites).claude/,.github/,.opencode/(TypeScript implementations).github/scripts/(3 shell scripts → TypeScript)Testing
Documentation
specs/anonymous-telemetry-implementation.md(794 lines)specs/phase-6-telemetry-upload-backend.md(655 lines)specs/bun-shell-script-conversion.md(520 lines)specs/copilot-agent-detection-refactoring.md(616 lines)README.mdwith comprehensive telemetry sectionMigration Notes
No breaking changes.
atomic initor viaatomic config set telemetry true. Existing users will be prompted on their nextatomic initrun.Security & Privacy Guarantees