context-compiler 0.9.0.dev15__tar.gz → 0.9.2__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.2/PKG-INFO +218 -0
  2. context_compiler-0.9.2/README.md +196 -0
  3. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/03_llm_premise_guardrail.py +35 -37
  4. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/05_llm_prompt_drift_vs_state.py +37 -26
  5. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/06_llm_context_compaction.py +5 -5
  6. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/07_llm_prompt_vs_state.py +5 -5
  7. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/README.md +18 -25
  8. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/02_configuration_and_correction.py +5 -5
  9. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/05_llm_integration_pattern.py +1 -1
  10. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/06_step_sequence_and_state_restore.py +2 -2
  11. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/README.md +1 -1
  12. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/pyproject.toml +1 -1
  13. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/engine.py +25 -19
  14. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/grammar.py +5 -29
  15. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/repl.py +1 -1
  16. context_compiler-0.9.0.dev15/PKG-INFO +0 -628
  17. context_compiler-0.9.0.dev15/README.md +0 -606
  18. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/.gitignore +0 -0
  19. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/LICENSE +0 -0
  20. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/01_llm_contradiction_error.py +0 -0
  21. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/02_llm_constraint_guardrail.py +0 -0
  22. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/04_llm_tool_denylist_guardrail.py +0 -0
  23. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/08_llm_replacement_precondition.py +0 -0
  24. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/__init__.py +0 -0
  25. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/common.py +0 -0
  26. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/llm_client.py +0 -0
  27. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/demos/run_demo.py +0 -0
  28. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/01_persistent_guardrails.py +0 -0
  29. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/03_ambiguity_with_error.py +0 -0
  30. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/04_tool_governance_denylist.py +0 -0
  31. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/07_single_policy_correction.py +0 -0
  32. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/08_apply_directive_decisions.py +0 -0
  33. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/examples/_util.py +0 -0
  34. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/host_support/__init__.py +0 -0
  35. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/host_support/provider_mode.py +0 -0
  36. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/__init__.py +0 -0
  37. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/const.py +0 -0
  38. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/decision.py +0 -0
  39. {context_compiler-0.9.0.dev15 → context_compiler-0.9.2}/src/context_compiler/py.typed +0 -0
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.5
2
+ Name: context-compiler
3
+ Version: 0.9.2
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 maintains host-side working memory consisting of a premise and
31
+ policies, separate from the model's conversational context. The Engine applies
32
+ directives to that working memory so applications can maintain explicit state
33
+ across model interactions without relying on the model to remember or infer it.
34
+ It blocks invalid or conflicting changes and returns structured decisions.
35
+
36
+ Use it when saved context and policy rules need to shape what an application
37
+ does, not just what the model sees or says.
38
+
39
+ The [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations)
40
+ show this approach working in applications, and the [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md)
41
+ show consistent behavior across models and prompt conditions.
42
+
43
+ ## Quickstart
44
+
45
+ This example shows premise and policy updates directly:
46
+
47
+ ```python
48
+ from context_compiler import Engine, SemanticErrorDecision, UpdateDecision
49
+
50
+ engine = Engine()
51
+
52
+ engine.step("set premise project deadline is Friday")
53
+ print(engine.premise)
54
+ # project deadline is Friday
55
+
56
+ engine.step("change premise to project deadline is Thursday")
57
+ print(engine.premise)
58
+ # project deadline is Thursday
59
+
60
+ engine.step("use docker")
61
+
62
+ result = engine.step("use podman instead of docker")
63
+ if isinstance(result, UpdateDecision):
64
+ print(result.changed)
65
+ # True
66
+
67
+ result = engine.step("use podman")
68
+ if isinstance(result, UpdateDecision):
69
+ print(result.changed)
70
+ # False
71
+
72
+ result = engine.step("use npm instead of yarn")
73
+ if isinstance(result, SemanticErrorDecision):
74
+ print(result.message)
75
+
76
+ # "yarn" is not currently in use.
77
+ # Replacement requires an active 'use' policy.
78
+ ```
79
+
80
+ ## Installation
81
+
82
+ Requirements:
83
+
84
+ - Python 3.11+
85
+
86
+ Install:
87
+
88
+ ```bash
89
+ pip install context-compiler
90
+ ```
91
+
92
+ Packaging notes:
93
+
94
+ - Base install includes the Context Compiler engine and CLI.
95
+ - Example and demo source files are available in the repository and source distribution.
96
+ - To run the demos from this repository, clone the repo and install `context-compiler[demos]`.
97
+ - The `[demos]` extra installs optional dependencies such as LiteLLM. It does not install demo source files into site-packages.
98
+
99
+ ## API and behavior
100
+
101
+ The main public API is `Engine` and its Decision results.
102
+
103
+ - `Engine.step(...)` accepts raw input and may return `no_directive`, `update`,
104
+ or `error`.
105
+ - `Engine.apply_directive(...)` accepts a supported directive and returns an
106
+ `update` or `error`.
107
+ - `engine.premise` and `engine.policies` expose live compiler state.
108
+ - `engine.export_json()` and `engine.import_json(...)` transport compiler state
109
+ only.
110
+ See the [API reference](https://github.com/rlippmann/context-compiler/blob/main/docs/api-reference.md) for fields, signatures, and
111
+ repair behavior.
112
+
113
+ ---
114
+
115
+ ## State Model
116
+
117
+ Working memory contains explicit user commitments:
118
+
119
+ | State | Meaning |
120
+ | --- | --- |
121
+ | `premise` | One factual or contextual value that changes how future answers should be interpreted |
122
+ | `use` | An affirmative per-item policy |
123
+ | `prohibit` | An excluding per-item policy |
124
+
125
+ ### Directive commands
126
+
127
+ Set or change the premise with:
128
+
129
+ ```text
130
+ set premise project deadline is Friday
131
+ change premise to project deadline is Thursday
132
+ ```
133
+
134
+ Policy commands:
135
+
136
+ ```text
137
+ use docker
138
+ prohibit peanuts
139
+ ```
140
+
141
+ To replace an existing `use` policy:
142
+
143
+ ```text
144
+ use podman instead of docker
145
+ ```
146
+
147
+ If `docker` is absent from working memory, the replacement fails and leaves
148
+ working memory unchanged. It does not become plain `use podman`.
149
+
150
+ To remove a policy or clear state:
151
+
152
+ ```text
153
+ remove policy peanuts
154
+ reset policies
155
+ clear state
156
+ ```
157
+
158
+ ---
159
+
160
+ ### When to use `premise`
161
+
162
+ Use `premise` for **persistent background context or factual state that changes how answers should be interpreted**, especially when it:
163
+
164
+ - applies across many turns
165
+ - significantly changes what solutions are valid
166
+ - cannot be fully captured as simple `use` / `prohibit` policies
167
+
168
+ Examples:
169
+
170
+ - `set premise current medications: …`
171
+ - `set premise outdoor event; no seating available`
172
+ - `set premise GDPR data handling requirements apply`
173
+ - `set premise system is deployed across multiple regions`
174
+ - `set premise project deadline is Friday`
175
+
176
+ The premise stays in effect until it is changed or cleared.
177
+
178
+ Use policies instead when the constraint is explicit and enforceable.
179
+
180
+ ```text
181
+ use concise replies
182
+ use a formal tone
183
+ prohibit introducing new external dependencies
184
+ ```
185
+
186
+ ## Examples and demos
187
+
188
+ - [examples](https://github.com/rlippmann/context-compiler/tree/main/examples) — minimal usage patterns for the Context Compiler engine
189
+ - [demos](https://github.com/rlippmann/context-compiler/tree/main/demos) — concrete scenarios showing how behavior differs with and without the compiler
190
+ - [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations) — runnable integrations using compiler state
191
+ - [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md) — evidence that the compiler works in practice
192
+
193
+ ---
194
+
195
+ ## CLI and REPL
196
+
197
+ The package includes an interactive REPL and a machine-readable JSON CLI. See
198
+ the [CLI and REPL guide](https://github.com/rlippmann/context-compiler/blob/main/docs/cli-repl.md) for commands, preload options, and
199
+ JSON output behavior.
200
+
201
+ ---
202
+
203
+ ## Documentation
204
+
205
+ - [Design philosophy](https://github.com/rlippmann/context-compiler/blob/main/docs/DesignPhilosophy.md)
206
+ - [Architecture boundaries](https://github.com/rlippmann/context-compiler/blob/main/docs/architecture.md)
207
+ - [Project overview](https://github.com/rlippmann/context-compiler/blob/main/docs/DescriptionAndMilestones.md)
208
+ - [Directive grammar specification](https://github.com/rlippmann/context-compiler/blob/main/docs/DirectiveGrammarSpec.md)
209
+ - [Multiple engines](https://github.com/rlippmann/context-compiler/blob/main/docs/multi-engine.md)
210
+ - [`tests/fixtures/`](https://github.com/rlippmann/context-compiler/tree/main/tests/fixtures) — Cross-language fixtures that help keep compiler behavior consistent across implementations.
211
+
212
+ For the full map, see [docs/README.md](https://github.com/rlippmann/context-compiler/blob/main/docs/README.md).
213
+
214
+ ---
215
+
216
+ ## License
217
+
218
+ Apache-2.0.
@@ -0,0 +1,196 @@
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 maintains host-side working memory consisting of a premise and
9
+ policies, separate from the model's conversational context. The Engine applies
10
+ directives to that working memory so applications can maintain explicit state
11
+ across model interactions without relying on the model to remember or infer it.
12
+ It blocks invalid or conflicting changes and returns structured decisions.
13
+
14
+ Use it when saved context and policy rules need to shape what an application
15
+ does, not just what the model sees or says.
16
+
17
+ The [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations)
18
+ show this approach working in applications, and the [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md)
19
+ show consistent behavior across models and prompt conditions.
20
+
21
+ ## Quickstart
22
+
23
+ This example shows premise and policy updates directly:
24
+
25
+ ```python
26
+ from context_compiler import Engine, SemanticErrorDecision, UpdateDecision
27
+
28
+ engine = Engine()
29
+
30
+ engine.step("set premise project deadline is Friday")
31
+ print(engine.premise)
32
+ # project deadline is Friday
33
+
34
+ engine.step("change premise to project deadline is Thursday")
35
+ print(engine.premise)
36
+ # project deadline is Thursday
37
+
38
+ engine.step("use docker")
39
+
40
+ result = engine.step("use podman instead of docker")
41
+ if isinstance(result, UpdateDecision):
42
+ print(result.changed)
43
+ # True
44
+
45
+ result = engine.step("use podman")
46
+ if isinstance(result, UpdateDecision):
47
+ print(result.changed)
48
+ # False
49
+
50
+ result = engine.step("use npm instead of yarn")
51
+ if isinstance(result, SemanticErrorDecision):
52
+ print(result.message)
53
+
54
+ # "yarn" is not currently in use.
55
+ # Replacement requires an active 'use' policy.
56
+ ```
57
+
58
+ ## Installation
59
+
60
+ Requirements:
61
+
62
+ - Python 3.11+
63
+
64
+ Install:
65
+
66
+ ```bash
67
+ pip install context-compiler
68
+ ```
69
+
70
+ Packaging notes:
71
+
72
+ - Base install includes the Context Compiler engine and CLI.
73
+ - Example and demo source files are available in the repository and source distribution.
74
+ - To run the demos from this repository, clone the repo and install `context-compiler[demos]`.
75
+ - The `[demos]` extra installs optional dependencies such as LiteLLM. It does not install demo source files into site-packages.
76
+
77
+ ## API and behavior
78
+
79
+ The main public API is `Engine` and its Decision results.
80
+
81
+ - `Engine.step(...)` accepts raw input and may return `no_directive`, `update`,
82
+ or `error`.
83
+ - `Engine.apply_directive(...)` accepts a supported directive and returns an
84
+ `update` or `error`.
85
+ - `engine.premise` and `engine.policies` expose live compiler state.
86
+ - `engine.export_json()` and `engine.import_json(...)` transport compiler state
87
+ only.
88
+ See the [API reference](https://github.com/rlippmann/context-compiler/blob/main/docs/api-reference.md) for fields, signatures, and
89
+ repair behavior.
90
+
91
+ ---
92
+
93
+ ## State Model
94
+
95
+ Working memory contains explicit user commitments:
96
+
97
+ | State | Meaning |
98
+ | --- | --- |
99
+ | `premise` | One factual or contextual value that changes how future answers should be interpreted |
100
+ | `use` | An affirmative per-item policy |
101
+ | `prohibit` | An excluding per-item policy |
102
+
103
+ ### Directive commands
104
+
105
+ Set or change the premise with:
106
+
107
+ ```text
108
+ set premise project deadline is Friday
109
+ change premise to project deadline is Thursday
110
+ ```
111
+
112
+ Policy commands:
113
+
114
+ ```text
115
+ use docker
116
+ prohibit peanuts
117
+ ```
118
+
119
+ To replace an existing `use` policy:
120
+
121
+ ```text
122
+ use podman instead of docker
123
+ ```
124
+
125
+ If `docker` is absent from working memory, the replacement fails and leaves
126
+ working memory unchanged. It does not become plain `use podman`.
127
+
128
+ To remove a policy or clear state:
129
+
130
+ ```text
131
+ remove policy peanuts
132
+ reset policies
133
+ clear state
134
+ ```
135
+
136
+ ---
137
+
138
+ ### When to use `premise`
139
+
140
+ Use `premise` for **persistent background context or factual state that changes how answers should be interpreted**, especially when it:
141
+
142
+ - applies across many turns
143
+ - significantly changes what solutions are valid
144
+ - cannot be fully captured as simple `use` / `prohibit` policies
145
+
146
+ Examples:
147
+
148
+ - `set premise current medications: …`
149
+ - `set premise outdoor event; no seating available`
150
+ - `set premise GDPR data handling requirements apply`
151
+ - `set premise system is deployed across multiple regions`
152
+ - `set premise project deadline is Friday`
153
+
154
+ The premise stays in effect until it is changed or cleared.
155
+
156
+ Use policies instead when the constraint is explicit and enforceable.
157
+
158
+ ```text
159
+ use concise replies
160
+ use a formal tone
161
+ prohibit introducing new external dependencies
162
+ ```
163
+
164
+ ## Examples and demos
165
+
166
+ - [examples](https://github.com/rlippmann/context-compiler/tree/main/examples) — minimal usage patterns for the Context Compiler engine
167
+ - [demos](https://github.com/rlippmann/context-compiler/tree/main/demos) — concrete scenarios showing how behavior differs with and without the compiler
168
+ - [`context-compiler-example-integrations`](https://github.com/rlippmann/context-compiler-example-integrations) — runnable integrations using compiler state
169
+ - [demo results](https://github.com/rlippmann/context-compiler/blob/main/docs/demos-results.md) — evidence that the compiler works in practice
170
+
171
+ ---
172
+
173
+ ## CLI and REPL
174
+
175
+ The package includes an interactive REPL and a machine-readable JSON CLI. See
176
+ the [CLI and REPL guide](https://github.com/rlippmann/context-compiler/blob/main/docs/cli-repl.md) for commands, preload options, and
177
+ JSON output behavior.
178
+
179
+ ---
180
+
181
+ ## Documentation
182
+
183
+ - [Design philosophy](https://github.com/rlippmann/context-compiler/blob/main/docs/DesignPhilosophy.md)
184
+ - [Architecture boundaries](https://github.com/rlippmann/context-compiler/blob/main/docs/architecture.md)
185
+ - [Project overview](https://github.com/rlippmann/context-compiler/blob/main/docs/DescriptionAndMilestones.md)
186
+ - [Directive grammar specification](https://github.com/rlippmann/context-compiler/blob/main/docs/DirectiveGrammarSpec.md)
187
+ - [Multiple engines](https://github.com/rlippmann/context-compiler/blob/main/docs/multi-engine.md)
188
+ - [`tests/fixtures/`](https://github.com/rlippmann/context-compiler/tree/main/tests/fixtures) — Cross-language fixtures that help keep compiler behavior consistent across implementations.
189
+
190
+ For the full map, see [docs/README.md](https://github.com/rlippmann/context-compiler/blob/main/docs/README.md).
191
+
192
+ ---
193
+
194
+ ## License
195
+
196
+ 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
  )