KB-6CE5

IU Core 120x Three-Axis — 05 Auto-cut three-axis mapping + text-as-code kickoff

4 min read Revision 1
dieu44iu-core-mvp120xauto-cuttext-as-codeexportv0.62026-05-22

05 — Auto-cut Three-Axis Mapping + Text-as-Code Kickoff

Auto-cut bridge → three-axis metadata

sandbox/090 probe M7 proved the auto-cut output flows into all three metadata axes, on production data, BEGIN…ROLLBACK:

  1. the auto-cut bridge maps a cut create to an add_new_piece structure op (birth spec discovered from real vocabulary — no hardcode);
  2. fn_iu_structure_op_apply enacts it (ok=true) — the birth gate mints one governed IU;
  3. fn_iu_metadata_refresh enriches the minted IU into axis B;
  4. the minted IU is then visible in v_iu_metadata_envelope (axis A position + axis C hierarchy + axis B tag count) AND in v_iu_content_group.

So an auto-cut-produced IU automatically enters the three-axis model: axis A via its sort_order/section_*, axis C via the structure op's tree placement, axis B via fn_iu_metadata_refresh. M7 result: apply ok=true · in_envelope=1 · content_group_tags=1. Zero durable rows. No production CUT executed.

Text-as-code layer — kickoff

cutter_agent/iu_core/text_as_code.py kicks off the text-as-code layer on top of the three-axis model. Like delivery_seam.py / pg_structure_store.py it is a pure contract module — dataclasses + pure functions, no IO, no DB.

Deterministic export layout. iu_export_path(record)iu-tree/<doc_code|_unfiled>/<sort_order:04d>-<canonical_address>.md. Axis A (sort_order) drives the ordering prefix so a directory listing reads in original document order; the globally-unique canonical_address is the filename stem, so no two IUs can collide on a path. export_tree raises on any path collision.

Diff contract. diff_trees(old, new)TreeDiff(added, removed, changed) — deterministic, sorted; a git diff of an export is meaningful.

Fail-closed, non-destructive import contract. IMPORT_IS_DESTRUCTIVE is False. validate_import only checks (unique iu_id / canonical_address / export path, no self-parent) and returns every error — an import is acceptable ONLY when errors is empty. import_plan produces a plan and executes is always False. Building a real importer is a later, separately gated macro.

Read-only export proof

The full live IU corpus was exported read-only through the contract (production v_iu_metadata_envelopeIuExportRecordexport_tree):

Check Result
records exported 158
export files 158 (1:1, no path collision)
deterministic re-export byte-identical
self-diff empty
import validation ok=true — 158 records, 0 errors
import executes False (non-destructive)
layout buckets DIEU-28, DIEU-32, DIEU-35, _unfiled

A real finding surfaced + was fixed during the proof: the first path scheme (section-code tail) collided for _unfiled IUs; the export-tree collision guard caught it, and the scheme was corrected to the unique canonical_address stem. The contract's own safety check did its job.

12 executable tests in test_iu_core_120x_three_axis.py (TestTextAsCode) prove the contract: deterministic + unique paths, diff, fail-closed validation, non-destructive import plan.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-120x-three-axis-metadata-delivery-autocut-textcode-open-goal/05-autocut-textcode-kickoff.md