File size: 2,363 Bytes
77da5ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# scripts.md — Other Scripts Reference

Reference for scripts not covered by dedicated doc files.

---

## `scripts/run_episode.py`

Runs a single full episode with the LLM agent (requires API key).

```bash
python scripts/run_episode.py
python scripts/run_episode.py --difficulty 3 --verbose
```

Returns a result dict with `total_reward`, `steps`, `domain`.

---

## `scripts/train.py`

Legacy training loop (pre-TRL). Uses a simple policy gradient loop without curriculum.
Prefer `train_trl.py` for new training runs.

---

## `scripts/smoke_test.py`

Quick sanity check — imports all core modules, resets the env once, takes one step.
No agent required. Exits with code 0 on success.

```bash
python scripts/smoke_test.py
```

---

## `scripts/test_lifestack.py`

Full edge-case test suite (11 tests). Does not use pytest runner by default —
run directly or via `pytest scripts/test_lifestack.py`.

```bash
python scripts/test_lifestack.py
pytest scripts/test_lifestack.py -v
```

Tests requiring `OPENAI_API_KEY` are automatically skipped when the key is absent.

### Tests

| # | Name | What it checks |
|---|---|---|
| 1 | Cascade floor | Metrics never go below 0 |
| 2 | Cascade ceiling | Metrics never exceed 100 |
| 3 | Resource exhaustion | `deduct()` returns False without going negative |
| 4 | Inaction penalty | `INACTION_PENALTY` fires when `actions_taken=0` |
| 5 | Critical floor penalty | `CRITICAL_FLOOR_VIOLATION` fires below threshold |
| 6 | Cascade dampening | Second-order deltas < first-order delta |
| 7 | SimPerson uptake bounds | All uptake values in [0.1, 1.0] |
| 8 | Memory threshold | Only reward >= 2.0 stored |
| 9 | Episode termination | `done=True` after horizon steps |
| 10 | Task-driven smoke | Inspect + Route execute without crash |
| 11 | Full episode smoke | `run_episode()` returns float reward *(skipped without API key)* |

---

## `scripts/longitudinal_demo.py`

Seeds Arjun's multi-week journey into ChromaDB and renders a comparison view.
Used by Tab 4 (Arjun's Journey) in `app.py`.

---

## `scripts/validate_simperson.py`

Validates all `SimPerson` personality trait combinations produce valid uptake values.

---

## Change Log

| Date | Change |
|---|---|
| 2026-04-23 | `test_lifestack.py` — `steps<=5` assertion fixed to `steps<=30`; `import pytest` added; `@pytest.mark.skipif` added to test 11 |