Repository navigation
Configuration Environment Variables
Complete guide to configuring Spector via environment variables, container secrets, Java system properties, and low-level JVM runtime flags. Learn the canonical mapping rules, convenience aliases, and production security patterns.
warning: Breaking change —
spector.memory.dimensionshas been removed
Embedding dimensionality now has a single source: **`spector.provider.embedding.dimensions`**
(`SPECTOR_PROVIDER_EMBEDDING_DIMENSIONS`). The cognitive memory derives its record and index width
from that value; it is no longer separately configurable.
Previously the two properties were read independently with no precedence between them, so they
could disagree — and in the shipped defaults they did, with `spector.memory.dimensions: 384`
against `spector.provider.embedding.dimensions: 768`.
**Setting `spector.memory.dimensions` now fails at startup** with a message naming the
replacement, rather than being silently ignored.
| If you set | Action |
|:---|:---|
| `SPECTOR_EMBEDDING_DIMS` | Nothing. It now maps only to the canonical provider variable. |
| `SPECTOR_MEMORY_DIMENSIONS` | Rename to `SPECTOR_PROVIDER_EMBEDDING_DIMENSIONS`. |
| `spector.memory.dimensions` in YAML | Move the value to `spector.provider.embedding.dimensions` and delete the old key. |
| `-Dspector.memory.dimensions` | Rename to `-Dspector.provider.embedding.dimensions`. |
| Docker, Helm or Terraform defaults | Nothing. All three set `SPECTOR_EMBEDDING_DIMS`. |
Spector's configuration loader (SpectorConfigSource) automatically translates any configuration property from spector.yml into a canonical environment variable using three simple rules:
-
Prefix: Every property begins with
SPECTOR_. -
Path Replacement: Nested YAML dots (
.) and kebab-case hyphens (-) become underscores (_). - Casing: All characters are converted to uppercase.
spector.yml Dot Path |
Canonical Environment Variable | Example Value |
|---|---|---|
spector.mode |
SPECTOR_MODE |
MEMORY |
spector.provider.embedding.dimensions |
SPECTOR_PROVIDER_EMBEDDING_DIMENSIONS |
768 |
spector.memory.persistence-path |
SPECTOR_MEMORY_PERSISTENCE_PATH |
/data/memory |
spector.provider.embedding.type |
SPECTOR_PROVIDER_EMBEDDING_TYPE |
openai |
spector.provider.embedding.api-key |
SPECTOR_PROVIDER_EMBEDDING_API_KEY |
sk-proj-xxxx |
spector.provider.generation.model |
SPECTOR_PROVIDER_GENERATION_MODEL |
llama3.2 |
spector.hnsw.ef-construction |
SPECTOR_HNSW_EF_CONSTRUCTION |
300 |
spector.circadian.time-trigger |
SPECTOR_CIRCADIAN_TIME_TRIGGER |
2h |
spector.icnu.weight-novelty |
SPECTOR_ICNU_WEIGHT_NOVELTY |
0.45 |
Note
Because this rule is dynamic and universal, any configuration property listed in the spector.yml Master Reference can be supplied via an environment variable without needing special code handlers.
To simplify Docker commands, Kubernetes manifests, and CLI scripts, Spector's container entrypoint (entrypoint.sh) and Spring auto-configuration support short, memorable convenience aliases.
If an alias is defined and its canonical equivalent is empty, the alias value is automatically promoted to the canonical configuration key during startup:
| Short Alias | Canonical Config Property / Variable | Description |
|---|---|---|
SPECTOR_EMBEDDING_PROVIDER |
SPECTOR_PROVIDER_EMBEDDING_TYPE |
Embedding provider adapter (ollama, openai, etc.) |
SPECTOR_EMBEDDING_MODEL |
SPECTOR_PROVIDER_EMBEDDING_MODEL |
Embedding model identifier (nomic-embed-text) |
SPECTOR_EMBEDDING_BASE_URL |
SPECTOR_PROVIDER_EMBEDDING_BASE_URL |
Endpoint URL for remote embedding provider |
SPECTOR_EMBEDDING_API_KEY |
SPECTOR_PROVIDER_EMBEDDING_API_KEY |
API secret key for embedding provider |
SPECTOR_EMBEDDING_DIMS |
SPECTOR_PROVIDER_EMBEDDING_DIMENSIONS |
Embedding dimensionality. The cognitive memory derives its record width from this single value; there is no separate memory dimensions property |
SPECTOR_EMBEDDING_TIMEOUT |
SPECTOR_PROVIDER_EMBEDDING_TIMEOUT |
Embedding request timeout (30s, 1m) |
SPECTOR_GENERATION_PROVIDER |
SPECTOR_PROVIDER_GENERATION_TYPE |
Text generation provider adapter |
SPECTOR_GENERATION_MODEL |
SPECTOR_PROVIDER_GENERATION_MODEL |
Generation model identifier (llama3.2) |
SPECTOR_GENERATION_BASE_URL |
SPECTOR_PROVIDER_GENERATION_BASE_URL |
Endpoint URL for text generation provider |
SPECTOR_GENERATION_API_KEY |
SPECTOR_PROVIDER_GENERATION_API_KEY |
API secret key for text generation provider |
SPECTOR_PORT |
spector.port (server port) |
HTTP API listen port (default: 7070) |
SPECTOR_DATA_DIR |
spector.memory.persistence-path |
Root directory for vector indexes and memory partitions |
SPECTOR_NODE_ID |
spector.cluster.node-id |
Unique instance identifier in a multi-node cluster |
SPECTOR_API_KEY |
spector.api-key |
Master API key required for client REST / MCP authentication |
SPECTOR_AUTH_JWT_SECRET |
spector.auth.jwt.secret |
HMAC-SHA256 secret key for signing auth tokens |
SPECTOR_NAMESPACE_TENANT_ROOTED |
spector.namespace.tenant-rooted.enabled |
Enable tenant-rooted namespace directory sharding (ADR-0033) |
SPECTOR_NAMESPACE_DUAL_READ |
spector.namespace.dual-read.enabled |
Enable dual-read fallback during layout migration window |
In production environments, storing sensitive credentials (such as OpenAI, Anthropic, or Azure API keys) in plain-text environment variables poses security risks (visible in docker inspect and /proc/$PID/environ).
Spector natively supports Docker Secrets and Kubernetes Secret volume mounts at /run/secrets/. During container startup, entrypoint.sh automatically detects and exports secrets mounted in this directory:
/run/secrets/
├── spector_embedding_api_key → Exports to SPECTOR_EMBEDDING_API_KEY
├── spector_generation_api_key → Exports to SPECTOR_GENERATION_API_KEY
├── spector_api_key → Exports to SPECTOR_API_KEY
└── spector_auth_jwt_secret → Exports to SPECTOR_AUTH_JWT_SECRET
version: '3.8'
services:
spector:
image: ghcr.io/spectrayan/spector:latest
ports:
- "8080:8080" # Cortex UI & API Proxy
- "7070:7070" # Synapse REST API
environment:
- SPECTOR_EMBEDDING_PROVIDER=openai
- SPECTOR_EMBEDDING_MODEL=text-embedding-3-small
- SPECTOR_EMBEDDING_DIMS=1536
secrets:
- spector_embedding_api_key
- spector_api_key
volumes:
- spector-data:/data
secrets:
spector_embedding_api_key:
file: ./secrets/openai_key.txt
spector_api_key:
file: ./secrets/spector_token.txt
volumes:
spector-data:Any configuration key can be passed to the JVM runtime as a standard system property. System properties take precedence over environment variables:
java \
--enable-preview --add-modules=jdk.incubator.vector --enable-native-access=ALL-UNNAMED \
-Dspector.provider.embedding.dimensions=768 \
-Dspector.memory.capacity=500000 \
-Dspector.provider.embedding.type=ollama \
-jar spector-synapse.jarSpector leverages Java 23+ Project Panama (Foreign Function & Memory API - JEP 454) and the Vector API (JEP 448) to achieve zero-GC off-heap vector search with native SIMD instructions (AVX-512, AVX2, ARM Neon).
Because these features utilize incubator modules and off-heap memory access, the JVM must be launched with the following arguments:
--enable-preview --add-modules=jdk.incubator.vector --enable-native-access=ALL-UNNAMED| JVM Argument | Purpose | Why It Is Mandatory |
|---|---|---|
--enable-preview |
Unlocks preview language and runtime features. | Required by Java 23/24 for incubating Panama memory structures. |
--add-modules=jdk.incubator.vector |
Loads the hardware SIMD vector accelerator module. | Enables vectorized dot product, cosine, and L2 distance computations. Without it, Spector falls back to slower scalar loops. |
--enable-native-access=ALL-UNNAMED |
Grants unrestricted off-heap memory mapping permissions. | Enables Arena.ofShared() and zero-copy MemorySegment off-heap memory-mapped files (vectors.mmap). |
Important
The official Spector Docker image (ghcr.io/spectrayan/spector) configures these flags automatically inside entrypoint.sh. If you build your own containers or run bare-metal JARs, you must include these flags in JAVA_OPTS.
When managing millions of vector records via memory-mapped off-heap segments (vectors.mmap), the host operating system's default memory-map and file-descriptor limits will cause OutOfMemoryError: Map failed or IOException: Too many open files if not adjusted.
# /etc/sysctl.d/99-spector.conf
vm.max_map_count=262144
fs.file-max=1048576Apply immediately on Linux host nodes:
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w fs.file-max=1048576For bare-metal and systemd services, raise the process descriptor limits for the spector user:
spector soft nofile 65536
spector hard nofile 1048576
spector soft memlock unlimited
spector hard memlock unlimitedIn Kubernetes environments, the official Spector Helm chart automatically applies vm.max_map_count and fs.file-max using a privileged initContainer. See the Deployment & Cloud Config Guide for full Helm values.
- Home
-
Getting Started
- Quick Start
- Installation
- Developer Guide
- JDK API Status
- MCP Server
- Java SDK
- Java API Reference
- Python SDK
- TypeScript SDK
- Spring AI Integration
- CLI Reference
- REST API
- API Playground
- Error Codes
- Configuration
- Deployment
-
Cognitive Memory
- Overview
- Getting Started
- Use Cases
- API Reference
- Concepts
- Pathways
- Scoring features
- Profiles
- Experimental
- Internals
- Design ancestry
-
Memory Kernel
- Overview
- Bundle Architecture
- Memory Shapes
- Binary Layouts & Tags
- WAL & Durability
-
Region Reference
- Overview & Index
- Partition Regions
-
Runtime Regions
- Working Memory
- Co-Activation Matrix
- Index MIDX
- Index IDPL
- Hebbian Graph
- Temporal Chains
- Temporal Facts
- Entity Directory
- Entity Names Pool
- HyperEntity Graph
- Entity Types Registry
- Relation Types Registry
- BM25 Lexical Index
- Checkpoint
- Insula (Somatic Self-Model)
- Continuity
- Provenance
- SPLADE Sparse Index
- Entity Reverse Index
- Identity Regions
- Synapse & Cortex
-
Architecture
- System Overview
- Core Concepts
- Ingestion Pipeline
- MCP Integration
- Distributed Mode
- Event Notifications
- Namespace Sharding
- Single-Namespace Scale & Capacity Limits
- Scale Benchmark Empirical Results
- Writer Quiesce Pause Empirical Results
- Kill-Owner Failover Empirical Results
- Salience & Importance Architecture
- GPU Acceleration
- Performance Tuning
- Test Framework & LLM Judge
- Chat & Visual Test Infrastructure
- Security & Data
-
Architecture Decision Records (ADRs)
- Overview
- Template
- Master Catalog (0001-0085)
-
Memory Kernel & Storage Formats
- ADR-0001: Graph Compression Strategy for Entity Graph
- ADR-0002: Multi-Partition Recall Fan-Out & Frozen Reten...
- ADR-0003: Completing Hypergraph Entity-Graph Graduation
- ADR-0004: Mmap Bundle Architecture & File Descriptor Sc...
- ADR-0005: spector-memory Technical Debt Hardening
- ADR-0042: Graph Recall Architecture and Cognitive Trave...
- ADR-0043: Single-VMA Bundle Layout Specification
- ADR-0044: Memory Kernel Isolation, Composition, and Layout
- ADR-0045: Spector Memory Import & Export Pipeline
- ADR-0046: Single Engram, Four Stores Storage Architecture
- ADR-0047: Episodic Memory and Engram Model Hierarchy
- ADR-0057: Remediation of Hardcoded Memory Offsets and Alignment Constants
- ADR-0062: Spector Memory Organization — Three-Plane Architecture
- ADR-0082: Index Plane Lifecycle, Derived Views, and Reconciliation
-
Active Inference Self-Model Engine (AISME)
- ADR-0006: Episodic Conversation Architecture
- ADR-0007: ReflectPathway — Biological Sleep Consolidation
- ADR-0008: Cognitive Substrate Evolution (TANGLE, GPM, M...
- ADR-0009: AISME Phase 1 — Homeostatic Affective Core
- ADR-0010: AISME Phase 2 — Free-Energy Guided Recall
- ADR-0011: AISME Phase 3 — Modern Hopfield Associative M...
- ADR-0012: AISME Phase 4 — Neural Manifold Distance (NMD)
- ADR-0013: AISME Phase 5 — Predictive Coding Narrative Self
- ADR-0014: AISME Phase 6 — Consciousness Continuity Metr...
- ADR-0015: AISME Phase 7 — Synaptic Relay Wiring & Pathw...
- ADR-0016: AISME Phase 8 — Closed-Loop Epistemic Learning
- ADR-0017: AISME Phase 9 — Generative Counterfactuals & ...
- ADR-0018: AISME Phase 10 — WanderPathway & Kernel Conti...
- ADR-0019: AISME Phase 11 — Expected Free Energy Policy ...
- ADR-0020: AISME Phase 12 — Continuous Self-Dynamics
- ADR-0023: AISME Complete Loop Closure & CognitiveVector...
- ADR-0024: Polymorphic SoulContext Hierarchy in AISME
- ADR-0027: Soul-Conditioned & Salience-Modulated Persona...
- ADR-0048: Cross-Capture Graph & CoActivation Kernel
- ADR-0049: Identity Trajectory Lyapunov Stability
- ADR-0050: Event Density Gating and Dynamic Epistemic Co...
- ADR-0051: Bayesian Online Change-Point Episode Segmenta...
- ADR-0052: Differential Privacy and Edge Anonymization
- ADR-0053: Multimodal Composite Importance Scoring
- ADR-0054: Lifespan-Adaptive Forgetting & Retention Kernel
- ADR-0055: LSR & RFF Dense Associative Memory Engineerin...
- ADR-0056: Log-Sum-ReLU (LSR) & Random Fourier Features ...
- ADR-0058: Linguistic & Vocal Prosody Expression Engine
- ADR-0063: Spacetime Vector Search and Synaptic Relay Architecture
- ADR-0064: Spacetime Simulation on Wander, Dream, and Express Pathways
- ADR-0071: Remember Cognitive Pathway Architecture
- ADR-0072: Six-Phase Fused Cognitive Scoring Pipeline
- ADR-0073: Recall Cognitive Pathway and Multi-Phase Retrieval Architecture
- ADR-0074: Reflect Cognitive Pathway and Sleep Consolidation Architecture
- ADR-0078: Salience Network and Thalamic Cognitive Profiles Architecture
-
Platform, Synapse & Clustering
- ADR-0021: Nucleus Symmetric Hardware Abstraction Layer ...
- ADR-0022: Embodied Kinesics & Phenomenological MCP Engine
- ADR-0025: Declarative MCP Tool Definitions via JSON Sch...
- ADR-0026: Dual-Plane Concurrency & Async Queue Backpres...
- ADR-0028: Dual-Plane Memory Audit Architecture (Separat...
- ADR-0029: Episodic→Semantic Lineage Provenance Region
- ADR-0030: Unified Engram Encoding Header Architecture
- ADR-0031: Unified Configuration Architecture & Bypass E...
- ADR-0032: Persona Enactment — Soul as Policy over Memory
- ADR-0033: Decoupling Cognitive & Mathematical Kernels t...
- ADR-0034: Cell Topology, Namespace Ownership, and HA Cl...
- ADR-0035: Cognitive Pathway Framework Rearchitecture
- ADR-0036: Pathway Error Handling, Isolation, and Circui...
- ADR-0037: Ingestion Boundary and Sensory Relocation
- ADR-0038: SIMD-Accelerated BM25 Lexical Scoring Optimiz...
- ADR-0039: Robust Unified Rate Limiting Architecture
- ADR-0040: Universal Apache Camel Messaging Channels
- ADR-0041: Unified Connector Architecture for Ingestion
- ADR-0059: Java 27 Upgrade Strategy and Value Class Migration
- ADR-0060: Cognitive Continuity Layer and Decoded Mind Streams
- ADR-0061: In-Memory Multi-Tenant Quartz Scheduler
- ADR-0065: Client SDK Architecture, OpenAPI, and MCP Integration
- ADR-0066: Engine & CLI Stabilization — Issue #727 Hardening
- ADR-0067: Cell-Based High Availability and Namespace-Sticky Sharding
- ADR-0068: Phileas PII Redaction Engine for Spector Synapse
- ADR-0069: Synapse-Owned Tool Access Policy
- ADR-0070: Unified Error Taxonomy and Exception Handling Architecture
- ADR-0075: Extensible LLM and Multimodal Embedding Provider SPI
- ADR-0076: Zero-Dependency Pluggable Cache Abstraction
- ADR-0077: Model B Asynchronous Task Queue and Concurrency
- ADR-0079: Asynchronous Memory Event and Telemetry Notification Bus
- ADR-0080: Observed Memory and Pathway Metrics Telemetry Architecture
- ADR-0081: Dedicated Reactive Ingress and In-Process Path Router
- ADR-0083: Namespace-Isolated Memory Analytics & Telemetry
- ADR-0084: Dual-Plane Conversation Persistence
- ADR-0085: Dynamic Synapse Configuration Overrides and Runtime Propagation
-
Modules Registry
- Overview
- Foundation Layer (/nucleus)
- Cognitive Layer (/memory)
- Gateway Layer (/synapse)
- Benchmarks & UI
- Deep Dives
-
Community
- Governance
- Contributing
- FAQ
- Glossary
- Roadmap
- 🔬 Labs
- Third-Party Legal