#+TITLE: Flight Plan: Neuro Microkernel Architecture
#+DATE: 2026-04-07
#+FILETAGS: :plan:architecture:neuro:microkernel:psf:

* Overview
Decouple HTTP request logic from the core neuro kernel (`neuro.lisp`) and migrate it into modular, hot-loadable provider skills (`org-skill-provider-*`). This ensures absolute modular sovereignty.

* Phase A: Demand (PRD)
- Current state: `neuro.lisp` contains HTTP logic for Groq, OpenRouter, and Gemini.
- Problem: The core kernel is bloated and tightly coupled to external API volatility.
- Solution: Move HTTP logic to `org-skill-provider-*` modules. The kernel's `ask-neuro` becomes a pure interface.

* Phase C: Success (Quality - Analyst Phase)
- **TDD Requirement:** Create `projects/opencortex/tests/neuro-test.lisp` containing assertions for the new `ask-neuro` contract.
- The tests MUST be executed and PROVE failure before any code is modified.
- Tests will assert that:
  1. `ask-neuro` fails gracefully when the `*neuro-backends*` registry is empty.
  2. `ask-neuro` succeeds when a mock provider is registered and correctly delegates the prompt to the mock function.

* Phase D: Build (Engineering - Coder Phase)
- Strip `execute-openrouter-request`, `execute-groq-request`, and `execute-gemini-request` from `projects/opencortex/docs/README.org`.
- Draft `notes/org-skill-provider-openrouter.org`.
- Draft `notes/org-skill-provider-groq.org`.
- Draft `notes/org-skill-provider-gemini.org`.
- Tangle updated `README.org` and new skills.

* Phase E: Chaos (Chaos Phase - Final Verification)
- Hot-load the refactored core and new provider skills.
- Run `neuro-test.lisp` and PROVE it passes.
- Inject a complex chat stimulus and monitor `opencortex-repl.log` for successful autonomous execution.
