EIDOS episodic reasoning: prediction-outcome tracking for agent evolution #601

Description

@AlexMikhalev

Summary

Implement episodic reasoning in terraphim_agent_evolution: every advisory/decision carries a predicted outcome. When the actual outcome is observed, prediction accuracy feeds back into future confidence scoring.

Motivation

Inspired by vibeship-spark-intelligence EIDOS (Episode-based Distillation) loop. terraphim_agent_evolution exists as a crate but is incomplete -- it's supposed to "track agent performance metrics, evolve agent capabilities over time." EIDOS provides the concrete mechanism.

EIDOS Loop

1. PREDICT: "This advisory/action will produce outcome X"
|
2. ACT: Agent or developer takes action
|
3. OBSERVE: Actual outcome Y recorded
|
4. EVALUATE: Compare prediction X vs outcome Y, compute accuracy
|
5. DISTILL: Update confidence for this class of advisory/action
|
(loop)

Concrete Application in Terraphim

Learning Capture Predictions

When terraphim-agent learn surfaces a past learning as advisory:

  • Predict: "Following this learning will prevent error type Z"
  • Observe: Did the developer follow the advice? Did the error recur?
  • Evaluate: If followed and error didn't recur -> prediction validated
  • Distill: Increase learning's reliability score

Judge Verdict Predictions

When the judge system issues a verdict:

  • Predict: "This code change will cause issue type Z if merged"
  • Observe: Was the verdict followed? Did the predicted issue manifest?
  • Evaluate: If ignored and issue manifested -> judge was right but ignored
  • Distill: Increase judge finding weight for this pattern

Hook Replacement Predictions

When terraphim_hooks replaces text (e.g., npm -> bun):

  • Predict: "This replacement will succeed without side effects"
  • Observe: Did the subsequent command succeed?
  • Evaluate: If replacement caused a failure -> hook rule needs refinement
  • Distill: Update hook confidence or add exception rule

Implementation Plan

1. Prediction type in terraphim_types

pubstructPrediction{pubid:Ulid,pubsource:PredictionSource,// Learning, Judge, Hook, Agentpubpredicted_outcome:String,pubconfidence:f64,// 0.0 - 1.0pubcreated_at: jiff::Timestamp,pubobserved_outcome:Option<ObservedOutcome>,pubaccuracy:Option<f64>,}

2. Prediction tracking in terraphim_agent_evolution

3. Confidence feedback

Affected Crates

  • terraphim_agent_evolution (primary -- implement EIDOS loop)
  • terraphim_types (add Prediction, ObservedOutcome types)
  • terraphim_hooks (emit predictions for text replacements)
  • terraphim_mcp_server (expose prediction accuracy metrics)

Dependencies

Estimated Effort

~1 day for prediction types + basic tracking. Feedback loop refinement is ongoing.

Key Insight

Agent evolution is not about self-modifying code (Ouroboros pattern). It's about self-improving knowledge quality. The evolution happens in the advisory confidence scores, not in the source code. This is the right approach for terraphim's deterministic-first philosophy -- the Aho-Corasick engine stays constant, the confidence weights evolve.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
      Skip to content

      EIDOS episodic reasoning: prediction-outcome tracking for agent evolution #601

      Description

      @AlexMikhalev

      Summary

      Implement episodic reasoning in terraphim_agent_evolution: every advisory/decision carries a predicted outcome. When the actual outcome is observed, prediction accuracy feeds back into future confidence scoring.

      Motivation

      Inspired by vibeship-spark-intelligence EIDOS (Episode-based Distillation) loop. terraphim_agent_evolution exists as a crate but is incomplete -- it's supposed to "track agent performance metrics, evolve agent capabilities over time." EIDOS provides the concrete mechanism.

      EIDOS Loop

      1. PREDICT: "This advisory/action will produce outcome X"
      |
      2. ACT: Agent or developer takes action
      |
      3. OBSERVE: Actual outcome Y recorded
      |
      4. EVALUATE: Compare prediction X vs outcome Y, compute accuracy
      |
      5. DISTILL: Update confidence for this class of advisory/action
      |
      (loop)
      

      Concrete Application in Terraphim

      Learning Capture Predictions

      When terraphim-agent learn surfaces a past learning as advisory:

      • Predict: "Following this learning will prevent error type Z"
      • Observe: Did the developer follow the advice? Did the error recur?
      • Evaluate: If followed and error didn't recur -> prediction validated
      • Distill: Increase learning's reliability score

      Judge Verdict Predictions

      When the judge system issues a verdict:

      • Predict: "This code change will cause issue type Z if merged"
      • Observe: Was the verdict followed? Did the predicted issue manifest?
      • Evaluate: If ignored and issue manifested -> judge was right but ignored
      • Distill: Increase judge finding weight for this pattern

      Hook Replacement Predictions

      When terraphim_hooks replaces text (e.g., npm -> bun):

      • Predict: "This replacement will succeed without side effects"
      • Observe: Did the subsequent command succeed?
      • Evaluate: If replacement caused a failure -> hook rule needs refinement
      • Distill: Update hook confidence or add exception rule

      Implementation Plan

      1. Prediction type in terraphim_types

      pubstructPrediction{pubid:Ulid,pubsource:PredictionSource,// Learning, Judge, Hook, Agentpubpredicted_outcome:String,pubconfidence:f64,// 0.0 - 1.0pubcreated_at: jiff::Timestamp,pubobserved_outcome:Option<ObservedOutcome>,pubaccuracy:Option<f64>,}

      2. Prediction tracking in terraphim_agent_evolution

      3. Confidence feedback

      Affected Crates

      • terraphim_agent_evolution (primary -- implement EIDOS loop)
      • terraphim_types (add Prediction, ObservedOutcome types)
      • terraphim_hooks (emit predictions for text replacements)
      • terraphim_mcp_server (expose prediction accuracy metrics)

      Dependencies

      Estimated Effort

      ~1 day for prediction types + basic tracking. Feedback loop refinement is ongoing.

      Key Insight

      Agent evolution is not about self-modifying code (Ouroboros pattern). It's about self-improving knowledge quality. The evolution happens in the advisory confidence scores, not in the source code. This is the right approach for terraphim's deterministic-first philosophy -- the Aho-Corasick engine stays constant, the confidence weights evolve.

      Activity

      Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

      Metadata

      Metadata

      Assignees

      No one assigned

        Labels

        Type

        No type

        Projects

        No projects

          Milestone

          No milestone

          Relationships

          None yet

          Development

          No branches or pull requests

          Issue actions

          , 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
          Skip to content

          EIDOS episodic reasoning: prediction-outcome tracking for agent evolution #601

          Description

          @AlexMikhalev

          Summary

          Implement episodic reasoning in terraphim_agent_evolution: every advisory/decision carries a predicted outcome. When the actual outcome is observed, prediction accuracy feeds back into future confidence scoring.

          Motivation

          Inspired by vibeship-spark-intelligence EIDOS (Episode-based Distillation) loop. terraphim_agent_evolution exists as a crate but is incomplete -- it's supposed to "track agent performance metrics, evolve agent capabilities over time." EIDOS provides the concrete mechanism.

          EIDOS Loop

          1. PREDICT: "This advisory/action will produce outcome X"
          |
          2. ACT: Agent or developer takes action
          |
          3. OBSERVE: Actual outcome Y recorded
          |
          4. EVALUATE: Compare prediction X vs outcome Y, compute accuracy
          |
          5. DISTILL: Update confidence for this class of advisory/action
          |
          (loop)
          

          Concrete Application in Terraphim

          Learning Capture Predictions

          When terraphim-agent learn surfaces a past learning as advisory:

          • Predict: "Following this learning will prevent error type Z"
          • Observe: Did the developer follow the advice? Did the error recur?
          • Evaluate: If followed and error didn't recur -> prediction validated
          • Distill: Increase learning's reliability score

          Judge Verdict Predictions

          When the judge system issues a verdict:

          • Predict: "This code change will cause issue type Z if merged"
          • Observe: Was the verdict followed? Did the predicted issue manifest?
          • Evaluate: If ignored and issue manifested -> judge was right but ignored
          • Distill: Increase judge finding weight for this pattern

          Hook Replacement Predictions

          When terraphim_hooks replaces text (e.g., npm -> bun):

          • Predict: "This replacement will succeed without side effects"
          • Observe: Did the subsequent command succeed?
          • Evaluate: If replacement caused a failure -> hook rule needs refinement
          • Distill: Update hook confidence or add exception rule

          Implementation Plan

          1. Prediction type in terraphim_types

          pubstructPrediction{pubid:Ulid,pubsource:PredictionSource,// Learning, Judge, Hook, Agentpubpredicted_outcome:String,pubconfidence:f64,// 0.0 - 1.0pubcreated_at: jiff::Timestamp,pubobserved_outcome:Option<ObservedOutcome>,pubaccuracy:Option<f64>,}

          2. Prediction tracking in terraphim_agent_evolution

          3. Confidence feedback

          Affected Crates

          • terraphim_agent_evolution (primary -- implement EIDOS loop)
          • terraphim_types (add Prediction, ObservedOutcome types)
          • terraphim_hooks (emit predictions for text replacements)
          • terraphim_mcp_server (expose prediction accuracy metrics)

          Dependencies

          Estimated Effort

          ~1 day for prediction types + basic tracking. Feedback loop refinement is ongoing.

          Key Insight

          Agent evolution is not about self-modifying code (Ouroboros pattern). It's about self-improving knowledge quality. The evolution happens in the advisory confidence scores, not in the source code. This is the right approach for terraphim's deterministic-first philosophy -- the Aho-Corasick engine stays constant, the confidence weights evolve.

          Activity

          Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

          Metadata

          Metadata

          Assignees

          No one assigned

            Labels

            Type

            No type

            Projects

            No projects

              Milestone

              No milestone

              Relationships

              None yet

              Development

              No branches or pull requests

              Issue actions