Agent Prompt — dot-iu-cutter v0.1 Automated Cutter Design — 2026-05-14
Agent Prompt — dot-iu-cutter v0.1 Automated Cutter Design — 2026-05-14
Mission
Design dot-iu-cutter v0.1: the automated cutter that turns the user command “Cắt luật A” into a governed, repeatable, PG-first TAC/KB→Information Unit workflow.
This is DESIGN ONLY. Do not implement code. Do not mutate PG. Do not run migrations.
Read first
- Final GPT Phase 5C2 review:
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-final-review-phase5c2-86-units-complete-authorize-dot-iu-cutter-design-2026-05-14.md - 86-unit completion report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-86-units-completion-report.md - DIEU-32 retry report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-retry-synthesize-title-execution-report.md - DIEU-32 root cause:
knowledge/dev/laws/dieu44-trien-khai/reports/dieu32-null-heading-body-root-cause-investigation-report.md - R1/R2 consolidated report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r1-r2-consolidated-status-report.md - R0 resume design:
knowledge/dev/laws/dieu44-trien-khai/design/p3d-phase5c2-resume-tac-to-information-unit-migration-plan.md - Birth Rev3 contract:
knowledge/dev/laws/dieu44-trien-khai/design/p3d-birth-system-b2-contract-design-rev3.md - IU create gateway README:
knowledge/dev/laws/dieu44-trien-khai/readme/iu-create-gateway-readme.md - Pack 23 edit/save policy report:
knowledge/dev/laws/dieu44-trien-khai/reports/23-p3c4-iu-policy-and-agent-context-report.md - Constitution:
knowledge/dev/laws/constitution.md - P3D multidimensional principle:
knowledge/dev/laws/dieu44-trien-khai/principles/p3d-terminology-and-multidimensional-entity-db-principle-2026-05-12.md
Design goal
Build the design so that the target operator experience is:
Cắt luật A
The system should then know how to safely do the rest:
- discover source;
- decide whether source is existing TAC, KB markdown, or future source;
- segment if needed;
- validate vocab/body/owner/render order/collisions;
- classify body policy per row;
- create IU/UV through canonical writer;
- trigger birth;
- attach provenance/profile;
- dual-write rollback keys;
- validate pre-commit and post-commit;
- write reports;
- prepare future edge/professional-linking hooks.
Hard boundaries
Design only:
No implementation.
No code changes.
No PG mutation.
No migration execution.
No UI cutover.
No vector/Qdrant work.
No event_outbox implementation.
No schema/function/trigger changes unless proposed as future option with explicit review gate.
Required design contents
1. Operator UX and command surface
Design commands such as:
dot-iu-cutter check --doc_code DIEU-35
dot-iu-cutter map --doc_code DIEU-35
dot-iu-cutter migrate --doc_code DIEU-35
dot-iu-cutter status
dot-iu-cutter rollback --rollback_keys <path>
Also design future natural-language wrapper:
Cắt luật Điều 32
2. Source modes
At minimum:
- TAC existing publication mode.
- KB markdown source mode, design-only for now if segmentation rules are not yet mature.
- Future direct IU draft mode.
3. State machine
Formalize stages:
- source discovery;
- preflight;
- mapping artifact;
- approval gate if needed;
- bounded transaction;
- rollback key dual-write;
- in-transaction validation;
- commit/rollback;
- post-commit validation;
- report.
4. Gate matrix
Use Phase 5C2 gates as baseline:
- publication exists;
- source rows count;
- render order contiguous;
- owner/body/vocab/collision checks;
- gateway enforced;
fn_iu_createsignature;- allowed markers;
- edit policy require_review;
- birth trigger/species map;
- existing IU snapshot;
- TAC pre-counts;
- source soft flags.
5. Per-row classifier
Must include:
SYNTHESIZE_TITLE iff section_type='heading' AND body IS NULL AND children>0
PRESERVE iff body IS NOT NULL
BLOCK iff body IS NULL AND not heading-container
Carry policy into identity_profile and content_profile.
6. Validation contract
Include:
- V-1 row accounting.
- V-2 render_order fidelity.
- V-3a IU-side hash consistency.
- V-3b' conditional body preservation/synthesis.
- V-3c TAC hash provenance.
- V-3d cross-system hash equality report-only.
- V-4 authority.
- V-5 birth coverage.
- V-6 source untouched.
- V-7 IU invariants.
- V-8 gateway integrity.
- V-9 pre-existing IU untouched.
- V-10 rollback key persistence.
7. Rollback design
Mandatory:
- exact captured UUIDs only;
- no pattern delete;
- KB + VPS log dual-write before COMMIT;
- post-commit rollback only via exact keys;
- retry/idempotency policy.
8. Anti-hardcode and scale design
No per-document hardcoded arrays. Counts and section types are live-derived. Historical counts are reference only.
9. Integration boundaries
Explicitly state:
- UI cutover is out of scope.
- Vector/IU collection is out of scope.
- event_outbox/IU notification is out of scope.
- parent FK enrichment is a later pass.
- auto-edge is next design pack after cutter foundation, but cutter must emit enough provenance for edges.
10. Productionization plan
Break into phases:
- v0.1 design/spec;
- v0.1 read-only
check/mapimplementation; - v0.1
migrateimplementation for TAC source; - v0.2 KB markdown segmentation mode;
- v0.3 MCP wrapper;
- v0.4 auto-edge integration.
Deliverables
Create:
- Design:
knowledge/dev/laws/dieu44-trien-khai/design/dot-iu-cutter-v0.1-automated-cutter-design.md
- Report:
knowledge/dev/laws/dieu44-trien-khai/reports/dot-iu-cutter-v0.1-design-report.md
- Optional operator contract:
knowledge/dev/laws/dieu44-trien-khai/specs/dot-iu-cutter-v0.1-operator-contract.md
Required final response fields
dot_iu_cutter_design_status=PASS|PARTIAL|BLOCKED
no_mutation_performed=true|false
phase5c2_lessons_integrated=true|false
operator_ux_defined=true|false
source_modes_defined=true|false
state_machine_defined=true|false
gate_matrix_defined=true|false
body_policy_defined=true|false
validation_contract_defined=true|false
rollback_design_defined=true|false
anti_hardcode_scale_review_pass=true|false
implementation_authorized=false
ui_cutover_allowed=false
vector_work_allowed=false
next_recommended_action=GPT_REVIEW_DOT_IU_CUTTER_DESIGN_THEN_DISPATCH_IMPLEMENTATION_PLAN
report_path=knowledge/dev/laws/dieu44-trien-khai/reports/dot-iu-cutter-v0.1-design-report.md
Notes
The point is not to memorialize the manual run. The point is to make sure future “Cắt luật A” work does not require remembering the manual run.