System Architecture

DAMS is organized into three cooperating layers — Memory, Intelligence, and Discovery — plus a tool-binding surface (OS shims + MCP) that keeps agents on the context fast path.

Layer overview

LayerComponentsRole
MemoryContext Wiki, Context Compiler, DAMS CLI, SKILL.mdWhat was decided, what's broken, what's next
IntelligenceSafety Gate, Drift Detection, CodeGraph, LSP-MCP, GitHub/GitLab MCP, Git ContextValidate, navigate, prevent
DiscoveryChunkhound, cAST chunking, Ollama embeddings + reranker, DuckDB, post-retrieval prunerFind relevant code by concept

The 5-Tier Dispatcher Pipeline

The context dispatcher (context_dispatcher.py) routes search queries through a cascade so common, high-signal lookups never touch the vector DB:

TierMechanismPurpose
0 — AST Fast-PathRegex match for CamelCase/PascalCase/snake_case identifiers → Graphify ASTInstant symbol lookup, bypasses vector DB
1 — SQLite FTS5Full-text search over symbol_indexExact method/class/attr in <50ms
2 — Graphify→ChunkhoundTrace symbol in dependency graph, fetch adjacent lines via ChunkhoundArchitecturally aware retrieval
3 — Semantic RAGNatural-language query → embeddings → DuckDB cosine similarityConcept search
4 — Grep/RipgrepSubprocess passthroughZero-failure terminal fallback

Graphify-First retrieval

DAMS grounds search in the knowledge graph before touching Chunkhound. For a selected task, it (1) queries Graphify for a topological subgraph, (2) injects that structure into query generation, (3) resolves real node names via Graphify, then (4) runs targeted Chunkhound retrieval into a scratchpad (codeResearch.md). BFS subgraph queries achieve a 71.5× token reduction versus naive file dumps.

Tool-binding surface

Two complementary mechanisms keep agents off brute-force scanning:

Deployment topology

ServiceIn containerOn host
Vite / React UI51745174
FastAPI backend87658765
Ollama1143411435

The backend default port is 8765 (not 8000) to avoid colliding with Portainer; the Vite dev server is pinned to 5174 with strictPort: true.

DAMS-FT: Fine-Tuned Codebase Intelligence

DAMS-FT (Fine-Tuned Edition) adds a specialized, fine-tuned local intelligence layer to DAMS, powered by a custom Bonsai-8B model and the Gortex AST knowledge graph daemon.

Key Advantages of DAMS-FT:

MetricDAMS-BaseDAMS-FT
Tool Selection Accuracy~82.4%100.0%
Routing Latency1,200-2,500ms<300ms
Token SavingsBaseline27-40%
SecurityPost-executionPreToolUse Blocking

DAMS-FT utilizes the GCX1 Wire Protocol for token-compressed serialization and implements a PreToolUse Security Shield that intercepts and redirects native tool calls to Gortex AST alternatives.

See the full DAMS-FT documentation for details on the 28-tool Gortex surface, benchmark results, and enterprise deployment.