prabodha 1.0.0__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 (66) hide show
  1. prabodha-1.0.0/LICENSE +202 -0
  2. prabodha-1.0.0/NOTICE +8 -0
  3. prabodha-1.0.0/PKG-INFO +156 -0
  4. prabodha-1.0.0/README.md +126 -0
  5. prabodha-1.0.0/pyproject.toml +51 -0
  6. prabodha-1.0.0/setup.cfg +4 -0
  7. prabodha-1.0.0/src/prabodha/__init__.py +0 -0
  8. prabodha-1.0.0/src/prabodha/cli.py +49 -0
  9. prabodha-1.0.0/src/prabodha/config.py +15 -0
  10. prabodha-1.0.0/src/prabodha/contracts/__init__.py +0 -0
  11. prabodha-1.0.0/src/prabodha/contracts/closure.py +33 -0
  12. prabodha-1.0.0/src/prabodha/contracts/trace.py +44 -0
  13. prabodha-1.0.0/src/prabodha/efe/__init__.py +7 -0
  14. prabodha-1.0.0/src/prabodha/efe/agent.py +245 -0
  15. prabodha-1.0.0/src/prabodha/efe/gate_to_obs.py +34 -0
  16. prabodha-1.0.0/src/prabodha/efe/ledger.py +53 -0
  17. prabodha-1.0.0/src/prabodha/efe/lint.py +44 -0
  18. prabodha-1.0.0/src/prabodha/efe/runner.py +124 -0
  19. prabodha-1.0.0/src/prabodha/lens/__init__.py +10 -0
  20. prabodha-1.0.0/src/prabodha/lens/adapter.py +169 -0
  21. prabodha-1.0.0/src/prabodha/lens/compare_cli.py +71 -0
  22. prabodha-1.0.0/src/prabodha/lens/e1_cli.py +79 -0
  23. prabodha-1.0.0/src/prabodha/lens/e1_metrics.py +501 -0
  24. prabodha-1.0.0/src/prabodha/lens/fit_cli.py +24 -0
  25. prabodha-1.0.0/src/prabodha/lens/public_api.py +111 -0
  26. prabodha-1.0.0/src/prabodha/lens/vis_cli.py +44 -0
  27. prabodha-1.0.0/src/prabodha/stats/__init__.py +0 -0
  28. prabodha-1.0.0/src/prabodha/stats/core.py +71 -0
  29. prabodha-1.0.0/src/prabodha/steer/__init__.py +10 -0
  30. prabodha-1.0.0/src/prabodha/steering/__init__.py +8 -0
  31. prabodha-1.0.0/src/prabodha/steering/bridge_trained.py +163 -0
  32. prabodha-1.0.0/src/prabodha/steering/e3_cli.py +169 -0
  33. prabodha-1.0.0/src/prabodha/steering/e4_cli.py +460 -0
  34. prabodha-1.0.0/src/prabodha/steering/injector.py +83 -0
  35. prabodha-1.0.0/src/prabodha/steering/public_api.py +125 -0
  36. prabodha-1.0.0/src/prabodha/steering/scoring.py +30 -0
  37. prabodha-1.0.0/src/prabodha/steering/timing.py +170 -0
  38. prabodha-1.0.0/src/prabodha/steering/verifier.py +69 -0
  39. prabodha-1.0.0/src/prabodha/steering/writer.py +64 -0
  40. prabodha-1.0.0/src/prabodha.egg-info/PKG-INFO +156 -0
  41. prabodha-1.0.0/src/prabodha.egg-info/SOURCES.txt +64 -0
  42. prabodha-1.0.0/src/prabodha.egg-info/dependency_links.txt +1 -0
  43. prabodha-1.0.0/src/prabodha.egg-info/entry_points.txt +2 -0
  44. prabodha-1.0.0/src/prabodha.egg-info/requires.txt +15 -0
  45. prabodha-1.0.0/src/prabodha.egg-info/top_level.txt +1 -0
  46. prabodha-1.0.0/tests/test_bridge_trained.py +111 -0
  47. prabodha-1.0.0/tests/test_closure.py +17 -0
  48. prabodha-1.0.0/tests/test_compare.py +42 -0
  49. prabodha-1.0.0/tests/test_configs.py +16 -0
  50. prabodha-1.0.0/tests/test_corpus.py +45 -0
  51. prabodha-1.0.0/tests/test_e1_metrics.py +218 -0
  52. prabodha-1.0.0/tests/test_efe.py +180 -0
  53. prabodha-1.0.0/tests/test_export_app_data.py +25 -0
  54. prabodha-1.0.0/tests/test_gpu_guard.py +32 -0
  55. prabodha-1.0.0/tests/test_l20_gate.py +259 -0
  56. prabodha-1.0.0/tests/test_mcp_server_integration.py +66 -0
  57. prabodha-1.0.0/tests/test_mcp_server_smoke.py +63 -0
  58. prabodha-1.0.0/tests/test_public_api_lens.py +55 -0
  59. prabodha-1.0.0/tests/test_public_api_steer.py +52 -0
  60. prabodha-1.0.0/tests/test_smoke_lens.py +27 -0
  61. prabodha-1.0.0/tests/test_smoke_steering.py +57 -0
  62. prabodha-1.0.0/tests/test_smoke_vis.py +30 -0
  63. prabodha-1.0.0/tests/test_stats.py +29 -0
  64. prabodha-1.0.0/tests/test_steer_trace_emission.py +129 -0
  65. prabodha-1.0.0/tests/test_steering.py +136 -0
  66. prabodha-1.0.0/tests/test_trace_contract.py +58 -0
prabodha-1.0.0/LICENSE ADDED
@@ -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.
prabodha-1.0.0/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ prabodha — Copyright 2026 Sharath S <qbz506@york.ac.uk>
2
+
3
+ This repository vendors anthropics/jacobian-lens (vendor/jacobian-lens), Copyright Anthropic,
4
+ licensed under the Apache License 2.0 — companion code for "Verbalizable Representations Form a
5
+ Global Workspace in Language Models" (transformer-circuits.pub/2026/workspace). Vendored unmodified
6
+ (RULES R7); all adaptations live under src/prabodha/.
7
+ Conceptual machinery ported from the Pratyabhijñā World Model (PWM) project and sibling projects by
8
+ the same author (see docs/prior_art_internal.md).
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: prabodha
3
+ Version: 1.0.0
4
+ Summary: Recognition-gated workspace steering for language models (PWM x J-space x GNW)
5
+ Author-email: Sharath S <qbz506@york.ac.uk>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/SharathSPhD/prabodha
8
+ Project-URL: Repository, https://github.com/SharathSPhD/prabodha
9
+ Project-URL: Paper, https://github.com/SharathSPhD/prabodha/blob/main/docs/paper/paper.pdf
10
+ Project-URL: Lenses, https://huggingface.co/qbz506/prabodha-lenses
11
+ Project-URL: Pages site, https://sharathsphd.github.io/prabodha
12
+ Keywords: interpretability,steering,jacobian-lens,global-workspace,llm
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: NOTICE
17
+ Requires-Dist: numpy>=1.24
18
+ Requires-Dist: pyyaml>=6
19
+ Requires-Dist: pydantic>=2.5
20
+ Provides-Extra: lens
21
+ Requires-Dist: torch>=2.1; extra == "lens"
22
+ Requires-Dist: transformers>=4.40; extra == "lens"
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8; extra == "dev"
25
+ Requires-Dist: ruff>=0.4; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
27
+ Provides-Extra: hybrid
28
+ Requires-Dist: flash-linear-attention; extra == "hybrid"
29
+ Dynamic: license-file
30
+
31
+ # prabodha — प्रबोध
32
+
33
+ **Recognition-gated workspace steering for language models.**
34
+
35
+ Prabodha ("awakening") implements the missing control theory for the Jacobian-lens
36
+ actuator: steer a frozen LLM through its global workspace using a small recognition-driven
37
+ world model. Writes are timed by sphurattā events (uncommitted moments), verified by
38
+ āgama re-cognition, bounded by svātantrya (autonomy), and diagnosed by the three malas.
39
+
40
+ Built as a bridge between PWM (Pratyabhijñā World Model, Sharath S), the J-space
41
+ (Anthropic's verbalizable global workspace), and GNW (Global Neuronal Workspace),
42
+ read as engineering.
43
+
44
+ ## What it does
45
+
46
+ | Claim | Evidence | Strength |
47
+ |---|---|---|
48
+ | Workspace band + verbalizable content replicate across 3 model families, 2 sizes | gates L1, L1b, L2 | screen, multi-model |
49
+ | Event-gated writes steer within entropy budget (core claim) | gates L9, L11 | confirm, 6 seeds |
50
+ | Alignment beats rate-matched control | gates L11 | p≈0.016, 6/6 sign-consistent |
51
+ | Transfers to a 2nd model via calibration | gates L13, L14-ms | confirm, 4 seeds |
52
+ | Amplitude ∝ 1/lens-strength; monotone dose in active range | gates L14-amp, L15-amp, L16 | confirm (Qwen3) / screen (Nemotron) |
53
+
54
+ The readback verdict is weak (BA ≈ 0.59 at n=120 — honest negative, gates L14–L16);
55
+ corpus-amplitude coupling is confirmed directionally but fails the strict margin criterion
56
+ (gate L19 fail-on-margin). No new claims are made; all numbers are committed to gates.
57
+
58
+ ## 60-second quickstart
59
+
60
+ ```bash
61
+ pip install prabodha
62
+ ```
63
+
64
+ Fit a lens and steer on a public model (Qwen3-4B, ~6 GB):
65
+
66
+ ```python
67
+ from prabodha.lens import fit, vis
68
+ from prabodha.steer import write
69
+
70
+ # 1. Fit a band-targeted lens (one-time; resumable)
71
+ fit(
72
+ model_config_path="configs/models/qwen3.yaml",
73
+ lens_config_path="configs/lens_mid.yaml",
74
+ out_path="outputs/lens_qwen3_mid30.pt"
75
+ )
76
+
77
+ # 2. Steer with recognition-gated writes
78
+ write(
79
+ model_config_path="configs/models/qwen3.yaml",
80
+ lens_file_path="outputs/lens_qwen3_mid30.pt",
81
+ exp_config_path="configs/experiments/e13full.yaml",
82
+ out_path="gates/my_run.json",
83
+ alpha=0.3,
84
+ seed=42,
85
+ emit_trace="outputs/traces/my_trace.json" # optional: emit per-token trace
86
+ )
87
+
88
+ # 3. Visualize lens readout (interactive HTML)
89
+ vis(
90
+ model_config_path="configs/models/qwen3.yaml",
91
+ lens_file_path="outputs/lens_qwen3_mid30.pt",
92
+ prompt="the fire remembers rivers",
93
+ out_path="outputs/fire_vis.html"
94
+ )
95
+ ```
96
+
97
+ See `examples/quickstart_qwen3.md` and `examples/quickstart_nemotron.md` for full
98
+ command-line workflows with expected numbers (gate-cited).
99
+
100
+ ## Install & use
101
+
102
+ ### Library
103
+
104
+ ```bash
105
+ pip install prabodha # core library + CLI
106
+ pip install prabodha[hybrid] # + flash-linear-attention support
107
+ ```
108
+
109
+ ### Public API
110
+
111
+ ```python
112
+ # Lens operations
113
+ from prabodha.lens import fit, eval, vis
114
+
115
+ # Steering operations
116
+ from prabodha.steer import write, gate, verify
117
+ ```
118
+
119
+ ### CLI
120
+
121
+ ```bash
122
+ prabodha --help # all subcommands
123
+ prabodha lens-fit --model M.yaml --lens L.yaml --out lens.pt
124
+ prabodha lens-eval --model M.yaml --lens-file lens.pt --exp E.yaml --out gate.json
125
+ prabodha lens-vis --model M.yaml --lens-file lens.pt --prompt "..." --out page.html
126
+ prabodha steer --model M.yaml --mid-lens lens.pt --exp E.yaml --out gate.json [--emit-trace trace.json]
127
+ prabodha figures # regenerate paper figures from gates/
128
+ ```
129
+
130
+ ## Plugin & MCP integration
131
+
132
+ Claude Code users: the plugin at `integrations/claude-code-plugin/` ships skills
133
+ (`lens-map`, `steer-verify`) with defaults from the measured findings.
134
+
135
+ MCP server at `integrations/mcp-server/` exposes `lens_map`, `steer_generate`,
136
+ `readback_verify`, `list_gates` for any MCP client.
137
+
138
+ ## Provenance & license
139
+
140
+ Vendored: [anthropics/jacobian-lens](https://github.com/anthropics/jacobian-lens)
141
+ (Apache-2.0) — companion code for *Verbalizable Representations Form a Global Workspace*
142
+ (Anthropic, 2026).
143
+
144
+ Prabodha: Sharath S, *Pratyabhijñā World Model* (arXiv, 2026).
145
+
146
+ License: Apache-2.0.
147
+
148
+ ---
149
+
150
+ Author: Sharath S <qbz506@york.ac.uk> · GitHub: SharathSPhD · Release: v1.0.0
151
+
152
+ **Docs:** [jspace_pratyabhijna_scoping.md](docs/jspace_pratyabhijna_scoping.md) ·
153
+ **Paper:** [docs/paper/paper.pdf](docs/paper/paper.pdf) ·
154
+ **Live app:** [prabodha.vercel.app](https://prabodha.vercel.app) ·
155
+ **Pages:** [sharathsphd.github.io/prabodha](https://sharathsphd.github.io/prabodha) ·
156
+ **HuggingFace:** [qbz506/prabodha-lenses](https://huggingface.co/qbz506/prabodha-lenses)
@@ -0,0 +1,126 @@
1
+ # prabodha — प्रबोध
2
+
3
+ **Recognition-gated workspace steering for language models.**
4
+
5
+ Prabodha ("awakening") implements the missing control theory for the Jacobian-lens
6
+ actuator: steer a frozen LLM through its global workspace using a small recognition-driven
7
+ world model. Writes are timed by sphurattā events (uncommitted moments), verified by
8
+ āgama re-cognition, bounded by svātantrya (autonomy), and diagnosed by the three malas.
9
+
10
+ Built as a bridge between PWM (Pratyabhijñā World Model, Sharath S), the J-space
11
+ (Anthropic's verbalizable global workspace), and GNW (Global Neuronal Workspace),
12
+ read as engineering.
13
+
14
+ ## What it does
15
+
16
+ | Claim | Evidence | Strength |
17
+ |---|---|---|
18
+ | Workspace band + verbalizable content replicate across 3 model families, 2 sizes | gates L1, L1b, L2 | screen, multi-model |
19
+ | Event-gated writes steer within entropy budget (core claim) | gates L9, L11 | confirm, 6 seeds |
20
+ | Alignment beats rate-matched control | gates L11 | p≈0.016, 6/6 sign-consistent |
21
+ | Transfers to a 2nd model via calibration | gates L13, L14-ms | confirm, 4 seeds |
22
+ | Amplitude ∝ 1/lens-strength; monotone dose in active range | gates L14-amp, L15-amp, L16 | confirm (Qwen3) / screen (Nemotron) |
23
+
24
+ The readback verdict is weak (BA ≈ 0.59 at n=120 — honest negative, gates L14–L16);
25
+ corpus-amplitude coupling is confirmed directionally but fails the strict margin criterion
26
+ (gate L19 fail-on-margin). No new claims are made; all numbers are committed to gates.
27
+
28
+ ## 60-second quickstart
29
+
30
+ ```bash
31
+ pip install prabodha
32
+ ```
33
+
34
+ Fit a lens and steer on a public model (Qwen3-4B, ~6 GB):
35
+
36
+ ```python
37
+ from prabodha.lens import fit, vis
38
+ from prabodha.steer import write
39
+
40
+ # 1. Fit a band-targeted lens (one-time; resumable)
41
+ fit(
42
+ model_config_path="configs/models/qwen3.yaml",
43
+ lens_config_path="configs/lens_mid.yaml",
44
+ out_path="outputs/lens_qwen3_mid30.pt"
45
+ )
46
+
47
+ # 2. Steer with recognition-gated writes
48
+ write(
49
+ model_config_path="configs/models/qwen3.yaml",
50
+ lens_file_path="outputs/lens_qwen3_mid30.pt",
51
+ exp_config_path="configs/experiments/e13full.yaml",
52
+ out_path="gates/my_run.json",
53
+ alpha=0.3,
54
+ seed=42,
55
+ emit_trace="outputs/traces/my_trace.json" # optional: emit per-token trace
56
+ )
57
+
58
+ # 3. Visualize lens readout (interactive HTML)
59
+ vis(
60
+ model_config_path="configs/models/qwen3.yaml",
61
+ lens_file_path="outputs/lens_qwen3_mid30.pt",
62
+ prompt="the fire remembers rivers",
63
+ out_path="outputs/fire_vis.html"
64
+ )
65
+ ```
66
+
67
+ See `examples/quickstart_qwen3.md` and `examples/quickstart_nemotron.md` for full
68
+ command-line workflows with expected numbers (gate-cited).
69
+
70
+ ## Install & use
71
+
72
+ ### Library
73
+
74
+ ```bash
75
+ pip install prabodha # core library + CLI
76
+ pip install prabodha[hybrid] # + flash-linear-attention support
77
+ ```
78
+
79
+ ### Public API
80
+
81
+ ```python
82
+ # Lens operations
83
+ from prabodha.lens import fit, eval, vis
84
+
85
+ # Steering operations
86
+ from prabodha.steer import write, gate, verify
87
+ ```
88
+
89
+ ### CLI
90
+
91
+ ```bash
92
+ prabodha --help # all subcommands
93
+ prabodha lens-fit --model M.yaml --lens L.yaml --out lens.pt
94
+ prabodha lens-eval --model M.yaml --lens-file lens.pt --exp E.yaml --out gate.json
95
+ prabodha lens-vis --model M.yaml --lens-file lens.pt --prompt "..." --out page.html
96
+ prabodha steer --model M.yaml --mid-lens lens.pt --exp E.yaml --out gate.json [--emit-trace trace.json]
97
+ prabodha figures # regenerate paper figures from gates/
98
+ ```
99
+
100
+ ## Plugin & MCP integration
101
+
102
+ Claude Code users: the plugin at `integrations/claude-code-plugin/` ships skills
103
+ (`lens-map`, `steer-verify`) with defaults from the measured findings.
104
+
105
+ MCP server at `integrations/mcp-server/` exposes `lens_map`, `steer_generate`,
106
+ `readback_verify`, `list_gates` for any MCP client.
107
+
108
+ ## Provenance & license
109
+
110
+ Vendored: [anthropics/jacobian-lens](https://github.com/anthropics/jacobian-lens)
111
+ (Apache-2.0) — companion code for *Verbalizable Representations Form a Global Workspace*
112
+ (Anthropic, 2026).
113
+
114
+ Prabodha: Sharath S, *Pratyabhijñā World Model* (arXiv, 2026).
115
+
116
+ License: Apache-2.0.
117
+
118
+ ---
119
+
120
+ Author: Sharath S <qbz506@york.ac.uk> · GitHub: SharathSPhD · Release: v1.0.0
121
+
122
+ **Docs:** [jspace_pratyabhijna_scoping.md](docs/jspace_pratyabhijna_scoping.md) ·
123
+ **Paper:** [docs/paper/paper.pdf](docs/paper/paper.pdf) ·
124
+ **Live app:** [prabodha.vercel.app](https://prabodha.vercel.app) ·
125
+ **Pages:** [sharathsphd.github.io/prabodha](https://sharathsphd.github.io/prabodha) ·
126
+ **HuggingFace:** [qbz506/prabodha-lenses](https://huggingface.co/qbz506/prabodha-lenses)
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "prabodha"
7
+ version = "1.0.0"
8
+ description = "Recognition-gated workspace steering for language models (PWM x J-space x GNW)"
9
+ readme = "README.md"
10
+ authors = [{name = "Sharath S", email = "qbz506@york.ac.uk"}]
11
+ license = {text = "Apache-2.0"}
12
+ requires-python = ">=3.10"
13
+ keywords = ["interpretability", "steering", "jacobian-lens", "global-workspace", "llm"]
14
+ dependencies = ["numpy>=1.24", "pyyaml>=6", "pydantic>=2.5"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/SharathSPhD/prabodha"
18
+ Repository = "https://github.com/SharathSPhD/prabodha"
19
+ Paper = "https://github.com/SharathSPhD/prabodha/blob/main/docs/paper/paper.pdf"
20
+ Lenses = "https://huggingface.co/qbz506/prabodha-lenses"
21
+ "Pages site" = "https://sharathsphd.github.io/prabodha"
22
+
23
+ [project.scripts]
24
+ prabodha = "prabodha.cli:main"
25
+
26
+ [project.optional-dependencies]
27
+ lens = ["torch>=2.1", "transformers>=4.40"]
28
+ dev = ["pytest>=8", "ruff>=0.4", "pytest-asyncio>=0.23"]
29
+ hybrid = ["flash-linear-attention"] # + causal-conv1d --no-build-isolation (see Dockerfile)
30
+
31
+ [tool.setuptools.packages.find]
32
+ where = ["src"]
33
+
34
+ [tool.pytest.ini_options]
35
+ markers = [
36
+ "smoke: end-to-end tiny-model tests (needs torch/transformers/jlens)",
37
+ "asyncio: async test coroutine (pytest-asyncio)",
38
+ ]
39
+ addopts = "-q"
40
+ testpaths = ["tests"]
41
+ asyncio_mode = "auto"
42
+
43
+ [tool.ruff]
44
+ line-length = 100
45
+ target-version = "py310"
46
+
47
+ [tool.ruff.lint.per-file-ignores]
48
+ # importorskip must run before prabodha.lens imports (torch/jlens optional on CPU CI)
49
+ "tests/test_smoke_lens.py" = ["E402"]
50
+ "tests/test_smoke_vis.py" = ["E402"]
51
+ "tests/test_smoke_steering.py" = ["E402"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,49 @@
1
+ """prabodha CLI — the H4 application surface: one entrypoint over the toolkit.
2
+ Concept: the doctrine as a usable instrument (clean external surface, RULES R8 — the
3
+ engineering-gloss column only). Subcommands route to the tested module CLIs.
4
+ Source: docs/h4_plugin_architecture.md phase 1.
5
+ Primitive: `prabodha <cmd> [args...]` -> module main(argv). Stdlib dispatch only.
6
+
7
+ prabodha lens-fit --model M.yaml --lens L.yaml --out lens.pt [--resume]
8
+ prabodha lens-eval --model M.yaml --lens-file lens.pt --exp E.yaml --out gate.json
9
+ prabodha lens-vis --model M.yaml --lens-file lens.pt --prompt "..." --out page.html
10
+ prabodha steer --model M.yaml --mid-lens lens.pt --exp E.yaml --out gate.json
11
+ prabodha research [--menu menu.yaml] [--propose]
12
+ prabodha figures (regenerate paper/HTML figures from gates)
13
+ """
14
+ import sys
15
+
16
+
17
+ def main() -> None:
18
+ if len(sys.argv) < 2 or sys.argv[1] in ("-h", "--help"):
19
+ print(__doc__)
20
+ raise SystemExit(0)
21
+ cmd, argv = sys.argv[1], sys.argv[2:]
22
+ if cmd == "lens-fit":
23
+ from prabodha.lens import fit_cli
24
+ sys.argv = ["fit_cli"] + argv
25
+ fit_cli.main()
26
+ elif cmd == "lens-eval":
27
+ from prabodha.lens import e1_cli
28
+ e1_cli.main(argv)
29
+ elif cmd == "lens-vis":
30
+ from prabodha.lens import vis_cli
31
+ vis_cli.main(argv)
32
+ elif cmd == "steer":
33
+ from prabodha.steering import e4_cli
34
+ e4_cli.main(argv)
35
+ elif cmd == "research":
36
+ from prabodha.efe import runner
37
+ runner.main(argv)
38
+ elif cmd == "figures":
39
+ import runpy
40
+ from pathlib import Path
41
+ script = Path(__file__).resolve().parents[2] / "scripts/tools/make_figures.py"
42
+ runpy.run_path(str(script), run_name="__main__")
43
+ else:
44
+ print(f"unknown command: {cmd}\n{__doc__}")
45
+ raise SystemExit(2)
46
+
47
+
48
+ if __name__ == "__main__":
49
+ main()
@@ -0,0 +1,15 @@
1
+ """Config loader — config over constants (CLAUDE.md).
2
+ Concept: āgama-śāsana — the written rule governs the run.
3
+ Primitive: YAML -> dict with required-key validation.
4
+ """
5
+ from __future__ import annotations
6
+ from pathlib import Path
7
+ import yaml
8
+
9
+ def load(path: str | Path, required: tuple[str, ...] = ()) -> dict:
10
+ with open(path) as f:
11
+ cfg = yaml.safe_load(f)
12
+ missing = [k for k in required if k not in cfg]
13
+ if missing:
14
+ raise KeyError(f"config {path} missing required keys: {missing}")
15
+ return cfg
File without changes
@@ -0,0 +1,33 @@
1
+ """Dual-closure gate schema (RULES R1).
2
+ Concept: dvāra (gate) with ubhaya-siddhi — both accomplishments required.
3
+ Source: neo-fm five-point gate; prabhasa closure.py; scoping doc §7.
4
+ Primitive: pydantic model serialized to gates/gate_<loop>.json.
5
+ """
6
+ from __future__ import annotations
7
+ from typing import Literal, Optional
8
+ from pydantic import BaseModel, model_validator
9
+
10
+ Verdict = Literal["pass", "fail", "pruned", "pending"]
11
+
12
+ class GateSide(BaseModel):
13
+ verdict: Verdict
14
+ evidence: str
15
+ deviations: list[str] = []
16
+
17
+ class GateReport(BaseModel):
18
+ loop: str
19
+ status: Literal["open", "closed"]
20
+ closed_at: Optional[str] = None
21
+ code_gate: GateSide
22
+ domain_gate: GateSide
23
+ signoff: str = "pending"
24
+
25
+ @model_validator(mode="after")
26
+ def _dual_closure(self) -> "GateReport":
27
+ if self.status == "closed":
28
+ ok = {"pass", "pruned"}
29
+ if not (self.code_gate.verdict in ok and self.domain_gate.verdict in ok):
30
+ raise ValueError("R1 violation: closed loop requires BOTH gates pass|pruned")
31
+ if self.domain_gate.verdict == "pruned" and not self.domain_gate.evidence:
32
+ raise ValueError("R5: pruned closure requires evidence (diagnosis)")
33
+ return self