AI Assistant Guide
This page is written for coding assistants (GitHub Copilot, Cursor, etc.) and for humans reviewing AI-generated changes.
Repository Mental Model
When modifying behavior, map the change to one or more layers:
- Phrase construction (
lingo/phrase.py) - Runtime dispatch/execution (
lingo/celery/language.py) - Transport serialization (
lingo/celery/protocol.py) - Persistence/progress (
lingo/storage/mongo/journal.py) - Artifact storage (
lingo/bucket/archive.py) - CLI surface (
lingo/cli.py)
High-Confidence Change Workflow
- Add or update behavior in one layer at a time.
- Add tests closest to that layer first.
- Run focused tests before broad test suites.
- Update guide docs if user-facing behavior changed.
- Ensure docstrings are Google style for new public APIs.
Invariants to Preserve
- Job status transitions should be monotonic.
- Serialized payloads must remain backward-compatible where practical.
- Fallback paths (distributed to local, compiled to simple) should preserve correctness.
- CLI should stay non-interactive and script-friendly.
Docstring Standard
Use Google style for public APIs:
- short summary line
Args:sectionReturns:sectionRaises:section when relevant
This style is required for clean mkdocstrings output.
When Unsure
Before changing semantics, inspect:
- tests in
tests/matching the subsystem - FastAPI example usage in
examples/fastapi/ - existing event names and status handling in journal/language modules