Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:ALwrity ALwrity txtai Requirements

From Leeroopedia
Knowledge Sources
Domains Semantic_Search, Embeddings, NLP
Last Updated 2026-10-24 00:00 GMT

Overview

Python environment with txtai, sentence-transformers, and FAISS for per-user semantic indexing, search, and clustering used by the SIF (Semantic Intelligence Framework).

Description

This environment layer provides the semantic intelligence stack for ALwrity's self-learning features. It uses txtai for embedding-based indexing and search, backed by sentence-transformers (`all-MiniLM-L6-v2` by default) as the embedding model and FAISS as the ANN backend. The service is designed to run on modest CPU hardware — the lightweight MiniLM model produces 384-dimensional vectors without GPU acceleration.

The `TxtaiIntelligenceService` creates a per-user txtai index at `workspace/workspace_{user_id}/indices/txtai`, enabling semantic deduplication of task proposals, content asset tracking, and committee-agent self-learning. The service uses a thread-safe singleton pattern with double-checked locking to prevent concurrent initialization races.

= Usage

Use this environment for:

  • Semantic deduplication of daily workflow task proposals (`TaskMemoryService.filter_redundant_proposals`)
  • Content asset indexing for retrieval and dedup (`TxtaiIntelligenceService.index_content`)
  • Committee agent self-learning — past task outcomes are indexed and searched to avoid redundant proposals
  • Semantic search across research, personas, and content

System Requirements

Category Requirement Notes
OS Linux / macOS / Windows (WSL2) Windows file-lock handling is a known concern; WSL2 recommended
Hardware 2+ CPU cores, 4GB RAM MiniLM is CPU-friendly; first model download requires ~90MB disk
Disk 500MB per user (indices) Embedding index grows with indexed content

Dependencies

Python Packages

  • `txtai` (latest; installed via `sentence-transformers` dependency chain)
  • `sentence-transformers` >= 3.0.0
  • `tf-keras` >= 2.0.0
  • `numpy` >= 1.24.0
  • `huggingface_hub` >= 1.1.4

Default embedding model (auto-downloaded from HuggingFace):

  • `sentence-transformers/all-MiniLM-L6-v2`

Credentials

  • `HF_TOKEN`: HuggingFace token (optional for public models; required for gated models)
  • `SIF_FAIL_FAST`: Set to `true` (default) to raise on initialization errors; `false` for degraded mode

Quick Install

# Install semantic indexing dependencies
pip install sentence-transformers>=3.0.0 tf-keras>=2.0.0 numpy>=1.24.0 huggingface_hub>=1.1.4

# txtai is installed as a dependency of sentence-transformers
# The default model (all-MiniLM-L6-v2) auto-downloads on first use

Code Evidence

txtai import with graceful degradation from `backend/services/intelligence/txtai_service.py:18-27`:

try:
    from txtai import Embeddings
    from txtai.pipeline import Labels, Extractor
    TXTAI_AVAILABLE = True
except ImportError:
    logger.warning("txtai not installed. Some features will be disabled.")
    Embeddings = None
    Labels = None
    Extractor = None
    TXTAI_AVAILABLE = False

Default model path and per-user index path from `backend/services/intelligence/txtai_service.py:46,71`:

DEFAULT_MODEL_PATH = "sentence-transformers/all-MiniLM-L6-v2"
# ...
self.index_path = f"workspace/workspace_{user_id}/indices/txtai"
self._backend = "faiss"  # Default backend

Fail-fast configuration from `backend/services/intelligence/txtai_service.py:78`:

self.fail_fast = str(os.getenv("SIF_FAIL_FAST", "true")).lower() in {"1", "true", "yes", "on"}

Common Errors

Error Message Cause Solution
`txtai not installed. Some features will be disabled.` txtai/sentence-transformers not installed `pip install sentence-transformers>=3.0.0`
`Could not save embeddings: index_path not found` Per-user workspace not created Ensure onboarding creates `workspace_{user_id}/indices/txtai`
`OSError` on Windows during index save File-lock contention on Windows Use WSL2 or set `SIF_FAIL_FAST=false` for degraded mode
Model download fails No network or `HF_TOKEN` needed for gated model Set `HF_TOKEN` or ensure network access for HuggingFace

Compatibility Notes

  • Windows: FAISS index file-locking can crash under concurrent access; WSL2 is recommended. The service has Windows-specific file-lock handling in `sif_async_helpers`.
  • FAISS nprobe incompatibility: The service detects FAISS ANN query incompatibility and falls back to brute-force search (`_disable_ann_queries` flag).
  • CPU-only: The default MiniLM model runs on CPU; no GPU is required.
  • Singleton safety: Per-user singleton with `threading.Lock` prevents concurrent initialization from multiple asyncio workers.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment