contextkitDocs

Reference

Configuration reference

Every MemoryConfig field and default in outhad-contextkitai 0.1.4, generated from the release on PyPI.

Every field and default below is read from outhad-contextkitai 0.1.4 on PyPI and regenerated after each release. Pass any of these to Memory.from_config({...}) as nested dictionaries.

Memory

MemoryConfig

FieldTypeDefaultDescription
vector_storeVectorStoreConfigVectorStoreConfig()Configuration for the vector store
llmLlmConfigLlmConfig()Configuration for the language model
embedderEmbedderConfigEmbedderConfig()Configuration for the embedding model
history_db_pathstros.path.join(outhad_contextkit_dir, 'history.db')Path to the history database
graph_storeGraphStoreConfigGraphStoreConfig()Configuration for the graph
tcmgmTCMGMConfigTCMGMConfig()TCMGM (episodic memory: dated events and cause → effect links). Set up whenever graph_store is configured; ignored without one.
versionstr'v1.1'The version of the API
custom_fact_extraction_promptOptional[str]NoneCustom prompt for the fact extraction
custom_update_memory_promptOptional[str]NoneCustom prompt for the update memory
ppmfPPMFConfigPPMFConfig()Privacy-Preserving Memory Firewall configuration
chunkingChunkingConfigChunkingConfig()Configuration for document chunking (optional feature)
context_graphContextGraphConfigContextGraphConfig()Context-Graph Layer (CGL) configuration. Defaults to disabled; behaviour is byte-identical to legacy Memory when enabled=False.
msprMSPRConfigMSPRConfig()Multi-Stage Personalized Retrieval (MSPR) configuration. Opt-in; behaviour is byte-identical to pre-MSPR Memory when enabled=False.
tenantTenantConfigTenantConfig()Tenant + sub-tenant routing configuration. Opt-in; behaviour is byte-identical when enabled=False (default). See doc_extra/TENANT_AND_DECAY/IMPLEMENTATION_GUIDE.md.
decay_v2DecayV2ConfigDecayV2Config()Time-aware decay + immutable versioning (Part D). Opt-in; byte-identical when enabled=False (default). Layers decay_score, periodic scheduler, versioned updates, reference tracker, cold archival on top of CGL.
state_storeStateStoreConfigStateStoreConfig()Optional Postgres database for the opt-in layers' state (context graph, MSPR stores, cold storage). Default: local disk.

LLM

Set under llm in the config.

LlmConfig

FieldTypeDefaultDescription
providerstr'openai'Provider of the LLM (e.g., 'ollama', 'openai')
configOptional[dict]{}Configuration for the specific LLM

Embedder

Set under embedder in the config.

EmbedderConfig

FieldTypeDefaultDescription
providerstr'openai'Provider of the embedding model (e.g., 'ollama', 'openai')
configOptional[dict]{}Configuration for the specific embedding model

Vector store

Set under vector_store in the config.

VectorStoreConfig

FieldTypeDefaultDescription
providerstr'qdrant'Provider of the vector store (e.g., 'qdrant', 'chroma', 'upstash_vector')
configOptional[Dict]NoneConfiguration for the specific vector store

Graph store

Set under graph_store in the config.

GraphStoreConfig

FieldTypeDefaultDescription
providerstr'neo4j'Provider of the data store (e.g., 'neo4j', 'memgraph', 'neptune')
configUnion[Neo4jConfig, MemgraphConfig, NeptuneConfig]NoneConfiguration for the specific data store
llmOptional[LlmConfig]NoneLLM configuration for querying the graph store
custom_promptOptional[str]NoneCustom prompt to fetch entities from the given text

Neo4jConfig

FieldTypeDefaultDescription
urlOptional[str]NoneHost address for the graph database
usernameOptional[str]NoneUsername for the graph database
passwordOptional[str]NonePassword for the graph database
databaseOptional[str]NoneDatabase for the graph database
base_labelOptional[bool]NoneWhether to use base node label __Entity__ for all entities
max_connection_pool_sizeOptional[int]NoneMax parallel sessions per driver (Phase PT1). None = driver default (100).
connection_acquisition_timeoutOptional[float]NoneSeconds a session waits for a free connection before raising (Phase PT1). None = driver default.
max_connection_lifetimeOptional[int]NoneSeconds before a pooled connection is recycled (Phase PT1). None = driver default.

MemgraphConfig

FieldTypeDefaultDescription
urlOptional[str]NoneHost address for the graph database
usernameOptional[str]NoneUsername for the graph database
passwordOptional[str]NonePassword for the graph database

NeptuneConfig

FieldTypeDefaultDescription
endpointOptional[str](Field(None, description='Endpoint to connect to a Neptune Analytics Server as neptune-graph://<graphid>'),)
base_labelOptional[bool]NoneWhether to use base node label __Entity__ for all entities

Episodic memory (TCMGM)

Set under tcmgm in the config.

TCMGMConfig

Episodic memory on top of the graph store: dated events and cause → effect links.

FieldTypeDefaultDescription
enabledboolTrueSet up TCMGM when a graph store is configured. Set False to keep the entity graph but skip TCMGM. Has no effect without graph_store.
build_timeline_on_addboolFalseAlso turn the messages of every add(infer=True) into dated events and cause → effect links, as build_timeline does. Costs extra LLM calls and needs the neo4j graph store.
causal_extraction_modeLiteral['llm', 'rules', 'cascade']'llm'How cause → effect links are found: 'llm' asks the LLM, 'rules' uses keyword and time-order rules only (no LLM call), 'cascade' tries the rules first and asks the LLM only when they find too little.

Chunking

Set under chunking in the config.

ChunkingConfig

Configuration for document chunking.

FieldTypeDefaultDescription
enabledboolFalseEnable automatic document chunking
strategyLiteral['character', 'token', 'semantic', 'hierarchical']'token'Chunking strategy: - 'character': Split by character count - 'token': Split by token count (recommended) - 'semantic': Split by semantic similarity - 'hierarchical': Split preserving document structure
chunk_sizeint512Maximum chunk size (tokens or characters depending on strategy)
chunk_overlapint50Overlap between consecutive chunks for context preservation
separatorsList[str]['\n\n', '\n', '. ', ' ', '']List of separators for recursive splitting (character strategy)
min_chunk_sizeint50Minimum chunk size (chunks smaller than this are merged)
max_chunks_per_documentOptional[int]NoneMaximum number of chunks per document (None = unlimited)
tokenizer_modelstr'gpt-4'Model name for token counting (tiktoken)
semantic_thresholdfloat0.5Similarity threshold for semantic chunking
respect_markdown_headersboolTruePreserve markdown header boundaries in hierarchical chunking
merge_chunks_on_retrievalboolTrueAutomatically merge chunks from same document during retrieval
chunk_context_windowint1Number of neighboring chunks to include for context (±N)
min_document_sizeint0Minimum document size (in characters) before chunking is applied. Documents smaller than this will be stored as a single memory. Set to 0 to always chunk. Recommended: 1500-2000 for narrative texts.

Privacy (PPMF)

Set under ppmf in the config.

PPMFConfig

Privacy-Preserving Memory Firewall configuration.

FieldTypeDefaultDescription
enabledboolFalseEnable PPMF
use_llm_classifierboolTrueUse LLM for sensitivity classification (fallback to rule-based)
classifier_modelOptional[str]NoneModel for classification (uses memory LLM if None)
classification_thresholdfloat0.7Confidence threshold for LLM classification
encryption_algorithmEncryptionAlgorithmEncryptionAlgorithm.FERNETEncryption algorithm to use
encryption_key_pathOptional[str]NonePath to encryption key file
key_rotation_enabledboolFalseEnable automatic key rotation
default_redaction_modeRedactionModeRedactionMode.ENCRYPTDefault redaction mode
sensitivity_rulesList[SensitivityRule][]Custom sensitivity rules
redact_telemetryboolTrueRedact sensitive data from telemetry
enable_adversarial_testingboolFalseEnable MEXTRA-style adversarial testing
adversarial_test_intervalint100Run adversarial tests every N memory operations
async_processingboolTrueProcess privacy operations asynchronously
cache_classificationsboolTrueCache classification results for identical content

Context graph

Set under context_graph in the config.

ContextGraphConfig

Master config for the Context-Graph Layer.

FieldTypeDefaultDescription
enabledboolFalseMaster switch. Off = zero behaviour change.
backendLiteral['networkx', 'neo4j', 'postgres']'networkx'networkx (in process), neo4j (the graph_store driver), or postgres (the database in MemoryConfig.state_store; stores the change log there too).
persist_pathOptional[str]NoneSnapshot path for networkx backend (defaults to {outhad_contextkit_dir}/context_graph.pkl when None)
decayDecayConfigDecayConfig()
edgesEdgeSynthesisConfigEdgeSynthesisConfig()
retrievalRetrievalConfigRetrievalConfig()
log_changesboolTrueWrite mutation events to the change log (a SQLite file, or the ck_graph_changes table with the postgres backend)

RetrievalConfig

Graph-first retrieval parameters.

FieldTypeDefaultDescription
enabledboolTrueUse graph-first retrieval when context_graph.enabled is True
seed_top_kint10
expansion_depthint2
max_candidatesint50
edge_weight_floorfloat0.1
alpha_densefloat0.55
beta_bm25float0.15
gamma_graphfloat0.3
algorithmLiteral['bfs', 'ppr']'bfs'Which retriever to use. 'bfs' (default) preserves pre-Phase-D behaviour; 'ppr' swaps in the PersonalisedPageRankRetriever.
ppr_dampingfloat0.85PageRank damping factor (1-teleport prob).
ppr_max_iterint200Maximum power-iteration steps.
ppr_tolerancefloat1e-06Convergence tolerance for power iteration.
delta_personalfloat0.0Weight of the personalised feedback term (δ·personal_boost). 0 = disabled.
epsilon_frequencyfloat0.0Weight of the log-scaled access_count term (ε·frequency). 0 = disabled.
zeta_successfloat0.0Weight of the (query_hash, memory_id) success-rate term (ζ·success). 0 = disabled.

EdgeSynthesisConfig

Controls which structural edges get synthesised on memory add/update.

FieldTypeDefaultDescription
enable_reply_toboolTrue
enable_topic_similarboolTrue
enable_document_linkboolTrue
enable_temporal_nextboolTrue
topic_top_kint5Max TOPIC_SIMILAR edges per insert
topic_min_similarityfloat0.75Cosine similarity floor for topic edges
reply_to_window_secondsint1800Max seconds between memories in the same run to create REPLY_TO
use_llm_inferenceboolFalseOpt-in LLM edge synthesis (Phase C). Equivalent to llm.enabled.
llmLLMEdgeConfigLLMEdgeConfig()

LLMEdgeConfig

Phase C — LLM-driven semantic edge synthesis parameters.

FieldTypeDefaultDescription
enabledboolFalseMaster switch. Mirror of EdgeSynthesisConfig.use_llm_inference (either flag set opts in); kept as its own model so the LLM knobs cluster.
providerOptional[str]NoneOptional LLM provider override. When None the synthesiser reuses Memory.llm (the extraction/update LLM).
max_pairs_per_insertint3Hard cap on LLM classification calls per new memory.
min_topic_similarityfloat0.8Only LLM-classify pairs whose topic cosine ≥ this floor.
min_confidencefloat0.6Drop LLM-inferred edges with confidence below this threshold.
daily_token_budgetint1000000 disables the budget. Enforced per user_id per UTC day.
tokens_per_call_estimateint500Conservative token estimate used for pre-call budget checks.
timeout_secondsfloat8.0Per-call LLM timeout. Exhausted calls fail-soft to no edges.
retry_on_schema_violationboolTrueRetry once when the LLM returns malformed JSON.
cooldown_secondsint900After budget exhaustion, cool down for N seconds before retrying.

DecayConfig

Edge weight + node relevance decay parameters.

FieldTypeDefaultDescription
enabledboolTrue
half_life_daysfloat30.0t½ for exponential edge weight decay
min_edge_weightfloat0.05Edges below this weight are pruned
min_node_relevancefloat0.02Nodes below this relevance are archived
tick_on_readboolTrueLazily apply decay during search traversals

Personalized retrieval (MSPR)

Set under mspr in the config.

MSPRConfig

Master config for Multi-Stage Personalized Retrieval.

FieldTypeDefaultDescription
enabledboolFalseMaster switch. Off = zero behaviour change, zero imports.
intentIntentConfigIntentConfig()
feedbackFeedbackConfigFeedbackConfig()
frequencyFrequencyConfigFrequencyConfig()
roleRoleConfigRoleConfig()
successSuccessConfigSuccessConfig()

IntentConfig

Phase F5 — Query intent classifier parameters.

FieldTypeDefaultDescription
enabledboolFalse
strategyLiteral['regex', 'llm', 'hybrid']'regex'
llm_timeout_secondsfloat2.0
cache_sizeint1024LRU cache size for classified queries. 0 disables cache.
enable_regex_fastpathboolTrueRun regex rules before any LLM call. Hits short-circuit.

FeedbackConfig

Phase F3/F4 — record_feedback + δ·personal_boost parameters.

FieldTypeDefaultDescription
enabledboolFalse
boost_deltafloat0.15Positive relevance delta applied on helpful feedback.
penalty_deltafloat0.1Absolute value of the negative delta for unhelpful feedback.
max_boost_per_memoryfloat0.6Cap on cumulative boost a single memory can accrue.
pin_floor_on_boostboolTruePin relevance_floor after a helpful boost so decay cannot erase the signal.
sqlite_pathOptional[str]NoneOverride path for feedback_events.db. None → default dir.

FrequencyConfig

Phase F2 — access_count + ε·frequency parameters.

FieldTypeDefaultDescription
enabledboolFalse
epsilon_weightfloat0.05Weight applied to the normalised frequency term. Mirrors RetrievalConfig.epsilon_frequency for convenience; the retriever reads from RetrievalConfig, this field is a presentation hint.
normaliseLiteral['log1p', 'zscore', 'none']'log1p'

RoleConfig

Phase F6 — role / tenant-aware retrieval parameters.

FieldTypeDefaultDescription
enabledboolFalse
tenant_fieldstr'tenant_id'Key in memory metadata that holds the tenant identifier.
role_fieldstr'role'Key in memory metadata that holds the actor role.
hard_filterboolTrueWhen True, deny cross-role/tenant reads pre-rerank. When False, merely deboost via RolePolicy.reweight().

SuccessConfig

Phase F7 — historical (query_hash, memory_id) success parameters.

FieldTypeDefaultDescription
enabledboolFalse
zeta_weightfloat0.1Mirror of RetrievalConfig.zeta_success for presentation.
query_hash_algoLiteral['sha256', 'minhash']'sha256'
sqlite_pathOptional[str]None
min_sample_sizeint3Only apply the success boost once we have this many samples.

Tenants

Set under tenant in the config.

TenantConfig

Master config for tenant + sub-tenant architecture.

FieldTypeDefaultDescription
enabledboolFalseMaster switch. Off = zero behaviour change, zero imports.
default_tenant_idstr'__default__'Tenant id used when the caller does not supply one. Reserved sentinel; cannot be created via the admin API.
sub_tenant_fieldstr'sub_tenant_id'Metadata key holding the sub-tenant identifier on memory payloads.
isolationIsolationConfigIsolationConfig()
registryRegistryConfigRegistryConfig()

IsolationConfig

How strict to be about cross-tenant data leakage.

FieldTypeDefaultDescription
modeLiteral['filter', 'collection', 'physical']'filter'filter — single shared collection; tenant_id added as a metadata filter at query time (matches MSPR F6 today). collection — one vector-store collection per tenant (T3). physical — one DB file / Neo4j DB per tenant. Reserved; not implemented in T3.
deny_cross_tenant_writesboolTrueWhen True, raise on writes whose payload tenant_id differs from the resolved tenant.
require_tenant_id_on_addboolFalseWhen True and tenant.enabled=True, every Memory.add without a tenant_id raises ValueError.

RegistryConfig

SQLite-backed tenant registry parameters.

FieldTypeDefaultDescription
sqlite_pathOptional[str]NoneOverride path for tenant_registry.db. None → {outhad_contextkit_dir}/tenant_registry.db.
cache_sizeint512LRU cache size for get_tenant() / has_role() lookups. 0 disables caching.

Decay and versioning

Set under decay_v2 in the config.

DecayV2Config

Master config for Part D — time-aware decay + versioning.

FieldTypeDefaultDescription
enabledboolFalseMaster switch. Off = zero behaviour change, zero imports.
weight_recencyfloat0.6Coefficient for the exp-decay recency term in compute_decay_score.
weight_frequencyfloat0.3Coefficient for the log1p-normalised frequency term.
weight_feedbackfloat0.1Coefficient for the tanh-normalised feedback term.
archive_thresholdfloat0.05Memory.archive_low archives every node whose decay_score falls below this floor.
track_referencesboolFalseWhen True, Memory.record_reference(memory_id) bumps access_count + last_accessed_at to reflect downstream usage.
scheduleScheduleConfigScheduleConfig()
versioningVersioningConfigVersioningConfig()
cold_storageColdStorageConfigColdStorageConfig()

ScheduleConfig

Periodic decay scheduler parameters (Phase D3).

FieldTypeDefaultDescription
enabledboolFalse
interval_secondsfloat3600.0Seconds between scheduler ticks. Default: hourly.
jitter_secondsfloat60.0Random ± jitter added to each interval to avoid thundering-herd ticks across replicas.
max_drift_secondsfloat600.0Reserved — bounds clock skew when computing the next tick. Not enforced in D3.

VersioningConfig

Immutable versioning parameters (Phase D4/D5).

FieldTypeDefaultDescription
modeLiteral['overwrite', 'immutable']'overwrite'overwrite — pre-feature in-place mutation. immutable — Memory.update creates a new vector-store row and marks the previous row metadata.status='superseded'.
keep_versionsint10Pruned chain length per memory. Older versions beyond this depth are dropped on insert / scheduler tick.
diff_providerLiteral['unified', 'json', 'none']'unified'Default mode for Memory.diff_versions.

ColdStorageConfig

Cold-archival adapter parameters (Phase D7).

FieldTypeDefaultDescription
backendLiteral['disabled', 'local', 's3', 'postgres']'disabled'local disk, S3, or postgres (the database in MemoryConfig.state_store).
local_rootOptional[str]NoneRoot directory for the local-disk adapter. None → {outhad_contextkit_dir}/cold_storage.
s3_bucketOptional[str]None
s3_prefixstr'outhad_contextkit/'
archive_grace_secondsfloat86400.0When the scheduler picks up archived nodes for cold demotion, only nodes archived more than this many seconds ago are moved. Defaults to 24h grace period.