feat: inherited when ... from agent attribution (Invariant prerequisite, v2 §43)#51
Merged
Merged
Conversation
…nt v2 §43) Extends statement-final agent attribution to `inherited when` headers: `inherited when <condition> [unless <guard>] from <agent-name> [:]`. Legal only with the `inherited` prefix; a trailing `from` on a plain `when` header remains a parse error. Reuses the existing `_try_consume_inherited_from` agent-name validation unchanged. `inherited_from` flows into HANDLER_FIRE trigger metadata via listener._wrap_with_trigger, which already read this field — the plumbing predates this change and required no modification. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
rmichaelthomas
added a commit
that referenced
this pull request
Jul 15, 2026
…ution feat: `inherited when ... from` agent attribution (Invariant prerequisite, v2 §43)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Invariant Checkpoint v2 §43 (IRQ-3) — the one upstream prerequisite for
liminate-invariant. Extends statement-final agent attribution toinherited whenheaders.Locked grammar:
inheritedprefix. A trailingfromon a plainwhenheader remains a parse error.inherited_fromflows into HANDLER_FIRE trigger metadata so downstream consumers (Invariant) can attribute Narratia-written handlers (inherited when ... from narratia) across sessions.fromreuse for one more grammatical position. The 60-word count is unchanged.Phases completed
parse_when_blockconsumesfrom <agent>attribution after the optionalunlessguard and before the optional colon, gated onis_inherited. A non-inheritedwhenwith a trailingfromnow raises a targeted parse error directing the user to theinheritedprefix. Reuses_try_consume_inherited_fromunchanged._render_whenappendsfrom <agent>to the header line (never after the multi-line action block).render()'s generic statement-final suffix is guarded againstWhenNodeso it doesn't double-append.tests/test_inherited.py(45 → 57): parse success (bare / with guard / with colon / withof-condition), all four error paths, header-line rendering, round-trip fidelity (assertingcompare=Falsefields explicitly), and an end-to-end HANDLER_FIRE trigger-metadata integration test through the actuallisten()generator.Files modified
src/liminate/parser.pysrc/liminate/renderer.pytests/test_inherited.pyInvariants satisfied
inherited whennodes.whenis untouched — trailingfromstill errors; without it, behavior is unchanged.inherited_fromis inert provenance metadata (compare=False), never read by execution.vocabulary.pyuntouched, word count remains 60.listener.pyrequired no change —_wrap_with_triggeralready readhandler.when_node.inherited_from(built dark, ahead of this grammar landing); this PR is what gives it a non-None value to carry for the first time.Test plan
python3 -m pytest— 1511 passed, 0 failed, 0 regressions (was 1499 before this branch)🤖 Generated with Claude Code