# @nous/autoresearch-core

Multi-agent orchestration & debate for the Phase-178 autonomous-research stack
(TODOS/phase-178 §178.10, plus the §178.9.2.1 trace middleware).

## Components

| Module            | Summary                                                                                                                                                                                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `coscientist.py`  | **Google AI Co-Scientist** generate/debate/evolve loop: Generation, Reflection, Ranking (Elo), Evolution, Meta-Review, Proximity agents, with test-time compute controllable per query. Converges on the best hypothesis on a controllable goal. (§178.10.1.1)      |
| `elo.py`          | **Elo-tournament ranker**: informative Swiss scheduling, LLM-judge duels, **diversity bonus** (relative distinctiveness lifts outliers), **anti-collusion noise**, and **Spearman calibration** against human rankings. (§178.10.1.2)                               |
| `case_studies.py` | **Published case-study regression**: source-pinned, end-to-end retrospective recapitulation of the disclosed KIRA6/AML, epigenetic liver-fibrosis, and cf-PICI/AMR results, with falsifiable experiment-plan checks. (§178.10.1.3)                                  |
| `backends.py`     | **Orchestration-backend façade**: a real dependency-free `LocalBackend` graph executor plus fail-loud `ExternalBackend` seams for LangGraph / OpenAI Agents / Claude Agents / CrewAI / AutoGen / Google ADK, selected by **feature coverage × cost**. (§178.10.2.1) |
| `a2a.py`          | **A2A adapter**: HMAC-SHA256-**signed capability cards**, peer-key registration, signature verification, and capability negotiation restricted to mutually-advertised, trusted peers. (§178.10.2.2)                                                                 |
| `hermetic.py`     | **Per-run pinning**: model-rev / tool-versions / corpus-snapshot `PinSet` + `RunManifest` with a `replay_key`; two runs replay identically iff their keys match. (§178.10.2.3)                                                                                      |
| `trace.py`        | **Structured-span trace middleware** every agent emits through — nested spans with inputs/outputs, tokens, cost, latency, tool calls, errors; pluggable exporter (Langfuse/Weave in production). (§178.9.2.1 core)                                                  |

External SDKs and LLM judges are honest seams: `ExternalBackend.run` raises
`BackendNotConfigured` rather than faking a result, and the Co-Scientist agents
are protocols you bind to real models. The tests verify the _coordination logic_
(Elo ranks by true strength, the tournament calibrates to human ranks, the loop
converges, signed cards gate collaboration, pins gate replay) on controllable
substrates.

The case-study suite is explicitly labeled retrospective recapitulation. It does
not claim an independent discovery or treat a software test as a replacement for
expert review, preclinical work, or the paper's wet-lab results.

## Testing

```bash
python3 -m pytest tests/ -q
python3 -m ruff check .
python3 -m nous_autoresearch_core.case_studies_cli
```
