Skip to content

feat(docs): TRI_AUTOCODE_SPEC master specification (#406)#407

Merged
gHashTag merged 206 commits intomainfrom
feat/issue-406-autocode-spec
Mar 26, 2026
Merged

feat(docs): TRI_AUTOCODE_SPEC master specification (#406)#407
gHashTag merged 206 commits intomainfrom
feat/issue-406-autocode-spec

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Summary

Adds docs/research/TRI_AUTOCODE_SPEC.md — unified specification for Trinity autocodegeneration.

Changes

Ready Issue Specs

Contains full specifications ready for agent implementation:

Scientific References

  1. Grammar Prompting (NeurIPS 2023)
  2. SDD Pipeline (arXiv 2025)
  3. AlphaVerus (CMU 2025)
  4. GCD (SynCode 2024)
  5. Multi-Stage (ScienceDirect 2025)
  6. Type-Constrained (ACM 2025)
  7. Multi-Agent FPGA (Design-Reuse 2025)

Files

  • docs/research/TRI_AUTOCODE_SPEC.md (new, 1068 LOC)

Closes #406

Antigravity Agent and others added 30 commits March 23, 2026 23:05
- Fixed ArrayList API (ArrayListUnmanaged with allocator param)
- Fixed std.fs.cwd().makeDir (no try before catch)
- Fixed std.json.Stringify API (valueAlloc)
- Fixed print format strings
- Fixed Worker.format display function
- Re-enabled tri_farm module in main.zig
- LocalWave9 commands: init, start, stop, status, recycle, clean
- Added SUB, MUL, JMP, CALL, RET, STI opcodes
- Removed duplicate opcode handlers (XOR, NOT, SHL, SHR)
- Refactored parseLine with parseThreeOp helper
- Added 4 new tests for all opcode categories
- All 17 tests passing

Assembler now supports all 27 TRI-27 opcodes:
- Control: NOP, HALT, JMP, JZ, JNZ, CALL, RET
- Arithmetic: ADD, SUB, MUL, DIV, INC, DEC
- Logic: AND, OR, XOR, NOT, SHL, SHR
- Memory: LD, ST, LDI, STI
- LD: load from memory to register
- JZ: conditional jump if zero
- JNZ: conditional jump if not zero
- Updated estimateCycles for new opcodes
- All 12 executor tests passing

Executor now supports all 27 TRI-27 opcodes:
- Control: NOP, HALT, JMP, JZ, JNZ, CALL, RET
- Arithmetic: ADD, SUB, MUL, DIV, INC, DEC
- Logic: AND, OR, XOR, NOT, SHL, SHR
- Memory: LD, ST, LDI, STI
- Two-pass assembly: first pass collects labels, second resolves them
- Label definitions: 'label_name:' format
- Label references: can be used in JMP, JZ, JNZ, CALL
- Error messages now include line numbers
- Added 2 new tests for label support and error messages
- All 19 tests passing

Assembler features:
- 27 opcodes supported (Phase 2)
- Label support for forward/backward references
- Line numbers in error messages
- Comments (; prefix)
- Empty line handling
…ly (#357)

- Fixed tri_asm.zig @truncate issues
- Fixed Tri27_Experience.zig (self-contained Episode module)
- Fixed tri27_experience_jsonl.zig imports
- Fixed tri27_cli.zig (format specifiers, readFileAlloc, Executor.run())
- Fixed executor.zig CPUState import
- All tri27 components compile and run successfully
Phase 3 - Labels and Line Numbers:
- Two-pass assembler: first pass collects labels, second resolves them
- Label definitions: 'label_name:' format
- Label references in JMP, JZ, JNZ, CALL
- Error messages with line numbers
- 19 tests passing

Tri27Event → Episode Bridge (WIP):
- Created tri27_bridge.zig module
- Added .tri27 to Source enum in episodes.zig
- Added tri27_op action to Action union
- Added recordTri27Episode function (incomplete)

Note: episodes.zig has compile errors due to path issues,
needs to be fixed in next session.
- Added .tri27 to Source enum
- Added tri27_op struct to Action union (operation, input_file, output_file, cycles, instructions)
- This enables Episode.recordTri27Episode() to map TRI-27 events
- Fixed runDocker to use 'docker-compose' instead of 'docker'
- Fixed local_farm.zig ArrayList API for Zig 0.15
- All other Zig 0.15 compatibility fixes applied
- Episode struct with id, timestamp, source, context, action, result, outcome
- Source types: lotus_cycle, external, scheduled, experience_recall
- Action types: scale_up, scale_down, trigger, set, wait
- JSONL persistence: appendEpisode(), loadEpisodes(), getEpisodeStats()
- Fixed Zig 0.15 compatibility across all queen modules
- All queen module tests pass (15/15)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added Stage 2 (Record Episode) to lotus_cycle.zig
- Created EpisodeSummary for Zig 0.15 JSON compatibility
- JSONL now writes simplified summary (union serialization workaround)
- appendEpisode() called at end of cycle
- All 6 queen module tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added src/tri/local_farm.zig for tracking local Docker workers
- Added src/tri/wave9_generator.zig for docker-compose generation
- Updated src/tri/tri_farm.zig to run local-wave9 commands
- Fixed Zig 0.15 compatibility (ArrayListUnmanaged API)
- Docker infrastructure: 48 workers with S3 MultiObj config
- Use: tri farm local-wave9 [init|start|status|stop|logs|restart]
- Added lotus-cycle CLI executable (run/stats/test/help commands)
- Fixed Zig 0.15 compatibility issues:
  - ArrayList.deinit() requires allocator parameter
  - ArrayList.append() requires allocator parameter
  - splitScalar() uses char not string literal
  - removed error discard patterns
  - GPA needs var instead of const for allocator()
  - divTrunc() for i128 division
- build.zig: removed .optimize/.target from Module/Executable options
- All tests passing (episodes: 5/5, lotus_cycle: 6/6)
- Added 4 tests for CLI interface
- usageAndExit help display test
- unknown command error test
- showStats statistics test
- runCycle execution test
- All tests passing (4/4)
- Changed @intcast to @truncate for SIMD result unpacking
- Updated function signatures: *HybridBigInt → *const HybridBigInt
- Added intermediate conversions for f32 SIMD operations
- All VSA tests passing (73/73)
- Clarify that compose functions use runDockerCompose
- containerExec now correctly uses runDockerCompose for compose-based containers
- Reformat ternary and sacred instruction blocks
- Improve code readability with proper section comments
- Fix SACR division error handling
- All tests passing (12/12)
- Added specs/tbin_format.md with binary format documentation
- Added test_comprehensive.zig for comprehensive testing
- Updated tri27_experience.zig and tri27_cli_fixed.zig
- Fixed @intFromFloat to @as(i64, @intFromFloat(...))
- Created self-contained VSA bridge without external VSA dependency
- Removed test code from vsa_bridge.zig (avoids Zig 0.15 module path restrictions)
- Fixed @clamp to std.math.clamp
- All executor tests passing (12/12)
- Add tri27_isa.md: complete TRI-27 instruction set reference
- Add health command to lotus-cycle CLI for system health checks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Correct TestCase struct field declarations for proper Zig syntax
- Separate name, test, and bool declarations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntax (#398)

- Rewrite TestCase struct with separate field declarations
- Add test_cases array initialization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
std.mem.indexOf now requires slice parameter, not char literal.
Changed '=' to &[_]u8{'='} for compatibility with Zig 0.15.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
std.posix.O.RDWR not available on macOS - use bitcast with
raw values from system fcntl.h:
- O_RDWR = 0x0002
- O_NONBLOCK = 0x0004
- O_NOCTTY = 0x00020000

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added formatInstruction and formatInstructionShort to decoder.zig
for converting Instruction structs to assembly strings.

Implemented runDisassembleCommand in tri27_cli.zig:
- Parses .tbin header (12 bytes)
- Decodes each 32-bit instruction
- Prints formatted assembly with address and hex
- Stops at HALT instruction

Output format:
  0x0000:  0x00000004  LDI t0, 5
  0x0004:  0x00000010  ADD t2, t0, t1
  *** HALT reached ***
  Disassembly complete: 3 instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Antigravity Agent and others added 5 commits March 24, 2026 20:09
- docs/tri27/t27_format.md — Assembly format specification
  * File structure: .const, .data, .code sections
  * Human-readable, easily parsed format
  * Complete instruction reference

- src/tri27/reticular_raphe.t27 — Reference implementation
  * PPL rolling average with φ-decay
  * WINDOW_SIZE=20, PHI_DECAY=0.990
  * Validates Queen Self-Learning H4-H6

First .t27 backend file (1/11 neuro modules complete)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Translate hypotheses, experiments, and analysis sections
- Maintains all scientific content and structure
- Improves accessibility for international collaboration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 1068 LOC unified specification
- Research layer status, Coptic extension, NA-R11
- Tri Language DNA: Waves 1-4 with feature sources
- Autocodegeneration: 8 scientific patterns
- Complete issue specs for future waves

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…406)

- Replace .tri-spec → unified .tri with @SPEC annotations
- Add Part 4.5: Spec-DSL in .tri
- @spec/@require/@ensure/@example/@goal keywords
- Typed holes for autogeneration
- CLI commands: spec lint, test, bdd run

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- CopticReg enum: alpha=0 through fay=26
- coptic_glyphs array with UTF-8 strings
- bank() function returns 0/1/2 for validation
- glyphToReg() lookup function
- 4 unit tests covering all functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- parseRegister() now supports Coptic glyphs (Ⲁ-Ϥ)
- glyphToReg() lookup via coptic.glyphToReg()
- Added getBank() function (0/1/2)
- Added bank validation errors (SacredOpRequiresBank1, AluOpRequiresBank0, CannotStoreToConstantBank)
- Updated AsmError with bank validation errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- generateSignature() creates HMAC-SHA256 signature
- hashContent() hashes content without signature header
- extractSignature() parses signature from .t27 files
- verifySignature() validates signature format
- insertSignatureHeader() adds TRI27_* headers to .t27
- 2 unit tests for signature extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- tri t27 verify <file> — Verify single .t27 file
- tri t27 verify --all — Verify all .t27 in src/tri27/
- tri t27 sign <file> — Re-sign after tri canonize
- tri t27 diff <file> — Show changes vs signed version
- 2 unit tests for verifyFile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- These are runtime/temporary files that should not be committed
- .claude/scheduled_tasks.lock (modified)
- .trinity/queen/launcher.err (modified) - Queen crash logs
- fpga/esp32-xvc (modified content, untracked) - FPGA state snapshot
- .trinity/dev_session.json (for state persistence)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 24, 2026
- Created src/tri27/coptic.zig with CopticReg enum (26 registers)
- Bank model: ALU (t0-t8), Sacred (t9-t17), Const (t18-shmima26)
- Added bank(), glyph(), name() methods
- L0/L1 caste build remains GREEN

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 25, 2026
- Created src/tri27/coptic.zig with CopticReg enum (26 registers)
- Bank model: ALU (t0-t8), Sacred (t9-t17), Const (t18-shmima26)
- Added bank(), glyph(), name() methods
- L0/L1 caste build remains GREEN

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gHashTag gHashTag merged commit ee921d0 into main Mar 26, 2026
21 of 35 checks passed
gHashTag added a commit that referenced this pull request Mar 26, 2026
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
- CopticReg enum: alpha=0 through fay=26
- coptic_glyphs array with UTF-8 strings
- bank() function returns 0/1/2 for validation
- glyphToReg() lookup function
- 4 unit tests covering all functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
- parseRegister() now supports Coptic glyphs (Ⲁ-Ϥ)
- glyphToReg() lookup via coptic.glyphToReg()
- Added getBank() function (0/1/2)
- Added bank validation errors (SacredOpRequiresBank1, AluOpRequiresBank0, CannotStoreToConstantBank)
- Updated AsmError with bank validation errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
- generateSignature() creates HMAC-SHA256 signature
- hashContent() hashes content without signature header
- extractSignature() parses signature from .t27 files
- verifySignature() validates signature format
- insertSignatureHeader() adds TRI27_* headers to .t27
- 2 unit tests for signature extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
- tri t27 verify <file> — Verify single .t27 file
- tri t27 verify --all — Verify all .t27 in src/tri27/
- tri t27 sign <file> — Re-sign after tri canonize
- tri t27 diff <file> — Show changes vs signed version
- 2 unit tests for verifyFile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
- These are runtime/temporary files that should not be committed
- .claude/scheduled_tasks.lock (modified)
- .trinity/queen/launcher.err (modified) - Queen crash logs
- fpga/esp32-xvc (modified content, untracked) - FPGA state snapshot
- .trinity/dev_session.json (for state persistence)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Mar 27, 2026
gHashTag pushed a commit that referenced this pull request Mar 27, 2026
… + Dataset Card (#407)

**Core V16 Module (zenodo_v16.zig - 395 LOC)**
- SignificanceLevel enum with p-value thresholds (*, **, ***)
- ConfidenceInterval with bootstrap/bayesian/analytical methods
- StatisticalTestResult (t-test, Wilcoxon, Mann-Whitney, ANOVA, Chi-square)
- ExperimentResultEnhanced with statistical annotations
- ExperimentComparisonEnhanced for multi-experiment tables
- All 5/5 tests passing

**Model Card Module (zenodo_model_card.zig - 470 LOC)**
- ModelType enum (6 model types)
- ModelArchitecture with full details
- TrainingData with splits and preprocessing
- EthicalConsiderations (ICLR 2025 requirement)
- ModelCard with markdown generation
- All 3/3 tests passing

**Dataset Card Module (zenodo_dataset_card.zig - 435 LOC)**
- DatasetMotivation enum (5 motivation types)
- DataSource for provenance tracking
- BiasAssessment (NeurIPS 2025 requirement)
- DatasetCard with full documentation
- All 4/4 tests passing

**Compliance:**
- Mitchell et al. (2019) Model Cards for Model Reporting
- Gebru et al. (2021) Datasheets for Datasets
- ICLR 2025 statistical rigor requirements
- NeurIPS 2025 bias assessment requirements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
- CopticReg enum: alpha=0 through fay=26
- coptic_glyphs array with UTF-8 strings
- bank() function returns 0/1/2 for validation
- glyphToReg() lookup function
- 4 unit tests covering all functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
- parseRegister() now supports Coptic glyphs (Ⲁ-Ϥ)
- glyphToReg() lookup via coptic.glyphToReg()
- Added getBank() function (0/1/2)
- Added bank validation errors (SacredOpRequiresBank1, AluOpRequiresBank0, CannotStoreToConstantBank)
- Updated AsmError with bank validation errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
- generateSignature() creates HMAC-SHA256 signature
- hashContent() hashes content without signature header
- extractSignature() parses signature from .t27 files
- verifySignature() validates signature format
- insertSignatureHeader() adds TRI27_* headers to .t27
- 2 unit tests for signature extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
- tri t27 verify <file> — Verify single .t27 file
- tri t27 verify --all — Verify all .t27 in src/tri27/
- tri t27 sign <file> — Re-sign after tri canonize
- tri t27 diff <file> — Show changes vs signed version
- 2 unit tests for verifyFile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
- These are runtime/temporary files that should not be committed
- .claude/scheduled_tasks.lock (modified)
- .trinity/queen/launcher.err (modified) - Queen crash logs
- fpga/esp32-xvc (modified content, untracked) - FPGA state snapshot
- .trinity/dev_session.json (for state persistence)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Mar 30, 2026
gHashTag pushed a commit that referenced this pull request Mar 30, 2026
… + Dataset Card (#407)

**Core V16 Module (zenodo_v16.zig - 395 LOC)**
- SignificanceLevel enum with p-value thresholds (*, **, ***)
- ConfidenceInterval with bootstrap/bayesian/analytical methods
- StatisticalTestResult (t-test, Wilcoxon, Mann-Whitney, ANOVA, Chi-square)
- ExperimentResultEnhanced with statistical annotations
- ExperimentComparisonEnhanced for multi-experiment tables
- All 5/5 tests passing

**Model Card Module (zenodo_model_card.zig - 470 LOC)**
- ModelType enum (6 model types)
- ModelArchitecture with full details
- TrainingData with splits and preprocessing
- EthicalConsiderations (ICLR 2025 requirement)
- ModelCard with markdown generation
- All 3/3 tests passing

**Dataset Card Module (zenodo_dataset_card.zig - 435 LOC)**
- DatasetMotivation enum (5 motivation types)
- DataSource for provenance tracking
- BiasAssessment (NeurIPS 2025 requirement)
- DatasetCard with full documentation
- All 4/4 tests passing

**Compliance:**
- Mitchell et al. (2019) Model Cards for Model Reporting
- Gebru et al. (2021) Datasheets for Datasets
- ICLR 2025 statistical rigor requirements
- NeurIPS 2025 bias assessment requirements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gHashTag gHashTag deleted the feat/issue-406-autocode-spec branch April 3, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(research): Trinity S³AI Research Layer — 5 scientific documents + Unified Framework

1 participant