flux-spec 0.5.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 (32) hide show
  1. flux_spec-0.5.0/LICENSE +202 -0
  2. flux_spec-0.5.0/NOTICE +2 -0
  3. flux_spec-0.5.0/PKG-INFO +202 -0
  4. flux_spec-0.5.0/README.md +173 -0
  5. flux_spec-0.5.0/flux_spec/__init__.py +19 -0
  6. flux_spec-0.5.0/flux_spec/_paths.py +46 -0
  7. flux_spec-0.5.0/flux_spec/bundle.py +406 -0
  8. flux_spec-0.5.0/flux_spec/data/schema/flux-enforcement-0.5.0.json +121 -0
  9. flux_spec-0.5.0/flux_spec/data/schema/flux-manifest-0.5.0.json +153 -0
  10. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-0.2.0.json +465 -0
  11. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-0.3.0.json +876 -0
  12. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-0.4.0.json +1601 -0
  13. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-0.4.1.json +1668 -0
  14. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-0.5.0.json +1669 -0
  15. flux_spec-0.5.0/flux_spec/data/schema/flux-schema-latest.json +1669 -0
  16. flux_spec-0.5.0/flux_spec/data/schema/flux-ui-hints-0.4.0.json +795 -0
  17. flux_spec-0.5.0/flux_spec/data/schema/flux-ui-hints-0.4.1.json +852 -0
  18. flux_spec-0.5.0/flux_spec/data/schema/flux-ui-hints-0.5.0.json +852 -0
  19. flux_spec-0.5.0/flux_spec/data/vectors/enforcement-vectors.json +935 -0
  20. flux_spec-0.5.0/flux_spec/data/vendor/fluid/fluid-schema-0.7.3.json +5234 -0
  21. flux_spec-0.5.0/flux_spec/data/vendor/fluid/fluid-schema-0.7.4.json +5437 -0
  22. flux_spec-0.5.0/flux_spec/data/vendor/fluid/fluid-schema-0.7.5.json +5630 -0
  23. flux_spec-0.5.0/flux_spec/enforce.py +315 -0
  24. flux_spec-0.5.0/flux_spec/validate.py +535 -0
  25. flux_spec-0.5.0/flux_spec.egg-info/PKG-INFO +202 -0
  26. flux_spec-0.5.0/flux_spec.egg-info/SOURCES.txt +30 -0
  27. flux_spec-0.5.0/flux_spec.egg-info/dependency_links.txt +1 -0
  28. flux_spec-0.5.0/flux_spec.egg-info/requires.txt +3 -0
  29. flux_spec-0.5.0/flux_spec.egg-info/top_level.txt +1 -0
  30. flux_spec-0.5.0/pyproject.toml +54 -0
  31. flux_spec-0.5.0/setup.cfg +4 -0
  32. flux_spec-0.5.0/tests/test_regression.py +847 -0
@@ -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.
flux_spec-0.5.0/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ FLUX specification
2
+ Copyright 2026 The FLUX Project authors
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: flux-spec
3
+ Version: 0.5.0
4
+ Summary: FLUX reference validator, RFC-04 enforcement gate, and RFC-09 evidence bundler — the open, declarative standard for governed synthetic customer universes.
5
+ Author: Agenticstiger
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://agenticstiger.github.io/flux/
8
+ Project-URL: Repository, https://github.com/Agenticstiger/flux
9
+ Project-URL: Documentation, https://agenticstiger.github.io/flux/
10
+ Project-URL: Changelog, https://github.com/Agenticstiger/flux/blob/main/CHANGELOG.md
11
+ Keywords: flux,fluid,digital-twin,synthetic-data,simulation,data-products,declarative,json-schema
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: jsonschema
27
+ Requires-Dist: rfc8785
28
+ Dynamic: license-file
29
+
30
+ <h1 align="center">FLUX</h1>
31
+
32
+ <p align="center"><strong>Flow Language for Universe eXperimentation</strong></p>
33
+ <p align="center">The open, declarative standard for governed synthetic customer universes — the discovery-side sibling of <a href="https://github.com/open-data-protocol/fluid">FLUID</a>.</p>
34
+
35
+ <p align="center">
36
+ <a href="https://agenticstiger.github.io/flux/">📖 Documentation</a> ·
37
+ <a href="https://agenticstiger.github.io/flux/guide/quickstart.html">🚀 Quickstart</a> ·
38
+ <a href="https://agenticstiger.github.io/flux/schema/kinds.html">🧭 The Nineteen Kinds</a> ·
39
+ <a href="https://agenticstiger.github.io/flux/concepts/seam.html">🔗 The FLUID Seam</a> ·
40
+ <a href="https://agenticstiger.github.io/flux/roadmap/">🗺️ Roadmap</a> ·
41
+ <a href="https://agenticstiger.github.io/flux/releases/0.5.0.html">✨ What's New</a>
42
+ </p>
43
+
44
+ ---
45
+
46
+ FLUX describes **synthetic customer universes**: a governed digital twin in
47
+ which candidate rules and data products are discovered, stress-tested and
48
+ proven *before* a single production system is touched. A FLUX universe is
49
+ assembled from small declarative documents — nineteen kinds across six
50
+ families — and a `Simulation` emits its results under a
51
+ [FLUID](https://github.com/open-data-protocol/fluid) data-product contract:
52
+ **what is proven in the twin is byte-for-byte the contract that ships.**
53
+
54
+ ```
55
+ FLUX discovers. FLUID delivers. The seam is where the risk goes to die.
56
+ ```
57
+
58
+ ## Status
59
+
60
+ **v0.5.0 — working draft.** All nine [vNext RFCs](docs/roadmap/rfcs.md) are
61
+ shipped additively on the 0.3.0 core — the spec now carries a runtime
62
+ enforcement contract with conformance vectors and portable, signable evidence
63
+ bundles alongside the declarative core. Pre-1.0: minor versions may break; every release
64
+ ships with a [schema diff](schema-diffs/) and a regression suite. The design
65
+ is documented in the position paper *"FLUX and FLUID"* (distributed separately
66
+ under CC BY 4.0); where the paper and this schema disagreed,
67
+ [docs/reconciliation.md](docs/reconciliation.md) is the honest ledger.
68
+
69
+ ## The nineteen kinds
70
+
71
+ | Family | Kinds | Question it answers |
72
+ |---|---|---|
73
+ | Population | World, Persona, Segment | *Who* is in the universe |
74
+ | Commerce | Catalog, Offer, Channel, ConsentProfile | *What* can be sold, *how* it can be reached |
75
+ | Behaviour | Journey, JourneyTaxonomy, Signal, Detector | *What happens* and *what to watch for* |
76
+ | Activation | Campaign, Treatment, Experiment | *What we do* about it |
77
+ | Calibration | Playback | *How the twin stays honest* |
78
+ | Composition | Simulation, Module, Blueprint, VerticalPack | *How it assembles* and *travels* |
79
+
80
+ Every document shares one envelope, aligned with FLUID's:
81
+
82
+ ```yaml
83
+ fluxVersion: "0.5.0"
84
+ kind: World
85
+ id: q3-retention-world
86
+ name: Q3 Retention World
87
+ metadata:
88
+ owner:
89
+ team: growth-lab
90
+ spec:
91
+ seed: 42
92
+ population:
93
+ size: 25000
94
+ lifecycleMix: { new: 0.15, active: 0.55, atrisk: 0.20, churned: 0.10 }
95
+ ```
96
+
97
+ Any kind may additionally declare `agentPolicy` (model allow-list, token
98
+ budget, use-case limits) and `skills` — the uniform agentic extension point.
99
+ A skill never changes the shape a kind must satisfy, only the content it emits
100
+ within those bounds.
101
+
102
+ ## The FLUID seam
103
+
104
+ A `Simulation` emits streams by **referencing** the FLUID contract they are
105
+ proven under — never by restating it:
106
+
107
+ ```yaml
108
+ spec:
109
+ worldRef: q3-retention-world
110
+ emits:
111
+ - productRef: telco.gold.payment_recovery_moment # a .fluid.yml in the bundle
112
+ exposeId: payment_recovery_moment # an expose of that product
113
+ fluidVersion: "0.7.5" # validated against the vendored FLUID schema
114
+ ```
115
+
116
+ The offline validator resolves the reference, validates the `.fluid.yml`
117
+ against the vendored FLUID schema for the pinned version, and asserts the
118
+ expose exists. Promotion to production is not a re-implementation: the same
119
+ contract file is wrapped around the real estate.
120
+
121
+ ## Validate a bundle
122
+
123
+ ```bash
124
+ pip install jsonschema pyyaml rfc8785
125
+ python3 scripts/validate.py examples/telco-payment-recovery # schema + cross-document
126
+ python3 scripts/enforce.py # RFC-04 conformance vectors
127
+ python3 scripts/bundle.py pack examples/telco-payment-recovery -o dist/ # RFC-09 evidence bundle
128
+ ```
129
+
130
+ Two layers, both offline (no cloud, no running engine):
131
+
132
+ 1. **Schema** — every `*.flux.yml` against [`schema/flux-schema-0.5.0.json`](schema/flux-schema-0.5.0.json)
133
+ (JSON Schema 2020-12, closed specs, typed everything).
134
+ 2. **Cross-document** — every reference resolves to the right kind (no
135
+ dangling links), mixes and weights sum to 1, transitions stay inside their
136
+ taxonomies, skills stay inside their `agentPolicy`, and the FLUID seam conforms.
137
+
138
+ Use the schema in your editor:
139
+
140
+ ```yaml
141
+ # yaml-language-server: $schema=https://agenticstiger.github.io/flux/schema/flux-schema-0.5.0.json
142
+ ```
143
+
144
+ ## As a library
145
+
146
+ `flux_spec` is also an installable Python package — the exact code behind
147
+ `scripts/validate.py`, `scripts/enforce.py` and `scripts/bundle.py`, not a
148
+ reimplementation; the three scripts are thin shims onto it. It is not yet on
149
+ PyPI, so install it from source for now:
150
+
151
+ ```bash
152
+ git clone https://github.com/Agenticstiger/flux.git && cd flux
153
+ pip install .
154
+ ```
155
+
156
+ ```python
157
+ from flux_spec.validate import Bundle
158
+ from flux_spec.enforce import decide, run_vectors
159
+ from flux_spec.bundle import pack, verify
160
+ ```
161
+
162
+ `python3 scripts/validate.py ...` and `python3 -m flux_spec.validate ...`
163
+ behave identically — same for `enforce` and `bundle`.
164
+
165
+ ## Example
166
+
167
+ [`examples/telco-payment-recovery/`](examples/telco-payment-recovery/) is the
168
+ paper's worked example, complete: all nineteen kinds plus the FLUID contract
169
+ at the seam, green under CI.
170
+
171
+ ## Repository layout
172
+
173
+ ```
174
+ schema/ flux-schema-<version>.json (+ -latest alias) — normative
175
+ schema-diffs/ one diff document per version pair
176
+ examples/ validated bundles (CI-enforced)
177
+ vendor/fluid/ vendored FLUID schemas the seam validates against
178
+ flux_spec/ the flux-spec package: validate.py · enforce.py (RFC-04) · bundle.py (RFC-09)
179
+ scripts/ validate.py / enforce.py / bundle.py — thin CLI shims onto flux_spec
180
+ tests/ regression suite + published enforcement conformance vectors
181
+ docs/ reconciliation ledger
182
+ ```
183
+
184
+ ## Relationship to FLUID
185
+
186
+ [FLUID](https://github.com/open-data-protocol/fluid) is the data-product
187
+ contract standard (MIT, [open-data-protocol](https://github.com/open-data-protocol)).
188
+ FLUX is the experimentation language that emits FLUID contracts. They are
189
+ separate standards with separate schemas, designed to interlock at exactly one
190
+ seam. This repo vendors FLUID schemas for offline seam validation; it does not
191
+ fork or redefine them.
192
+
193
+ ## License
194
+
195
+ [Apache License 2.0](LICENSE). The originating position paper is distributed
196
+ separately under CC BY 4.0 by The FLUX Project.
197
+
198
+ ## Contributing
199
+
200
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [GOVERNANCE.md](GOVERNANCE.md) and
201
+ [VERSIONING.md](VERSIONING.md). Spec changes travel as one PR touching schema
202
+ + diff + examples + tests together.
@@ -0,0 +1,173 @@
1
+ <h1 align="center">FLUX</h1>
2
+
3
+ <p align="center"><strong>Flow Language for Universe eXperimentation</strong></p>
4
+ <p align="center">The open, declarative standard for governed synthetic customer universes — the discovery-side sibling of <a href="https://github.com/open-data-protocol/fluid">FLUID</a>.</p>
5
+
6
+ <p align="center">
7
+ <a href="https://agenticstiger.github.io/flux/">📖 Documentation</a> ·
8
+ <a href="https://agenticstiger.github.io/flux/guide/quickstart.html">🚀 Quickstart</a> ·
9
+ <a href="https://agenticstiger.github.io/flux/schema/kinds.html">🧭 The Nineteen Kinds</a> ·
10
+ <a href="https://agenticstiger.github.io/flux/concepts/seam.html">🔗 The FLUID Seam</a> ·
11
+ <a href="https://agenticstiger.github.io/flux/roadmap/">🗺️ Roadmap</a> ·
12
+ <a href="https://agenticstiger.github.io/flux/releases/0.5.0.html">✨ What's New</a>
13
+ </p>
14
+
15
+ ---
16
+
17
+ FLUX describes **synthetic customer universes**: a governed digital twin in
18
+ which candidate rules and data products are discovered, stress-tested and
19
+ proven *before* a single production system is touched. A FLUX universe is
20
+ assembled from small declarative documents — nineteen kinds across six
21
+ families — and a `Simulation` emits its results under a
22
+ [FLUID](https://github.com/open-data-protocol/fluid) data-product contract:
23
+ **what is proven in the twin is byte-for-byte the contract that ships.**
24
+
25
+ ```
26
+ FLUX discovers. FLUID delivers. The seam is where the risk goes to die.
27
+ ```
28
+
29
+ ## Status
30
+
31
+ **v0.5.0 — working draft.** All nine [vNext RFCs](docs/roadmap/rfcs.md) are
32
+ shipped additively on the 0.3.0 core — the spec now carries a runtime
33
+ enforcement contract with conformance vectors and portable, signable evidence
34
+ bundles alongside the declarative core. Pre-1.0: minor versions may break; every release
35
+ ships with a [schema diff](schema-diffs/) and a regression suite. The design
36
+ is documented in the position paper *"FLUX and FLUID"* (distributed separately
37
+ under CC BY 4.0); where the paper and this schema disagreed,
38
+ [docs/reconciliation.md](docs/reconciliation.md) is the honest ledger.
39
+
40
+ ## The nineteen kinds
41
+
42
+ | Family | Kinds | Question it answers |
43
+ |---|---|---|
44
+ | Population | World, Persona, Segment | *Who* is in the universe |
45
+ | Commerce | Catalog, Offer, Channel, ConsentProfile | *What* can be sold, *how* it can be reached |
46
+ | Behaviour | Journey, JourneyTaxonomy, Signal, Detector | *What happens* and *what to watch for* |
47
+ | Activation | Campaign, Treatment, Experiment | *What we do* about it |
48
+ | Calibration | Playback | *How the twin stays honest* |
49
+ | Composition | Simulation, Module, Blueprint, VerticalPack | *How it assembles* and *travels* |
50
+
51
+ Every document shares one envelope, aligned with FLUID's:
52
+
53
+ ```yaml
54
+ fluxVersion: "0.5.0"
55
+ kind: World
56
+ id: q3-retention-world
57
+ name: Q3 Retention World
58
+ metadata:
59
+ owner:
60
+ team: growth-lab
61
+ spec:
62
+ seed: 42
63
+ population:
64
+ size: 25000
65
+ lifecycleMix: { new: 0.15, active: 0.55, atrisk: 0.20, churned: 0.10 }
66
+ ```
67
+
68
+ Any kind may additionally declare `agentPolicy` (model allow-list, token
69
+ budget, use-case limits) and `skills` — the uniform agentic extension point.
70
+ A skill never changes the shape a kind must satisfy, only the content it emits
71
+ within those bounds.
72
+
73
+ ## The FLUID seam
74
+
75
+ A `Simulation` emits streams by **referencing** the FLUID contract they are
76
+ proven under — never by restating it:
77
+
78
+ ```yaml
79
+ spec:
80
+ worldRef: q3-retention-world
81
+ emits:
82
+ - productRef: telco.gold.payment_recovery_moment # a .fluid.yml in the bundle
83
+ exposeId: payment_recovery_moment # an expose of that product
84
+ fluidVersion: "0.7.5" # validated against the vendored FLUID schema
85
+ ```
86
+
87
+ The offline validator resolves the reference, validates the `.fluid.yml`
88
+ against the vendored FLUID schema for the pinned version, and asserts the
89
+ expose exists. Promotion to production is not a re-implementation: the same
90
+ contract file is wrapped around the real estate.
91
+
92
+ ## Validate a bundle
93
+
94
+ ```bash
95
+ pip install jsonschema pyyaml rfc8785
96
+ python3 scripts/validate.py examples/telco-payment-recovery # schema + cross-document
97
+ python3 scripts/enforce.py # RFC-04 conformance vectors
98
+ python3 scripts/bundle.py pack examples/telco-payment-recovery -o dist/ # RFC-09 evidence bundle
99
+ ```
100
+
101
+ Two layers, both offline (no cloud, no running engine):
102
+
103
+ 1. **Schema** — every `*.flux.yml` against [`schema/flux-schema-0.5.0.json`](schema/flux-schema-0.5.0.json)
104
+ (JSON Schema 2020-12, closed specs, typed everything).
105
+ 2. **Cross-document** — every reference resolves to the right kind (no
106
+ dangling links), mixes and weights sum to 1, transitions stay inside their
107
+ taxonomies, skills stay inside their `agentPolicy`, and the FLUID seam conforms.
108
+
109
+ Use the schema in your editor:
110
+
111
+ ```yaml
112
+ # yaml-language-server: $schema=https://agenticstiger.github.io/flux/schema/flux-schema-0.5.0.json
113
+ ```
114
+
115
+ ## As a library
116
+
117
+ `flux_spec` is also an installable Python package — the exact code behind
118
+ `scripts/validate.py`, `scripts/enforce.py` and `scripts/bundle.py`, not a
119
+ reimplementation; the three scripts are thin shims onto it. It is not yet on
120
+ PyPI, so install it from source for now:
121
+
122
+ ```bash
123
+ git clone https://github.com/Agenticstiger/flux.git && cd flux
124
+ pip install .
125
+ ```
126
+
127
+ ```python
128
+ from flux_spec.validate import Bundle
129
+ from flux_spec.enforce import decide, run_vectors
130
+ from flux_spec.bundle import pack, verify
131
+ ```
132
+
133
+ `python3 scripts/validate.py ...` and `python3 -m flux_spec.validate ...`
134
+ behave identically — same for `enforce` and `bundle`.
135
+
136
+ ## Example
137
+
138
+ [`examples/telco-payment-recovery/`](examples/telco-payment-recovery/) is the
139
+ paper's worked example, complete: all nineteen kinds plus the FLUID contract
140
+ at the seam, green under CI.
141
+
142
+ ## Repository layout
143
+
144
+ ```
145
+ schema/ flux-schema-<version>.json (+ -latest alias) — normative
146
+ schema-diffs/ one diff document per version pair
147
+ examples/ validated bundles (CI-enforced)
148
+ vendor/fluid/ vendored FLUID schemas the seam validates against
149
+ flux_spec/ the flux-spec package: validate.py · enforce.py (RFC-04) · bundle.py (RFC-09)
150
+ scripts/ validate.py / enforce.py / bundle.py — thin CLI shims onto flux_spec
151
+ tests/ regression suite + published enforcement conformance vectors
152
+ docs/ reconciliation ledger
153
+ ```
154
+
155
+ ## Relationship to FLUID
156
+
157
+ [FLUID](https://github.com/open-data-protocol/fluid) is the data-product
158
+ contract standard (MIT, [open-data-protocol](https://github.com/open-data-protocol)).
159
+ FLUX is the experimentation language that emits FLUID contracts. They are
160
+ separate standards with separate schemas, designed to interlock at exactly one
161
+ seam. This repo vendors FLUID schemas for offline seam validation; it does not
162
+ fork or redefine them.
163
+
164
+ ## License
165
+
166
+ [Apache License 2.0](LICENSE). The originating position paper is distributed
167
+ separately under CC BY 4.0 by The FLUX Project.
168
+
169
+ ## Contributing
170
+
171
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [GOVERNANCE.md](GOVERNANCE.md) and
172
+ [VERSIONING.md](VERSIONING.md). Spec changes travel as one PR touching schema
173
+ + diff + examples + tests together.
@@ -0,0 +1,19 @@
1
+ """flux_spec — the FLUX reference validator, RFC-04 enforcement gate, and
2
+ RFC-09 evidence bundler, as an installable package.
3
+
4
+ from flux_spec.validate import Bundle
5
+ from flux_spec.enforce import decide, run_vectors
6
+ from flux_spec.bundle import pack, verify
7
+
8
+ `scripts/validate.py`, `scripts/enforce.py` and `scripts/bundle.py` at the
9
+ repo root remain the documented CLI entry points — they are thin shims onto
10
+ this package, so command-line behaviour is unchanged.
11
+ """
12
+
13
+ __version__ = "0.5.0"
14
+
15
+ # The FLUX schema version this package's vendored/packaged data matches
16
+ # (schema/flux-schema-<SCHEMA_VERSION>.json, i.e. the current "latest").
17
+ SCHEMA_VERSION = "0.5.0"
18
+
19
+ __all__ = ["__version__", "SCHEMA_VERSION"]
@@ -0,0 +1,46 @@
1
+ """Resource path resolution for flux_spec.
2
+
3
+ Two ways to run this package, one set of bytes:
4
+
5
+ * **Source checkout** — `flux_spec/` sits at the repo root next to `schema/`,
6
+ `vendor/fluid/` and `tests/`. Those are canonical: a contributor edits them
7
+ directly, and CI validates them in place.
8
+ * **Installed distribution** (`pip install flux-spec` or `pip install .`) —
9
+ there is no `schema/` next to the installed package, only the committed
10
+ copies under `flux_spec/data/` (kept in sync with the canonical files by
11
+ `scripts/sync-package-data.py`, gated in CI by a `git diff --exit-code`).
12
+ Those are read back via `importlib.resources` rather than a hardcoded
13
+ site-packages path.
14
+
15
+ Detection is a single filesystem check: does `schema/` exist next to this
16
+ package's parent directory?
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import importlib.resources
22
+ from pathlib import Path
23
+
24
+ _PACKAGE_DIR = Path(__file__).resolve().parent
25
+ REPO = _PACKAGE_DIR.parent
26
+ _SOURCE_CHECKOUT = (REPO / "schema").is_dir()
27
+
28
+
29
+ def _packaged(*parts: str) -> Path:
30
+ return Path(importlib.resources.files("flux_spec").joinpath("data", *parts))
31
+
32
+
33
+ def schema_dir() -> Path:
34
+ return (REPO / "schema") if _SOURCE_CHECKOUT else _packaged("schema")
35
+
36
+
37
+ def vendor_fluid_dir() -> Path:
38
+ return (REPO / "vendor" / "fluid") if _SOURCE_CHECKOUT else _packaged("vendor", "fluid")
39
+
40
+
41
+ def enforcement_vectors_path() -> Path:
42
+ return (
43
+ (REPO / "tests" / "enforcement-vectors.json")
44
+ if _SOURCE_CHECKOUT
45
+ else _packaged("vectors", "enforcement-vectors.json")
46
+ )