diff --git a/.env.example b/.env.example
index 7b393e6..cf2ad4b 100644
--- a/.env.example
+++ b/.env.example
@@ -2,34 +2,74 @@
# ForensicPathways Environment Configuration
# ===========================================
-# Authentication & OIDC (Required)
-AUTH_SECRET=change-this-to-a-strong-secret-key-in-production
+# === Authentication Configuration ===
+AUTHENTICATION_NECESSARY=false
+AUTHENTICATION_NECESSARY_CONTRIBUTIONS=false
+AUTHENTICATION_NECESSARY_AI=false
+AUTH_SECRET=your-secret-key-change-in-production
+
+# OIDC Configuration (if authentication enabled)
OIDC_ENDPOINT=https://your-oidc-provider.com
-OIDC_CLIENT_ID=your-oidc-client-id
-OIDC_CLIENT_SECRET=your-oidc-client-secret
+OIDC_CLIENT_ID=your-client-id
+OIDC_CLIENT_SECRET=your-client-secret
-# Auth Scopes - set to true in prod
-AUTHENTICATION_NECESSARY_CONTRIBUTIONS=true
-AUTHENTICATION_NECESSARY_AI=true
+# ===================================================================
+# AI CONFIGURATION - Complete Reference for Improved Pipeline
+# ===================================================================
-# Application Configuration (Required)
-PUBLIC_BASE_URL=https://your-domain.com
-NODE_ENV=production
+# === CORE AI ENDPOINTS & MODELS ===
+AI_API_ENDPOINT=https://llm.mikoshi.de
+AI_API_KEY=sREDACTED3w
+AI_MODEL='mistral/mistral-small-latest'
-# AI Service Configuration (Required for AI features)
-AI_MODEL=mistral-large-latest
-AI_API_ENDPOINT=https://api.mistral.ai
-AI_API_KEY=your-mistral-api-key
-AI_RATE_LIMIT_DELAY_MS=1000
+# === IMPROVED PIPELINE: Use separate analyzer model (mistral-small is fine) ===
+AI_ANALYZER_ENDPOINT=https://llm.mikoshi.de
+AI_ANALYZER_API_KEY=skREDACTEDw3w
+AI_ANALYZER_MODEL='mistral/mistral-small-latest'
-# Git Integration (Required for contributions)
-GIT_REPO_URL=https://git.cc24.dev/mstoeck3/forensic-pathways
-GIT_PROVIDER=gitea
-GIT_API_ENDPOINT=https://git.cc24.dev/api/v1
-GIT_API_TOKEN=your-git-api-token
+# === EMBEDDINGS CONFIGURATION ===
+AI_EMBEDDINGS_ENABLED=true
+AI_EMBEDDINGS_ENDPOINT=https://api.mistral.ai/v1/embeddings
+AI_EMBEDDINGS_API_KEY=ZREDACTED3wL
+AI_EMBEDDINGS_MODEL=mistral-embed
+AI_EMBEDDINGS_BATCH_SIZE=20
+AI_EMBEDDINGS_BATCH_DELAY_MS=1000
-# File Upload Configuration (Optional)
-LOCAL_UPLOAD_PATH=./public/uploads
+# === PIPELINE: VectorIndex (HNSW) Configuration ===
+AI_MAX_SELECTED_ITEMS=60 # Tools visible to each micro-task
+AI_EMBEDDING_CANDIDATES=60 # VectorIndex candidates (HNSW is more efficient)
+AI_SIMILARITY_THRESHOLD=0.3 # Not used by VectorIndex (uses cosine distance internally)
+
+# === MICRO-TASK CONFIGURATION ===
+AI_MICRO_TASK_DELAY_MS=500 # Delay between micro-tasks
+AI_MICRO_TASK_TIMEOUT_MS=25000 # Timeout per micro-task (increased for full context)
+
+# === RATE LIMITING ===
+AI_RATE_LIMIT_DELAY_MS=3000 # Main rate limit delay
+AI_RATE_LIMIT_MAX_REQUESTS=6 # Main requests per minute (reduced - fewer but richer calls)
+AI_MICRO_TASK_RATE_LIMIT=15 # Micro-task requests per minute (was 30)
+
+# === QUEUE MANAGEMENT ===
+AI_QUEUE_MAX_SIZE=50
+AI_QUEUE_CLEANUP_INTERVAL_MS=300000
+
+# === PERFORMANCE & MONITORING ===
+AI_MICRO_TASK_DEBUG=true
+AI_PERFORMANCE_METRICS=true
+AI_RESPONSE_CACHE_TTL_MS=3600000
+
+# ===================================================================
+# LEGACY VARIABLES (still used but less important)
+# ===================================================================
+
+# These are still used by other parts of the system:
+AI_RESPONSE_CACHE_TTL_MS=3600000 # For caching responses
+AI_QUEUE_MAX_SIZE=50 # Queue management
+AI_QUEUE_CLEANUP_INTERVAL_MS=300000 # Queue cleanup
+
+# === Application Configuration ===
+PUBLIC_BASE_URL=http://localhost:4321
+NODE_ENV=development
# Nextcloud Integration (Optional)
NEXTCLOUD_ENDPOINT=https://your-nextcloud.com
diff --git a/.gitignore b/.gitignore
index 35db4ed..c56fca3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,3 +85,4 @@ temp/
.astro/data-store.json
.astro/content.d.ts
prompt.md
+data/embeddings.json
diff --git a/RAG-Roadmap.md b/RAG-Roadmap.md
new file mode 100644
index 0000000..787f7b0
--- /dev/null
+++ b/RAG-Roadmap.md
@@ -0,0 +1,358 @@
+# Forensic-Grade RAG Implementation Roadmap
+
+## Context & Current State Analysis
+
+You have access to a forensic tools recommendation system built with:
+- **Embeddings-based retrieval** (src/utils/embeddings.ts)
+- **Multi-stage AI pipeline** (src/utils/aiPipeline.ts)
+- **Micro-task processing** for detailed analysis
+- **Rate limiting and queue management** (src/utils/rateLimitedQueue.ts)
+- **YAML-based tool database** (src/data/tools.yaml)
+
+**Current Architecture**: Basic RAG (Retrieve → AI Selection → Micro-task Generation)
+
+**Target Architecture**: Forensic-Grade RAG with transparency, objectivity, and reproducibility
+
+## Implementation Roadmap
+
+### PHASE 1: Configuration Externalization & AI Architecture Enhancement (Weeks 1-2)
+
+#### 1.1 Complete Configuration Externalization
+**Objective**: Remove all hard-coded values from codebase (except AI prompts)
+
+**Tasks**:
+1. **Create comprehensive configuration schema** in `src/config/`
+ - `forensic-scoring.yaml` - All scoring criteria, weights, thresholds
+ - `ai-models.yaml` - AI model configurations and routing
+ - `system-parameters.yaml` - Rate limits, queue settings, processing parameters
+ - `validation-criteria.yaml` - Expert validation rules, bias detection parameters
+
+2. **Implement configuration loader** (`src/utils/configLoader.ts`)
+ - Hot-reload capability for configuration changes
+ - Environment-specific overrides (dev/staging/prod)
+ - Configuration validation and schema enforcement
+ - Default fallbacks for missing values
+
+3. **Audit existing codebase** for hard-coded values:
+ - Search for literal numbers, strings, arrays in TypeScript files
+ - Extract to configuration files with meaningful names
+ - Ensure all thresholds (similarity scores, rate limits, token counts) are configurable
+
+#### 1.2 Dual AI Model Architecture Implementation
+**Objective**: Implement large + small model strategy for optimal cost/performance
+
+**Tasks**:
+1. **Extend environment configuration**:
+ ```
+ # Strategic Analysis Model (Large, Few Tokens)
+ AI_STRATEGIC_ENDPOINT=
+ AI_STRATEGIC_API_KEY=
+ AI_STRATEGIC_MODEL=mistral-large-latest
+ AI_STRATEGIC_MAX_TOKENS=500
+ AI_STRATEGIC_CONTEXT_WINDOW=32000
+
+ # Content Generation Model (Small, Many Tokens)
+ AI_CONTENT_ENDPOINT=
+ AI_CONTENT_API_KEY=
+ AI_CONTENT_MODEL=mistral-small-latest
+ AI_CONTENT_MAX_TOKENS=2000
+ AI_CONTENT_CONTEXT_WINDOW=8000
+ ```
+
+2. **Create AI router** (`src/utils/aiRouter.ts`):
+ - Route different task types to appropriate models
+ - **Strategic tasks** → Large model: tool selection, bias analysis, methodology decisions
+ - **Content tasks** → Small model: descriptions, explanations, micro-task outputs
+ - Automatic fallback logic if primary model fails
+ - Usage tracking and cost optimization
+
+3. **Update aiPipeline.ts**:
+ - Replace single `callAI()` method with task-specific methods
+ - Implement intelligent routing based on task complexity
+ - Add token estimation for optimal model selection
+
+### PHASE 2: Evidence-Based Scoring Framework (Weeks 3-5)
+
+#### 2.1 Forensic Scoring Engine Implementation
+**Objective**: Replace subjective AI selection with objective, measurable criteria
+
+**Tasks**:
+1. **Create scoring framework** (`src/scoring/ForensicScorer.ts`):
+ ```typescript
+ interface ScoringCriterion {
+ name: string;
+ weight: number;
+ methodology: string;
+ dataSources: string[];
+ calculator: (tool: Tool, scenario: Scenario) => Promise