Skip to main content

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) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  1. 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.
  2. 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.
  3. 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.
  4. 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 .html files. Performs sliding-window chunking (configurable size/overlap) with content-hash incremental processing.
  • Extraction: Passes text chunks through packages/model-harness to 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-m3 via 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-m3 embeddings and LLM extraction natively on Apple Silicon Metal GPUs.
  • For Docker execution, use http://host.docker.internal:11434 for 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!

  1. 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).
  2. Graph Exporters (apps/artifice-graph/src/exporters/): Implement custom graph serializers (e.g., RDF/Turtle, Graphviz DOT, or custom web visualizers).
  3. 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

artifice_graph-0.1.0.tar.gz (175.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artifice_graph-0.1.0-py3-none-any.whl (165.9 kB view details)

Uploaded Python 3

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

Hashes for artifice_graph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f6381ea663148ac43d3e719bd5f8be9bc41634c9302ae40c8a8264ffa78609b5
MD5 139a70a73b131d9b9036fb6a69b54107
BLAKE2b-256 3880eace8ea734d235ab789c4b74f57a358cc3c290f7d905c78e3b66a9d40168

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifice_graph-0.1.0.tar.gz:

Publisher: publish.yml on Muggwoffin/artifice-suite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for artifice_graph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01abfdda257bd9cf35e26072d0ada429e68d31670774a62c834d7f884502882a
MD5 d1eb748c197b99f31c8ae443f78a2ed4
BLAKE2b-256 e4e513dfbd411006e6b00fcb5640ce54b2787e7d16554960ea1150f467866c62

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifice_graph-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Muggwoffin/artifice-suite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page