Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions crates/trios-physics/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AGENTS.md — trios-physics

> AAIF-compliant | MCP-compatible

- Crate: trios-physics (Gold)
- Repo: gHashTag/trios

## Ring map

| Ring | Package | Role |
|------|---------|------|
| PH-00 | trios-physics-ph00 | physical constants |
| PH-01 | trios-physics-ph01 | equations |
| BR-OUTPUT | trios-physics-br-output | assembly |

## Rules

- L-ARCH-001 future logic in rings/
- R9: no sibling imports
- L6: pure Rust
- Anchor: phi^2 + phi^-2 = 3
29 changes: 29 additions & 0 deletions crates/trios-physics/RING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# RING — trios-physics (Gold Crate)

| Field | Value |
|-------|-------|
| Metal | 🥇 Gold |
| Type | Crate |

## Purpose

Physical constants and equations (quantum, QCD, gravity).
Foundation for physics simulations across TRIOS.

## Ring Structure

```
crates/trios-physics/
├── src/lib.rs ← preserved (FFI to zig-physics)
└── rings/
├── PH-00/ ← physical constants (c, h, G, alpha)
├── PH-01/ ← equations (E=mc^2, lambda=h/p)
└── BR-OUTPUT/ ← assembly
```

`BR-OUTPUT → PH-01 → PH-00`. R9 satisfied.

## Laws

- L-ARCH-001 / R1–R5 / R9 / L6
- Anchor: `phi^2 + phi^-2 = 3`
3 changes: 3 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AGENTS.md — BR-OUTPUT (trios-physics)

May import PH-00, PH-01. L6: pure Rust.
22 changes: 22 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "trios-physics-br-output"
version = "0.1.0"
edition = "2021"
authors = ["Dmitrii Vasilev"]
license = "MIT"
description = "BR-OUTPUT — assembly for trios-physics"
publish = false

[dependencies]
trios-physics-ph00 = { path = "../PH-00" }
trios-physics-ph01 = { path = "../PH-01" }

[workspace]
3 changes: 3 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# BR-OUTPUT — trios-physics

Re-exports PH-00 + PH-01.
3 changes: 3 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/RING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RING — BR-OUTPUT (trios-physics)

Top of ring graph. Imports PH-00, PH-01.
8 changes: 8 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/TASK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# TASK — BR-OUTPUT (trios-physics)

## Status: SCAFFOLDED
- [x] Re-export PH-00, PH-01
- [x] Physics::anchor

## Open
- [ ] MCP tool definitions
24 changes: 24 additions & 0 deletions crates/trios-physics/rings/BR-OUTPUT/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! BR-OUTPUT — trios-physics assembly

pub use trios_physics_ph00::{ALPHA, C, G, H, HBAR};
pub use trios_physics_ph01::{de_broglie_wavelength, rest_energy};

pub struct Physics;

impl Physics {
pub const fn anchor() -> f64 {
3.0
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn rings_link() {
let e = rest_energy(1.0);
assert!(e > 0.0);
assert_eq!(Physics::anchor(), 3.0);
}
}
6 changes: 6 additions & 0 deletions crates/trios-physics/rings/PH-00/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AGENTS.md — PH-00

- Package: trios-physics-ph00
- R1: no PH-01/BR-OUTPUT
- R9: no sibling imports
- L6: pure Rust
7 changes: 7 additions & 0 deletions crates/trios-physics/rings/PH-00/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions crates/trios-physics/rings/PH-00/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "trios-physics-ph00"
version = "0.1.0"
edition = "2021"
authors = ["Dmitrii Vasilev"]
license = "MIT"
description = "PH-00 — physical constants"
publish = false

[workspace]
6 changes: 6 additions & 0 deletions crates/trios-physics/rings/PH-00/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# PH-00 — physical constants

Bottom of the ring graph for trios-physics.

## API
- `C`, `H`, `HBAR`, `G`, `ALPHA`
11 changes: 11 additions & 0 deletions crates/trios-physics/rings/PH-00/RING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RING — PH-00 (trios-physics)

| Metal | 🥈 Silver |
| Package | trios-physics-ph00 |

Physical constants. Bottom of dependency graph.

## Laws
- R1: no PH-01/BR-OUTPUT
- R9: no sibling imports
- L6: pure Rust
9 changes: 9 additions & 0 deletions crates/trios-physics/rings/PH-00/TASK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TASK — PH-00

## Status: SCAFFOLDED
- [x] C, H, HBAR, G, ALPHA
- [x] Tests

## Open
- [ ] Add k_B (Boltzmann), N_A (Avogadro)
- [ ] Migrate constants from `crates/trios-physics/src/`
35 changes: 35 additions & 0 deletions crates/trios-physics/rings/PH-00/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! PH-00 — physical constants
//!
//! Bottom of the ring graph for trios-physics.
//! SI units throughout.

/// Speed of light in vacuum (m/s).
pub const C: f64 = 299_792_458.0;

/// Planck constant (J·s).
pub const H: f64 = 6.626_070_15e-34;

/// Reduced Planck constant (J·s).
pub const HBAR: f64 = 1.054_571_817e-34;

/// Newtonian gravitational constant (m^3 / (kg·s^2)).
pub const G: f64 = 6.674_30e-11;

/// Fine-structure constant (dimensionless).
pub const ALPHA: f64 = 7.297_352_5693e-3;

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn c_is_si_value() {
assert!((C - 299_792_458.0).abs() < 1.0);
}

#[test]
fn alpha_inverse_close_to_137() {
let inv = 1.0 / ALPHA;
assert!((inv - 137.035_999_084).abs() < 1e-6);
}
}
6 changes: 6 additions & 0 deletions crates/trios-physics/rings/PH-01/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AGENTS.md — PH-01

- Package: trios-physics-ph01
- R1: no BR-OUTPUT
- May import PH-00 only
- L6: pure Rust
14 changes: 14 additions & 0 deletions crates/trios-physics/rings/PH-01/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions crates/trios-physics/rings/PH-01/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "trios-physics-ph01"
version = "0.1.0"
edition = "2021"
authors = ["Dmitrii Vasilev"]
license = "MIT"
description = "PH-01 — physics equations"
publish = false

[dependencies]
trios-physics-ph00 = { path = "../PH-00" }

[workspace]
7 changes: 7 additions & 0 deletions crates/trios-physics/rings/PH-01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PH-01 — physics equations

Equations on top of PH-00.

## API
- `rest_energy(mass_kg) -> f64`
- `de_broglie_wavelength(momentum) -> f64`
11 changes: 11 additions & 0 deletions crates/trios-physics/rings/PH-01/RING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RING — PH-01

Physics equations.

## Dependencies
- PH-00

## Laws
- R1: no BR-OUTPUT
- R9: no sibling imports
- L6: pure Rust
10 changes: 10 additions & 0 deletions crates/trios-physics/rings/PH-01/TASK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TASK — PH-01

## Status: SCAFFOLDED
- [x] rest_energy, de_broglie_wavelength
- [x] Tests

## Open
- [ ] Migrate FFI equations from `src/`
- [ ] Add gravitational potential energy, Schwarzschild radius
- [ ] Add Schroedinger time-independent solver helper
32 changes: 32 additions & 0 deletions crates/trios-physics/rings/PH-01/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! PH-01 — physics equations
//!
//! Equations on top of PH-00 constants.

use trios_physics_ph00::{C, H};

/// E = m c^2.
pub fn rest_energy(mass_kg: f64) -> f64 {
mass_kg * C * C
}

/// de Broglie wavelength: lambda = h / p.
pub fn de_broglie_wavelength(momentum: f64) -> f64 {
H / momentum
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn rest_energy_one_kg() {
let e = rest_energy(1.0);
assert!((e - C * C).abs() < 1e-6);
}

#[test]
fn de_broglie_unit_momentum() {
let lambda = de_broglie_wavelength(1.0);
assert!((lambda - H).abs() < 1e-40);
}
}
Loading