Skip to content

rdegraci/lorebuilder-cli

Repository files navigation

LoreBuilder CLI

A modular, persistent CLI for world-building and replayable, context-rich character conversations powered by LLMs, ChromaDB, and NLP.

License: MIT Python 3.8+


Features

  • Persistent Multi-Turn Chat – All conversations replayable via transactional SQLite logging.
  • Semantic Lore Search – Contextual retrieval via ChromaDB vector DB and modern embeddings.
  • LLM-Driven Stories – All generation/context managed via a master LoreService and LiteLLM.
  • NLP-Powered Character Recognition – Flexible, quoted, multi-word, and fuzzy chat with lore-synced character list, powered by spaCy/rapidfuzz.
  • Modular Command Registry & Dynamic Help – Only active commands appear in help/menus; per-command docs from handler docstrings.
  • Rich Terminal UI – User-centric, colorized feedback with Rich.

Quickstart

git clone https://github.com/yourusername/lorebuilder-cli.git
cd lorebuilder-cli
pip install -r requirements.txt
python -m spacy download en_core_web_sm
  • Configure your LLM API key in .env:

    LLM_API_KEY=your-model-api-key-here
  • (Optional) Edit app.yaml for additional config.

Run the app:

python app.py

Usage

  • Type help or help <command> inside the CLI.
  • Example command categories:
    • Lore: add_lore, generate_lore, store_generated_lore, query_lore, list_all_lore, delete_lore
    • Characters: chat_as, list_characters
    • System: help, exit

Directory Structure

app.py               # Main entrypoint
bootstrap.py         # Service initialization
cli.py               # CLI REPL and UX
help.py, cli_utils.py# Help & output styling
commands/            # Modular command handlers
lore.py              # LoreService logic
lore_entities.py     # Entity extraction and NLP
chat_history.py      # Chat/session tracking
app.yaml             # Configuration
.env                 # API keys (never commit)
ARCHITECTURE.md      # Dev architecture doc

Persistent World Model

  • Chat: lore_chat_history.db (SQLite)
  • Lore: ChromaDB vector storage, kept in sync with entity extraction

Dependencies

  • ChromaDB, SQLite3, LiteLLM, spaCy, rapidfuzz, Rich, python-dotenv, PyYAML

Documentation


Contributing

Pull requests welcome! Please open issues for bugs or feature requests.


Credits

  • Significant Contributors:

  • Inspirations & Foundations:

    • ChromaDB — Vector database design and docs
    • spaCy — NLP entity recognition pipeline
    • Rich — Terminal formatting and interactive UI

Contact


License

MIT (see LICENSE)

About

LoreBuilder CLI is a modular, developer-friendly command-line interface for world-building and context-rich character conversations. It integrates Retrieval-Augmented Generation (RAG) with ChromaDB vector search, persistent chat and lore storage using SQLite, and modern LLM-powered story expansion.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages