feat(consume): --follow-parent carries the enclosing section's text, from room the cut left

K3-21 B. The second form of `parent`: `okf consume --follow-parent`
(`consume.attach_parent_text`) puts the enclosing concept's text inside an
excerpt's `parent`, with that concept's own `sha256` so a claim resting on it
is cited as that concept. It runs AFTER the cut, on the room the cut left, in
rank order, so the delivered set, its order, the withheld list and the
denominators are the same with the flag as without it -- inherited text
cannot displace an excerpt, the mechanism a consumer measured when copied-in
ancestor text pushed the right section to withheld place 504 and 1 069. A
text that does not fit is cut to the longest prefix that does and marked
`truncated`; a parent the payload already holds, or one a higher-ranked
excerpt already carried, travels once. OFF; the defaults are chosen on the
measurement that follows this commit.

`delivered_text` is the one normalisation an excerpt's `text` and a parent's
share. Contract SS 8 point 6 gains the MAY; the template tells the reader
what `text`, `sha256` and `truncated` mean. README and CLAUDE.md name the
flag.

Moved on purpose: the SS 7.4 known-positive again (14 455 / 14 083 / 372 ->
14 721 / 14 346 / 375), and `skills/okf-consume/` regenerated with it.
`tests/test_parent_text.py::test_no_room_means_no_text_and_no_lost_excerpt`
changed from its red form: it asked through `build_payload` at `limit ==
spent`, where the knapsack's 500 B buckets admit nothing at all
(`budget_admits_nothing`); it now holds the rule at `attach_parent_text`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-11 13:11:24 +02:00
commit 839bd61349
8 changed files with 158 additions and 25 deletions

View file

@ -129,9 +129,11 @@ what that section inherits stands in the enclosing concept, whose file is its
`concept_id` plus `.md` under the bundle root. The text links it too, on a line
`Enclosing section: [title](/path)`, where `/` is the bundle root. Cite what you
take from it by that concept's own `(bundle_id, concept_id)`, never by the
excerpt that pointed to it. An excerpt carrying `parent_unresolved` names a
parent this reader could not find in the bundle: say so rather than reporting
that it has none.
excerpt that pointed to it. When `parent` also carries `text`, the pre-pass
followed the pointer for you: that is the enclosing concept's text, `sha256` is
that concept's own, and `truncated` means it was cut to the budget. An excerpt
carrying `parent_unresolved` names a parent this reader could not find in the
bundle: say so rather than reporting that it has none.
| Marking | Use when |
|---|---|

View file

@ -140,9 +140,11 @@ what that section inherits stands in the enclosing concept, whose file is its
`concept_id` plus `.md` under the bundle root. The text links it too, on a line
`Enclosing section: [title](/path)`, where `/` is the bundle root. Cite what you
take from it by that concept's own `(bundle_id, concept_id)`, never by the
excerpt that pointed to it. An excerpt carrying `parent_unresolved` names a
parent this reader could not find in the bundle: say so rather than reporting
that it has none.
excerpt that pointed to it. When `parent` also carries `text`, the pre-pass
followed the pointer for you: that is the enclosing concept's text, `sha256` is
that concept's own, and `truncated` means it was cut to the budget. An excerpt
carrying `parent_unresolved` names a parent this reader could not find in the
bundle: say so rather than reporting that it has none.
| Marking | Use when |
|---|---|
@ -208,7 +210,7 @@ carries its denominator.
| Limit | `120000` |
| Unit | `utf-8 bytes of emitted JSON` |
| Instrument | `okf_consume.measure (len of the ensure_ascii=False JSON encoding, utf-8)` |
| Known-positive | `docs/consumption-contract.md, encoded as a JSON string` at `14455` |
| Known-positive | `docs/consumption-contract.md, encoded as a JSON string` at `14721` |
The instrument reproduces the known-positive figure before any of its own
numbers are believed. Report what the run actually spent.

View file

@ -11,10 +11,10 @@
"spent": 2289,
"known_positive": {
"case": "docs/consumption-contract.md, encoded as a JSON string",
"expected": 14455,
"measured": 14455,
"raw_bytes": 14083,
"encoding_delta": 372
"expected": 14721,
"measured": 14721,
"raw_bytes": 14346,
"encoding_delta": 375
}
},
"denominators": {