context-compiler 0.9.0.dev14__tar.gz → 0.9.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.
Files changed (39) hide show
  1. context_compiler-0.9.1/PKG-INFO +216 -0
  2. context_compiler-0.9.1/README.md +194 -0
  3. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/03_llm_premise_guardrail.py +35 -37
  4. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/05_llm_prompt_drift_vs_state.py +37 -26
  5. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/06_llm_context_compaction.py +5 -5
  6. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/07_llm_prompt_vs_state.py +5 -5
  7. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/README.md +18 -25
  8. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/02_configuration_and_correction.py +5 -5
  9. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/05_llm_integration_pattern.py +1 -1
  10. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/06_step_sequence_and_state_restore.py +2 -2
  11. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/README.md +1 -1
  12. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/pyproject.toml +1 -1
  13. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/engine.py +2 -0
  14. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/grammar.py +5 -29
  15. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/repl.py +1 -1
  16. context_compiler-0.9.0.dev14/PKG-INFO +0 -628
  17. context_compiler-0.9.0.dev14/README.md +0 -606
  18. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/.gitignore +0 -0
  19. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/LICENSE +0 -0
  20. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/01_llm_contradiction_error.py +0 -0
  21. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/02_llm_constraint_guardrail.py +0 -0
  22. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/04_llm_tool_denylist_guardrail.py +0 -0
  23. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/08_llm_replacement_precondition.py +0 -0
  24. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/__init__.py +0 -0
  25. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/common.py +0 -0
  26. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/llm_client.py +0 -0
  27. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/demos/run_demo.py +0 -0
  28. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/01_persistent_guardrails.py +0 -0
  29. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/03_ambiguity_with_error.py +0 -0
  30. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/04_tool_governance_denylist.py +0 -0
  31. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/07_single_policy_correction.py +0 -0
  32. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/08_apply_directive_decisions.py +0 -0
  33. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/examples/_util.py +0 -0
  34. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/host_support/__init__.py +0 -0
  35. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/host_support/provider_mode.py +0 -0
  36. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/__init__.py +0 -0
  37. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/const.py +0 -0
  38. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/decision.py +0 -0
  39. {context_compiler-0.9.0.dev14 → context_compiler-0.9.1}/src/context_compiler/py.typed +0 -0
@@ -0,0 +1,216 @@
1
+ Metadata-Version: 2.5
2
+ Name: context-compiler
3
+ Version: 0.9.1
4
+ Summary: Deterministic conversational state engine for LLM applications.
5
+ Project-URL: Homepage, https://github.com/rlippmann/context-compiler
6
+ Project-URL: Repository, https://github.com/rlippmann/context-compiler
7
+ Project-URL: Issues, https://github.com/rlippmann/context-compiler/issues
8
+ Author: Robert Lippmann
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai-infrastructure,conversation-state,conversational-ai,deterministic,llm,state-machine,state-management
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.11
19
+ Provides-Extra: demos
20
+ Requires-Dist: litellm>=1.0.0; extra == 'demos'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Context Compiler
24
+
25
+ [![PyPI version](https://img.shields.io/pypi/v/context-compiler)](https://pypi.org/project/context-compiler/)
26
+ [![Python versions](https://img.shields.io/pypi/pyversions/context-compiler)](https://pypi.org/project/context-compiler/)
27
+ [![License](https://img.shields.io/pypi/l/context-compiler)](https://pypi.org/project/context-compiler/)
28
+ [![codecov](https://codecov.io/gh/rlippmann/context-compiler/branch/main/graph/badge.svg)](https://codecov.io/gh/rlippmann/context-compiler)
29
+
30
+ Context Compiler helps LLM applications keep explicit premise and policy rules
31
+ stable across turns. It blocks invalid or conflicting changes and returns
32
+ structured decisions.
33
+
34
+ Use it when saved context and policy rules need to shape what an application
35
+ does, not just what the model sees or says.
36
+
37
+ The [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations)
38
+ show this approach working in applications, and the [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md)
39
+ show consistent behavior across models and prompt conditions.
40
+
41
+ ## Quickstart
42
+
43
+ This example shows premise and policy updates directly:
44
+
45
+ ```python
46
+ from context_compiler import Engine, SemanticErrorDecision, UpdateDecision
47
+
48
+ engine = Engine()
49
+
50
+ engine.step("set premise project deadline is Friday")
51
+ print(engine.premise)
52
+ # project deadline is Friday
53
+
54
+ engine.step("change premise to project deadline is Thursday")
55
+ print(engine.premise)
56
+ # project deadline is Thursday
57
+
58
+ engine.step("use docker")
59
+
60
+ result = engine.step("use podman instead of docker")
61
+ if isinstance(result, UpdateDecision):
62
+ print(result.changed)
63
+ # True
64
+
65
+ result = engine.step("use podman")
66
+ if isinstance(result, UpdateDecision):
67
+ print(result.changed)
68
+ # False
69
+
70
+ result = engine.step("use npm instead of yarn")
71
+ if isinstance(result, SemanticErrorDecision):
72
+ print(result.message)
73
+
74
+ # "yarn" is not currently in use.
75
+ # Replacement requires an active 'use' policy.
76
+ ```
77
+
78
+ ## Installation
79
+
80
+ Requirements:
81
+
82
+ - Python 3.11+
83
+
84
+ Install:
85
+
86
+ ```bash
87
+ pip install context-compiler
88
+ ```
89
+
90
+ Packaging notes:
91
+
92
+ - Base install includes the Context Compiler engine and CLI.
93
+ - Example and demo source files are available in the repository and source distribution.
94
+ - To run the demos from this repository, clone the repo and install `context-compiler[demos]`.
95
+ - The `[demos]` extra installs optional dependencies such as LiteLLM. It does not install demo source files into site-packages.
96
+
97
+ ## API and behavior
98
+
99
+ The main public API is `Engine` and its Decision results.
100
+
101
+ - `Engine.step(...)` accepts raw input and may return `no_directive`, `update`,
102
+ or `error`.
103
+ - `Engine.apply_directive(...)` accepts a supported directive and returns an
104
+ `update` or `error`.
105
+ - `engine.premise` and `engine.policies` expose live compiler state.
106
+ - `engine.export_json()` and `engine.import_json(...)` transport compiler state
107
+ only.
108
+ See the [API reference](https://github.com/rlippmann/context-compiler/blob/main/docs/api-reference.md) for fields, signatures, and
109
+ repair behavior.
110
+
111
+ ---
112
+
113
+ ## State Model
114
+
115
+ The engine stores explicit user commitments as saved state:
116
+
117
+ | State | Meaning |
118
+ | --- | --- |
119
+ | `premise` | One factual or contextual value that changes how future answers should be interpreted |
120
+ | `use` | An affirmative per-item policy |
121
+ | `prohibit` | An excluding per-item policy |
122
+
123
+ ### Directive commands
124
+
125
+ Set or change the premise with:
126
+
127
+ ```text
128
+ set premise project deadline is Friday
129
+ change premise to project deadline is Thursday
130
+ ```
131
+
132
+ Policy commands:
133
+
134
+ ```text
135
+ use docker
136
+ prohibit peanuts
137
+ ```
138
+
139
+ To replace an existing `use` policy:
140
+
141
+ ```text
142
+ use podman instead of docker
143
+ ```
144
+
145
+ If `docker` is absent from saved state, the replacement fails and leaves state
146
+ unchanged. It does not become plain `use podman`.
147
+
148
+ To remove a policy or clear state:
149
+
150
+ ```text
151
+ remove policy peanuts
152
+ reset policies
153
+ clear state
154
+ ```
155
+
156
+ ---
157
+
158
+ ### When to use `premise`
159
+
160
+ Use `premise` for **persistent background context or factual state that changes how answers should be interpreted**, especially when it:
161
+
162
+ - applies across many turns
163
+ - significantly changes what solutions are valid
164
+ - cannot be fully captured as simple `use` / `prohibit` policies
165
+
166
+ Examples:
167
+
168
+ - `set premise current medications: …`
169
+ - `set premise outdoor event; no seating available`
170
+ - `set premise GDPR data handling requirements apply`
171
+ - `set premise system is deployed across multiple regions`
172
+ - `set premise project deadline is Friday`
173
+
174
+ The premise stays in effect until it is changed or cleared.
175
+
176
+ Use policies instead when the constraint is explicit and enforceable.
177
+
178
+ ```text
179
+ use concise replies
180
+ use a formal tone
181
+ prohibit introducing new external dependencies
182
+ ```
183
+
184
+ ## Examples and demos
185
+
186
+ - [examples](https://github.com/rlippmann/context-compiler/tree/main/examples) — minimal usage patterns for the Context Compiler engine
187
+ - [demos](https://github.com/rlippmann/context-compiler/tree/main/demos) — concrete scenarios showing how behavior differs with and without the compiler
188
+ - [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations) — runnable integrations using compiler state
189
+ - [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md) — evidence that the compiler works in practice
190
+
191
+ ---
192
+
193
+ ## CLI and REPL
194
+
195
+ The package includes an interactive REPL and a machine-readable JSON CLI. See
196
+ the [CLI and REPL guide](https://github.com/rlippmann/context-compiler/blob/main/docs/cli-repl.md) for commands, preload options, and
197
+ JSON output behavior.
198
+
199
+ ---
200
+
201
+ ## Documentation
202
+
203
+ - [Design philosophy](https://github.com/rlippmann/context-compiler/blob/main/docs/DesignPhilosophy.md)
204
+ - [Architecture boundaries](https://github.com/rlippmann/context-compiler/blob/main/docs/architecture.md)
205
+ - [Project overview](https://github.com/rlippmann/context-compiler/blob/main/docs/DescriptionAndMilestones.md)
206
+ - [Directive grammar specification](https://github.com/rlippmann/context-compiler/blob/main/docs/DirectiveGrammarSpec.md)
207
+ - [Multiple engines](https://github.com/rlippmann/context-compiler/blob/main/docs/multi-engine.md)
208
+ - [`tests/fixtures/`](https://github.com/rlippmann/context-compiler/tree/main/tests/fixtures) — Cross-language fixtures that help keep compiler behavior consistent across implementations.
209
+
210
+ For the full map, see [docs/README.md](https://github.com/rlippmann/context-compiler/blob/main/docs/README.md).
211
+
212
+ ---
213
+
214
+ ## License
215
+
216
+ Apache-2.0.
@@ -0,0 +1,194 @@
1
+ # Context Compiler
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/context-compiler)](https://pypi.org/project/context-compiler/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/context-compiler)](https://pypi.org/project/context-compiler/)
5
+ [![License](https://img.shields.io/pypi/l/context-compiler)](https://pypi.org/project/context-compiler/)
6
+ [![codecov](https://codecov.io/gh/rlippmann/context-compiler/branch/main/graph/badge.svg)](https://codecov.io/gh/rlippmann/context-compiler)
7
+
8
+ Context Compiler helps LLM applications keep explicit premise and policy rules
9
+ stable across turns. It blocks invalid or conflicting changes and returns
10
+ structured decisions.
11
+
12
+ Use it when saved context and policy rules need to shape what an application
13
+ does, not just what the model sees or says.
14
+
15
+ The [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations)
16
+ show this approach working in applications, and the [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md)
17
+ show consistent behavior across models and prompt conditions.
18
+
19
+ ## Quickstart
20
+
21
+ This example shows premise and policy updates directly:
22
+
23
+ ```python
24
+ from context_compiler import Engine, SemanticErrorDecision, UpdateDecision
25
+
26
+ engine = Engine()
27
+
28
+ engine.step("set premise project deadline is Friday")
29
+ print(engine.premise)
30
+ # project deadline is Friday
31
+
32
+ engine.step("change premise to project deadline is Thursday")
33
+ print(engine.premise)
34
+ # project deadline is Thursday
35
+
36
+ engine.step("use docker")
37
+
38
+ result = engine.step("use podman instead of docker")
39
+ if isinstance(result, UpdateDecision):
40
+ print(result.changed)
41
+ # True
42
+
43
+ result = engine.step("use podman")
44
+ if isinstance(result, UpdateDecision):
45
+ print(result.changed)
46
+ # False
47
+
48
+ result = engine.step("use npm instead of yarn")
49
+ if isinstance(result, SemanticErrorDecision):
50
+ print(result.message)
51
+
52
+ # "yarn" is not currently in use.
53
+ # Replacement requires an active 'use' policy.
54
+ ```
55
+
56
+ ## Installation
57
+
58
+ Requirements:
59
+
60
+ - Python 3.11+
61
+
62
+ Install:
63
+
64
+ ```bash
65
+ pip install context-compiler
66
+ ```
67
+
68
+ Packaging notes:
69
+
70
+ - Base install includes the Context Compiler engine and CLI.
71
+ - Example and demo source files are available in the repository and source distribution.
72
+ - To run the demos from this repository, clone the repo and install `context-compiler[demos]`.
73
+ - The `[demos]` extra installs optional dependencies such as LiteLLM. It does not install demo source files into site-packages.
74
+
75
+ ## API and behavior
76
+
77
+ The main public API is `Engine` and its Decision results.
78
+
79
+ - `Engine.step(...)` accepts raw input and may return `no_directive`, `update`,
80
+ or `error`.
81
+ - `Engine.apply_directive(...)` accepts a supported directive and returns an
82
+ `update` or `error`.
83
+ - `engine.premise` and `engine.policies` expose live compiler state.
84
+ - `engine.export_json()` and `engine.import_json(...)` transport compiler state
85
+ only.
86
+ See the [API reference](https://github.com/rlippmann/context-compiler/blob/main/docs/api-reference.md) for fields, signatures, and
87
+ repair behavior.
88
+
89
+ ---
90
+
91
+ ## State Model
92
+
93
+ The engine stores explicit user commitments as saved state:
94
+
95
+ | State | Meaning |
96
+ | --- | --- |
97
+ | `premise` | One factual or contextual value that changes how future answers should be interpreted |
98
+ | `use` | An affirmative per-item policy |
99
+ | `prohibit` | An excluding per-item policy |
100
+
101
+ ### Directive commands
102
+
103
+ Set or change the premise with:
104
+
105
+ ```text
106
+ set premise project deadline is Friday
107
+ change premise to project deadline is Thursday
108
+ ```
109
+
110
+ Policy commands:
111
+
112
+ ```text
113
+ use docker
114
+ prohibit peanuts
115
+ ```
116
+
117
+ To replace an existing `use` policy:
118
+
119
+ ```text
120
+ use podman instead of docker
121
+ ```
122
+
123
+ If `docker` is absent from saved state, the replacement fails and leaves state
124
+ unchanged. It does not become plain `use podman`.
125
+
126
+ To remove a policy or clear state:
127
+
128
+ ```text
129
+ remove policy peanuts
130
+ reset policies
131
+ clear state
132
+ ```
133
+
134
+ ---
135
+
136
+ ### When to use `premise`
137
+
138
+ Use `premise` for **persistent background context or factual state that changes how answers should be interpreted**, especially when it:
139
+
140
+ - applies across many turns
141
+ - significantly changes what solutions are valid
142
+ - cannot be fully captured as simple `use` / `prohibit` policies
143
+
144
+ Examples:
145
+
146
+ - `set premise current medications: …`
147
+ - `set premise outdoor event; no seating available`
148
+ - `set premise GDPR data handling requirements apply`
149
+ - `set premise system is deployed across multiple regions`
150
+ - `set premise project deadline is Friday`
151
+
152
+ The premise stays in effect until it is changed or cleared.
153
+
154
+ Use policies instead when the constraint is explicit and enforceable.
155
+
156
+ ```text
157
+ use concise replies
158
+ use a formal tone
159
+ prohibit introducing new external dependencies
160
+ ```
161
+
162
+ ## Examples and demos
163
+
164
+ - [examples](https://github.com/rlippmann/context-compiler/tree/main/examples) — minimal usage patterns for the Context Compiler engine
165
+ - [demos](https://github.com/rlippmann/context-compiler/tree/main/demos) — concrete scenarios showing how behavior differs with and without the compiler
166
+ - [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations) — runnable integrations using compiler state
167
+ - [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md) — evidence that the compiler works in practice
168
+
169
+ ---
170
+
171
+ ## CLI and REPL
172
+
173
+ The package includes an interactive REPL and a machine-readable JSON CLI. See
174
+ the [CLI and REPL guide](https://github.com/rlippmann/context-compiler/blob/main/docs/cli-repl.md) for commands, preload options, and
175
+ JSON output behavior.
176
+
177
+ ---
178
+
179
+ ## Documentation
180
+
181
+ - [Design philosophy](https://github.com/rlippmann/context-compiler/blob/main/docs/DesignPhilosophy.md)
182
+ - [Architecture boundaries](https://github.com/rlippmann/context-compiler/blob/main/docs/architecture.md)
183
+ - [Project overview](https://github.com/rlippmann/context-compiler/blob/main/docs/DescriptionAndMilestones.md)
184
+ - [Directive grammar specification](https://github.com/rlippmann/context-compiler/blob/main/docs/DirectiveGrammarSpec.md)
185
+ - [Multiple engines](https://github.com/rlippmann/context-compiler/blob/main/docs/multi-engine.md)
186
+ - [`tests/fixtures/`](https://github.com/rlippmann/context-compiler/tree/main/tests/fixtures) — Cross-language fixtures that help keep compiler behavior consistent across implementations.
187
+
188
+ For the full map, see [docs/README.md](https://github.com/rlippmann/context-compiler/blob/main/docs/README.md).
189
+
190
+ ---
191
+
192
+ ## License
193
+
194
+ Apache-2.0.
@@ -1,4 +1,4 @@
1
- """Demo 3: explicit premise change removes stale values deterministically."""
1
+ """Demo 3: explicit contextual-premise change removes stale values deterministically."""
2
2
 
3
3
  import re
4
4
 
@@ -61,8 +61,6 @@ def _plan_uses_value(output: str, value: str) -> bool:
61
61
  lowered = line.lower()
62
62
  if token not in lowered:
63
63
  continue
64
- if token == "vegetarian" and "vegan" in lowered:
65
- continue
66
64
  if _NEGATION_RE.search(lowered):
67
65
  continue
68
66
  return True
@@ -72,9 +70,9 @@ def _plan_uses_value(output: str, value: str) -> bool:
72
70
  def main() -> None:
73
71
  engine = Engine()
74
72
  user_inputs = [
75
- "set premise vegetarian curry",
76
- "change premise to vegan curry",
77
- ("Give me a shopping list and 3-step plan. First line must be PREMISE:<value>."),
73
+ "set premise project deadline is Friday",
74
+ "change premise to project deadline is Thursday",
75
+ ("Give me a project plan and 3 steps. First line must be PREMISE:<value>."),
78
76
  ]
79
77
  print_user_inputs(user_inputs)
80
78
 
@@ -91,7 +89,7 @@ def main() -> None:
91
89
  baseline_messages = build_baseline_messages(
92
90
  [user_inputs[0], user_inputs[1], user_inputs[2]],
93
91
  baseline_system_prompt=(
94
- "Be a helpful assistant. Use conversation history to infer the user's current premise."
92
+ "Be a helpful assistant. Use conversation history to infer the current project context."
95
93
  ),
96
94
  )
97
95
  print_messages("baseline", baseline_messages)
@@ -100,7 +98,7 @@ def main() -> None:
100
98
 
101
99
  _, reinjected_messages = build_reinjected_messages(
102
100
  [user_inputs[0], user_inputs[1], user_inputs[2]],
103
- premise="vegan curry",
101
+ premise="project deadline is Thursday",
104
102
  use_policies=[],
105
103
  prohibit_policies=[],
106
104
  )
@@ -140,23 +138,23 @@ def main() -> None:
140
138
  reinjected_premise = extract_tag_value(reinjected_output, "PREMISE")
141
139
  mediated_premise = extract_tag_value(mediated_output, "PREMISE")
142
140
  compact_premise = extract_tag_value(compact_output, "PREMISE")
143
- baseline_uses_vegan = _plan_uses_value(baseline_output, "vegan")
144
- baseline_uses_vegetarian = _plan_uses_value(baseline_output, "vegetarian")
145
- reinjected_uses_vegan = _plan_uses_value(reinjected_output, "vegan")
146
- reinjected_uses_vegetarian = _plan_uses_value(reinjected_output, "vegetarian")
147
- mediated_uses_vegan = _plan_uses_value(mediated_output, "vegan")
148
- mediated_uses_vegetarian = _plan_uses_value(mediated_output, "vegetarian")
149
- compact_uses_vegan = _plan_uses_value(compact_output, "vegan")
150
- compact_uses_vegetarian = _plan_uses_value(compact_output, "vegetarian")
151
- baseline_respects = not baseline_uses_vegetarian
152
- reinjected_respects = not reinjected_uses_vegetarian
153
- mediated_respects = not mediated_uses_vegetarian
154
- compact_respects = compacted_prompt is None and not compact_uses_vegetarian
141
+ baseline_uses_friday = _plan_uses_value(baseline_output, "Friday")
142
+ baseline_uses_thursday = _plan_uses_value(baseline_output, "Thursday")
143
+ reinjected_uses_friday = _plan_uses_value(reinjected_output, "Friday")
144
+ reinjected_uses_thursday = _plan_uses_value(reinjected_output, "Thursday")
145
+ mediated_uses_friday = _plan_uses_value(mediated_output, "Friday")
146
+ mediated_uses_thursday = _plan_uses_value(mediated_output, "Thursday")
147
+ compact_uses_friday = _plan_uses_value(compact_output, "Friday")
148
+ compact_uses_thursday = _plan_uses_value(compact_output, "Thursday")
149
+ baseline_respects = not baseline_uses_friday
150
+ reinjected_respects = not reinjected_uses_friday
151
+ mediated_respects = not mediated_uses_friday
152
+ compact_respects = compacted_prompt is None and not compact_uses_friday
155
153
  print_host_check(
156
154
  "PLAN_VALUES",
157
155
  (
158
- f"vegan={yes_no(baseline_uses_vegan)}, "
159
- f"vegetarian={yes_no(baseline_uses_vegetarian)}, "
156
+ f"Friday={yes_no(baseline_uses_friday)}, "
157
+ f"Thursday={yes_no(baseline_uses_thursday)}, "
160
158
  f"premise_tag={baseline_premise or 'MISSING'}"
161
159
  ),
162
160
  context="baseline",
@@ -164,8 +162,8 @@ def main() -> None:
164
162
  print_host_check(
165
163
  "PLAN_VALUES",
166
164
  (
167
- f"vegan={yes_no(reinjected_uses_vegan)}, "
168
- f"vegetarian={yes_no(reinjected_uses_vegetarian)}, "
165
+ f"Friday={yes_no(reinjected_uses_friday)}, "
166
+ f"Thursday={yes_no(reinjected_uses_thursday)}, "
169
167
  f"premise_tag={reinjected_premise or 'MISSING'}"
170
168
  ),
171
169
  context="reinjected-state",
@@ -173,8 +171,8 @@ def main() -> None:
173
171
  print_host_check(
174
172
  "PLAN_VALUES",
175
173
  (
176
- f"vegan={yes_no(mediated_uses_vegan)}, "
177
- f"vegetarian={yes_no(mediated_uses_vegetarian)}, "
174
+ f"Friday={yes_no(mediated_uses_friday)}, "
175
+ f"Thursday={yes_no(mediated_uses_thursday)}, "
178
176
  f"premise_tag={mediated_premise or 'MISSING'}"
179
177
  ),
180
178
  context="compiler-mediated",
@@ -182,32 +180,32 @@ def main() -> None:
182
180
  print_host_check(
183
181
  "PLAN_VALUES",
184
182
  (
185
- f"vegan={yes_no(compact_uses_vegan)}, "
186
- f"vegetarian={yes_no(compact_uses_vegetarian)}, "
183
+ f"Friday={yes_no(compact_uses_friday)}, "
184
+ f"Thursday={yes_no(compact_uses_thursday)}, "
187
185
  f"premise_tag={compact_premise or 'MISSING'}"
188
186
  ),
189
187
  context="compiler-mediated + compact",
190
188
  )
191
189
  print_spec_report(
192
- test_name="03_explicit_premise_change — stale value removed",
190
+ test_name="03_explicit_premise_change — stale context removed",
193
191
  baseline_pass=baseline_respects,
194
192
  reinjected_state_pass=reinjected_respects,
195
193
  compiler_pass=mediated_respects,
196
194
  compiler_compact_pass=compact_respects,
197
- expected="explicit premise change should remove the stale vegetarian value",
195
+ expected="explicit premise change should remove the stale Friday context",
198
196
  actual=(
199
- "baseline still used stale vegetarian value; "
200
- "both compiler-mediated paths used vegan value"
201
- if mediated_respects and compact_respects and baseline_uses_vegetarian
197
+ "baseline still used stale Friday context; "
198
+ "both compiler-mediated paths used Thursday context"
199
+ if mediated_respects and compact_respects and baseline_uses_friday
202
200
  else (
203
- "all four paths used vegan value"
201
+ "all four paths used Thursday context"
204
202
  if baseline_respects and mediated_respects and compact_respects
205
203
  else (
206
- "at least one compiler-mediated path included stale vegetarian value"
204
+ "at least one compiler-mediated path included stale Friday context"
207
205
  if (not mediated_respects or not compact_respects)
208
206
  else (
209
- "baseline already used vegan value; a compiler-mediated path "
210
- "still included stale vegetarian content"
207
+ "baseline already used Thursday context; a compiler-mediated path "
208
+ "still included stale Friday context"
211
209
  )
212
210
  )
213
211
  )