Skip to content

Commit ee1e8d1

Browse files
committed
post run corrections
1 parent b7a81ef commit ee1e8d1

11 files changed

Lines changed: 890 additions & 10 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ exclusions, or competency questions, but the system owns the detection step.
5353
Generated bundles are local runtime artifacts. They are ignored by git by
5454
default.
5555

56+
Raw JSON record counts are not graph completion. For ordinary `MAKE-GRAPH`,
57+
completion requires semantic acceptance: graph intent fit, source-backed domain
58+
membership, field sufficiency, pair-specific edge evidence, semantic sample
59+
audit, and accepted-versus-candidate target reconciliation. Candidate records
60+
can be useful frontier state, but they do not count toward requested targets.
61+
5662
### Two Scales Of Control
5763

5864
Ortelius uses Codex at two scales of control: globally, as a policy-driven

assets/protocol_assets/system/graph_population/v001/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,15 @@ assets/protocol_assets/bundles/<domain_slug>/<protocol_id>/
3737

3838
This directory does not contain populated graph facts, live crawl results, or a
3939
hard Python interpreter that calls Codex/OpenAI APIs.
40+
41+
## Post-run correction gates
42+
43+
For ordinary `MAKE-GRAPH`, v001 now treats semantic completion as stricter than
44+
structural JSON validity. A generated bundle must materialize graph intent
45+
before source probing, express source reconnaissance through Markdown batch
46+
packets, audit any generated mechanical code, separate candidate records from
47+
accepted target-counting records, pass domain membership and semantic sample
48+
audits, and reconcile accepted counts before claiming completion.
49+
50+
If semantic acceptance is incomplete, Codex should report that the graph is not
51+
complete before reporting raw counts or structural validation.

assets/protocol_assets/system/graph_population/v001/graph_population_control_protocol.md

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,104 @@ at the schema first:
3232
assets/protocol_assets/system/graph_population/v001/graph_population_protocol_schema.md
3333
```
3434

35+
36+
## Post-Run Correction Execution Gates
37+
38+
These gates are normative for contextless execution. They prevent the executor
39+
from pushing through in the wrong place: Codex must push through recoverable
40+
source and semantic difficulty by expanding explicit Markdown loops, not by
41+
skipping gates, inventing hidden scripts, or counting weak records as complete.
42+
43+
### GraphIntentContract.MaterializationGate
44+
45+
For ordinary MAKE-GRAPH bundles, verify before any source, type, edge, instance,
46+
or graph-writing action:
47+
48+
```text
49+
manifest.graph_intent exists
50+
runs/<run_id>/reports/graph_intent_contract.md exists
51+
graph_intent_status is confirmed or explicitly_authorized_inference
52+
created_before_source_probe: true
53+
downstream_gate exists
54+
next_legal_action_after_contract is source reconnaissance planning
55+
```
56+
57+
If a source probe or source result exists before the contract is materialized,
58+
stop with `graph_intent_materialization_order_violation`. If confirmation is
59+
missing, stop with `graph_intent_confirmation_required`. Passing this gate
60+
advances only to source reconnaissance planning, not directly to source probing.
61+
62+
### SourceReconnaissance Markdown Loop
63+
64+
Source reconnaissance is a Markdown-controlled loop with this order:
65+
66+
```text
67+
SourceReconnaissance.PlanWrite
68+
SourceReconnaissance.BatchPacketWrite
69+
SourceReconnaissance.BatchExecute
70+
SourceReconnaissance.ResultReview
71+
```
72+
73+
The executor must not execute a source batch until the batch packet exists and
74+
contains the candidate rows or selection rule, acceptance criteria, rejection
75+
criteria, source batch cache path, write targets, cursor update rule, and resume
76+
point. If source results exist without a declared batch packet, stop with
77+
`source_result_without_declared_batch`.
78+
79+
### GeneratedCode.RuntimeAuditGate
80+
81+
If generated helper code, temporary code, inline Python, shell, notebooks, or
82+
SQL-like helpers are used during a run, verify
83+
`runs/<run_id>/reports/generated_code_runtime_audit.md` before accepting any
84+
result the code produced.
85+
86+
The audit must show that code had a mechanical purpose and that a prior
87+
Markdown artifact owned the decision. Missing audit means
88+
`hidden_runtime_audit_missing`. Code that selected semantic graph content,
89+
filled targets, chose accepted/candidate status, or owned traversal means
90+
`hidden_semantic_runtime_detected`.
91+
92+
### FiberGraph.Node.DomainMembershipReview
93+
94+
Before fiber nodes become accepted, run a domain-membership review. Each
95+
reviewed record must become accepted, candidate, rejected, or deferred. A record
96+
with only source-query-shape evidence remains candidate. Candidate, rejected,
97+
and deferred records do not count toward MAKE-GRAPH targets.
98+
99+
Write or update:
100+
101+
```text
102+
runs/<run_id>/reports/domain_membership_audit.md
103+
```
104+
105+
### FiberGraph.Edge.PairEvidenceReview
106+
107+
Before fiber edges become accepted, verify accepted endpoints, accepted edge
108+
type, pair-specific evidence for the exact source-predicate-target assertion,
109+
primitive relation status, and graph-intent fit. Endpoint co-presence, shared
110+
bucket membership, deterministic pairing, and SQL-query-like derivation are not
111+
pair evidence. Candidate edge records may remain in a frontier, but they do not
112+
count toward targets.
113+
114+
### SemanticAcceptance.SampleAudit
115+
116+
Before final semantic acceptance, run the semantic sample audit over accepted
117+
node and edge records. If accepted samples expose wrong domain membership, wrong
118+
type assignment, non-primitive relation shape, or missing pair evidence, the
119+
run must stop for repair. Do not downgrade target-counting semantic errors to
120+
warnings.
121+
122+
### Completion.SemanticAcceptanceGate
123+
124+
Completion requires `semantic_acceptance_status: passed`, accepted target
125+
reconciliation, domain membership audit passed, semantic sample audit passed,
126+
no candidate records counted toward targets, no synthetic/completion records
127+
counted toward targets, and no contradictory counters.
128+
129+
If semantic acceptance is not passed, final narration must begin by saying the
130+
graph is not complete. Raw counts, structural validation success, or generated
131+
file paths may follow only as supporting detail.
132+
35133
## Corrected Soft Control Flow Diagram
36134

37135
This diagram is the whole-system control flow. It is normative for both the
@@ -59,7 +157,7 @@ flowchart TD
59157
C5 --> C6["Initialize candidate graph JSON files"]
60158
C6 --> C7["Initialize run artifacts: structured cursor, initialized execution_log, source_batch_plan, reports, source_batches, batch_packets, tool_outputs"]
61159
C7 --> C7I["MAKE-GRAPH: write graph_intent_contract.md as the first run report artifact"]
62-
C7I --> C7A["MAKE-GRAPH: initialize source landscape map, source family registry, adapter frontier, and source strategy log"]
160+
C7I --> C7A["MAKE-GRAPH: initialize source reconnaissance plan, landscape map, source family registry, adapter frontier, recovery plan, and source strategy log"]
63161
C7A --> C7B["MAKE-GRAPH: initialize joint population feasibility and endpoint reservation plans"]
64162
C7B --> C8["Run generated-bundle acceptance checks"]
65163
C8 --> C9["Write runs/<run_id>/reports/generated_bundle_acceptance_report.md"]
@@ -75,7 +173,7 @@ flowchart TD
75173
E3 --> E4["Reconcile graph paths and inspect current graph JSON state"]
76174
E4 --> E4I{"MAKE-GRAPH graph intent contract valid?"}
77175
E4I -->|"no"| S
78-
E4I -->|"yes"| E4A{"MAKE-GRAPH source landscape and joint population control surfaces valid?"}
176+
E4I -->|"yes"| E4A{"MAKE-GRAPH source reconnaissance, runtime audit, and joint population control surfaces valid?"}
79177
E4A -->|"no"| S
80178
E4A -->|"yes"| E5["Derive next legal bounded action from manifest order, loop spec, cursor, log, and repo reality"]
81179
E5 --> E6["Execute one Markdown-authorized action"]

assets/protocol_assets/system/graph_population/v001/graph_population_protocol_schema.md

Lines changed: 173 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,177 @@ it, point Codex at the control protocol instead:
121121
assets/protocol_assets/system/graph_population/v001/graph_population_control_protocol.md
122122
```
123123

124+
125+
## Post-Run Correction Directives
126+
127+
These directives are normative corrections from full-scale MAKE-GRAPH testing.
128+
They exist to prevent a contextless Codex from treating structurally valid JSON
129+
or raw record counts as semantic graph completion.
130+
131+
### Post-Confirmation Materialization Gate
132+
133+
After graph intent is confirmed or explicitly authorized for inference, the next
134+
legal graph-building action is to materialize the graph intent contract and the
135+
initial bundle control surface. Source probing remains illegal until these
136+
artifacts exist in the generated bundle:
137+
138+
```text
139+
runs/<run_id>/reports/graph_intent_contract.md
140+
control_loop_plan.md
141+
runs/<run_id>/cursor.json
142+
runs/<run_id>/execution_log.md
143+
```
144+
145+
The graph intent contract must include:
146+
147+
```text
148+
domain_label
149+
graph_intent_status
150+
intent_resolution_mode
151+
confirmed_or_authorized_lens
152+
included_lenses
153+
excluded_lenses
154+
ordinary_entity_scope
155+
relation_scope
156+
source_scope
157+
domain_membership_rule
158+
type_membership_rule
159+
edge_evidence_rule
160+
downstream_gate
161+
created_before_source_probe: true
162+
next_legal_action_after_contract
163+
```
164+
165+
If source probing, source-adapter testing, type discovery, edge discovery,
166+
instance discovery, or graph JSON writing occurs before this materialization,
167+
stop with `graph_intent_materialization_order_violation`.
168+
169+
### Markdown-First Source Reconnaissance Directive
170+
171+
Source reconnaissance must be planned in Markdown before it is executed. Codex
172+
must write these run artifacts before any source result influences graph shape:
173+
174+
```text
175+
runs/<run_id>/reports/source_reconnaissance_plan.md
176+
runs/<run_id>/reports/source_family_registry.md
177+
runs/<run_id>/reports/source_landscape_map.md
178+
runs/<run_id>/reports/source_adapter_recovery_plan.md
179+
runs/<run_id>/reports/source_strategy_decision_log.md
180+
runs/<run_id>/batch_packets/*.md
181+
```
182+
183+
The source reconnaissance plan must define:
184+
185+
```text
186+
graph_intent_contract_path
187+
source_scope
188+
source_families
189+
source_adapters
190+
source_family_priority
191+
source_adapter_recovery_order
192+
minimum_domain_membership_evidence
193+
minimum_type_membership_evidence
194+
minimum_edge_pair_evidence
195+
batching_strategy
196+
failure_policy
197+
next_legal_action
198+
```
199+
200+
A source batch cache by itself is not a plan. Every source batch that influences
201+
candidate selection or graph JSON must have a prior Markdown batch packet. If a
202+
source result exists without a declared batch packet, stop with
203+
`source_result_without_declared_batch`.
204+
205+
### Generated Code Runtime Audit
206+
207+
Python, shell, notebooks, or inline code may perform only declared mechanical
208+
work after the controlling Markdown artifact exists. Mechanical work includes
209+
validation, serialization, counting, deterministic sorting, ID normalization,
210+
referential checks, and executing a declared source query from a Markdown batch
211+
packet.
212+
213+
Generated code must not decide graph intent, source strategy, semantic type
214+
selection, semantic edge selection, accepted/candidate status, or target-filling
215+
policy. If generated code is used at all during MAKE-GRAPH execution, the run
216+
must maintain:
217+
218+
```text
219+
runs/<run_id>/reports/generated_code_runtime_audit.md
220+
```
221+
222+
The audit must declare `generated_code_used: true` or `generated_code_used:
223+
false`. When true, it must include `declared_markdown_authority`,
224+
`mechanical_purpose`, `semantic_non_authority_statement`, `inputs`, `outputs`,
225+
`executed_at`, `cleanup_status`, and `safe_to_resume`. Missing audit means
226+
`hidden_runtime_audit_missing`. Generated code that owns semantic traversal
227+
means `hidden_semantic_runtime_detected`.
228+
229+
### Domain Membership Acceptance Rule
230+
231+
Source query shape creates candidates, not accepted records. QIDs, URLs, labels,
232+
search hits, source classes, endpoint co-presence, or adapter result membership
233+
do not by themselves prove domain membership.
234+
235+
An accepted fiber node must satisfy all of these predicates in source-backed,
236+
human-readable form:
237+
238+
```text
239+
type_membership_predicate
240+
domain_membership_predicate
241+
graph_intent_fit_predicate
242+
source_backing_predicate
243+
field_sufficiency_predicate
244+
```
245+
246+
Records that are only source-shape matches must remain candidate records with a
247+
non-counting status such as `candidate_source_shape_only`,
248+
`candidate_domain_membership_uncertain`, `candidate_type_membership_uncertain`,
249+
`candidate_graph_intent_uncertain`, `rejected`, or `deferred`. Candidate,
250+
rejected, and deferred records never count toward MAKE-GRAPH targets.
251+
252+
### Semantic Sample Audit
253+
254+
Before semantic completion, every MAKE-GRAPH run must write and pass:
255+
256+
```text
257+
runs/<run_id>/reports/semantic_sample_audit.md
258+
```
259+
260+
The audit must sample accepted records in human-readable form and check domain
261+
membership, type assignment, graph-intent fit, primitive relation status, and
262+
pair evidence. If an accepted sample is plainly wrong, stop with
263+
`domain_membership_audit_failed` or a more precise semantic failure. If labels
264+
or evidence are too sparse to audit, stop with `semantic_sample_audit_limited`.
265+
266+
### Accepted Target Reconciliation
267+
268+
MAKE-GRAPH target counts are accepted semantic targets, not raw JSON record
269+
counts. Semantic reports must reconcile raw records, accepted records, candidate
270+
records, rejected records, synthetic/completion records, and target satisfaction.
271+
272+
Required counters include:
273+
274+
```text
275+
requested_node_types
276+
accepted_node_types
277+
requested_edge_types
278+
accepted_edge_types
279+
requested_fiber_nodes_per_type
280+
accepted_fiber_nodes_counted
281+
candidate_fiber_node_records
282+
requested_fiber_edges_per_type
283+
accepted_fiber_edges_counted
284+
candidate_fiber_edge_records
285+
synthetic_or_completion_records_counted_toward_target: false
286+
candidate_records_counted_toward_target: false
287+
graph_build_targets_met
288+
semantic_acceptance_status
289+
```
290+
291+
If `semantic_acceptance_status` is not `passed`, the graph is not complete. The
292+
final response must say that first. Structural validation success may be
293+
reported only as supporting detail.
294+
124295
## Corrected Soft Control Flow Diagram
125296

126297
This diagram is the whole-system control flow. It is normative for both the
@@ -148,7 +319,7 @@ flowchart TD
148319
C5 --> C6["Initialize candidate graph JSON files"]
149320
C6 --> C7["Initialize run artifacts: structured cursor, initialized execution_log, source_batch_plan, reports, source_batches, batch_packets, tool_outputs"]
150321
C7 --> C7I["MAKE-GRAPH: write graph_intent_contract.md as the first run report artifact"]
151-
C7I --> C7A["MAKE-GRAPH: initialize source landscape map, source family registry, adapter frontier, and source strategy log"]
322+
C7I --> C7A["MAKE-GRAPH: initialize source reconnaissance plan, landscape map, source family registry, adapter frontier, recovery plan, and source strategy log"]
152323
C7A --> C7B["MAKE-GRAPH: initialize joint population feasibility and endpoint reservation plans"]
153324
C7B --> C8["Run generated-bundle acceptance checks"]
154325
C8 --> C9["Write runs/<run_id>/reports/generated_bundle_acceptance_report.md"]
@@ -164,7 +335,7 @@ flowchart TD
164335
E3 --> E4["Reconcile graph paths and inspect current graph JSON state"]
165336
E4 --> E4I{"MAKE-GRAPH graph intent contract valid?"}
166337
E4I -->|"no"| S
167-
E4I -->|"yes"| E4A{"MAKE-GRAPH source landscape and joint population control surfaces valid?"}
338+
E4I -->|"yes"| E4A{"MAKE-GRAPH source reconnaissance, runtime audit, and joint population control surfaces valid?"}
168339
E4A -->|"no"| S
169340
E4A -->|"yes"| E5["Derive next legal bounded action from manifest order, loop spec, cursor, log, and repo reality"]
170341
E5 --> E6["Execute one Markdown-authorized action"]

assets/protocol_assets/system/graph_population/v001/manifest.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
"Evidence Required",
5454
"Validation Required",
5555
"Completion Rule",
56+
"Semantic Acceptance Gate",
57+
"Recovery Policy",
58+
"Batch Execution",
5659
"Stop Conditions",
5760
"Handoff"
5861
],
@@ -66,7 +69,12 @@
6669
"runs/<run_id>/reports/source_strategy_decision_log.md",
6770
"runs/<run_id>/reports/joint_population_feasibility_plan.md",
6871
"runs/<run_id>/reports/endpoint_reservation_plan.md",
69-
"runs/<run_id>/reports/semantic_acceptance_report.md"
72+
"runs/<run_id>/reports/semantic_acceptance_report.md",
73+
"runs/<run_id>/reports/source_reconnaissance_plan.md",
74+
"runs/<run_id>/reports/source_adapter_recovery_plan.md",
75+
"runs/<run_id>/reports/generated_code_runtime_audit.md",
76+
"runs/<run_id>/reports/domain_membership_audit.md",
77+
"runs/<run_id>/reports/semantic_sample_audit.md"
7078
],
7179
"semantic_acceptance_validator_checks": [
7280
"source_landscape_artifacts_present",
@@ -79,7 +87,17 @@
7987
"graph_intent_contract_present",
8088
"graph_intent_alignment_loop_precedes_source_and_type_discovery",
8189
"graph_intent_downstream_gate_required",
82-
"semantic_acceptance_checks_graph_intent_fit"
90+
"semantic_acceptance_checks_graph_intent_fit",
91+
"graph_intent_contract_materialized_before_source_probe",
92+
"source_reconnaissance_plan_required_before_source_results",
93+
"source_result_requires_declared_batch_packet",
94+
"generated_code_runtime_audit_required",
95+
"candidate_records_never_count_toward_targets",
96+
"accepted_target_reconciliation_required",
97+
"semantic_sample_audit_required_before_completion",
98+
"domain_membership_audit_required_before_completion",
99+
"semantic_report_counter_contradictions_rejected",
100+
"completion_narration_must_match_semantic_status"
83101
]
84102
},
85103
"graph_contract": {

assets/protocol_assets/system/graph_population/v001/prompts/execute_bundle.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ continue_until: graph_build_targets_met unless manual debugging was explicitly
2020
requested. Execute only the bounded scope requested by continue_until. Validate affected graph state, append
2121
the execution log, update the cursor, and stop if any stop condition fires.
2222
23+
Post-run correction gates: for ordinary MAKE-GRAPH bundles, verify post-confirmation graph-intent materialization order, source reconnaissance plan and batch packets, generated code runtime audit, domain membership audit, semantic sample audit, and accepted-versus-candidate target reconciliation before any completion claim. Candidate, rejected, deferred, synthetic, deterministic, or completion-policy records do not count toward targets. If semantic acceptance is not passed, say the graph is not complete before reporting raw counts or structural validation.
24+
2325
Do not redesign the generated bundle unless explicitly invoked in REPAIR-BUNDLE
2426
mode. Do not write outside the allowed target files declared by the bundle.
2527
```

0 commit comments

Comments
 (0)