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
- Code: MIT License (see LICENSE)
- Content: CC-BY-4.0 (see LICENSE-CONTENT)
Contributing
Contributions welcome! Please open an issue or PR.
Project details
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e1d2075b45a8a3d78b11414884462a61c4963d6824c34826ec4a88fdd2c16c
|
|
| MD5 |
aeb5d01070449c47fbb06b83bfae1f06
|
|
| BLAKE2b-256 |
b9fe81eddec0c9dd16120c8deb73e70926ec6e371cfa1084adfbf077d8fa7e47
|
Provenance
The following attestation bundles were made for ifcraftcorpus-1.11.0.tar.gz:
Publisher:
release.yml on pvliesdonk/if-craft-corpus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ifcraftcorpus-1.11.0.tar.gz -
Subject digest:
e2e1d2075b45a8a3d78b11414884462a61c4963d6824c34826ec4a88fdd2c16c - Sigstore transparency entry: 984941403
- Sigstore integration time:
-
Permalink:
pvliesdonk/if-craft-corpus@bfa5640010b48b1a20c0cc2d209dca86bd66946f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pvliesdonk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bfa5640010b48b1a20c0cc2d209dca86bd66946f -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ea8e6ca8a3096bf086576e65173b66115bf010675ec44aa56fe11ee752b039
|
|
| MD5 |
cd29e8e2f334e71cd526a11e16d65327
|
|
| BLAKE2b-256 |
a0c867a50dde1571d85aab87544acb805e888a40765585e05571a38baa7800f9
|
Provenance
The following attestation bundles were made for ifcraftcorpus-1.11.0-py3-none-any.whl:
Publisher:
release.yml on pvliesdonk/if-craft-corpus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ifcraftcorpus-1.11.0-py3-none-any.whl -
Subject digest:
15ea8e6ca8a3096bf086576e65173b66115bf010675ec44aa56fe11ee752b039 - Sigstore transparency entry: 984941406
- Sigstore integration time:
-
Permalink:
pvliesdonk/if-craft-corpus@bfa5640010b48b1a20c0cc2d209dca86bd66946f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pvliesdonk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bfa5640010b48b1a20c0cc2d209dca86bd66946f -
Trigger Event:
workflow_dispatch
-
Statement type: