Version: v1.2.7 | Status: Active | Last Updated: March 2026
Codomyrmex is an idealized modular workspace designed to facilitate interaction between (pairwise) and among (multiple) humans, people, agents, synthetic systems, embodiments, tools, and things most broadly.
It functions as a cohesive "colony" of specialized modules where each component has a single responsibility, clear boundaries, and standardized interfaces. The system abstracts complexity through layering, ensuring that high-level workflows can be orchestrated without tight coupling to low-level implementations.
- Modularity: The system must allow individual modules to be added, removed, or upgraded without breaking the larger system.
- Agent-Readability: All components must be self-documenting in a way that is parseable and understandable by AI agents (via
AGENTS.mdandSPEC.md). - Deep Signposting: Every directory must provide clear navigation to its parent, children, and related modules to enable distinct context retrieval.
- Polyglot Support: The architecture must support tools and code in multiple languages, unified by standard protocols (like MCP and shared config).
- Safe Execution: Code execution must be sandboxed and observable.
- Discoverability: All modules must be discoverable via the
system_discoverymechanism and registered in the module index. - Instrumentation: Every module must integrate with
logging_monitoringfor structured telemetry and observability. - Integration Workspaces: The
projects/surface must support standalone integration projects (includingdaf-consultingandhermes-paperclip-adapter) without coupling into core module boundaries.
- Each module is a self-contained unit under
src/codomyrmex/with its own implementation, tests, and RASP documentation pattern — four standard files that make every module self-describing:- README.md — Module overview, exports, and quick start
- AGENTS.md — AI agent coordination and operating contracts
- SPEC.md — Functional specification and design rationale
- PAI.md — PAI system integration and algorithm phase mapping
- Modules expose only public APIs; internal implementation details remain encapsulated.
- Adding, removing, or upgrading a module must not require changes to unrelated modules.
- Consistent directory structure and naming conventions across all 128 top-level modules.
- Unified documentation patterns: every module carries the same set of specification files.
- Shared configuration idioms via standardized
Configobjects andpyproject.tomlextras.
- Include only essential elements; avoid speculative abstractions.
- Minimize the public API surface area of each module to reduce coupling.
- Lazy module loading ensures startup cost scales with usage, not with total module count.
- Prioritize working solutions over theoretical completeness.
- Forward-looking design that accommodates future modules without requiring rewrites.
- Each module must deliver demonstrable value through its defined interfaces.
- Comprehensive test coverage enforced through
pytestwith structured markers (unit,integration,slow,network,external). - 40% line-coverage floor in
[tool.coverage.report] fail_under(pyproject.toml). Plainuv run pytestdoes not collect coverage;make test, CI unit jobs, and explicit--cov=src/codomyrmex --cov-fail-under=40apply the gate. The experimentalmemepackage is omitted from[tool.coverage.run]measurement. - Test-driven development practices encouraged; tests live alongside source in
src/codomyrmex/tests/unit/<module>/. - Real data analysis required over mocked approximations. Tests use skip-when-unavailable guards for external dependencies.
- Self-documenting code with clear docstrings and type annotations.
- Complete API specifications (
API_SPECIFICATION.md) and MCP tool definitions (MCP_TOOL_SPECIFICATION.md) for applicable modules with AI-callable tools. - Living documentation that stays synchronized with implementation through scaffolding tools.
The system is organized into four hierarchical layers. Dependencies flow strictly upward: higher layers may depend on lower layers, but never the reverse.
graph TB
subgraph Application["Application Layer"]
CLI[cli]
SD[system_discovery]
end
subgraph Service["Service Layer"]
DOC[documentation]
API[api]
CICD[ci_cd_automation]
CONT[containerization]
DB[database_management]
CFG[config_management]
LOG2[logistics]
ORCH[orchestrator]
end
subgraph Core["Core Layer"]
AGT[agents]
COD[coding]
LLM[llm]
GIT[git_operations]
SEC[security]
PERF[performance]
DV[data_visualization]
end
subgraph Foundation["Foundation Layer"]
LM[logging_monitoring]
ES[environment_setup]
MCP[model_context_protocol]
TI[terminal_interface]
end
Application --> Service
Service --> Core
Core --> Foundation
- Foundation Layer: Core infrastructure consumed by every other layer. Provides logging, environment validation, MCP interfaces, and terminal formatting.
- Core Layer: Primary capabilities including agent frameworks, code analysis (within
coding/), LLM integration, version control, security scanning, performance profiling, and data visualization. - Service Layer: Higher-level orchestration that composes core capabilities into documentation generation, API management, CI/CD pipelines (includes build automation), container management, database operations, configuration, logistics workflows, and workflow orchestration.
- Application Layer: User-facing entry points. The CLI provides the primary human interface;
system_discoveryprovides module health monitoring and dynamic registration.
__init__(config: SimulationConfig = None, agents: List[Agent] = None): Initialize simulation.run() -> SimulationResult: Execute simulation loop.add_agent(agent: Agent): Add agent to environment.remove_agent(agent_id: str): Remove agent from environment.
act(observation: dict) -> Action: logic for agent decision making.learn(reward: float): logic for agent learning.
add_node(node_id: str, data: Any = None) -> Node: Add node to graph.add_edge(source_id: str, target_id: str, weight: float = 1.0) -> Edge: Add edge between nodes.get_neighbors(node_id: str) -> List[Node]: Get adjacent nodes.shortest_path(start_id: str, end_id: str) -> List[Node]: Find shortest path (Dijkstra).
- Coupling: Aim for loose coupling between modules and high cohesion within each module.
- Modularity Gate: New modules must pass structure validation (RASP documentation — README, AGENTS, SPEC, PAI — plus
__init__.pyand test file scaffolding) before being committed. - Documentation Coverage: 100% of module directories must contain a non-skeletal
README.mdwith accurate content. - Interface Stability: Public API changes require a semantic version bump and updated specification documents.
- Test Coverage: All modules must maintain unit test coverage; integration tests are required for cross-module interactions.
- Entry Points:
__init__.pyserves as the primary entry point for every module, exporting the public API. - Configuration: Modules receive configuration through standardized
Configobjects and environment variables validated byenvironment_setup. - Output Standards: Consistent return types (e.g.,
Resultobjects for operations, structured dicts for data) across all module APIs. - MCP Protocol: Modules that expose AI-callable tools must define them in
MCP_TOOL_SPECIFICATION.mdfollowing the Model Context Protocol schema. - Error Handling: Modules must raise domain-specific exceptions and log errors through
logging_monitoringrather than silently failing.
- Inputs:
- User commands (CLI, Shell).
- AI Agent requests (MCP, Function Calls).
- Event triggers (File changes, Webhooks).
- Outputs:
- Synthesized code and artifacts.
- Structured logs and telemetry.
- Visualizations and reports.
- Executable processes.
- Boundaries:
- Modules interact primarily through public APIs defined in
src/codomyrmex/. - Cross-module dependencies are strictly hierarchical (Foundation -> Core -> Service -> Application).
- Modules interact primarily through public APIs defined in
- Scaffolding: Use
doc_scaffolder.pyto initialize new modules with the correct directory structure and documentation templates. - Signposting: Maintain current parent/child navigation links in all markdown files to support agent traversal.
- Dependency Management: All dependencies are declared in
pyproject.toml; module-specificrequirements.txtfiles are deprecated. - Refactoring: Regularly audit modules for TODO cleanup, placeholder replacement, and adherence to current conventions.
- Versioning: All modules follow semantic versioning starting at
v0.1.0; version bumps are coordinated at the repository level.
This root directory serves as the nexus of the colony. It does not contain business logic itself but defines the structure (skeleton) and rules (membrane) that hold the organism together. The src/ directory contains the organs, docs/ the memory, and scripts/ the reflexive behaviors.
Active items tracked by sprint target.
| Item | Status | Sprint Target | Notes |
|---|---|---|---|
| Circular imports: ~35 pairs across modules | Fixed | Sprint 17 | Sprint 17 audit: --check confirmed 0 circular imports via ci_cd_automation build import fix |
| Oversized files: 16 non-test files >800 LOC | Open | Sprint 35 | Largest: orchestration.py; ongoing; track in TODO.md |
| 6 optional modules fail import | Expected | — | Cloud (AWS/Azure/GCP), performance.monitoring, lazy_loader, security cert validator — require optional SDKs |
| Bidirectional PAI↔codomyrmex comms | Fixed | v1.1.0 | agents/pai/pai_webhook.py + agents/pai/pai_client.py added in v1.1.0 |
| Tool versioning: no deprecation timeline UI | Open | Sprint 35 | deprecated_in metadata present but not surfaced in MCP tool list |
- Documentation: Reference Guides
- All Agents: AGENTS.md
- Functional Spec: SPEC.md
- Source Index: src/README.md
- Module Docs: docs/modules/
- Repository Root: README.md