Skip to main content

Interactive fiction craft corpus with search library and MCP server

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ifcraftcorpus-1.11.0.tar.gz (371.3 kB view details)

Uploaded Source

Built Distribution

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

ifcraftcorpus-1.11.0-py3-none-any.whl (457.8 kB view details)

Uploaded Python 3

File details

Details for the file ifcraftcorpus-1.11.0.tar.gz.

File metadata

  • Download URL: ifcraftcorpus-1.11.0.tar.gz
  • Upload date:
  • Size: 371.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ifcraftcorpus-1.11.0.tar.gz
Algorithm Hash digest
SHA256 e2e1d2075b45a8a3d78b11414884462a61c4963d6824c34826ec4a88fdd2c16c
MD5 aeb5d01070449c47fbb06b83bfae1f06
BLAKE2b-256 b9fe81eddec0c9dd16120c8deb73e70926ec6e371cfa1084adfbf077d8fa7e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifcraftcorpus-1.11.0.tar.gz:

Publisher: release.yml on pvliesdonk/if-craft-corpus

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

File details

Details for the file ifcraftcorpus-1.11.0-py3-none-any.whl.

File metadata

  • Download URL: ifcraftcorpus-1.11.0-py3-none-any.whl
  • Upload date:
  • Size: 457.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ifcraftcorpus-1.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15ea8e6ca8a3096bf086576e65173b66115bf010675ec44aa56fe11ee752b039
MD5 cd29e8e2f334e71cd526a11e16d65327
BLAKE2b-256 a0c867a50dde1571d85aab87544acb805e888a40765585e05571a38baa7800f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ifcraftcorpus-1.11.0-py3-none-any.whl:

Publisher: release.yml on pvliesdonk/if-craft-corpus

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