core/teaching/__init__.py
Shay 97971bd636 feat: add reviewed teaching loop for controlled correction learning
Introduces teaching/ module with three-stage correction pipeline:

1. correction.py — extracts CorrectionCandidate from correction intents,
   binding correction text to the prior turn it references
2. review.py — validates candidates: rejects identity overrides (17
   marker patterns) and empty corrections; produces ReviewedTeachingExample
   with deterministic SHA-256 review hash
3. store.py — bounded FIFO store for accepted examples; emits
   PackMutationProposal objects instead of mutating the vocab manifold
   directly; retrievable by subject

Design invariants:
- Identity override attempts are rejected at the review gate
- Pack mutations are proposal-only (applied=False by default)
- All traces are deterministic: same input → same candidate_id and review_hash

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-14 20:32:28 -07:00

27 lines
1 KiB
Python

"""teaching — correction capture, review, and proposal-only pack mutation.
The teaching loop allows CORE to learn from corrections in a controlled,
auditable way. Corrections flow through three stages:
1. Capture — extract a CorrectionCandidate from a correction intent
2. Review — validate the candidate (identity-safe, bounded, deterministic)
3. Store — persist reviewed examples; propose pack mutations without applying
Identity overrides are rejected at the review stage. Pack mutations are
emitted as proposals (PackMutationProposal) that require explicit external
approval before they touch the vocabulary manifold.
"""
from teaching.correction import CorrectionCandidate, extract_correction
from teaching.review import ReviewedTeachingExample, ReviewOutcome, review_correction
from teaching.store import TeachingStore, PackMutationProposal
__all__ = [
"CorrectionCandidate",
"extract_correction",
"ReviewedTeachingExample",
"ReviewOutcome",
"review_correction",
"TeachingStore",
"PackMutationProposal",
]