ArtificeGraph
Local-First Knowledge Graph & Obsidian Vault Extraction for Historians
Part of the Artifice Suite โ Local-First, Model-Agnostic Software Harnesses for Humanities Research.
๐๏ธ Philosophy: The Software Harness vs. The Chatbot
ArtificeGraph transforms raw historical texts and OCR transcripts into structured NetworkX knowledge graphs and hyperlinked Obsidian vaults. It is engineered around Joseph Weizenbaumโs anti-ELIZA principle: software should perform deterministic pipeline operations, invoking AI models strictly for structured entity and relationship extraction.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ArtificeGraph Harness โ โ โ โ 1. Sliding-Window Document Ingestion & Content-Hash Chunking โ โ 2. Structured Entity/Relation Extraction (via packages/model-harness) โ โ 3. Semantic Entity Resolution (Fuzzy + bge-m3 Cosine Similarity) โ โ 4. Obsidian Vault Generation (Dataview Frontmatter & Wikilinks) โ โ 5. Multi-Format Graph Export (GraphML, GEXF, Cypher, JSON, CSV) โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Deterministic Pipeline, No Conversational Noise: ArtificeGraph never "chats" with you about your sources. It executes a modular 5-stage pipeline that ingests raw historical texts and yields structured research databases.
- Historian-First Data Model: Built explicitly for historical methodologyโtracking entity types (Person, Organization, Location, Event, Concept), typed relationships, verbatim evidence quotes, confidence scores, and temporal markers.
- Local-First & Private: Primary historical documents, confidential archival transcripts, and prosopographical datasets remain 100% offline. Operates using local open-weights models via Ollama or LM Studio, or optionally cloud API endpoints via your own keys.
- Editorial Visual Identity: Built using The New Masses Design System (
packages/shared-ui)โa warm, paper-and-ink interface inspired by 1930s radical editorial design and Soviet Constructivism.
โจ Core Capabilities
1. Multi-Stage Pipeline Architecture
Each stage operates independently and can be executed separately or resumed at any point:
- Ingestion: Accepts
.txt,.md,.pdf, and.htmlfiles. Performs sliding-window chunking (configurable size/overlap) with content-hash incremental processing. - Extraction: Passes text chunks through
packages/model-harnessto extract typed entities and directed relationships with confidence scores and exact evidence quotes. Includes automatic JSON repair and disk-backed response caching. - Entity Resolution: Two-tier deduplication combining fast fuzzy matching (SequenceMatcher) and semantic vector embeddings (
bge-m3via Ollama) with union-find clustering and YAML alias overrides (data/aliases.yaml). - Obsidian Vault Exporter: Generates a hyperlinked vault containing source documents (
01_Sources/) and entity notes (02_Entities/{Persons,Organizations,...}/) with Dataview metadata,[[wikilinks]], evidence quotes, and source backlinks. - Graph Exporters: Generates NetworkX directed graphs exported as GraphML (Gephi/yEd), GEXF (Gephi-native with visual attributes), JSON (Node-link format), CSV (Node/Edge tables), and Cypher (Neo4j import scripts).
2. Demo Mode (No Model Required)
Includes a built-in synthetic dataset on the Congress of Vienna (12 entities, 8 relationships) to test the graph exporters and Obsidian vault generators without requiring a running local LLM:
artifice-graph demo
๐จ Design System (packages/shared-ui)
All web and visual components in ArtificeGraph adhere to The New Masses Design System:
- Palette: Warm cream paper (
#f6f3ea), deep warm black ink (#1b1813), Esperanto green accents (#2f7d45), and antique gold highlights (#bf9b30). - Typography: Playfair Display (Headings), Libre Baskerville (Body text), and Archivo (UI Labels/Buttons).
- Surface Elevation: Paper-like diffused shadows (
shadow-paper) and hard-offset tactile button press interactions.
๐ Monorepo Architecture
ArtificeGraph is located at apps/artifice-graph within the Artifice Suite monorepo and shares core dependencies with partner applications:
artifice-suite/
โโโ apps/
โ โโโ artifice-graph/
โ โโโ src/
โ โ โโโ cli.py # Typer CLI (7 commands)
โ โ โโโ config.py # Pydantic configuration loader
โ โ โโโ models/ # Documents, entities, & relationships
โ โ โโโ ingestion/ # Sliding-window document chunker
โ โ โโโ extraction/ # LLM extraction & disk cache
โ โ โโโ embedding/ # bge-m3 embedding generator
โ โ โโโ entity_resolution/ # Fuzzy + semantic resolver & union-find
โ โ โโโ exporters/ # NetworkX & Obsidian exporters
โ โ โโโ storage/ # JSON & NetworkX graph persistence
โ โ โโโ web/ # FastAPI server & LudwigLang web UI
โ โโโ tests/ # Pytest suite
โ โโโ README.md
โโโ packages/
โโโ shared-ui/ # The New Masses CSS tokens & web components
โโโ model-harness/ # BYOM connectors (Ollama/LM Studio/OpenAI)
โโโ core-types/ # Shared TypeScript & Python data interfaces
๐ Setup & Installation
Ensure Python 3.11+ is installed. From the monorepo root:
# Install shared packages and app in editable mode
pip install -e packages/core-types -e packages/model-harness -e packages/shared-ui -e apps/artifice-graph
Local Model Requirements (Default)
Ensure Ollama is running locally with your extraction and embedding models:
# Extraction model
ollama pull gemma2:27b
# Embedding model for semantic entity deduplication
ollama pull bge-m3
ollama serve
macOS & Apple Silicon Notes
- Ollama runs
bge-m3embeddings and LLM extraction natively on Apple Silicon Metal GPUs. - For Docker execution, use
http://host.docker.internal:11434for model connections.
๐ฅ๏ธ Usage & Interfaces
1. CLI Commands
# Run full pipeline end-to-end:
artifice-graph run-all data/input_ocr/
# Run individual stages:
artifice-graph ingest data/input_ocr/
artifice-graph extract --model gemma2:27b
artifice-graph resolve-entities --semantic
artifice-graph build-vault
artifice-graph build-graph
# Run incremental mode (skip unchanged files):
artifice-graph run-all --incremental
# Demo mode (No LLM required):
artifice-graph demo
2. Web UI (Recommended)
Launches the FastAPI backend with The New Masses editorial controls, live streaming logs, and entity library browser:
python -m artifice_graph.web
โ๏ธ Configuration
ArtificeGraph reads settings from config.yaml or environment variables:
| Section | Key | Default | Description |
|---|---|---|---|
llm |
base_url |
http://localhost:11434 |
LLM API endpoint |
llm |
model |
gemma2:27b |
Model used for extraction |
embedding |
model |
bge-m3 |
Model used for semantic deduplication |
ingestion |
chunk_size |
2000 |
Character count per sliding chunk |
ingestion |
chunk_overlap |
200 |
Overlap between adjacent chunks |
entity_resolution |
use_semantic |
true |
Enable bge-m3 semantic deduplication |
entity_resolution |
aliases_file |
data/aliases.yaml |
Manual entity merge overrides |
๐ Output Directory Structure
Executing the pipeline populates the data/output/ directory with structured research artifacts:
data/
โโโ input_ocr/ # Primary source text files (.txt, .pdf, .md)
โโโ output/
โ โโโ entities.json # Deduplicated canonical entities
โ โโโ relationships.json # Extracted relationships with evidence
โ โโโ knowledge_graph.graphml # Gephi / yEd graph format
โ โโโ knowledge_graph.gexf # Native Gephi format with visual attributes
โ โโโ knowledge_graph.json # JSON node-link format
โ โโโ knowledge_graph.cypher # Neo4j CREATE statements
โ โโโ knowledge_graph_nodes.csv # Spreadsheet node table
โ โโโ knowledge_graph_edges.csv # Spreadsheet edge table
โโโ obsidian_vault/ # Output Obsidian vault directory
โ โโโ 01_Sources/ # Primary source notes with Dataview metadata
โ โโโ 02_Entities/ # Categorized entity notes (Persons, Locations, etc.)
โโโ aliases.yaml # Manual entity resolution override rules
๐ ๏ธ Open-Source Extension Points
We welcome contributions from historical researchers, digital humanists, and software engineers!
- Custom Entity Types & Extraction Schemas (
apps/artifice-graph/src/models/): Extend default entity categories (Person, Organization, Location, Event, Concept) with domain sub-types (e.g., Diplomatic Mission, Archival Record Group). - Graph Exporters (
apps/artifice-graph/src/exporters/): Implement custom graph serializers (e.g., RDF/Turtle, Graphviz DOT, or custom web visualizers). - Obsidian Templates (
apps/artifice-graph/src/exporters/obsidian_exporter.py): Customize Markdown metadata fields and Dataview query templates.
๐งช Testing
Run the offline pytest suite covering document chunking, fuzzy/semantic deduplication, NetworkX exports, and Obsidian vault generation:
pytest apps/artifice-graph/tests/
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file artifice_graph-0.1.0.tar.gz.
File metadata
- Download URL: artifice_graph-0.1.0.tar.gz
- Upload date:
- Size: 175.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6381ea663148ac43d3e719bd5f8be9bc41634c9302ae40c8a8264ffa78609b5
|
|
| MD5 |
139a70a73b131d9b9036fb6a69b54107
|
|
| BLAKE2b-256 |
3880eace8ea734d235ab789c4b74f57a358cc3c290f7d905c78e3b66a9d40168
|
Provenance
The following attestation bundles were made for artifice_graph-0.1.0.tar.gz:
Publisher:
publish.yml on Muggwoffin/artifice-suite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
artifice_graph-0.1.0.tar.gz -
Subject digest:
f6381ea663148ac43d3e719bd5f8be9bc41634c9302ae40c8a8264ffa78609b5 - Sigstore transparency entry: 2357325244
- Sigstore integration time:
-
Permalink:
Muggwoffin/artifice-suite@332bea1bbfdd1325c34e542c0a5f2c1e55db6032 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Muggwoffin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@332bea1bbfdd1325c34e542c0a5f2c1e55db6032 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file artifice_graph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: artifice_graph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 165.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01abfdda257bd9cf35e26072d0ada429e68d31670774a62c834d7f884502882a
|
|
| MD5 |
d1eb748c197b99f31c8ae443f78a2ed4
|
|
| BLAKE2b-256 |
e4e513dfbd411006e6b00fcb5640ce54b2787e7d16554960ea1150f467866c62
|
Provenance
The following attestation bundles were made for artifice_graph-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Muggwoffin/artifice-suite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
artifice_graph-0.1.0-py3-none-any.whl -
Subject digest:
01abfdda257bd9cf35e26072d0ada429e68d31670774a62c834d7f884502882a - Sigstore transparency entry: 2357325329
- Sigstore integration time:
-
Permalink:
Muggwoffin/artifice-suite@332bea1bbfdd1325c34e542c0a5f2c1e55db6032 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Muggwoffin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@332bea1bbfdd1325c34e542c0a5f2c1e55db6032 -
Trigger Event:
workflow_dispatch
-
Statement type: