Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,30 @@ is optimal in-domain but fragile under shift, so pair it with adaptation
whenever transfer is on the line; family-conditioning requires informative
slice sizes to pay off.

## Meta-Search (protocols 241–244, toy confirmation and real-workload transfer test)

AlgoLab can record its own research search histories, replay alternative
decisions against them, and evaluate versioned search policies with a
fail-closed promotion gate. Built from DREAM-RSI ideas but AlgoLab-native;
no policy source is self-modified and no paid API is required.

- Audit: `docs/research/DREAM_RSI_INTEGRATION_AUDIT.md`
- Reports: `docs/research/DREAM_RSI_INTEGRATION_REPORT.md` and the consolidated
`implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md`
- Preregistrations: `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` …
`244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md`
- Run: `algolab meta-search-run --dir experiments/protocol-243-v1` (or
`algolab meta-transfer-run --dir experiments/protocol-244-v1`), then
`algolab meta-verify --dir <bundle>`
- Results: protocol 241 pilot was **mis-scaled and uninformative**; protocol
242 screen found positive effects that failed BH-FDR; protocol 243
**promoted** the evolved policy on fresh seeds (toy substrate only):
+0.0187 discoveries/credit (95% CI +0.0103 to +0.0275, p = 0.0005),
held-out +0.0213. Protocol 244 tested that unchanged policy on real
`transform`/`hpo` workloads and **did not transfer it**: both arms were
`REJECTED_PROSPECTIVE` (q = 0.5052). Historical replay is *not* prospective
evidence; no deployment or autonomy claim follows from the toy promotion.

## Non-negotiable constraints

- **Human oversight by default, autonomy by exception** — autonomy is
Expand Down
26 changes: 20 additions & 6 deletions docs/STATUS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# STATUS — proven claims, substrates, sample sizes, evidence links

Updated: 2026-11-15 — protocols 239 (transform) and 240 (compose) recorded;
both bundles independently re-executed and reproduced by
`scripts/verify_bundle.py`. Protocol 240 adds a **negative** claim (class C).
The protocol-236 designation was resolved (D-2: 236 = higher-N real workload,
S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format:
**claim** — substrate, n, register link, evidence bundle.
Updated: 2026-11-22 — protocols 239 (transform) and 240 (compose) remain
independently reproduced; the meta-search line now includes protocol 244, a
preregistered **negative transfer** result on real workloads. The protocol-236
designation was resolved (D-2: 236 = higher-N real workload, S2 = protocol 237)
— see `docs/quality/protocol-236-conflict.md`. Entry format: **claim** —
substrate, n, register link, evidence bundle.

## toy substrate (deterministic planted-truth generator)

Expand Down Expand Up @@ -42,6 +42,20 @@ S2 = protocol 237) — see `docs/quality/protocol-236-conflict.md`. Entry format
|---|---|---|---|---|
| 10 | A closed 585-program grammar (1–3 typed transforms, no repeats) over three sklearn datasets yields **no** significant policy advantage over uniform random program search on distinct-validated-programs/credit in either training family (H1–H5 all false), and **no** arm's champion transfers positively to the held-out family; outcome class **C**. Scoped to this 585-program space, not to knowledge loops in general | 10 trials/family | `spec/research/240_GENERATIVE_COMPOSITION_SEARCH.md` | `experiments/protocol-240-v1/` |

## meta-search substrate (protocol 241, replay-grounded policy improvement)

| # | Claim | n | Spec | Evidence |
|---|---|---|---|---|
| 11 | Exploratory pilot only: no policy beat the fixed baseline on discoveries/credit (all REJECTED_PROSPECTIVE); the preregistered 10-credit budget was below most operator costs. A post-hoc 40-credit diagnostic also found no improvement (cost-aware Δ = −0.006548, p = 0.14). No promotion; replay never used as prospective evidence | 4 trials/family | `spec/research/241_META_SEARCH_POLICY_IMPROVEMENT.md` | `experiments/protocol-241-v1/`, `experiments/protocol-241-v1-diagnostic/` |

## meta-search confirmatory line (protocols 242–243)

| # | Claim | n | Spec | Evidence |
|---|---|---|---|---|
| 12 | Screen with cost-normalised policies and budget matched to operator costs: both cost-aware arms improved prospects and held-out delta, but failed BH-FDR (evolved Δ = +0.020833, CI low +0.003819, q = 0.0907). No promotion | 8 trials/family | `spec/research/242_META_SEARCH_CORRECTED_PROMOTION.md` | `experiments/protocol-242-v1/` |
| 13 | **Promoted (toy substrate only):** fresh-seed confirmatory run of the evolved policy beats fixed baseline: Δ = +0.018720 discoveries/credit (95% CI +0.010324 to +0.027454, p = q = 0.0005, d = 1.01); held-out gamma Δ = +0.021296 (CI low +0.015046, d = 1.38); secondary also positive. All gates passed; replay was diagnostic only | 24 trials/family | `spec/research/243_META_SEARCH_CONFIRMATORY.md` | `experiments/protocol-243-v1/` |
| 14 | **Not demonstrated (real workloads):** the unchanged evolved policy does not transfer to `transform` or `hpo`: prospective Δ = +0.004045 (transform, CI low −0.003175, q = 0.5052) and +0.002500 (hpo, CI low 0, q = 0.5052); both `REJECTED_PROSPECTIVE`, replay diagnostic only; bundle byte-reproduced | 8 trials/family/stage per workload | `spec/research/244_META_SEARCH_REAL_WORKLOAD_TRANSFER.md` | `experiments/protocol-244-v1/`, `implementation/algolab/experiments/protocol-241-final/RESEARCH_REPORT.md` |

## Official milestones (per `planning/MILESTONES.md`)

M0 Delivered · M1 Delivered · **M2 Reference rediscovery — not delivered
Expand Down
28 changes: 28 additions & 0 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ Knowledge layer with evidence tracking and operator management.
- `operators` - Operator catalog and credit budgets
- `registry` - Append-only skill registry

### `algolab.meta_search`
Meta-Search / policy-evolution subsystem (protocols 241+). Search strategies are
typed, versioned experimental objects; all stochastic choices are seeded.

- `traces` — `DiscoveryTrace` / `TraceNode`: append-only, content-addressed,
sha256-chained discovery lineage with canonical JSON.
- `replay` — `ReplayEnv`: prefix-only decisions on a frozen trace; counterfactual
branches are labelled uncertain with no manufactured outcome and are never
prospective evidence.
- `policies` — `SearchPolicy` with deterministic `select()`, `SearchPolicy.checksum()`,
`propose_policy()` and the frozen `BASELINE` / `REPLAY` / `EVOLVED` / `CONTROL` presets.
- `evaluation` — staged `evaluate_policy()` and fail-closed `promote()`; replay
can only diagnose, prospective and independent held-out stages can promote.
- `protocol_241` — sealed bundle writer `run_pilot()` and independent
`verify_pilot()` re-hasher/verdict checker.
- `transfer` — Protocol 244 real-workload runner: reuses the same evaluator and
promotion gate on frozen `transform`/`hpo` attempt traces; replay remains
diagnostic only.

### `algolab.statistics`
Deterministic statistical inference utilities.
- Bootstrap confidence intervals
Expand All @@ -41,6 +60,15 @@ Execution engine for experiments and runs.

See [implementation/algolab/README.md](../../implementation/algolab/README.md#cli-reference) for full CLI documentation.

Meta-Search commands:

- `algolab meta-search-run --dir <bundle> ...` — run a preregistered policy
comparison and seal every artifact in `checksums.json`.
- `algolab meta-transfer-run --dir <bundle> ...` — run the preregistered
real-workload transfer protocol with the same evaluator/promotion gate.
- `algolab meta-verify --dir <bundle> [--json]` — independently re-hash the
bundle, check trace integrity and detect replay-only promotion.

## Usage Examples

- [Quickstart with toy substrate](../../examples/quickstart_toy.py)
Expand Down
86 changes: 86 additions & 0 deletions docs/research/DREAM_RSI_INTEGRATION_AUDIT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# DREAM-RSI → AlgoLab integration audit

**Audited upstream:** `google-research/dream-rsi`, commit
`8ec35bd2538220517ce1bfca4282db21b8c518db` (shallow clone at
`/tmp/opencode/dream-rsi`, outside the AlgoLab source tree).
**Audit date:** 2026-11-19. **Auditor:** implementation agent, Phase 1 of the
master mission. This document records source-level findings, not README claims.

## 1. Architecture comparison

| Concern | DREAM-RSI | AlgoLab (this checkout) | Integration decision |
|---|---|---|---|
| Discovery tree | filesystem `NodeStore` (`explore_b<B>/attempt_<AA>/meta.json`), flat parent ids; `export_graph()` emits nodes+edges | append-only SQLite entities + event store, hash-sealed artifacts, lineage queries | **C** — AlgoLab persistence is the authority; no second tree store |
| Frozen replay world | `env/trace/raw.py`: `CellRaw`, `RawNode`, `RawTrace` (schema v1), `raw_scores.json` | checksummed JSON bundle + `append-only` tables | **B → rewritten** as content-addressed `DiscoveryTrace` in `algolab.meta_search.traces` |
| Replay env | `env/trace_env.py` `TraceEnv`: prefix-only `probe`/`probe_batch`, budget/round bookkeeping | none | **B** — `meta_search.replay.ReplayEnv` keeps prefix-only decisions + explicit uncertainty, drops agent/live half |
| Observation type | `Observation` (score, valid, fail_class, deltas) | `Attempt`, `Evidence`, `SelectionRecord` | **C** — new minimal `Observation` avoids coupling to agent traces |
| Policy | Python module `OptimalPolicy(LLMDesignedMethod)`, rewritten by an agent | versioned, deterministic policy classes in `algolab.search.policies` | **C** — structured frozen `SearchPolicy`, no self-modifying code |
| Policy rewrite loop | `learning/heuristic_search/workflow.py` (agent writes one editable file) | none; MASTER_SPEC §13 requires versioned, shadow-tested proposals | **C** — `propose_policy()` produces reviewable config changes; LLM optional, not required |
| Evaluation | `heuristic_search/eval.py`: `_trace_auc`, `_pareto_summary`, reward = `auc - λ·parallel_penalty`, beta sweep | `statistics.py` (bootstrap CI, Welch, Cohen's d, BH-FDR), `PolicyComparison` | **C** — reuse AlgoLab statistics; keep DREAM-RSI's *qualification-before-selection* idea |
| Promotion | `_qualification_reason` + `_select_best_round` + sha256 check; incumbent stays if not beaten | governance gates, promotion bar ≥2 families | **B/C** — fail-closed 4-stage gate in `meta_search.evaluation.promote` |
| Trace pool | `learning/trace_pool.py` directory of frozen traces + manifest | artifact store | **C** — append traces to the existing artifact store; no parallel pool |
| Orchestration | `orchestrate.py` explore→learning→promote cycles, archive/reset | CLI + sealed `search-run` bundles | **C** — one CLI command (`meta-search-run`) writes one sealed bundle |
| Agents/LLM | Gemini/Codex/Claude backends, 273-line proposer prompt | LLM adapter default off (M3) | **D** — not imported; core works without paid APIs |
| Tasks | KernelBench + SimpleTES (AGPL-3.0 fetched tasks) | toy / hpo / s2 / transform / compose substrates | **D** — use AlgoLab's CPU-friendly toy substrate |

## 2. Components examined (source level)

Files inspected (all under `/tmp/opencode/dream-rsi/`):

- `dream_rsi/env/types.py` — `CellMeta`, `Observation`, `SearchEnv` protocol.
- `dream_rsi/env/trace_env.py` — `TraceEnv`, replay/live probe semantics,
`execution_trace()`, cost model, `_reveal`.
- `dream_rsi/env/trace/{types,raw,export}.py` — `Node`, `Trace`, `CellRaw`,
`RawNode`, `RawTrace`, `raw_trace_to_trace`, zombie/failure classification.
- `dream_rsi/env/{observation,runner,trace_store}.py`, `env/runner.py`.
- `dream_rsi/exploration/store.py` — `NodeStore`, `export_graph`.
- `dream_rsi/learning/trace_pool.py` — frozen trace pool + manifest.
- `dream_rsi/policy/{api,baseline,load,grid_planning,observation_signal,constants}.py`
— `LLMDesignedMethod`, `SimResult`, `GridPlan`, `ParallelRefineMethod`,
`resolve_grid_plan`, pure observation signal helpers.
- `dream_rsi/learning/discover.py` — offline discovery driver / baseline
benchmark (deliberately hides the grid ceiling from the proposer).
- `dream_rsi/learning/heuristic_search/eval.py` — `_resolve_target`,
`evaluate_on_trace`, `evaluate_multi_trace`, `_trace_auc`, `_pareto_summary`,
`run_beta_sweep`; reward = attainment AUC minus parallelism penalty.
- `dream_rsi/learning/heuristic_search/workflow.py` — proposal/eval/archive
rounds, `_qualification_reason`, `_select_best_round`, `promote_best_round`.
- `dream_rsi/orchestrate.py` — stages, `write_live_cycle_manifest` (schema 2,
policy sha256), `_discover_ok`, cycle archiving.
- `dream_rsi/agents/*`, `dream_rsi/prompts/*`, `dream_rsi/learning/directions/*`,
`tests/test_*.py`, `pyproject.toml`, `LICENSE`.

Notable source-level corrections to the README: there is **no** `DiscoverEnv`
class; no policy-pool abstraction; no bandit/UCB sampler (selection is a
deterministic argmax over a qualified reward). Code defaults are 2 branches ×
2 refinements, and the default agent in code is `claude` (proposer backend
`codex`), while the README's "gemini default" applies only to launch scripts.

## 3. Reuse classification

| Component (upstream file / function) | Class | Dependencies | License | AlgoLab equivalent | Proposed integration | Benefit | Tests |
|---|---|---|---|---|---|---|---|
| `env/trace/raw.py` schema + `raw_trace_to_trace` | B (rewritten) | stdlib only | Apache-2.0 | event store, artifact checksums | `meta_search/traces.py`: `TraceNode`, `DiscoveryTrace`, canonical JSON + sha256 chain | durable, attributable histories | `TestTraceInfrastructure` |
| `env/trace_env.py` replay half (`legal_actions`, `_reveal`, prefix-only probing, cost accounting) | B | `NodeStore`, `TraceStore`, agents | Apache-2.0 | none | `meta_search/replay.py`: `ReplayEnv`, outcome-kind enum, no manufactured labels | evaluate alternative policies without fabrication | `TestReplay` |
| `policy/api.py` (`SimResult`, `LLMDesignedMethod`, `GridPlan`) + `grid_planning.resolve_grid_plan` | C | stdlib | Apache-2.0 | `search/policies.py` | frozen structured `SearchPolicy` + 4 deterministic presets + `propose_policy()` | reviewable, versioned, no paid API | `TestPolicies` |
| `heuristic_search/eval.py` `_qualification_reason`, `_pareto_summary` reward idea | B/C | numpy-free math, result dicts | Apache-2.0 | `statistics.py`, `PolicyComparison` | 4-stage fail-closed `evaluate_policy`/`promote` | prevents replay-only or overfit promotion | `TestPromotion` |
| `trace_pool.py` + `orchestrate.write_live_cycle_manifest` (sha256 provenance) | C | filesystem | Apache-2.0 | artifact store, sealed bundles | sealed `protocol-241-v1` bundle + `verify_pilot()` | independent verification / reproducibility | `TestPilotAndVerification` |
| `exploration/store.py` `NodeStore`, workspace tree | D | filesystem, agent dirs | Apache-2.0 | repositories, event store | not imported | — | — |
| `learning/heuristic_search/workflow.py` agent rewriter, `agents/*`, prompts | D | paid-model SDKs, subprocesses | Apache-2.0 / MIT vendored | LLM adapter default-off | not imported (optional LLM may be layered later) | — | — |
| KernelBench / SimpleTES tasks | D | external, AGPL-3.0 fetched | MIT / AGPL-3.0 | toy/hpo/transform/compose | not imported | — | — |

## 4. Dependency and licensing audit

- Upstream root license: **Apache License 2.0** (`/tmp/opencode/dream-rsi/LICENSE`).
Per-file headers: `Copyright 2026 Google LLC`. No `NOTICE` file. Vendored
`third_party/kernelbench/LICENSE` is MIT (Stanford Scaling Intelligence Lab);
fetched SimpleTES tasks are AGPL-3.0 and not present in this checkout.
- Upstream runtime dependencies: none in the base install; optional extras add
numpy/scipy/psutil/scikit-learn, requests/pyyaml, model SDKs, pytest. All are
already available in AlgoLab (sklearn) or deliberately excluded (model SDKs).
**No new dependency is introduced by this integration.**
- Decision: **no upstream source code was copied.** Only architectural ideas
were reimplemented in AlgoLab-native modules, so Apache §4 copying
obligations do not attach; attribution is nonetheless recorded here and in
`THIRD_PARTY_NOTICES.md`, together with the Apache-2.0 license text location.
Nothing from `third_party/` or fetched AGPL tasks was touched.
Loading
Loading