Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ repos:
hooks:
- id: mypy
args: [--pretty]
additional_dependencies: []
additional_dependencies:
- hypothesis
22 changes: 22 additions & 0 deletions docs/M1Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,19 @@ Accepted patterns:
- "do not X"
- "never X"
- "avoid X"
- "refrain from X"
- "please don't X"

Produces:

POLICY_ADD(normalize(X))

`"refrain from X"` is treated as a hard-negative directive and adds
`normalize(X)` to `policies.prohibit`.

For hard-negative directives, `normalize(X)` is applied to each policy
payload item before storage.

#### 5.2 Hard Positive Directives

Accepted patterns:
Expand All @@ -117,6 +124,8 @@ Produces:
FACT_SET(key="focus.device", value=X)

“Using” statements set the current discussion focus, not inventory.
Hard-positive directives store fact values as opaque strings and do not
apply `normalize(X)` to the stored fact value.

#### 5.3 Correction Markers

Expand All @@ -143,6 +152,8 @@ Produces:
POLICY_REMOVE(normalize(X))

If X not present → no-op.
For allow/removal directives, `normalize(X)` is applied to each policy
payload item used for removal matching.

#### 5.5 List Handling

Expand All @@ -167,6 +178,17 @@ For exclusive predicates:

No stemming, synonym mapping, ontology, or semantic interpretation.

Policy payloads (add/remove) use `normalize(X)` exactly as defined above.

Fact values do not use `normalize(X)`. They may receive minimal input
sanitation only:

1. Unicode normalization
2. Apostrophe normalization
3. Whitespace collapse

Fact sanitation does not include lowercasing or leading-article removal.

### 7. Ambiguity Handling

If a message might mutate state but is unclear:
Expand Down
3 changes: 3 additions & 0 deletions src/context_compiler/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .engine import Decision, Engine, State, create_engine

__all__ = ["Decision", "Engine", "State", "create_engine"]
Loading
Loading