Releases: flamehaven01/Flamehaven-Filesearch
Release list
v1.6.4 — Complexity Reduction Refactor
What's Changed
Refactored
-
core.py—_restore_from_persistence(depth-5 / CC-17 → depth-3 / CC-5)
Extracted three focused helpers:_inject_into_chronos(uri, doc)— embedding generation + ChronosGrid injection_restore_store_docs(store_name, docs)— doc dedup + restore loop_restore_store_atoms(store_name, atoms)— atom restore loop
Entry point reduced to 18 lines. No behavior change.
-
auth.py—list_keys(depth-4 / CC-8 → depth-2)
Extracted two static helpers:_decode_permissions(perms_json)— decrypt + JSON parse with raw fallback_row_to_key_info(row)— DB tuple →APIKeyInfoconversion
Body reduced to a single list-comprehension.
-
api.py—_init_searcher(depth-4 / CC-5 → depth-2)
Extracted_seed_default_store(fs)— holds the nested inner-try that creates the default store and inserts the bootstrap doc.
Quality
- 71 tests pass (no regressions)
- Real-vault smoke probe: 156/156 files ingested, 8,405 atoms indexed, 5/5 queries
status=success, confidence ≥ 0.840
Full Changelog: https://github.com/flamehaven01/Flamehaven-Filesearch/blob/main/CHANGELOG.md
[1.6.1] - 2026-04-19
Refactored
-
API orchestration (
api.py):initialize_services(66 lines, CC~8) →
_init_searcher+_init_cache+_init_metrics+ 8-line orchestrator.
_record_upload_failureextracted — eliminates 2× duplicated
record_file_upload + record_errorblocks inupload_single_file. -
Admin auth (
admin_routes.py):_get_admin_user(77 lines, CC~10) →
_parse_bearer_token+_try_oauth_admin+_resolve_key_admin+ 5-line
orchestrator. Fixesreverse_field_glyphsrebuilt on every recursive call. -
Engine (
engine/chronos_grid.py):seek_vector_resonance(80 lines,
2 code paths) →_hnsw_vector_resonance+_brute_vector_resonance+
10-line dispatcher (HNSW path vs brute-force cosine similarity). -
Engine (
engine/gravitas_pack.py):_compress_dict/_decompress_dict
clone cluster →_transform_dict(obj, key_map, value_transform)dispatch table.
Both callers become 2-line delegators.
Changed
-
eval_self.py:CORPUS_FILESsplit intoAUDIT_CORPUS(11 docs) +
SOURCE_CORPUS(7 source files).CORPUS_FILES = AUDIT_CORPUS + SOURCE_CORPUS
preserves existing full-pack behaviour;AUDIT_CORPUSalone enables lightweight
doc-quality runs. -
.gitignore:docs/history/added under "Historical development artifacts".
Tests
- 475 passed, 13 skipped — same count as v1.6.0 (1 pre-existing flaky timing test
in full suite; passes in isolation).
[1.6.0] - 2026-04-19
Added
-
BM25 + RRF Hybrid Search (
engine/hybrid_search.py): Production-grade BM25
(k1=1.5, b=0.75) with Korean+English tokenizer
(re.findall(r"[a-z0-9\uac00-\ud7a3]+", text.lower())).
Reciprocal Rank Fusion merges BM25 and ChronosGrid semantic lists using
string URI as doc ID — no integer alignment required. k=60, top_k configurable.
Lazy per-store index with_bm25_dirtyset: index rebuilt on first hybrid
search after any upload, not on every upload. -
KnowledgeAtom chunk-level indexing (
engine/knowledge_atom.py): Two-level
indexing — file-level doc + chunk atoms with fragment URIs
(local://store/enc_path#c0001).chunk_and_inject()splits content into
800-char overlapping windows (120-char overlap, 80-char minimum), embeds each
chunk viaembedding_generator.generate(), injects into ChronosGrid, and
registers in_atom_store_docsfor URI-based resolution. Enables precision
chunk-level retrieval alongside file-level documents. -
Stable URI scheme: Local documents now use
local://<store>/<urllib.parse.quote(abs_path, safe='')>instead of
local://<store>/<basename>. Eliminates collisions when files with identical
names exist in different directories. URIs are reversible viaunquote().
Both main docs and chunk atoms share the same URI namespace.
Refactored
-
core.pysegmentation (1258 → 221 lines):FlamehavenFileSearchsplit into
three focused mixin classes viaIngestMixin,LocalSearchMixin,
CloudSearchMixin.core.pyis now a thin orchestrator:__init__,
create_store,list_stores,delete_store,get_metrics,
_resolve_vector_backend.Mixin File Responsibility IngestMixin_ingest.py(228 L)upload_file, upload_files, _local_upload, _generate_file_vector LocalSearchMixin_search_local.py(273 L)_local_search, BM25 rebuild, hybrid rerank, RAG prompt CloudSearchMixin_search_cloud.py(265 L)search, search_stream, search_multimodal + 6 shared helpers -
Duplicate helper elimination (
_search_cloud.py): Six blocks that were
copy-pasted betweensearch()andsearch_multimodal()are now shared helpers:
_resolve_search_params,_ensure_store,_query_vector_backend,
_driftlock_validate,_extract_grounding_sources,_gemini_search_call.
Fixed
search_streamdouble intent-refine bug:intent_refiner.refine_intent(query)
was called twice (lines 984 and 988 in oldcore.py) — once before the
provider-RAG branch and once inside it. The second call discarded the first
optimized_query. Fixed: single call, result reused throughout the method.
Tests
- 443 tests pass, 13 skipped — no regression from refactor.
test_flamehaven_remote_client_flowpatch target updated: also patches
flamehaven_filesearch._search_cloud._google_genai_typesafter types moved
fromcore.pyto_search_cloud.py.
[1.5.3] - 2026-04-19
[1.5.3] - 2026-04-19
Added
-
Multi-provider LLM support (
engine/llm_providers.py):AbstractLLMProvider
ABC + 4 concrete implementations +create_llm_provider()factory.Provider Class Install extra Google Gemini GeminiProvider[google](existing)OpenAI ChatGPT OpenAIProvider[openai]Anthropic Claude AnthropicProvider[anthropic]Ollama local OllamaProvider[ollama]OpenAI-compatible OpenAIProvider+base_url[openai] -
Local model support via Ollama (
OllamaProvider): zero API key required.
Tested models:gemma4:27b,gemma4:4b,gemma4:2b(128K/256K ctx, Apache-2.0),
qwen2.5:7b/14b/32b,mistral,llama3.2. Streaming via/api/generate. -
OpenAI-compatible endpoint routing:
openai_compatible/kimi/vllm/
lmstudioall map toOpenAIProviderwith custombase_url.
Example: Kimi —OPENAI_BASE_URL=https://api.moonshot.cn/v1. -
Provider-RAG mode in
core.py: for non-Gemini providers,search()runs
local semantic retrieval (ChronosGrid) →_build_rag_prompt()→ LLM answer.
search_stream()callsprovider.stream()for token-by-token output. -
New
Configfields:llm_provider(str, default"gemini")openai_api_key,anthropic_api_key(auto-loaded from env)ollama_base_url(defaulthttp://localhost:11434)local_model(defaultgemma4:27b)openai_base_url(for compatible endpoints)
-
New env vars:
LLM_PROVIDER,OPENAI_API_KEY,ANTHROPIC_API_KEY,
OLLAMA_BASE_URL,LOCAL_MODEL,OPENAI_BASE_URL -
New install extras:
[openai],[anthropic],[ollama]
Changed
Config.validate()skips Google API key requirement whenllm_provider != "gemini"pyproject.toml:descriptionupdated; keywords extended withopenai,
anthropic,claude,ollama,gemma,qwen,local-llm
[1.5.2] - 2026-04-19
Added
-
Parse Cache (
engine/parse_cache.py): mtime-based file extraction cache.
Algorithm absorbed from RAG-Anythingprocessor.py:_generate_cache_key().
Cache key = MD5(resolved_path + mtime + parser_config). Path-indexed reverse
map enables O(1)invalidate(). API:get/put/invalidate/clear/stats.
extract_text(use_cache=True)integrates transparently — no API change.
Score: 0.0 CLEAN. -
ContextExtractor (
engine/context_extractor.py): Sliding-window chunk
context extractor for RAG result enrichment. Algorithm absorbed from
RAG-Anythingmodalprocessors.py:ContextExtractor. Givenchunk_text()
output,enrich_chunks()adds acontextkey to each chunk containing
surrounding neighbour text.ContextConfig:window_size,max_context_chars,
include_headings. Zero external dependencies. Score: 0.0 CLEAN. -
Backend Plugin Architecture (
engine/format_backends.py): Format-family
backends absorbed from Doclingabstract_backend.pypattern.
AbstractFormatBackendABC withsupported_extensions+extract().
BackendRegistrymaps extensions to backend classes; new formats register
without modifying the dispatcher. 11 concrete backends:
PDFBackend,DOCXBackend,DOCBackend,XLSXBackend,PPTXBackend,
RTFBackend,HTMLBackend,VTTBackend,LaTeXBackend,CSVBackend,
ImageBackend,PlainTextBackend. Score: 12.2 clean.
Refactored
engine/file_parser.py(75 lines, was 340): Rewritten as pure registry
dispatcher —_dispatch()resolves backend viaBackendRegistry.get(ext)
then callsbackend.extract(). Cyclomatic complexity 13 → 3.
function_clone_cluster(5 structurally similar_extract_*functions)
eliminated by moving each into its own Backend class. Score: 3.0 CLEAN.
Tests
tests/test_phase1_parse_cache_context.py: 33 tests (parse_cache + ContextExtractor).tests/test_phase2_format_backends.py: 50 tests (registry + backends + helpers).- Combined: 83 tests, all passing. AI-Slop-Detector critical deficits: 0.
[1.5.1] - 2026-04-18
Removed
engine/embedding_generator_legacy.py: Deleted. Identical API surface and
100% function overlap withembedding_generator.py; the file was never imported
by production code and represented 306 lines of dead duplicate code.
Refactored
-
engine/text_chunker.py: Extracted_split_section()and_make_chunk()
helpers fromchunk_text()to reduce nesting depth and cyclomatic complexity. -
engine/file_parser.py: Extracted_extract_table_rows()from
_extract_pptx()(nesting depth 5 → 3); split bareexceptclauses in
_extract_doc()into typedFileNotFoundError/subprocess.TimeoutExpired
handlers with proper log messages. -
engine/gravitas_pack.py: Extracted_estimate_field_reduction()from
estimate_compression_ratio()to eliminate nested for-loops. -
engine/chronos_grid.py: Extracted_upsert_vector()from
inject_essence()to collapse 4-level nesting. -
usage_middleware.py: Extracted_collect_exceeded_quotas()module-level
helper to flatten nested loop insidedispatch(). -
api.py: Extracted_save_upload_file()fromupload_multiple_files()
to resolve critical nested_complexity (depth=4 + high cyclomatic complexity).
Tests
- 360 tests pass (13 skipped) — 29 more than v1.5.0 (360 vs 331).
- AI-Slop-Detector: CLEAN | critical deficits 7 → 0 | avg deficit score
13.46 → 11.25. - ruff: no issues.
[1.5.0] - 2026-04-16
Added
-
Universal Document Parser (
engine/file_parser.py): Complete rewrite with
support for 34 file extensions across 10 format families. Extraction stack:
PDF (pymupdf → pypdf), DOCX/DOC (python-docx + antiword), XLSX (openpyxl),
PPTX (python-pptx), RTF (striprtf), HTML, WebVTT, LaTeX, CSV (all stdlib),
Image OCR ([vision] extra). -
Internal Format Parsers (
engine/format_parsers.py): Zero-dependency
implementations absorbed directly into the codebase — no external document-AI
framework required:- HTML (
extract_html): stdlibhtml.parser-based extractor; suppresses
<script>,<style>,<head>content; preserves block structure. - WebVTT (
extract_vtt): W3C WebVTT spec regex parser; strips timestamps,
cue settings, NOTE/STYLE/REGION blocks, and inline tags (<b>,<c.*>). - LaTeX (
extract_latex): Regex-based text extraction; removes display math
and figure environments, promotes\sectionheadings, unwraps\textbf{}/
\emph{}etc., strips remaining commands. - CSV (
extract_csv): stdlibcsv.Snifferwith auto-detected delimiter
(,,;, TAB,|,:); fallback to comma on detection failure. - Image OCR (
extract_image): Delegates to pytesseract when [vision] extra
is installed; gracefully returns empty string otherwise.
- HTML (
-
Internal Text Chunker (
engine/text_chunker.py): Structure-aware + token-
aware chunking for RAG pipelines — no external ML dependency:- Phase 1: Markdown heading boundary splitting (heading stack preserved).
- Phase 2: Paragraph splitting within sections; sentence splitting for
oversized paragraphs. - Phase 3: Undersized chunk merging (
merge_peers). - Token estimate: 1 token ≈ 0.75 words (conservative for embedding models).
- API:
chunk_text(text, max_tokens=512, min_tokens=64, merge_peers=True)
→List[{text, pages, headings}].
-
Framework Integrations (
integrations/): Plug-and-play adapters for
popular AI agent frameworks — all built on internal extraction, no third-party
document-AI required:FlamehavenLangChainLoader— LangChainBaseLoaderinterface; supports
chunk=Truefor node-level splits.FlamehavenLlamaIndexReader— LlamaIndexBaseReaderinterface; supports
chunk=True.FlamehavenHaystackConverter— HaystackBaseConverterinterface;
run(sources=[...])returns{"documents": [...]}.FlamehavenCrewAITool— CrewAIBaseToolinterface;_run()and
_arun()for sync and async agents.
-
Content-Based Vector Embeddings: Upload pipeline now extracts file content
(first 2000 chars) and embeds it via DSP v2.0. Previously, embeddings were
generated from filename + filetype strings, making semantic search meaningless
for local mode. Fixes semantic search quality for all non-Gemini-API paths.
Changed
-
engine/file_parser.py: Fully rewritten. Docling external dependency
removed; all parsers are now internal or delegate to existing [parsers] extras.
SUPPORTED_EXTENSIONSexpanded from 11 to 34 entries. -
pyproject.toml:packageslist explicitly includes
flamehaven_filesearch.engineandflamehaven_filesearch.integrations
sub-packages for correct PyPI distribution. -
validators.py: Removed HWP MIME types (application/x-hwp,
application/haansofthwp,application/vnd.hancom.hwp/hwpx). Added audio
(audio/wav,audio/mpeg,audio/ogg,audio/flac,audio/aac,
audio/x-m4a), WebVTT (text/vtt), and LaTeX (application/x-latex,
text/x-tex) MIME types.
Removed
- HWP / HWPX support: The OLE binary HWP parser (
_extract_hwp,
_parse_hwp5_body) and HWPX ZIP+XML parser have been removed. HWP requires
theolefiledependency and a custom binary record parser that adds
significant complexity for a narrow format. Use.docxconversion instead.
Tests
- 318 tests pass (13 skipped). All format parser functions validated with
tempfile-based unit checks. - AI-Slop-Detector: status CLEAN, all new files LDR S++, inflation PASS.
- ruff: no issues across all new and modified files.
[1.4.2] - 2026-04-16
Changed
- CI/CD: Replaced
flake8withruffin the lint job for faster and
consistent linting (matches local development tooling). - Abstract base classes:
VectorStore,MetadataStore, andIAMProvider
migrated fromraise NotImplementedErrorstubs to properABC+
@abstractmethod— cleaner Python contract, eliminates unreachable
NotImplementedErrorpaths. tokenize()inlang_processor.py: Removed implicitdetect_language()
call; callers must passlangexplicitly. Removes a hidden latency source
and makes call-site intent clear.
Added
NullIAMProvider: Concrete null-object implementation ofIAMProvider
for use when no IAM backend is configured (replaces direct abstract
instantiation)..slopconfig.yaml: Project-specific AI-Slop-Detector configuration —
suppresses false positives for optional dependencies, ABC stubs, and
FastAPI singleton globals; adds Flamehaven-specific domain overrides._xlsx_row_text()/_pptx_table_lines(): Extracted helpers in
file_parser.pyto reduce nesting depth and improve readability.
Fixed
MAX_FILENAME_LENGTH255 → 200 (validators.py): Prevents Windows
MAX_PATH(260 chars) overflow when writing uploaded files to temp
directories, fixingtest_very_long_filename→ 500 regression.- Logging fallback JSON output:
CustomJsonFormatter(when
python-json-loggeris absent) now emits proper JSON instead of plain text,
fixingJSONDecodeErrorintest_setup_json_logging_accepts_level_kwarg. setup_json_logging()else branch: Usedlogging.Formatter()instead of
CustomJsonFormatter()— corrected toCustomJsonFormatter().- Vector generation latency (
embedding_generator.py): Added ASCII
shortcut — skipsdetect_language()for ASCII-only text, reducing avg
generation time from 14.9 ms to 0.847 ms (p95 < 1 ms). - Empty
exceptblocks: Converted silent exception swallowing in
ws_routes.py,multimodal.py, andvector_store.pytologger.debug()
calls with the captured exception. - Unused imports: Removed
from typing import Generator(inline,
core.py) andHTTPException,Response,status(usage_middleware.py).
Tests
- 331 tests collected, all pass under
pytest. test_very_long_filename: now correctly returns 400 (not 500) on Windows.test_performance_*: avg vector generation < 1 ms (threshold met).test_setup_json_logging_*: fallback JSON formatter validated.
v1.4.1 - Usage Tracking & pgvector Hardening
Production-hardening release with comprehensive usage tracking, quota management, and pgvector reliability enhancements.
Full Changelog: CHANGELOG.md
Key Features
Usage Tracking & Quota Management
- Per-API-key request/token tracking with SQLite backend
- Daily and monthly quota enforcement
- Alert system with configurable thresholds
- Automatic cleanup of old records
Admin APIs
- Detailed usage statistics
- Quota status and configuration
- Usage alerts monitoring
pgvector Maintenance
- HNSW index rebuilding
- VACUUM ANALYZE operations
- Index statistics export
- Comprehensive tuning guide
Installation
pip install flamehaven-filesearch==1.4.1Upgrade
pip install --upgrade flamehaven-filesearchDocumentation
v1.3.1
Added - Phase 2 & 3: Semantic Search + Gravitas-Pack Integration
- Gravitas Vectorizer v2.0: Custom Deterministic Semantic Projection (DSP) algorithm
- Zero ML dependencies (removed sentence-transformers 500MB+)
- Instant initialization (<1ms vs 2min+ before)
- Hybrid feature extraction: word tokens (2.0x weight) + char n-grams (3-5)
- Signed feature hashing for collision mitigation
- 384-dimensional unit-normalized vectors
- LRU caching with 16.7%+ hit rate
- GravitasPacker: Symbolic compression integrated into cache layer
- 90%+ compression ratio on metadata
- Deterministic lore scroll generation
- Instant decompression (<1ms)
- Vector Quantizer: int8 quantization for 75% memory reduction
- Asymmetric quantization (per-vector min/max calibration)
- 30%+ speedup on cosine similarity calculations
- Backward compatible with float32 vectors
- Search Modes:
keyword,semantic,hybridviasearch_modeparameter - API Schema Enhancement: Added
refined_query,corrections,search_mode,search_intent,semantic_resultsto SearchResponse - Chronos-Grid Integration: Vector storage and similarity search
- Intent-Refiner: Typo correction and query optimization
- unittest Migration: Replaced pytest with Python stdlib unittest
- 19/19 tests passing in 0.33s
- Zero timeout issues
- Master test suite:
tests/run_all_tests.py
- Performance Benchmarks: Dedicated benchmark suite for DSP v2.0
- Documentation: README, CHANGELOG, TOMB files updated
Performance
- Vector generation: <1ms per text
- Memory: 1536 bytes → 384 bytes per vector (75% reduction)
- Metadata compression: 90%+ ratio
- Search speed: 30% faster on quantized vectors
- Similar text similarity: 0.787 (78.7%)
- Differentiation ratio: 2.36x
- Cache efficiency: 16.7%+ hit rate
- Search 1000 vectors: <100ms
- Precision loss: <0.1% (negligible for file search)
Changed
EmbeddingGeneratorcompletely rewritten with DSP algorithmcache.py: Integrated GravitasPacker compression/decompressionchronos_grid.py: Optional quantization support- Test infrastructure migrated from pytest to unittest
- Docker metadata updated to v1.3.1
- README badges and features updated
- Version bumped to 1.3.1
Fixed
- Critical: pytest timeout issue resolved via unittest migration
- Critical: sentence-transformers blocking eliminated
- ASCII safety enforced across all output (no Unicode in cp949 environment)
Tests
python tests/run_all_tests.py(19/19 passed, 0.33s)- All semantic search features verified
- Performance benchmarks included
Breaking Changes
- None (fully backward compatible)
search_modeparameter is optional with default behavior preserved