dreamrsi 0.1.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. dreamrsi-0.1.0a2/.gitattributes +6 -0
  2. dreamrsi-0.1.0a2/.github/ISSUE_TEMPLATE/bug_report.yml +25 -0
  3. dreamrsi-0.1.0a2/.github/ISSUE_TEMPLATE/early_adopter.yml +33 -0
  4. dreamrsi-0.1.0a2/.github/pull_request_template.md +11 -0
  5. dreamrsi-0.1.0a2/.github/workflows/ci.yml +51 -0
  6. dreamrsi-0.1.0a2/.github/workflows/publish.yml +64 -0
  7. dreamrsi-0.1.0a2/.gitignore +9 -0
  8. dreamrsi-0.1.0a2/ARCHITECTURE.md +40 -0
  9. dreamrsi-0.1.0a2/CHANGELOG.md +63 -0
  10. dreamrsi-0.1.0a2/CONTRIBUTING.md +41 -0
  11. dreamrsi-0.1.0a2/LICENSE +202 -0
  12. dreamrsi-0.1.0a2/NOTICE +17 -0
  13. dreamrsi-0.1.0a2/PKG-INFO +87 -0
  14. dreamrsi-0.1.0a2/README.md +401 -0
  15. dreamrsi-0.1.0a2/assets/architecture.svg +27 -0
  16. dreamrsi-0.1.0a2/assets/banner.svg +34 -0
  17. dreamrsi-0.1.0a2/assets/bonsai-development-v4.json +92 -0
  18. dreamrsi-0.1.0a2/assets/bonsai-development-v4.png +0 -0
  19. dreamrsi-0.1.0a2/assets/bonsai-development-v4.svg +872 -0
  20. dreamrsi-0.1.0a2/assets/bonsai-result.png +0 -0
  21. dreamrsi-0.1.0a2/assets/bonsai-result.svg +1819 -0
  22. dreamrsi-0.1.0a2/assets/logo.svg +14 -0
  23. dreamrsi-0.1.0a2/docs/PYPI_README.md +55 -0
  24. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/bonsai-matrix-seed-19.json.gz +0 -0
  25. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/bonsai-matrix-seed-43.json.gz +0 -0
  26. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/bonsai-matrix-seed-7.json.gz +0 -0
  27. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/bonsai-source-incumbent-seed-7.json.gz +0 -0
  28. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/manifest.json +170 -0
  29. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22/selected-policy.json +122 -0
  30. dreamrsi-0.1.0a2/docs/experiments/bonsai-2026-09-22.md +113 -0
  31. dreamrsi-0.1.0a2/docs/experiments/plot_bonsai.py +43 -0
  32. dreamrsi-0.1.0a2/docs/experiments/plot_policy_development.py +141 -0
  33. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22/bonsai-source-incumbent-seed-19-followup.json.gz +0 -0
  34. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22/bonsai-v4-boundary-reasoning4096-seed-43.json.gz +0 -0
  35. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22/bonsai-v4-round-feedback-seed-43.json.gz +0 -0
  36. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22/manifest.json +650 -0
  37. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22/selected-policy.json +129 -0
  38. dreamrsi-0.1.0a2/docs/experiments/sandbox-v4-2026-09-22.md +72 -0
  39. dreamrsi-0.1.0a2/docs/hardening.md +36 -0
  40. dreamrsi-0.1.0a2/docs/implementation-comparison.md +53 -0
  41. dreamrsi-0.1.0a2/docs/integration.md +153 -0
  42. dreamrsi-0.1.0a2/docs/launch-copy.md +29 -0
  43. dreamrsi-0.1.0a2/docs/launch-plan.md +58 -0
  44. dreamrsi-0.1.0a2/docs/releasing.md +19 -0
  45. dreamrsi-0.1.0a2/docs/research-loop.md +163 -0
  46. dreamrsi-0.1.0a2/docs/sandbox.md +123 -0
  47. dreamrsi-0.1.0a2/docs/strict-remediation-plan.md +319 -0
  48. dreamrsi-0.1.0a2/examples/01_toy_optimization.py +159 -0
  49. dreamrsi-0.1.0a2/examples/02_replay_lab.py +49 -0
  50. dreamrsi-0.1.0a2/examples/03_policy_development.py +41 -0
  51. dreamrsi-0.1.0a2/examples/04_runnable.py +22 -0
  52. dreamrsi-0.1.0a2/examples/05_local_llamacpp.py +191 -0
  53. dreamrsi-0.1.0a2/examples/06_sandbox_profiles.py +33 -0
  54. dreamrsi-0.1.0a2/examples/balanced_source.py +28 -0
  55. dreamrsi-0.1.0a2/pyproject.toml +62 -0
  56. dreamrsi-0.1.0a2/src/dreamrsi/__init__.py +100 -0
  57. dreamrsi-0.1.0a2/src/dreamrsi/_http.py +86 -0
  58. dreamrsi-0.1.0a2/src/dreamrsi/_invoke.py +34 -0
  59. dreamrsi-0.1.0a2/src/dreamrsi/_policy.py +32 -0
  60. dreamrsi-0.1.0a2/src/dreamrsi/_sandbox_worker.py +29 -0
  61. dreamrsi-0.1.0a2/src/dreamrsi/accounting.py +149 -0
  62. dreamrsi-0.1.0a2/src/dreamrsi/adapters.py +44 -0
  63. dreamrsi-0.1.0a2/src/dreamrsi/artifacts.py +130 -0
  64. dreamrsi-0.1.0a2/src/dreamrsi/checkpoints.py +104 -0
  65. dreamrsi-0.1.0a2/src/dreamrsi/developer.py +491 -0
  66. dreamrsi-0.1.0a2/src/dreamrsi/discovery/__init__.py +336 -0
  67. dreamrsi-0.1.0a2/src/dreamrsi/errors.py +72 -0
  68. dreamrsi-0.1.0a2/src/dreamrsi/evaluation/__init__.py +82 -0
  69. dreamrsi-0.1.0a2/src/dreamrsi/events/__init__.py +122 -0
  70. dreamrsi-0.1.0a2/src/dreamrsi/integrations.py +47 -0
  71. dreamrsi-0.1.0a2/src/dreamrsi/llamacpp.py +89 -0
  72. dreamrsi-0.1.0a2/src/dreamrsi/methods.py +310 -0
  73. dreamrsi-0.1.0a2/src/dreamrsi/models/__init__.py +64 -0
  74. dreamrsi-0.1.0a2/src/dreamrsi/models/base.py +144 -0
  75. dreamrsi-0.1.0a2/src/dreamrsi/models/budget.py +70 -0
  76. dreamrsi-0.1.0a2/src/dreamrsi/models/discovery.py +98 -0
  77. dreamrsi-0.1.0a2/src/dreamrsi/models/evaluation.py +38 -0
  78. dreamrsi-0.1.0a2/src/dreamrsi/models/events.py +48 -0
  79. dreamrsi-0.1.0a2/src/dreamrsi/models/objectives.py +19 -0
  80. dreamrsi-0.1.0a2/src/dreamrsi/models/policy.py +126 -0
  81. dreamrsi-0.1.0a2/src/dreamrsi/models/promotion.py +36 -0
  82. dreamrsi-0.1.0a2/src/dreamrsi/models/replay.py +100 -0
  83. dreamrsi-0.1.0a2/src/dreamrsi/models/results.py +40 -0
  84. dreamrsi-0.1.0a2/src/dreamrsi/ollama.py +71 -0
  85. dreamrsi-0.1.0a2/src/dreamrsi/optimization/__init__.py +152 -0
  86. dreamrsi-0.1.0a2/src/dreamrsi/policies/__init__.py +19 -0
  87. dreamrsi-0.1.0a2/src/dreamrsi/policies/balanced.py +32 -0
  88. dreamrsi-0.1.0a2/src/dreamrsi/policies/breadth_first.py +20 -0
  89. dreamrsi-0.1.0a2/src/dreamrsi/policies/depth_first.py +20 -0
  90. dreamrsi-0.1.0a2/src/dreamrsi/policies/epsilon_greedy.py +43 -0
  91. dreamrsi-0.1.0a2/src/dreamrsi/policies/fixed_parallel.py +42 -0
  92. dreamrsi-0.1.0a2/src/dreamrsi/policies/greedy.py +29 -0
  93. dreamrsi-0.1.0a2/src/dreamrsi/policies/random_policy.py +23 -0
  94. dreamrsi-0.1.0a2/src/dreamrsi/process_sandbox.py +78 -0
  95. dreamrsi-0.1.0a2/src/dreamrsi/promotion/__init__.py +67 -0
  96. dreamrsi-0.1.0a2/src/dreamrsi/protocols/__init__.py +26 -0
  97. dreamrsi-0.1.0a2/src/dreamrsi/protocols/agent.py +39 -0
  98. dreamrsi-0.1.0a2/src/dreamrsi/protocols/evaluator.py +15 -0
  99. dreamrsi-0.1.0a2/src/dreamrsi/protocols/method.py +15 -0
  100. dreamrsi-0.1.0a2/src/dreamrsi/protocols/objective.py +16 -0
  101. dreamrsi-0.1.0a2/src/dreamrsi/protocols/optimizer.py +22 -0
  102. dreamrsi-0.1.0a2/src/dreamrsi/protocols/policy.py +19 -0
  103. dreamrsi-0.1.0a2/src/dreamrsi/protocols/promotion.py +19 -0
  104. dreamrsi-0.1.0a2/src/dreamrsi/protocols/replay.py +15 -0
  105. dreamrsi-0.1.0a2/src/dreamrsi/protocols/sandbox.py +18 -0
  106. dreamrsi-0.1.0a2/src/dreamrsi/protocols/store.py +31 -0
  107. dreamrsi-0.1.0a2/src/dreamrsi/py.typed +0 -0
  108. dreamrsi-0.1.0a2/src/dreamrsi/replay/__init__.py +339 -0
  109. dreamrsi-0.1.0a2/src/dreamrsi/runtime.py +894 -0
  110. dreamrsi-0.1.0a2/src/dreamrsi/sandbox.py +782 -0
  111. dreamrsi-0.1.0a2/src/dreamrsi/storage/__init__.py +80 -0
  112. dreamrsi-0.1.0a2/src/dreamrsi/storage/sqlite.py +108 -0
  113. dreamrsi-0.1.0a2/src/dreamrsi/validation.py +148 -0
  114. dreamrsi-0.1.0a2/src/dreamrsi/views.py +33 -0
  115. dreamrsi-0.1.0a2/src/dreamrsi/workspaces.py +69 -0
  116. dreamrsi-0.1.0a2/tests/test_campaigns.py +202 -0
  117. dreamrsi-0.1.0a2/tests/test_developer_execution.py +267 -0
  118. dreamrsi-0.1.0a2/tests/test_extensions.py +96 -0
  119. dreamrsi-0.1.0a2/tests/test_integrations.py +91 -0
  120. dreamrsi-0.1.0a2/tests/test_local_models.py +103 -0
  121. dreamrsi-0.1.0a2/tests/test_policy_developer.py +212 -0
  122. dreamrsi-0.1.0a2/tests/test_policy_round_feedback.py +65 -0
  123. dreamrsi-0.1.0a2/tests/test_recovery_boundaries.py +134 -0
  124. dreamrsi-0.1.0a2/tests/test_replay.py +107 -0
  125. dreamrsi-0.1.0a2/tests/test_runtime.py +288 -0
  126. dreamrsi-0.1.0a2/tests/test_sandbox_idioms.py +36 -0
  127. dreamrsi-0.1.0a2/tests/test_sandbox_profiles.py +132 -0
  128. dreamrsi-0.1.0a2/tests/test_source_incumbent.py +33 -0
@@ -0,0 +1,6 @@
1
+ * text=auto
2
+ *.py text eol=lf
3
+ *.md text eol=lf
4
+ *.toml text eol=lf
5
+ *.yml text eol=lf
6
+ *.svg text eol=lf
@@ -0,0 +1,25 @@
1
+ name: Bug report
2
+ description: A reproducible SDK failure
3
+ title: "[Bug]: "
4
+ body:
5
+ - type: input
6
+ id: environment
7
+ attributes:
8
+ label: Environment
9
+ description: Operating system, Python version, and SDK version or commit SHA
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: Minimal reproduction
16
+ description: Self-contained code without tokens, passwords, or private data
17
+ render: python
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ id: behavior
22
+ attributes:
23
+ label: Expected and actual behavior
24
+ validations:
25
+ required: true
@@ -0,0 +1,33 @@
1
+ name: Early adopter feedback
2
+ description: Share your first integration attempt and what blocked you.
3
+ title: "[Feedback]: "
4
+ body:
5
+ - type: textarea
6
+ id: task
7
+ attributes:
8
+ label: What are you building?
9
+ description: Describe your task, agent framework and how you score candidates. Do not include secrets or private data.
10
+ validations:
11
+ required: true
12
+ - type: dropdown
13
+ id: stage
14
+ attributes:
15
+ label: How far did you get?
16
+ options:
17
+ - Ran the replay demo
18
+ - Connected my own agent
19
+ - Ran a repeat experiment
20
+ - Could not install or run
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: feedback
25
+ attributes:
26
+ label: What worked, and what blocked you?
27
+ description: Include Python version, OS and SDK commit when relevant.
28
+ validations:
29
+ required: true
30
+ - type: input
31
+ id: discovery
32
+ attributes:
33
+ label: Where did you hear about the project? (optional)
@@ -0,0 +1,11 @@
1
+ ## User-facing change
2
+
3
+ <!-- Problem, new behavior, and limitations. -->
4
+
5
+ ## Validation
6
+
7
+ <!-- Commands and results; include a regression test for behavior fixes. -->
8
+
9
+ ## Related work
10
+
11
+ <!-- Optional: issue or roadmap item. -->
@@ -0,0 +1,51 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ tests:
13
+ name: Python ${{ matrix.python }} / ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [ubuntu-latest]
19
+ python: ["3.11", "3.12", "3.13", "3.14"]
20
+ include:
21
+ - os: windows-latest
22
+ python: "3.14"
23
+ steps:
24
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
25
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
26
+ with:
27
+ python-version: ${{ matrix.python }}
28
+ - run: python -m pip install -e ".[dev]"
29
+ - run: python -m pytest -q
30
+
31
+ quality:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
35
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
36
+ with:
37
+ python-version: "3.14"
38
+ - run: python -m pip install -e ".[dev]" build
39
+ - run: python -m ruff check src tests examples
40
+ - run: python -m pyright
41
+ - run: python -m build
42
+
43
+ optional-integration:
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
47
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
48
+ with:
49
+ python-version: "3.14"
50
+ - run: python -m pip install -e ".[dev,langchain]"
51
+ - run: python -m pytest tests/test_integrations.py -q
@@ -0,0 +1,64 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: Exact package version to publish
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: pypi-publication
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ build:
20
+ if: github.ref == 'refs/heads/main'
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
24
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
25
+ with:
26
+ python-version: "3.14"
27
+ - run: python -m pip install -e ".[dev,langchain]" build twine
28
+ - name: Verify requested version
29
+ env:
30
+ EXPECTED_VERSION: ${{ inputs.version }}
31
+ run: |
32
+ python - <<'PY'
33
+ import os, tomllib, dreamrsi
34
+ with open('pyproject.toml', 'rb') as stream:
35
+ project = tomllib.load(stream)['project']
36
+ assert project['version'] == dreamrsi.__version__ == os.environ['EXPECTED_VERSION']
37
+ assert project['authors'] == [{'name': 'TheAstrayDev'}]
38
+ PY
39
+ - run: python -m pytest -q
40
+ - run: python -m ruff check src tests examples docs/experiments
41
+ - run: python -m pyright
42
+ - run: python -m build
43
+ - run: python -m twine check --strict dist/*
44
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
45
+ with:
46
+ name: python-distributions
47
+ path: dist/
48
+ if-no-files-found: error
49
+
50
+ publish:
51
+ needs: build
52
+ runs-on: ubuntu-latest
53
+ environment:
54
+ name: pypi
55
+ url: https://pypi.org/project/dreamrsi/
56
+ permissions:
57
+ id-token: write
58
+ steps:
59
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
60
+ with:
61
+ name: python-distributions
62
+ path: dist/
63
+ - name: Publish distributions with Trusted Publishing
64
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ *.egg-info/
8
+ temp/
9
+ logs/
@@ -0,0 +1,40 @@
1
+ # Architecture
2
+
3
+ The fixed discovery agent and evaluator produce immutable discovery trees. Policies choose root/leaf expansions from revealed information. Strict replay reads recorded transitions; it never predicts unrecorded outcomes. A developer can rewrite executable exploration source, test it on training replay and submit the strongest candidate to a promotion gate. See [the research](https://arxiv.org/html/2609.14858v1) and the [implementation contracts](docs/research-loop.md).
4
+
5
+ ## Modules
6
+
7
+ | Module | Responsibility |
8
+ | --- | --- |
9
+ | `runtime.py` | Online attempts, event persistence, extension routing, metered dispatch |
10
+ | `methods.py` | Replaceable outer loop and checkpoint boundaries |
11
+ | `developer.py` | Model request → source → replay feedback → revision |
12
+ | `sandbox.py` | Bounded SDK-language interpreter; no Docker or generated bytecode execution |
13
+ | `process_sandbox.py` | Optional fresh worker, hard termination and event-loop isolation for interpreter decisions |
14
+ | `artifacts.py` | Source hashes/provenance and explicit policy serialization |
15
+ | `replay/`, `views.py` | Recorded-transition execution and shared prefix-visible context |
16
+ | `validation.py` | Independent collection and single-use validation batches |
17
+ | `accounting.py` | Shared reservations, usage reports, uncertainty and overruns |
18
+ | `checkpoints.py`, `storage/` | Versioned JSON state and transactional SQLite persistence |
19
+ | `integrations.py`, `workspaces.py` | Runnable integration and external snapshot lifecycle |
20
+
21
+ ## Invariants
22
+
23
+ - The developer changes policy source, not agent weights or task scoring.
24
+ - Only revealed nodes, observations and child counts reach policy views.
25
+ - Candidate policies and incumbent use the same training worlds and objective.
26
+ - Holdout feedback never enters developer requests; consumed batches are not reused.
27
+ - Source loading checks integrity and never executes code. Interpretation starts only at a policy decision.
28
+ - Resource reservations precede external dispatch. Unknown costs stay estimated and reserved.
29
+ - A committed online tree survives a dreaming interruption. Uncertain external calls are not silently repeated after restart.
30
+ - Live model clients, browser handles and DB sessions remain in adapters/backends, not discovery state.
31
+
32
+ ## Limits and recovery semantics
33
+
34
+ The interpreter supports a documented Python-syntax subset, not arbitrary Python. Logical allocation/operation limits are not OS memory quotas. The SDK cannot enforce provider pricing or terminate a remote job without adapter support. JSON-compatible descriptors and durable backend snapshots are required for persistence. User-defined component changes must update `experiment_version`. A finite holdout experiment supplies evidence, not proof of generalization.
35
+
36
+ The complete gap-by-gap status is in [hardening.md](docs/hardening.md). The
37
+ [Bonsai experiment](docs/experiments/bonsai-2026-09-22.md) records real source repair,
38
+ replay, held-out promotion, serialization and fresh online execution, including failures.
39
+ StrictReplay coefficients participate in recovery fingerprints. Ambiguous validation
40
+ collection is journaled and requires explicit reconciliation before abandonment.
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0a2 — 2026-09-22
4
+
5
+ - Completed a real Bonsai follow-up with all demonstration gates passing: 5/6 scored
6
+ revisions, changed replay behavior, stopping repair, held-out promotion and reloaded online gain.
7
+ - Added configurable function allowlists, JSON sandbox profiles and an optional killable
8
+ process backend without Docker; causal last-round observations enable stopping feedback.
9
+ - Set package author to TheAstrayDev and prepared wheel/source distributions for PyPI.
10
+
11
+ - Added JSON sandbox profiles and per-builtin, math and collection-method allowlists.
12
+ - Added an optional process interpreter backend with timeout/cancellation cleanup.
13
+ - Added causal last-round feedback to both online and replay policy views.
14
+ - Added explicit empty-round diagnostics to guide model-written stopping/recovery revisions.
15
+
16
+ - Added replay-driven source development and a dependency-free SDK policy interpreter.
17
+ - Added prefix observations/diagnostics, independent single-use validation and SQLite checkpoints.
18
+ - Added shared usage reservations, token/USD reports and conservative interrupted-call accounting.
19
+ - Added explicit policy codecs, source hashes, Runnable integration and workspace lifecycle hooks.
20
+ - Added regression coverage for interpreter abuse, restart boundaries and integration behavior.
21
+ - Recorded the September 22 local Bonsai-27B-Q1_0 experiment, raw reports and chart:
22
+ 1/3 declared seeds promoted and redeployed; the selected policy reduced residual error
23
+ by 87.5% on a fresh toy task at equal agent calls. That earlier matrix did not meet diversity acceptance.
24
+ - Added durable developer revision status, response recovery, source/AST/decision hashes,
25
+ source-line error feedback and an executable source-incumbent example.
26
+ - Journaled ambiguous validation collection and failed validation evidence; fingerprinted
27
+ replay coefficients on resume and preserved full per-run usage in exports.
28
+ - Added bounded generator expressions and list sorting with interpreted helper keys.
29
+
30
+
31
+ - Added injectable replay engines, trajectory objectives and outer methods.
32
+ - Extracted the default improvement loop into `DefaultMethod`.
33
+ - Added regression coverage for extension routing, ranking, promotion and invalid scores.
34
+ - Recorded architecture gaps and acceptance criteria in `docs/hardening.md`.
35
+
36
+ - English documentation, issue templates, and contributor guidance.
37
+ - A no-key replay lab that compares policies and reports additional live calls.
38
+ - Early-adopter feedback template and a practical first-user launch plan.
39
+
40
+ ## 0.1.0a1 — 2026-09-20
41
+
42
+ First public alpha snapshot of the independent SDK.
43
+
44
+ ### Working foundation
45
+
46
+ - Sync/async callable and stateful agent integrations.
47
+ - Discovery trees, committed snapshots, and JSON export.
48
+ - Strict replay with shared action validation.
49
+ - Seven built-in policies, parameter search, and promotion gates.
50
+ - Call, node, depth, time, and concurrency limits.
51
+ - In-memory storage, events, and 33 regression tests.
52
+
53
+ ### Project presentation
54
+
55
+ - Original vector logo, banner, and architecture diagram.
56
+ - README covering installation, examples, research comparison, and roadmap.
57
+ - Explicit non-affiliation with Google and implementation limitations.
58
+ - Apache-2.0 license, contributor guidance, and CI.
59
+
60
+ ### Not implemented in the initial snapshot
61
+
62
+ LLM policy-code development, executable sandbox, automatic independent validation,
63
+ durable campaign recovery, and provider-level dollar accounting.
@@ -0,0 +1,41 @@
1
+ # Contributing to Dream-RSI SDK
2
+
3
+ This independent project prioritizes simple integrations, correct replay, and measured
4
+ results. It is not an official Google repository.
5
+
6
+ ## Report a problem or propose a change
7
+
8
+ Include your Python and SDK versions, a minimal reproduction without private data,
9
+ expected behavior, and actual behavior. For API proposals, describe the integration
10
+ problem and show how the calling code would become simpler.
11
+
12
+ Open an issue before substantial work so it can be aligned with the
13
+ [roadmap](README.md#roadmap). A small fix for a reproducible bug can go directly to a PR.
14
+ If you are trying the SDK for the first time, use the early-adopter feedback issue template.
15
+
16
+ ## Local checks
17
+
18
+ ```bash
19
+ python -m venv .venv
20
+ # Activate the virtual environment for your operating system.
21
+ python -m pip install -e ".[dev]"
22
+ python -m pytest -q
23
+ python -m ruff check src tests
24
+ python -m pyright
25
+ ```
26
+
27
+ Tests must run without secrets, paid APIs, or a connected model. Add a regression test
28
+ for behavior changes. New adapters should include an example and explain state isolation,
29
+ concurrency, cancellation, and operation costs.
30
+
31
+ ## Invariants
32
+
33
+ - Never expose unrevealed outcomes to a replay policy.
34
+ - Keep training and validation evidence separate.
35
+ - Never turn exceptions or missing data into successful scores.
36
+ - Do not present SDK call counts as provider dollar costs.
37
+ - Keep framework-specific dependencies out of the required core.
38
+ - Do not claim research results without a reproducible experiment.
39
+
40
+ Explain what changes for users, why, and how you checked it. Contributions are distributed
41
+ under the project's [Apache-2.0 license](LICENSE).
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,17 @@
1
+ Dream-RSI SDK
2
+ Copyright 2026 TheAstrayDev and contributors
3
+
4
+ This is an independent, unofficial implementation inspired by publicly available
5
+ research about Dream-RSI. The maintainer is not an employee of Google or Google
6
+ DeepMind. This project is not a commercial development of Google and is not
7
+ affiliated with, sponsored by, or endorsed by Google, Google DeepMind, or the
8
+ authors of the research paper.
9
+
10
+ Research attribution:
11
+ Tong Zheng et al., "Dream-RSI: Recursive Self-Improvement through Evolving Worlds"
12
+ arXiv:2609.14858, 2026. https://arxiv.org/abs/2609.14858
13
+ Official research repository: https://github.com/zhengkid/Dream-RSI
14
+
15
+ The SDK's logo and architecture illustration are original project assets, not
16
+ official Google branding or official research figures. References to the research
17
+ do not imply that this SDK reproduces its full implementation or reported results.
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.5
2
+ Name: dreamrsi
3
+ Version: 0.1.0a2
4
+ Summary: Independent, unofficial Dream-RSI-inspired Python SDK for exploration-policy replay and search (alpha).
5
+ Project-URL: Homepage, https://github.com/TheAstrayDev/dream-rsi-sdk
6
+ Project-URL: Documentation, https://github.com/TheAstrayDev/dream-rsi-sdk#readme
7
+ Author: TheAstrayDev
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: agents,ai,dream-rsi,exploration,recursive-self-improvement
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Provides-Extra: dev
24
+ Requires-Dist: hypothesis>=6.0; extra == 'dev'
25
+ Requires-Dist: pyright>=1.1; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.5; extra == 'dev'
29
+ Provides-Extra: langchain
30
+ Requires-Dist: langchain-core<2,>=1.6.3; extra == 'langchain'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Dream-RSI SDK · Alpha
34
+
35
+ **Bring your agent. Record its search. Evolve executable exploration policies.**
36
+
37
+ An independent, unofficial Python SDK inspired by Dream-RSI research. Maintained by
38
+ **TheAstrayDev**, who is not a Google or Google DeepMind employee. This is a personal
39
+ research initiative, not a commercial Google development, official SDK or endorsed product.
40
+
41
+ Python 3.11+ · zero core third-party dependencies · Apache-2.0 · version **0.1.0a2**.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ python -m pip install dreamrsi==0.1.0a2
47
+ ```
48
+
49
+ ```python
50
+ from dreamrsi import Budget, DreamRSI
51
+
52
+ rsi = DreamRSI(
53
+ agent=lambda task: task.upper(),
54
+ evaluator=lambda answer: float(len(answer)),
55
+ budget=Budget(model_calls=4),
56
+ )
57
+ result = rsi.run_sync("hello")
58
+ print(result.best) # HELLO
59
+ ```
60
+
61
+ This example demonstrates integration, not quality improvement. Stateful adapters support
62
+ generate/evaluate/refine tasks. Replay uses recorded outcomes without new discovery calls.
63
+ `LLMPolicyDeveloper` writes and iteratively rewrites executable source from measured feedback.
64
+ The SDK includes configurable Docker-free policy interpreters, optional process execution,
65
+ held-out validation, SQLite recovery and reported token/USD accounting.
66
+
67
+ ## Tested with Bonsai-27B-Q1_0
68
+
69
+ ![Measured Bonsai policy development](https://raw.githubusercontent.com/TheAstrayDev/dream-rsi-sdk/main/assets/bonsai-development-v4.png)
70
+
71
+ A local llama.cpp follow-up scored 5/6 revisions, repaired stopping from 1,000 to 4
72
+ replay rounds, promoted a policy and reloaded it for a fresh toy run. Residual error
73
+ decreased from 1.5 to 0.1875 at six agent calls per policy. This is limited mechanics
74
+ evidence, not a broad AI benchmark or a reproduction of the paper's performance.
75
+ Earlier failures and all run denominators remain in the public reports.
76
+
77
+ - [Full documentation and roadmap](https://github.com/TheAstrayDev/dream-rsi-sdk#readme)
78
+ - [Real-model evidence](https://github.com/TheAstrayDev/dream-rsi-sdk/blob/main/docs/experiments/sandbox-v4-2026-09-22.md)
79
+ - [Integration and recovery](https://github.com/TheAstrayDev/dream-rsi-sdk/blob/main/docs/research-loop.md)
80
+ - [Sandbox configuration](https://github.com/TheAstrayDev/dream-rsi-sdk/blob/main/docs/sandbox.md)
81
+ - [Issues](https://github.com/TheAstrayDev/dream-rsi-sdk/issues)
82
+ - [Original Dream-RSI paper](https://arxiv.org/abs/2609.14858)
83
+
84
+ Alpha APIs may change. Generated source runs in a bounded Python-syntax subset, not
85
+ arbitrary Python. External state isolation and remote cancellation require adapter support.
86
+ Usage caps depend on accurate provider reports and ceilings. Research-scale performance
87
+ and broad generalization remain unverified.