hypnosis 0.1.0a1__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 (75) hide show
  1. hypnosis-0.1.0a1/IMPLEMENTATION_PLAN.md +296 -0
  2. hypnosis-0.1.0a1/LICENSE.md +21 -0
  3. hypnosis-0.1.0a1/PKG-INFO +279 -0
  4. hypnosis-0.1.0a1/README.md +235 -0
  5. hypnosis-0.1.0a1/docs/application.md +71 -0
  6. hypnosis-0.1.0a1/docs/context.md +30 -0
  7. hypnosis-0.1.0a1/docs/optimization.md +27 -0
  8. hypnosis-0.1.0a1/docs/orchestration.md +24 -0
  9. hypnosis-0.1.0a1/docs/process-streams.md +32 -0
  10. hypnosis-0.1.0a1/docs/tools.md +26 -0
  11. hypnosis-0.1.0a1/docs/verification.md +23 -0
  12. hypnosis-0.1.0a1/experiments/hero-pilot-v1/README.md +75 -0
  13. hypnosis-0.1.0a1/experiments/hero-pilot-v1/results-2026-11-20.json +353 -0
  14. hypnosis-0.1.0a1/experiments/hero-pilot-v1/run.py +89 -0
  15. hypnosis-0.1.0a1/experiments/hero-session-v2/README.md +154 -0
  16. hypnosis-0.1.0a1/experiments/hero-session-v2/controller-recovery-2026-11-21.patch +77 -0
  17. hypnosis-0.1.0a1/experiments/hero-session-v2/report.py +123 -0
  18. hypnosis-0.1.0a1/experiments/hero-session-v2/results-2026-11-21.json +1993 -0
  19. hypnosis-0.1.0a1/experiments/hero-session-v2/run.py +166 -0
  20. hypnosis-0.1.0a1/pyproject.toml +67 -0
  21. hypnosis-0.1.0a1/pyproject.toml.orig +60 -0
  22. hypnosis-0.1.0a1/scripts/check_release.py +61 -0
  23. hypnosis-0.1.0a1/scripts/qualify.py +49 -0
  24. hypnosis-0.1.0a1/src/hypnosis/__init__.py +9 -0
  25. hypnosis-0.1.0a1/src/hypnosis/__main__.py +4 -0
  26. hypnosis-0.1.0a1/src/hypnosis/application.py +257 -0
  27. hypnosis-0.1.0a1/src/hypnosis/checkpoints.py +120 -0
  28. hypnosis-0.1.0a1/src/hypnosis/cli.py +108 -0
  29. hypnosis-0.1.0a1/src/hypnosis/context.py +172 -0
  30. hypnosis-0.1.0a1/src/hypnosis/curriculum.py +63 -0
  31. hypnosis-0.1.0a1/src/hypnosis/data/__init__.py +5 -0
  32. hypnosis-0.1.0a1/src/hypnosis/data/corpus.py +156 -0
  33. hypnosis-0.1.0a1/src/hypnosis/data/materials.py +175 -0
  34. hypnosis-0.1.0a1/src/hypnosis/data/sources.py +93 -0
  35. hypnosis-0.1.0a1/src/hypnosis/data/wiki.py +75 -0
  36. hypnosis-0.1.0a1/src/hypnosis/data/wikitext.py +117 -0
  37. hypnosis-0.1.0a1/src/hypnosis/evaluation.py +79 -0
  38. hypnosis-0.1.0a1/src/hypnosis/execution.py +136 -0
  39. hypnosis-0.1.0a1/src/hypnosis/harness_records.py +65 -0
  40. hypnosis-0.1.0a1/src/hypnosis/optimization.py +170 -0
  41. hypnosis-0.1.0a1/src/hypnosis/orchestration.py +181 -0
  42. hypnosis-0.1.0a1/src/hypnosis/pilot_results.py +38 -0
  43. hypnosis-0.1.0a1/src/hypnosis/process.py +278 -0
  44. hypnosis-0.1.0a1/src/hypnosis/records.py +103 -0
  45. hypnosis-0.1.0a1/src/hypnosis/runtime.py +146 -0
  46. hypnosis-0.1.0a1/src/hypnosis/selection.py +117 -0
  47. hypnosis-0.1.0a1/src/hypnosis/terminal.py +125 -0
  48. hypnosis-0.1.0a1/src/hypnosis/tools.py +134 -0
  49. hypnosis-0.1.0a1/src/hypnosis/training.py +404 -0
  50. hypnosis-0.1.0a1/src/hypnosis/verification.py +110 -0
  51. hypnosis-0.1.0a1/src/hypnosis/workbench.py +217 -0
  52. hypnosis-0.1.0a1/src/hypnosis/workflow.py +42 -0
  53. hypnosis-0.1.0a1/tests/test_application.py +68 -0
  54. hypnosis-0.1.0a1/tests/test_checkpoints.py +73 -0
  55. hypnosis-0.1.0a1/tests/test_context.py +51 -0
  56. hypnosis-0.1.0a1/tests/test_curriculum.py +42 -0
  57. hypnosis-0.1.0a1/tests/test_data.py +148 -0
  58. hypnosis-0.1.0a1/tests/test_evaluation.py +44 -0
  59. hypnosis-0.1.0a1/tests/test_job_execution.py +30 -0
  60. hypnosis-0.1.0a1/tests/test_materials.py +64 -0
  61. hypnosis-0.1.0a1/tests/test_model.py +30 -0
  62. hypnosis-0.1.0a1/tests/test_optimization.py +67 -0
  63. hypnosis-0.1.0a1/tests/test_orchestration.py +81 -0
  64. hypnosis-0.1.0a1/tests/test_process.py +111 -0
  65. hypnosis-0.1.0a1/tests/test_records.py +35 -0
  66. hypnosis-0.1.0a1/tests/test_runtime.py +150 -0
  67. hypnosis-0.1.0a1/tests/test_selection.py +54 -0
  68. hypnosis-0.1.0a1/tests/test_session.py +46 -0
  69. hypnosis-0.1.0a1/tests/test_session_report.py +44 -0
  70. hypnosis-0.1.0a1/tests/test_tools.py +56 -0
  71. hypnosis-0.1.0a1/tests/test_training_jobs.py +137 -0
  72. hypnosis-0.1.0a1/tests/test_verification.py +47 -0
  73. hypnosis-0.1.0a1/tests/test_workbench.py +171 -0
  74. hypnosis-0.1.0a1/tests/test_workflow.py +53 -0
  75. hypnosis-0.1.0a1/tests/workbench_native_worker.py +31 -0
@@ -0,0 +1,296 @@
1
+ # Hypnosis implementation plan
2
+
3
+ Hypnosis owns harness execution policy, context/tools, verification, experiment
4
+ management, training orchestration and measured harness optimization. Its first
5
+ user interface is a Carets application. The
6
+ [complete Cohesion Block B plan](https://github.com/wispsy/wispsy/blob/main/docs/cohesion-block-b/IMPLEMENTATION_PLAN.md)
7
+ contains the architecture, reuse register, full cross-project acceptance and
8
+ staged milestones. [Project 28](https://github.com/orgs/wispsy/projects/28) and
9
+ [owning issues](https://github.com/wispsy/hypnosis/issues) hold current execution state.
10
+
11
+ ## First vertical slice — HYP-01
12
+
13
+ Build a finite invocation-owned event lifecycle over explicitly supplied async
14
+ text producers. Each run has identity, increasing event sequences and bounded
15
+ UTF-8 output, event count and elapsed time. Normal outcomes are completed,
16
+ canceled, failed or limited. Canceled consumer tasks propagate and close the
17
+ source without producing false completion. Errors expose structural codes.
18
+
19
+ Expose the same run through ordinary Python, Expose Interface commands and
20
+ Carets messages. One Program and TerminalSession own input/output and teardown;
21
+ producer work remains outside update(). Escape control text and retain a
22
+ bounded display tail. Reuse Carets streams and TestProgram for deterministic
23
+ input, resize, cancellation and restoration checks. An explicitly configured
24
+ Thoughtform adapter can stream a real tiny Transformer through one owned worker;
25
+ this validates integration and does not establish useful trained behavior.
26
+
27
+ This finite domain lifecycle does not replace a durable workflow engine. Thread
28
+ cancellation is cooperative at token boundaries, not forced interruption.
29
+
30
+ ## Single-agent harness foundation
31
+
32
+ 1. HYP-TOOLS-01: accept a selected Hidden Moves catalog. Validate and authorize
33
+ tool requests before execution; never build another registry/schema engine.
34
+ 2. HYP-CONTEXT-01: bounded retrieval from explicit roots/providers, selected
35
+ skills/instructions and Parse MD documents, with source provenance and
36
+ trusted-instruction separation. Reuse the workspace capability plugin.
37
+ 3. HYP-MEMORY-01: Backpack codecs/records for runs and evaluation metadata,
38
+ explicit transcript retention, value-safe diagnostics and process reopen.
39
+ 4. HYP-WORKFLOW-01: Moveset/func_seq composition and optional Scriptty documents
40
+ for jobs. Resume without committed replay; uncertain effects require an
41
+ explicit retry/restart decision and matching definition/source identity.
42
+ 5. HYP-VERIFY-01: caller-selected actual verifiers, bounded repairs and workspace
43
+ diffs. A model's completion claim cannot satisfy task acceptance by itself.
44
+ 6. HYP-OLLAMA-01: explicitly configured endpoint/model through Requ and optional
45
+ Apiconn operations. Test real framing/cancellation with synthetic transport;
46
+ require selected hardware/model before long local inference.
47
+
48
+ ## Training and measured optimization
49
+
50
+ HYP-TRAIN-01 orchestrates prepare/load/train/evaluate/register stages through
51
+ existing workflows. Thoughtformula owns all gradient/optimizer/checkpoint math.
52
+ Select dataset provenance/license, source checkpoint, destination and resource
53
+ budget first. Preserve the source checkpoint and register new artifact lineage;
54
+ never train, download or promote a model implicitly.
55
+
56
+ HYP-EVAL-01 establishes versioned tasks, seeds, development/selection/held-out
57
+ splits, actual verifier outcomes, equal-budget baselines, latency/token/tool/
58
+ repair/compute metrics and reproducibility receipts. Report failures and success
59
+ denominators. HYP-OPT-01 searches bounded harness configurations with held-out
60
+ regression gates and explicit promotion. It does not modify weights as a side
61
+ effect of selecting context/tools/workflows.
62
+
63
+ HYP-ORCH-01 adds bounded multi-agent roles, dependencies, admission and shared
64
+ resource budgets after the single-agent evaluation foundation. Reuse workflow
65
+ and provider seams, propagate cancellation and serialize or isolate model caches.
66
+ Start sequentially on constrained hardware.
67
+
68
+ ## Composition and acceptance
69
+
70
+ Carets owns rendering/layout/focus/themes and terminal lifecycle. Expose
71
+ Interface owns parsing. Backpack owns storage. Hidden Moves owns capabilities.
72
+ Thoughtform owns identity/model definitions. Paracosm owns world authority.
73
+ Compose Application owns reusable assembly/reference qualification. Avoid core
74
+ cycles and optional-import side effects. The current UI provides application
75
+ evidence for later Carets design tokens and the Warewolf embedding contract.
76
+
77
+ Each task has a focused branch/PR and behavior checks. Build/install both wheel
78
+ and source outside the checkout, verify exact dependency sources, and run
79
+ headless profiles on Linux/macOS/Windows. Prove native terminals separately.
80
+ Public source development is authorized; package/weight uploads, releases,
81
+ paid providers and deployment require their own concrete authorization.
82
+
83
+ ## Hero homegrown training continuation
84
+
85
+ The [expanded canonical chapter](https://github.com/wispsy/wispsy/blob/main/docs/cohesion-block-b/hero-training.md)
86
+ selects Hero, her Hero Coding specialization, independent Engl records,
87
+ explicit source review and a combined 15-minute first training pilot.
88
+ [HYP-SOURCE-01](https://github.com/wispsy/hypnosis/issues/13) records the approved
89
+ internal recipe and candidate Python vault/docs/wiki sources. All future source
90
+ additions remain owner-reviewed. The supplied local datasets support bounded
91
+ compressed/indexed preparation; no full Wikipedia extraction is needed.
92
+
93
+ The direct prepare/train/evaluate/register profile reuses func_seq and Backpack
94
+ and does not require externally connected tools. Thoughtformula owns bounded
95
+ pretraining, numerical evaluation and lossless optimizer resume; Thoughtform
96
+ owns named recipes/local artifacts and parent lineage. Curriculum/shuffle and
97
+ coding-child results require held-out counts/coverage and actual runtime/step
98
+ receipts. Ollama and the selected-catalog/tool path remain deferred.
99
+
100
+ HYP-MEMORY-01: typed structural training/evaluation/artifact receipts use Backpack
101
+ public codecs and explicit storage paths. Verification closes the store, reopens
102
+ it in a separate Python process, and checks idempotent recovery and conflicts.
103
+ Raw source text, credentials and transcripts are excluded from job receipts.
104
+
105
+ HYP-WORKFLOW-01: func_seq owns stage sequencing and progress. Identity-bound
106
+ trusted stage definitions refuse incompatible recovery; tests demonstrate
107
+ committed stages are not replayed and failed effects require explicit retry.
108
+ The first profile does not depend on an external tool catalog or Ollama.
109
+
110
+ HYP-EVAL-01: provider-neutral split measurement reports availability, tokenizer
111
+ coverage/exclusions and exact selected record/token denominators. The native
112
+ Thoughtformula loss adapter and nonexecuting syntax probes support fixed-budget
113
+ experiments. Missing held-out splits are explicit unavailable results. Matched
114
+ curriculum/shuffle comparison and small-sample limits belong in pilot receipts.
115
+ HYP-CURRICULUM-01: the approved internal v1 generator is deterministic, finite,
116
+ content-hashed and split by problem group. Tests independently verify every
117
+ reference and demonstrate train/held-out separation and source-selection bounds.
118
+ It contains no external teacher output or vault-derived material.
119
+
120
+ HYP-TRAIN-01: the integrated local job composes the public Thoughtformula,
121
+ Thoughtform, func_seq and Backpack APIs. Passive settings and corpus identities
122
+ bind recovery. Tokenizer fitting is training-only, with explicit unknown-text
123
+ counts and fixed per-document windows. Hero Coding starts from a fresh loaded
124
+ Hero parent and records lineage. Native checkpoint and quantized inference
125
+ exports stay local. The same owned worker emits bounded Carets progress and
126
+ joins on cooperative cancellation. Source/CLI/Carets/parent-preservation and
127
+ nonzero-step pause/retry tests cover the complete path; installed `training`
128
+ profiles qualify the application on Linux, macOS and Windows.
129
+
130
+ HERO-PILOT-02: completed-job receipt recollection validates the native artifact and
131
+ func_seq state before reopening the identical CLI without retry authority. It
132
+ retains original delivery diagnostics and respects the combined deadline. The
133
+ matched shuffle acceptance in HERO-PILOT-01 remains open; no curriculum advantage
134
+ or model promotion is claimed. Complete local training artifacts stay in ignored
135
+ run folders. The next source/window-mixture/runtime decision is tracked in #27.
136
+
137
+ The owner-approved sanitized pilot measurements are published in
138
+ `experiments/hero-pilot-v1/results-2026-11-20.json`, with the observed limits and
139
+ unperformed comparison documented beside them. Raw source text and weights are
140
+ not distributed.
141
+
142
+ HYP-DATA-02: citation provenance preserves reference groups and explicit bodies,
143
+ marks conflicting named reuse unresolved, and propagates truncation metadata.
144
+ Authored parser fixtures qualify the behavior without touching existing corpora
145
+ or performing additional model training.
146
+ ## Session v2 — approved Python materials and checkpoint collections
147
+
148
+ Selected 21 November 2026 from the owner's instruction on hypnosis #27. All
149
+ current materials in `_datasets/python3_vault/`, the `psf_wiki/` clone, and the
150
+ Python 3.14 documentation archives are approved for local training. Recipe and
151
+ progression selection is delegated for this session. Future additions remain
152
+ separate selections. Raw text and weights stay local; sanitized measurements
153
+ and code/CI receipts use the existing publication authorization.
154
+
155
+ ### Delivery batches
156
+
157
+ 1. HYP-VAULT-01: snapshot approved Markdown/text-archive selections with complete
158
+ file/member hashes, root-relative paths, source references and bounded reads.
159
+ Reuse Parse MD for Markdown structure and code spans. Prefer the documentation
160
+ text archive; HTML/EPUB/texinfo are duplicate views, not additional samples.
161
+ Preserve source derivation and label migrated community wiki material.
162
+ Never run downloaded code or follow embedded links. Group chunks from a page
163
+ and explicit documentation-derived notes together before held-out splitting.
164
+ 2. TFORM-03: add named `balanced-v2` Hero/Hero Coding recipes in Thoughtform,
165
+ retaining the pilot recipes. Start at width 64, two layers, two experts,
166
+ hidden width 128; measure actual parameter count/throughput before training.
167
+ A new tokenizer/model family is trained from scratch; previous artifacts stay
168
+ intact. Coding specialization preserves the new parent's vocabulary/shape.
169
+ 3. HYP-MIX-01: source quotas and weighted document/window interleaving eliminate
170
+ first-source starvation. Fit tokenizer merges only on training material and
171
+ include every selected training character plus the declared ASCII alphabet.
172
+ Keep the `pilot-v1` preparation/serialization exactly compatible so old jobs
173
+ and the matched baseline retain their original corpus/pair/tokenizer identity.
174
+ 4. HYP-CHECKPOINT-01: longer finite jobs retain immutable periodic native snapshots
175
+ and passive artifact sidecars. Reuse Backpack for a typed local collection
176
+ index, not a new storage engine. Keep latest recovery state separate from
177
+ retained history. Validate pause/retry and fresh-process inventory, enforce
178
+ retained-file/byte limits and preserve every existing checkpoint.
179
+ 5. HERO-SESSION-02: bounded one-hour combined experiment window. Reserve up to
180
+ eight minutes for the 1,478-step old shuffled baseline, thirty minutes for the
181
+ new balanced Hero, eighteen minutes for Hero Coding, with four minutes for
182
+ probes/evaluation/checkpoint IO. Use hard remaining-time child deadlines,
183
+ print the scheduled stop in PST, and collect results while doing independent
184
+ CI/documentation work. A timeout preserves the last complete native snapshot.
185
+ 6. HERO-QA-02: installed source/wheel qualification and exact merged source pins;
186
+ update the canonical plan, source cards, issues and Project evidence.
187
+
188
+ ### Initial source mixture
189
+
190
+ Hero window weights: internal v1 exercises 20; vault tutorials 20; TinyStories
191
+ 20; Simple English Wikipedia 10; UD English 5; Wiktionary 5; vault references 5;
192
+ Python 3.14 docs 10; selected Python community wiki 5. Official train/dev/test
193
+ splits stay fixed. Document/reference groups and exact-content deduplication
194
+ keep held-out material separate. Report actual source windows consumed.
195
+
196
+ Hero Coding weights: vault tutorials 30; Python 3.14 docs 35; approved internal
197
+ Python exercises 20; vault references 10; Python community wiki 5. Retain a small
198
+ fixed general-language evaluation alongside coding-source measurements to show
199
+ regression/forgetting. Syntax is parsed, never executed as model-generated code.
200
+
201
+ ### Acceptance and limits
202
+
203
+ All selected source IDs must receive windows, vocabulary coverage/exclusions and
204
+ record/token denominators must be explicit, and old completed jobs must reopen
205
+ without replay. Keep periodic checkpoints with run/model/recipe/corpus/tokenizer/
206
+ parent/optimizer identity and immutable filenames. Publish aggregate receipts,
207
+ not training text, weights or private paths. Compare old Hero/shuffle only when
208
+ step, pair, tokenizer and initialization identities match. New-family losses
209
+ are not directly compared numerically with v1 across different tokenizers.
210
+ Tiny short-run models remain experimental; no factual, functional coding or
211
+ autonomous training-agent claim follows from loss or syntax. No Ollama/external
212
+ teacher, paid provider, package release or model-weight publication is selected.
213
+
214
+ HYP-MIX-01 implements balanced-v2 source quotas, weighted document/window
215
+ interleaving, complete selected-training alphabet coverage and actual consumed
216
+ source audits. Separate coding/general held-out metrics make specialization
217
+ regressions visible. Legacy job settings omit the new profile field to retain
218
+ existing identity; the original completed pilot reopens without replay.
219
+
220
+ HYP-CHECKPOINT-01 retains immutable periodic native snapshots and typed Backpack
221
+ inventory under finite count/byte ceilings. Exact continuation from a retained
222
+ balanced-v2 artifact preserves Adam and data/order identities in a new run with
223
+ additional budgets; specialization remains distinct. Tests compare continued
224
+ weights/moments bit-for-bit with uninterrupted training and reopen collection
225
+ records in a fresh process. The selected thirty-minute Hero stage will use two
226
+ fifteen-minute jobs so this continuation path is exercised in the real session.
227
+
228
+ ## Application completion and Carets v0.2.0 — 22 November 2026
229
+
230
+ Owner-selected scope: complete the Hypnosis application portion of Cohesion Block B
231
+ and Carets foundations leading to #7. Ollama remains deferred. Version 0.2.0 is a
232
+ component-library foundation; #7 remains the growing widget backlog. Release and
233
+ publication are explicitly authorized after verification.
234
+
235
+ ### Delivery order and acceptance
236
+
237
+ 1. Carets #3: immutable size/constraint/rect/layout nodes, rows, columns, stacks,
238
+ overlays/splits, fixed/weighted/percentage/content sizing, limits, padding,
239
+ margins, gaps/alignment and bounded clipping. Content measurement does not
240
+ depend on the parent. Test nested resize, deterministic allocation, shortage,
241
+ zero dimensions and identity-derived zones.
242
+ 2. Carets #5: one grapheme/width/clipping path shared by style, cells and layout;
243
+ retain dependency-free core with pinned Unicode property data and conformance
244
+ fixtures. Explicit terminal-width policy covers emoji/ZWJ, combining text,
245
+ flags, wide cells and ambiguous width. Add color fallback, cursor ownership,
246
+ layer composition, resize/full redraw and immutable previous-frame snapshots.
247
+ 3. Carets #6: incremental CSI/SS3/function/modifier keys, explicit Kitty protocol
248
+ negotiation/events, focus reports, complete SGR mouse actions and bounded
249
+ paste/malformed input. Preserve fragmented UTF-8 and subsequent input. Terminal
250
+ modes are opted into, owned and restored by the existing session.
251
+ 4. CARET-FRAME-01: optional bounded frame scheduling with serialized lossless
252
+ updates, deterministic clock tests, responsive input and final flush; immediate
253
+ rendering remains the default.
254
+ 5. CARET-DS-01/#7 foundation: shared immutable component sizing/state/accessibility
255
+ contracts, theme roles/spacing, reusable shell regions and initial controls.
256
+ Adapt existing controls rather than creating another rendering/focus lifecycle.
257
+ Demonstrate Hypnosis and an independent dashboard under narrow/Unicode/modal
258
+ conditions. Keep the complete future widget list open in #7.
259
+ 6. CARET-TABLE-01: bounded read-only table viewport over public Headless Spreadsheets
260
+ snapshots, stable source/row/column/revision identity, keyboard selection and
261
+ virtualization. Storage and revision-checked edits stay in source adapters.
262
+ 7. HYP-TOOLS-01: selected Hidden Moves catalog, typed requests, application-owned
263
+ authority, finite arguments/results, structural receipts and explicit uncertain
264
+ effects/cancellation. Never reimplement schema dispatch or activate providers
265
+ from retrieved text.
266
+ 8. HYP-CONTEXT-01: explicit Workspace selections and trusted instruction inputs,
267
+ bounded UTF-8 bytes and caller tokenizer budgets, source/hash/truncation records,
268
+ stale-source handling and held-out retrieval fixtures. Reuse Workspace and Parse
269
+ MD; private context stays out of structural receipts.
270
+ 9. HYP-VERIFY-01: caller-selected real verifier outcomes, finite repair attempts and
271
+ shared time/output/tool authority. Cover pass, repaired pass, exhausted limits,
272
+ verifier errors and cancellation. Keep workspace diff/provenance references
273
+ inspectable without automatically executing generated code.
274
+ 10. HYP-OPT-01: deterministic finite configuration trials and immutable task/provider/
275
+ config identities, held-out regression gates and explicit candidate selection.
276
+ Reuse Backpack receipts; no implicit weight training or automatic promotion.
277
+ 11. HYP-ORCH-01: explicit role/dependency DAGs, admission and shared resource/time/
278
+ output budgets with existing func_seq seams. Sequential scheduling by default;
279
+ cancellation, blocked dependents and model resource serialization are explicit.
280
+ 12. Integrate the same application services into CLI and Carets, with job/tool/context/
281
+ verification/trial views. Keep terminal output bounded, use shared shell/theme/
282
+ table components, preserve one terminal owner and keep JSON stdout separate.
283
+ 13. Finish installed app-family qualification and public source pins. Run focused
284
+ tests for each change, source and wheel checks, Linux/macOS/Windows headless
285
+ checks and POSIX native-terminal evidence. Preserve all existing datasets,
286
+ checkpoints and source profiles; no new long training session is selected.
287
+ 14. Prepare v0.2.0 metadata, release notes, migration/component-author guidance,
288
+ compatibility limits and verified wheel/source hashes. Publish the requested
289
+ release through the verified existing GitHub/PyPI path and check uploaded
290
+ artifacts. No dependent package release is implied.
291
+
292
+ Use focused branches/PRs in rolling batches. Fold stacked children into parents
293
+ before main, retain passing current-head evidence and update the Project/issues
294
+ at integration. Keep numerical training in Thoughtformula, recipes/artifacts in
295
+ Thoughtform, capability dispatch in Hidden Moves, storage in Backpack, scheduling
296
+ in func_seq and document/table semantics in their owning libraries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wispsy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,279 @@
1
+ Metadata-Version: 2.4
2
+ Name: hypnosis
3
+ Version: 0.1.0a1
4
+ Summary: Bounded harness execution, orchestration and a Carets application.
5
+ Author: ellainng
6
+ Author-email: ellainng <299958882+ellainng@users.noreply.github.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE.md
9
+ Requires-Dist: carets==0.2.0
10
+ Requires-Dist: expose-interface==0.1.0
11
+ Requires-Dist: hidden-moves==0.1.1 ; extra == 'application'
12
+ Requires-Dist: hidden-moves-workspace==0.1.0a2 ; extra == 'application'
13
+ Requires-Dist: parse-md==0.1.0 ; extra == 'application'
14
+ Requires-Dist: backpack-store==0.2.0 ; extra == 'application'
15
+ Requires-Dist: func-seq==0.1.0 ; extra == 'application'
16
+ Requires-Dist: headless-spreadsheets==0.1.1 ; extra == 'application'
17
+ Requires-Dist: hidden-moves-workspace==0.1.0a2 ; extra == 'context'
18
+ Requires-Dist: parse-md==0.1.0 ; extra == 'context'
19
+ Requires-Dist: parse-md==0.1.0 ; extra == 'data'
20
+ Requires-Dist: parse-mw==0.1.0 ; extra == 'data'
21
+ Requires-Dist: engl==0.1.0a1 ; extra == 'data'
22
+ Requires-Dist: thoughtform[thoughtformula]==0.1.0a1 ; extra == 'models'
23
+ Requires-Dist: backpack-store==0.2.0 ; extra == 'records'
24
+ Requires-Dist: hidden-moves==0.1.1 ; extra == 'tools'
25
+ Requires-Dist: parse-md==0.1.0 ; extra == 'training'
26
+ Requires-Dist: thoughtform[thoughtformula]==0.1.0a1 ; extra == 'training'
27
+ Requires-Dist: backpack-store==0.2.0 ; extra == 'training'
28
+ Requires-Dist: func-seq==0.1.0 ; extra == 'training'
29
+ Requires-Dist: engl==0.1.0a1 ; extra == 'training'
30
+ Requires-Dist: parse-mw==0.1.0 ; extra == 'training'
31
+ Requires-Dist: func-seq==0.1.0 ; extra == 'workflow'
32
+ Requires-Python: >=3.14
33
+ Project-URL: Source, https://github.com/wispsy/hypnosis
34
+ Project-URL: Project, https://github.com/orgs/wispsy/projects/28
35
+ Provides-Extra: application
36
+ Provides-Extra: context
37
+ Provides-Extra: data
38
+ Provides-Extra: models
39
+ Provides-Extra: records
40
+ Provides-Extra: tools
41
+ Provides-Extra: training
42
+ Provides-Extra: workflow
43
+ Description-Content-Type: text/markdown
44
+
45
+ # Hypnosis
46
+
47
+ Initial PyPI preview: **0.1.0a1**. Data and training use published
48
+ `parse-mw==0.1.0`; optional profiles select exact published package versions.
49
+ No weights or datasets are distributed. [Wispsy Releases](https://github.com/orgs/wispsy/projects/31)
50
+ tracks verified publication separately from current main development.
51
+
52
+ Bounded harness execution, orchestration and a Carets terminal application.
53
+ Python 3.14+. Source development is tracked in
54
+ [Cohesion Block B](https://github.com/orgs/wispsy/projects/28).
55
+
56
+ ```sh
57
+ uv sync
58
+ uv run hypnosis demo --text 'Hello from Hypnosis.'
59
+ uv run hypnosis terminal --text 'Live output in Carets.'
60
+ ```
61
+
62
+ `demo` uses a deterministic offline source and prints one JSON result. `terminal`
63
+ opens a Carets application on a supported POSIX terminal: Enter starts the run,
64
+ `c` cancels and `q` quits. There is one Program/TerminalSession owner. The
65
+ application displays a bounded text tail, escapes terminal control characters,
66
+ handles resize and closes producers before terminal restoration. Interactive
67
+ output uses stderr so command results remain separate on stdout.
68
+
69
+ Ordinary Python can use `Harness.stream(factory, run_id=..., control=...)` with
70
+ an async text source. The default limits are 4,096 events (including started and
71
+ terminal), 65,536 UTF-8 output bytes and 30 seconds including consumer delay.
72
+ Outcomes distinguish completion, cooperative cancellation, source failure and
73
+ budget exhaustion. External consumer/task cancellation propagates; cleanup does
74
+ not fabricate a successful terminal event. Producer exceptions are reported by
75
+ structural codes rather than private exception text. A limit may consume one
76
+ extra source item to discover exhaustion; effects of that item are not rolled
77
+ back.
78
+
79
+ `hypnosis.execution.from_sync(factory)` moves synchronous iteration and closure
80
+ to one owned worker with one `next()` in flight. Cancellation waits for that
81
+ operation before closing on the worker. It cannot forcibly stop Python code or
82
+ guarantee a hard inference deadline. `model_text(adapter, prompt)` adapts a
83
+ configured Thoughtform `ThoughtformulaModel` using the same mechanism. Install
84
+ `uv sync --extra models` to run the actual tiny-model integration tests; callers
85
+ still supply compatible model/tokenizer instances and serialize shared model
86
+ access. No model/data download, training or inference starts on import.
87
+
88
+ Selected tools use Hidden Moves catalogs; context uses Workspace and Parse MD;
89
+ durable jobs use func_seq; records use Backpack; training stays in Thoughtformula.
90
+ Measured harness trials use actual verifier outcomes and a heldout regression
91
+ gate with explicit promotion. Ollama remains deferred. Importing the package
92
+ never activates providers, trains weights or downloads data.
93
+
94
+ ## Harness workbench
95
+
96
+ ```sh
97
+ uv sync --extra application
98
+ uv run hypnosis application-demo
99
+ uv run hypnosis app
100
+ uv run hypnosis stream --text 'Incremental process output.'
101
+ ```
102
+
103
+ The application profile composes Carets 0.2.0's shared shell and typed snapshot
104
+ tables. The offline workflow retrieves a selected scratch document, calls an
105
+ explicit tool, verifies and repairs a saved artifact, and compares configurations
106
+ on validation/heldout cases. These are real service integrations using a small
107
+ deterministic exercise; they do not claim general autonomous problem solving.
108
+ `app` presents jobs, tools, context references, verification attempts, trials,
109
+ checkpoint metadata and private local output. Use 1–7 to change section, Tab to
110
+ change focus, arrows to navigate, c to cancel and q to quit. Press p to review a
111
+ promotion; the dialog defaults to Cancel and requires selecting Confirm.
112
+
113
+ Select `--database PATH` to retain structural receipts. Select both
114
+ `--checkpoint-database PATH --checkpoint-root PATH` to browse an existing
115
+ checkpoint collection read-only. With `--extra models` as well, `--artifact PATH`
116
+ loads an explicitly selected local Hero/Hero Coding sidecar for a bounded native
117
+ syntax probe. No generated Python is executed and syntax is not a functional
118
+ correctness test. No model weights change. See [application composition](docs/application.md),
119
+ [tools](docs/tools.md), [context](docs/context.md), [verification](docs/verification.md),
120
+ [trials](docs/optimization.md), [jobs](docs/orchestration.md) and
121
+ [process streams](docs/process-streams.md).
122
+
123
+ Verify with `PYTHONPATH=src python -m unittest discover -s tests`. CI builds and
124
+ checks wheel/source installations outside the checkout on Linux, macOS and
125
+ Windows, with and without the optional real-model profile. Native Windows
126
+ terminal interaction is not claimed by those headless checks.
127
+
128
+ See [the repository plan](IMPLEMENTATION_PLAN.md) and the
129
+ [complete family plan](https://github.com/wispsy/wispsy/blob/main/docs/cohesion-block-b/IMPLEMENTATION_PLAN.md).
130
+
131
+ ## Approved homegrown training data
132
+
133
+ The optional `data` profile reads explicitly selected local TinyStories,
134
+ Wikipedia multistream bz2/index, Wiktextract and UD files. `hypnosis.data` exposes
135
+ bounded corpus preparation with source snapshots, grouped held-out splits,
136
+ deduplication, citation markers and reproducible corpus receipts. It never
137
+ extracts the full Wikipedia dump or fetches reference URLs.
138
+
139
+ Source IDs are admitted by explicit reviewed catalogs. The internally generated
140
+ v1 pilot remains reproducible under [source review #13](https://github.com/wispsy/hypnosis/issues/13).
141
+ The later approved Python vault/tutorials, docs and wiki snapshots are tracked
142
+ under [source review #27](https://github.com/wispsy/hypnosis/issues/27); future
143
+ sources and recipe changes retain their own review. Fingerprints
144
+ are labeled stat-plus-head/tail samples, not full-dump checksum verification.
145
+ Exact selected corpus/block hashes retain reproducibility. Keep corpus outputs
146
+ in caller-owned ignored local artifact directories.
147
+
148
+ The optional `records` profile uses Backpack Store directly. `RunLedger` persists
149
+ versioned `TrainingReceipt`, `EvaluationReceipt` and `ArtifactReceipt` values at
150
+ an explicit local SQLite path. Records hold identities and measurements, without
151
+ source text or transcripts. A repeated matching write is idempotent for workflow
152
+ recovery; a conflicting receipt is refused. One workflow owns the job writer.
153
+
154
+ The optional `workflow` profile composes explicit trusted prepare, train,
155
+ evaluate and register callables with func_seq. `WorkflowIdentity` binds corpus,
156
+ source selection, recipe and job configuration into its version. Its existing
157
+ checkpoint preserves completed stages and requires explicit retry/restart after
158
+ an uncertain interrupted effect. Native numerical checkpoints remain separate.
159
+
160
+ `evaluation.measure_split` retains explicit held-out split denominators and
161
+ reports unknown-token exclusions, selected records, sequence/token counts and
162
+ missing splits without substituting training examples. The Thoughtformula
163
+ adapter reports token-weighted next-token loss/perplexity. Bounded syntax probes
164
+ parse generated continuations without executing them. These measures do not
165
+ establish factual accuracy, working code or autonomous agent capability.
166
+ `hypnosis.curriculum.generated_documents` implements the explicitly approved
167
+ `wispsy-internal-curriculum/v1` pilot: exact addition/multiplication answers and
168
+ Python addition, even-number filtering and list-sum references. Seeds and recipe
169
+ hashes identify the generated material. Related arithmetic and Python variants
170
+ share a split group. Reference code is authored and independently checked;
171
+ model-generated code is never executed. New recipes and sources require review.
172
+
173
+ ## Homegrown training
174
+
175
+ Install the `training` extra to select the complete pinned component profile.
176
+ The default import and demo remain lightweight.
177
+
178
+ ```sh
179
+ hypnosis prepare sources.json .corpora/pilot --documents-per-source 128
180
+ hypnosis train .corpora/pilot .runs/hero hero.json
181
+ hypnosis train-terminal .corpora/pilot .runs/hero-live hero-live.json
182
+ hypnosis train .corpora/pilot .runs/hero-coding coding.json \
183
+ --parent-artifact .runs/hero/artifact.json
184
+ ```
185
+
186
+ Create the parent `.corpora` and `.runs` directories explicitly. A source file is
187
+ a JSON list of approved `source_id`, local `path` and, for Wikipedia, `index`
188
+ selections. The approved generated source is `{"source_id":"internal-v1",
189
+ "path":"recipe"}`. New IDs remain rejected pending source review.
190
+
191
+ A job file is a closed JSON object such as:
192
+
193
+ ```json
194
+ {"run_id":"hero-pilot","model_id":"hero","max_steps":1000,
195
+ "max_seconds":240,"block_size":32,"seed":7,"shuffle":false}
196
+ ```
197
+
198
+ Hero Coding selects `"model_id":"hero-coding"` and an explicit Hero sidecar.
199
+ It preserves parent weights/tokenizer as a starting point, resets Adam for its own
200
+ trajectory and selects only approved internal Python exercises. Hero uses the
201
+ selected training split; tokenizer fitting sees training material only, with a
202
+ predeclared printable ASCII alphabet. Unknown text exclusions are counted.
203
+ Curriculum and shuffle runs consume the same fixed document windows.
204
+
205
+ Each new destination binds corpus/source/config/recipe/parent identities.
206
+ func_seq owns prepare/train/evaluate/register progress, Thoughtformula owns
207
+ lossless `.tft` numerical state and `.mgpt` inference exports, Thoughtform owns
208
+ the passive sidecar, and Backpack holds structural receipts. `result.json`
209
+ contains before/after held-out measurements and explicit denominators. Weights,
210
+ source corpora and local job directories stay outside Git.
211
+
212
+ Carets shows the same worker's progress. `c` cancels cooperatively at an optimizer
213
+ boundary and saves `latest.tft`; `q` requests cancellation before exiting. Use
214
+ `--retry` explicitly after reviewing an interrupted workflow. Completed stages
215
+ are not replayed. Changed job identities and reused foreign destinations are
216
+ refused. A new specialization and exact numerical resume are separate operations.
217
+ Time limits are checked at step boundaries; the bounded pilot launcher also
218
+ applies a hard combined process deadline. These pilot artifacts are experimental.
219
+
220
+ Wikipedia citation names are scoped by reference group. Explicit conflicting
221
+ bodies retain their own spans/URLs; an empty reuse of an ambiguous name stays
222
+ unresolved. Reused long bodies inherit truncation metadata. Preserved citation
223
+ associations remain provenance, not a verdict that the reference supports a claim.
224
+
225
+ Approved Python material sources now include `python-vault-tutorials`,
226
+ `python-vault-reference`, `psf-wiki-python` and `python314-docs`. Their approval
227
+ is recorded in issue #27. `bind_source(Source(...))` returns a complete selected
228
+ snapshot fingerprint; put that fingerprint in the selected Source before corpus
229
+ preparation. Changed/added selected files are rejected. Markdown uses Parse MD
230
+ source spans and code blocks; documentation members stream from the text archive
231
+ without extraction. References and derivation remain attached, and related page
232
+ chunks share a held-out group. Alternate documentation formats are not duplicate
233
+ training samples. Downloaded examples are data and are never executed.
234
+
235
+ The `balanced-v2` job profile selects the named larger recipes and interleaves
236
+ weighted source/document windows. Every selected source receives a quota; small
237
+ original sets may be deliberately oversampled, with unique/repeated counts
238
+ recorded. Tokenizer merges use a bounded balanced training sample, and its
239
+ alphabet includes all selected training characters. Hero Coding inherits that
240
+ frozen vocabulary. Actual consumed source windows/tokens and separate coding/
241
+ general held-out measurements are reported. `pilot-v1` remains the default and
242
+ retains its original config, tokenizer and window identities for old jobs and
243
+ matched comparisons. Losses across different tokenizers are not directly comparable.
244
+
245
+ Balanced-v2 jobs retain immutable `checkpoints/step-.../model.tft` snapshots and
246
+ verified sidecars at the selected checkpoint interval. Latest recovery state is
247
+ separate. A job keeps at most 128 history snapshots and 512 MiB of native history;
248
+ reaching either ceiling saves a final limited result without deleting history.
249
+ Typed Backpack collections retain model/profile/tokenizer/data/parent/continuation
250
+ identities and support bounded pages:
251
+
252
+ ```sh
253
+ hypnosis index-checkpoints .runs/my-run .runs/checkpoints.sqlite .runs
254
+ hypnosis checkpoints .runs/checkpoints.sqlite .runs --model-id hero --profile balanced-v2
255
+ hypnosis train .corpora/selected .runs/hero-next next.json \
256
+ --continue-artifact .runs/my-run/artifact.json
257
+ ```
258
+
259
+ Continuation preserves full weights, Adam and numerical order from a balanced-v2
260
+ checkpoint. It requires identical corpus, recipe, tokenizer, windows, learning
261
+ rate and ordering policy. Its step/time settings are additional budgets in a new
262
+ run directory; cumulative and per-job counters are both recorded. Specialization
263
+ uses `--parent-artifact` instead and resets Adam. These operations cannot be
264
+ combined. Every history/final context is passive data; no source code is loaded
265
+ from it. Index refresh is idempotent and does not train or mutate checkpoint bytes.
266
+
267
+
268
+ ### MediaWiki excerpt profile
269
+
270
+ The optional `data` and `training` profiles use `parse-mw==0.1.0` for typed
271
+ MediaWiki syntax. Hypnosis retains citation policy: exact original character
272
+ spans, named/grouped reuse, ambiguous definitions and bounded evidence URLs.
273
+ A small reference-span adapter handles self-closing and grouped references
274
+ before parsing; no template expansion, URL retrieval or external parser runs.
275
+ Comments and unexpanded templates are omitted from plain excerpts, link labels
276
+ and literal regions remain text. Up to 128 citation records and 4,096 scanned
277
+ references are admitted per article; input is capped at 4 Mi characters and the
278
+ syntax tree at 100,000 nodes/64 levels. Nested/unclosed references or conflicting
279
+ name/group attributes refuse rather than inventing citation provenance.