Behavior-first system modeling language.
BehavioML models systems using:
- Workflows
- Roles
- Capabilities
- Interfaces
- Components
- Modules
- Events
- Entities
- State Machines
- Decisions
Architecture is not modeled directly.
Architecture emerges from the model.
BehavioML is a behavior-first system modeling language designed for both humans and AI agents.
The goal is to model systems using behavior, responsibilities, state, and constraints, allowing architecture to emerge naturally from the model instead of being modeled explicitly.
BehavioML is:
- Visual-first
- Git-native
- AI-native
- Semantic
- Architecture-agnostic
BehavioML is not UML, BPMN, or Architecture-as-Code.
It is a system model.
Editors, diagrams, architecture views, documentation, and generated artifacts are views of the model.
Only the model is authoritative.
Information must exist in exactly one place.
If information appears in multiple places, the model is wrong.
| Entity | Owns |
|---|---|
| Workflow | Behavioral scenario |
| Role | Workflow participation |
| Capability | Responsibility |
| Interface | Architectural contracts |
| Component | Implementation |
| Module | Organization |
| Event | Observable occurrences |
| Entity | State ownership |
| State Machine | State transitions |
| Decision | Rationale |
Behavior is the primary concern.
Structure exists to implement behavior.
Behavior
↓
Responsibilities
↓
Implementation
Workflows are the primary entry point for understanding a system.
A workflow describes one behaviorally meaningful scenario.
A workflow may describe:
- nominal behavior
- failure handling
- timeout handling
- recovery behavior
- other meaningful behavioral scenarios
A workflow is not an exhaustive execution graph.
A workflow is not a program.
Implementation-local branching belongs in source code.
Workflows never describe implementation.
Capabilities describe responsibilities.
Examples:
validate_user
authenticate_user
store_user
send_email
create_stream
restart_ice
Capabilities:
- are reusable
- are implementation-independent
- can be composed
- can be shared across workflows
- can declare observable events associated with their behavior
Components describe implementation.
Examples:
AuthService
PromptDetector
UserRepository
IndexedDbStorage
Components do not describe behavior.
Components implement behavior.
Modules describe:
- ownership
- packaging
- boundaries
Modules do not describe behavior.
Decisions answer:
Why?
Not:
What?
Architecture is an emergent property.
Architecture is derived from:
Workflows
Roles
Capabilities
Interfaces
Components
Modules
Decisions
Architecture is a generated view.
Architecture is not a source of truth.
Paths are semantic.
The filesystem defines identity and namespace.
Example:
capabilities/auth/validate_user.yaml
Scope:
capabilities
Path identity:
auth/validate_user
Directories may group related model entities.
For example, related workflows may be grouped by domain area, protocol phase, feature, role, or behavior family:
workflows/connection/client/establish_connection.yaml
workflows/connection/client/handle_handshake_failure.yaml
workflows/connection/endpoint/handle_idle_timeout.yaml
A separate higher-level entity should only be introduced when the group itself needs source-of-truth metadata.
Every entity is represented by exactly one file.
BehavioML does not use:
- IDs
- UUIDs
- Internal names
Identity is derived from the file path inside an entity scope.
A field defines the target entity type for its references.
The reference value is a path identity inside that target scope.
References are never filesystem-relative.
Examples:
| Field | Target scope | Value | Resolves to |
|---|---|---|---|
steps |
capabilities/ |
auth/validate_user |
capabilities/auth/validate_user.yaml |
triggered_by |
events/ |
handshake_failed |
events/handshake_failed.yaml |
requires |
interfaces/ |
crypto/tls_handshake |
interfaces/crypto/tls_handshake.yaml |
roles.primary |
roles/ |
client |
roles/client.yaml |
Allowed:
auth/validate_user
handshake_failed
client
Forbidden:
../validate_user
./validate_user
Some fields are polymorphic and can reference multiple entity types.
Polymorphic fields must use typed references.
Typed reference syntax:
<scope>:<path-identity>
Example:
workflows:connection/client/establish_connection
capabilities:connection/perform_handshake
events:handshake_failed
URL-like forms are not used.
Forbidden:
events://handshake_failed
Behavior must not be duplicated.
Repeated behavior should be extracted into reusable capabilities.
Describes one behaviorally meaningful scenario.
Examples:
establish_connection
handle_handshake_failure
handle_idle_timeout
close_connection
A workflow owns:
- behavioral intent
- ordered steps
- participating roles
- optional triggering events
A workflow is expressed as steps through capabilities.
A workflow may be triggered by events.
Important failures, timeouts, retries, and recovery paths may be represented as separate workflows when they are meaningful at system-behavior level.
Workflows should not model every execution branch.
Related workflows may be grouped by directory instead of introducing a separate Scenario, Use Case, Story, or Journey entity.
A higher-level workflow grouping entity should only be introduced when that grouping needs its own source-of-truth metadata.
Represents a functional participant in a workflow.
Examples:
client
server
endpoint
publisher
subscriber
relay
A role is not:
- a Component
- an Entity
- a Module
- an implementation
Roles describe who participates in behavior, not how that behavior is implemented.
Describes responsibility.
Capabilities may be atomic or composite.
Capabilities may declare observable events associated with their behavior.
Capability-declared events do not imply exact timing, final result, success/failure classification, or a single receiver.
Describes an architectural dependency.
Examples:
user_repository
storage_provider
llm_provider
Interfaces separate responsibility from implementation.
Describes implementation.
Implements:
- capabilities
- interfaces
Describes organizational boundaries.
Represents something observable that happened in the system.
Events may be consumed by:
- workflows
- state machines
- monitoring
- other behavior
Examples:
user_created
payment_completed
ice_restart_completed
handshake_failed
Represents ownership of state.
Examples:
User
Order
Session
Prompt
Stream
WhipSession
Owns:
- states
- transitions
- lifecycle constraints
State machines describe what is allowed.
Explains rationale.
A decision may affect any model entity.
When a decision references affected entities, those references are polymorphic and must use typed reference syntax.
Example:
workflows:connection/client/establish_connection
capabilities:connection/perform_handshake
events:handshake_failed
Workflow
involves
Role
Workflow
steps through
Capability
Workflow
may be triggered by
Event
Capability
uses
Capability
Capability
requires
Interface
Capability
declares observable
Event
Component
implements
Capability
Component
implements
Interface
Component
belongs_to
Module
Decision
affects
Any model entity
Event
triggers
StateMachine
StateMachine
belongs_to
Entity
Workflows do not own transitions.
State machines own transitions.
Capabilities may declare observable events.
Events may trigger workflows.
Events trigger state transitions.
This prevents:
- duplication
- circular references
- workflow-state coupling
- workflow-as-code modeling
Architecture =
Workflows
+ Roles
+ Capabilities
+ Interfaces
+ Components
+ Modules
+ Decisions
Architecture is derived.
Architecture is never modeled directly.
BehavioML does not model:
- Classes
- Objects
- Inheritance
- Aggregation
- Composition
- Private Methods
- Framework Details
- Implementation Patterns
- Implementation-local Branching
- Technical Exceptions
These belong in source code.
model/
├── workflows/
├── roles/
├── capabilities/
├── interfaces/
├── components/
├── modules/
├── events/
├── entities/
├── state-machines/
├── decisions/
└── generated/
Only model directories contain source-of-truth information.