# MemPalace — Comprehensive Technical Review **Reviewed**: April 7, 2026 **Repository**: https://github.com/milla-jovovich/mempalace **Language**: Python 3.9+ **License**: MIT --- ## Project Purpose & Description MemPalace is a lossless, local-first AI memory system designed to solve conversational context loss. Every conversation with an AI—every decision, debug session, architecture debate—currently disappears when the session ends. Six months of daily AI use equals ~19.5M tokens lost. MemPalace stores everything verbatim rather than letting AI decide what's worth remembering. It organizes memories using the ancient Greek "method of loci" (palace structure): - **Wings** → people or projects - **Halls** → memory types - **Rooms** → specific topics - **Closets** → summaries - **Drawers** → exact original content This hierarchical structure alone improves retrieval by 34%. **Key claim**: 96.6% retrieval score on LongMemEval (academic benchmark) with zero API calls, zero cloud dependency, zero LLM required—the highest published score meeting those constraints. --- ## Architecture & Module Structure 17 modules, ~3500 lines of code total. | Module | File | Role | |--------|------|------| | CLI | `cli.py` | 11 CLI commands | | Config | `config.py` | Hierarchical configuration (env vars → file → defaults) | | Normalize | `normalize.py` | Converts 5 chat export formats to standard transcript | | Miner | `miner.py` | Project file ingestion into ChromaDB | | Convo Miner | `convo_miner.py` | Conversation/chat file ingestion with exchange-pair chunking | | Searcher | `searcher.py` | Semantic search via ChromaDB with wing/room filtering | | Layers | `layers.py` | 4-layer memory stack (L0–L3) | | Dialect | `dialect.py` | AAAK compression (30x lossless symbolic format) | | Knowledge Graph | `knowledge_graph.py` | Temporal entity-relationship graph (SQLite-backed) | | Palace Graph | `palace_graph.py` | Room-based navigation & BFS traversal | | MCP Server | `mcp_server.py` | Model Context Protocol server with 19 tools | | Onboarding | `onboarding.py` | Interactive first-run setup & entity registry seeding | | Entity Detector | `entity_detector.py` | Auto-detect people/projects from content via regex | | Entity Registry | `entity_registry.py` | Persistent name disambiguation registry | | General Extractor | `general_extractor.py` | Extract 5 memory types from text | | Room Detector | `room_detector_local.py` | Auto-detect rooms from folder structure (no API) | | Spellcheck | `spellcheck.py` | Spell-correct preserving technical terms & proper nouns | | Transcript Splitter | `split_mega_files.py` | Split concatenated transcripts into per-session files | | Package Init | `__init__.py` / `__main__.py` | Package initialization & entry point | --- ## All Classes & Key Methods ### MempalaceConfig (`config.py`) Hierarchical configuration management (env vars → config file → defaults). | Method | Purpose | |--------|---------| | `__init__()` | Load from config file if it exists | | `.palace_path` | Get memory palace location (default: `~/.mempalace/palace`) | | `.collection_name` | ChromaDB collection name (default: `mempalace_drawers`) | | `.people_map` | Name variant canonicalization dictionary | | `.topic_wings` / `.hall_keywords` | Classification defaults | | `.init()` | Create config directory & write defaults | | `.save_people_map()` | Persist name mappings | ### KnowledgeGraph (`knowledge_graph.py`) Temporal entity-relationship graph (SQLite, local). Alternative to Neo4j/Zep with zero cloud cost. **Data model**: - `entities` table: id, name, type, properties, created_at - `triples` table: subject → predicate → object with validity windows (valid_from / valid_to) - Indices on subject, object, predicate, valid dates | Method | Purpose | |--------|---------| | `.add_entity(name, entity_type, properties)` | Create or update entity node | | `.add_triple(subject, predicate, obj, valid_from, valid_to, confidence, source)` | Add relationship with temporal validity | | `.invalidate(subject, predicate, obj, ended)` | Mark fact as ended (preserves history) | | `.query_entity(name, as_of, direction)` | Get all relationships for entity at a specific date | | `.timeline(entity)` | Chronological story of an entity | ### MemoryStack (`layers.py`) 4-layer retrieval optimization — load only what's needed. | Layer | Description | Token Budget | |-------|-------------|-------------| | L0 — Identity | Reads from `~/.mempalace/identity.txt` (user-written plain text). "Who am I?" context. | ~100 tokens | | L1 — Essential Story | Auto-generated from top-weighted drawers. Highest importance + most recent. Grouped by room. | ~500–800 tokens | | L2 — On-Demand | Per-wing summaries, loaded when a topic comes up. | ~200–500 tokens | | L3 — Deep Search | Full ChromaDB semantic search for arbitrarily complex queries. | Unlimited | | Method | Purpose | |--------|---------| | `.wake_up(wing)` | Render L0 + L1 context (~170 tokens) | | `.generate()` | Generate L1 from palace (scores by importance + recency) | ### Dialect (`dialect.py`) AAAK compression — 30x lossless symbolic format readable by any LLM. **Format**: Pipe-separated structured text with emotion codes, entity shorthand, flags. Example: `FAM: ALC(mom)→♡JOR | 2D(kids): RIL(18) MAX(11) | TECH: python,chromadb | ★★★` | Method | Purpose | |--------|---------| | `.compress(text, metadata)` | Compress drawer to AAAK format | | `.compression_stats()` | Measure compression ratio | | `.count_tokens()` | Estimate tokens needed | **Emotion codes**: vulnerability, joy, fear, trust, grief, wonder, rage, love, hope, despair, peace, humor, tenderness, doubt, anxiety, and more. **Flags**: ORIGIN, CORE, SENSITIVE, PIVOT, GENESIS, DECISION, TECHNICAL. ### Palace Graph (`palace_graph.py`) Room-based graph traversal — built from ChromaDB metadata, no external DB. | Method | Purpose | |--------|---------| | `.build_graph(col)` | Returns `(nodes, edges)` — nodes: `{room: {wings, halls, count, dates}}`, edges: tunnels | | `.traverse(start_room, max_hops)` | BFS walk to find connected rooms | | `.find_tunnels(wing_a, wing_b)` | Find rooms bridging two wings | | `.graph_stats()` | Overview (connectivity, density, bridges) | ### Entity Detector (`entity_detector.py`) Pattern-based detection of people and projects from content. **Signal types**: - Person verbs: "said", "told", "thinks" - Dialogue markers: `> Speaker:` - Project verbs: "building", "deployed" - Filename patterns Signal counting → classification as person / project / uncertain. Interactive confirmation via `confirm_entities()`. ### Entity Registry (`entity_registry.py`) Persistent lookup: name → {type, confidence, source}. - Handles 40+ common English words that could be names ("grace", "will", "may", "mark", "sky", "river") - Context pattern matching to disambiguate ("Soren said" → person, not verb) - Three source priorities: onboarding > learned from sessions > Wikipedia research --- ## CLI Commands & Options ### `mempalace init [--yes]` Detect rooms from folder structure, auto-detect people/projects. `--yes`: auto-accept detected entities (non-interactive). ### `mempalace mine [options]` Mine files into palace. | Option | Purpose | |--------|---------| | `--mode projects\|convos` | Code/docs (default) or chat exports | | `--wing NAME` | Override wing name | | `--agent NAME` | Your name (default: "mempalace") | | `--limit N` | Max files to process (0 = all) | | `--dry-run` | Show what would be filed | | `--palace PATH` | Override palace path | ### `mempalace search "query" [options]` Semantic search, optionally filtered. | Option | Purpose | |--------|---------| | `--wing NAME` | Filter by wing | | `--room NAME` | Filter by room | | `--results N` | Number of results | | `--palace PATH` | Override palace path | ### `mempalace split [options]` Split concatenated transcript mega-files into per-session files. | Option | Purpose | |--------|---------| | `--output-dir DIR` | Where to write files (default: same dir) | | `--dry-run` | Preview without writing | | `--min-sessions N` | Only split files with N+ sessions | ### `mempalace wake-up [--wing NAME] [--palace PATH]` Load L0 + L1 context (~170 tokens). ### `mempalace status [--palace PATH]` Palace overview: drawer count, wings/rooms breakdown. ### `mempalace compress [options]` AAAK compress all drawers (or specific wing). | Option | Purpose | |--------|---------| | `--wing NAME` | Compress specific wing only | | `--config PATH` | Custom config path | | `--dry-run` | Show compression stats without storing | | `--palace PATH` | Override palace path | ### Global Option `--palace ` is available on all commands to override palace location. --- ## Configuration ### Global Config — `~/.mempalace/config.json` ```json { "palace_path": "/path/to/palace", "collection_name": "mempalace_drawers", "people_map": {"Kai": "KAI", "Priya": "PRI"}, "topic_wings": ["emotions", "consciousness", "technical"], "hall_keywords": {"emotions": ["scared", "sad"]} } ``` ### Wing Config — `mempalace.yaml` or `mempal.yaml` (per-project) ```yaml wing: my_project rooms: - name: frontend keywords: ["css", "react", "ui"] - name: backend keywords: ["api", "database", "server"] - name: general ``` ### Identity File — `~/.mempalace/identity.txt` Plain text loaded as L0 (always in context). Example: ``` I am Atlas, AI assistant for Alice. Traits: warm, direct. People: Alice (creator), Bob (partner). Project: journaling app for emotional processing. ``` ### Known Names — `~/.mempalace/known_names.json` For transcript splitting: ```json { "names": ["Alice", "Ben", "Riley", "Max", "Sam"], "username_map": {"ajones": "Alice", "bsmith": "Ben"} } ``` --- ## Storage Backends ### ChromaDB (Persistent Vector Database) - Local SQLite + embedding vectors - Collection: `mempalace_drawers` - Metadata per drawer: - `wing`: project/person name - `room`: topic/aspect - `hall`: memory type (optional) - `source_file`: origin file path - `chunk_index`: position in file - `added_by`: who filed it (agent name) - `filed_at`: timestamp - Optional: `importance`, `emotional_weight`, `ingest_mode`, `extract_mode` ### SQLite Knowledge Graph - Path: `~/.mempalace/knowledge_graph.sqlite3` - Two tables: `entities`, `triples` - Temporal validity: `valid_from` → `valid_to` (facts have validity windows) - Indexed on subject, object, predicate, valid dates - Historical queries supported (invalidation preserves history, doesn't delete) ### Palace Location - Default: `~/.mempalace/palace` - Override via env: `MEMPALACE_PALACE_PATH` - Override via config file or `--palace` CLI flag --- ## Search & Retrieval Capabilities ### Semantic Search (ChromaDB) ```python search_memories(query, palace_path, wing=None, room=None, n_results=5) ``` - Embedding-based via ChromaDB's default embeddings - Filter by wing and/or room - Returns: `{text, wing, room, source_file, similarity}` - Boolean WHERE support: `{"$and": [{"wing": "myapp"}, {"room": "frontend"}]}` ### Knowledge Graph Queries ```python kg.query_entity("Max") # All facts about Max kg.query_entity("Max", as_of="2026-01-15") # Historical snapshot kg.timeline("Orion") # Chronological project story ``` ### Graph Traversal ```python traverse(start_room="auth-migration", max_hops=2) # Connected rooms across wings find_tunnels(wing_a="driftwood", wing_b="code") # Rooms bridging two wings ``` ### Hybrid Retrieval (Multi-stage) | Stage | Description | Impact | |-------|-------------|--------| | Stage 1 | Semantic (ChromaDB) | Baseline | | Stage 2 | Keyword re-ranking (stop-word-aware fuzzy matching) | +1–3pp | | Stage 3 (optional) | LLM reranking (Haiku) | → 100% | ### Retrieval Improvement from Palace Structure | Filter Level | Retrieval Score | |-------------|----------------| | Search all | 60.9% | | + Wing filter | 73.1% | | + Wing + Hall | 84.8% | | + Wing + Room | 94.8% | --- ## Text Processing & Ingestion ### Chat Format Normalization (`normalize.py`) Converts 5 export formats to standard transcript: 1. **Plain text** with `>` markers (pass-through) 2. **Claude.ai JSON** — `[{"role": "user", "content": "..."}]` 3. **ChatGPT conversations.json** — nested mapping tree 4. **Claude Code JSONL** — `type:"human"/"assistant"` entries 5. **Slack JSON exports** No API calls, fully local. ### Project File Mining (`miner.py`) **Supported extensions** (25 types): `.txt`, `.md`, `.py`, `.js`, `.ts`, `.json`, `.yaml`, `.html`, `.csv`, `.sql`, `.sh`, `.go`, `.rs`, `.rb`, `.java`, and more. **File routing** (room detection priority): 1. Folder path matches room name 2. Filename matches room 3. Keyword scoring from room keywords 4. Fallback: "general" **Chunking parameters**: - `CHUNK_SIZE`: 800 chars (configurable) - `CHUNK_OVERLAP`: 100 chars - `MIN_CHUNK_SIZE`: 50 chars - Splits on paragraph/line boundaries **Skipped directories**: `.git`, `node_modules`, `__pycache__`, `.venv`, `build`, `dist`, `.mempalace`, `coverage` ### Conversation Mining (`convo_miner.py`) **Exchange-pair chunking**: One user turn + following AI response = one drawer unit. Maintains context pairs as natural semantic units. **Fallback**: Paragraph chunking if no `>` markers detected. **Room detection for conversations** — topic keyword scoring: - `technical`, `architecture`, `planning`, `decisions`, `problems`, `general` - 10+ keywords per topic ### General Extraction (`general_extractor.py`) 5 memory types extracted via keyword/pattern markers: | Type | Marker Count | Example Markers | |------|-------------|-----------------| | Decisions | 20+ | "let's use X", "we decided", "trade-off", "architecture" | | Preferences | 15+ | "I prefer X", "always use", "never use", "snake_case" | | Milestones | 30+ | "it works", "fixed", "finally", "breakthrough", "shipped" | | Problems | 15+ | "bug", "error", "broken", "crash", "root cause" | | Emotions | 25+ | "love", "scared", "proud", "hurt", "grateful", "angry" | ### Spellcheck (`spellcheck.py`) - Spell-corrects user input before filing - Preserves: technical terms (hyphens/underscores), CamelCase, URLs, proper nouns - Uses `autocorrect` library (lazy-loaded, optional) - Skips tokens <4 chars, technical words, code identifiers ### Transcript Splitting (`split_mega_files.py`) - Detects true session starts ("Claude Code v...") vs context restores ("Ctrl+E") - Extracts timestamps: `⏺ H:MM AM/PM Weekday, Month DD, YYYY` - Saves as: `YYYY-MM-DD_HH-MM_[people]_[subject].txt` - Backs up originals (`.mega_backup`) - Dry-run mode for preview ### Room Detector (`room_detector_local.py`) - 30+ folder-to-room mappings (frontend, backend, database, docs, design, costs, meetings, etc.) - Priority: explicit config > folder structure > keyword matching - No API calls required --- ## MCP (Model Context Protocol) Integration ### Installation ```bash claude mcp add mempalace -- python -m mempalace.mcp_server ``` ### 19 Available Tools #### Read Tools (Palace) | Tool | Purpose | |------|---------| | `mempalace_status` | Palace overview + AAAK spec (auto-teaches dialect) | | `mempalace_list_wings` | All wings with drawer counts | | `mempalace_list_rooms` | Rooms within optional wing | | `mempalace_get_taxonomy` | Full wing → room → count tree | | `mempalace_search` | Semantic search with wing/room filters | | `mempalace_check_duplicate` | Check if content already exists (>90% similarity) | | `mempalace_get_aaak_spec` | AAAK dialect reference | #### Write Tools (Palace) | Tool | Purpose | |------|---------| | `mempalace_add_drawer` | File verbatim content into wing/room (checks duplicates) | | `mempalace_delete_drawer` | Remove drawer by ID | #### Knowledge Graph Tools | Tool | Purpose | |------|---------| | `mempalace_kg_query` | Entity relationships with time filtering | | `mempalace_kg_add` | Add temporal fact: subject → predicate → object | | `mempalace_kg_invalidate` | Mark fact as ended | | `mempalace_kg_timeline` | Chronological entity story | | `mempalace_kg_stats` | Graph overview | #### Navigation Tools | Tool | Purpose | |------|---------| | `mempalace_traverse` | Walk graph from room across wings | | `mempalace_find_tunnels` | Rooms bridging two wings | | `mempalace_graph_stats` | Graph connectivity overview | #### Agent Diary Tools | Tool | Purpose | |------|---------| | `mempalace_diary_write` | Agent writes timestamped entry to its wing/diary | | `mempalace_diary_read` | Agent reads its last N diary entries | ### Memory Protocol (auto-sent in status response) 1. **ON WAKE-UP**: Call `mempalace_status` to load palace + AAAK spec 2. **BEFORE RESPONDING** about persons/projects: call `mempalace_kg_query` FIRST 3. **IF UNSURE** about facts: use "let me check" + query (never guess) 4. **AFTER SESSION**: call `mempalace_diary_write` to record learnings 5. **WHEN FACTS CHANGE**: `mempalace_kg_invalidate` old + `mempalace_kg_add` new --- ## Dependencies ### Runtime | Package | Version | Purpose | |---------|---------|---------| | `chromadb` | >=0.4.0 | Vector database | | `pyyaml` | >=6.0 | Configuration parsing | ### Optional | Package | Purpose | |---------|---------| | `autocorrect` | Spell-checking (lazy-loaded) | ### Development | Package | Purpose | |---------|---------| | `ruff` | Linting & formatting | | `pytest` | Testing | | `build` | Package building | | `twine` | PyPI publishing | ### External Services - **None required** for core functionality - Optional Haiku reranking for 100% benchmark score (~$0.001/query) --- ## Entry Points & Installation ### Package Entry Point ```toml # pyproject.toml [project.scripts] mempalace = "mempalace:main" ``` ### Install ```bash pip install mempalace # or development install pip install -e ".[dev]" ``` ### Usage — CLI ```bash mempalace init ~/projects/myapp mempalace mine ~/projects/myapp mempalace search "why did we use GraphQL" ``` ### Usage — Python API ```python from mempalace.searcher import search_memories from mempalace.knowledge_graph import KnowledgeGraph results = search_memories("auth migration", palace_path="~/.mempalace/palace") kg = KnowledgeGraph() kg.query_entity("Max") ``` ### Usage — MCP (Claude) ```bash claude mcp add mempalace -- python -m mempalace.mcp_server # Now Claude has 19 tools for memory access ``` --- ## Testing ### Test Suite (`tests/`) | Test File | What It Tests | |-----------|---------------| | `test_config.py` | Configuration loading, env overrides, defaults, init | | `test_normalize.py` | Chat format conversion (plain text, Claude JSON, ChatGPT) | | `test_miner.py` | Project file mining, chunking, ChromaDB storage | | `test_convo_miner.py` | Conversation mining, exchange-pair chunking, room detection | ### Testing Philosophy - All tests run **without API keys or network access** - Use `tempfile` for isolated temporary palaces - ChromaDB integration tested end-to-end - Each test: clone → setup → mine → verify ### Running Tests ```bash pytest tests/ -v ``` --- ## CI/CD — `.github/workflows/ci.yml` **Matrix testing**: Python 3.9, 3.11, 3.13 ```yaml on: [push to main, pull requests] jobs: test: strategy: matrix: python-version: ["3.9", "3.11", "3.13"] lint: python-version: "3.11" steps: - ruff check . - ruff format --check . ``` --- ## Pre-commit Hooks — `.pre-commit-config.yaml` ```yaml repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.9.0 hooks: - id: ruff args: [--fix] - id: ruff-format ``` **Code style**: - Line length: 100 chars - Format: `ruff format` (enforces double quotes) - Linting: E, F, W rules (ignore E501) --- ## Claude Code Hooks (`hooks/`) Two auto-save hooks for Claude Code integration: ### `mempal_save_hook.sh` Triggers every 15 human messages. Blocks AI and tells it to save key topics/decisions/quotes to palace. AI does the filing (knows conversation context). ### `mempal_precompact_hook.sh` Triggers right before context compression. Emergency save before context window shrinks. Forces AI to save everything before losing session. ### Installation (Claude Code) Add to `.claude/settings.local.json`: ```json { "hooks": { "Stop": [{ "hooks": [{ "type": "command", "command": "/absolute/path/to/hooks/mempal_save_hook.sh", "timeout": 30 }] }], "PreCompact": [{ "hooks": [{ "type": "command", "command": "/absolute/path/to/hooks/mempal_precompact_hook.sh", "timeout": 30 }] }] } } ``` --- ## Examples (`examples/`) | File | Purpose | |------|---------| | `basic_mining.py` | Simple workflow: init → mine → search | | `convo_import.py` | Import Claude Code, ChatGPT, Slack conversations | | `mcp_setup.md` | MCP server configuration for Claude | --- ## Benchmarks (`benchmarks/`) Three academic benchmarks, all reproducible locally: ### LongMemEval (500 questions across 53 sessions) ```bash python longmemeval_bench.py /path/to/data.json ``` | Mode | Score | |------|-------| | Raw (semantic only) | 96.6% R@5 | | Hybrid v1 (keyword re-ranking) | +1–3pp | | Hybrid v2 (temporal boosting) | +0.4pp | | Hybrid + Haiku rerank | 100% R@5 | Highest zero-API score published. 6 question types tested. ### LoCoMo (1,986 multi-hop QA pairs) ```bash python locomo_bench.py /tmp/locomo/data/locomo10.json --granularity session ``` | Mode | Score | |------|-------| | Session-level | 60.3% R@10 | | With Sonnet rerank | 100% R@10 | Tests temporal inference + multi-hop reasoning. 10 conversations, 19–32 sessions each. ### ConvoMem (Salesforce, 75K+ QA pairs) ```bash python convomem_bench.py --category all --limit 50 ``` | Mode | Score | |------|-------| | All categories | 92.9% recall | | Comparison: Mem0 | ~46% recall | 6 categories: assistant facts, user facts, preferences, etc. Auto-downloads from HuggingFace. ### All Benchmark Modes | Mode | Description | |------|-------------| | `--mode raw` | Semantic only (96.6%) | | `--mode hybrid` | Keyword re-ranking | | `--mode hybrid_v2` | Temporal boosting + 2-pass retrieval | | `--mode aaak` | AAAK compression experiments (84.2%) | | `--mode rooms` | Room-based filtering (89.4%) | --- ## Key Design Decisions ### 1. Verbatim-First Architecture - **Decision**: Never summarize user content - **Rationale**: LLM extraction loses context (why, tradeoffs, alternatives). Raw text + good retrieval = stronger baseline - **Result**: 96.6% recall without API vs Mem0 (85%) that uses LLM extraction ### 2. Palace Structure (Wings/Halls/Rooms) - **Decision**: Hierarchical taxonomy (project → aspect → topic) - **Evidence**: Tested on 22,000+ real memories — structure alone provides +34% retrieval ### 3. Local-First, No Cloud - **Decision**: Everything runs on user's machine - **Tech**: SQLite for knowledge graph (vs Neo4j cloud $25/mo) - **Trade-off**: No sharing/sync, but full privacy + zero API costs ### 4. Temporal Validity Windows - **Decision**: Facts have valid_from → valid_to dates - **Why**: Temporal queries ("what was true in January?") work correctly - **Behavior**: Invalidation preserves history, doesn't delete ### 5. Hybrid Retrieval (Multi-stage) - Progressive quality gains without hard dependency on LLM - Stage 1: Semantic → Stage 2: Keyword re-ranking → Stage 3 (optional): LLM reranking ### 6. Two-Pass Entity Normalization - Pass 1: Entity detection (pattern-based + content scanning) - Pass 2: Interactive confirmation + alias mapping - Handles ambiguous names ("Grace" = person or adjective?) ### 7. Exchange-Pair Chunking for Conversations - User turn + AI response = one drawer unit - Maintains context pairs as natural semantic units - Fallback: paragraph chunking if no `>` markers ### 8. Module Independence - Core modules work standalone (normalize, dialect, entity_detector) - MCP server can run separately from CLI - No tight coupling between palace_graph, knowledge_graph, searcher --- ## Summary | Attribute | Value | |-----------|-------| | Total LOC | ~3,500 | | Runtime dependencies | 2 (chromadb, pyyaml) | | Python versions | 3.9, 3.10, 3.11, 3.12, 3.13 | | Storage | ChromaDB (vectors) + SQLite (knowledge graph) | | Cloud required | No | | API keys required | No (core features) | | MCP tools | 19 | | CLI commands | 7+ | | Chat formats supported | 5 | | File types supported | 25 | | Memory types extracted | 5 (decisions, preferences, milestones, problems, emotions) | | Benchmark: LongMemEval | 96.6% R@5 (100% with Haiku) | | Benchmark: LoCoMo | 60.3% R@10 (100% with rerank) | | Benchmark: ConvoMem | 92.9% recall (2× Mem0) | | Wake-up context cost | ~170 tokens | | AAAK compression ratio | 30x lossless |