Files
EverOS/.claude/rules/async-programming.md
Elliot Chen 518b8eca85 chore: initialize EverOS 1.0.0
md-first memory extraction framework for AI agents.

Markdown is the single source of truth; SQLite holds state and LanceDB
provides the rebuildable vector + BM25 + scalar index. The codebase follows
a single-direction DDD layering (entrypoints -> service -> memory -> infra,
with component / core / config cross-cutting) enforced by import-linter.

Engineering surface:
- Coding conventions in .claude/rules/ (path-scoped) and workflows in
  .claude/skills/ (/commit, /new-branch, /pr).
- GitHub Actions CI runs make lint + test + integration; pre-commit mirrors
  the gates locally (ruff, hygiene hooks, gitlint commit-msg).
- Commit messages follow Conventional Commits, enforced by gitlint.
- make lint also enforces datetime two-zone discipline and OpenAPI drift.
2026-06-06 07:33:17 +08:00

22 lines
957 B
Markdown

---
paths:
- "src/**/*.py"
- "tests/**/*.py"
---
# Async programming rule
The write/read paths are async end-to-end. Keep them non-blocking.
- **No blocking calls in async functions** — no synchronous file I/O, no `time.sleep`,
no blocking DB/network calls inside `async def`. Ruff `ASYNC` flags the common cases.
- **Offload CPU/blocking work** with `anyio.to_thread.run_sync` (or the established
helper) rather than blocking the event loop.
- **Concurrency** via `asyncio.gather` / `asyncio.TaskGroup` for independent awaits;
don't `await` in a loop when the calls are independent.
- **Tests**: `pytest-asyncio` is in `auto` mode — an `async def test_*` just works,
no `@pytest.mark.asyncio` needed.
- **Don't fire-and-forget** without holding a reference (`asyncio.create_task` results
must be tracked, or you lose exceptions). The OME subsystem owns the long-running
background loops — application code shouldn't spawn its own.