# foxprint666/aether-lang architecture

> Architecture diagram of the GitHub repository foxprint666/aether-lang, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/foxprint666/aether-lang
- Repository: https://github.com/foxprint666/aether-lang

## Overview

Aether is an AI-safe code-change runtime: agents submit structured AST patches, which are validated, applied, and—through the Python orchestrator—snapshotted, sandboxed, and committed or rolled back. Python and Node.js provide runtime SDKs; Rust also contains a separate Aether language compiler. The README documents the broader runtime capabilities, while several Node and Rust connections are only documented at a high level. Dashed edges mark those unverified relationships.

Main entry points: [`sdk/python/ai_runtime/orchestrator.py`](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/orchestrator.py) (Patch Orchestrator), [`sdk/node/src/patch_engine.ts`](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/patch_engine.ts) (Node Patch Engine), [`sdk/python/ai_runtime/patch_engine.py`](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/patch_engine.py) (Patch Engine), [`sdk/python/ai_runtime/sandbox.py`](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox.py) (Sandbox Dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_py_flow["Python Patch Workflow"]
  node_py_orchestrator["Patch Orchestrator<br/>[orchestrator.py]"]
  node_py_validation["Patch Validation<br/>[schema.py]"]
  node_py_rules["Security Rules<br/>[rules.py]"]
  node_py_semantic["Semantic Gate<br/>[ae_bridge.py]"]
  node_py_patch_engine["Patch Engine<br/>[patch_engine.py]"]
  node_py_ast["Python AST Apply<br/>[engine.py]"]
end

subgraph group_py_support["Python Runtime Services"]
  node_py_snapshot[("Snapshot Store<br/>[store.py]")]
  node_py_collector["File Collector<br/>[gitignore.py]"]
  node_py_lock["Write Lock<br/>[lock.py]"]
  node_py_sandbox["Sandbox Dispatcher<br/>[sandbox.py]"]
  node_py_t1["Cranelift Tier<br/>[sandbox_t1.py]"]
  node_py_t2["WASM Tier<br/>[sandbox_t2.py]"]
  node_py_t3["Subprocess Tier<br/>[sandbox_t3.py]"]
  node_py_audit[("Audit Log<br/>[audit_log.py]")]
  node_py_events["Structured Events<br/>[events.py]"]
  node_py_diff["Patch Diff<br/>[diff.py]"]
  node_py_types["Execution Types<br/>[_types.py]"]
end

subgraph group_node_runtime["Node.js Runtime"]
  node_node_patch["Node Patch Engine<br/>[patch_engine.ts]"]
  node_node_validation["Node Validation<br/>[validation.ts]"]
  node_node_security["Security Rules<br/>[security.ts]"]
  node_node_ast["Recast AST Engine<br/>[engine.ts]"]
  node_node_sandbox["T3 Sandbox<br/>[index.ts]"]
  node_node_snapshot[("Snapshot Store<br/>[store.ts]")]
  node_node_collector["File Collector<br/>[gitignore.ts]"]
  node_node_types["Execution Types<br/>[types.ts]"]
end

subgraph group_rust_compiler["Aether Compiler"]
  node_rust_cli["Aether CLI<br/>[main.rs]"]
  node_rust_lexer["Lexer<br/>[lexer.rs]"]
  node_rust_parser["Parser<br/>[parser.rs]"]
  node_rust_ast["AST Store<br/>[lib.rs]"]
  node_rust_sema["Semantic Analysis<br/>[lib.rs]"]
  node_rust_codegen["Interpreter<br/>[lib.rs]"]
end

node_agent(("AI Agent"))
node_node_agent(("SDK User"))
node_rust_user(("Compiler User"))

node_agent -->|"submits patch"| node_py_orchestrator
node_py_orchestrator -->|"validates schema"| node_py_validation
node_py_orchestrator -->|"checks rules"| node_py_rules
node_py_orchestrator -->|"checks semantics"| node_py_semantic
node_py_orchestrator -->|"captures state"| node_py_snapshot
node_py_orchestrator -->|"dispatches patch"| node_py_patch_engine
node_py_orchestrator -->|"records outcome"| node_py_audit
node_py_orchestrator -->|"emits events"| node_py_events
node_py_patch_engine -->|"validates schema"| node_py_validation
node_py_patch_engine -->|"checks rules"| node_py_rules
node_py_patch_engine -->|"applies AST changes"| node_py_ast
node_py_patch_engine -->|"runs scripts"| node_py_sandbox
node_py_snapshot -->|"collects files"| node_py_collector
node_py_snapshot -->|"locks writes"| node_py_lock
node_py_sandbox -->|"dispatches tier"| node_py_t1
node_py_sandbox -->|"dispatches tier"| node_py_t2
node_py_sandbox -->|"dispatches tier"| node_py_t3
node_py_sandbox -->|"captures state"| node_py_snapshot
node_py_audit -->|"records events"| node_py_events
node_py_diff -->|"uses result types"| node_py_types
node_node_agent -->|"submits patch"| node_node_patch
node_node_patch -->|"validates schema"| node_node_validation
node_node_patch -->|"checks rules"| node_node_security
node_node_patch -->|"applies AST changes"| node_node_ast
node_node_patch -->|"runs scripts"| node_node_sandbox
node_node_sandbox -->|"returns results"| node_node_types
node_node_snapshot -->|"collects files"| node_node_collector
node_node_patch -.->|"uses snapshots"| node_node_snapshot
node_rust_user -->|"runs compiler"| node_rust_cli
node_rust_parser -->|"consumes tokens"| node_rust_lexer
node_rust_parser -->|"builds AST"| node_rust_ast
node_rust_cli -.->|"parses source"| node_rust_parser
node_rust_cli -.->|"checks program"| node_rust_sema
node_rust_cli -.->|"executes program"| node_rust_codegen
node_rust_codegen -.->|"interprets AST"| node_rust_ast

click node_py_orchestrator "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/orchestrator.py"
click node_py_validation "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/schema.py"
click node_py_rules "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/rules.py"
click node_py_semantic "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/ae_bridge.py"
click node_py_patch_engine "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/patch_engine.py"
click node_py_ast "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/ast/engine.py"
click node_py_snapshot "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/store.py"
click node_py_collector "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/gitignore.py"
click node_py_lock "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/lock.py"
click node_py_sandbox "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox.py"
click node_py_t1 "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t1.py"
click node_py_t2 "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t2.py"
click node_py_t3 "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t3.py"
click node_py_audit "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/audit_log.py"
click node_py_events "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/events.py"
click node_py_diff "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/diff.py"
click node_py_types "https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/_types.py"
click node_node_patch "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/patch_engine.ts"
click node_node_validation "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/validation.ts"
click node_node_security "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/security.ts"
click node_node_ast "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/ast/engine.ts"
click node_node_sandbox "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/sandbox/index.ts"
click node_node_snapshot "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/snapshot/store.ts"
click node_node_collector "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/snapshot/gitignore.ts"
click node_node_types "https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/types.ts"
click node_rust_cli "https://github.com/foxprint666/aether-lang/blob/main/crates/ae/src/main.rs"
click node_rust_lexer "https://github.com/foxprint666/aether-lang/blob/main/crates/ae-syntax/src/lexer.rs"
click node_rust_parser "https://github.com/foxprint666/aether-lang/blob/main/crates/ae-syntax/src/parser.rs"
click node_rust_ast "https://github.com/foxprint666/aether-lang/blob/main/crates/ae-ast/src/lib.rs"
click node_rust_sema "https://github.com/foxprint666/aether-lang/blob/main/crates/ae-sema/src/lib.rs"
click node_rust_codegen "https://github.com/foxprint666/aether-lang/blob/main/crates/ae-codegen/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_py_orchestrator,node_py_validation,node_py_rules,node_py_semantic,node_py_patch_engine,node_py_ast,node_node_agent,node_rust_user toneBlue
class node_py_snapshot,node_py_collector,node_py_lock,node_py_sandbox,node_py_t1,node_py_t2,node_py_t3,node_py_audit,node_py_events,node_py_diff,node_py_types toneAmber
class node_node_patch,node_node_validation,node_node_security,node_node_ast,node_node_sandbox,node_node_snapshot,node_node_collector,node_node_types toneMint
class node_rust_cli,node_rust_lexer,node_rust_parser,node_rust_ast,node_rust_sema,node_rust_codegen toneRose
class node_agent toneIndigo
```

## Components

### Python Patch Workflow

- [Patch Orchestrator](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/orchestrator.py): `sdk/python/ai_runtime/orchestrator.py`
- [Patch Validation](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/schema.py): `sdk/python/ai_runtime/validation/schema.py`
- [Security Rules](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/rules.py): `sdk/python/ai_runtime/validation/rules.py`
- [Semantic Gate](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/validation/ae_bridge.py): `sdk/python/ai_runtime/validation/ae_bridge.py`
- [Patch Engine](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/patch_engine.py): `sdk/python/ai_runtime/patch_engine.py`
- [Python AST Apply](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/ast/engine.py): `sdk/python/ai_runtime/ast/engine.py`

### Python Runtime Services

- [Snapshot Store](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/store.py): `sdk/python/ai_runtime/snapshot/store.py`
- [File Collector](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/gitignore.py): `sdk/python/ai_runtime/snapshot/gitignore.py`
- [Write Lock](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/snapshot/lock.py): `sdk/python/ai_runtime/snapshot/lock.py`
- [Sandbox Dispatcher](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox.py): `sdk/python/ai_runtime/sandbox.py`
- [Cranelift Tier](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t1.py): `sdk/python/ai_runtime/sandbox_t1.py`
- [WASM Tier](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t2.py): `sdk/python/ai_runtime/sandbox_t2.py`
- [Subprocess Tier](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/sandbox_t3.py): `sdk/python/ai_runtime/sandbox_t3.py`
- [Audit Log](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/audit_log.py): `sdk/python/ai_runtime/observability/audit_log.py`
- [Structured Events](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/events.py): `sdk/python/ai_runtime/observability/events.py`
- [Patch Diff](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/observability/diff.py): `sdk/python/ai_runtime/observability/diff.py`
- [Execution Types](https://github.com/foxprint666/aether-lang/blob/main/sdk/python/ai_runtime/_types.py): `sdk/python/ai_runtime/_types.py`

### Node.js Runtime

- [Node Patch Engine](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/patch_engine.ts): `sdk/node/src/patch_engine.ts`
- [Node Validation](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/validation.ts): `sdk/node/src/validation.ts`
- [Security Rules](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/security.ts): `sdk/node/src/security.ts`
- [Recast AST Engine](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/ast/engine.ts): `sdk/node/src/ast/engine.ts`
- [T3 Sandbox](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/sandbox/index.ts): `sdk/node/src/sandbox/index.ts`
- [Snapshot Store](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/snapshot/store.ts): `sdk/node/src/snapshot/store.ts`
- [File Collector](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/snapshot/gitignore.ts): `sdk/node/src/snapshot/gitignore.ts`
- [Execution Types](https://github.com/foxprint666/aether-lang/blob/main/sdk/node/src/types.ts): `sdk/node/src/types.ts`

### Aether Compiler

- [Aether CLI](https://github.com/foxprint666/aether-lang/blob/main/crates/ae/src/main.rs): `crates/ae/src/main.rs`
- [Lexer](https://github.com/foxprint666/aether-lang/blob/main/crates/ae-syntax/src/lexer.rs): `crates/ae-syntax/src/lexer.rs`
- [Parser](https://github.com/foxprint666/aether-lang/blob/main/crates/ae-syntax/src/parser.rs): `crates/ae-syntax/src/parser.rs`
- [AST Store](https://github.com/foxprint666/aether-lang/blob/main/crates/ae-ast/src/lib.rs): `crates/ae-ast/src/lib.rs`
- [Semantic Analysis](https://github.com/foxprint666/aether-lang/blob/main/crates/ae-sema/src/lib.rs): `crates/ae-sema/src/lib.rs`
- [Interpreter](https://github.com/foxprint666/aether-lang/blob/main/crates/ae-codegen/src/lib.rs): `crates/ae-codegen/src/lib.rs`

### Other components

- **AI Agent**
- **SDK User**
- **Compiler User**

## Connections

- AI Agent → Patch Orchestrator: submits patch
- Patch Orchestrator → Patch Validation: validates schema (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Security Rules: checks rules (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Semantic Gate: checks semantics (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Snapshot Store: captures state (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Patch Engine: dispatches patch (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Audit Log: records outcome (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Orchestrator → Structured Events: emits events (evidence: `sdk/python/ai_runtime/orchestrator.py`)
- Patch Engine → Patch Validation: validates schema (evidence: `sdk/python/ai_runtime/patch_engine.py`)
- Patch Engine → Security Rules: checks rules (evidence: `sdk/python/ai_runtime/patch_engine.py`)
- Patch Engine → Python AST Apply: applies AST changes (evidence: `sdk/python/ai_runtime/patch_engine.py`)
- Patch Engine → Sandbox Dispatcher: runs scripts (evidence: `sdk/python/ai_runtime/patch_engine.py`)
- Snapshot Store → File Collector: collects files (evidence: `sdk/python/ai_runtime/snapshot/store.py`)
- Snapshot Store → Write Lock: locks writes (evidence: `sdk/python/ai_runtime/snapshot/store.py`)
- Sandbox Dispatcher → Cranelift Tier: dispatches tier (evidence: `sdk/python/ai_runtime/sandbox.py`)
- Sandbox Dispatcher → WASM Tier: dispatches tier (evidence: `sdk/python/ai_runtime/sandbox.py`)
- Sandbox Dispatcher → Subprocess Tier: dispatches tier (evidence: `sdk/python/ai_runtime/sandbox.py`)
- Sandbox Dispatcher → Snapshot Store: captures state (evidence: `sdk/python/ai_runtime/sandbox.py`)
- Audit Log → Structured Events: records events (evidence: `sdk/python/ai_runtime/observability/audit_log.py`)
- Patch Diff → Execution Types: uses result types (evidence: `sdk/python/ai_runtime/observability/diff.py`)
- SDK User → Node Patch Engine: submits patch
- Node Patch Engine → Node Validation: validates schema (evidence: `sdk/node/src/patch_engine.ts`)
- Node Patch Engine → Security Rules: checks rules (evidence: `sdk/node/src/patch_engine.ts`)
- Node Patch Engine → Recast AST Engine: applies AST changes (evidence: `sdk/node/src/patch_engine.ts`)
- Node Patch Engine → T3 Sandbox: runs scripts (evidence: `sdk/node/src/patch_engine.ts`)
- T3 Sandbox → Execution Types: returns results (evidence: `sdk/node/src/sandbox/index.ts`)
- Snapshot Store → File Collector: collects files (evidence: `sdk/node/src/snapshot/store.ts`)
- Node Patch Engine → Snapshot Store: uses snapshots
- Compiler User → Aether CLI: runs compiler
- Parser → Lexer: consumes tokens (evidence: `crates/ae-syntax/src/parser.rs`)
- Parser → AST Store: builds AST (evidence: `crates/ae-syntax/src/parser.rs`)
- Aether CLI → Parser: parses source
- Aether CLI → Semantic Analysis: checks program
- Aether CLI → Interpreter: executes program
- Interpreter → AST Store: interprets AST
