DAMS Documentation
DAMS (Defensive Agentic Memory System) is a local-first memory, safety, and retrieval layer for AI coding agents. It gives autonomous and vibe-coding workflows persistent context, structural code intelligence, and pre-commit guardrails — so agents write features without re-reading the codebase and without repeating past bugs.
Why DAMS exists
As AI-assisted coding scales from autocomplete to autonomous agents (Cline, Claude Code, Aider, OpenCode), teams hit the agentic context cliff: agents write code they do not understand, overwrite schemas, skip tests, ignore prior decisions, and hit hard context-window limits. Every session starts from zero.
DAMS wraps the local dev environment in an active memory shell. It coordinates what was decided, what is changing, how the code is structured, and how to verify correctness — combining a git-versioned Markdown wiki, a local SQLite ledger, AST dependency graphs, and OS-level interception. The result: the agent always operates with exactly the context it needs, and nothing more.
What you get
- Compiled context, not retrieved context — a freshness-scored steering file (default
DAMS.md) distilled from a 3-layer token budget. - Structural code intelligence — Graphify knowledge graphs (Leiden community clustering) and tree-sitter call graphs for ripple detection.
- Hybrid retrieval — Chunkhound cAST chunking + semantic/regex hybrid search + a local Ollama reranker, all on-device.
- Defensive guardrails — a Safety Gate blocks contract violations before commit; regression traps prevent recurred bugs.
- Agent interoperability — a Model Context Protocol (MCP) server and OS-level shims that route native search tools through DAMS context.
- Local sovereignty — embeddings, reranking, and research run on your GPU. No source code leaves the machine.
DAMS-FT: Fine-Tuned Codebase Intelligence Engine
DAMS-FT (Defensive Agentic Memory System - Fine-Tuned Edition) represents the second-generation evolution of the core DAMS platform. While standard DAMS provides persistent session memory and broad-spectrum LLM orchestration, DAMS-FT introduces a specialized, fine-tuned local intelligence layer optimized specifically for large-scale software engineering, AST graph navigation, and zero-trust security policy enforcement.
By coupling a custom-trained local model (Bonsai-8B) with a deterministic AST knowledge graph daemon (Gortex), DAMS-FT completely eliminates common AI coding agent failure modes—such as hallucinated API methods, context window exhaustion, and uncontrolled filesystem text scans.
Platform Comparison: DAMS-Base vs. DAMS-FT
| Feature | DAMS-Base | DAMS-FT |
|---|---|---|
| Primary Execution Path | Cloud LLM (Gemini/MiniMax) | Fine-Tuned Local Router + Main LLM |
| Search Mechanism | Text-based regex | AST Knowledge Graph |
| Tool Accuracy | ~82.4% | 100.0% Exact |
| Token Reduction | Baseline | 27-40% savings |
| Security Model | Post-execution validation | PreToolUse Hard Blocking |
| Routing Latency | 1,200-2,500ms | <300ms |
The Bonsai-8B Model
Bonsai-8B is an 8-billion parameter model fine-tuned on 10,000+ multi-turn developer interaction trajectories and Gortex AST schema definitions. It provides deterministic intent extraction, schema parametrization for all 28 Gortex tools, and fits in 5.2 GB of GPU VRAM using Q4_K_M quantization.
The GCX1 Wire Protocol
DAMS-FT utilizes GCX1 (Gortex Compact Exchange Format v1), a token-compressed serialization protocol that reduces prompt token volume by 27-40% per session, enabling 3x larger repository context within model token limits.
PreToolUse Security Shield
DAMS-FT implements a strict PreToolUse interception hook that blocks native search tools (grep, find, file reads) before execution and redirects to Gortex AST alternatives, ensuring zero-latency, deterministic graph traversals with 100.0% tool selection accuracy.
Quick Start
1. Install
# System deps + Python toolchain
sudo apt update && sudo apt install -y cmake pkg-config libssl-dev libsqlite3-dev libclang-dev clang build-essential
curl -LsSf https://astral.sh/uv/install.sh | sh
curl -fsSL https://fnm.vercel.app/install | bash && fnm install 22
# Ollama (local embeddings + reranker)
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3-embedding:8b
ollama pull dengcao/Qwen3-Reranker-8B:Q5_K_M
2. Initialize a project
git init
dams init # creates .dams/, SQLite ledger, git hooks
dams atomize prd.md # decompose PRD into an atomized task tree
dams graphify # build knowledge graph (~2k vs ~123k tokens)
dams recompile # compile wiki -> DAMS.md steering file
3. Wire up your agent
dams configure-agents . # installs OS-level shims + steering rules for
# OpenCode, Cline, Claude Code, Cursor, Continue, Kilo
4. Develop with guardrails
dams next TASK-001 # activate a task (warms cache in background)
# ... agent reads DAMS.md and uses DAMS MCP tools ...
git commit -m "feat: add auth [TASK-001]" # pre-commit runs `dams check`
dams task-done TASK-001
dams end "bootstrapped auth"
.devcontainer — a single docker compose up gives you the
Python backend, Vite/React UI, Node toolchain, and Ollama client with zero host setup.
Next steps
- Understand the system architecture.
- Learn the core concepts (wiki, compiler, safety gate).
- Browse the CLI reference or the MCP API.