AI Software Factory for the RaceOS motorsport platform
Project description
RaceOS AI Software Factory
AI-native software factory for the RaceOS motorsport platform.
How It Works
┌─────────────────────────────────────────────────────────────────────┐
│ │
│ Human: "implement engine load gauge" │
│ │ │
│ ▼ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ CLI │───►│ 9Router │───►│ LangGraph│───►│ OpenCode │ │
│ │ (raceos) │ │(select │ │(orchestr)│ │(execute) │ │
│ └──────────┘ │ model) │ └──────────┘ └──────────┘ │
│ └──────────┘ │ │ │
│ │ ▼ ▼ │
│ │ ┌──────────┐ ┌──────────┐ │
│ │ │ Brain │ │LLM Gateway│ │
│ │ │(.raceos/)│ │(9Router│ │
│ │ └──────────┘ │ / 9Router)│ │
│ │ └──────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────────────────────────────┐ │
│ │ LLM (Claude / GPT-5 / Gemini / DS) │ │
│ └──────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Complete Flow
Human
│
│ $ raceos firmware "fix load always showing 100%"
│
▼
┌─ CLI ──────────────────────────────────────────────────────────────┐
│ 1. Parse input → intent: "debug", domain: "firmware" │
│ 2. Create task → TASK-A1B2C3 │
│ 3. Save checkpoint (crash recovery) │
└────────────────────────────────────────────────────────────────────┘
│
▼
┌─ 9Router (model selection) ────────────────────────────────────────┐
│ 4. Task type: debugging → select Claude Sonnet 4.6, temp=0 │
│ 5. Check budget: $3.42/$50.00 (OK, no downgrade) │
│ 6. Set timeout: 120s │
└────────────────────────────────────────────────────────────────────┘
│
▼
┌─ LangGraph (orchestration) ────────────────────────────────────────┐
│ │
│ 7. ORCHESTRATOR → classify: type=debugging, complexity=medium │
│ │ │
│ 8. CONTEXT AGENT → load tiered context: │
│ │ Tier 1: .raceos/ principles (cached) 2K tokens │
│ │ Tier 2: openspec/specs/display-dashboard/ 3K tokens │
│ │ Tier 3: firmware/middleware/telemetry_parser.cpp 4K tokens │
│ │ Tier 4: codebase memory patterns 1K tokens │
│ │ │
│ 9. ENGINEER → dispatch to OpenCode │
│ │ │
│ 10. REVIEWER → verify code quality (Claude, temp=0) │
│ │ │
│ 11. VALIDATOR → trust executor (tests already passed) │
│ │ │
│ 12. KNOWLEDGE → store patterns + suggest follow-ups │
│ │
└────────────────────────────────────────────────────────────────────┘
│
▼
┌─ OpenCode (execution) ─────────────────────────────────────────────┐
│ 13. Receive: context (10K tokens) + task + constraints │
│ 14. Tools: file.read → file.write → terminal.run → git.commit │
│ 15. LLM calls → via Gateway → Claude generates fix │
│ 16. Run: pio build ✅ → pio test ✅ (16 passed) │
│ 17. Commit: [factory] fix: convert raw byte to percentage │
└────────────────────────────────────────────────────────────────────┘
│
▼
┌─ LLM Gateway (HTTP) ──────────────────────────────────────────────┐
│ 18. POST /chat/completions → model: claude-sonnet-4.6 │
│ 19. Retry: 429→backoff, 5xx→retry, 400→fail │
│ 20. Fallback: Claude fails → try GPT-5 → try DeepSeek │
│ 21. Cost: track tokens, record to ledger │
└────────────────────────────────────────────────────────────────────┘
│
▼
Human sees:
✅ Fixed: raw byte (0-255) not converted to percentage
📁 Modified: telemetry_parser.cpp, board_config.h, test_telemetry_parser.cpp
💰 Cost: $0.20
⏱️ Duration: 44s
💡 Follow-up: "check if rpm, temp, duty also need conversion"
Components
| Component | Role | Location |
|---|---|---|
| CLI | Human interface (15 commands + shell) | src/factory/cli/ |
| 9Router | Select model + enforce budget | src/factory/router/ |
| LangGraph | Orchestrate 11 AI agents | src/factory/orchestrator/ |
| OpenCode | Execute code via MCP tools | src/factory/executor/ |
| LLM Gateway | HTTP proxy to LLM providers | src/factory/gateway/ |
| Context Agent | Load Brain + specs + memory | src/factory/context/ |
| OpenSpec | Parse/generate specs | src/factory/spec_engine/ |
| Codebase Memory | Store implementation patterns | src/factory/memory/ |
| Project Brain | Immutable knowledge (read-only) | ../.raceos/ |
Install
pip install raceos-factory
Setup
# 1. Get LLM API key (choose one gateway):
# 9Router: https://9router.ai/keys
# 9Router: https://9router.ai
# 2. Configure
cd your-raceos-project/raceos-factory
cp .env.example .env
# Edit .env → add your API key
# 3. Verify
raceos doctor
See LLM Gateway Setup Guide for detailed options.
Usage
Interactive Shell
$ raceos
raceos> implement engine load gauge
raceos> fix typo in ecu_parser.h
raceos> how to wire display to stm32
raceos> /status
raceos> /budget
raceos> /quit
Direct Commands
raceos feature "add BLE support" --domain firmware
raceos firmware "fix watchdog timeout"
raceos hardware "wiring diagram for racepanel"
raceos docs "explain HAL interfaces"
raceos review
raceos doctor
raceos install
raceos update
AI Agents (11)
| Agent | Handles | Model |
|---|---|---|
| Orchestrator | Classify + route tasks | DeepSeek (cheap) |
| Context | Load Brain + specs + memory | No LLM (file I/O) |
| Planner | Generate specs before execution | GPT-5 |
| Engineer | Write/fix code | Claude |
| Reviewer | Independent code review | Claude (temp=0) |
| Validator | Run build + tests | No LLM (subprocess) |
| Knowledge | Learn patterns + suggest follow-ups | No LLM |
| Architect | Design systems + ADRs | GPT-5 |
| Research | Market/user evidence | GPT-5 |
| Product | Problem definition + MVP | GPT-5 |
| Hardware | Wiring/BOM/pinout | Gemini |
Cost
| Task Type | Cost | Time |
|---|---|---|
| Feature (complex) | $0.54 | ~56s |
| Bug fix | $0.20 | ~44s |
| Documentation | $0.13 | ~21s |
| Classification | $0.0001 | ~2s |
Daily budget: $50 (configurable). Auto-downgrades model when approaching limit.
Architecture
Project Brain (.raceos/) ── read-only, immutable
↓
OpenSpec (specs/) ── behavioral contracts
↓
LangGraph (DAG) ── orchestrate 11 agents
↓
OpenCode (tools) ── file, terminal, git, patch
↓
9Router (rules) ── deterministic model selection
↓
LLM Gateway ── HTTP to providers
↓
LLM (Claude/GPT/Gemini/DeepSeek)
Zero circular dependencies. Single responsibility per component.
Configuration
| File | Controls |
|---|---|
.env |
API key (secret) |
config/router.yaml |
Model routing + budget + fallback + retry |
config/factory.yaml |
Paths + workflow + logging |
config/opencode.json |
Execution tools + safety |
config/context-tiers.yaml |
Context budgets per tier |
config/memory.yaml |
Codebase memory indexing |
config/openspec.yaml |
Spec engine settings |
See CONFIG_INDEX.md for "I want to change X → edit this file".
Documentation
| Doc | Purpose |
|---|---|
| LLM Gateway Setup | Choose + configure gateway |
| Architecture | Complete system flow |
| CLI Design | CLI commands + shell |
| Integration | How components connect |
| Deployment | Production deployment |
| CONFIG_INDEX | Configuration reference |
Contributing
See CONTRIBUTING.md.
Security
See SECURITY.md.
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raceos_factory-1.0.6.tar.gz.
File metadata
- Download URL: raceos_factory-1.0.6.tar.gz
- Upload date:
- Size: 151.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c5674ff6eeaa06f56d38c4103fb88e938a971283e80150e6e033a779966eda2
|
|
| MD5 |
c989d474ad68b161db62f0f8b45731a2
|
|
| BLAKE2b-256 |
101c10ec380a5bd7bec22baa07e8b34ed8ef2284f7952d98436d84fdaf6b8a43
|
File details
Details for the file raceos_factory-1.0.6-py3-none-any.whl.
File metadata
- Download URL: raceos_factory-1.0.6-py3-none-any.whl
- Upload date:
- Size: 168.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08212608745828c56dabf9bfc9ae01738d0e8d57644386eaa758e8d81393dedf
|
|
| MD5 |
4bc5f39846343349608a7f4ff1d1ede2
|
|
| BLAKE2b-256 |
1b77f94c2162e5bd77b282e55f5cfaf9f07483619985036b70cde5c86f1a754d
|