Commit ab9fe7d
committed
feat(nars): Sprint A — Intervention + Counterfactual verbs (PR-LL-1)
Closes the Pearl 2³ named-but-not-dispatched gap from the
neurosymbolic+RLVR+causal curriculum (PR #373 §6.1). Two new
NARS inference variants land as first-class verbs in the stack;
AriGraph gains an intervene_on() method producing counterfactual
SPO-G tagged with ContextTag::Intervention.
## Worker outputs (6 agents + main-thread coordination)
W1 — `lance-graph-planner/src/thinking/nars_dispatch.rs`:
- NarsInferenceType::Intervention (Pearl rung 2, conf_modifier=0.85)
- NarsInferenceType::Counterfactual (Pearl rung 3, conf_modifier=0.70)
- Doc comments cite Vashishtha 2025 (arXiv:2510.01539) + ICM
- Extended route(), detect_from_query(), confidence_modifier()
- Bridged 2 downstream exhaustive-match sites (nars/inference.rs,
orchestration_impl.rs) to Abduction semiring as stopgap
W2 — `lance-graph-planner/src/cache/nars_engine.rs`:
- Local Inference enum: Intervention=7, Counterfactual=8 added
- nars_infer() routes Intervention → Abduction × 0.85,
Counterfactual → Deduction × 0.70
- New style vectors: intervention_style() weights MASK_PO,
counterfactual_style() weights MASK_SPO
- inference_to_pearl_mask() + inference_to_style() dispatch helpers
- to_causal_edge() updated to map local 7/8 → W3's protocol enum
- 4 new tests covering confidence ordering, mask routing, weights,
roundtrip
W3 — `causal-edge/src/edge.rs`:
- Reclaimed Reserved5 → InferenceType::Intervention (slot 5)
- Reclaimed Reserved6 → InferenceType::Counterfactual (slot 6)
- from_bits() decoder updated
- No bit-layout change beyond renaming; binary compat preserved
W4 — `lance-graph/src/graph/arigraph/triplet_graph.rs`:
- pub enum ContextTag { Observation, Intervention } — SPO-G "G slot"
at the AriGraph data layer (raw_g()=0xFF for Intervention)
- pub struct CounterfactualSpoG { triplet, context }
- TripletGraph::intervene_on(subject, predicate, new_object) — Pearl
rung-2 do-calculus, original graph NOT mutated
W5 — NEW `lance-graph/tests/intervene_counterfactual.rs` (274 lines):
- 8 integration tests covering all 4 worker outputs end-to-end
- 7 pass; 1 marked #[ignore] (three_step_counterfactual_chain —
depends on abduction substrate wiring, target of PR-LL-4)
- clippy::cloned_ref_to_slice_refs fixed in main-thread cleanup
W6 — governance (backfilled by main thread due to permission snapshot):
- EPIPHANIES.md PREPEND: E-LL-1-INTERVENE entry
- AGENT_ORCHESTRATION_LOG.md appended W6 coordination line
- knowledge/causal-edge-64-spo-variant.md "Recent additions" section
## Verification
- `cargo check --workspace` exits 0 (W1's downstream patches kept it green)
- `cargo test -p lance-graph --test intervene_counterfactual` — 7/8 pass
(8th #[ignore] for PR-LL-4)
- Clippy lint fixed in W5's test (cloned_ref_to_slice_refs)
- AGENT_ORCHESTRATION_LOG records all 6 worker entries
## OQ ratifications (autoresolved per "autoattended" directive)
- OQ-LL-1: graded NARS confidence ∈ [0,1] (chosen)
- OQ-LL-5: clear ICM bit on counterfactual contradiction (deferred to
PR-LL-2 where IcmInvarianceColumn lands)
## Predecessor / successor
Predecessor: PR #373 (curriculum v1) + PR #372 (causaledge64 substrate)
Successor: PR-LL-2 (ICM-invariance column + Opt-Sym generator) consumes
the new G slot tagging1 parent e788551 commit ab9fe7d
12 files changed
Lines changed: 882 additions & 14 deletions
File tree
- .claude/board
- sprint-log-LL1/agents
- crates
- causal-edge/src
- lance-graph-planner/src
- cache
- nars
- thinking
- lance-graph
- src/graph/arigraph
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1232 | 1232 | | |
1233 | 1233 | | |
1234 | 1234 | | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | | - | |
24 | | - | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
38 | | - | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
0 commit comments