1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! Issue #559: the general recursive meta core, wired as one cohesive pass.
//!
//! Every request flows through the same pipeline before registry-backed method
//! dispatch executes the selected method:
//!
//! 1. the explicit, link-serializable problem frame (R330) — the meaning record
//! made first-class, enumerating every detected need (R7);
//! 2. the recursive, bounded downward decomposition into work units (R332) —
//! decompose until each leaf is directly solvable (R19);
//! 3. the need-satisfaction ledger (R333) — every detected need carries an
//! explicit status, a blocked need recorded rather than dropped (R8);
//! 4. the method registry (R331) — the catalogue of methods each atomic leaf can
//! route to, derived from the live dispatch constants and used by the solver's
//! live method dispatch;
//! 5. the bidirectional recursive reasoning (R337, R338) — a human-readable
//! thought at every recursive step. The downward pass (observe →
//! decompose/atomic → method) explains *how the request is taken apart*; the
//! upward construction pass (leaf method → compose children → root) explains
//! *how the answer is put back together*. Which directions are emitted is
//! governed by [`RecursionMode`](crate::meta_construction::RecursionMode)
//! (default `Down`, behavior-preserving), so the box is inspectable in both
//! directions, not just the predicate;
//! 6. the solution evidence (R334) — the end-to-end join, per need `frame →
//! work-unit leaf → status → method`, so "address every detected need" is one
//! auditable record;
//! 7. the method-selection trace (R339) — for every atomic leaf, the method the
//! single data-driven registry authority resolves (alias-aware), recorded so
//! the selection step of the algorithm is inspectable. Governed by
//! [`SelectionMode`](crate::selection::SelectionMode) (default `Off`, which
//! records nothing); a leaf with no serving method is recorded `unresolved`
//! rather than dropped;
//! 8. the skill-accumulation ledger (R342) — distilled from the solution evidence,
//! every satisfied need becomes a proposed reusable skill and every blocked need
//! a curriculum item, so the loop accumulates what it can do and a list of what
//! it cannot yet do. Governed by [`SkillMode`](crate::skill_ledger::SkillMode)
//! (default `Off`, which records nothing); it is proposal-only — no skill is ever
//! auto-promoted to stable without tests and a benchmark delta (C3).
//!
//! The recording stages are append-only: each stage appends Links Notation
//! artifacts to the event log. The same registry they record is also the live
//! method-selection authority used by `meta_method_dispatch`.
use crateEventLog;
use crateIntentFormalization;
use crateRecursionMode;
use crateSelectionMode;
use crateSkillMode;
/// Record the full meta core for one formalized prompt as trace events.
///
/// `max_depth` bounds the recursive decomposition so the downward pass always
/// terminates. `recursion_mode` selects which recursive directions are reasoned
/// about: the default ([`RecursionMode::Down`]) emits the downward decomposition
/// reasoning only, reproducing the pre-knob trace exactly (R13); `Up`/`Both`
/// additionally emit the upward construction pass. `selection_mode` selects
/// whether the per-leaf registry method-selection trace is recorded: the
/// default ([`SelectionMode::Off`]) records nothing. `skill_mode` selects whether
/// the skill-accumulation ledger is recorded: the default ([`SkillMode::Off`])
/// records nothing. The structural work-unit decomposition events
/// (`work_unit:enter` / `work_unit:exit`) are always emitted regardless of any
/// mode. This is the single seam the solver loop calls; keeping the stages together
/// here keeps the loop body small and the pipeline cohesive.
/// Apply the meta-core mode environment overrides in place.
///
/// `FORMAL_AI_RECURSION_MODE` selects which recursive directions are traced,
/// `FORMAL_AI_SELECTION_MODE` selects whether the method-selection trace is
/// recorded, and `FORMAL_AI_SKILL_MODE` selects whether the skill-accumulation
/// ledger is recorded; an unset or unrecognized value leaves the corresponding mode
/// at its (behavior-preserving) default. Kept here so the meta-core knobs are parsed
/// in one place rather than inline in [`crate::solver::SolverConfig::from_env`].