These rules apply to Codex when working in this repository.
- Install pre-commit hook:
ln -s -f ../../scripts/pre-commit .git/hooks/pre-commit
- No in-function imports. All imports must be at the module top level.
- Follow the module hierarchy when importing. Higher-level modules import from lower-level modules, never the reverse.
Module hierarchy (lowest to highest):
database/utils/routers/main.py
- Memory management: free large objects immediately after use. E.g.,
delfor byte arrays after processing,.clear()for dicts/lists holding data.
- All user-facing strings must use l10n (
context.l10n.keyName). Add keys to ARB files usingjqto avoid reading large files. - After modifying ARB files in
app/lib/l10n/, regenerate localizations:cd app && flutter gen-l10n
Always format code after making changes. The pre-commit hook handles this automatically, but you can also run manually:
- Dart (app/):
dart format --line-length 120 <files>- Files ending in
.gen.dartor.g.dartare auto-generated and should not be formatted manually.
- Files ending in
- Python (backend/):
black --line-length 120 --skip-string-normalization <files> - C/C++ (firmware: omi/, omiGlass/):
clang-format -i <files>
- Always run tests before committing:
- Backend changes: run
backend/test.sh - App changes: run
app/test.sh
- Backend changes: run