fjp-conformance 0.1.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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Flow Information Systems
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,16 @@
1
+ Flow Judgment Protocol Conformance (FJP-CONF)
2
+ Copyright 2026 Flow Information Systems
3
+
4
+ This product was created and is maintained by Flow Information Systems
5
+ (https://flowinfo.co).
6
+
7
+ Flow Judgment Protocol™, FJP™, FJP-CONF™, Judgment-Grounded Agent™,
8
+ Judgment-Grounded™, Flow™, and Flow Information Systems™, together with the
9
+ tagline "DNS resolves location. Flow resolves importance."™, are trademarks of
10
+ Flow Information Systems. See TRADEMARKS.md for the trademark usage policy.
11
+
12
+ The Apache License, Version 2.0 (LICENSE) governs use of the source code in this
13
+ repository. It does not grant any right to use the trademarks listed above.
14
+
15
+ This NOTICE file must be preserved in redistributions of this work, per Section 4
16
+ of the Apache License, Version 2.0.
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: fjp-conformance
3
+ Version: 0.1.0
4
+ Summary: FJP-CONF v0.1 — behavioral conformance suite for Judgment-Grounded Agents.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=7; extra == "dev"
12
+ Dynamic: license-file
13
+
14
+ # FJP-CONF — Flow Judgment Protocol Conformance
15
+
16
+ **Flow Judgment Protocol™ (FJP)** is the judgment layer for AI agents and
17
+ enterprise decision systems. It determines what changed, whether it matters, what
18
+ matters most, and what should happen next.
19
+
20
+ **FJP-CONF** is the public, vendor-neutral conformance standard for FJP. It defines
21
+ what it means for an agent to make **accountable** decisions — decisions that can
22
+ be traced, challenged, and audited — and ships a runnable test suite so any
23
+ developer can verify their own agent.
24
+
25
+ - **Specification:** [`spec/v0.1.md`](./spec/v0.1.md) · field reference: [`spec/schema.md`](./spec/schema.md)
26
+ - **Canonical URL:** https://fjp.flowinfo.co/conformance/v0.1
27
+ - **Status:** v0.1.0 — public draft
28
+
29
+ FJP-CONF tests an agent's **observable output**, not its internal method. Two
30
+ agents may reach opposite conclusions and both conform. Conformance asserts that a
31
+ decision is *accountable* — not that it is *correct*.
32
+
33
+ ## The idea in one paragraph
34
+
35
+ Retrieval-grade systems answer *what is true*. They do not answer *was this worth
36
+ acting on, and how would we know if it wasn't*. When an agent acts, three questions
37
+ must be answerable afterward: what did it act on, why did it judge that worth acting
38
+ on, and what would have made that judgment wrong. FJP-CONF defines the minimum
39
+ externalized structure — the **Judgment-Grounded Record** — that makes those
40
+ questions answerable, independent of how the agent decides.
41
+
42
+ ## The Judgment-Grounded Record
43
+
44
+ For every action it recommends or takes, a conforming agent emits a record with
45
+ four components:
46
+
47
+ | Component | Answers |
48
+ |-------------|---------------------|
49
+ | `signal` | what changed |
50
+ | `judgment` | why it matters |
51
+ | `action` | what should happen |
52
+ | `falsifier` | what would make it wrong |
53
+
54
+ ## Conformance levels
55
+
56
+ | Level | Name | Adds |
57
+ |-------|--------------|-------------------------------------------------------------|
58
+ | L0 | Structural | A well-formed record with all four components. |
59
+ | L1 | Grounded | Attributable signal; the action traces back to it. |
60
+ | L2 | Falsifiable | A concrete, checkable condition that would reverse the call. |
61
+ | L3 | Accountable | Records are retained and the falsifier can be re-evaluated. |
62
+
63
+ ## Quickstart
64
+
65
+ Requires Python 3.11+. No third-party dependencies.
66
+
67
+ ```bash
68
+ # validate a record at Level 2
69
+ python -m conformance.runner examples/passing_agent.json --level 2
70
+
71
+ # a non-conforming record
72
+ python -m conformance.runner examples/failing_agent.json --level 2
73
+ ```
74
+
75
+ Exit codes: `0` conforms · `1` does not conform · `2` invalid input.
76
+
77
+ Programmatic use:
78
+
79
+ ```python
80
+ from conformance import evaluate, conforms
81
+
82
+ results = evaluate(record, level=2)
83
+ print(conforms(results))
84
+ ```
85
+
86
+ Level 3 requires your agent to implement a small adapter
87
+ (`get_record`, `evaluate_falsifier`); see [`conformance/adapter.py`](./conformance/adapter.py)
88
+ and [`examples/passing_agent_l3.py`](./examples/passing_agent_l3.py).
89
+
90
+ Run the tests:
91
+
92
+ ```bash
93
+ python -m pytest -q
94
+ ```
95
+
96
+ ## Claiming conformance
97
+
98
+ A conformance claim names a level and version and is reproducible by running this
99
+ suite against your agent's output:
100
+
101
+ > "Conforms to FJP-CONF v0.1, Level 2."
102
+
103
+ Authoritative verification and any official FJP-CONF certification are administered
104
+ by Flow Information Systems. This open suite lets anyone self-check; see
105
+ [`TRADEMARKS.md`](./TRADEMARKS.md) for what you may and may not call your
106
+ implementation.
107
+
108
+ ## License and trademarks
109
+
110
+ Source code is licensed under the Apache License, Version 2.0 — see
111
+ [`LICENSE`](./LICENSE). The code license does **not** grant rights in the
112
+ trademarks.
113
+
114
+ **Flow Judgment Protocol™, FJP™, FJP-CONF™, Judgment-Grounded Agent™,** and
115
+ **"DNS resolves location. Flow resolves importance."™** are trademarks of
116
+ **Flow Information Systems** (https://flowinfo.co). See [`NOTICE`](./NOTICE) and
117
+ [`TRADEMARKS.md`](./TRADEMARKS.md).
@@ -0,0 +1,104 @@
1
+ # FJP-CONF — Flow Judgment Protocol Conformance
2
+
3
+ **Flow Judgment Protocol™ (FJP)** is the judgment layer for AI agents and
4
+ enterprise decision systems. It determines what changed, whether it matters, what
5
+ matters most, and what should happen next.
6
+
7
+ **FJP-CONF** is the public, vendor-neutral conformance standard for FJP. It defines
8
+ what it means for an agent to make **accountable** decisions — decisions that can
9
+ be traced, challenged, and audited — and ships a runnable test suite so any
10
+ developer can verify their own agent.
11
+
12
+ - **Specification:** [`spec/v0.1.md`](./spec/v0.1.md) · field reference: [`spec/schema.md`](./spec/schema.md)
13
+ - **Canonical URL:** https://fjp.flowinfo.co/conformance/v0.1
14
+ - **Status:** v0.1.0 — public draft
15
+
16
+ FJP-CONF tests an agent's **observable output**, not its internal method. Two
17
+ agents may reach opposite conclusions and both conform. Conformance asserts that a
18
+ decision is *accountable* — not that it is *correct*.
19
+
20
+ ## The idea in one paragraph
21
+
22
+ Retrieval-grade systems answer *what is true*. They do not answer *was this worth
23
+ acting on, and how would we know if it wasn't*. When an agent acts, three questions
24
+ must be answerable afterward: what did it act on, why did it judge that worth acting
25
+ on, and what would have made that judgment wrong. FJP-CONF defines the minimum
26
+ externalized structure — the **Judgment-Grounded Record** — that makes those
27
+ questions answerable, independent of how the agent decides.
28
+
29
+ ## The Judgment-Grounded Record
30
+
31
+ For every action it recommends or takes, a conforming agent emits a record with
32
+ four components:
33
+
34
+ | Component | Answers |
35
+ |-------------|---------------------|
36
+ | `signal` | what changed |
37
+ | `judgment` | why it matters |
38
+ | `action` | what should happen |
39
+ | `falsifier` | what would make it wrong |
40
+
41
+ ## Conformance levels
42
+
43
+ | Level | Name | Adds |
44
+ |-------|--------------|-------------------------------------------------------------|
45
+ | L0 | Structural | A well-formed record with all four components. |
46
+ | L1 | Grounded | Attributable signal; the action traces back to it. |
47
+ | L2 | Falsifiable | A concrete, checkable condition that would reverse the call. |
48
+ | L3 | Accountable | Records are retained and the falsifier can be re-evaluated. |
49
+
50
+ ## Quickstart
51
+
52
+ Requires Python 3.11+. No third-party dependencies.
53
+
54
+ ```bash
55
+ # validate a record at Level 2
56
+ python -m conformance.runner examples/passing_agent.json --level 2
57
+
58
+ # a non-conforming record
59
+ python -m conformance.runner examples/failing_agent.json --level 2
60
+ ```
61
+
62
+ Exit codes: `0` conforms · `1` does not conform · `2` invalid input.
63
+
64
+ Programmatic use:
65
+
66
+ ```python
67
+ from conformance import evaluate, conforms
68
+
69
+ results = evaluate(record, level=2)
70
+ print(conforms(results))
71
+ ```
72
+
73
+ Level 3 requires your agent to implement a small adapter
74
+ (`get_record`, `evaluate_falsifier`); see [`conformance/adapter.py`](./conformance/adapter.py)
75
+ and [`examples/passing_agent_l3.py`](./examples/passing_agent_l3.py).
76
+
77
+ Run the tests:
78
+
79
+ ```bash
80
+ python -m pytest -q
81
+ ```
82
+
83
+ ## Claiming conformance
84
+
85
+ A conformance claim names a level and version and is reproducible by running this
86
+ suite against your agent's output:
87
+
88
+ > "Conforms to FJP-CONF v0.1, Level 2."
89
+
90
+ Authoritative verification and any official FJP-CONF certification are administered
91
+ by Flow Information Systems. This open suite lets anyone self-check; see
92
+ [`TRADEMARKS.md`](./TRADEMARKS.md) for what you may and may not call your
93
+ implementation.
94
+
95
+ ## License and trademarks
96
+
97
+ Source code is licensed under the Apache License, Version 2.0 — see
98
+ [`LICENSE`](./LICENSE). The code license does **not** grant rights in the
99
+ trademarks.
100
+
101
+ **Flow Judgment Protocol™, FJP™, FJP-CONF™, Judgment-Grounded Agent™,** and
102
+ **"DNS resolves location. Flow resolves importance."™** are trademarks of
103
+ **Flow Information Systems** (https://flowinfo.co). See [`NOTICE`](./NOTICE) and
104
+ [`TRADEMARKS.md`](./TRADEMARKS.md).
@@ -0,0 +1,25 @@
1
+ """FJP-CONF v0.1 — Judgment-Grounded Agent conformance suite."""
2
+
3
+ from .schema import SPEC_VERSION
4
+ from .checks import (
5
+ Result,
6
+ check_l0,
7
+ check_l1,
8
+ check_l2,
9
+ check_l3,
10
+ evaluate,
11
+ conforms,
12
+ )
13
+ from .adapter import JudgmentGroundedAgent
14
+
15
+ __all__ = [
16
+ "SPEC_VERSION",
17
+ "Result",
18
+ "check_l0",
19
+ "check_l1",
20
+ "check_l2",
21
+ "check_l3",
22
+ "evaluate",
23
+ "conforms",
24
+ "JudgmentGroundedAgent",
25
+ ]
@@ -0,0 +1,30 @@
1
+ """FJP-CONF v0.1 — L3 agent adapter interface.
2
+
3
+ An agent claiming Level 3 (Accountable) implements this protocol so the
4
+ conformance suite can retrieve a past record and re-evaluate its falsifier.
5
+ The suite tests the *interface behavior*, never the agent's internal method.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Protocol, runtime_checkable
11
+
12
+
13
+ @runtime_checkable
14
+ class JudgmentGroundedAgent(Protocol):
15
+ """Minimal interface an L3-conformant agent must expose."""
16
+
17
+ def get_record(self, record_id: str) -> dict:
18
+ """Return the stored Judgment-Grounded Record for `record_id`.
19
+
20
+ MUST return a dict whose `record_id` equals the argument and which is a
21
+ valid (L0) JGR. MAY raise if the id is unknown.
22
+ """
23
+ ...
24
+
25
+ def evaluate_falsifier(self, record_id: str) -> str:
26
+ """Re-evaluate the record's falsifier against the current world.
27
+
28
+ MUST return one of: "open", "triggered", "expired".
29
+ """
30
+ ...
@@ -0,0 +1,209 @@
1
+ """FJP-CONF v0.1 — conformance checks.
2
+
3
+ Each check function returns a list of Result tuples. A record conforms to a level
4
+ if every check at that level (and below) passes. Stdlib only.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import datetime as _dt
10
+ from typing import List, NamedTuple
11
+
12
+ from . import schema
13
+
14
+
15
+ class Result(NamedTuple):
16
+ check_id: str
17
+ level: int
18
+ passed: bool
19
+ detail: str
20
+
21
+
22
+ # ----------------------------------------------------------------------------- #
23
+ # helpers
24
+ # ----------------------------------------------------------------------------- #
25
+
26
+ def _is_nonempty_str(v) -> bool:
27
+ return isinstance(v, str) and v.strip() != ""
28
+
29
+
30
+ def _valid_iso8601(v) -> bool:
31
+ if not isinstance(v, str) or not v.strip():
32
+ return False
33
+ s = v.strip().replace("Z", "+00:00")
34
+ try:
35
+ _dt.datetime.fromisoformat(s)
36
+ return True
37
+ except ValueError:
38
+ return False
39
+
40
+
41
+ def _obj(record: dict, key: str) -> dict:
42
+ v = record.get(key)
43
+ return v if isinstance(v, dict) else {}
44
+
45
+
46
+ # ----------------------------------------------------------------------------- #
47
+ # L0 — structural
48
+ # ----------------------------------------------------------------------------- #
49
+
50
+ def check_l0(record: dict) -> List[Result]:
51
+ r: List[Result] = []
52
+ add = lambda cid, ok, msg: r.append(Result(cid, 0, ok, msg))
53
+
54
+ # Defensive: a record must be a JSON object. Guard here so every caller
55
+ # (CLI, tests, and any future hosted verifier) fails cleanly instead of
56
+ # crashing on adversarial or malformed input.
57
+ if not isinstance(record, dict):
58
+ add("L0.record.is_object", False,
59
+ f"record must be a JSON object (got {type(record).__name__})")
60
+ return r
61
+
62
+ add("L0.record_id", _is_nonempty_str(record.get("record_id")),
63
+ "record_id must be a non-empty string")
64
+ add("L0.timestamp", _valid_iso8601(record.get("timestamp")),
65
+ "timestamp must be valid ISO 8601")
66
+
67
+ for comp in ("signal", "judgment", "action", "falsifier"):
68
+ add(f"L0.{comp}.present", isinstance(record.get(comp), dict),
69
+ f"{comp} must be present and an object")
70
+
71
+ sig, jud, act, fal = (_obj(record, k) for k in
72
+ ("signal", "judgment", "action", "falsifier"))
73
+
74
+ add("L0.signal.description", _is_nonempty_str(sig.get("description")),
75
+ "signal.description must be a non-empty string")
76
+ add("L0.signal.observed_at", _valid_iso8601(sig.get("observed_at")),
77
+ "signal.observed_at must be valid ISO 8601")
78
+
79
+ add("L0.judgment.assessment", _is_nonempty_str(jud.get("assessment")),
80
+ "judgment.assessment must be a non-empty string")
81
+ conf = jud.get("confidence")
82
+ add("L0.judgment.confidence",
83
+ isinstance(conf, (int, float)) and not isinstance(conf, bool)
84
+ and 0.0 <= float(conf) <= 1.0,
85
+ "judgment.confidence must be a number in [0, 1]")
86
+
87
+ add("L0.action.directive", _is_nonempty_str(act.get("directive")),
88
+ "action.directive must be a non-empty string")
89
+
90
+ add("L0.falsifier.condition", _is_nonempty_str(fal.get("condition")),
91
+ "falsifier.condition must be a non-empty string")
92
+ return r
93
+
94
+
95
+ # ----------------------------------------------------------------------------- #
96
+ # L1 — grounded
97
+ # ----------------------------------------------------------------------------- #
98
+
99
+ def check_l1(record: dict) -> List[Result]:
100
+ r: List[Result] = []
101
+ add = lambda cid, ok, msg: r.append(Result(cid, 1, ok, msg))
102
+
103
+ sig, jud, act = (_obj(record, k) for k in ("signal", "judgment", "action"))
104
+
105
+ sources = sig.get("sources")
106
+ add("L1.signal.sources",
107
+ isinstance(sources, list) and any(_is_nonempty_str(s) for s in sources),
108
+ "signal.sources must be a non-empty list of identifiers")
109
+
110
+ sig_id = schema.canonical_signal_id(sig)
111
+ add("L1.judgment.signal_ref",
112
+ _is_nonempty_str(jud.get("signal_ref")) and jud.get("signal_ref") == sig_id,
113
+ "judgment.signal_ref must match the signal's canonical identity")
114
+
115
+ jud_id = schema.canonical_judgment_id(jud)
116
+ add("L1.action.judgment_ref",
117
+ _is_nonempty_str(act.get("judgment_ref")) and act.get("judgment_ref") == jud_id,
118
+ "action.judgment_ref must match the judgment's canonical identity")
119
+ return r
120
+
121
+
122
+ # ----------------------------------------------------------------------------- #
123
+ # L2 — falsifiable
124
+ # ----------------------------------------------------------------------------- #
125
+
126
+ def _is_vacuous(condition: str) -> bool:
127
+ c = condition.lower()
128
+ if any(bad in c for bad in schema.VACUITY_BLOCKLIST):
129
+ return True
130
+ has_marker = any(m in c for m in schema.CONCRETENESS_MARKERS)
131
+ has_digit = any(ch.isdigit() for ch in c)
132
+ # Concrete if it has a comparison/event marker OR a number.
133
+ return not (has_marker or has_digit)
134
+
135
+
136
+ def check_l2(record: dict) -> List[Result]:
137
+ r: List[Result] = []
138
+ add = lambda cid, ok, msg: r.append(Result(cid, 2, ok, msg))
139
+
140
+ fal = _obj(record, "falsifier")
141
+ cond = fal.get("condition", "")
142
+
143
+ add("L2.falsifier.checkable", fal.get("checkable") is True,
144
+ "falsifier.checkable must be exactly true")
145
+ add("L2.falsifier.status", fal.get("status") in schema.VALID_STATUSES,
146
+ f"falsifier.status must be one of {schema.VALID_STATUSES}")
147
+ add("L2.falsifier.concrete",
148
+ _is_nonempty_str(cond) and not _is_vacuous(cond),
149
+ "falsifier.condition must be concrete (references a threshold, quantity, "
150
+ "dated bound, or event) and not a vacuous catch-all")
151
+ return r
152
+
153
+
154
+ # ----------------------------------------------------------------------------- #
155
+ # L3 — accountable (requires an adapter; see adapter.py)
156
+ # ----------------------------------------------------------------------------- #
157
+
158
+ def check_l3(adapter, record_id: str) -> List[Result]:
159
+ """L3 validates the agent can retrieve a record and re-evaluate its falsifier.
160
+
161
+ `adapter` must implement get_record(record_id) -> dict and
162
+ evaluate_falsifier(record_id) -> str. See conformance/adapter.py.
163
+ """
164
+ r: List[Result] = []
165
+ add = lambda cid, ok, msg: r.append(Result(cid, 3, ok, msg))
166
+
167
+ try:
168
+ rec = adapter.get_record(record_id)
169
+ except Exception as e: # noqa: BLE001 - conformance must not crash on impl errors
170
+ add("L3.get_record", False, f"get_record raised: {e!r}")
171
+ return r
172
+
173
+ add("L3.get_record.returns_record",
174
+ isinstance(rec, dict) and rec.get("record_id") == record_id,
175
+ "get_record must return the JGR with the requested record_id")
176
+
177
+ # The retrieved record must itself still be structurally valid.
178
+ l0_ok = all(res.passed for res in check_l0(rec)) if isinstance(rec, dict) else False
179
+ add("L3.get_record.valid_jgr", l0_ok,
180
+ "retrieved record must still be a valid (L0) JGR")
181
+
182
+ try:
183
+ status = adapter.evaluate_falsifier(record_id)
184
+ add("L3.evaluate_falsifier", status in schema.VALID_STATUSES,
185
+ f"evaluate_falsifier must return one of {schema.VALID_STATUSES}")
186
+ except Exception as e: # noqa: BLE001
187
+ add("L3.evaluate_falsifier", False, f"evaluate_falsifier raised: {e!r}")
188
+ return r
189
+
190
+
191
+ # ----------------------------------------------------------------------------- #
192
+ # aggregation
193
+ # ----------------------------------------------------------------------------- #
194
+
195
+ def evaluate(record: dict, level: int) -> List[Result]:
196
+ """Run all checks up to and including `level` (0-2) on a JSON record."""
197
+ results = check_l0(record)
198
+ # If the record isn't even an object, higher-level checks can't run safely.
199
+ if not isinstance(record, dict):
200
+ return results
201
+ if level >= 1:
202
+ results += check_l1(record)
203
+ if level >= 2:
204
+ results += check_l2(record)
205
+ return results
206
+
207
+
208
+ def conforms(results: List[Result]) -> bool:
209
+ return all(res.passed for res in results)
@@ -0,0 +1,92 @@
1
+ """FJP-CONF v0.1 — command-line runner.
2
+
3
+ Usage:
4
+ python -m conformance.runner examples/passing_agent.json --level 2
5
+ python -m conformance.runner path/to/record.json # defaults to L2
6
+
7
+ Exit code 0 if the record conforms at the requested level, 1 otherwise.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import json
14
+ import os
15
+ import sys
16
+
17
+ from . import checks, schema
18
+
19
+ # A single Judgment-Grounded Record is small. Cap input to prevent a hostile file
20
+ # from exhausting memory or the JSON parser (matters if this runner is ever
21
+ # invoked on third-party-submitted records, e.g. a hosted verifier).
22
+ MAX_RECORD_BYTES = 1_048_576 # 1 MiB
23
+
24
+
25
+ class InvalidInput(Exception):
26
+ """Raised when the input file cannot be read or parsed as a JSON object."""
27
+
28
+
29
+ def _load(path: str) -> dict:
30
+ try:
31
+ size = os.path.getsize(path)
32
+ except OSError as e:
33
+ raise InvalidInput(f"cannot access {path}: {e}") from e
34
+ if size > MAX_RECORD_BYTES:
35
+ raise InvalidInput(
36
+ f"file is {size} bytes; exceeds {MAX_RECORD_BYTES}-byte limit for a "
37
+ "single record")
38
+ try:
39
+ with open(path, "r", encoding="utf-8") as fh:
40
+ data = fh.read(MAX_RECORD_BYTES + 1)
41
+ except OSError as e:
42
+ raise InvalidInput(f"cannot read {path}: {e}") from e
43
+ try:
44
+ return json.loads(data)
45
+ except json.JSONDecodeError as e:
46
+ raise InvalidInput(f"not valid JSON: {e}") from e
47
+ except RecursionError as e:
48
+ raise InvalidInput("JSON nesting too deep") from e
49
+
50
+
51
+ def run(path: str, level: int) -> bool:
52
+ record = _load(path)
53
+ results = checks.evaluate(record, level)
54
+ ok = checks.conforms(results)
55
+
56
+ print(f"FJP-CONF v{schema.SPEC_VERSION} — {path}")
57
+ print(f"Target level: L{level}\n")
58
+ for res in results:
59
+ mark = "PASS" if res.passed else "FAIL"
60
+ print(f" [{mark}] L{res.level} {res.check_id}")
61
+ if not res.passed:
62
+ print(f" -> {res.detail}")
63
+
64
+ print()
65
+ if ok:
66
+ print(f"RESULT: conforms to FJP-CONF v{schema.SPEC_VERSION} Level {level}")
67
+ else:
68
+ failed = [r.check_id for r in results if not r.passed]
69
+ print(f"RESULT: does NOT conform at Level {level} "
70
+ f"({len(failed)} check(s) failed)")
71
+ return ok
72
+
73
+
74
+ def main(argv=None) -> int:
75
+ p = argparse.ArgumentParser(
76
+ prog="fjp-conform",
77
+ description="Validate a Judgment-Grounded Record against FJP-CONF v0.1.",
78
+ )
79
+ p.add_argument("record", help="Path to a JSON record to validate.")
80
+ p.add_argument("--level", type=int, default=2, choices=(0, 1, 2),
81
+ help="Target conformance level (0-2). L3 requires an adapter "
82
+ "and is validated programmatically, not from the CLI.")
83
+ args = p.parse_args(argv)
84
+ try:
85
+ return 0 if run(args.record, args.level) else 1
86
+ except InvalidInput as e:
87
+ print(f"ERROR: invalid input — {e}", file=sys.stderr)
88
+ return 2 # distinct from 1 (non-conforming) so CI can tell them apart
89
+
90
+
91
+ if __name__ == "__main__":
92
+ sys.exit(main())
@@ -0,0 +1,57 @@
1
+ """FJP-CONF v0.1 — schema constants and canonical-identity helpers.
2
+
3
+ Stdlib only. No third-party dependencies, by design: a public conformance tool
4
+ must run anywhere with `python3` and nothing else.
5
+ """
6
+
7
+ SPEC_VERSION = "0.1.0"
8
+
9
+ VALID_STATUSES = ("open", "triggered", "expired")
10
+
11
+ # Heuristic vacuity blocklist for L2 falsifier checks (case-insensitive substring).
12
+ # A first filter to catch trivially non-falsifiable conditions, not a full review.
13
+ VACUITY_BLOCKLIST = (
14
+ "circumstances change",
15
+ "things change",
16
+ "the world changes",
17
+ "the situation changes",
18
+ "conditions change",
19
+ "new information",
20
+ "it becomes clear",
21
+ "anything changes",
22
+ "something changes",
23
+ "market changes", # too broad without a threshold
24
+ "sentiment changes",
25
+ )
26
+
27
+ # Tokens that signal a concrete, checkable falsifier condition.
28
+ # Two families: (a) threshold/quantity/date comparators, (b) discrete,
29
+ # externally observable events. Stems are intentional ("cancel" catches
30
+ # cancels/cancelled/cancellation) — matching is case-insensitive substring.
31
+ CONCRETENESS_MARKERS = (
32
+ # comparators / quantities / bounds
33
+ "exceeds", "falls", "drops", "rises", "above", "below", "reaches",
34
+ "within", "by ", "before", "after", "greater than", "less than",
35
+ "more than", "fewer than", "at least", "at most", "declines", "increases",
36
+ "%", "$", "per ", "no later than", "if not", "unless",
37
+ # discrete observable events
38
+ "announces", "files", "confirms", "denies", "misses", "beats",
39
+ "resign", "cancel", "reject", "approv", "closes", "terminat",
40
+ "withdraw", "delay", "acquir", "launch", "recall", "default",
41
+ "downgrade", "upgrade", "steps down", "departs", "reaffirm", "raises",
42
+ "cuts", "suspend", "rules", "votes", "signs", "expires", "settle",
43
+ )
44
+
45
+
46
+ def canonical_signal_id(signal: dict) -> str:
47
+ """Identity of a signal: explicit `id` if present, else its description."""
48
+ if not isinstance(signal, dict):
49
+ return ""
50
+ return str(signal.get("id") or signal.get("description") or "").strip()
51
+
52
+
53
+ def canonical_judgment_id(judgment: dict) -> str:
54
+ """Identity of a judgment: explicit `id` if present, else its assessment."""
55
+ if not isinstance(judgment, dict):
56
+ return ""
57
+ return str(judgment.get("id") or judgment.get("assessment") or "").strip()
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: fjp-conformance
3
+ Version: 0.1.0
4
+ Summary: FJP-CONF v0.1 — behavioral conformance suite for Judgment-Grounded Agents.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=7; extra == "dev"
12
+ Dynamic: license-file
13
+
14
+ # FJP-CONF — Flow Judgment Protocol Conformance
15
+
16
+ **Flow Judgment Protocol™ (FJP)** is the judgment layer for AI agents and
17
+ enterprise decision systems. It determines what changed, whether it matters, what
18
+ matters most, and what should happen next.
19
+
20
+ **FJP-CONF** is the public, vendor-neutral conformance standard for FJP. It defines
21
+ what it means for an agent to make **accountable** decisions — decisions that can
22
+ be traced, challenged, and audited — and ships a runnable test suite so any
23
+ developer can verify their own agent.
24
+
25
+ - **Specification:** [`spec/v0.1.md`](./spec/v0.1.md) · field reference: [`spec/schema.md`](./spec/schema.md)
26
+ - **Canonical URL:** https://fjp.flowinfo.co/conformance/v0.1
27
+ - **Status:** v0.1.0 — public draft
28
+
29
+ FJP-CONF tests an agent's **observable output**, not its internal method. Two
30
+ agents may reach opposite conclusions and both conform. Conformance asserts that a
31
+ decision is *accountable* — not that it is *correct*.
32
+
33
+ ## The idea in one paragraph
34
+
35
+ Retrieval-grade systems answer *what is true*. They do not answer *was this worth
36
+ acting on, and how would we know if it wasn't*. When an agent acts, three questions
37
+ must be answerable afterward: what did it act on, why did it judge that worth acting
38
+ on, and what would have made that judgment wrong. FJP-CONF defines the minimum
39
+ externalized structure — the **Judgment-Grounded Record** — that makes those
40
+ questions answerable, independent of how the agent decides.
41
+
42
+ ## The Judgment-Grounded Record
43
+
44
+ For every action it recommends or takes, a conforming agent emits a record with
45
+ four components:
46
+
47
+ | Component | Answers |
48
+ |-------------|---------------------|
49
+ | `signal` | what changed |
50
+ | `judgment` | why it matters |
51
+ | `action` | what should happen |
52
+ | `falsifier` | what would make it wrong |
53
+
54
+ ## Conformance levels
55
+
56
+ | Level | Name | Adds |
57
+ |-------|--------------|-------------------------------------------------------------|
58
+ | L0 | Structural | A well-formed record with all four components. |
59
+ | L1 | Grounded | Attributable signal; the action traces back to it. |
60
+ | L2 | Falsifiable | A concrete, checkable condition that would reverse the call. |
61
+ | L3 | Accountable | Records are retained and the falsifier can be re-evaluated. |
62
+
63
+ ## Quickstart
64
+
65
+ Requires Python 3.11+. No third-party dependencies.
66
+
67
+ ```bash
68
+ # validate a record at Level 2
69
+ python -m conformance.runner examples/passing_agent.json --level 2
70
+
71
+ # a non-conforming record
72
+ python -m conformance.runner examples/failing_agent.json --level 2
73
+ ```
74
+
75
+ Exit codes: `0` conforms · `1` does not conform · `2` invalid input.
76
+
77
+ Programmatic use:
78
+
79
+ ```python
80
+ from conformance import evaluate, conforms
81
+
82
+ results = evaluate(record, level=2)
83
+ print(conforms(results))
84
+ ```
85
+
86
+ Level 3 requires your agent to implement a small adapter
87
+ (`get_record`, `evaluate_falsifier`); see [`conformance/adapter.py`](./conformance/adapter.py)
88
+ and [`examples/passing_agent_l3.py`](./examples/passing_agent_l3.py).
89
+
90
+ Run the tests:
91
+
92
+ ```bash
93
+ python -m pytest -q
94
+ ```
95
+
96
+ ## Claiming conformance
97
+
98
+ A conformance claim names a level and version and is reproducible by running this
99
+ suite against your agent's output:
100
+
101
+ > "Conforms to FJP-CONF v0.1, Level 2."
102
+
103
+ Authoritative verification and any official FJP-CONF certification are administered
104
+ by Flow Information Systems. This open suite lets anyone self-check; see
105
+ [`TRADEMARKS.md`](./TRADEMARKS.md) for what you may and may not call your
106
+ implementation.
107
+
108
+ ## License and trademarks
109
+
110
+ Source code is licensed under the Apache License, Version 2.0 — see
111
+ [`LICENSE`](./LICENSE). The code license does **not** grant rights in the
112
+ trademarks.
113
+
114
+ **Flow Judgment Protocol™, FJP™, FJP-CONF™, Judgment-Grounded Agent™,** and
115
+ **"DNS resolves location. Flow resolves importance."™** are trademarks of
116
+ **Flow Information Systems** (https://flowinfo.co). See [`NOTICE`](./NOTICE) and
117
+ [`TRADEMARKS.md`](./TRADEMARKS.md).
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ NOTICE
3
+ README.md
4
+ pyproject.toml
5
+ conformance/__init__.py
6
+ conformance/adapter.py
7
+ conformance/checks.py
8
+ conformance/runner.py
9
+ conformance/schema.py
10
+ fjp_conformance.egg-info/PKG-INFO
11
+ fjp_conformance.egg-info/SOURCES.txt
12
+ fjp_conformance.egg-info/dependency_links.txt
13
+ fjp_conformance.egg-info/entry_points.txt
14
+ fjp_conformance.egg-info/requires.txt
15
+ fjp_conformance.egg-info/top_level.txt
16
+ tests/test_checks.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fjp-conform = conformance.runner:main
@@ -0,0 +1,3 @@
1
+
2
+ [dev]
3
+ pytest>=7
@@ -0,0 +1 @@
1
+ conformance
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fjp-conformance"
7
+ version = "0.1.0"
8
+ description = "FJP-CONF v0.1 — behavioral conformance suite for Judgment-Grounded Agents."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "Apache-2.0" }
12
+ dependencies = [] # stdlib only, by design
13
+
14
+ [project.optional-dependencies]
15
+ dev = ["pytest>=7"]
16
+
17
+ [project.scripts]
18
+ fjp-conform = "conformance.runner:main"
19
+
20
+ [tool.setuptools]
21
+ packages = ["conformance"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,102 @@
1
+ """Tests for the FJP-CONF check logic. Run: python -m pytest -q"""
2
+
3
+ import json
4
+ import os
5
+
6
+ from conformance import checks
7
+ from conformance.checks import _is_vacuous # noqa: internal heuristic under test
8
+
9
+ HERE = os.path.dirname(__file__)
10
+ EX = os.path.join(HERE, "..", "examples")
11
+
12
+
13
+ def _load(name):
14
+ with open(os.path.join(EX, name), encoding="utf-8") as fh:
15
+ return json.load(fh)
16
+
17
+
18
+ def test_passing_record_conforms_l2():
19
+ rec = _load("passing_agent.json")
20
+ assert checks.conforms(checks.evaluate(rec, 2))
21
+
22
+
23
+ def test_passing_record_conforms_l0_and_l1():
24
+ rec = _load("passing_agent.json")
25
+ assert checks.conforms(checks.evaluate(rec, 0))
26
+ assert checks.conforms(checks.evaluate(rec, 1))
27
+
28
+
29
+ def test_failing_record_fails_l1():
30
+ rec = _load("failing_agent.json")
31
+ assert not checks.conforms(checks.evaluate(rec, 1))
32
+
33
+
34
+ def test_failing_record_fails_l2():
35
+ rec = _load("failing_agent.json")
36
+ assert not checks.conforms(checks.evaluate(rec, 2))
37
+
38
+
39
+ def test_failing_record_fail_ids():
40
+ rec = _load("failing_agent.json")
41
+ failed = {r.check_id for r in checks.evaluate(rec, 2) if not r.passed}
42
+ assert "L1.signal.sources" in failed
43
+ assert "L1.judgment.signal_ref" in failed
44
+ assert "L1.action.judgment_ref" in failed
45
+ assert "L2.falsifier.checkable" in failed
46
+ assert "L2.falsifier.concrete" in failed
47
+
48
+
49
+ def test_confidence_bounds():
50
+ rec = _load("passing_agent.json")
51
+ rec["judgment"]["confidence"] = 1.4
52
+ res = {r.check_id: r.passed for r in checks.check_l0(rec)}
53
+ assert res["L0.judgment.confidence"] is False
54
+
55
+
56
+ def test_confidence_bool_rejected():
57
+ rec = _load("passing_agent.json")
58
+ rec["judgment"]["confidence"] = True # bool must not count as a number
59
+ res = {r.check_id: r.passed for r in checks.check_l0(rec)}
60
+ assert res["L0.judgment.confidence"] is False
61
+
62
+
63
+ def test_vacuity_heuristic():
64
+ assert _is_vacuous("unless circumstances change")
65
+ assert _is_vacuous("if something changes")
66
+ assert _is_vacuous("if the outlook shifts") # no marker, no digit
67
+ assert not _is_vacuous("if revenue falls below $2B in Q3")
68
+ assert not _is_vacuous("if the customer reaffirms guidance within 30 days")
69
+
70
+
71
+ def test_vacuity_event_falsifiers_are_concrete():
72
+ # Discrete, externally observable events are checkable falsifiers even
73
+ # without a number or comparator — must not false-positive as vacuous.
74
+ for cond in (
75
+ "if the CEO resigns",
76
+ "if the deal is cancelled",
77
+ "if the FDA rejects the application",
78
+ "if the acquisition closes",
79
+ "if regulators approve the merger",
80
+ "if the company withdraws its offer",
81
+ ):
82
+ assert not _is_vacuous(cond), cond
83
+
84
+
85
+ def test_vacuity_blocklist_beats_markers():
86
+ # A blocklisted catch-all stays vacuous even with a digit or marker.
87
+ assert _is_vacuous("unless circumstances change by 2027")
88
+
89
+
90
+ def test_l3_adapter():
91
+ rec = _load("passing_agent.json")
92
+ store = {rec["record_id"]: rec}
93
+
94
+ class A:
95
+ def get_record(self, rid):
96
+ return store[rid]
97
+
98
+ def evaluate_falsifier(self, rid):
99
+ return "open"
100
+
101
+ res = checks.check_l3(A(), rec["record_id"])
102
+ assert all(r.passed for r in res)