Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Latest commit

 

History

History
443 lines (358 loc) · 18.1 KB

configuration.md

File metadata and controls

443 lines (358 loc) · 18.1 KB

Configuration

AMM can be configured via environment variables or configuration files (JSON/TOML).

Config File Locations

AMM loads configuration in the following order:

  1. Defaults: Hardcoded in the binary.
  2. User Config: ~/.amm/config.json or ~/.amm/config.toml (first file found wins).
  3. Environment Variables: Overrides file/default settings.

Environment Variables

Core & Storage

Variable Description Default
AMM_STORAGE_BACKEND sqlite or postgres sqlite
AMM_DB_PATH Path to the SQLite database file ~/.amm/amm.db
AMM_POSTGRES_DSN PostgreSQL connection string (unset)

HTTP Server

Variable Description Default
AMM_HTTP_ADDR HTTP server listen address :8080
AMM_HTTP_CORS_ORIGINS Comma-separated list of allowed CORS origins (unset)
AMM_HTTP_READ_TIMEOUT_SECONDS HTTP server read timeout 30
AMM_HTTP_WRITE_TIMEOUT_SECONDS HTTP server write timeout 60
AMM_HTTP_IDLE_TIMEOUT_SECONDS HTTP server idle timeout 120
AMM_API_KEY Static API key for HTTP server authentication. When set, all HTTP API requests (except /healthz, /v1/status, /openapi.json, /swagger/) must include the key via Authorization: Bearer <key> or X-API-Key: <key> header. (unset)
AMM_API_URL Base URL for API-mode example integrations (for example the Hermes plugin example and other shipped HTTP hooks). Not consumed directly by the AMM binaries themselves. (unset)

Retrieval

Variable Description Default
AMM_DEFAULT_LIMIT Default result limit for non-ambient recall 10
AMM_AMBIENT_LIMIT Result limit for ambient recall mode 5
AMM_ENABLE_SEMANTIC Enable semantic vector scoring in recall (requires embeddings to be enabled and populated) false
AMM_ENABLE_EXPLAIN Enable explain-recall signal breakdowns true
AMM_MAX_EXPAND_DEPTH Maximum recursive delegation depth for Expand calls 1
AMM_TEMPORAL_ATTENUATION Score multiplier for recall items outside the active temporal window (0.0-1.0) 0.3

Privacy

Variable Description Default
AMM_DEFAULT_PRIVACY Default privacy level for new memories (private, shared, public_safe) private

Maintenance (Background Jobs)

Variable Description Default
AMM_AUTO_REFLECT Automatically run reflect job after event ingestion true
AMM_AUTO_COMPRESS Automatically run compress job true
AMM_AUTO_CONSOLIDATE Automatically run consolidate job true
AMM_AUTO_DETECT_CONTRADICTIONS Automatically run contradiction detection true

Compression

Variable Description Default
AMM_ESCALATION_DETERMINISTIC_MAX_CHARS Maximum characters for the Level-3 deterministic truncation fallback in the compression pipeline 2048

Intake Quality Gates

Controls minimum thresholds for memory creation. Candidates below these thresholds are rejected at intake, before storage.

Variable Description Default
AMM_MIN_CONFIDENCE_FOR_CREATION Minimum confidence score (0.0–1.0) for a memory candidate to be persisted 0.50
AMM_MIN_IMPORTANCE_FOR_CREATION Minimum importance score (0.0–1.0) for a memory candidate to be persisted 0.30

Important: Heuristic extraction (used when no LLM is configured) produces candidates at confidence 0.45, which is below the default gate of 0.50. This means heuristic-only memories are not stored by default. If you run AMM without an LLM summarizer endpoint, lower the confidence gate:

AMM_MIN_CONFIDENCE_FOR_CREATION=0.4   # Allow heuristic extractions through

Set both to 0 to disable intake filtering entirely.

Summarizer (LLM Extraction & Reflection)

Set AMM_SUMMARIZER_ENDPOINT and AMM_SUMMARIZER_API_KEY to enable LLM-backed memory extraction, NER entity extraction, and relationship inference. Without these, AMM falls back to heuristic extraction.

Variable Description Default
AMM_SUMMARIZER_ENDPOINT Base URL for OpenAI-compatible API (e.g. https://api.openai.com/v1) (unset)
AMM_SUMMARIZER_API_KEY API key for the extraction/summarization model (unset)
AMM_SUMMARIZER_MODEL Model name for extraction and summarization gpt-4o-mini
AMM_SUMMARIZER_TIMEOUT_SECONDS HTTP client timeout for LLM summarizer/review calls 300 (5 min)
AMM_SUMMARIZER_REASONING Send reasoning: {"enabled": true} to the LLM. Set to enabled to activate; any other value (or empty) omits the field. Use for models that only support the simple toggle. (empty)
AMM_SUMMARIZER_REASONING_EFFORT Send reasoning: {"effort": "..."} to the LLM (low, medium, high). Empty omits. Takes precedence over AMM_SUMMARIZER_REASONING when both are set. (empty)
AMM_REPROCESS_BATCH_SIZE Number of events per reprocess/summarization batch 20
AMM_REFLECT_BATCH_SIZE Number of events claimed per reflect iteration 100
AMM_REFLECT_LLM_BATCH_SIZE Number of claimed reflect events sent to each LLM analysis call 20
AMM_COMPRESS_CHUNK_SIZE Events per chunk for history compression 10
AMM_COMPRESS_MAX_EVENTS Maximum events to compress per job run 200
AMM_COMPRESS_MIN_EVENTS Minimum pending events required to trigger compression. Replaces the previous 24h cooldown. compress_chunk_size * 5 (i.e. 50)
AMM_COMPRESS_BATCH_SIZE Number of chunks per LLM compress batch 15
AMM_TOPIC_BATCH_SIZE Number of topic groups per LLM summarize batch 15
AMM_LIFECYCLE_REVIEW_BATCH_SIZE Number of memories per lifecycle review batch 50
AMM_CROSS_PROJECT_SIMILARITY_THRESHOLD Minimum similarity score for cross-project memory transfer 0.7

Reasoning Configuration

The reasoning and reasoning_effort parameters are independent tunables that control the reasoning object sent to the LLM API. Different models/providers support different subsets of this object:

Model behavior Set reasoning Set reasoning_effort API sends
Supports only the simple toggle (some OpenRouter models) enabled (leave empty) "reasoning": {"enabled": true}
Supports only effort levels (OpenAI o-series) (leave empty) low / medium / high "reasoning": {"effort": "high"}
Supports both enabled low / medium / high "reasoning": {"effort": "high"} (effort wins)
Neither / unknown (leave empty) (leave empty) (field omitted)

When both are set, reasoning_effort takes precedence since it's more specific. Setting an unsupported parameter may cause API errors. When in doubt, leave both empty — AMM will omit the reasoning field entirely.

The same split applies to the review model via AMM_REVIEW_REASONING and AMM_REVIEW_REASONING_EFFORT.

Review Model (Optional Separate LLM for Review/Lifecycle)

A separate model can be used for lifecycle review, consolidation, and contradiction detection. Defaults to the summarizer model if unset.

Variable Description Default
AMM_REVIEW_ENDPOINT Base URL for the review model API (falls back to AMM_SUMMARIZER_ENDPOINT)
AMM_REVIEW_API_KEY API key for the review model (falls back to AMM_SUMMARIZER_API_KEY)
AMM_REVIEW_MODEL Model name for review/consolidation tasks (falls back to AMM_SUMMARIZER_MODEL)
AMM_REVIEW_REASONING Send reasoning: {"enabled": true} to the review model. Set to enabled to activate; any other value omits. (empty)
AMM_REVIEW_REASONING_EFFORT Send reasoning: {"effort": "..."} to the review model (low, medium, high). Empty omits. Takes precedence over AMM_REVIEW_REASONING when both are set. (empty)

Embeddings (Semantic Search)

Set AMM_EMBEDDINGS_ENABLED=true to generate/store embeddings. Semantic scoring at recall time is separately controlled by AMM_ENABLE_SEMANTIC. Supports any OpenAI-compatible embeddings API (OpenAI, Ollama, OpenRouter, etc.).

Variable Description Default
AMM_EMBEDDINGS_ENABLED Enable vector embedding generation/storage false
AMM_EMBEDDING_TIMEOUT_SECONDS HTTP client timeout for embedding API calls 30
AMM_EMBEDDINGS_ENDPOINT Base URL for OpenAI-compatible embeddings API (unset)
AMM_EMBEDDINGS_API_KEY API key for the embeddings provider (unset)
AMM_EMBEDDINGS_MODEL Embedding model name text-embedding-3-small
AMM_EMBEDDINGS_PROVIDER Provider label (informational, e.g. openai, ollama) (unset)
AMM_EMBEDDING_BATCH_SIZE Number of objects per embedding batch 64

JSON Configuration Example

Full reference — all supported keys shown with their defaults:

{
  "storage": {
    "backend": "sqlite",
    "db_path": "~/.amm/amm.db",
    "postgres_dsn": ""
  },
  "http": {
    "addr": ":8080",
    "cors_origins": "",
    "read_timeout_seconds": 30,
    "write_timeout_seconds": 60,
    "idle_timeout_seconds": 120
  },
  "api": {
    "url": "",
    "key": ""
  },
    "retrieval": {
      "default_limit": 10,
      "ambient_limit": 5,
      "enable_semantic": false,
      "enable_explain": true,
      "temporal_attenuation": 0.3
    },
    "max_expand_depth": 1,
  "privacy": {
    "default_privacy": "private"
  },
  "maintenance": {
    "auto_reflect": true,
    "auto_compress": true,
    "auto_consolidate": true,
    "auto_detect_contradictions": true
  },
  "compression": {
    "escalation_deterministic_max_chars": 2048
  },
  "summarizer": {
    "endpoint": "https://api.openai.com/v1",
    "api_key": "sk-...",
    "model": "gpt-4o-mini",
    "timeout_seconds": 300,
    "reasoning": "",
    "reasoning_effort": "",
    "review_endpoint": "https://api.openai.com/v1",
    "review_api_key": "sk-...",
    "review_model": "gpt-4o",
    "review_reasoning": "",
    "review_reasoning_effort": "",
    "reprocess_batch_size": 20,
    "reflect_batch_size": 100,
    "reflect_llm_batch_size": 20,
    "lifecycle_review_batch_size": 50,
    "compress_chunk_size": 10,
    "compress_max_events": 200,
    "compress_min_events": 50,
    "compress_batch_size": 15,
    "topic_batch_size": 15,
    "embedding_batch_size": 64,
    "cross_project_similarity_threshold": 0.7,
    "embedding_timeout_seconds": 30
  },
  "intake_quality": {
    "min_confidence_for_creation": 0.50,
    "min_importance_for_creation": 0.30
  },
  "embeddings": {
    "enabled": true,
    "provider": "openai",
    "endpoint": "https://api.openai.com/v1",
    "api_key": "sk-...",
    "model": "text-embedding-3-small"
  }
}

TOML Configuration Example

Full reference — all supported keys shown with their defaults:

[storage]
backend = "sqlite"
db_path = "~/.amm/amm.db"
# postgres_dsn = "postgres://user:pass@localhost:5432/amm?sslmode=disable"

[http]
addr = ":8080"
# cors_origins = "*"
# read_timeout_seconds = 30
# write_timeout_seconds = 60
# idle_timeout_seconds = 120

[api]
# key = "your-static-api-key"
# url = "http://remote-amm:8080"

[retrieval]
default_limit = 10
ambient_limit = 5
enable_semantic = false
enable_explain = true

max_expand_depth = 1

[privacy]
default_privacy = "private"

[maintenance]
auto_reflect = true
auto_compress = true
auto_consolidate = true
auto_detect_contradictions = true

[compression]
# Maximum characters for the Level-3 deterministic truncation fallback.
# Env: AMM_ESCALATION_DETERMINISTIC_MAX_CHARS
escalation_deterministic_max_chars = 2048

[summarizer]
endpoint = "https://api.openai.com/v1"
api_key = "sk-..."
model = "gpt-4o-mini"
# timeout_seconds = 300
# reasoning = ""
# reasoning_effort = ""
# review_endpoint = "https://api.openai.com/v1"
# review_api_key = "sk-..."
# review_model = "gpt-4o"
# review_reasoning = ""
# review_reasoning_effort = ""
reprocess_batch_size = 20
reflect_batch_size = 100
reflect_llm_batch_size = 20
lifecycle_review_batch_size = 50
compress_chunk_size = 10
compress_max_events = 200
compress_min_events = 50
compress_batch_size = 15
topic_batch_size = 15
embedding_batch_size = 64
cross_project_similarity_threshold = 0.7
# embedding_timeout_seconds = 30

[intake_quality]
min_confidence_for_creation = 0.50
min_importance_for_creation = 0.30

[embeddings]
enabled = true
provider = "openai"
endpoint = "https://api.openai.com/v1"
api_key = "sk-..."
model = "text-embedding-3-small"

Ollama Example (local embeddings)

[summarizer]
endpoint = "https://api.openai.com/v1"
api_key = "sk-..."
model = "gpt-4o-mini"

[embeddings]
enabled = true
provider = "ollama"
endpoint = "http://localhost:11434/v1"
api_key = "ollama"
model = "nomic-embed-text"

Ingestion Policies

Ingestion policies control how events are processed at ingestion time. They are stored in the database and persist across restarts.

Policy Modes

Mode Behavior
full Store event and extract memories from it
read_only Store event but skip memory extraction
ignore Drop the event entirely — not stored, not processed

Pattern Types

Policies match events by different fields:

Pattern Type Matches Against
kind Event kind (e.g., message_user, tool_call, tool_result)
session Session identifier
source Source system identifier
surface Surface/interface identifier
agent Agent identifier
project Project identifier
runtime Runtime identifier

Match Modes

Match Mode Description
exact Exact string match
glob Glob pattern (e.g., tool_*)
regex Regular expression

Priority

When multiple policies match the same event, the policy with the highest priority value wins. Explicit policies override the built-in noise heuristics.

Recommended Policies

Strongly recommended for all deployments: Ignore tool_call and tool_result events.

amm policy-add --pattern-type kind --pattern "tool_call" --mode ignore --match-mode exact --priority 100
amm policy-add --pattern-type kind --pattern "tool_result" --mode ignore --match-mode exact --priority 100

Why: Without these policies, the extraction pipeline treats raw tool invocation JSON as meaningful content. Tool calls contain patch text, shell commands, API payloads, and other machine-generated artifacts that the LLM extractor misinterprets as facts, decisions, or constraints. This produces large numbers of low-quality memories that pollute recall results and waste processing resources.

The meaningful information from tool interactions is already captured in message_user and message_assistant events, where agents describe what they did, what they found, and why. Ignoring the raw tool JSON removes noise without losing signal.

Built-in Noise Heuristics

AMM has built-in heuristics that auto-downgrade certain events to read_only:

  • tool_result events
  • Self-referential AMM tool_call events
  • Large JSON blobs
  • Build/test logs
  • File listings and diffs

Explicit ignore policies are stricter than these heuristics — they drop events entirely before the extraction pipeline ever sees them.

Managing Policies

# List all active policies
amm policy-list

# Add a policy
amm policy-add --pattern-type kind --pattern "tool_call" --mode ignore --match-mode exact --priority 100

# Remove a policy by ID
amm policy-remove <policy-id>

Additional Policy Examples

# Ignore all tool-related events using a glob pattern
amm policy-add --pattern-type kind --pattern "tool_*" --mode ignore --match-mode glob

# Ignore events from a noisy source system
amm policy-add --pattern-type source --pattern "noisy-ci-bot" --mode ignore

# Store but don't extract from a specific session
amm policy-add --pattern-type session --pattern "debug-session-123" --mode read_only

Compression Behaviour

Compression triggers when at least compress_min_events events are pending past the compression frontier (AMM_COMPRESS_MIN_EVENTS, default: compress_chunk_size * 5, i.e. 50). A 60-second rate-limit cooldown prevents back-to-back runs on rapid cron ticks. compress_min_events is clamped against compress_max_events so misconfiguration cannot permanently stall compression.

The compression pipeline uses three-level escalation to guarantee convergence. All body summarization calls follow this fallback chain:

  1. Level 1 (Normal): LLM summarize at maxChars target. Used if output is non-empty and shorter than input.
  2. Level 2 (Aggressive): LLM summarize at maxChars/2 target. Used if level 1 failed to reduce.
  3. Level 3 (Deterministic): Truncate to min(len, maxChars, escalation_deterministic_max_chars) and append [Truncated from N chars]. Always succeeds. No LLM call.

escalation_deterministic_max_chars defaults to 2048 and is configurable via AMM_ESCALATION_DETERMINISTIC_MAX_CHARS or [compression].escalation_deterministic_max_chars.

The summaries table includes a depth field:

  • depth=0 — leaf summaries (cover raw events) or session summaries
  • depth=1 — topic/condensed summaries (cover leaf summaries)
  • depth=2+ — reserved for future higher condensed levels

Scoring Signals

Recall ranking is determined by a weighted sum of multiple signals:

  • Lexical: Keyword match score (FTS5/BM25).
  • Semantic: Vector similarity score (requires embeddings enabled).
  • Entity Overlap: Matches against known entities in the knowledge graph, with hub dampening.
  • Recency: Boosts newer information.
  • Importance: Weighted by assigned importance (manual or LLM-extracted).
  • Freshness: Computed at query time from temporal fields; decays over a 14-day half-life.
  • Temporal Validity: Filters and scores by valid_from/valid_to window.
  • Source Trust: Reliability multiplier for the originating system.
  • Structural Proximity: Boosts items closely linked to source history.
  • Repetition Penalty: Dampens items recently surfaced in the same session.