diff --git a/.claude/launch.json b/.claude/launch.json
index f9a72f2..d23dab6 100644
--- a/.claude/launch.json
+++ b/.claude/launch.json
@@ -4,7 +4,7 @@
{
"name": "Observer Console",
"runtimeExecutable": ".venv/bin/python",
- "runtimeArgs": ["scripts/observer_console.py", "--no-open", "--port", "8899"],
+ "runtimeArgs": ["tools/console/server.py", "--no-open", "--port", "8899"],
"port": 8899
}
]
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b4dec02..2b15444 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,7 +19,7 @@ jobs:
python -m pip install -e . pytest
- name: Compile check
run: |
- python -m compileall -q src scripts
+ python -m compileall -q src analysis experiments tools
- name: Unit tests
run: |
python -m pytest -q
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 81ee751..8d2ce73 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,10 +28,10 @@ python -m pip install -e ".[research]"
For experiment-driven work, use the repo workflow note:
-- [docs/RESEARCH_WORKFLOW.md](docs/RESEARCH_WORKFLOW.md)
+- [docs/workflow/RESEARCH_WORKFLOW.md](docs/workflow/RESEARCH_WORKFLOW.md)
It covers:
-- how to orient from `RESEARCH.md`
+- how to orient from `docs/research/RESEARCH.md`
- how to define success criteria before runs
- how to verify provenance before interpretation
- how to update the research log after each session
@@ -41,8 +41,8 @@ It covers:
These match what CI runs:
```bash
-# Compile-check the active runtime + scripts
-python -m compileall -q src scripts
+# Compile-check the active runtime and support tools
+python -m compileall -q src analysis experiments tools
# Run the test suite
python -m pytest -q
@@ -52,9 +52,8 @@ The test suite is small but guards against drift — CLI semantic-layer parsing,
branchpoint-analyzer defaults, README quickstart commands pointing at the unified
runtime. Add tests when adding features that other agents will rely on.
-The legacy modules (`baseline_hysteresis_v1/`, `v1.5/`, `intervention_engine_v1.5_v2/`,
-`adaptive_controller_system4/`) are kept as historical reference for the v1
+The legacy modules (`archive/prototypes/`, `archive/controller/`, and `archive/analysis/`) are kept as historical reference for the v1
paper. Production research uses `src/runtime_lab/` — invoked via
`python -m runtime_lab.cli.main {observe|stress|hysteresis|control}` or the
-warm-model daemon at `scripts/observer_daemon.py`. Don't add new code to the
+warm-model daemon at `tools/observer_daemon.py`. Don't add new code to the
legacy directories.
diff --git a/README.md b/README.md
index 8e600fe..f0b0047 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ actual token-decision timeline, creates matched counterfactuals, measures what
changes, and saves enough provenance to challenge every result. `Act`—including
controller research—comes later.
-See [`docs/OBSERVER_FOUNDATIONS.md`](docs/OBSERVER_FOUNDATIONS.md) for the
+See [`docs/foundations/OBSERVER_FOUNDATIONS.md`](docs/foundations/OBSERVER_FOUNDATIONS.md) for the
scientific and runtime contract.
## Read The Paper First
@@ -57,19 +57,19 @@ thesis remains paused.
Start with:
-- `docs/OBSERVER_FOUNDATIONS.md` for what Observer is and what each result can
+- `docs/foundations/OBSERVER_FOUNDATIONS.md` for what Observer is and what each result can
prove.
-- `RESEARCH.md` for the active evidence ledger and next experiment.
-- `docs/FOUNDATION_CALIBRATION_2026-07-19.md` for the first repaired-protocol
+- `docs/research/RESEARCH.md` for the active evidence ledger and next experiment.
+- `docs/results/FOUNDATION_CALIBRATION_2026-07-19.md` for the first repaired-protocol
target-model result.
-- `docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md` for the downstream-layer
+- `docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md` for the downstream-layer
propagation result.
-- `docs/Q3_BASIN_MAPPING_2026-07-19.md` for the causal paired-continuation
+- `docs/results/Q3_BASIN_MAPPING_2026-07-19.md` for the causal paired-continuation
outcome result and negative prediction gate.
-- `docs/Q3_M3R2_REPLICATION_2026-07-19.md` for the fresh-prompt replication,
+- `docs/results/Q3_M3R2_REPLICATION_2026-07-19.md` for the fresh-prompt replication,
stronger negative Q3 result, and procedural non-replication.
-- `RESEARCH_CONTROLLER.md` for the archived controller evidence.
-- `docs/RESEARCH_WORKFLOW.md` for the experiment handoff discipline.
+- `archive/controller/RESEARCH_CONTROLLER.md` for the archived controller evidence.
+- `docs/workflow/RESEARCH_WORKFLOW.md` for the experiment handoff discipline.
---
@@ -292,29 +292,35 @@ foundation.
intervention-free branch continuation, and declared branch-blind rubrics
- Simple diagnostic baselines plus a deterministic synthetic validator
- Experimental runs reported in the paper were executed on a single NVIDIA H200 GPU via RunPod
-- Reporting checklist in `REPRODUCIBILITY.md`
+- Reporting checklist in `docs/research/REPRODUCIBILITY.md`
---
-## Project Layout
-
-```
-src/runtime_lab/ active implementation and unified CLI
-scripts/ offline analyzers, warm-model daemon, console
-tests/ guard tests (CLI parsing, doc/CI hygiene)
-runs/ local run artifacts (ignored by git)
-docs/ paper, workflow note, assets
-RESEARCH.md active evidence ledger and calibration program
-RESEARCH_CONTROLLER.md archived controller arc (Phase 1, F1–F29)
-docs/OBSERVER_FOUNDATIONS.md active scientific/runtime contract
-baseline_hysteresis_v1/ legacy v1 hysteresis prototype (historical)
-v1.5/ legacy v1.5 observability prototype (historical)
-intervention_engine_v1.5_v2/ legacy v2 intervention prototype (historical)
-adaptive_controller_system4/ legacy controller prototype (historical)
+## Repository Layout
+
+The active implementation is kept separate from experiment tooling, documentation, and historical research. The Python package remains named `runtime_lab` for compatibility.
+
+```text
+observer/
+├── src/runtime_lab/ active measurement package and unified CLI
+├── experiments/ reusable calibration runners
+├── analysis/ offline artifact analyzers
+├── tools/ daemon, validation, and console tooling
+│ └── console/static/ console web assets
+├── tests/ contract and behavioral tests
+├── docs/
+│ ├── foundations/ active scientific/runtime contract
+│ ├── research/ active evidence ledger and reproducibility
+│ ├── results/ dated calibration and replication reports
+│ ├── workflow/ experiment handoff guidance
+│ └── observer_paper.html hosted paper source (stable Pages path)
+└── archive/
+ ├── controller/ historical controller arc
+ ├── prototypes/ superseded runtime prototypes
+ └── analysis/ superseded analyzers
```
-The `legacy v*` directories are kept for reproducing v1-paper results and as
-historical reference. New work goes in `src/runtime_lab/`.
+New research code belongs in `src/runtime_lab/`, `experiments/`, `analysis/`, or `tools/`. The `archive/` tree is preserved for historical reproduction and context; it is not part of the active evidence pipeline.
---
@@ -335,7 +341,7 @@ Or cite via `CITATION.cff`. The current preprint is the v2 paper at
[`docs/observer_paper.html`](docs/observer_paper.html) (also hosted at
observer: Runtime Instrumentation for
Trajectory Mapping in Lang
observations, but its recovery ratios and regime labels are provisional.
The historical numbers below are retained as an audit record, not erased.
The current contract is documented in
- docs/OBSERVER_FOUNDATIONS.md.
+ docs/foundations/OBSERVER_FOUNDATIONS.md.
The repaired protocols were then calibrated in 42 Qwen3-1.7B runs across @@ -1261,7 +1261,7 @@
RESEARCH_CONTROLLER.md archive for historical context.
+ archive/controller/RESEARCH_CONTROLLER.md archive for historical context.
In v2 we ran a longer arc on Qwen3-1.7B (28 layers) with explicit controls. We @@ -1768,7 +1768,7 @@
(scaling | additive-random | additive-EMA-opposing | additive-anchor-opposing)
× (L=−1, L=−2, L=−3) × (magnitude ∈ {0.3, 0.6, 0.8, 1.2})
have all been tested and are recorded in §10 and the
- RESEARCH_CONTROLLER.md archive. Reopening this space without new
+ archive/controller/RESEARCH_CONTROLLER.md archive. Reopening this space without new
information from the mapping work would be blind tuning.
@@ -1789,7 +1789,7 @@
- The included REPRODUCIBILITY.md specifies a reporting checklist for public claims:
+ The included docs/research/REPRODUCIBILITY.md specifies a reporting checklist for public claims:
pin commit hash in every figure caption; report model key, backend, seed, and intervention settings;
run at least 3 seeds per comparison; report mean + confidence interval, not best run;
publish raw results.json used for plots. This is the standard that is routinely
@@ -1801,10 +1801,10 @@
RESEARCH.md tracks the active mapping program and is the entry point
- for any new session, and RESEARCH_CONTROLLER.md archives the
+ docs/research/RESEARCH.md tracks the active mapping program and is the entry point
+ for any new session, and archive/controller/RESEARCH_CONTROLLER.md archives the
completed controller arc with full F-numbered findings so subsequent agents can
- cite established facts without re-deriving them. docs/RESEARCH_WORKFLOW.md
+ cite established facts without re-deriving them. docs/workflow/RESEARCH_WORKFLOW.md
documents the experiment handoff protocol both documents follow.
@@ -2005,8 +2005,8 @@ RESEARCH_CONTROLLER.md, RESEARCH.md, and
- docs/OBSERVER_FOUNDATIONS.md in the
+ archive/controller/RESEARCH_CONTROLLER.md, docs/research/RESEARCH.md, and
+ docs/foundations/OBSERVER_FOUNDATIONS.md in the
repository, with full per-experiment run identifiers so any claim in this paper
can be traced to its underlying run artifacts.
diff --git a/REPRODUCIBILITY.md b/docs/research/REPRODUCIBILITY.md
similarity index 99%
rename from REPRODUCIBILITY.md
rename to docs/research/REPRODUCIBILITY.md
index a11aa0e..48931f6 100644
--- a/REPRODUCIBILITY.md
+++ b/docs/research/REPRODUCIBILITY.md
@@ -180,7 +180,7 @@ Mode-specific extras:
Before assigning meaning to advanced signals, run:
```bash
-python scripts/validate_diagnostics.py \
+python tools/validate_diagnostics.py \
--json-out /tmp/observer-diagnostic-validation.json
```
diff --git a/RESEARCH.md b/docs/research/RESEARCH.md
similarity index 94%
rename from RESEARCH.md
rename to docs/research/RESEARCH.md
index e0760c7..aad967a 100644
--- a/RESEARCH.md
+++ b/docs/research/RESEARCH.md
@@ -2,7 +2,7 @@
_Active living document. Observer's current work begins with the repaired
Observe → Perturb → Compare → Prove foundation. The controller arc is archived
-in [RESEARCH_CONTROLLER.md](RESEARCH_CONTROLLER.md)._
+in [RESEARCH_CONTROLLER.md](../../archive/controller/RESEARCH_CONTROLLER.md)._
Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
@@ -28,11 +28,11 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
**Historical context**
- This doc tracks the mapping program that started 2026-04-19. It is forward-looking by design.
-- For *why* this program exists — the complete controller arc, findings F1–F29, experiments E1–E8.7 — see [RESEARCH_CONTROLLER.md](RESEARCH_CONTROLLER.md).
+- For *why* this program exists — the complete controller arc, findings F1–F29, experiments E1–E8.7 — see [RESEARCH_CONTROLLER.md](../../archive/controller/RESEARCH_CONTROLLER.md).
- Don't re-run experiments already recorded there. Evidence in the carry-over section below is a summary; the full record is in the archive.
**Discipline**
-- Full protocol: [docs/RESEARCH_WORKFLOW.md](docs/RESEARCH_WORKFLOW.md)
+- Full protocol: [docs/RESEARCH_WORKFLOW.md](../workflow/RESEARCH_WORKFLOW.md)
- Evidence standard: strong findings need ≥3 seeds AND ≥2 prompts AND ≥2 models. Single-seed or single-model results are labeled as provisional.
- Before trusting any result, check provenance (config.json, events.jsonl, applied-count).
- Negative results are progress. Don't retroactively adjust success criteria.
@@ -55,7 +55,7 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
- **North star**: *Observer maps trajectory sensitivity, propagation,
persistence, and recovery through matched causal experiments.* The first
calibration target remains Qwen3-1.7B; cross-model generalization is later.
-- **Foundation contract**: [docs/OBSERVER_FOUNDATIONS.md](docs/OBSERVER_FOUNDATIONS.md).
+- **Foundation contract**: [docs/OBSERVER_FOUNDATIONS.md](../foundations/OBSERVER_FOUNDATIONS.md).
Active work follows Observe → Perturb → Compare → Prove. Act is downstream.
- **Program structure**: three mapping questions, Q1–Q3 in §3. **Q1 status: scoped positive**;
**Q2 status: scoped mechanistic answer**; **Q3 status: measured negative**
@@ -100,7 +100,7 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
- **Verdict:** M3R-2 confirmed the negative Q3 gate under a broader,
higher-resolution preregistered design. The controller-return criterion is
not met, and the controller remains paused.
- - Evidence: `docs/Q3_M3R2_REPLICATION_2026-07-19.md`.
+ - Evidence: `docs/results/Q3_M3R2_REPLICATION_2026-07-19.md`.
- Confidence: **high** in causal mechanics, replay, controls, artifacts, and
the negative result for this frozen design; **low** that a universal
prompt-class direction exists.
@@ -134,7 +134,7 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
condition is not met. “Improve” means higher score under a predeclared
deterministic prompt rubric, not universal semantic quality. The
controller-return criterion is not met.
- - Evidence: `docs/Q3_BASIN_MAPPING_2026-07-19.md`.
+ - Evidence: `docs/results/Q3_BASIN_MAPPING_2026-07-19.md`.
- Confidence: **high** in protocol validity, replay, controls, and recorded
rubric outcomes; **low-medium** in prompt-class interpretation because the
eligible binary sample is small and class balance is uneven.
@@ -164,7 +164,7 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
- **Verdict:** Q2 has a scoped mechanistic answer. Historical F27's “earlier
layer = worse” is not a universal local law and likely includes repeated
exposure/context cascade. The Q2 controller-return criterion is not met.
- - Evidence: `docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md`.
+ - Evidence: `docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md`.
- Confidence: **high** in protocol validity and measured curves; **medium**
in layer-13 candidacy because prompt diversity remains narrow.
@@ -185,7 +185,7 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
intervention, magnitude, prompts, and seeds. It is not yet a robust
controller trigger or a cross-prompt/model universal detector.
- Evidence:
- `docs/FOUNDATION_CALIBRATION_2026-07-19.md` and the durable local artifact
+ `docs/results/FOUNDATION_CALIBRATION_2026-07-19.md` and the durable local artifact
directory recorded there.
- Confidence: **medium-high** in the scoped AUROC result; only three unique
prompt-slice holdouts exist.
@@ -245,12 +245,12 @@ Last updated: **2026-07-19** · Foundation rebuild started: **2026-07-19**
- **Interpretation**: within Qwen3-1.7B on this prompt, hidden-state geometry features from the clean trajectory predict flippability at 0.82 AUROC. Mechanistically coherent: flippable steps are low-velocity, spectrally-broad-but-low-power, concentrated in a dominant direction, and later in the sequence.
- **Correction:** shadow features removed direct feature leakage, but did not
repair the shifted/cascading label. This analysis cannot close Q1.
- - Artifacts: analyzer at `scripts/analyze_branchpoints.py`, commit `1ec2c14`.
+ - Artifacts: analyzer at `analysis/analyze_branchpoints.py`, commit `1ec2c14`.
- Confidence: **medium** (1 prompt, 4 seeds, mechanistically consistent features, but prompt-breadth evidence standard not yet met).
## 2. Carry-over facts (established in controller arc)
-_These are motivating evidence for the mapping program. Full records in RESEARCH_CONTROLLER.md §2._
+_These are motivating evidence for the mapping program. Full records in archive/controller/RESEARCH_CONTROLLER.md §2._
- **F13** (cited): reproducible drift operating point at (Qwen3-1.7B, L27, noise_mag=1.0, factual, temp=0.8) — drift 1.96 ± 0.37, DSR=5.36 across 5 seeds. The instrument can produce reproducible perturbation effects.
- **F17 / F22**: scaling at final layer is absorbed by the model's final RMSNorm. Zero effect on logits. Don't use scaling as an intervention class at L=-1.
@@ -328,7 +328,7 @@ landed.
**The claim we're trying to establish.** Given a token flip at branchpoint T, predict whether the resulting trajectory lands in a better or worse basin. F29 showed this is model-specific; we want to characterize the model-dependent features that determine it.
-**Evidence standard** (Qwen3-1.7B scope): ≥5 prompts × ≥3 seeds per (prompt, config) cell, all within Qwen3-1.7B. Cross-model basin comparison is out of scope here (see RESEARCH_CONTROLLER.md F29 for the one cross-model data point we already have, to be revisited later).
+**Evidence standard** (Qwen3-1.7B scope): ≥5 prompts × ≥3 seeds per (prompt, config) cell, all within Qwen3-1.7B. Cross-model basin comparison is out of scope here (see archive/controller/RESEARCH_CONTROLLER.md F29 for the one cross-model data point we already have, to be revisited later).
**Stop condition**: a feature of the pre-flip Qwen3-1.7B generation that predicts improve-vs-degrade with AUROC ≥ 0.7. Candidate features:
- Baseline output repetition score (is the model in a degenerate loop?)
@@ -362,7 +362,7 @@ The controller thesis is paused, not dead. It returns to active status when **an
If any two land, a controller redesign experiment is warranted. If none land during the mapping program, the interpretability findings stand alone and the controller stays on ice.
-**What does NOT justify re-opening controller work**: more tuning of the existing `raw_div → scaling | random additive | EMA opposition` design. That entire search space is exhausted (RESEARCH_CONTROLLER.md F17–F27).
+**What does NOT justify re-opening controller work**: more tuning of the existing `raw_div → scaling | random additive | EMA opposition` design. That entire search space is exhausted (archive/controller/RESEARCH_CONTROLLER.md F17–F27).
---
@@ -387,7 +387,7 @@ expected-improvement criteria have not landed.
- **Outcome**: complete 2026-07-19. Magnitude 0.30 cleared mean held-out AUROC
0.80 on both prompt slices (0.831 sourdough, 0.886 water cycle). Zero controls
were exact. See F32 and
- `docs/FOUNDATION_CALIBRATION_2026-07-19.md`.
+ `docs/results/FOUNDATION_CALIBRATION_2026-07-19.md`.
### [x] MHR — Calibrate matched hysteresis
@@ -428,7 +428,7 @@ expected-improvement criteria have not landed.
- **Follow-ups**: _(filled when complete)_
### [!] Historical M1.2 — Second controller-run prompt *(completed, claim invalidated)*
-- **Outcome**: ran 10 control runs on "Describe the water cycle in a few sentences." with same config as M1.1's passing slice. All active cells fired (8-10 interventions per seed). Rerun of `scripts/analyze_branchpoints.py` on Qwen3-only opposing-anchor corpus:
+- **Outcome**: ran 10 control runs on "Describe the water cycle in a few sentences." with same config as M1.1's passing slice. All active cells fired (8-10 interventions per seed). Rerun of `analysis/analyze_branchpoints.py` on Qwen3-only opposing-anchor corpus:
- Sourdough: AUROC 0.82 ✓
- Water cycle: AUROC 0.86 ✓
- Both prompts clear the 0.80 threshold independently
@@ -443,7 +443,7 @@ expected-improvement criteria have not landed.
- **Design**:
- Pick one non-sourdough prompt already in the registry (e.g., "Describe the water cycle in a few sentences." or "Explain how airplanes fly in a clear, accurate way.").
- Run 5 seeds × 2 cells (shadow + opposing-anchor additive at L=-1, mag=0.3/0.6, temp=0.8, max_tokens=48). 10 runs.
- - Run `scripts/analyze_branchpoints.py` on the combined corpus (sourdough + new prompt).
+ - Run `analysis/analyze_branchpoints.py` on the combined corpus (sourdough + new prompt).
- **Stop condition** (Q1 closure): within-Qwen3 held-out AUROC ≥ 0.80 across both prompts.
- **Historical expected payoff**: this was expected to settle Q1. The
2026-07-19 audit established that the label did not match the causal question.
@@ -472,7 +472,7 @@ expected-improvement criteria have not landed.
types and three injection layers, with normalized/angular metrics and prompt
slices as well as raw L2.
- **Outcome**: complete 2026-07-19. See F34 and
- `docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md`.
+ `docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md`.
### [x] M3R — Causal prompt-class basin mapping on Qwen3-1.7B
- **Question**: When an independent branchpoint fork changes a decision and
@@ -497,8 +497,8 @@ expected-improvement criteria have not landed.
predictor reached mean AUROC 0.571 across five valid splits, below 0.70.
Procedural prompts produced a scoped 12 improve / 0 degrade / 6 tie pattern
that was subsequently tested and did not replicate in M3R-2/F36. See F35,
- F36, `docs/Q3_BASIN_MAPPING_2026-07-19.md`, and
- `docs/Q3_M3R2_REPLICATION_2026-07-19.md`.
+ F36, `docs/results/Q3_BASIN_MAPPING_2026-07-19.md`, and
+ `docs/results/Q3_M3R2_REPLICATION_2026-07-19.md`.
### [x] M3R-2 — Fresh-prompt causal basin replication
@@ -517,14 +517,14 @@ expected-improvement criteria have not landed.
Thirteen valid prompt holdouts reached mean AUROC 0.596, below 0.70. The
procedural slice produced 16 improve / 19 degrade / 9 tie, so the M3R
directional pattern did not replicate. See F36 and
- `docs/Q3_M3R2_REPLICATION_2026-07-19.md`.
+ `docs/results/Q3_M3R2_REPLICATION_2026-07-19.md`.
---
## 6. Sessions log (Mapping phase)
- **2026-04-19 · Program defined.** Pivoted from controller-focused to mapping-focused. Three questions (Q1 branchpoint geometry, Q2 propagation, Q3 basin structure) with stop conditions. Controller-return criteria specified. Next: M1.1.
-- **2026-04-19 · M1.1 ran, Qwen3 AUROC 0.82.** Codex wrote `scripts/analyze_branchpoints.py`. Claude caught + fixed a circular-feature leak (features from active events included intervention_applied, scale_used, etc. — tautological). With honest shadow-trajectory features on the Qwen3-1.7B sourdough slice, held-out AUROC is **0.82** across 12 pairs / 4 seeds — clears Q1's 0.80 threshold. F30 added. Remaining Q1 gap: ≥2 prompts evidence standard. M1.2 queued: run a second Qwen3 prompt suite.
+- **2026-04-19 · M1.1 ran, Qwen3 AUROC 0.82.** Codex wrote `analysis/analyze_branchpoints.py`. Claude caught + fixed a circular-feature leak (features from active events included intervention_applied, scale_used, etc. — tautological). With honest shadow-trajectory features on the Qwen3-1.7B sourdough slice, held-out AUROC is **0.82** across 12 pairs / 4 seeds — clears Q1's 0.80 threshold. F30 added. Remaining Q1 gap: ≥2 prompts evidence standard. M1.2 queued: run a second Qwen3 prompt suite.
- **2026-04-19 · Scope correction.** Human redirected: mapping program is Qwen3-1.7B, not cross-model. Earlier M1.2 spec (add logit-margin logging for cross-model generalization) deferred to M1.3 / later work. Current M1.2 is a simple 10-run experiment on a second Qwen3 prompt.
- **2026-04-19 · Historical M1.2 verdict (invalidated 2026-07-19).** Ten
water-cycle controller runs produced historical AUROCs of 0.82 and 0.86 and
@@ -567,7 +567,7 @@ expected-improvement criteria have not landed.
became 16 / 19 / 9 on fresh prompts. The negative Q3 result is replicated;
controller work remains paused.
-_(For sessions covering the controller arc 2026-02 through 2026-04-19, see [RESEARCH_CONTROLLER.md](RESEARCH_CONTROLLER.md) §5.)_
+_(For sessions covering the controller arc 2026-02 through 2026-04-19, see [RESEARCH_CONTROLLER.md](../../archive/controller/RESEARCH_CONTROLLER.md) §5.)_
---
@@ -576,7 +576,7 @@ _(For sessions covering the controller arc 2026-02 through 2026-04-19, see [RESE
**Orient before starting**
```bash
# see the status of both docs
-head -40 RESEARCH.md RESEARCH_CONTROLLER.md
+head -40 docs/research/RESEARCH.md archive/controller/RESEARCH_CONTROLLER.md
# current state via API
curl -s http://127.0.0.1:8899/api/capabilities | jq '.modes | keys'
@@ -587,7 +587,7 @@ curl -s http://127.0.0.1:8899/api/runs | jq '.runs[0:5] | .[] | {id, mode, headl
```bash
cd ~/observer
source .venv/bin/activate
-python scripts/observer_daemon.py --model qwen3-1.7b
+python tools/observer_daemon.py --model qwen3-1.7b
```
**Orchestrator pattern for a new mapping experiment**
diff --git a/docs/FOUNDATION_CALIBRATION_2026-07-19.md b/docs/results/FOUNDATION_CALIBRATION_2026-07-19.md
similarity index 100%
rename from docs/FOUNDATION_CALIBRATION_2026-07-19.md
rename to docs/results/FOUNDATION_CALIBRATION_2026-07-19.md
diff --git a/docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md b/docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md
similarity index 100%
rename from docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md
rename to docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md
diff --git a/docs/Q3_BASIN_MAPPING_2026-07-19.md b/docs/results/Q3_BASIN_MAPPING_2026-07-19.md
similarity index 98%
rename from docs/Q3_BASIN_MAPPING_2026-07-19.md
rename to docs/results/Q3_BASIN_MAPPING_2026-07-19.md
index 40efb86..a2d6249 100644
--- a/docs/Q3_BASIN_MAPPING_2026-07-19.md
+++ b/docs/results/Q3_BASIN_MAPPING_2026-07-19.md
@@ -197,5 +197,5 @@ replication rather than controller work:
- Manifest: `basin_manifest.json`
- Machine-readable analysis: `basin_analysis.json`
- Generated analysis table: `BASIN_ANALYSIS.md`
-- Reproducible runner: `scripts/run_basin_calibration.py`
-- Independent analyzer: `scripts/analyze_basins.py`
+- Reproducible runner: `experiments/run_basin_calibration.py`
+- Independent analyzer: `analysis/analyze_basins.py`
diff --git a/docs/Q3_M3R2_REPLICATION_2026-07-19.md b/docs/results/Q3_M3R2_REPLICATION_2026-07-19.md
similarity index 99%
rename from docs/Q3_M3R2_REPLICATION_2026-07-19.md
rename to docs/results/Q3_M3R2_REPLICATION_2026-07-19.md
index 686de59..7daeea2 100644
--- a/docs/Q3_M3R2_REPLICATION_2026-07-19.md
+++ b/docs/results/Q3_M3R2_REPLICATION_2026-07-19.md
@@ -270,8 +270,8 @@ The controller-return program still lacks two qualifying results:
- Generated analysis: `BASIN_ANALYSIS.md`
- Independent reanalysis:
`/tmp/observer-m3r2-analysis-independent.json`
-- Frozen runner: `scripts/run_basin_calibration.py`
-- Frozen analyzer: `scripts/analyze_basins.py`
+- Frozen runner: `experiments/run_basin_calibration.py`
+- Frozen analyzer: `analysis/analyze_basins.py`
The independent analyzer rerun matched the durable analysis exactly after
removing only `generated_at`.
diff --git a/docs/superpowers/plans/2026-08-28-observer-repository-layout.md b/docs/superpowers/plans/2026-08-28-observer-repository-layout.md
new file mode 100644
index 0000000..66f4b64
--- /dev/null
+++ b/docs/superpowers/plans/2026-08-28-observer-repository-layout.md
@@ -0,0 +1,193 @@
+# Observer Repository Layout Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Make the active Observer measurement system immediately legible by separating experiment runners, offline analysis, operational tools, current research documentation, and historical implementations without changing runtime behavior.
+
+**Architecture:** Preserve the existing `src/runtime_lab` Python package and its public `runtime_lab.cli.main` entrypoint. Move reusable calibration runners into `experiments/`, offline analyzers into `analysis/`, daemon/validation/console support into `tools/`, and historical controller/prototype code into `archive/`. Keep the hosted paper at `docs/observer_paper.html` so the existing GitHub Pages URL remains stable.
+
+**Tech Stack:** Python 3.10+, setuptools, PyTorch, Transformers, pytest, GitHub Actions, static HTML/CSS/JavaScript console.
+
+**Spec:** Repository-organization request from the user, based on the active Observer structure described in the session.
+
+## Global Constraints
+
+- Do not alter experiment semantics, model behavior, metrics, artifact formats, or the `runtime_lab` package name.
+- Preserve every historical implementation and research record; move them, do not delete them.
+- Keep `docs/observer_paper.html` and `docs/assets/observer_paper_cover.png` at their current hosted paths.
+- Update all imports, commands, tests, documentation links, and launch configuration affected by moves.
+- Compile and test active code paths; historical archive code is preserved but excluded from the active CI compile target.
+
+---
+
+### Task 1: Save the layout plan
+
+**Files:**
+- Create: `docs/superpowers/plans/2026-08-28-observer-repository-layout.md`
+
+- [ ] **Step 1: Record the target boundaries and invariants**
+
+Document the final directory responsibilities, the files being moved, and the compatibility constraints above.
+
+- [ ] **Step 2: Commit the plan**
+
+Create one commit containing only this plan so the implementation has a durable handoff record.
+
+---
+
+### Task 2: Separate active runners, analysis, and tools
+
+**Files:**
+- Move: `scripts/run_basin_calibration.py` → `experiments/run_basin_calibration.py`
+- Move: `scripts/run_foundation_calibration.py` → `experiments/run_foundation_calibration.py`
+- Move: `scripts/run_propagation_calibration.py` → `experiments/run_propagation_calibration.py`
+- Move: `scripts/analyze_basins.py` → `analysis/analyze_basins.py`
+- Move: `scripts/analyze_branchpoints.py` → `analysis/analyze_branchpoints.py`
+- Move: `scripts/analyze_propagation.py` → `analysis/analyze_propagation.py`
+- Move: `scripts/observer_daemon.py` → `tools/observer_daemon.py`
+- Move: `scripts/validate_diagnostics.py` → `tools/validate_diagnostics.py`
+- Move: `scripts/observer_console.py` → `tools/console/server.py`
+- Move: `scripts/observer_console/app.js` → `tools/console/static/app.js`
+- Move: `scripts/observer_console/index.html` → `tools/console/static/index.html`
+- Move: `scripts/observer_console/styles.css` → `tools/console/static/styles.css`
+- Create: `experiments/__init__.py`
+- Create: `analysis/__init__.py`
+- Create: `tools/__init__.py`
+- Create: `tools/console/__init__.py`
+
+- [ ] **Step 1: Preserve module contents while moving active files**
+
+Move each active file to its responsibility-based destination. Keep the existing `runtime_lab` imports and command-line interfaces unchanged.
+
+- [ ] **Step 2: Repair console path resolution**
+
+In `tools/console/server.py`, set the repository root to `Path(__file__).resolve().parents[2]` and static root to `Path(__file__).resolve().parent / "static"`. Update its usage example to `python tools/console/server.py --port 8899`.
+
+- [ ] **Step 3: Repair the cross-module analyzer import**
+
+In `analysis/analyze_propagation.py`, import the calibration helpers from `experiments.run_propagation_calibration` with the existing script-execution fallback preserved.
+
+- [ ] **Step 4: Commit the active-tooling move**
+
+Create one commit containing the active runner, analysis, daemon, validation, and console reorganization.
+
+---
+
+### Task 3: Move historical code behind an explicit archive boundary
+
+**Files:**
+- Move: `scripts/analyze_branchpoints_legacy.py` → `archive/analysis/analyze_branchpoints_legacy.py`
+- Move: `adaptive_controller_system4/` → `archive/controller/adaptive_controller_system4/`
+- Move: `baseline_hysteresis_v1/` → `archive/prototypes/baseline_hysteresis_v1/`
+- Move: `intervention_engine_v1.5_v2/` → `archive/prototypes/intervention_engine_v1.5_v2/`
+- Move: `v1.5/` → `archive/prototypes/v1.5/`
+- Move: `RESEARCH_CONTROLLER.md` → `archive/controller/RESEARCH_CONTROLLER.md`
+- Create: `archive/__init__.py`
+- Create: `archive/analysis/__init__.py`
+
+- [ ] **Step 1: Move historical implementations without editing their contents**
+
+Retain the original filenames and internal structure under `archive/` so old experiments remain inspectable and reproducible.
+
+- [ ] **Step 2: Add archive boundary markers**
+
+Add minimal package markers only where tests need imports; do not turn archived code into active package code or change its semantics.
+
+- [ ] **Step 3: Commit the archive move**
+
+Create one commit containing only historical relocation and package markers.
+
+---
+
+### Task 4: Organize current research documentation
+
+**Files:**
+- Move: `RESEARCH.md` → `docs/research/RESEARCH.md`
+- Move: `REPRODUCIBILITY.md` → `docs/research/REPRODUCIBILITY.md`
+- Move: `docs/OBSERVER_FOUNDATIONS.md` → `docs/foundations/OBSERVER_FOUNDATIONS.md`
+- Move: `docs/RESEARCH_WORKFLOW.md` → `docs/workflow/RESEARCH_WORKFLOW.md`
+- Move: `docs/FOUNDATION_CALIBRATION_2026-07-19.md` → `docs/results/FOUNDATION_CALIBRATION_2026-07-19.md`
+- Move: `docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md` → `docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md`
+- Move: `docs/Q3_BASIN_MAPPING_2026-07-19.md` → `docs/results/Q3_BASIN_MAPPING_2026-07-19.md`
+- Move: `docs/Q3_M3R2_REPLICATION_2026-07-19.md` → `docs/results/Q3_M3R2_REPLICATION_2026-07-19.md`
+
+- [ ] **Step 1: Move current documents by purpose**
+
+Group the scientific contract, workflow, research ledger, reproducibility checklist, and calibration reports without modifying their findings.
+
+- [ ] **Step 2: Update relative links inside moved documents**
+
+Make every foundation, workflow, result, analyzer, runner, daemon, and archived-controller reference resolve from its new location.
+
+- [ ] **Step 3: Keep the hosted paper path stable**
+
+Leave `docs/observer_paper.html` and its asset directory in place, while updating its displayed source/reference paths to the organized documentation locations.
+
+- [ ] **Step 4: Commit the documentation move**
+
+Create one commit containing current-document relocation and link corrections.
+
+---
+
+### Task 5: Update repository surfaces and tests
+
+**Files:**
+- Modify: `README.md`
+- Modify: `CONTRIBUTING.md`
+- Modify: `.claude/launch.json`
+- Modify: `.github/workflows/ci.yml`
+- Modify: `tests/test_repo_hygiene.py`
+- Modify: `tests/test_claim_status.py`
+- Modify: `tests/test_branchpoint_analyzer.py`
+- Modify: `tests/test_basin_analyzer.py`
+- Modify: `tests/test_basin_calibration.py`
+- Modify: `tests/test_daemon_contract.py`
+- Modify: `tests/test_diagnostic_validation.py`
+- Modify: `tests/test_foundation_calibration.py`
+- Modify: `tests/test_hysteresis_protocol.py`
+- Modify: `tests/test_layer_resolution_contract.py`
+- Modify: `tests/test_propagation_analyzer.py`
+- Modify: `tests/test_propagation_calibration.py`
+
+- [ ] **Step 1: Rewrite the README repository map**
+
+Show `src/runtime_lab/` as the active package, `experiments/`, `analysis/`, `tools/`, `tests/`, organized `docs/`, the stable paper source, and `archive/` as the historical boundary.
+
+- [ ] **Step 2: Update commands and links**
+
+Point quick checks, calibration commands, source links, research references, console launch configuration, and CI compile targets at their new paths.
+
+- [ ] **Step 3: Update test imports and fixture paths**
+
+Replace `scripts.*` imports with `analysis.*`, `experiments.*`, `tools.*`, and `tools.console.server`; point claim/status and console-static assertions at their organized locations.
+
+- [ ] **Step 4: Commit the public-surface update**
+
+Create one commit containing README, contributor guidance, launch/CI configuration, and test path updates.
+
+---
+
+### Task 6: Verify the reorganized repository
+
+**Files:**
+- Verify: complete Git tree, imports, documentation links, CI commands, and test suite
+
+- [ ] **Step 1: Verify no stale active paths remain**
+
+Search tracked text for `scripts/`, old root research paths, and old legacy top-level paths; allow only intentional historical prose or URL references.
+
+- [ ] **Step 2: Verify active Python compilation**
+
+Run `python -m compileall -q src analysis experiments tools` and confirm exit code 0.
+
+- [ ] **Step 3: Verify the unit/contract suite**
+
+Run `python -m pytest -q` and record the exact pass/fail result.
+
+- [ ] **Step 4: Verify the final tree**
+
+Confirm active code is outside `archive/`, all historical files are preserved under `archive/`, the paper remains at `docs/observer_paper.html`, and all tests refer to the new locations.
+
+- [ ] **Step 5: Commit any verification-only corrections**
+
+If verification exposes a stale path, fix it in the smallest logical commit and rerun the affected checks.
diff --git a/docs/RESEARCH_WORKFLOW.md b/docs/workflow/RESEARCH_WORKFLOW.md
similarity index 95%
rename from docs/RESEARCH_WORKFLOW.md
rename to docs/workflow/RESEARCH_WORKFLOW.md
index 58e0e99..b8c3767 100644
--- a/docs/RESEARCH_WORKFLOW.md
+++ b/docs/workflow/RESEARCH_WORKFLOW.md
@@ -9,8 +9,8 @@ foundation produces evidence that meets the return criteria.
## 1. Orient Before Acting
-Open [OBSERVER_FOUNDATIONS.md](OBSERVER_FOUNDATIONS.md) and
-[RESEARCH.md](../RESEARCH.md) first.
+Open [OBSERVER_FOUNDATIONS.md](../foundations/OBSERVER_FOUNDATIONS.md) and
+[RESEARCH.md](../research/RESEARCH.md) first.
Read:
- `§1 Current state`
@@ -54,13 +54,13 @@ If code changes are needed:
- keep them scoped to one logical change
- run the proportional unit/contract tests
- verify they compile before running experiments
-- run `scripts/validate_diagnostics.py` when diagnostic meaning changes
+- run `tools/validate_diagnostics.py` when diagnostic meaning changes
Do not mix exploratory code edits, experiment execution, and interpretation in one sloppy batch.
## 4. Use the Warm Daemon
-For repeated experiments, use `scripts/observer_daemon.py` so the model loads once.
+For repeated experiments, use `tools/observer_daemon.py` so the model loads once.
One gotcha: the daemon redirects `stdout` so JSON acknowledgements are not polluted by runner printouts. If an orchestrator expects human-readable logs on `stdout`, it will get confused. Treat structured daemon responses as the real protocol and read diagnostic noise from `stderr` / saved artifacts instead.
@@ -152,7 +152,7 @@ Update:
- `§4 Backlog`
- `§5 Sessions log`
-The advisory written into each run's `summary.json` is also part of the handoff surface. When a run changes what the next agent should do, make sure the `RESEARCH.md` update and the run advisory tell the same story.
+The advisory written into each run's `summary.json` is also part of the handoff surface. When a run changes what the next agent should do, make sure the `docs/research/RESEARCH.md` update and the run advisory tell the same story.
When adding a finding:
- give it an `F##`
diff --git a/experiments/__init__.py b/experiments/__init__.py
new file mode 100644
index 0000000..c073b2b
--- /dev/null
+++ b/experiments/__init__.py
@@ -0,0 +1 @@
+"""Reusable experiment protocols and calibration runners."""
diff --git a/scripts/run_basin_calibration.py b/experiments/run_basin_calibration.py
similarity index 100%
rename from scripts/run_basin_calibration.py
rename to experiments/run_basin_calibration.py
diff --git a/scripts/run_foundation_calibration.py b/experiments/run_foundation_calibration.py
similarity index 100%
rename from scripts/run_foundation_calibration.py
rename to experiments/run_foundation_calibration.py
diff --git a/scripts/run_propagation_calibration.py b/experiments/run_propagation_calibration.py
similarity index 100%
rename from scripts/run_propagation_calibration.py
rename to experiments/run_propagation_calibration.py
diff --git a/tests/test_basin_analyzer.py b/tests/test_basin_analyzer.py
index 05c7c17..67ccfc0 100644
--- a/tests/test_basin_analyzer.py
+++ b/tests/test_basin_analyzer.py
@@ -13,7 +13,7 @@
M3R2_PREDICTOR_L2_REGULARIZATION,
)
from runtime_lab.core.io.hashing import hash_config
-from scripts.analyze_basins import (
+from analysis.analyze_basins import (
analyze_basin_root,
render_markdown,
)
diff --git a/tests/test_basin_calibration.py b/tests/test_basin_calibration.py
index ea91990..ca4664e 100644
--- a/tests/test_basin_calibration.py
+++ b/tests/test_basin_calibration.py
@@ -12,7 +12,7 @@
M3R2_PREDICTOR_FEATURES,
M3R2_PREDICTOR_L2_REGULARIZATION,
)
-from scripts.run_basin_calibration import (
+from experiments.run_basin_calibration import (
_build_design,
_find_completed_summary,
_run_cell,
diff --git a/tests/test_branchpoint_analyzer.py b/tests/test_branchpoint_analyzer.py
index 8bfe8be..4b13b92 100644
--- a/tests/test_branchpoint_analyzer.py
+++ b/tests/test_branchpoint_analyzer.py
@@ -2,7 +2,8 @@
import sys
import pytest
-from scripts import analyze_branchpoints, analyze_branchpoints_legacy
+from analysis import analyze_branchpoints
+from archive.analysis import analyze_branchpoints_legacy
from runtime_lab.core.io.hashing import hash_config
diff --git a/tests/test_claim_status.py b/tests/test_claim_status.py
index 2f0d0b1..82d1a74 100644
--- a/tests/test_claim_status.py
+++ b/tests/test_claim_status.py
@@ -9,7 +9,7 @@ def _read(relative_path):
def test_research_preserves_f31_and_records_scoped_q1_recalibration():
- text = _read("RESEARCH.md")
+ text = _read("docs/research/RESEARCH.md")
assert "F31 — REOPENED" in text
assert "F32 — RECALIBRATED" in text
@@ -23,7 +23,7 @@ def test_research_preserves_f31_and_records_scoped_q1_recalibration():
def test_foundation_contract_defines_causal_event_timeline():
- text = _read("docs/OBSERVER_FOUNDATIONS.md")
+ text = _read("docs/foundations/OBSERVER_FOUNDATIONS.md")
assert "Observe → Perturb → Compare → Prove" in text
assert "consumed token" in text
@@ -49,8 +49,8 @@ def test_readme_presents_foundation_before_controller():
def test_archived_claims_are_preserved_with_corrections():
- controller = _read("RESEARCH_CONTROLLER.md")
- reproducibility = _read("REPRODUCIBILITY.md")
+ controller = _read("archive/controller/RESEARCH_CONTROLLER.md")
+ reproducibility = _read("docs/research/REPRODUCIBILITY.md")
paper = _read("docs/observer_paper.html")
assert "FOUNDATION REBUILD CORRECTION" in controller
@@ -62,7 +62,7 @@ def test_archived_claims_are_preserved_with_corrections():
def test_repository_calibration_report_states_scope_and_controller_boundary():
- text = _read("docs/FOUNDATION_CALIBRATION_2026-07-19.md")
+ text = _read("docs/results/FOUNDATION_CALIBRATION_2026-07-19.md")
assert "42" in text
assert "0.831" in text
@@ -71,7 +71,7 @@ def test_repository_calibration_report_states_scope_and_controller_boundary():
def test_q2_report_records_validated_scope_and_normalization_result():
- text = _read("docs/Q2_PROPAGATION_CALIBRATION_2026-07-19.md")
+ text = _read("docs/results/Q2_PROPAGATION_CALIBRATION_2026-07-19.md")
assert "280 runs" in text
assert "4,200 paired decisions" in text
@@ -81,7 +81,7 @@ def test_q2_report_records_validated_scope_and_normalization_result():
def test_q3_report_records_negative_gate_without_erasing_scoped_signal():
- text = _read("docs/Q3_BASIN_MAPPING_2026-07-19.md")
+ text = _read("docs/results/Q3_BASIN_MAPPING_2026-07-19.md")
assert "60/60" in text
assert "2,820" in text
@@ -94,7 +94,7 @@ def test_q3_report_records_negative_gate_without_erasing_scoped_signal():
def test_m3r2_report_locks_the_negative_replication_and_controller_boundary():
- text = _read("docs/Q3_M3R2_REPLICATION_2026-07-19.md")
+ text = _read("docs/results/Q3_M3R2_REPLICATION_2026-07-19.md")
assert "90/90" in text
assert "5,670" in text
@@ -114,14 +114,14 @@ def test_m3r2_report_locks_the_negative_replication_and_controller_boundary():
def test_public_claim_surfaces_record_m3r2_without_moving_the_gate():
- research = _read("RESEARCH.md")
+ research = _read("docs/research/RESEARCH.md")
readme = _read("README.md")
paper = _read("docs/observer_paper.html")
assert "F36 — M3R-2 PROMPT-BREADTH REPLICATION" in research
assert "M3R-2 confirmed the negative Q3 gate" in research
assert "90-run M3R-2 replication" in readme
- assert "docs/Q3_M3R2_REPLICATION_2026-07-19.md" in readme
+ assert "docs/results/Q3_M3R2_REPLICATION_2026-07-19.md" in readme
assert "F36 — M3R-2 prompt-breadth replication" in paper
assert "procedural pattern did not replicate" in paper
assert "0.596" in readme
@@ -129,7 +129,7 @@ def test_public_claim_surfaces_record_m3r2_without_moving_the_gate():
def test_console_capabilities_describe_active_protocols():
- text = _read("scripts/observer_console.py")
+ text = _read("tools/console/server.py")
assert '"branchpoints": {' in text
assert '"propagation": {' in text
diff --git a/tests/test_daemon_contract.py b/tests/test_daemon_contract.py
index 497935b..9e4e926 100644
--- a/tests/test_daemon_contract.py
+++ b/tests/test_daemon_contract.py
@@ -3,7 +3,8 @@
import pytest
-from scripts import observer_console, observer_daemon
+from tools.console import server as observer_console
+from tools import observer_daemon
from runtime_lab.basins.evaluators import get_prompt_spec
from runtime_lab.core.backend.loader import load_model_with_backend
from tests.fakes import make_fake_backend
@@ -119,13 +120,13 @@ def test_daemon_and_console_expose_per_layer_propagation():
def test_console_static_ui_exposes_propagation_mode():
html = (
- ROOT / "scripts" / "observer_console" / "index.html"
+ ROOT / "tools" / "console" / "static" / "index.html"
).read_text()
javascript = (
- ROOT / "scripts" / "observer_console" / "app.js"
+ ROOT / "tools" / "console" / "static" / "app.js"
).read_text()
stylesheet = (
- ROOT / "scripts" / "observer_console" / "styles.css"
+ ROOT / "tools" / "console" / "static" / "styles.css"
).read_text()
assert 'data-mode="propagation"' in html
@@ -219,13 +220,13 @@ def test_daemon_dispatches_basins_with_the_warm_backend(tmp_path):
def test_console_static_ui_exposes_basins_mode():
html = (
- ROOT / "scripts" / "observer_console" / "index.html"
+ ROOT / "tools" / "console" / "static" / "index.html"
).read_text()
javascript = (
- ROOT / "scripts" / "observer_console" / "app.js"
+ ROOT / "tools" / "console" / "static" / "app.js"
).read_text()
stylesheet = (
- ROOT / "scripts" / "observer_console" / "styles.css"
+ ROOT / "tools" / "console" / "static" / "styles.css"
).read_text()
assert 'data-mode="basins"' in html
diff --git a/tests/test_diagnostic_validation.py b/tests/test_diagnostic_validation.py
index 2c4e941..0a5cc37 100644
--- a/tests/test_diagnostic_validation.py
+++ b/tests/test_diagnostic_validation.py
@@ -6,7 +6,7 @@
run_baseline_probe,
)
from runtime_lab.core.diagnostics.manager import DiagnosticsManager
-from scripts.validate_diagnostics import validate_synthetic_diagnostics
+from tools.validate_diagnostics import validate_synthetic_diagnostics
def test_baseline_probe_distinguishes_constant_and_shock_sequences():
diff --git a/tests/test_foundation_calibration.py b/tests/test_foundation_calibration.py
index e27c39e..ec2e1f8 100644
--- a/tests/test_foundation_calibration.py
+++ b/tests/test_foundation_calibration.py
@@ -2,7 +2,7 @@
import pytest
-from scripts.run_foundation_calibration import (
+from experiments.run_foundation_calibration import (
DEFAULT_PROMPTS,
build_calibration_cells,
magnitude_slug,
diff --git a/tests/test_hysteresis_protocol.py b/tests/test_hysteresis_protocol.py
index 42616e9..2769604 100644
--- a/tests/test_hysteresis_protocol.py
+++ b/tests/test_hysteresis_protocol.py
@@ -9,7 +9,8 @@
from runtime_lab.core.io.hashing import hash_config
from runtime_lab.hysteresis.runner import _hidden_distances, run_hysteresis_experiment
from runtime_lab.cli.hysteresis import add_hysteresis_args
-from scripts import observer_console, observer_daemon
+from tools.console import server as observer_console
+from tools import observer_daemon
from tests.fakes import make_fake_backend
diff --git a/tests/test_layer_resolution_contract.py b/tests/test_layer_resolution_contract.py
index b90f18b..fc61929 100644
--- a/tests/test_layer_resolution_contract.py
+++ b/tests/test_layer_resolution_contract.py
@@ -9,7 +9,7 @@
resolve_probe_layers,
resolve_semantic_layer,
)
-from scripts import observer_daemon
+from tools import observer_daemon
ROOT = Path(__file__).resolve().parents[1]
diff --git a/tests/test_propagation_analyzer.py b/tests/test_propagation_analyzer.py
index 388320d..41508e5 100644
--- a/tests/test_propagation_analyzer.py
+++ b/tests/test_propagation_analyzer.py
@@ -3,7 +3,7 @@
import pytest
-from scripts.analyze_propagation import (
+from analysis.analyze_propagation import (
aggregate_runs,
load_propagation_runs,
render_markdown,
diff --git a/tests/test_propagation_calibration.py b/tests/test_propagation_calibration.py
index e05b434..7489b06 100644
--- a/tests/test_propagation_calibration.py
+++ b/tests/test_propagation_calibration.py
@@ -2,8 +2,8 @@
import pytest
-from scripts.run_foundation_calibration import DEFAULT_PROMPTS
-from scripts.run_propagation_calibration import (
+from experiments.run_foundation_calibration import DEFAULT_PROMPTS
+from experiments.run_propagation_calibration import (
build_propagation_cells,
control_magnitude,
is_control_cell,
diff --git a/tests/test_repo_hygiene.py b/tests/test_repo_hygiene.py
index 74ebc35..72e1031 100644
--- a/tests/test_repo_hygiene.py
+++ b/tests/test_repo_hygiene.py
@@ -7,7 +7,7 @@
class RepoHygieneTests(unittest.TestCase):
def test_branchpoint_analyzer_defaults_to_repeated_run_grouped_evaluation(self):
- from scripts import analyze_branchpoints
+ from analysis import analyze_branchpoints
parser = analyze_branchpoints.build_arg_parser()
args = parser.parse_args([])
@@ -18,7 +18,7 @@ def test_branchpoint_analyzer_defaults_to_repeated_run_grouped_evaluation(self):
def test_ci_checks_active_runtime_package(self):
ci = (ROOT / ".github" / "workflows" / "ci.yml").read_text()
- self.assertIn("python -m compileall -q src scripts", ci)
+ self.assertIn("python -m compileall -q src analysis experiments tools", ci)
def test_readme_quickstart_uses_unified_runtime_lab_cli(self):
readme = (ROOT / "README.md").read_text()
@@ -28,5 +28,19 @@ def test_readme_quickstart_uses_unified_runtime_lab_cli(self):
self.assertIn("python -m runtime_lab.cli.main control", readme)
+ def test_repository_layout_separates_active_and_archived_surfaces(self):
+ self.assertTrue((ROOT / "analysis").is_dir())
+ self.assertTrue((ROOT / "experiments").is_dir())
+ self.assertTrue((ROOT / "tools").is_dir())
+ self.assertTrue((ROOT / "archive").is_dir())
+ self.assertTrue((ROOT / "docs" / "foundations").is_dir())
+ self.assertTrue((ROOT / "docs" / "research").is_dir())
+ self.assertTrue((ROOT / "docs" / "results").is_dir())
+ self.assertFalse((ROOT / "scripts").exists())
+ self.assertFalse((ROOT / "adaptive_controller_system4").exists())
+ self.assertFalse((ROOT / "baseline_hysteresis_v1").exists())
+ self.assertFalse((ROOT / "intervention_engine_v1.5_v2").exists())
+ self.assertFalse((ROOT / "v1.5").exists())
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/__init__.py b/tools/__init__.py
new file mode 100644
index 0000000..fe43e0d
--- /dev/null
+++ b/tools/__init__.py
@@ -0,0 +1 @@
+"""Operational tools for running and validating Observer."""
diff --git a/tools/console/__init__.py b/tools/console/__init__.py
new file mode 100644
index 0000000..5c430b0
--- /dev/null
+++ b/tools/console/__init__.py
@@ -0,0 +1 @@
+"""Observer web console package."""
diff --git a/scripts/observer_console.py b/tools/console/server.py
similarity index 99%
rename from scripts/observer_console.py
rename to tools/console/server.py
index 7de427d..211cd44 100644
--- a/scripts/observer_console.py
+++ b/tools/console/server.py
@@ -3,7 +3,7 @@
Single-file server built on the stdlib. Streams token-level telemetry
over Server-Sent Events as runs execute.
- python scripts/observer_console.py [--port 8899]
+ python tools/console/server.py [--port 8899]
"""
from __future__ import annotations
@@ -24,8 +24,8 @@
from urllib.parse import parse_qs, urlparse
-REPO_ROOT = Path(__file__).resolve().parents[1]
-STATIC_DIR = Path(__file__).resolve().parent / "observer_console"
+REPO_ROOT = Path(__file__).resolve().parents[2]
+STATIC_DIR = Path(__file__).resolve().parent / "static"
RUNS_DIR = REPO_ROOT / "runs"
REGISTRY_PATH = REPO_ROOT / "models.json"
diff --git a/scripts/observer_console/app.js b/tools/console/static/app.js
similarity index 100%
rename from scripts/observer_console/app.js
rename to tools/console/static/app.js
diff --git a/scripts/observer_console/index.html b/tools/console/static/index.html
similarity index 100%
rename from scripts/observer_console/index.html
rename to tools/console/static/index.html
diff --git a/scripts/observer_console/styles.css b/tools/console/static/styles.css
similarity index 100%
rename from scripts/observer_console/styles.css
rename to tools/console/static/styles.css
diff --git a/scripts/observer_daemon.py b/tools/observer_daemon.py
similarity index 99%
rename from scripts/observer_daemon.py
rename to tools/observer_daemon.py
index 5fe90fc..48440e5 100644
--- a/scripts/observer_daemon.py
+++ b/tools/observer_daemon.py
@@ -13,7 +13,7 @@
callers can read one response per request.
Usage:
- python scripts/observer_daemon.py --model qwen3-1.7b
+ python tools/observer_daemon.py --model qwen3-1.7b
This is launched from the dashboard's JobManager when warm-daemon mode is
enabled; stdin is fed JSON line-by-line, stdout is parsed back to pick up
diff --git a/scripts/validate_diagnostics.py b/tools/validate_diagnostics.py
similarity index 100%
rename from scripts/validate_diagnostics.py
rename to tools/validate_diagnostics.py