# How to Disable Telemetry in Feynman: Environment Variable Configuration Guide

> Easily disable Feynman telemetry by setting FEYNMAN_TELEMETRY=off or DO_NOT_TRACK=1. Learn how to bypass analytics and enhance your privacy with this quick guide.

- Repository: [Advait Paliwal/feynman](https://github.com/advaitpaliwal/feynman)
- Tags: how-to-guide
- Published: 2026-09-08

---

**Set the environment variable `FEYNMAN_TELEMETRY=off` or `DO_NOT_TRACK=1` before running Feynman to completely disable all PostHog telemetry collection and bypass the analytics stack.**

Feynman integrates **telemetry** via PostHog to collect usage analytics, but the open-source project provides straightforward opt-out mechanisms through environment variables. Whether you need to disable tracking for privacy compliance, corporate security policies, or personal preference, you can disable telemetry without modifying any source code by leveraging the configuration resolver in [`src/telemetry/posthog.ts`](https://github.com/advaitpaliwal/feynman/blob/main/src/telemetry/posthog.ts).

## How Telemetry Control Works in Feynman

The telemetry system evaluates opt-out preferences during initialization through the `resolvePostHogTelemetryConfig` function in [`src/telemetry/posthog.ts`](https://github.com/advaitpaliwal/feynman/blob/main/src/telemetry/posthog.ts). This function checks the runtime environment for specific variables; if either `FEYNMAN_TELEMETRY=off` or `DO_NOT_TRACK=1` is present, the function returns `undefined`, which causes the rest of the telemetry stack—including the PostHog client, OTLP transport, and circuit-breaker logic—to be bypassed entirely.

When telemetry is disabled, subsequent calls to `getPostHogOtelEnv` produce a clean environment without any PostHog-related keys, ensuring no analytics data reaches external servers.

## Methods to Disable Feynman Telemetry

### Using Environment Variables (CLI)

The simplest method to disable telemetry is setting one of two supported environment variables before invoking the Feynman CLI. This approach requires no code changes and works for both temporary and session-wide disabling.

Disable telemetry for a single command:

```bash

# Option 1: Use the Feynman-specific variable

FEYNMAN_TELEMETRY=off feynman rank "some topic"

# Option 2: Use the standard Do Not Track convention

DO_NOT_TRACK=1 feynman rank "some topic"

```

Disable telemetry for an entire shell session:

```bash
export FEYNMAN_TELEMETRY=off

# or

export DO_NOT_TRACK=1

# All subsequent Feynman commands run without telemetry

feynman rank "another topic"

```

### Permanent Configuration in Shell Profiles

To permanently disable telemetry across all sessions, add the export statement to your shell's configuration file. This ensures the opt-out persists across terminal restarts.

For Bash users:

```bash
echo 'export FEYNMAN_TELEMETRY=off' >> ~/.bashrc

```

For Zsh users:

```bash
echo 'export DO_NOT_TRACK=1' >> ~/.zshrc

```

Reload your profile with `source ~/.bashrc` or `source ~/.zshrc` to apply changes immediately.

### Programmatic Disabling in Node.js

When spawning Feynman as a child process or using it programmatically, pass the environment variable explicitly in the `env` option:

```javascript
const { spawn } = require('child_process');

const child = spawn('feynman', ['rank', 'topic'], {
  env: { ...process.env, FEYNMAN_TELEMETRY: 'off' }
});

child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);

```

If importing Feynman's API directly as a library, you can disable telemetry by passing an explicit environment configuration to `initializePostHogTelemetry`:

```typescript
import { initializePostHogTelemetry } from './src/telemetry/posthog.js';

initializePostHogTelemetry({
  home: '/tmp/feynman',
  appVersion: '0.3.4',
  serviceName: 'my-tool',
  env: { FEYNMAN_TELEMETRY: 'off' }  // Opt-out here
});

```

## Verification Through the Test Suite

The opt-out behavior is rigorously validated in [`tests/telemetry.test.ts`](https://github.com/advaitpaliwal/feynman/blob/main/tests/telemetry.test.ts). The test case **"resolvePostHogTelemetryConfig respects telemetry opt out"** asserts that passing `{ FEYNMAN_TELEMETRY: "off" }` or `{ DO_NOT_TRACK: "1" }` causes the configuration resolver to return `undefined`, preventing telemetry initialization.

Additionally, the test **"getPostHogOtelEnv clears inherited telemetry env when telemetry is disabled"** confirms that when telemetry is disabled, `getPostHogOtelEnv` produces a sanitized environment without PostHog-related keys, as verified around lines 99-108 of the test file.

## Key Source Files

The following files in the `advaitpaliwal/feynman` repository implement and verify the telemetry control logic:

- **[`src/telemetry/posthog.ts`](https://github.com/advaitpaliwal/feynman/blob/main/src/telemetry/posthog.ts)** – Contains `resolvePostHogTelemetryConfig` and `initializePostHogTelemetry`, which evaluate environment variables to determine telemetry activation.
- **[`src/pi/runtime.ts`](https://github.com/advaitpaliwal/feynman/blob/main/src/pi/runtime.ts)** – Entry point where `getPostHogOtelEnv` applies the telemetry configuration to the Pi runtime environment.
- **[`tests/telemetry.test.ts`](https://github.com/advaitpaliwal/feynman/blob/main/tests/telemetry.test.ts)** – Test suite confirming that both `FEYNMAN_TELEMETRY=off` and `DO_NOT_TRACK=1` properly disable the telemetry stack.

## Summary

- Set **`FEYNMAN_TELEMETRY=off`** or **`DO_NOT_TRACK=1`** to disable telemetry without code changes.
- The **`resolvePostHogTelemetryConfig`** function in [`src/telemetry/posthog.ts`](https://github.com/advaitpaliwal/feynman/blob/main/src/telemetry/posthog.ts) evaluates these variables during initialization.
- Permanent opt-out is achieved by adding the export to your shell profile (`~/.bashrc` or `~/.zshrc`).
- Programmatic usage requires passing the environment variable in the **`env`** configuration object.
- The test suite in **[`tests/telemetry.test.ts`](https://github.com/advaitpaliwal/feynman/blob/main/tests/telemetry.test.ts)** validates that telemetry is fully bypassed when these variables are set.

## Frequently Asked Questions

### What environment variables disable Feynman telemetry?

Feynman checks two environment variables: **`FEYNMAN_TELEMETRY=off`** and **`DO_NOT_TRACK=1`**. Either variable will cause the `resolvePostHogTelemetryConfig` function to return `undefined`, completely disabling the PostHog telemetry integration.

### Does disabling telemetry affect Feynman's functionality?

No. Disabling telemetry only prevents analytics data collection and transmission. All core ranking, search, and language processing features continue to function normally; the application simply bypasses the PostHog client initialization and OTLP transport layers.

### How can I verify that telemetry is actually disabled?

You can verify the configuration by checking that `resolvePostHogTelemetryConfig` returns `undefined` when your environment variables are set. In the Feynman test suite, the file [`tests/telemetry.test.ts`](https://github.com/advaitpaliwal/feynman/blob/main/tests/telemetry.test.ts) demonstrates this verification approach, confirming that the `getPostHogOtelEnv` function returns an environment object without PostHog-related keys when telemetry is disabled.

### Can I disable telemetry programmatically when using Feynman as a library?

Yes. When calling `initializePostHogTelemetry` programmatically, pass an `env` object containing `FEYNMAN_TELEMETRY: 'off'`. When spawning Feynman as a child process, include the environment variable in the `env` option of `child_process.spawn`. Both methods prevent the telemetry stack from initializing without requiring global environment changes.