Skip to main content

Naming conventions for core/

A small, enforceable vocabulary so file and type names say what they are. The goal is that a reader can tell a data type from a process, a mutable state from a frozen view, and a package’s purpose from its name alone.

Glossary (one meaning per term)

Module naming: {domain}_{role}.py

Name a file for the concept it holds, not with a generic bucket word.

Type naming

  • Mixins carry a Mixin suffix — they cannot stand alone (they assume fields/methods the host provides). EventEmitterMixin, ToolFilterMixin, SteeringMixin.
  • Protocols are named by their role, not with a Protocol suffix — matches the stdlib (Iterable, SupportsRead) and agent_harness/ports.py (OutputSink, SessionStore). LoopHost, not LoopHostProtocol.
  • Do not prefix a type with its own package name. Inside core/agent/, a class is EventEmitterMixin, not AgentEventEmitter — the namespace already says “agent.”

Anti-patterns (do not add in new code)

  • context.py at core/ or core/agent/ root — “context” is overloaded across the repo. Name the concept (run_io.py, turn_snapshot.py).
  • models.py when the file holds only run I/O — too vague. Say what the models are (run_io.py).
  • *Context without a domain prefix when another *Context already exists.
  • A package whose only child is a single sub-package — collapse the wrapper.

Imports

Use fully qualified paths in code; keep short mental labels for docs. Re-export from a package __init__.py only for its single canonical symbol (Agent), not everything — avoid from core.agent import *-style ambiguity.