diff --git a/crates/trios-sacred/AGENTS.md b/crates/trios-sacred/AGENTS.md new file mode 100644 index 0000000000..6447c5c070 --- /dev/null +++ b/crates/trios-sacred/AGENTS.md @@ -0,0 +1,21 @@ +# AGENTS.md — trios-sacred + +> AAIF-compliant | MCP-compatible + +- Crate: trios-sacred (Gold) +- Repo: gHashTag/trios + +## Ring map + +| Ring | Package | Role | +|------|---------|------| +| SC-00 | trios-sacred-sc00 | geometry primitives | +| SC-01 | trios-sacred-sc01 | sacred ratios | +| BR-OUTPUT | trios-sacred-br-output | assembly | + +## Rules + +- L-ARCH-001 future logic in rings/ +- R9: no sibling imports +- L6: pure Rust +- Anchor: phi^2 + phi^-2 = 3 diff --git a/crates/trios-sacred/RING.md b/crates/trios-sacred/RING.md new file mode 100644 index 0000000000..7c7175a878 --- /dev/null +++ b/crates/trios-sacred/RING.md @@ -0,0 +1,44 @@ +# RING — trios-sacred (Gold Crate) + +## Identity + +| Field | Value | +|-------|-------| +| Metal | 🥇 Gold | +| Type | Crate | +| Sealed | No | + +## Purpose + +Sacred geometry primitives — geometric shapes anchored on phi, and ratio +helpers (golden ratio, sqrt(2), sqrt(3), pi). Foundational for +trinity-aligned spatial reasoning. + +## Ring Structure (L-ARCH-001) + +``` +crates/trios-sacred/ +├── src/lib.rs ← preserved (FFI to zig-sacred-geometry) +└── rings/ + ├── SC-00/ ← geometry primitives (Vec2, Triangle, Circle) + ├── SC-01/ ← sacred ratios (phi, sqrt2, sqrt3, pi) + └── BR-OUTPUT/ ← assembly + router +``` + +## Dependency Flow + +``` +BR-OUTPUT + ↓ + SC-01 → SC-00 +``` + +R9: rings cannot import siblings. + +## Laws + +- L-ARCH-001: Future logic in `rings/` +- R1–R5: Ring Isolation +- R9: No sibling imports +- L6: Pure Rust only +- Anchor: `phi^2 + phi^-2 = 3` diff --git a/crates/trios-sacred/rings/BR-OUTPUT/AGENTS.md b/crates/trios-sacred/rings/BR-OUTPUT/AGENTS.md new file mode 100644 index 0000000000..10db9c69f5 --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/AGENTS.md @@ -0,0 +1,3 @@ +# AGENTS.md — BR-OUTPUT (trios-sacred) + +May import SC-00, SC-01. L6: pure Rust. diff --git a/crates/trios-sacred/rings/BR-OUTPUT/Cargo.lock b/crates/trios-sacred/rings/BR-OUTPUT/Cargo.lock new file mode 100644 index 0000000000..c6461d4bbe --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/Cargo.lock @@ -0,0 +1,22 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-sacred-br-output" +version = "0.1.0" +dependencies = [ + "trios-sacred-sc00", + "trios-sacred-sc01", +] + +[[package]] +name = "trios-sacred-sc00" +version = "0.1.0" + +[[package]] +name = "trios-sacred-sc01" +version = "0.1.0" +dependencies = [ + "trios-sacred-sc00", +] diff --git a/crates/trios-sacred/rings/BR-OUTPUT/Cargo.toml b/crates/trios-sacred/rings/BR-OUTPUT/Cargo.toml new file mode 100644 index 0000000000..43c44fc377 --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "trios-sacred-br-output" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "BR-OUTPUT — assembly for trios-sacred" +publish = false + +[dependencies] +trios-sacred-sc00 = { path = "../SC-00" } +trios-sacred-sc01 = { path = "../SC-01" } + +[workspace] diff --git a/crates/trios-sacred/rings/BR-OUTPUT/README.md b/crates/trios-sacred/rings/BR-OUTPUT/README.md new file mode 100644 index 0000000000..cfcdfae524 --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/README.md @@ -0,0 +1,3 @@ +# BR-OUTPUT — trios-sacred + +Re-exports SC-00 + SC-01. diff --git a/crates/trios-sacred/rings/BR-OUTPUT/RING.md b/crates/trios-sacred/rings/BR-OUTPUT/RING.md new file mode 100644 index 0000000000..8b5bf827ff --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/RING.md @@ -0,0 +1,3 @@ +# RING — BR-OUTPUT (trios-sacred) + +Top of ring graph. Imports SC-00, SC-01. diff --git a/crates/trios-sacred/rings/BR-OUTPUT/TASK.md b/crates/trios-sacred/rings/BR-OUTPUT/TASK.md new file mode 100644 index 0000000000..f34dc4300f --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/TASK.md @@ -0,0 +1,8 @@ +# TASK — BR-OUTPUT (trios-sacred) + +## Status: SCAFFOLDED +- [x] Re-export SC-00, SC-01 +- [x] `Sacred::anchor()` + +## Open +- [ ] MCP tools diff --git a/crates/trios-sacred/rings/BR-OUTPUT/src/lib.rs b/crates/trios-sacred/rings/BR-OUTPUT/src/lib.rs new file mode 100644 index 0000000000..d18f5bb2df --- /dev/null +++ b/crates/trios-sacred/rings/BR-OUTPUT/src/lib.rs @@ -0,0 +1,28 @@ +//! BR-OUTPUT — trios-sacred assembly + +pub use trios_sacred_sc00::{Circle, Triangle, Vec2}; +pub use trios_sacred_sc01::{scale_phi, PHI, PI, SQRT2, SQRT3}; + +pub struct Sacred; + +impl Sacred { + pub const fn anchor() -> f64 { + 3.0 + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn anchor_const() { + assert_eq!(Sacred::anchor(), 3.0); + } + + #[test] + fn rings_link() { + let v = scale_phi(Vec2::new(1.0, 1.0)); + assert!((v.x - PHI).abs() < 1e-12); + } +} diff --git a/crates/trios-sacred/rings/SC-00/AGENTS.md b/crates/trios-sacred/rings/SC-00/AGENTS.md new file mode 100644 index 0000000000..b229dde7bf --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/AGENTS.md @@ -0,0 +1,7 @@ +# AGENTS.md — SC-00 + +- Ring: SC-00 +- Package: trios-sacred-sc00 +- R1: no imports from SC-01, BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-sacred/rings/SC-00/Cargo.lock b/crates/trios-sacred/rings/SC-00/Cargo.lock new file mode 100644 index 0000000000..7c93679304 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-sacred-sc00" +version = "0.1.0" diff --git a/crates/trios-sacred/rings/SC-00/Cargo.toml b/crates/trios-sacred/rings/SC-00/Cargo.toml new file mode 100644 index 0000000000..27be57a4a4 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "trios-sacred-sc00" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "SC-00 — sacred geometry primitives" +publish = false + +[workspace] diff --git a/crates/trios-sacred/rings/SC-00/README.md b/crates/trios-sacred/rings/SC-00/README.md new file mode 100644 index 0000000000..f598571951 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/README.md @@ -0,0 +1,9 @@ +# SC-00 — sacred geometry primitives + +Bottom of the ring graph for trios-sacred. + +## API + +- `Vec2 { x, y }` with `dot` +- `Triangle([Vec2; 3])` +- `Circle { center, radius }` diff --git a/crates/trios-sacred/rings/SC-00/RING.md b/crates/trios-sacred/rings/SC-00/RING.md new file mode 100644 index 0000000000..f89f073a75 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/RING.md @@ -0,0 +1,11 @@ +# RING — SC-00 (trios-sacred) + +| Metal | 🥈 Silver | +| Package | trios-sacred-sc00 | + +Geometry primitives. Bottom of dependency graph. + +## Laws +- R1: no SC-01/BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-sacred/rings/SC-00/TASK.md b/crates/trios-sacred/rings/SC-00/TASK.md new file mode 100644 index 0000000000..aa22c38635 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/TASK.md @@ -0,0 +1,12 @@ +# TASK — SC-00 + +## Status: SCAFFOLDED + +## Completed +- [x] Vec2, Triangle, Circle +- [x] dot product test + +## Open +- [ ] Migrate from `crates/trios-sacred/src/sacred/` +- [ ] Add Pentagon (phi-anchored) +- [ ] Add Hexagon, Vesica Piscis diff --git a/crates/trios-sacred/rings/SC-00/src/lib.rs b/crates/trios-sacred/rings/SC-00/src/lib.rs new file mode 100644 index 0000000000..2cbe1fa845 --- /dev/null +++ b/crates/trios-sacred/rings/SC-00/src/lib.rs @@ -0,0 +1,40 @@ +//! SC-00 — sacred geometry primitives +//! +//! Bottom of the ring graph for trios-sacred. + +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct Vec2 { + pub x: f64, + pub y: f64, +} + +impl Vec2 { + pub const fn new(x: f64, y: f64) -> Self { + Self { x, y } + } + + pub fn dot(self, other: Vec2) -> f64 { + self.x * other.x + self.y * other.y + } +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct Triangle(pub [Vec2; 3]); + +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct Circle { + pub center: Vec2, + pub radius: f64, +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn vec2_dot() { + let a = Vec2::new(1.0, 0.0); + let b = Vec2::new(0.0, 1.0); + assert_eq!(a.dot(b), 0.0); + } +} diff --git a/crates/trios-sacred/rings/SC-01/AGENTS.md b/crates/trios-sacred/rings/SC-01/AGENTS.md new file mode 100644 index 0000000000..56184a9dc1 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/AGENTS.md @@ -0,0 +1,7 @@ +# AGENTS.md — SC-01 + +- Package: trios-sacred-sc01 +- R1: no BR-OUTPUT imports +- R9: no sibling imports +- May import SC-00 only +- L6: pure Rust diff --git a/crates/trios-sacred/rings/SC-01/Cargo.lock b/crates/trios-sacred/rings/SC-01/Cargo.lock new file mode 100644 index 0000000000..90aa6fc375 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/Cargo.lock @@ -0,0 +1,14 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-sacred-sc00" +version = "0.1.0" + +[[package]] +name = "trios-sacred-sc01" +version = "0.1.0" +dependencies = [ + "trios-sacred-sc00", +] diff --git a/crates/trios-sacred/rings/SC-01/Cargo.toml b/crates/trios-sacred/rings/SC-01/Cargo.toml new file mode 100644 index 0000000000..fbdf3814de --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "trios-sacred-sc01" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "SC-01 — sacred ratios (phi, sqrt2, sqrt3, pi)" +publish = false + +[dependencies] +trios-sacred-sc00 = { path = "../SC-00" } + +[workspace] diff --git a/crates/trios-sacred/rings/SC-01/README.md b/crates/trios-sacred/rings/SC-01/README.md new file mode 100644 index 0000000000..d501ea98c5 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/README.md @@ -0,0 +1,3 @@ +# SC-01 — sacred ratios + +phi, sqrt2, sqrt3, pi. Depends on SC-00 for `Vec2` scaling. diff --git a/crates/trios-sacred/rings/SC-01/RING.md b/crates/trios-sacred/rings/SC-01/RING.md new file mode 100644 index 0000000000..4e12211082 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/RING.md @@ -0,0 +1,11 @@ +# RING — SC-01 + +Sacred ratios (phi, sqrt2, sqrt3, pi). + +## Dependencies +- SC-00 + +## Laws +- R1: no BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-sacred/rings/SC-01/TASK.md b/crates/trios-sacred/rings/SC-01/TASK.md new file mode 100644 index 0000000000..2df32bc988 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/TASK.md @@ -0,0 +1,12 @@ +# TASK — SC-01 + +## Status: SCAFFOLDED + +## Completed +- [x] PHI, SQRT2, SQRT3, PI +- [x] scale_phi +- [x] phi anchor test + +## Open +- [ ] Migrate phi-engine from legacy `src/phi-engine/` +- [ ] Add Beal-conjecture search helpers from FFI diff --git a/crates/trios-sacred/rings/SC-01/src/lib.rs b/crates/trios-sacred/rings/SC-01/src/lib.rs new file mode 100644 index 0000000000..58b8c1d8d4 --- /dev/null +++ b/crates/trios-sacred/rings/SC-01/src/lib.rs @@ -0,0 +1,32 @@ +//! SC-01 — sacred ratios +//! +//! phi (golden ratio), sqrt(2), sqrt(3), pi. + +use trios_sacred_sc00::Vec2; + +pub const PHI: f64 = 1.618_033_988_749_894_8; +pub const SQRT2: f64 = std::f64::consts::SQRT_2; +pub const SQRT3: f64 = 1.732_050_807_568_877_2; +pub const PI: f64 = std::f64::consts::PI; + +/// Scale a Vec2 by phi. +pub fn scale_phi(v: Vec2) -> Vec2 { + Vec2::new(v.x * PHI, v.y * PHI) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn phi_anchor() { + let lhs = PHI * PHI + (1.0 / PHI) * (1.0 / PHI); + assert!((lhs - 3.0).abs() < 1e-12); + } + + #[test] + fn scale_phi_works() { + let v = scale_phi(Vec2::new(1.0, 0.0)); + assert!((v.x - PHI).abs() < 1e-12); + } +}