Files
EverOS/.claude/rules/init-py-and-reexport.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

38 lines
1.1 KiB
Markdown

---
paths:
- "src/**/__init__.py"
- "src/**/*.py"
---
# `__init__.py` and re-export rule
A package's `__init__.py` is its **public facade**. Consumers import from the
package, never from its internal modules.
## Pattern
```python
"""One-paragraph module docstring: what this package is and how to use it."""
from .models import Episode as Episode
from .models import MemCell as MemCell
__all__ = [
"Episode",
"MemCell",
]
```
- **Explicit `X as X` redundant-alias form** on each re-export. This is intentional:
it marks the name as a deliberate public re-export (ruff `F401` / `PLC0414` aware)
rather than an accidental unused import.
- **`__all__`** lists every public name, alphabetically sorted, matching the
re-exports. It is the contract; keep it in sync.
- **Internal modules stay private** — don't re-export helpers that aren't part of
the public API.
- New subpackage? Add an `__init__.py` with a docstring + `__all__` even if it
starts small. Empty-but-documented beats missing.
This facade discipline is what lets `import-linter` forbid deep imports across
package boundaries (see [architecture.md](architecture.md)).