> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sense-lab.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> All environment variables supported by AMFS.

## Connection

These are the only variables most users need:

| Variable        | Description                                                |
| :-------------- | :--------------------------------------------------------- |
| `AMFS_HTTP_URL` | Your AMFS API URL (e.g. `https://amfs-login.sense-lab.ai`) |
| `AMFS_API_KEY`  | Your API key (from Dashboard → Settings → API Keys)        |

When `AMFS_HTTP_URL` is set, all memory operations route through the authenticated HTTP API.

***

## Agent Identity

| Variable         | Description                                                      | Default       |
| :--------------- | :--------------------------------------------------------------- | :------------ |
| `AMFS_AGENT_ID`  | Override auto-detected agent identity (for CI, scripts, servers) | Auto-detected |
| `AMFS_NAMESPACE` | Memory namespace for isolation                                   | `default`     |

Identity is auto-detected from the IDE environment (Cursor, Claude Code). Set `AMFS_AGENT_ID` explicitly in headless environments like CI or deploy scripts.

***

## MCP Server

| Variable                  | Description                           | Default   |
| :------------------------ | :------------------------------------ | :-------- |
| `AMFS_TRANSPORT`          | Transport protocol: `stdio` or `http` | `stdio`   |
| `AMFS_HOST`               | MCP HTTP server bind host             | `0.0.0.0` |
| `AMFS_PORT`               | MCP HTTP server bind port             | `8000`    |
| `AMFS_PATH`               | MCP HTTP server URL path              | `/mcp`    |
| `AMFS_TTL_SWEEP_INTERVAL` | Seconds between TTL sweep runs        | —         |

***

## Pro Features

| Variable                   | Description                                                                   | Default                 |
| :------------------------- | :---------------------------------------------------------------------------- | :---------------------- |
| `AMFS_TRACE_SIGNING_KEY`   | HMAC key for immutable trace integrity (traces are signed and Merkle-chained) | —                       |
| `AMFS_OTEL_ENDPOINT`       | OpenTelemetry collector endpoint (gRPC)                                       | `http://localhost:4317` |
| `AMFS_OTEL_SERVICE_NAME`   | Service name for OTel spans                                                   | `amfs`                  |
| `AMFS_AUTO_EXTRACT`        | Enable automatic entity/relationship extraction from traces                   | `false`                 |
| `AMFS_EXTRACTION_MODEL`    | LLM model for extraction                                                      | `gpt-4o-mini`           |
| `AMFS_EXTRACTION_PROVIDER` | LLM provider (`openai`, `anthropic`)                                          | `openai`                |
| `AMFS_CORTEX_LLM_MODEL`    | LLM model for narrative digest compilation                                    | `gpt-4o-mini`           |
| `AMFS_ML_MODEL_DIR`        | Directory for learned ranking model checkpoints                               | —                       |

***

## Auto-Detection (Read-Only)

These are set by IDEs and read by AMFS for agent identity detection. You don't set these yourself.

| Variable              | Set By           | Used For                             |
| :-------------------- | :--------------- | :----------------------------------- |
| `CURSOR_SESSION_ID`   | Cursor           | Detecting Cursor environment         |
| `VSCODE_PID`          | VS Code / Cursor | Detecting VS Code/Cursor environment |
| `CLAUDE_CODE_SESSION` | Claude Code      | Detecting Claude Code environment    |

***

## Self-Hosted Only

These variables are for self-hosted AMFS deployments. You don't need them on the managed platform.

| Variable                       | Description                                    | Default                 |
| :----------------------------- | :--------------------------------------------- | :---------------------- |
| `AMFS_POSTGRES_DSN`            | Postgres connection string                     | —                       |
| `AMFS_DATA_DIR`                | Filesystem data directory                      | `.amfs`                 |
| `AMFS_S3_BUCKET`               | S3 bucket name                                 | —                       |
| `AMFS_S3_PREFIX`               | S3 object key prefix                           | `amfs/`                 |
| `AMFS_S3_ENDPOINT`             | Custom S3 endpoint (ACS, MinIO, R2)            | —                       |
| `AWS_DEFAULT_REGION`           | AWS region                                     | `us-east-1`             |
| `AWS_ACCESS_KEY_ID`            | AWS access key                                 | —                       |
| `AWS_SECRET_ACCESS_KEY`        | AWS secret key                                 | —                       |
| `AMFS_HTTP_HOST`               | HTTP server bind host                          | `0.0.0.0`               |
| `AMFS_HTTP_PORT`               | HTTP server bind port                          | `8080`                  |
| `AMFS_API_KEYS`                | Comma-separated API keys (self-hosted auth)    | —                       |
| `AMFS_CORS_ORIGINS`            | CORS allowed origins                           | `*`                     |
| `AMFS_CONNECTOR_{NAME}_SECRET` | HMAC secret for webhook connector verification | —                       |
| `AMFS_CORTEX_DEBOUNCE_MS`      | Digest recompilation debounce (ms)             | `3000`                  |
| `AMFS_PRO_URL`                 | Pro API URL for hybrid deployments             | —                       |
| `AMFS_PRO_API_KEY`             | API key for the Pro API                        | —                       |
| `AMFS_API_URL`                 | Dashboard: AMFS server URL (server-side)       | `http://localhost:8080` |
| `NEXT_PUBLIC_AMFS_API_URL`     | Dashboard: AMFS server URL (client-side)       | —                       |
| `AMFS_ROOT`                    | Dashboard: path to `.amfs` directory           | —                       |
| `AMFS_DEMO`                    | Dashboard: force demo mode                     | `false`                 |
| `AMFS_TEST_PG_DSN`             | Postgres DSN for integration tests             | —                       |
