Core Concepts

DAMS models a project as a git-versioned Markdown wiki plus a local SQLite ledger. The wiki is the single source of truth; the compiler turns it into a compact steering file.

Context Wiki (.dams/context/)

A directory of structured Markdown files — decisions, contracts, traps, tasks, and sessions — that is Obsidian-compatible and git-versioned. Key subfolders:

Context Compiler (3-layer token budget)

The compiler reads the wiki and produces a freshness-scored steering file (default DAMS.md) targeting an 8K token budget:

LayerContentIncluded when
L1 — Never DropActive issues, safety-critical contracts, immediate prioritiesAlways
L2 — High PriorityLast 5 decisions, critical traps, pending PRD deps>2K tokens remaining
L3 — FillCompleted decisions (summarized), conventions, old logs>5K tokens remaining

Freshness score (0.0–1.0) = 0.5·Recency + 0.3·Drift + 0.2·Age. Below 0.8 the agent is told to recompile; below 0.5 context is treated as potentially stale. Token counting uses tiktoken (cl100k_base).

Safety Gate (dams check)

Drift Detection (dams doctor)

DetectionSeverity
Wiki references a deleted filewarning
Task marked done but tests failwarning
Stale issue (>30 days)info
Contradictory contractserror
Decision superseded but still referencedinfo

CodeGraph & Graphify

Graphify (preferred) is a multi-modal knowledge graph (Tree-sitter AST + optional LLM semantic extraction) with Leiden community clustering. It identifies high-degree "god nodes" and surprising cross-file connections. CodeGraph is the fast tree-sitter fallback call graph for ripple detection when Graphify is unavailable. Both feed AGENTS.md in ~200 tokens versus ~123k reading every file.

Code Research (Chunkhound)

Chunkhound's orchestrated BFS sub-agent explores code relationships dynamically at query time — virtual Graph RAG without precomputed graph storage. It uses cAST chunking (structure-aware, 4.3pt retrieval gain), hybrid semantic+regex search, and a local Ollama reranker. Results land in the codeResearch.md scratchpad.

Atomized Tasks

A single granular unit of work (e.g., "create users table"), auto-generated from the PRD by pure LLM reasoning; the AI implicitly designs the schema and task hierarchy together. Tasks carry frontmatter with status, priority, dependencies, files, and linked commits.