Skip to content

feat(orchestrator): self-regulated thinking — graph sensorium + temperature + NARS auto-heal - #23

Merged
AdaWorldAPI merged 7 commits into
mainfrom
claude/transcode-deepnsm-rust-oNa1Z
Mar 28, 2026
Merged

feat(orchestrator): self-regulated thinking — graph sensorium + temperature + NARS auto-heal#23
AdaWorldAPI merged 7 commits into
mainfrom
claude/transcode-deepnsm-rust-oNa1Z

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Three new self-awareness mechanisms:

GraphSensorium — real-time signals from the knowledge graph:

  • contradiction_rate: contradictions / active_triplets
  • truth_entropy: Shannon entropy of confidence distribution
  • revision_velocity: revisions/step (learning rate)
  • plasticity_flux: fraction of Hot entities (environment change rate)
  • deduction_yield: inference success rate
  • episodic_saturation: memory fullness
    → suggested_bias(): Resolve/Explore/Exploit/Adapt/Stagnant/Balanced

Temperature — LLM-style noise injection for stale thinking:

  • 0.0 = deterministic (normal greedy topology selection)
  • 1.0 = maximum randomness (break out of local optima)
  • Auto-increases on GraphBias::Stagnant (thinking is stuck)
  • Auto-decreases on GraphBias::Exploit (graph is consistent)
  • Injected as deterministic noise into topology expected_quality scores

NARS Auto-Heal Contingency — the immune system:

  • BootstrapTruth: uninitialized truth values → set from_evidence(1,0)
  • ResolveContradictions: high contradiction rate → reduce conflicting confidence
  • InferMissingLinks: consistent but sparse → run deduction to fill gaps
  • CompactDeleted: high episodic saturation → garbage collect
  • NormalizeTruth: possible confidence inflation → re-scale
  • ResetTopology: orchestrator learning poisoned → wipe NARS edges,
    warm restart with temperature=0.5, hardcoded fallback

The self-regulation loop:
graph mutations → GraphSensorium::compute()
→ update_sensorium() adjusts temperature
→ auto_heal() diagnoses + prescribes healing actions
→ select_next() uses from_graph_signals() for MUL assessment
→ DK position derived from graph consistency (demonstrated) vs topology confidence (felt)
→ style selection modulated by temperature + MUL free_will
→ execution → graph mutations → loop

12 new tests for sensorium, temperature, auto-heal, graph bias.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7

claude added 7 commits March 28, 2026 06:57
- deepnsm.rs: lightweight NSM (Natural Semantic Metalanguage) module
  for the cockpit notebook system. 74 universal semantic primes,
  113-word vocabulary, nsm_decompose(), cosine similarity, legality
  analysis (primes ratio, molecules ratio, circularity detection).
  Zero external dependencies. 13 tests passing.

Transcoded from Python DeepNSM (AdaWorldAPI/DeepNSM).

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
osint_audit.rs (notebook-query):
  - OsintRegistry: global singleton with atomic counters for 12 pipeline stages
    (extraction, refinement, planning, classification, deduction, contradiction,
    revision, episodic_store, episodic_retrieve, graph_bfs, spatial_path, xai_api)
  - OsintGraphHealth: triplet count, truth distribution, contradictions,
    episodic saturation, NARS inference stats
  - XaiStatus: ADA_XAI env var presence, call counts, failure rate
  - run_osint_audit(): full health report with prioritized recommendations
  - 7 tests

cockpit-server:
  - New route: GET /api/debug/osint → osint_audit_handler
  - Real-time AriGraph health monitoring alongside neural-debug strategy checks

The /api/debug/osint endpoint enables reading "brain" activation and plasticity
via verbose debug — every NARS deduction, contradiction detection, and evidence
revision is counted atomically. Combined with neural-debug's static scanner,
this gives both compile-time (dead/stub/NaN) and runtime (call count, latency,
success rate) visibility into the full OSINT pipeline.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
… reasoning

notebook-query/mri.rs (500+ lines):
  - BrainRegion model: 4 regions (perception, reasoning, memory, action)
    each with sub-regions mapped from OSINT pipeline stages
  - PlasticityState: Hot/Warm/Frozen/Conflicted per entity
    (maps to CausalEdge64 bits 49-51)
  - ThinkingStyleActivation: per-style call count, quality, NARS effectiveness truth
  - ReasoningChain: traced NARS inference steps (deduction/abduction/induction)
  - ScanMode: Structural (topology), Functional (activation), Full (DTI with chains)
  - run_brain_mri(): collects all data into single BrainMri response
  - Health score: region activation minus conflict penalty
  - Findings: auto-detected hot plasticity, frozen regions, contradictions
  - 6 tests

cockpit-server routes:
  - GET /mri                  → standalone HTML page with live visualization
    Auto-refreshes every 5s. Color-coded regions (hot=red, frozen=blue,
    active=green, conflicted=amber). Bar charts for activation levels.
  - GET /api/mri/scan         → JSON API (full scan)
  - GET /api/mri/scan/:mode   → JSON API (structural/functional/full)

The MRI page shows:
  1. Brain regions with activation bars (perception/reasoning/memory/action)
  2. Plasticity map: which entities are Hot (learning) vs Frozen vs Conflicted
  3. NARS reasoning chains: active deduction/abduction/induction traces
  4. Findings: auto-generated health assessment

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
orchestrator.rs (550+ lines, 11 tests):

  MetaOrchestrator: self-monitoring agent loop with two transparent modes:

  1. ADAPTIVE (default): NARS topology learns which thinking style
     sequences produce good outcomes. 4×4 = 16 directed edges, each
     with a TruthValue (frequency=success rate, confidence=evidence
     strength). Selection: exploit highest expected quality (85%) or
     explore least-observed edge (15%) for information gain.

  2. HARDCODED FALLBACK: When rolling efficiency drops below 0.35,
     transparently switches to plan→act→explore→reflex sequence.
     When fallback efficiency exceeds 0.55, re-enables adaptive
     mode with an exploration burst.

  The meta-awareness layer monitors its OWN efficiency:
  - Rolling window of last 20 outcome qualities
  - NARS revision on every (style_from → style_to) transition
  - Automatic mode switching with full event log
  - Every mode switch recorded with reason + efficiency at switch time

  This IS "thinking about thinking": the orchestrator observes which
  cognitive styles are effective, learns optimal sequences via NARS
  evidence accumulation, detects when learning isn't working (low
  efficiency), and falls back to a known-good baseline. The /mri
  endpoint shows the full topology — which style transitions have
  high confidence, which are being explored, whether the system is
  in adaptive or fallback mode and why.

cockpit-server routes:
  - GET  /api/orchestrator/status → full snapshot (mode, topology, efficiency)
  - POST /api/orchestrator/step   → execute one step + optional quality feedback

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
…ompass

The Meta-Uncertainty Layer now modulates every orchestrator decision:

  Dunning-Kruger position (4 states):
    MountStupid      → ForceSandbox (Reflex only, block all autonomous action)
    ValleyOfDespair  → ForceExplore + 2× exploration rate (you're learning)
    SlopeOfEnlightenment → Normal operation, 1× exploration
    PlateauOfMastery → 0.5× exploration (exploit, you've earned it)

  Trust texture (3 levels):
    Crystalline → trust topology weights fully (free_will × 1.0)
    Fibrous     → moderate discount (free_will × 0.7)
    Fuzzy       → heavy discount (free_will × 0.4), distrust learned edges

  Flow state (4 modes):
    Flow    → normal patience, normal thresholds
    Boredom → 1.5× patience, wider thresholds, more exploration
    Anxiety → 0.5× patience, tighter fallback (trigger sooner)
    Apathy  → 0.25× patience, fast fallback

  Compass override:
    ForceSandbox → Mount Stupid detected, return Reflex only
    ForceExplore → Valley + very low competence, override topology

  free_will_modifier = DK_humility × trust_factor × flow_patience
  Scales topology expected_quality — low free_will = distrust your own learning.

  MulAssessment auto-derives from rolling efficiency (demonstrated competence)
  vs topology confidence (felt competence). This closes the self-assessment
  loop: the system's belief about its own ability is compared against
  actual measured performance, and the gap determines DK position.

  New StepReason::MulOverride variant for compass/DK overrides.
  Every StepResult now carries the full MulAssessment that drove it.
  Mode switch reasons now include DK position and flow state.
  Snapshot includes MUL for /mri visualization.

  6 new tests for MUL integration.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
…rature + NARS auto-heal

Three new self-awareness mechanisms:

GraphSensorium — real-time signals from the knowledge graph:
  - contradiction_rate: contradictions / active_triplets
  - truth_entropy: Shannon entropy of confidence distribution
  - revision_velocity: revisions/step (learning rate)
  - plasticity_flux: fraction of Hot entities (environment change rate)
  - deduction_yield: inference success rate
  - episodic_saturation: memory fullness
  → suggested_bias(): Resolve/Explore/Exploit/Adapt/Stagnant/Balanced

Temperature — LLM-style noise injection for stale thinking:
  - 0.0 = deterministic (normal greedy topology selection)
  - 1.0 = maximum randomness (break out of local optima)
  - Auto-increases on GraphBias::Stagnant (thinking is stuck)
  - Auto-decreases on GraphBias::Exploit (graph is consistent)
  - Injected as deterministic noise into topology expected_quality scores

NARS Auto-Heal Contingency — the immune system:
  - BootstrapTruth: uninitialized truth values → set from_evidence(1,0)
  - ResolveContradictions: high contradiction rate → reduce conflicting confidence
  - InferMissingLinks: consistent but sparse → run deduction to fill gaps
  - CompactDeleted: high episodic saturation → garbage collect
  - NormalizeTruth: possible confidence inflation → re-scale
  - ResetTopology: orchestrator learning poisoned → wipe NARS edges,
    warm restart with temperature=0.5, hardcoded fallback

The self-regulation loop:
  graph mutations → GraphSensorium::compute()
    → update_sensorium() adjusts temperature
    → auto_heal() diagnoses + prescribes healing actions
    → select_next() uses from_graph_signals() for MUL assessment
    → DK position derived from graph consistency (demonstrated) vs topology confidence (felt)
    → style selection modulated by temperature + MUL free_will
    → execution → graph mutations → loop

12 new tests for sensorium, temperature, auto-heal, graph bias.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
@AdaWorldAPI
AdaWorldAPI merged commit e1dd50d into main Mar 28, 2026
AdaWorldAPI pushed a commit that referenced this pull request Aug 11, 2026
The decode half of the .chains codec (osm-soa-bake PR #23): the bake
already computed every way's z=32 vertex chain and dropped it after
mean_cell — the sidecar un-discards it, and this side reads it back.

- osm_features: GET /api/osm/geometry/:idx — open the .chains sidecar
  once (OnceLock), REFUSE it unless its slab_digest matches the mapped
  slab (cross-bake geometry against another bake's identities is the
  drift the pin exists to make loud), resolve row -> identity ordinal ->
  chain -> lon/lat points. 404 when no chain is stored (nodes,
  relations) — never 200-with-empty.
- osm page: an SVG shape layer inside #tiles (inherits the map
  transform); classFor(tags) fills water/building/wood/green rings and
  strokes highways; showShape wired into the existing click detail.
- osm_slab_hydrate: ARTIFACTS grows to berlin.chains — a deploy now
  hydrates all three artifacts (~1.42 GB cold; volume >= 2 GB). The
  bucket's SHA256SUMS gained the third line additively, so binaries
  reading only soa+books still verify.

Verified in a real browser against the real Berlin bake: a genuine
click on a harbour dot resolved "Westhafen I" (natural=water,
water=harbour) and drew its shore ring filled; building and landuse
rings and a highway polyline drawn via the page's own showFeature; a
node correctly 404s; zero page errors.

Gaps the POC now makes visible (by design — the POC is the falsifier):
shapes are click-only rather than a base fill layer with a node/street
overlay; multipolygon relations are unassembled; small rings are
sub-pixel at overview zoom. Recorded in the plan's Phase 8.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants