ACE Roleplay adapts the ACE method to deterministic, multi-turn roleplay conversations. It stores short "bullets" in SQLite with FTS5 for fast retrieval, runs a generator → reflector → curator loop, and exposes both CLI and API interfaces.
+---------+ +-------------+ +----------+
| User | --> | ChatSession | --> | Generator|
+---------+ +------+------+ +----+-----+
| |
v v
+----+-----+ +----+-----+
| Retriever| | Evaluators|
+----+-----+ +----+-----+
| |
v v
+----+-----+ +----+-----+
| Reflector| --> | Curator |
+----------+ +----------+
- SQLite playbook with deterministic migrations and FTS5 search.
- Retrieval combines persona canon, tactics, continuity, antipatterns, and user preferences.
- Generator produces roleplay responses and traces without requiring network access.
- Evaluators catch out-of-character slips, contradictions, repetition, and boundary risk.
- Reflector proposes small deltas, curator applies them deterministically.
- CLI (Typer) and FastAPI server for integration.
- Example persona seed for immediate use.
pip install -e .Optional MinHash deduplication support:
pip install -e .[minhash]Set the following environment variables or edit .env:
ACE_OPENAI_API_KEYACE_OPENAI_BASE_URL
Seed the database and start chatting:
ace-roleplay seed
ace-roleplay chatInspect or search bullets:
ace-roleplay search --text "hooks"
ace-roleplay statsRun the FastAPI server:
uvicorn ace_roleplay.api:app --reloadCall the chat endpoint:
curl -X POST localhost:8000/chat \
-H "Content-Type: application/json" \
-d '{"user_message": "The guards are coming!"}'pytest -qLinting suggestions:
ruff check .
black --check .
mypy .- Fork and create a topic branch.
- Add tests for new behavior.
- Ensure
pytest -qand linters pass. - Submit a pull request describing the change and test coverage.
MIT License. See LICENSE for details.