# RC8 Phase 1 — Research Runtime Stabilization

## Failure reproduced

Windows successfully launched Python and found `server.py`, but Python failed with:

`ModuleNotFoundError: No module named 'research_engine'`

The file was present. The failure was caused by launching the server from a directory that did not place the research package on Python's import path.

## Changes completed

1. Converted the research folder into a proper Python package.
2. Added `research/__init__.py`.
3. Added package-relative imports with direct-script fallbacks.
4. Changed the Windows launcher to run:
   `python -m research.server`
5. Explicitly sets `PYTHONPATH` to the CRD and research directories.
6. Explicitly changes the working directory before launch.
7. Added a pre-launch import self-test.
8. Added checks for `server.py`, `research_engine.py`, and Python.
9. Keeps failures visible instead of flashing closed.
10. Writes all launch and import output to `Logs/research-workbench.log`.
11. Added `Tests/TEST_RESEARCH_ENGINE.cmd`.
12. Preserved the populated Top-300 offline workbench as a fallback.

## Validation completed in the build environment

- `from research.research_engine import ResearchEngine`: passed
- `python -m research.server --no-browser`: started successfully
- `/api/health`: returned HTTP 200 with `ok: true`
- Server shutdown: completed
- Python source compilation: passed

## Next phases

### Phase 2 — Unified local application shell
- One launcher process
- Embedded local workbench navigation
- No separate flashing command windows
- Unified status and health screen
- Direct access to MedRec, patient review, database, and research

### Phase 3 — Research ingestion reliability
- Connector-level status
- Network-block detection
- Source caching
- PDF and URL intake verification
- Retry and partial-result behavior

### Phase 4 — Installer and distribution hardening
- Runtime bundling where licensing/distribution permits
- Self-contained update package
- GitHub release build automation
- `downloads.carry.pub` release portal
