Skip to content

TDGS-2: Trinity Caste System — Enforce L0/L1 Independence in build.zig #412

Closed

Description

@gHashTag

TDGS-2: Trinity Caste System — Enforce L0/L1 Independence in build.zig

Context

Following TDGS-1 (Tri Dev Guarded Stack), we need to enforce architectural invariants in the build system: L0 (Temple) and L1 (Queens) must build independently of L2-L3 (Workers/Foragers).

Current Problem

The tri binary has a circular dependency: Queen depends on tri_farm/tri_fpga which should be "consumable" workers. If one worker fails to compile, the entire tri build fails — breaking the caste system invariant.

Required Changes

1. Create Caste-Aware Build Targets

Add targets to build.zig:

  • zig build temple — L0 only (TTC, math, VSA, types)
  • zig build queens — L1 only (Queen, Doctor, Scheduler)
  • zig build workers — L2 only (tri_farm, tri_fpga, inference)
  • zig build tri — All castes (for backward compatibility)

2. Zig 0.15 Build API Migration

The build.zig needs migration from Zig 0.13 → 0.15 API:

Old (0.13):

b.addExecutable(.{
    .name = "foo",
    .root_source_file = b.path("foo.zig"),
    .target = target,
    .optimize = optimize,
})

New (0.15):

const foo_mod = b.createModule(.{
    .root_source_file = b.path("foo.zig"),
    .target = target,
    .optimize = optimize,
});
b.addExecutable(.{
    .name = "foo",
    .root_module = foo_mod,
})

This affects 275+ occurrences across build.zig.

3. Architectural Separation

  • Temple (L0): src/vsa.zig, src/sacred/, src/hybrid/
  • Queens (L1): src/tri/doctor/, src/tri/main.zig (Queen routing)
  • Workers (L2): src/tri/tri_farm.zig, src/tri/tri_fpga.zig
  • Foragers (L3): Train tasks, benchmarks

Success Criteria

  1. zig build queens succeeds even if tri_farm.zig has syntax errors
  2. zig build temple compiles in <5 seconds (minimal dependencies)
  3. Doctor daemon can be built independently: zig build doctor

Files to Modify

  • build.zig — Add caste-aware targets, migrate to Zig 0.15 API
  • Possibly: src/tri/main.zig — Split Queen routing from worker commands

References

  • CLAUDE.md: "Trinity S³AI — Temple, Brain & φ-Structure"
  • TDGS-1: Issue #XXX (Tri Dev Guarded Stack)
  • Plan file: /Users/playra/.claude/plans/nifty-shimmying-widget.md

Generated from: tri doctor diagnose
Date: 2026-03-24T18:58:23Z
Priority: High (unblocks Queen + Doctor independence)

Activity

  1. gHashTag commented on Mar 24, 2026

    @gHashTag
    OwnerAuthor

    All acceptance criteria met:

    • ✅ Caste system verified: L0 builds independently, L1 builds independently
    • ✅ All TRI-27 Idiom 11 spec-in-code components complete
    • ✅ CI workflow created

    Moving to TDGS-3: Trinity Architecture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions