diff --git a/CLAUDE.md b/CLAUDE.md
index dc36e57..a3461e3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -124,12 +124,12 @@ The plugin operates in two logical phases:
**Phase 1 — File Indexing & Summarization**
```
-[Source .java files] → SourceFileIndexer → [*.java.ai.md files (with s/k filled)]
+[Source .java files] → SourceFileIndexer → [*.java.ai.md files (deterministic header + AI body)]
```
**Phase 2 — Package Aggregation & Summarization**
```
-[*.java.ai.md files] → PackageIndexer → [package.ai.md files (with s/k filled)]
+[*.java.ai.md files] → PackageIndexer → [package.ai.md files (deterministic header + AI body)]
```
### Key Components
@@ -203,8 +203,8 @@ the header machine-parseable without AI involvement (see
| Goal | Description |
|---|---|
-| `ai-index:generate` | Phase 1: index source files and fill AI summary/keywords fields |
-| `ai-index:aggregate-packages` | Phase 2: aggregate package index files and fill AI summary/keywords fields |
+| `ai-index:generate` | Phase 1: index source files and fill the AI-generated document body |
+| `ai-index:aggregate-packages` | Phase 2: aggregate package index files and fill the AI-generated document body |
### Key Parameters (`GenerateMojo`)
@@ -326,7 +326,7 @@ See [`../workspace/workflows/pull-request-workflow.md`](../workspace/workflows/p
## Key Design Principles
1. **Local-first** — all AI inference runs locally via llama.cpp; no cloud API calls, no data leaves the machine.
-2. **Deterministic indexing** — same source produces the same `.ai.md` skeleton; only AI-generated fields (`s`, `k`) vary.
+2. **Deterministic indexing** — same source produces the same `.ai.md` skeleton (deterministic header); only the AI-generated body varies.
3. **Incremental updates** — files with existing summaries are skipped unless `force=true`; checksums detect source changes.
4. **Unified indexing and summarization** — each indexer (`SourceFileIndexer`, `PackageIndexer`) both creates the `.ai.md` skeleton and fills in AI fields in a single pass; no separate summarization step is needed.
5. **Provider abstraction** — AI backends are pluggable through `AiGenerationProvider`; mock provider enables fully deterministic tests.
diff --git a/README.md b/README.md
index 4d56359..b86f1a6 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ A Maven plugin for generating hierarchical, AI-readable documentation of source
It creates structured `.ai.md` files per source file and aggregates them into package-level summaries for fast semantic navigation and retrieval.
## Features
- Generate AI summaries for Java source files
-- Extract keyword metadata for search and indexing
+- Weave searchable type, API and domain names into every summary
- Aggregate summaries at package level
- Uses local models via llama.cpp (no cloud dependency)
- Incremental updates (skips unchanged files)
@@ -100,10 +100,20 @@ The plugin runs in two phases.
- D: 2026-03-15T23:31:52Z
- T: 2026-03-19T18:13:31Z
- G: 1.0.0
+- A: 0.0.0
- X: file
-- K: AiMdDocument, AiMdHeader, record, metadata, markdown
-#### AiMdDocument.java
-Represents a document consisting of a structured metadata header and a markdown body. Ensures non-null invariants and encapsulates AI-generated content.
+---
+> Immutable value type pairing a deterministic metadata header with the AI-generated markdown body of one .ai.md document.
+
+#### Purpose
+- Hold one parsed `.ai.md` document as an `AiMdHeader` plus its markdown body.
+
+#### Type
+- record-shaped value class (Java); marked `@ConvertToRecord`.
+
+#### Public API
+- `header() -> AiMdHeader` — the document's metadata header.
+- `body() -> String` — the AI-generated markdown body.
```
## Requirements
- Java 8+ (production code targets Java 8; CI builds on Java 8 via temurin)
@@ -123,12 +133,95 @@ It is published on Maven Central and resolves automatically — no manual instal
```
## Configuration
-Minimal setup in POM:
-```
-
- /path/to/model.gguf
- ${project.basedir}/src/site/ai
-
+The plugin is configured from three building blocks, declared on the plugin inside
+``:
+
+1. **``** — define each GGUF model once (path + sampling parameters), each with a ``.
+2. **``** — define each prompt template once, each with a ``. A template takes
+ two `%s` placeholders: the file/package name and the source (or, for packages, the child summaries).
+3. **``** — per goal, map one `` to one ``. This is
+ **required**: a goal with no field generation fails fast.
+
+```xml
+
+ net.ladenthin
+ llamacpp-ai-index-maven-plugin
+ 1.0.0
+
+
+
+
+ src/main/java/com/example
+
+
+ llamacpp-jni
+
+
+
+
+ coder
+ /path/to/model.gguf
+ 32768
+ 1536
+ 0.7
+ 8
+
+
+
+
+
+
+ file-body
+
+
+
+ package-body
+
+
+
+
+
+
+
+
+ ai-generate
+ generate-resources
+ generate
+
+
+
+ file-body
+ coder
+
+
+
+
+
+ ai-aggregate-packages
+ process-resources
+ aggregate-packages
+
+
+
+ package-body
+ coder
+
+
+
+
+
+
```
## Usage
Run AI index generation:
@@ -140,22 +233,25 @@ With native llama tests:
mvn clean install -Pai-index-selftest -DrunNativeLlamaTests=true
```
## Plugin Configuration
-Key parameters:
-- outputDirectory: target directory for `.ai.md` files
-- subtrees: source directories to index
-- generationProvider: AI backend (`llamacpp-jni`)
-- llamaModelPath: path to GGUF model
-- llamaContextSize: context window
-- llamaMaxTokens: output token limit
-- llamaTemperature: sampling temperature
-- llamaThreads: CPU threads
+Run-level parameters (set in ``):
+- `outputDirectory` — target directory for `.ai.md` files (default: `${project.basedir}/src/site/ai`)
+- `subtrees` — source directories to index, relative to the project base dir (default: `src/main/java`)
+- `fileExtensions` — file extensions to index (default: `.java`)
+- `generationProvider` — AI backend: `mock` (default) or `llamacpp-jni`
+- `force` — regenerate even when a body already exists (default: `false`)
+- `skip` — skip the goal entirely (default: `false`)
+- `aiDefinitions` / `promptDefinitions` — named models / prompt templates, referenced by key
+- `fieldGenerations` — per goal: which `promptKey` runs with which `aiDefinitionKey` (**required**)
+
+Per-model parameters — model path, context size, output tokens, temperature, top-p / top-k,
+repeat penalty, threads — live inside each ``, not as top-level parameters.
## Prompt System
-The plugin uses configurable prompts:
-- file-summary
-- file-keywords
-- package-summary
-- package-keywords
-Prompts are optimized to avoid code blocks, formatter artifacts, empty outputs, and produce structured markdown.
+Prompts are defined in the plugin configuration (``) and referenced by key
+from ``. The self-test profile defines two:
+- `file-body` — summarizes a single source file
+- `package-body` — synthesizes a package summary from the already-generated file summaries
+Each summary begins with a one-sentence blockquote lead, followed by structured `####` sections.
+Prompts are optimized to avoid code blocks, formatter artifacts, and empty outputs, and to produce structured markdown.
## Output Structure
```
src/site/ai/