th0th provides extensive configuration options for optimizing performance, storage, and behavior. All settings can be configured via the config file or environment variables.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/S1LV4/th0th/llms.txt
Use this file to discover all available pages before exploring further.
Configuration File
Location:~/.config/th0th/config.json
The config file is auto-created on first run with sensible defaults:
CLI Configuration
Cache Configuration
th0th uses a two-level caching system for optimal performance:L1 Cache (In-Memory)
Fast memory cache for frequently accessed data.Enable/disable the entire caching system.
Maximum L1 cache size in megabytes. Stores most recently used embeddings in memory.
L1 cache TTL in seconds (5 minutes). How long items stay in memory cache.
L2 Cache (Disk/SQLite)
Persistent cache that survives restarts.Maximum L2 cache size in megabytes. Stores embeddings on disk.
L2 cache TTL in seconds (1 hour). How long items stay in disk cache.
Default TTL when not specified (1 hour).
Environment Variables
.env
Cache Behavior
- Hit
- Miss
Cache Hit Flow:Check L1 (memory) → If miss, check L2 (disk) → If L2 hit, promote to L1 → Return cached resultTypical latency: <1ms
Cache hit rates typically reach 80-90% after initial indexing, providing significant performance improvements.
Compression Configuration
th0th compresses code context to reduce token usage by 70-98%.Enable/disable compression globally.
Compression strategy to use. Options:
code_structure: Extract function signatures, class definitions, imports (98% reduction)conversation_summary: Summarize conversation historysemantic_dedup: Remove semantically duplicate contenthierarchical: Multi-level compression preserving hierarchy
Target compression ratio (0.7 = 70% reduction). Range: 0.1-0.95
Strategy Details
- code_structure
- semantic_dedup
- hierarchical
Best for: Code files, API references, implementation detailsExtracts:
- Function signatures
- Class/interface definitions
- Type definitions
- Import statements
- Comments and docstrings
- Function bodies
- Implementation details
- Verbose code
Environment Variables
.env
LLM-Based Compression (Optional)
For advanced summarization, configure an LLM:Logging Configuration
Log level. Options:
debug, info, warn, errorEnable detailed performance metrics and analytics.
Environment Variables
.env
Log Levels
- debug
- info
- warn
- error
Use case: Development, troubleshootingOutputs: All requests and responses, cache hits/misses, provider selection logic, performance timings, detailed error tracesWarning: High volume, not recommended for production
Data Storage
Base directory for all data storage. Expands
~ to home directory.Database Paths
All database paths are relative to the project root:.env
Directory Structure
Rate Limiting
Protect APIs and prevent abuse:Maximum requests per minute per client.
Maximum tokens processed per minute.
.env
Rate limits apply per API client. Adjust based on your embedding provider’s limits.
Security
Maximum input text length in characters. Prevents memory exhaustion.
Sanitize inputs to prevent injection attacks and invalid Unicode.
.env
Input Sanitization
Automatically removes:- Control characters (U+0000 to U+001F)
- Invalid UTF-16 surrogate pairs
- Zero-width spaces
- Replacement character (U+FFFD)
Performance Tuning
Batch Configuration
Retry Configuration
- Attempt 1: 500ms
- Attempt 2: 1000ms
- Attempt 3: 2000ms
- Max delay: 8000ms
Memory Optimization
For constrained environments:High-Performance Setup
For large-scale deployments:Environment Priority
Configuration loading order (highest to lowest priority):- Environment variables (
.envfile) - Config file (
~/.config/th0th/config.json) - Default values (hardcoded)
Environment variables always override config file settings.
Configuration Examples
Troubleshooting
Config Not Loading
Cache Issues
Performance Issues
Enable metrics to diagnose:Next Steps
Embedding Providers
Configure Ollama, Mistral, or OpenAI for semantic search.
Monitoring
Set up monitoring and analytics for production deployments.