microscope-memory 1.2.0

Pure binary cognitive memory engine with REST API bridge for LLM integration. Zero-JSON core, mmap-based, hierarchical, sub-microsecond search.
Documentation
# Benchmark index for the 60 resonance facts, with the semantic path ON.
#
# bench_config.toml is not what the published comparison runs. That one sets
# semantic_weight = 0.0 and provider = "mock", so the index it builds
# contains no real vectors and the vector path returns nothing -- a measurement
# taken on it reports a lexical-only system. This file is the same benchmark
# corpus with a real MiniLM index, which is what the FAISS and sqlite rows in
# docs/measurements/real_embedding_comparison.json are compared against.
#
# Build:  MICROSCOPE_CONFIG=bench_config_semantic.toml microscope-mem build
# Measure: python scripts/compare_baselines.py --config bench_config_semantic.toml
# Microscope Memory Configuration Example
# Copy to config.toml and adjust paths.

[paths]
# Directory containing memory layer JSON files
layers_dir = "./bench_layers"

# Output directory for binary index files
output_dir = "./bench_output_semantic"

# Temporary directory for processing
temp_dir = "./bench_tmp"

[index]
# Block size in characters (fixed viewport)
block_size = 256

# Maximum depth levels (0-8)
max_depth = 8

# Header size in bytes
header_size = 32

# Automatically consolidate the hot append log into the main index.
auto_rebuild = true

# Trigger consolidation after this many pending entries.
auto_rebuild_entries = 250

# Maximum source entries per layer. Zero preserves the complete history.
layer_retention_entries = 2000  # bound each layer file; oldest entries are trimmed past this
max_blocks = 0                   # 0 = unbounded; >0 evicts lowest-score blocks when the index exceeds this
protect_min_importance = 8       # never evict blocks with importance >= this
promote_energy_threshold = 0.35  # dream auto-promotes blocks whose recall energy reaches this

[search]
# Default number of results
default_k = 10

# Zoom weight for 4D search
zoom_weight = 2.0

# Keyword boost factor
keyword_boost = 0.1

# Semantic blending weight (0.0 = pure hash coords, 1.0 = pure embedding coords)
# NOTE: 0.0 disables semantic ranking in 'recall'. Set to > 0.0 to enable hybrid search.
semantic_weight = 1.0
semantic_rank_gain = 2.0
# Emotional bias warp strength (0.0 = disabled, 0.0-1.0 = warp toward emotional centroid)
emotional_bias_weight = 0.0

[memory_layers]
# Configure which cognitive layers to include
layers = [
    "long_term",
    "short_term",
    "associative",
    "emotional",
    "relational",
    "reflections",
    "crypto_chain",
    "echo_cache",
    "rust_state"
]

[performance]
# Use memory mapping
use_mmap = true

# Cache size in MB
cache_size = 64

# Number of parallel workers for building
build_workers = 4

# Use GPU acceleration for soft search (requires --features gpu)
use_gpu = false

# Zstd compression for data.bin (requires --features compression)
compression = false

# Query cache TTL in seconds
cache_ttl_secs = 300

[embedding]
# Provider: "mock" (hash-based), "candle" (BERT), or "onnx" (ONNX Runtime)
provider = "candle"

# Model name (for candle/onnx providers)
model = "sentence-transformers/all-MiniLM-L6-v2"

# Embedding dimension
dim = 384

# Max depth to embed (deeper = more vectors, more disk).
# NOTE: D5-D8 (words/tokens) are usually too small for meaningful embeddings.
max_depth = 4

[server]
# HTTP server port
port = 6060
# Shared master secret for inbound HTTP auth. Empty = no auth (single-user
# localhost default). Required when binding on a non-loopback host.
# Two modes use the same secret:
#   X-API-Key: <secret>                     — shared-key mode (trusted team)
#   Authorization: Bearer <user_id>.<hmac>  — per-user identity; generate with
#     `microscope-mem token <user_id>` — the verified user_id is bound to the
#     caller, so a user can never read another user's scoped memories.
api_key = ""

# CORS origin
cors_origin = "*"

[logging]
# Log level: trace, debug, info, warn, error
level = "info"

# Log file path (optional)
file = "microscope.log"

# ─── Federation (optional) ───────────────────────────
# Uncomment and configure to enable multi-index federated search.
# Each federated index gets its own section.
#
# [[federation.indices]]
# name = "project_a"
# config_path = "/path/to/project_a/config.toml"
# weight = 1.0
#
# [[federation.indices]]
# name = "project_b"
# config_path = "/path/to/project_b/config.toml"
# weight = 0.8