An offline, provenance-preserving RAG pipeline and human-in-the-loop corpus builder for the digital humanities, DerridAI provides local-first, evidence-grounded scholarly RAG for auditable research, provenance-aware corpus building, retrieval, citation, and LLM evaluation.
Python
0
7,801 commits
updated Oct 17, 2026
English · Français · Español · Português · Deutsch · Italiano · Magyar · Русский · हिन्दी · বাংলা · العربية · 简体中文
DerridAI is a local-first, provenance-preserving research environment for building, reviewing, searching, and querying scholarly corpora. It combines source ingestion, human-in-the-loop corpus construction, evidence-aware metadata enrichment, derived vector/search indexes, and evidence-grounded retrieval-augmented generation (RAG) in one Docker application.
DerridAI is also the originating reference implementation of cELF 1.0 — the Capta-Enriched Locatable Factum, a provenance-preserving information architecture for AI-assisted documentary research. The implementation keeps source identity, record identity and revision, metadata assertions, evidence, generated claims, and support bindings separately inspectable instead of flattening them into one opaque vector store.
Current version: 0.82.0 — Gloucester (release notes). This README describes the Gloucester release.
FieldAssertion records distinguish derivation, evaluation, authority, value state, confidence, evidence, actor/model, stable field identity, and record revision. Human confirmation does not erase model or deterministic provenance.masterThe summary below describes the Gloucester release.
EvidenceRef locator semantics; architecture maps now document critical code boundaries; CI/pre-push selection, repository hygiene, and copyright enforcement were strengthened.See the User Guide for the full feature reference.
DerridAI's scholarly data model follows the cELF distinction between authoritative documentary/scholarly state and rebuildable computational projections. At full traceability, the conceptual path is:
SourceDocument
-> SourceSpan
-> Record
-> RecordRevision
-> FieldAssertion
-> Evidence Acquisition
-> EvidenceRef
-> EvidencePacket
-> GenerationRun
-> GeneratedClaim
-> SupportBinding
This means an answer can be audited backward from a generated claim to its support, evidence, record revision, source span, and source document. Embeddings, retrieval rank, reranker scores, caches, UI state, and other operation-specific values remain derived state; they do not become intrinsic properties of the source record.
See SPECIFICATION.md for the normative cELF 1.0 specification.
DerridAI's top-level dependency and authority boundaries are:
flowchart LR
Browser["web · Vue 3 browser app"]
subgraph API["api · FastAPI"]
REST["REST commands + mutations"]
GQL["GraphQL read façade"]
WS["WebSocket notifications"]
Reads["cELF read services"]
Domains["Corpus · Research · Pipelines · Jobs"]
end
Canonical["Canonical scholarly state<br/>sources · records · revisions · assertions · evidence"]
System["Server-owned durable state<br/>SQLite"]
Chroma["Derived/rebuildable projections<br/>Chroma + embeddings + caches"]
Providers["LLM / embedding providers"]
NLP["Optional document-nlp worker"]
Browser --> REST
Browser --> GQL
Browser <-->|bounded events| WS
REST --> Domains
REST --> Reads
GQL --> Reads
Reads --> Canonical
Reads -. query derived projections .-> Chroma
Domains --> Canonical
Domains --> System
Domains -. index / retrieve .-> Chroma
Domains --> Providers
Domains -. change notifications .-> WS
Domains -. bounded reviewed text .-> NLP
NLP -. derived annotations .-> Domains
For developers working inside a subsystem, the local maps are more specific than this overview:
| If you want to change… | Start here |
|---|---|
| Backend/domain behavior | api/README.md → api/app/README.md |
| Frontend route/workspace behavior | web/README.md → web/src/README.md |
| Reusable UI or Storybook components | web/src/components/README.md |
| Corpus Builder | web/src/features/corpus-builder/README.md and web/src/components/corpus-builder/README.md |
| Pipeline Studio | api/app/pipelines/README.md and web/src/components/pipelines/README.md |
| Tests / CI ownership | tests/README.md and web/tests/README.md |
Read docs/CODE_READABILITY.md before a refactor. It records naming, documentation, nesting, and provenance-preservation conventions, plus the main traps in legacy/derived-state code.
web — Vue 3, TypeScript, Pinia, Vue Router, Vite, PDF.js, and nginx. It is the browser application, proxies /api/, and consumes REST, GraphQL, and realtime notifications. Storybook is an opt-in development profile.api — Python 3.12, FastAPI, Strawberry GraphQL, the ChromaDB client, PyMuPDF, sentence-transformers, and spaCy. It is the authoritative application boundary for authentication, source/corpus operations, cELF reads, provenance, RAG, pipelines, jobs, and system state.document-nlp — an optional isolated BookNLP worker for English Document Intelligence. It receives bounded reviewed text and has no corpus authority.chroma — an optional HTTP Chroma server. Embedded PersistentClient remains the default; both modes store derived search/vector projections.ollama — an optional local Ollama service. DerridAI can instead use Ollama already running on the host or any configured OpenAI-compatible endpoint.The default Compose stack starts web and api; the other services are opt-in profiles or external providers.
DerridAI deliberately does not treat every store as equally authoritative:
./data.POST /api/graphql; no mutation or subscription root.WS /api/ws/events; never a source of truth.For detailed module ownership, persistence boundaries, and data flow, see Architecture, GraphQL, and Realtime.
These are the supported clean-checkout steps.
Install Git, Docker Engine/Desktop with the docker compose command, and an LLM endpoint. The default configuration expects Ollama on the host.
Default models:
gemma4:e2b
bge-m3:latest
git clone https://github.com/ajschlosser/DerridAI.git
cd DerridAI
cp .env.example .env
PowerShell:
Copy-Item .env.example .env
On Docker Desktop with WSL, set HOST_UID and HOST_GID in .env to the output of id -u and id -g so bind-mounted SQLite/Chroma files remain owned by your host user.
Do not export DerridAI test-storage variables such as CHROMA_DATA_ROOT, AUTH_DB_PATH, SYSTEM_DB_PATH, or CHROMA_PATH globally in your shell. Compose interpolates exported variables before values from the file are passed into the container.
For Ollama already running on the host:
ollama pull gemma4:e2b
ollama pull bge-m3:latest
The default .env.example uses:
OLLAMA_BASE_URL=http://host.docker.internal:11434
OLLAMA_MODEL=gemma4:e2b
OLLAMA_EMBED_MODEL=bge-m3:latest
EMBEDDING_PROVIDER=ollama
Or use the optional Compose Ollama service:
docker compose --profile ollama up -d ollama
docker compose exec ollama ollama pull gemma4:e2b
docker compose exec ollama ollama pull bge-m3:latest
Then set OLLAMA_BASE_URL=http://ollama:11434 in .env.
docker compose config --quiet
docker compose up -d --build
Default endpoints:
On first launch, create the initial administrator account in the browser. DerridAI ships no default credentials.
docker compose ps
curl -fsS http://127.0.0.1:8000/api/live
The liveness response should contain "ok": true, the application version, and the baked git commit when available.
For a broader diagnostic:
./scripts/diagnose.sh
PowerShell:
.\scripts\diagnose.ps1
# Local Ollama service
docker compose --profile ollama up -d ollama
# Chroma HTTP server (then set CHROMA_MODE=http)
docker compose --profile chroma up -d chroma
# English BookNLP Document Intelligence enhancement
docker compose --profile document-nlp up -d document-nlp
# Storybook development surface
docker compose --profile dev up storybook
See Document Intelligence before enabling or installing NLP language packs.
docker compose down
# after pulling changes
docker compose down
docker compose up -d --build
If an older release left root-owned files under data/, run ./scripts/fix-data-permissions.sh on supported Unix-like hosts.
CI uses Python 3.12 and Node 22.
Backend/test environment:
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
pip install -r api/requirements-dev.txt
Frontend environment:
cd web
npm ci --no-audit --no-fund
npx playwright install chromium
cd ..
Fast local quality gates:
ruff check api/app tests scripts/check_frontend_api_contract.py scripts/check_frontend_graphql_contract.py
mypy
python -m compileall -q api/app
pytest -q -n auto --dist=worksteal \
--ignore=tests/test_frontend_api_contract.py \
--ignore=tests/test_frontend_graphql_contract.py
pytest -q -m contract tests/test_frontend_api_contract.py tests/test_frontend_graphql_contract.py
cd web
npm run format:repo:check
npm run lint
npm run typecheck
npm run typecheck:tests
npm run test:unit
npm run build:ci
Use npm run format:repo from web/ to format every Prettier-supported source, configuration, and documentation file in the repository. Generated legacy DOM snapshot HTML is intentionally excluded.
For a change-aware local gate, run scripts/preflight.sh from the repository root after installing both environments. It selects checks from the diff and verifies that the branch is not behind origin/master; browser suites remain CI-owned.
For browser coverage, Storybook, CI parity, and contribution rules, see CONTRIBUTING.md.
Start with the narrowest architectural map for the part you intend to change. This avoids learning the whole repository before making a focused contribution.
| Change area | Start here | Important boundary / common trap |
|---|---|---|
| Source ingestion and extraction | Backend map, ingestion safety | Treat every source as inert untrusted data; preserve medium-specific locators and extractor provenance. |
| Corpus Builder and review | Backend application map, frontend feature, components | corpus_builder.py and PdfCorpusBuilder.vue are orchestration/compatibility owners, not default homes for new domain logic. |
| Metadata, assertions, and evidence | Metadata schemas, Metadata Memory, project context | Keep derivation, evaluation, authority, value state, revision, and evidence distinct; do not flatten them into one value or flag. |
| Research, retrieval, and pipelines | Pipeline backend, Pipeline UI, architecture | Retrieval scores and indexes are derived state. Exact evidence/support binding is deterministic scholarly state. |
| REST, GraphQL, or realtime | Backend map, frontend API clients, GraphQL, realtime | REST owns mutations; GraphQL is read-only; WebSocket messages signal change and must be followed by canonical reads. |
| Frontend UI or state | Frontend workspace, application map, domain layer | Keep user-facing strings in i18n, preserve WCAG behavior, and avoid new dependencies on the remaining compatibility runtime. |
| Static research sites / SDK | Frontend workspace, web/site/, web/sdk/, api/app/site_publication.py | Generated api/app/site_assets/derridai-*.js files are build outputs; change their TypeScript/Vue sources and regenerate. |
| Tests and CI | Backend tests, frontend tests, contributing | Contract tests are intentionally separate from the broad backend run; characterization snapshots change only for understood behavior changes. |
| cELF/specification or requirements | SPECIFICATION.md, requirements | Preserve normative requirement identifiers and traceability; implementation detail must not silently redefine cELF semantics. |
api/app/ — FastAPI backend: source/corpus workflows, cELF read services, GraphQL, realtime, provenance, pipelines, RAG, providers, persistence, and jobs.web/src/ — Vue 3 application: views, components, Pinia stores, routing, API clients, realtime client, domain modules, and the shrinking isolated legacy compatibility layer.web/sdk/ — framework-neutral TypeScript SDK for publication loading, local retrieval, citations, annotations, provider injection, and Research.web/site/ — generated-site Vue entrypoint and compatibility adapter for the portable research-site runtime.booknlp-worker/ — optional isolated BookNLP Document Intelligence worker.tests/ — backend, regression, contract, release-consistency, and architecture tests.web/tests/frontend/ — Vitest component/domain tests.web/tests/e2e/ — Playwright application, Storybook, accessibility, and characterization coverage.docs/ — current architecture/domain contracts and historical release notes.data/ — local runtime state; git-ignored except placeholders. Never commit its contents.Start with the documents describing current behavior:
Release history is in CHANGELOG.md and docs/notes/<version>.md. Version-specific release notes are historical records, not current architecture or backlog documents.
DerridAI is licensed under the GNU Affero General Public License v3.0.
Copyright © 2026 Aaron John Schlosser, PhD. The application also displays © 2026 The New England Transcendental Club of California.
An offline, provenance-preserving RAG pipeline and human-in-the-loop corpus builder for the digital humanities, DerridAI provides local-first, evidence-grounded scholarly RAG for auditable research, provenance-aware corpus building, retrieval, citation, and LLM evaluation.
Python
0
7,801 commits
updated Oct 17, 2026
English · Français · Español · Português · Deutsch · Italiano · Magyar · Русский · हिन्दी · বাংলা · العربية · 简体中文
DerridAI is a local-first, provenance-preserving research environment for building, reviewing, searching, and querying scholarly corpora. It combines source ingestion, human-in-the-loop corpus construction, evidence-aware metadata enrichment, derived vector/search indexes, and evidence-grounded retrieval-augmented generation (RAG) in one Docker application.
DerridAI is also the originating reference implementation of cELF 1.0 — the Capta-Enriched Locatable Factum, a provenance-preserving information architecture for AI-assisted documentary research. The implementation keeps source identity, record identity and revision, metadata assertions, evidence, generated claims, and support bindings separately inspectable instead of flattening them into one opaque vector store.
Current version: 0.82.0 — Gloucester (release notes). This README describes the Gloucester release.
FieldAssertion records distinguish derivation, evaluation, authority, value state, confidence, evidence, actor/model, stable field identity, and record revision. Human confirmation does not erase model or deterministic provenance.masterThe summary below describes the Gloucester release.
EvidenceRef locator semantics; architecture maps now document critical code boundaries; CI/pre-push selection, repository hygiene, and copyright enforcement were strengthened.See the User Guide for the full feature reference.
DerridAI's scholarly data model follows the cELF distinction between authoritative documentary/scholarly state and rebuildable computational projections. At full traceability, the conceptual path is:
SourceDocument
-> SourceSpan
-> Record
-> RecordRevision
-> FieldAssertion
-> Evidence Acquisition
-> EvidenceRef
-> EvidencePacket
-> GenerationRun
-> GeneratedClaim
-> SupportBinding
This means an answer can be audited backward from a generated claim to its support, evidence, record revision, source span, and source document. Embeddings, retrieval rank, reranker scores, caches, UI state, and other operation-specific values remain derived state; they do not become intrinsic properties of the source record.
See SPECIFICATION.md for the normative cELF 1.0 specification.
DerridAI's top-level dependency and authority boundaries are:
flowchart LR
Browser["web · Vue 3 browser app"]
subgraph API["api · FastAPI"]
REST["REST commands + mutations"]
GQL["GraphQL read façade"]
WS["WebSocket notifications"]
Reads["cELF read services"]
Domains["Corpus · Research · Pipelines · Jobs"]
end
Canonical["Canonical scholarly state<br/>sources · records · revisions · assertions · evidence"]
System["Server-owned durable state<br/>SQLite"]
Chroma["Derived/rebuildable projections<br/>Chroma + embeddings + caches"]
Providers["LLM / embedding providers"]
NLP["Optional document-nlp worker"]
Browser --> REST
Browser --> GQL
Browser <-->|bounded events| WS
REST --> Domains
REST --> Reads
GQL --> Reads
Reads --> Canonical
Reads -. query derived projections .-> Chroma
Domains --> Canonical
Domains --> System
Domains -. index / retrieve .-> Chroma
Domains --> Providers
Domains -. change notifications .-> WS
Domains -. bounded reviewed text .-> NLP
NLP -. derived annotations .-> Domains
For developers working inside a subsystem, the local maps are more specific than this overview:
| If you want to change… | Start here |
|---|---|
| Backend/domain behavior | api/README.md → api/app/README.md |
| Frontend route/workspace behavior | web/README.md → web/src/README.md |
| Reusable UI or Storybook components | web/src/components/README.md |
| Corpus Builder | web/src/features/corpus-builder/README.md and web/src/components/corpus-builder/README.md |
| Pipeline Studio | api/app/pipelines/README.md and web/src/components/pipelines/README.md |
| Tests / CI ownership | tests/README.md and web/tests/README.md |
Read docs/CODE_READABILITY.md before a refactor. It records naming, documentation, nesting, and provenance-preservation conventions, plus the main traps in legacy/derived-state code.
web — Vue 3, TypeScript, Pinia, Vue Router, Vite, PDF.js, and nginx. It is the browser application, proxies /api/, and consumes REST, GraphQL, and realtime notifications. Storybook is an opt-in development profile.api — Python 3.12, FastAPI, Strawberry GraphQL, the ChromaDB client, PyMuPDF, sentence-transformers, and spaCy. It is the authoritative application boundary for authentication, source/corpus operations, cELF reads, provenance, RAG, pipelines, jobs, and system state.document-nlp — an optional isolated BookNLP worker for English Document Intelligence. It receives bounded reviewed text and has no corpus authority.chroma — an optional HTTP Chroma server. Embedded PersistentClient remains the default; both modes store derived search/vector projections.ollama — an optional local Ollama service. DerridAI can instead use Ollama already running on the host or any configured OpenAI-compatible endpoint.The default Compose stack starts web and api; the other services are opt-in profiles or external providers.
DerridAI deliberately does not treat every store as equally authoritative:
./data.POST /api/graphql; no mutation or subscription root.WS /api/ws/events; never a source of truth.For detailed module ownership, persistence boundaries, and data flow, see Architecture, GraphQL, and Realtime.
These are the supported clean-checkout steps.
Install Git, Docker Engine/Desktop with the docker compose command, and an LLM endpoint. The default configuration expects Ollama on the host.
Default models:
gemma4:e2b
bge-m3:latest
git clone https://github.com/ajschlosser/DerridAI.git
cd DerridAI
cp .env.example .env
PowerShell:
Copy-Item .env.example .env
On Docker Desktop with WSL, set HOST_UID and HOST_GID in .env to the output of id -u and id -g so bind-mounted SQLite/Chroma files remain owned by your host user.
Do not export DerridAI test-storage variables such as CHROMA_DATA_ROOT, AUTH_DB_PATH, SYSTEM_DB_PATH, or CHROMA_PATH globally in your shell. Compose interpolates exported variables before values from the file are passed into the container.
For Ollama already running on the host:
ollama pull gemma4:e2b
ollama pull bge-m3:latest
The default .env.example uses:
OLLAMA_BASE_URL=http://host.docker.internal:11434
OLLAMA_MODEL=gemma4:e2b
OLLAMA_EMBED_MODEL=bge-m3:latest
EMBEDDING_PROVIDER=ollama
Or use the optional Compose Ollama service:
docker compose --profile ollama up -d ollama
docker compose exec ollama ollama pull gemma4:e2b
docker compose exec ollama ollama pull bge-m3:latest
Then set OLLAMA_BASE_URL=http://ollama:11434 in .env.
docker compose config --quiet
docker compose up -d --build
Default endpoints:
On first launch, create the initial administrator account in the browser. DerridAI ships no default credentials.
docker compose ps
curl -fsS http://127.0.0.1:8000/api/live
The liveness response should contain "ok": true, the application version, and the baked git commit when available.
For a broader diagnostic:
./scripts/diagnose.sh
PowerShell:
.\scripts\diagnose.ps1
# Local Ollama service
docker compose --profile ollama up -d ollama
# Chroma HTTP server (then set CHROMA_MODE=http)
docker compose --profile chroma up -d chroma
# English BookNLP Document Intelligence enhancement
docker compose --profile document-nlp up -d document-nlp
# Storybook development surface
docker compose --profile dev up storybook
See Document Intelligence before enabling or installing NLP language packs.
docker compose down
# after pulling changes
docker compose down
docker compose up -d --build
If an older release left root-owned files under data/, run ./scripts/fix-data-permissions.sh on supported Unix-like hosts.
CI uses Python 3.12 and Node 22.
Backend/test environment:
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
pip install -r api/requirements-dev.txt
Frontend environment:
cd web
npm ci --no-audit --no-fund
npx playwright install chromium
cd ..
Fast local quality gates:
ruff check api/app tests scripts/check_frontend_api_contract.py scripts/check_frontend_graphql_contract.py
mypy
python -m compileall -q api/app
pytest -q -n auto --dist=worksteal \
--ignore=tests/test_frontend_api_contract.py \
--ignore=tests/test_frontend_graphql_contract.py
pytest -q -m contract tests/test_frontend_api_contract.py tests/test_frontend_graphql_contract.py
cd web
npm run format:repo:check
npm run lint
npm run typecheck
npm run typecheck:tests
npm run test:unit
npm run build:ci
Use npm run format:repo from web/ to format every Prettier-supported source, configuration, and documentation file in the repository. Generated legacy DOM snapshot HTML is intentionally excluded.
For a change-aware local gate, run scripts/preflight.sh from the repository root after installing both environments. It selects checks from the diff and verifies that the branch is not behind origin/master; browser suites remain CI-owned.
For browser coverage, Storybook, CI parity, and contribution rules, see CONTRIBUTING.md.
Start with the narrowest architectural map for the part you intend to change. This avoids learning the whole repository before making a focused contribution.
| Change area | Start here | Important boundary / common trap |
|---|---|---|
| Source ingestion and extraction | Backend map, ingestion safety | Treat every source as inert untrusted data; preserve medium-specific locators and extractor provenance. |
| Corpus Builder and review | Backend application map, frontend feature, components | corpus_builder.py and PdfCorpusBuilder.vue are orchestration/compatibility owners, not default homes for new domain logic. |
| Metadata, assertions, and evidence | Metadata schemas, Metadata Memory, project context | Keep derivation, evaluation, authority, value state, revision, and evidence distinct; do not flatten them into one value or flag. |
| Research, retrieval, and pipelines | Pipeline backend, Pipeline UI, architecture | Retrieval scores and indexes are derived state. Exact evidence/support binding is deterministic scholarly state. |
| REST, GraphQL, or realtime | Backend map, frontend API clients, GraphQL, realtime | REST owns mutations; GraphQL is read-only; WebSocket messages signal change and must be followed by canonical reads. |
| Frontend UI or state | Frontend workspace, application map, domain layer | Keep user-facing strings in i18n, preserve WCAG behavior, and avoid new dependencies on the remaining compatibility runtime. |
| Static research sites / SDK | Frontend workspace, web/site/, web/sdk/, api/app/site_publication.py | Generated api/app/site_assets/derridai-*.js files are build outputs; change their TypeScript/Vue sources and regenerate. |
| Tests and CI | Backend tests, frontend tests, contributing | Contract tests are intentionally separate from the broad backend run; characterization snapshots change only for understood behavior changes. |
| cELF/specification or requirements | SPECIFICATION.md, requirements | Preserve normative requirement identifiers and traceability; implementation detail must not silently redefine cELF semantics. |
api/app/ — FastAPI backend: source/corpus workflows, cELF read services, GraphQL, realtime, provenance, pipelines, RAG, providers, persistence, and jobs.web/src/ — Vue 3 application: views, components, Pinia stores, routing, API clients, realtime client, domain modules, and the shrinking isolated legacy compatibility layer.web/sdk/ — framework-neutral TypeScript SDK for publication loading, local retrieval, citations, annotations, provider injection, and Research.web/site/ — generated-site Vue entrypoint and compatibility adapter for the portable research-site runtime.booknlp-worker/ — optional isolated BookNLP Document Intelligence worker.tests/ — backend, regression, contract, release-consistency, and architecture tests.web/tests/frontend/ — Vitest component/domain tests.web/tests/e2e/ — Playwright application, Storybook, accessibility, and characterization coverage.docs/ — current architecture/domain contracts and historical release notes.data/ — local runtime state; git-ignored except placeholders. Never commit its contents.Start with the documents describing current behavior:
Release history is in CHANGELOG.md and docs/notes/<version>.md. Version-specific release notes are historical records, not current architecture or backlog documents.
DerridAI is licensed under the GNU Affero General Public License v3.0.
Copyright © 2026 Aaron John Schlosser, PhD. The application also displays © 2026 The New England Transcendental Club of California.