A model-first, artifact-driven engineering tool for visual system modeling, equation extraction, simulation, and control design — inspired by Simscape and Modelica.
Phase 1 (Visual Modeling Tier) — under active development.
- component library and registry
- visual block-diagram canvas with drag/drop
- graph assembly and validation
- project package persistence (
.systemdesign/directory format) - configuration UI for controllers, I/O, simulation, and plots
- unified result panel with grouped plot type selection
Phase 2 (Equation Extraction, Simulation, Stability) and Phase 3 (Advanced Performance) are planned. See specs/07_implementation_order.md for the staged roadmap.
The project is organized around a three-layer application structure:
application/— application shell, composition, routing, and orchestration.features/— domain-oriented modules such as system modeling and controller design.shared/— reusable components, types, and utilities shared across modules.
The target architecture follows two feature modules backed by a shared simulation engine:
features/SystemModelingModulefeatures/ControllerDesignModuleshared/engine(Phase 2 only — Phase 1 raisesImportError)shared/componentsshared/graphshared/probesshared/typesshared/utilsshared/registry
For the full layered architecture, see specs/06_data_flow_and_architecture.md §2.
Create and activate the local environment:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txtInstall the project in editable mode so that the application,
features, and shared packages are importable from anywhere:
python -m pip install -e .This is a one-time setup. After this step, the project layout under
src/ is registered with the active Python environment.
Install pre-commit hooks (one-time setup):
pre-commit installRun the desktop app:
python -m application.mainOr use the installed console script:
system-designerTo run with debug logging:
python -m application.main --debugAfter setup, verify everything is wired correctly:
ruff check src tests
ruff format --check src tests
mypy --config-file pyproject.toml src
pytest -m architecture -vIf pytest -m architecture reports PASSED for all (or SKIPPED for
the logging-events test, which is expected before Stage S1), the
project is in a clean Stage S0 baseline.
Tests are segmented by pytest markers:
# Architecture invariants (must pass at all times — runs first in CI)
pytest -m architecture
# Unit tests
pytest -m unit
# Integration tests
pytest -m integration
# GUI tests (requires display or Xvfb)
pytest -m gui
# All tests except slow
pytest -m "not slow"
# Coverage report
pytest -m unit --cov=src --cov-report=htmlpyproject.toml already adds src/ to the pytest path, so the
commands above work without manual PYTHONPATH configuration.
See specs/12_ci_cd_pipeline.md §6 for the full test segmentation policy.
This project is designed to support AI-assisted development. Read the documents below in order before making changes.
The order below is the conflict-resolution authority order from specs/08_codex_execution_rules.md §3.1.
specs/08_codex_execution_rules.md— Execution contract for AI agents. Read this first.specs/02_workspace_requirements.md— Visual modeling canvas, graph, identity model, persistence.specs/03_configuration_requirements.md— Controller, I/O, simulation, plot layout configuration.specs/04_model_equations_requirements.md— Equation extraction pipeline (Phase 2).specs/05_simulation_and_results_requirements.md— Simulation engine, results, stability, plots.specs/06_data_flow_and_architecture.md— Module ownership, project structure, ADR catalog.specs/07_implementation_order.md— 8-stage roadmap (S0–S7) with dependencies and risks.specs/01_library_requirements.md— Component library, registry, SVG, drag/drop.specs/09_coding_standards.md— Python style, type hints, naming, PySide6 conventions.specs/10_logging_conventions.md— Logger hierarchy, levels, structured logging.specs/11_error_code_catalog.md— Stable error code catalog.specs/12_ci_cd_pipeline.md— CI/CD pipeline definition.decisions/ADR-001..017.md— Architecture Decision Records.
Before writing code, the AI agent must internalize these rules from 08:
- Specs are contracts, not suggestions. Do not "improve" architectural decisions captured in ADRs.
- Phase 1 must not import
shared.engine. This is enforced at startup withImportError(ADR-001). WorkspaceModelis the source of truth. UI components subscribe to its signals; they do not store independent state (ADR-003).- Component instance IDs use ULID with
cmp_prefix. Do not use display names as references (ADR-002). - Plot configuration uses
channel_selection.kindschema. Legacysignals[]arrays are forbidden (ADR-016). - Stability artifact is separate from ODE artifact. A/B/C/D matrices live in
StabilityAnalysisArtifact, notODEArtifact(ADR-010, ADR-013). - Result panel is unified. Both simulation results and stability analysis render in the same 4-slot panel (ADR-015).
See specs/08_codex_execution_rules.md §6 for the complete list. Highlights:
- No fake simulation data to make plots appear to work.
- No silent equation linearization without explicit user workflow.
- No hardcoded quarter-car topology in generic library components.
- No A/B/C/D matrices in
ODEArtifact(they belong inStabilityAnalysisArtifact). - No skipping migration tests for schema changes.
Codex_Project/
├── README.md ← you are here
├── pyproject.toml
├── requirements.txt
├── requirements-dev.txt
├── .gitignore
│
├── specs/ ← all specification documents
│ ├── 01_library_requirements.md
│ ├── 02_workspace_requirements.md
│ ├── 03_configuration_requirements.md
│ ├── 04_model_equations_requirements.md
│ ├── 05_simulation_and_results_requirements.md
│ ├── 06_data_flow_and_architecture.md
│ ├── 07_implementation_order.md
│ ├── 08_codex_execution_rules.md
│ ├── 09_coding_standards.md
│ ├── 10_logging_conventions.md
│ ├── 11_error_code_catalog.md
│ └── 12_ci_cd_pipeline.md
│
├── decisions/ ← Architecture Decision Records
│ ├── README.md
│ ├── _template.md
│ └── ADR-001 ... ADR-017
│
├── .github/ ← CI/CD pipeline
│ └── workflows/
│ └── ci.yml
│
├── tests/ ← test code
│ ├── __init__.py
│ └── architecture/
│ ├── __init__.py
│ └── test_*.py
│
├── assets/ ← localization, license files
│ └── locales/
│ └── en.json
│
└── src/ ← source code
├── application/ ← QApplication entry, shell, bootstrap
│ ├── __init__.py
│ ├── main.py ← entry point: python -m application.main
│ └── SystemDesignerShell/
│ ├── __init__.py
│ └── main_window.py
├── features/
│ ├── SystemModelingModule/ ← visual modeling, workspace, graph
│ │ ├── model/ ← WorkspaceModel, ComponentInstance
│ │ ├── commands/ ← QUndoCommand subclasses
│ │ ├── panels/ ← Library, Info, ModelEquations panels
│ │ └── workspace/ ← BlockDiagramWorkspace (UI)
│ └── ControllerDesignModule/ ← configuration, controller design
│ ├── model/ ← ControllerSettings, IOSelection, PlotLayout
│ ├── builders/ ← Phase 2: TF/SS builders, linearization
│ └── panels/
│ ├── ConfigurationPanel/ ← 4-tab config panel
│ └── ResultsPanel/ ← 4-slot unified result panel
└── shared/
├── components/ ← component schema dataclasses
├── registry/ ← ComponentRegistry, DomainRegistry
├── graph/ ← SystemGraph, GraphAssembler
├── types/ ← domain enums, port kinds, plot types
├── probes/ ← output observation
├── utils/ ← helpers (ULID, JSON, units, logging)
└── engine/ ← PHASE 2 ONLY — Phase 1: ImportError
The project distinguishes product phases (user-facing capability tiers) from implementation stages (build order).
| Phase | Capability |
|---|---|
| Phase 1 | Visual modeling: canvas, graph, validation, persistence (active) |
| Phase 2 | Equation extraction, simulation, stability analysis, controller runtime |
| Phase 3 | Advanced performance, large-scale workflows, nonlinear systems, streaming |
| Stage | Phase | Name | Output |
|---|---|---|---|
| S0 | Pre-Phase 1 | Architecture Scaffold and ADR Gate | folder skeleton, import boundaries, ADR baseline |
| S1 | Phase 1 | Workspace Foundation | WorkspaceModel, commands, graph |
| S2 | Phase 1 | Configuration and Project Package | controller/config/plot placeholders, .systemdesign/ |
| S3 | Phase 2A | Equation System | ODEArtifact |
| S4 | Phase 2B | Simulation Engine | SimulationResultArtifact |
| S5 | Phase 2C | Stability and Control Analysis | StabilityAnalysisArtifact |
| S6 | Phase 2D | Plot and Result Rendering | unified result panel |
| S7 | Phase 2E | Controller Runtime Integration | closed-loop execution |
See specs/07_implementation_order.md for the full stage-by-stage execution plan with acceptance criteria.
- Pull latest from
main. - Create a feature branch:
git checkout -b feature/<short-description>. - Make changes, following coding standards (
specs/09_coding_standards.md). - Run linter and tests locally:
ruff check src tests mypy --config-file pyproject.toml src pytest -m "architecture or unit" - Commit with a message matching the convention from
specs/08_codex_execution_rules.md§13.2. - Push and open a pull request.
- CI runs the full pipeline (see
specs/12_ci_cd_pipeline.md). - Address review comments.
- Squash merge once approved.
Significant architectural decisions are captured as ADRs under decisions/. Before introducing a new architectural pattern:
- Check
specs/06_data_flow_and_architecture.md§19 for existing ADRs. - If no ADR covers your decision, draft a new one using
decisions/_template.md. - Have it reviewed before implementing.
- Once accepted, the ADR becomes immutable (it can be superseded but not deleted).
If your change affects project.json or any saved data structure:
- Bump the relevant
schema_versionin the schema definition. - Add a migration to
features/SystemModelingModule/model/migrations/. - Add a round-trip migration test.
- Update the relevant spec section.
See specs/02_workspace_requirements.md §29.3.1 for the full schema migration contract.
| Document | Purpose |
|---|---|
specs/01_library_requirements.md |
Component library and registry |
specs/02_workspace_requirements.md |
Visual canvas, identity, persistence |
specs/03_configuration_requirements.md |
Configuration panels |
specs/04_model_equations_requirements.md |
Equation extraction (Phase 2) |
specs/05_simulation_and_results_requirements.md |
Simulation engine and results (Phase 2) |
specs/06_data_flow_and_architecture.md |
Module ownership and architecture |
specs/07_implementation_order.md |
Stage-by-stage build plan |
specs/08_codex_execution_rules.md |
AI agent execution contract |
specs/09_coding_standards.md |
Python style and conventions |
specs/10_logging_conventions.md |
Logging hierarchy and format |
specs/11_error_code_catalog.md |
Stable error code catalog |
specs/12_ci_cd_pipeline.md |
CI/CD pipeline |
decisions/ |
Architecture Decision Records |
(To be determined.)
If SVG assets in this project are adapted from third-party sources (e.g., Modelica Standard Library), their original licenses are preserved under assets/licenses/ and referenced from the SvgRegistry attribution metadata (see specs/01_library_requirements.md §10.4.1).
- For bug reports, open a GitHub issue.
- For architectural questions, check
decisions/first; open a discussion if no ADR covers your case. - For coding standards questions, see
specs/09_coding_standards.md. - For AI agent integration questions, see
specs/08_codex_execution_rules.md.
Inspired by:
- MathWorks Simscape (modeling philosophy)
- Modelica Association (Modelica Standard Library and Bond Graph approach)
- CasADi project (symbolic + numerical backend, planned for Phase 2)
These influences are referenced in the relevant ADRs and spec sections; the project does not depend on any of these tools at runtime in Phase 1.