Development and Code Architecture¶
This page is a quick reference for contributors working on AgentECS internals.
Development workflow¶
- Create a branch for each change.
- Run checks locally before opening a PR:
task checkfor lint, format, type checks, and teststask lint:importsfor import contract validation- Keep changes scoped and atomic (one logical change per commit).
- Update docs when public behavior or architecture contracts change.
Runtime layers¶
AgentECS runtime code in src/agentecs/ is organized by dependency direction.
| Layer | Folders | Responsibility |
|---|---|---|
| 1 (outer) | adapters/ |
External integrations and boundary protocols |
| 2 | world/, scheduling/ |
Stateful orchestration and execution planning |
| 3 | storage/ |
Component storage interfaces and backends |
| 4 (inner) | core/ |
Stateless ECS primitives and pure operations |
Dependency flow is top-to-bottom (outer layers import inner layers).
Layer notes¶
world/andscheduling/are same-level peers and may import each other.storage/depends oncore/, but must import leaf modules (not thecorepackage facade).core/should not depend on runtime orchestration layers.
Other folders under src/agentecs/¶
config/: package configuration helpers.tracing/: execution history and tracing helpers.standard_library/: reusable higher-level ECS patterns._rust/: Rust-backed extensions.
Import contracts¶
Import boundaries are enforced by .importlinter and checked via task lint:imports.
runtime_layers (layers contract)¶
Defines runtime dependency direction:
agentecs.adaptersagentecs.world : agentecs.schedulingagentecs.storageagentecs.core
no_root_facade_imports (forbidden contract)¶
Internal runtime modules (core, storage, world, scheduling, adapters) must not import the root facade module agentecs.
storage_core_leaf_imports (forbidden contract)¶
agentecs.storage must not import agentecs.core directly. Use explicit leaf imports from submodules (for example agentecs.core.component.operations).