This file describes the repository as it exists on main. Do not infer features from old documentation or deleted scripts.
Linux/macOS or a Windows shell with bash and GCC/Clang:
bash scripts/build.sh --arch generic
bash scripts/build.sh --arch generic --smoke
bash scripts/build.sh --debug --arch generic --smoke
bash scripts/build.sh --arch generic --benchBuild artifacts are written under build/.
PowerShell wrapper:
.\scripts\niyah.ps1 build
.\scripts\niyah.ps1 smoke
.\scripts\niyah.ps1 bench
.\scripts\niyah.ps1 train C:\path\to\teacher.jsonl -Device cuda
.\scripts\niyah.ps1 train-c Data_Training\sovereign_knowledge.txtC build/run and train-c require bash plus GCC or Clang. Full-model train runs natively through Python/PyTorch and does not require Bash.
| Path | Responsibility |
|---|---|
Core_CPP/niyah_core.c |
neural allocation, forward path, sampling, persistence, legacy output-head adaptation |
Core_CPP/niyah_train_full.c |
deterministic initialization and full-parameter detached-KV/truncated-BPTT C training |
Core_CPP/niyah_train.c |
native C training executable |
tools/train_casper.py |
full-sequence PyTorch/CUDA SFT, checkpoint/resume, native .bin export |
Core_CPP/hybrid_reasoner.c |
symbolic terms, unification, clause solving |
Core_CPP/constraint_solver.c |
rational constraint operations and propagation |
Core_CPP/rule_parser.c |
.nrule parser and verification |
Core_CPP/proof_generator.c |
SHA-256 and proof file generation/verification |
Core_CPP/khz_q_svd.c |
numerical output gate |
Core_CPP/casper_rag.c |
search transport, result parsing/ranking, trace/context hashing |
Core_CPP/casper_cli.c |
Casper query/proof CLI |
Core_CPP/niyah_hybrid_main.c |
hybrid command-line entry point |
tokenizer.c |
deterministic UTF-8 tokenizer with byte fallback |
The non-RAG C runtime links against the C runtime and libm.
RAG transport is platform-specific:
- Windows: WinHTTP.
- POSIX: the
curlexecutable is invoked bycasper_rag.c.
PyTorch is training-only for tools/train_casper.py; exported .bin inference does not depend on PyTorch. The Node and WPF directories are optional runtimes with separate dependencies.
- Read the current source before modifying it.
- Do not reference deleted scripts or binaries outside
build/. - C changes must compile with the warning gate in
scripts/build.sh. - Run
bash scripts/build.sh --arch generic --smokeafter C changes. - Use the debug sanitizer build for memory-sensitive C changes.
- Do not claim a fixed smoke-test count. Treat process exit status/current output as evidence.
- Do not claim network availability from configuration alone.
- Do not claim a feature is implemented because it appears in documentation.
- Keep proof-format, model-format, tokenizer-contract, and public ABI changes explicit.
- Do not commit credentials, deployment addresses, private infrastructure details, or machine-specific paths.
- Do not describe the C trainer as exact full-sequence BPTT: its KV gradient boundary is intentionally truncated.
- Do not describe the Python training path as verified on CUDA unless it has actually run with CUDA on the target environment.
Historical ids 0..1499 are preserved. Vocabulary v2 appends byte fallback ids 1500..1755 for raw UTF-8 bytes. Old checkpoints were not trained on these appended ids and should not be assumed to use them meaningfully.
- Constraint rationals use integer numerator/denominator representation.
- Cross-multiplication uses
__int128where provided; the portability fallback is not exact for every int64 value. - Determinism claims apply only to paths excluding network responses, wall-clock data, unfixed random seeds, nondeterministic GPU kernels, and other external state.
.github/workflows/ci.yml checks:
- C core with GCC and Clang using generic architecture, release smoke, and debug sanitizer smoke.
- Python training-tool syntax.
- Node source syntax after
npm ci. - Windows WPF build with .NET 9.
A change is not verified until the relevant current workflow and local/reproducible checks pass.