KB-7996

GPT Review — 23-P2 Inspection Prompt rev2, Scale + Multi-Axis Directive

7 min read Revision 1
gpt-reviewpack-23p2inspection-promptscalemulti-axisrev3-required

GPT Review — 23-P2 Inspection Prompt rev2, Scale + Multi-Axis Directive

Date: 2026-05-06
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p2-iu-edit-merge-runtime-inspection-prompt.md rev2

Verdict

Rev2 is close but should not dispatch yet. Rev3 required.

Opus fixed the two missing directive items: full information_unit schema and fn_iu_create_plan / fn_content_hash sources. However, the User clarified three long-term requirements that must be reflected before inspection:

  1. Scale: metadata evolves over time and must not break the design.
  2. Assembly is multi-axis, not only document reassembly.
  3. Parent/child is primarily for workflow/process decomposition and is not the same as cross-domain/professional-axis composition.

The prompt currently inspects parent/child and edge schema, but it does not explicitly ask Agent to classify composition axes or inspect metadata-evolution capacity. Add the patches below before dispatch.

Required rev3 patches

P1 — Add metadata evolution / schema-evolution inspection

Add a section after §1 or §4:

# ============================================================
# §4B METADATA EVOLUTION / SCHEMA-EVOLUTION CAPACITY
# ============================================================

run_sql "4B.1" "JSONB/profile columns on IU/UV" <<'SQL'
SELECT table_name, column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_schema='public'
  AND table_name IN ('information_unit','unit_version')
  AND (data_type='jsonb' OR column_name ILIKE '%profile%' OR column_name ILIKE '%metadata%' OR column_name ILIKE '%identity%')
ORDER BY table_name, column_name;
SQL

run_sql "4B.2" "identity_profile key/type samples" <<'SQL'
SELECT key,
       jsonb_typeof(value) AS value_type,
       count(*) AS n
FROM public.information_unit iu,
     jsonb_each(COALESCE(iu.identity_profile,'{}'::jsonb)) AS e(key,value)
GROUP BY key, jsonb_typeof(value)
ORDER BY n DESC, key;
SQL

run_sql "4B.3" "metadata-related dot_config keys" <<'SQL'
SELECT key, value
FROM public.dot_config
WHERE key ILIKE '%metadata%'
   OR key ILIKE '%profile%'
   OR key ILIKE '%schema%'
   OR key ILIKE '%iu_%'
   OR key ILIKE 'iu.%'
ORDER BY key
LIMIT 200;
SQL

Agent must assess whether Phase 1 can safely use JSONB metadata without hardcoding field lists, and what must become governed vocab/schema later.

P2 — Add multi-axis composition inspection separate from parent/child

Add:

# ============================================================
# §4C MULTI-AXIS COMPOSITION / TRACEABILITY
# ============================================================

run_sql "4C.1" "universal_edges metadata/order columns" <<'SQL'
SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_schema='public' AND table_name='universal_edges'
  AND (column_name ILIKE '%metadata%'
    OR column_name ILIKE '%profile%'
    OR column_name ILIKE '%order%'
    OR column_name ILIKE '%sort%'
    OR column_name ILIKE '%axis%'
    OR column_name ILIKE '%relation%')
ORDER BY ordinal_position;
SQL

run_sql "4C.2" "edge types relevant to multi-axis traceability" <<'SQL'
SELECT edge_type, count(*)
FROM public.universal_edges
WHERE edge_type ILIKE '%govern%'
   OR edge_type ILIKE '%implement%'
   OR edge_type ILIKE '%test%'
   OR edge_type ILIKE '%derive%'
   OR edge_type ILIKE '%depend%'
   OR edge_type ILIKE '%contain%'
   OR edge_type ILIKE '%part%'
   OR edge_type ILIKE '%render%'
   OR edge_type ILIKE '%trace%'
GROUP BY edge_type
ORDER BY count(*) DESC, edge_type;
SQL

Agent must distinguish:

  • document-axis assembly: parent document → child sections;
  • workflow-axis assembly: process parent → step children;
  • professional/domain-axis assembly: law → design → procedure → code → test → report.

The report must not collapse these into one parent/child model.

P3 — Add explicit advisory classification for composition models

In Agent Instructions, add a new advisory table:

### §4B Composition Axis Assessment (ADVISORY)

Classify current support:

| Axis | Example | Current primitive | Feasible now? | Missing |
|---|---|---|---|---|
| Document assembly | original doc → sections | parent_or_container_ref / sort_order | ? | ? |
| Workflow assembly | process → steps | parent/child IU | ? | ? |
| Domain traceability | law → design → procedure → code → test → report | universal_edges typed relations | ? | ? |
| Release/render bundle | selected slices → artifact | TBD | ? | ? |

Recommendation: which axis is Phase 1, which is Phase 2+.

P4 — Add scale-safety notes to model feasibility

In Proposal Model Feasibility, require Agent to judge scale impact:

  • Can the recommended model handle many proposed versions per IU?
  • Does it require scanning all versions or can it use indexed lookup?
  • Does JSONB metadata use remain acceptable at small scale only?
  • What index/constraint would eventually be needed, without creating it now?

P5 — Fix minor robustness: query count / fail count

The prompt accumulates QUERY_ERRORS but does not count queries_run / queries_failed, while the report template asks for them. Add variables:

QUERY_COUNT=0
QUERY_FAIL_COUNT=0

Inside run_sql():

QUERY_COUNT=$((QUERY_COUNT+1))
...
if [ "$ex" -ne 0 ]; then
  QUERY_FAIL_COUNT=$((QUERY_FAIL_COUNT+1))
  ...
fi

Final output:

echo "queries_run=$QUERY_COUNT" | tee -a "$LOG_PATH"
echo "queries_failed=$QUERY_FAIL_COUNT" | tee -a "$LOG_PATH"

P6 — Keep prompt read-only and compact

Do not expand into implementation. No DDL/DML. No function changes. No vector mutation. No cleanup.

Directive to Opus

Patch 23-p2-iu-edit-merge-runtime-inspection-prompt.md to rev3 with P1–P5.

Do not dispatch after patch; return for GPT/User final approval.

Summary

Rev2 answers the immediate edit/merge inspection, but the User’s clarified requirements add two dimensions: metadata evolution and multi-axis composition. Rev3 should inspect whether current runtime can support those dimensions without hardcoding or confusing document parent/child with domain traceability.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-23-p2-inspection-prompt-rev2-scale-axis-directive-2026-05-06.md