worldstate-check 0.1.1__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.
- worldstate_check-0.1.1/LICENSE +21 -0
- worldstate_check-0.1.1/PKG-INFO +310 -0
- worldstate_check-0.1.1/README.md +282 -0
- worldstate_check-0.1.1/pyproject.toml +44 -0
- worldstate_check-0.1.1/setup.cfg +4 -0
- worldstate_check-0.1.1/src/worldstate_check/__init__.py +3 -0
- worldstate_check-0.1.1/src/worldstate_check/__main__.py +3 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/__init__.py +15 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/base.py +38 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/command.py +85 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/file.py +87 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/http.py +66 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/json_check.py +39 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/metric.py +114 -0
- worldstate_check-0.1.1/src/worldstate_check/checks/tcp.py +29 -0
- worldstate_check-0.1.1/src/worldstate_check/cli.py +124 -0
- worldstate_check-0.1.1/src/worldstate_check/demo.py +50 -0
- worldstate_check-0.1.1/src/worldstate_check/engine.py +70 -0
- worldstate_check-0.1.1/src/worldstate_check/errors.py +10 -0
- worldstate_check-0.1.1/src/worldstate_check/loader.py +328 -0
- worldstate_check-0.1.1/src/worldstate_check/models.py +80 -0
- worldstate_check-0.1.1/src/worldstate_check/report.py +67 -0
- worldstate_check-0.1.1/src/worldstate_check/util.py +237 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/PKG-INFO +310 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/SOURCES.txt +36 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/dependency_links.txt +1 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/entry_points.txt +2 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/requires.txt +1 -0
- worldstate_check-0.1.1/src/worldstate_check.egg-info/top_level.txt +1 -0
- worldstate_check-0.1.1/tests/test_command.py +69 -0
- worldstate_check-0.1.1/tests/test_engine.py +62 -0
- worldstate_check-0.1.1/tests/test_examples.py +22 -0
- worldstate_check-0.1.1/tests/test_file_json.py +111 -0
- worldstate_check-0.1.1/tests/test_http_tcp.py +79 -0
- worldstate_check-0.1.1/tests/test_loader.py +124 -0
- worldstate_check-0.1.1/tests/test_metric.py +104 -0
- worldstate_check-0.1.1/tests/test_numeric_bounds.py +29 -0
- worldstate_check-0.1.1/tests/test_report_cli.py +68 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sylvester Kaczmarek
|
|
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,310 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: worldstate-check
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Deterministic postcondition verification for AI agents and autonomous systems.
|
|
5
|
+
Author: Sylvester Kaczmarek
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sylvesterkaczmarek/worldstate-check
|
|
8
|
+
Project-URL: Repository, https://github.com/sylvesterkaczmarek/worldstate-check
|
|
9
|
+
Project-URL: Issues, https://github.com/sylvesterkaczmarek/worldstate-check/issues
|
|
10
|
+
Keywords: ai-agents,autonomy,verification,assurance,robotics,telemetry
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Topic :: Software Development :: Testing
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: PyYAML<7,>=6.0.2
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# WorldState Check
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
[](https://github.com/sylvesterkaczmarek/worldstate-check/actions/workflows/ci.yml)
|
|
34
|
+

|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
**Verify that an autonomous action changed the world as intended.**
|
|
38
|
+
|
|
39
|
+
WorldState Check evaluates explicit postconditions against independent observations after an AI agent, automation, robot, or autonomous system acts. It distinguishes a successful command from a verified outcome, uses deterministic verdict logic, and produces a structured evidence report without requiring an LLM judge.
|
|
40
|
+
|
|
41
|
+
## At a glance
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
INTENT
|
|
45
|
+
|
|
|
46
|
+
ACTION
|
|
47
|
+
|
|
|
48
|
+
ACKNOWLEDGEMENT
|
|
49
|
+
|
|
|
50
|
+
OBSERVED WORLD STATE
|
|
51
|
+
|
|
|
52
|
+
POSTCONDITIONS
|
|
53
|
+
|
|
|
54
|
+
VERIFIED / NOT_VERIFIED / UNCERTAIN
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A tool call returning success is not the same as the requested state being achieved.
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Agent: "Safe mode entered."
|
|
61
|
+
|
|
62
|
+
$ worldstate-check demo
|
|
63
|
+
|
|
64
|
+
[PASS ] command-ack
|
|
65
|
+
[PASS ] payload-power
|
|
66
|
+
[FAIL ] attitude-error
|
|
67
|
+
[PASS ] battery-soc
|
|
68
|
+
|
|
69
|
+
VERDICT: NOT_VERIFIED
|
|
70
|
+
Required checks: 3/4 passed
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The command was acknowledged and the payload was powered down, but the synthetic attitude error remained outside the required bound.
|
|
74
|
+
|
|
75
|
+
## Why this is useful
|
|
76
|
+
|
|
77
|
+
The same verification pattern applies across software and physical autonomy:
|
|
78
|
+
|
|
79
|
+
- an agent says a deployment succeeded, but the health endpoint still fails;
|
|
80
|
+
- a maintenance workflow closes a job, but the measured equipment state remains outside limits;
|
|
81
|
+
- a spacecraft accepts a safe-mode command, but telemetry shows the required attitude was not reached;
|
|
82
|
+
- an automation reports completion, but the expected file, process, API state, or database-facing evidence is absent.
|
|
83
|
+
|
|
84
|
+
WorldState Check makes the success condition explicit and evaluates observable state instead of trusting the actor's completion claim.
|
|
85
|
+
|
|
86
|
+
## Check types
|
|
87
|
+
|
|
88
|
+
| Type | What it verifies |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `file` | existence, text assertions, SHA-256 |
|
|
91
|
+
| `json` | structured state through deterministic field comparisons |
|
|
92
|
+
| `metric` | JSON or CSV telemetry, thresholds, ranges, freshness |
|
|
93
|
+
| `http` | status, response text, JSON response state; network access is opt-in |
|
|
94
|
+
| `tcp` | endpoint reachability; network access is opt-in |
|
|
95
|
+
| `command` | explicit verification commands, opt-in only |
|
|
96
|
+
|
|
97
|
+
Required checks produce one of three verdicts:
|
|
98
|
+
|
|
99
|
+
- `VERIFIED` when every required postcondition passes;
|
|
100
|
+
- `NOT_VERIFIED` when at least one required postcondition fails;
|
|
101
|
+
- `UNCERTAIN` when no required check fails but reliable evidence is unavailable for one or more required checks.
|
|
102
|
+
|
|
103
|
+
## Quick start
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git clone https://github.com/sylvesterkaczmarek/worldstate-check.git
|
|
107
|
+
cd worldstate-check
|
|
108
|
+
python -m pip install .
|
|
109
|
+
worldstate-check demo
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Run a passing synthetic scenario:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
worldstate-check demo --scenario verified
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Create a starter specification:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
worldstate-check init worldstate.yaml
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Validate it without touching any evidence source:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
worldstate-check validate worldstate.yaml
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then verify the observed state:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
worldstate-check verify worldstate.yaml
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Specifications that intentionally contact HTTP or TCP endpoints must opt in:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
worldstate-check verify deployment.yaml --allow-network
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Write a machine-readable evidence report:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
worldstate-check verify worldstate.yaml --report evidence.json
|
|
146
|
+
worldstate-check verify-report evidence.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Verification specification
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
version: 1
|
|
153
|
+
task: spacecraft-safe-mode
|
|
154
|
+
|
|
155
|
+
checks:
|
|
156
|
+
- id: payload-off
|
|
157
|
+
type: json
|
|
158
|
+
path: telemetry.json
|
|
159
|
+
field: payload.power
|
|
160
|
+
operator: eq
|
|
161
|
+
value: "off"
|
|
162
|
+
|
|
163
|
+
- id: attitude-error
|
|
164
|
+
type: metric
|
|
165
|
+
source:
|
|
166
|
+
type: json
|
|
167
|
+
path: telemetry.json
|
|
168
|
+
field: attitude.error_deg
|
|
169
|
+
operator: lte
|
|
170
|
+
value: 3.0
|
|
171
|
+
|
|
172
|
+
- id: battery-reserve
|
|
173
|
+
type: metric
|
|
174
|
+
source:
|
|
175
|
+
type: json
|
|
176
|
+
path: telemetry.json
|
|
177
|
+
field: battery.soc
|
|
178
|
+
operator: gte
|
|
179
|
+
value: 25.0
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
See [docs/specification.md](docs/specification.md) for all supported checks.
|
|
183
|
+
|
|
184
|
+
## Telemetry freshness
|
|
185
|
+
|
|
186
|
+
A value can be numerically valid and still be unsafe evidence if it is stale. Metric checks can require a recent timestamp:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
- id: temperature
|
|
190
|
+
type: metric
|
|
191
|
+
source:
|
|
192
|
+
type: json
|
|
193
|
+
path: telemetry.json
|
|
194
|
+
field: temperature_c
|
|
195
|
+
timestamp_field: observed_at
|
|
196
|
+
max_age_seconds: 5
|
|
197
|
+
operator: lte
|
|
198
|
+
value: 75
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Stale required telemetry causes `NOT_VERIFIED` because the available observation does not satisfy the declared freshness postcondition.
|
|
202
|
+
|
|
203
|
+
## Waiting for eventual state
|
|
204
|
+
|
|
205
|
+
Some effects are asynchronous. `--wait` re-evaluates the postconditions until they pass or the timeout expires:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
worldstate-check verify deployment.yaml --wait 30
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The report records the number of attempts. Keep verification checks idempotent when using retries.
|
|
212
|
+
|
|
213
|
+
## Safety boundaries
|
|
214
|
+
|
|
215
|
+
WorldState Check treats the verification specification as potentially powerful input.
|
|
216
|
+
|
|
217
|
+
- evidence paths are confined to the verification root by default;
|
|
218
|
+
- paths outside that root require `--allow-outside-root`;
|
|
219
|
+
- command checks require `--allow-command`;
|
|
220
|
+
- HTTP and TCP checks require `--allow-network`;
|
|
221
|
+
- commands use an argument vector with `shell=False`;
|
|
222
|
+
- command checks receive only a minimal environment and do not copy raw argv or output into evidence reports;
|
|
223
|
+
- HTTP evidence redacts URL credentials, query strings, and fragments;
|
|
224
|
+
- specifications and evidence reads have explicit size limits.
|
|
225
|
+
|
|
226
|
+
See [docs/security.md](docs/security.md).
|
|
227
|
+
|
|
228
|
+
## Example physical-system checks
|
|
229
|
+
|
|
230
|
+
The repository contains two runnable file-backed examples:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
worldstate-check verify examples/field-maintenance.yaml
|
|
234
|
+
worldstate-check verify examples/spacecraft-safe-mode.yaml
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The first is expected to verify. The second is intentionally expected to return `NOT_VERIFIED` because the attitude-error postcondition fails.
|
|
238
|
+
|
|
239
|
+
## Evidence report
|
|
240
|
+
|
|
241
|
+
JSON reports include:
|
|
242
|
+
|
|
243
|
+
- task and final verdict;
|
|
244
|
+
- every expected and observed value;
|
|
245
|
+
- required versus optional checks;
|
|
246
|
+
- timing and attempt count;
|
|
247
|
+
- source metadata such as evidence path, endpoint, or telemetry age;
|
|
248
|
+
- a SHA-256 digest of the report payload.
|
|
249
|
+
|
|
250
|
+
`worldstate-check verify-report` recomputes that digest and reports whether the saved payload still matches it. The digest is not a digital signature and does not establish the identity or trustworthiness of the evidence source.
|
|
251
|
+
|
|
252
|
+
## Assurance model
|
|
253
|
+
|
|
254
|
+
WorldState Check verifies declared postconditions against observations. It does not prove that sensors, endpoints, files, or other evidence sources are trustworthy or correctly calibrated. It also does not determine whether the original intent was safe.
|
|
255
|
+
|
|
256
|
+
See [docs/assurance-model.md](docs/assurance-model.md) for the exact scope.
|
|
257
|
+
|
|
258
|
+
## Repository layout
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
worldstate-check/
|
|
262
|
+
├── .github/workflows/ci.yml
|
|
263
|
+
├── assets/social/
|
|
264
|
+
├── docs/
|
|
265
|
+
├── examples/
|
|
266
|
+
├── src/worldstate_check/
|
|
267
|
+
│ ├── checks/
|
|
268
|
+
│ ├── cli.py
|
|
269
|
+
│ ├── engine.py
|
|
270
|
+
│ ├── loader.py
|
|
271
|
+
│ ├── models.py
|
|
272
|
+
│ └── report.py
|
|
273
|
+
├── tests/
|
|
274
|
+
├── CITATION.cff
|
|
275
|
+
├── LICENSE
|
|
276
|
+
├── Makefile
|
|
277
|
+
├── pyproject.toml
|
|
278
|
+
└── README.md
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Development
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
python -m pip install -e .
|
|
285
|
+
python -m pip install pytest
|
|
286
|
+
pytest
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The core verdict path is deterministic and does not call an LLM.
|
|
290
|
+
|
|
291
|
+
## Cite this repository
|
|
292
|
+
|
|
293
|
+
If you use or adapt this repository, please cite:
|
|
294
|
+
|
|
295
|
+
> Kaczmarek, S. (2026). *WorldState Check*. GitHub. https://github.com/sylvesterkaczmarek/worldstate-check
|
|
296
|
+
|
|
297
|
+
```bibtex
|
|
298
|
+
@software{Kaczmarek_2026_WorldState_Check,
|
|
299
|
+
author = {Sylvester Kaczmarek},
|
|
300
|
+
title = {{WorldState Check}},
|
|
301
|
+
year = {2026},
|
|
302
|
+
url = {https://github.com/sylvesterkaczmarek/worldstate-check}
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## License
|
|
307
|
+
|
|
308
|
+
MIT. See [LICENSE](LICENSE).
|
|
309
|
+
|
|
310
|
+
© **Sylvester Kaczmarek** · [https://www.sylvesterkaczmarek.com](https://www.sylvesterkaczmarek.com)
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# WorldState Check
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://github.com/sylvesterkaczmarek/worldstate-check/actions/workflows/ci.yml)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
**Verify that an autonomous action changed the world as intended.**
|
|
10
|
+
|
|
11
|
+
WorldState Check evaluates explicit postconditions against independent observations after an AI agent, automation, robot, or autonomous system acts. It distinguishes a successful command from a verified outcome, uses deterministic verdict logic, and produces a structured evidence report without requiring an LLM judge.
|
|
12
|
+
|
|
13
|
+
## At a glance
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
INTENT
|
|
17
|
+
|
|
|
18
|
+
ACTION
|
|
19
|
+
|
|
|
20
|
+
ACKNOWLEDGEMENT
|
|
21
|
+
|
|
|
22
|
+
OBSERVED WORLD STATE
|
|
23
|
+
|
|
|
24
|
+
POSTCONDITIONS
|
|
25
|
+
|
|
|
26
|
+
VERIFIED / NOT_VERIFIED / UNCERTAIN
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A tool call returning success is not the same as the requested state being achieved.
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Agent: "Safe mode entered."
|
|
33
|
+
|
|
34
|
+
$ worldstate-check demo
|
|
35
|
+
|
|
36
|
+
[PASS ] command-ack
|
|
37
|
+
[PASS ] payload-power
|
|
38
|
+
[FAIL ] attitude-error
|
|
39
|
+
[PASS ] battery-soc
|
|
40
|
+
|
|
41
|
+
VERDICT: NOT_VERIFIED
|
|
42
|
+
Required checks: 3/4 passed
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The command was acknowledged and the payload was powered down, but the synthetic attitude error remained outside the required bound.
|
|
46
|
+
|
|
47
|
+
## Why this is useful
|
|
48
|
+
|
|
49
|
+
The same verification pattern applies across software and physical autonomy:
|
|
50
|
+
|
|
51
|
+
- an agent says a deployment succeeded, but the health endpoint still fails;
|
|
52
|
+
- a maintenance workflow closes a job, but the measured equipment state remains outside limits;
|
|
53
|
+
- a spacecraft accepts a safe-mode command, but telemetry shows the required attitude was not reached;
|
|
54
|
+
- an automation reports completion, but the expected file, process, API state, or database-facing evidence is absent.
|
|
55
|
+
|
|
56
|
+
WorldState Check makes the success condition explicit and evaluates observable state instead of trusting the actor's completion claim.
|
|
57
|
+
|
|
58
|
+
## Check types
|
|
59
|
+
|
|
60
|
+
| Type | What it verifies |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `file` | existence, text assertions, SHA-256 |
|
|
63
|
+
| `json` | structured state through deterministic field comparisons |
|
|
64
|
+
| `metric` | JSON or CSV telemetry, thresholds, ranges, freshness |
|
|
65
|
+
| `http` | status, response text, JSON response state; network access is opt-in |
|
|
66
|
+
| `tcp` | endpoint reachability; network access is opt-in |
|
|
67
|
+
| `command` | explicit verification commands, opt-in only |
|
|
68
|
+
|
|
69
|
+
Required checks produce one of three verdicts:
|
|
70
|
+
|
|
71
|
+
- `VERIFIED` when every required postcondition passes;
|
|
72
|
+
- `NOT_VERIFIED` when at least one required postcondition fails;
|
|
73
|
+
- `UNCERTAIN` when no required check fails but reliable evidence is unavailable for one or more required checks.
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/sylvesterkaczmarek/worldstate-check.git
|
|
79
|
+
cd worldstate-check
|
|
80
|
+
python -m pip install .
|
|
81
|
+
worldstate-check demo
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Run a passing synthetic scenario:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
worldstate-check demo --scenario verified
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Create a starter specification:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
worldstate-check init worldstate.yaml
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Validate it without touching any evidence source:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
worldstate-check validate worldstate.yaml
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then verify the observed state:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
worldstate-check verify worldstate.yaml
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Specifications that intentionally contact HTTP or TCP endpoints must opt in:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
worldstate-check verify deployment.yaml --allow-network
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Write a machine-readable evidence report:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
worldstate-check verify worldstate.yaml --report evidence.json
|
|
118
|
+
worldstate-check verify-report evidence.json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Verification specification
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
version: 1
|
|
125
|
+
task: spacecraft-safe-mode
|
|
126
|
+
|
|
127
|
+
checks:
|
|
128
|
+
- id: payload-off
|
|
129
|
+
type: json
|
|
130
|
+
path: telemetry.json
|
|
131
|
+
field: payload.power
|
|
132
|
+
operator: eq
|
|
133
|
+
value: "off"
|
|
134
|
+
|
|
135
|
+
- id: attitude-error
|
|
136
|
+
type: metric
|
|
137
|
+
source:
|
|
138
|
+
type: json
|
|
139
|
+
path: telemetry.json
|
|
140
|
+
field: attitude.error_deg
|
|
141
|
+
operator: lte
|
|
142
|
+
value: 3.0
|
|
143
|
+
|
|
144
|
+
- id: battery-reserve
|
|
145
|
+
type: metric
|
|
146
|
+
source:
|
|
147
|
+
type: json
|
|
148
|
+
path: telemetry.json
|
|
149
|
+
field: battery.soc
|
|
150
|
+
operator: gte
|
|
151
|
+
value: 25.0
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
See [docs/specification.md](docs/specification.md) for all supported checks.
|
|
155
|
+
|
|
156
|
+
## Telemetry freshness
|
|
157
|
+
|
|
158
|
+
A value can be numerically valid and still be unsafe evidence if it is stale. Metric checks can require a recent timestamp:
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
- id: temperature
|
|
162
|
+
type: metric
|
|
163
|
+
source:
|
|
164
|
+
type: json
|
|
165
|
+
path: telemetry.json
|
|
166
|
+
field: temperature_c
|
|
167
|
+
timestamp_field: observed_at
|
|
168
|
+
max_age_seconds: 5
|
|
169
|
+
operator: lte
|
|
170
|
+
value: 75
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Stale required telemetry causes `NOT_VERIFIED` because the available observation does not satisfy the declared freshness postcondition.
|
|
174
|
+
|
|
175
|
+
## Waiting for eventual state
|
|
176
|
+
|
|
177
|
+
Some effects are asynchronous. `--wait` re-evaluates the postconditions until they pass or the timeout expires:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
worldstate-check verify deployment.yaml --wait 30
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The report records the number of attempts. Keep verification checks idempotent when using retries.
|
|
184
|
+
|
|
185
|
+
## Safety boundaries
|
|
186
|
+
|
|
187
|
+
WorldState Check treats the verification specification as potentially powerful input.
|
|
188
|
+
|
|
189
|
+
- evidence paths are confined to the verification root by default;
|
|
190
|
+
- paths outside that root require `--allow-outside-root`;
|
|
191
|
+
- command checks require `--allow-command`;
|
|
192
|
+
- HTTP and TCP checks require `--allow-network`;
|
|
193
|
+
- commands use an argument vector with `shell=False`;
|
|
194
|
+
- command checks receive only a minimal environment and do not copy raw argv or output into evidence reports;
|
|
195
|
+
- HTTP evidence redacts URL credentials, query strings, and fragments;
|
|
196
|
+
- specifications and evidence reads have explicit size limits.
|
|
197
|
+
|
|
198
|
+
See [docs/security.md](docs/security.md).
|
|
199
|
+
|
|
200
|
+
## Example physical-system checks
|
|
201
|
+
|
|
202
|
+
The repository contains two runnable file-backed examples:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
worldstate-check verify examples/field-maintenance.yaml
|
|
206
|
+
worldstate-check verify examples/spacecraft-safe-mode.yaml
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The first is expected to verify. The second is intentionally expected to return `NOT_VERIFIED` because the attitude-error postcondition fails.
|
|
210
|
+
|
|
211
|
+
## Evidence report
|
|
212
|
+
|
|
213
|
+
JSON reports include:
|
|
214
|
+
|
|
215
|
+
- task and final verdict;
|
|
216
|
+
- every expected and observed value;
|
|
217
|
+
- required versus optional checks;
|
|
218
|
+
- timing and attempt count;
|
|
219
|
+
- source metadata such as evidence path, endpoint, or telemetry age;
|
|
220
|
+
- a SHA-256 digest of the report payload.
|
|
221
|
+
|
|
222
|
+
`worldstate-check verify-report` recomputes that digest and reports whether the saved payload still matches it. The digest is not a digital signature and does not establish the identity or trustworthiness of the evidence source.
|
|
223
|
+
|
|
224
|
+
## Assurance model
|
|
225
|
+
|
|
226
|
+
WorldState Check verifies declared postconditions against observations. It does not prove that sensors, endpoints, files, or other evidence sources are trustworthy or correctly calibrated. It also does not determine whether the original intent was safe.
|
|
227
|
+
|
|
228
|
+
See [docs/assurance-model.md](docs/assurance-model.md) for the exact scope.
|
|
229
|
+
|
|
230
|
+
## Repository layout
|
|
231
|
+
|
|
232
|
+
```text
|
|
233
|
+
worldstate-check/
|
|
234
|
+
├── .github/workflows/ci.yml
|
|
235
|
+
├── assets/social/
|
|
236
|
+
├── docs/
|
|
237
|
+
├── examples/
|
|
238
|
+
├── src/worldstate_check/
|
|
239
|
+
│ ├── checks/
|
|
240
|
+
│ ├── cli.py
|
|
241
|
+
│ ├── engine.py
|
|
242
|
+
│ ├── loader.py
|
|
243
|
+
│ ├── models.py
|
|
244
|
+
│ └── report.py
|
|
245
|
+
├── tests/
|
|
246
|
+
├── CITATION.cff
|
|
247
|
+
├── LICENSE
|
|
248
|
+
├── Makefile
|
|
249
|
+
├── pyproject.toml
|
|
250
|
+
└── README.md
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Development
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
python -m pip install -e .
|
|
257
|
+
python -m pip install pytest
|
|
258
|
+
pytest
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The core verdict path is deterministic and does not call an LLM.
|
|
262
|
+
|
|
263
|
+
## Cite this repository
|
|
264
|
+
|
|
265
|
+
If you use or adapt this repository, please cite:
|
|
266
|
+
|
|
267
|
+
> Kaczmarek, S. (2026). *WorldState Check*. GitHub. https://github.com/sylvesterkaczmarek/worldstate-check
|
|
268
|
+
|
|
269
|
+
```bibtex
|
|
270
|
+
@software{Kaczmarek_2026_WorldState_Check,
|
|
271
|
+
author = {Sylvester Kaczmarek},
|
|
272
|
+
title = {{WorldState Check}},
|
|
273
|
+
year = {2026},
|
|
274
|
+
url = {https://github.com/sylvesterkaczmarek/worldstate-check}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT. See [LICENSE](LICENSE).
|
|
281
|
+
|
|
282
|
+
© **Sylvester Kaczmarek** · [https://www.sylvesterkaczmarek.com](https://www.sylvesterkaczmarek.com)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=75", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "worldstate-check"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Deterministic postcondition verification for AI agents and autonomous systems."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Sylvester Kaczmarek"}]
|
|
14
|
+
dependencies = ["PyYAML>=6.0.2,<7"]
|
|
15
|
+
keywords = ["ai-agents", "autonomy", "verification", "assurance", "robotics", "telemetry"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
28
|
+
"Topic :: Software Development :: Testing",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/sylvesterkaczmarek/worldstate-check"
|
|
33
|
+
Repository = "https://github.com/sylvesterkaczmarek/worldstate-check"
|
|
34
|
+
Issues = "https://github.com/sylvesterkaczmarek/worldstate-check/issues"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
worldstate-check = "worldstate_check.cli:main"
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["src"]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
testpaths = ["tests"]
|
|
44
|
+
addopts = "-q"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .command import run_command_check
|
|
2
|
+
from .file import run_file_check
|
|
3
|
+
from .http import run_http_check
|
|
4
|
+
from .json_check import run_json_check
|
|
5
|
+
from .metric import run_metric_check
|
|
6
|
+
from .tcp import run_tcp_check
|
|
7
|
+
|
|
8
|
+
CHECK_RUNNERS = {
|
|
9
|
+
"file": run_file_check,
|
|
10
|
+
"json": run_json_check,
|
|
11
|
+
"metric": run_metric_check,
|
|
12
|
+
"http": run_http_check,
|
|
13
|
+
"tcp": run_tcp_check,
|
|
14
|
+
"command": run_command_check,
|
|
15
|
+
}
|