Add LinaAI automatic Codex routing

This commit is contained in:
2026-05-24 07:24:58 +00:00
parent e82045a7f9
commit 2d3e0454cd
5 changed files with 330 additions and 15 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ These rules apply to any self-hosted AI coding assistant working on Agrarian.
Stop local work and prepare a Codex handoff when any of these are true:
- confidence is below `0.65`,
- confidence is below `0.75`,
- tests fail twice,
- build fails twice,
- Unreal compile errors persist after one focused fix,
+23 -8
View File
@@ -30,13 +30,15 @@ Codex escalation when local tooling is over its head.
## Operating Model
1. Local AI gathers context and proposes small changes.
2. Work happens on a branch, not directly on `main`.
3. The agent reports risk, files inspected, commands run, and confidence.
4. Tests/builds decide whether a change is acceptable.
5. After two failed local attempts, stop and escalate.
6. Codex escalation uses the npm Codex CLI, not the API.
7. Human review controls merges.
1. Start with `Scripts/linaai_task.sh`, not raw Aider, for normal work.
2. Qwen/Ollama performs a preflight risk and confidence check.
3. Default confidence threshold is `0.75`.
4. High-risk tasks or low-confidence tasks route to Codex automatically.
5. Aider runs only for acceptable supervised local work.
6. If Aider fails, `Scripts/linaai_task.sh` writes a status file and calls
Codex through `Scripts/ai_codex_escalate.sh`.
7. Codex escalation uses the npm Codex CLI, not the API.
8. Human review controls merges.
## Codex Escalation
@@ -44,6 +46,19 @@ Use `Scripts/ai_codex_escalate.sh` with a completed task status file. The
script prefers a locally installed `codex` command and falls back to
`npx -y @openai/codex exec`.
For normal tasks, use:
```bash
cd ~/repos/AgrarianGame
Scripts/linaai_task.sh "your task here"
```
To test automatic escalation without editing files:
```bash
Scripts/linaai_task.sh --dry-run --force-escalate "Test escalation path only."
```
On `LinaAI`, the npm Codex CLI is installed, but it still needs an authenticated
Codex login before cloud escalation can run:
@@ -54,7 +69,7 @@ codex login
Codex should be called for:
- confidence below `0.65`,
- confidence below `0.75`,
- two failed build/test attempts,
- Unreal compile errors that persist,
- tasks touching save systems, multiplayer, auth, payments, AGR wallet
+18
View File
@@ -57,6 +57,24 @@
- `codex doctor` on `LinaAI` reports the npm Codex CLI install is healthy but
not authenticated yet. Run `codex login` on `LinaAI` before expecting Codex
escalation to execute.
## LinaAI Automatic Aider To Codex Routing - 2026-05-24
- Added `Scripts/linaai_task.sh` as the normal LinaAI task entry point.
- Default local confidence threshold is `0.75`; `0.65` is too permissive for
the current project risk profile.
- Workflow:
- Qwen/Ollama performs preflight risk and confidence classification.
- high-risk tasks route directly to Codex.
- tasks below `0.75` confidence route directly to Codex.
- acceptable tasks run through Aider with `--no-auto-commits`.
- if Aider exits unsuccessfully, the script writes a status file and calls
`Scripts/ai_codex_escalate.sh`.
- High-risk keyword routing includes Unreal core architecture, save/load,
multiplayer, networking/replication, AGR wallet/payments, marketplace/economy
transfer logic, auth, security, migrations, secrets, and broad refactors.
- Test command:
`Scripts/linaai_task.sh --dry-run --force-escalate "Test escalation path only."`
- Added self-hosted AI project documentation:
- `Docs/AI/SelfHostedAiDevelopmentStack.md`
- `Docs/AI/LocalAgentGuardrails.md`