Unotusk / Documentation / v0.5.0-loki
1.1 Introduction

Architecture Overview

Unotusk is a self-contained, single-tenant intelligence engine for engineering teams. Unlike cloud-hosted AI coding assistants that transmit source code and AST tokens to external multi-tenant infrastructure, Unotusk runs 100% within your private infrastructure.

Core Operating Invariants:
  • • Zero Cloud Egress: Zero bytes leave your internal network during AST parsing, vector embedding search, graph cycle analysis, and query grounding.
  • • Evidentiary Grounding: Every response includes verifiable citation chips pointing to exact file paths and line ranges. If code evidence does not exist, the engine explicitly declares its absence rather than hallucinating.
  • • Single-Tenant Local Stack: Deployed as a dedicated Server Node (FastAPI, PostgreSQL 16 + pgvector, Redis, Tree-sitter) communicating with native Desktop Clients over internal LAN HTTP REST (:28000).
Service Architecture Topology
UNOTUSK MVP TOPOLOGY =
Flutter Desktop Client (app/) + Server Setup App (setup_app/)
                       │ (HTTP REST: Port 28000 Control Plane)
                       ▼
FastAPI Async Backend (apps/api/)
  ├── Parser Engine (Tree-sitter: Python, TS/JS, Go)
  ├── Proactive Discovery Engine (9 Analyzers)
  ├── Grounded Context Engine (Multi-Signal SQL + Tarjan SCC Graph)
  ├── Project Intelligence Report Engine (10 Sections)
  └── Customer Knowledge Service (ADRs, Constraints)
         │                               │
         ▼                               ▼
PostgreSQL 16 + pgvector         Redis 7 + Background Worker
(Relational Context, AST,       (services/workers/worker.py)
 Findings, Reports, Chunks)
1.2 Security & Isolation

Zero Cloud Egress Invariant

Unotusk is architected from the ground up for strict air-gapped security protocols. The system contains an offline deterministic synthesizer fallback, enabling complete codebase navigation, architectural dependency mapping, and AST traversal with zero external internet connectivity.

Data Storage & Encryption Invariants:

Relational schemas and vector chunk embeddings are stored inside PostgreSQL 16 utilizing the pgvector extension with tuned HNSW indexes. Code chunks, AST nodes, and symbol references never leave the PostgreSQL database container.

Database connection: postgresql://postgres:<POSTGRES_PASSWORD>@postgres:5432/unotusk_db
1.3 Verification Protocol

Evidentiary Grounding

Every answer generated by Unotusk is verified through the Cryptographic AST Citation Gate. Statements are mapped to exact line-bounded symbol definitions (classes, functions, interface signatures).

Code Citation Chips

Clicking any citation instantly loads the source file in the Desktop Client, scrolling to the exact line range and highlighting the relevant AST node.

Absence Declaration

If a requested component does not exist in the codebase, the engine declares its absence rather than guessing or generating synthetic references.

1.4 Hardware Sizing

Hardware Sizing Matrix

Hardware sizing depends on the number of concurrent engineering repositories and total lines of code indexed.

Deployment Tier
vCPU
Memory
Disk
Capacity
Pilot / Workstation
2 Cores
4 GB
20 GB SSD
1–5 repos (<50k LOC)
Standard Team
4 Cores
8 GB
50 GB SSD
5–25 repos (<250k LOC)
Enterprise Core
8 Cores
16 GB
100 GB NVMe
25+ enterprise codebases
Supported Host Operating Systems: Ubuntu 20.04+, Debian 11+, RHEL 8+, macOS 12+, or Windows 10/11 x64 with Docker Desktop or Docker Engine 24+.
2.1 Getting Started

3-Minute Quick Start Guide

Setting up Unotusk involves two straightforward steps: starting the local Server Node on a designated workstation or server, and pointing your team’s Desktop Clients to its internal IP address.

STEP 1: Launch Server Setup Wizard or Compose

On your host server or workstation, run the Server Setup Wizard or boot headless with Docker Compose:

git clone https://github.com/Techteam-zephvion/install-unotusk.git && cd install-unotusk && docker compose up -d
STEP 2: Verify Health Status

Confirm the API engine is listening and connected to the database:

$ curl -s http://localhost:28000/api/v1/health
{ "status": "healthy", "database": "postgresql+pgvector", "redis": "connected", "version": "v0.5.0-loki" }
STEP 3: Connect Desktop Clients

Share the host machine's internal LAN IP (e.g. http://10.0.0.59:28000) with engineers. On first launch of the native macOS, Windows, or Linux desktop app, paste this endpoint to begin querying.

2.2 Infrastructure

Server Node Setup

Automated Setup Wizard (GUI)

The Setup Wizard is recommended for Windows Server hosts and desktop workstations. It handles container orchestration, pre-flight port checks, and database migrations with single-click verification.

Headless Linux Deployment (Docker Compose)

For headless Ubuntu, Debian, or enterprise servers, run the stack directly with Docker Compose:

# 1. Start backend services
docker compose up -d

# 2. Check running container status
docker compose ps

# 3. View live FastAPI backend logs
docker compose logs -f api

Port Allocation & Networking

Port
Protocol
Service
:28000
HTTP REST / SSE
FastAPI Intelligence Core (Client Ingress)
:5432
TCP / SQL
PostgreSQL 16 + pgvector (Internal only)
:6379
TCP
Redis 7 Task Broker (Internal only)
2.3 Monitoring

Health Verification API

The health endpoint provides automated telemetry on database connectivity, worker queue depth, and memory headroom:

GET /api/v1/health

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "healthy",
  "version": "v0.5.0-loki",
  "database": "postgresql+pgvector",
  "redis": "connected",
  "active_workers": 1,
  "queue_depth": 0
}
3.1 Client Experience

Desktop Client & 9 Workspace Tabs

The Desktop Client is a native Flutter desktop application with a pixel-perfect Warm Dark design system (#181816), Young Serif typography, and 9 focused workspace tabs:

TAB 1: AskTab — Evidentiary Grounded Ask

Press Ctrl + K anywhere to open Grounded Ask. Ask architectural questions and receive multi-signal grounded answers with clickable citation chips referencing exact source files and line ranges.

TAB 2: OntologyTab — Interactive Code Graph Explorer

Visualizes 1-hop and multi-hop relationships across modules, packages, and database entities. Filter by file, symbol type, or dependency depth to inspect dependencies before refactoring.

TAB 3: DiscoveriesTab — 9 Proactive AST Analyzers

Upon ingestion, Unotusk automatically scans for architectural risks:

• Circular Dependency Detector
• Component Coupling Analyzer
• Test Coverage Gap Finder
• Security Boundary Auditor
• God Object Identifier
• Unused Export Pruner
• State Invariant Verifier
• API Contract Diff Engine
TAB 4: ArchitectureTab — Living Topology Diagrams

Renders Mermaid-compatible architectural flowcharts and service interaction diagrams generated directly from repository imports and route handlers.

TAB 5: SpecHistoryTab — ADRs & Decision Evolution

Chronological timeline of Architectural Decision Records (ADRs) extracted from Git commit histories, PR reviews, and markdown specs.

TABS 6–9: Knowledge, Ingestion Feed, Files & Overview

KnowledgeTab: Curate team rules and architectural constraints.
IngestionFeedTab: Real-time streaming log of tree-sitter parsing rates and vector indexing.
FilesTab: Hierarchical directory navigator with symbol counts.
OverviewTab: High-level codebase summary, health score, and index freshness.

4.1 Core Engines

Intelligence Engines & Algorithms

Tree-sitter Polyglot Parser

Extracts precise Abstract Syntax Trees across Python, TypeScript, JavaScript, and Go without invoking compilers. Generates code atoms with symbol signatures, docstrings, imports, and structural boundaries.

Tarjan Strongly Connected Components (SCC)

Identifies circular dependency cycles in O(V + E) time. Cycles are reported directly in DiscoveriesTab with exact import trace paths so developers can decouple modules safely.

Incremental Delta Snapshot Caching

Computes Git diff trees between commits. Unchanged files retain existing vector embeddings and AST symbols; only modified files undergo re-parsing and embedding re-indexing, accelerating subsequent pushes.

Cryptographic AST Citation Gate

Validates citations before delivering responses to the client. Any hallucinated file path or misaligned line range is pruned and flagged prior to response rendering.

HNSW Vector Index Tuning

Configures PostgreSQL pgvector with Hierarchical Navigable Small World (HNSW) indexing (m=16, ef_construction=64), achieving sub-15ms vector retrieval at 99.4% recall.

Low-Latency SSE Streaming Interface

Delivers contextual answers token-by-token over Server-Sent Events (SSE) with structured citation event payloads for instantaneous client rendering.

5.1 Operations Runbook

Troubleshooting & Operations

Port Conflict Resolution

If another internal service is bound to port 28000, override the port in .env:

# 1. Identify conflicting process
sudo lsof -i :28000

# 2. Rebind Unotusk port in .env
API_PORT=28050

# 3. Restart services
docker compose up -d

Offline Synthesizer Fallback

When external LLM APIs (Groq, Anthropic) are unreachable or disabled for air-gapped environments, Unotusk automatically activates the deterministic offline synthesizer. The offline engine constructs grounded responses strictly using multi-signal SQL retrieval and extracted AST symbol tables.

Database Backup & Migration

Database schema migrations execute automatically via Alembic on container initialization. To trigger manual migrations or back up the pgvector database:

# Run pending database migrations
docker compose exec api alembic upgrade head

# Create full database snapshot
docker compose exec postgres pg_dump -U postgres unotusk_db > backup_$(date +%F).sql

Diagnostic Export

Generate an anonymized diagnostics bundle for troubleshooting:

python3 scripts/export_diagnostics.py --output diagnostics.zip
Command copied to clipboard