Files
nibiru-framework.com/application/module/ai/training/README.md
stephan 48c839d927 Initial public push: docs cosmos v4 + AI module + framework groundwork
This is the snapshot the production landing site (nibiru-framework.com) is
deployed from. Brings together the recent splash + docs migration to the v4
"Cosmos" design system, the new in-framework AI module, and the framework
groundwork that backs the framework-reference extraction.

What lands:
- docs/: Astro + Starlight site with the v4 dark cosmic palette, GalaxyHero
  canvas constellation, Mission Control chat (wired to /api/oracle →
  api.neuronetz.ai via providers.mjs Ollama), 5-panel MMVC stage
  (Model · AI · Module · Controller · View), translated EN/DE/JA/ES/FR
  content, PWA + sitemap + llms.txt + Umami analytics.
- docs/design-system/: canonical mockup bundle (source/index-v2.html for
  splash, source/docs-system.html + preview/ for docs, SPEC.md, tokens).
- docs/scripts/extraction/framework-reference-v2.md: deep framework
  reference (~1.6k lines, file:line citations, every public factory and
  idiom — basis for the LoRA training corpus.
- application/module/ai/: AI module with chat / embed / RAG / agent
  plugins, plus pdoQuery / httpGet / fileRead tools and Modelfile +
  smoke-test in training/.
- application/module/users/: user / ACL / form-factory traits used as the
  reference plugin pattern for the framework docs.
- application/settings/config/database/: schema + seed migrations
  including the AI module tables (200–203).
- Form factory + autogenerator changes the framework-reference-v2 covers.

Production secrets stay out: docs/.env, settings.production.ini and
ai.production.ini are all gitignored (.example files are in tree).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 15:22:18 +02:00

64 lines
2.3 KiB
Markdown

# Training nibiru-coder
This folder contains everything needed to register a Nibiru-flavoured chat
model on your Ollama server (defaults to `http://localhost:11434`; override
via the `OLLAMA_BASE_URL` env var or in `application/module/ai/settings/ai.production.ini`).
## What the model is
`nibiru-coder` is a **system-prompt-customised** Qwen 2.5 Coder 14B. It's not
a fine-tune in the LoRA sense — it's the same weights as the base model but
with a baked-in system prompt that:
- explains MMVC, modules, the dispatcher, and Nibiru's singletons,
- enforces the framework's conventions (`pageAction`, `navigationAction`,
`View::assign`, `Form::create`),
- pushes the model toward Nibiru-idiomatic answers instead of generic Laravel
/ Symfony advice.
System-prompt customisation runs **instantly** (no GPU training time) and
gives ~80 % of the value of a real LoRA at zero training cost. When you have
budget for a real LoRA, the
[corpus exporter](/en/ai/corpus/) produces the JSONL you'd train on.
## Build it
```bash
./application/module/ai/training/build.sh # builds nibiru-coder:1.0
./application/module/ai/training/build.sh 1.1 # bump tag
```
The script:
1. Reads the `Modelfile` next to it.
2. POSTs to `${OLLAMA_BASE_URL}/api/create`.
3. Runs a smoke-test chat call to confirm the new tag responds.
After it succeeds, set the model in `application/module/ai/settings/ai.ini`:
```ini
[AI]
chat.model = "nibiru-coder:1.0"
```
…and every `\Nibiru\Module\Ai\Ai` instance in your app talks to it.
## Iterate on the system prompt
The Modelfile's `SYSTEM """ ... """` block is the lever. Tighten the
conventions, add new examples, or add citations to specific framework files.
Re-run `build.sh` with a new tag (`1.1`, `1.2`) and A/B against the previous
tag in your app.
## Real LoRA path (when you're ready)
1. Run `npm run build:corpus` in `docs/` — produces `dist/corpus/chat.jsonl`.
2. Use Axolotl / Unsloth / LLaMA-Factory with that JSONL as your sharegpt
training set.
3. Convert the resulting LoRA to GGUF (`llama.cpp`'s `convert-hf-to-gguf.py`).
4. Build an Ollama Modelfile with `FROM ./your-lora.gguf` and re-register
as `nibiru-coder:2.0`.
The framework code doesn't need to change — flip the model tag in
`ai.ini` and you're on the new weights.