Skip to main content

IF Craft Corpus

A curated knowledge base for interactive fiction writing craft, with a Python library for search and RAG applications.

Features

  • 48 documents covering narrative structure, prose craft, genre conventions, and more
  • 1300+ searchable sections with detailed craft guidance
  • Python library for programmatic access with FTS and optional semantic search
  • Pre-built index for instant search without setup

Installation

pip install ifcraftcorpus

For semantic search with embeddings:

pip install ifcraftcorpus[embeddings]

Quick Start

from ifcraftcorpus import Corpus

# Initialize corpus (uses bundled content and pre-built index)
corpus = Corpus()

# Full-text search
results = corpus.search("dialogue subtext techniques")
for r in results:
    print(f"{r.document}: {r.heading}")
    print(f"  {r.snippet}...")

# Browse by cluster
docs = corpus.list_documents(cluster="prose-and-language")

# Get full document
doc = corpus.get_document("dialogue_craft")
print(doc.title, doc.summary)

Semantic Search (Optional)

# Enable semantic search with sentence-transformers
corpus = Corpus(embeddings="all-MiniLM-L6-v2")

# Hybrid search combines FTS + semantic
results = corpus.search(
    "how to write realistic conversations",
    mode="hybrid"
)

Corpus Clusters

Cluster Documents Focus
narrative-structure 9 Pacing, beats, branching, scene structure
prose-and-language 7 Dialogue, voice, style, prose patterns
craft-foundations 10 Quality standards, testing, workflow, tools
world-and-setting 5 Worldbuilding, canon, setting, naming
genre-conventions 7 Mystery, horror, fantasy, romance, sci-fi, tropes
audience-and-access 3 Accessibility, localization, targeting
emotional-design 2 Emotional beats, catharsis
scope-and-planning 1 Scope, length, planning
agent-design 3 Multi-agent patterns, prompt engineering
game-design 1 Mechanics design patterns

Verbose Logging

Set LOG_LEVEL (e.g., INFO, DEBUG) or the convenience flag VERBOSE=1 before launching ifcraftcorpus, ifcraftcorpus-mcp, or the Docker image to emit detailed logs to stderr. Example:

LOG_LEVEL=DEBUG ifcraftcorpus-mcp

# Docker
docker run -p 8000:8000 \
  -e LOG_LEVEL=DEBUG \
  ghcr.io/pvliesdonk/if-craft-corpus

Logs never touch stdout, so stdio transports remain compatible.

Documentation

Full documentation: https://pvliesdonk.github.io/if-craft-corpus

License

Contributing

Contributions welcome! Please open an issue or PR.

Metadata

Release files for ifcraftcorpus 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ifcraftcorpus 1.11.0
File Size Uploaded Provenance
ifcraftcorpus-1.11.0.tar.gz 371.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ifcraftcorpus 1.11.0
File Interpreter ABI Platform
ifcraftcorpus-1.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 829.1 kB

Release files / ifcraftcorpus-1.11.0.tar.gz

Download URL ifcraftcorpus-1.11.0.tar.gz
Size 371.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e2e1d2075b45a8a3d78b11414884462a61c4963d6824c34826ec4a88fdd2c16c
BLAKE2b-256 checksum
How to use checksums
b9fe81eddec0c9dd16120c8deb73e70926ec6e371cfa1084adfbf077d8fa7e47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

Release files / ifcraftcorpus-1.11.0-py3-none-any.whl

Download URL ifcraftcorpus-1.11.0-py3-none-any.whl
Size 457.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15ea8e6ca8a3096bf086576e65173b66115bf010675ec44aa56fe11ee752b039
BLAKE2b-256 checksum
How to use checksums
a0c867a50dde1571d85aab87544acb805e888a40765585e05571a38baa7800f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

Security for ifcraftcorpus 1.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ifcraftcorpus-1.11.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page