openclaw - 💡(How to fix) Fix Outcome scorer emits momentum events to GreyMatter [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49974Fetched 2026-04-08 01:00:36
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1locked ×1

Extend the outcome-scorer Stop hook to emit momentum events to the GreyMatter daemon after scoring entries. This connects the existing Rescorla-Wagner reward signal to the new thread-level momentum engine.

Root Cause

Extend the outcome-scorer Stop hook to emit momentum events to the GreyMatter daemon after scoring entries. This connects the existing Rescorla-Wagner reward signal to the new thread-level momentum engine.

RAW_BUFFERClick to expand / collapse

Summary

Extend the outcome-scorer Stop hook to emit momentum events to the GreyMatter daemon after scoring entries. This connects the existing Rescorla-Wagner reward signal to the new thread-level momentum engine.

Depends on

  • grey-matter: Thread-level momentum engine with biexponential decay

Implementation

In outcome-scorer.py, after scoring entries that map to threads:

  1. Connect to GreyMatter via TCP (reuse brain_gm.py pattern at localhost:7433)
  2. Send record_progress RPC with event_type: "outcome" and prediction_error from Rescorla-Wagner
  3. If direct RPC is too slow for Stop hook budget, enqueue to hook-worker as "momentum-event" type via enqueue.sh

Files

  • workspace-emotional/skills/emotional-memory/scripts/outcome-scorer.py — MODIFY

extent analysis

Fix Plan

To extend the outcome-scorer Stop hook, we need to implement the following steps:

  • Connect to GreyMatter via TCP
  • Send record_progress RPC with event_type: "outcome" and prediction_error from Rescorla-Wagner
  • Optionally, enqueue to hook-worker as "momentum-event" type if direct RPC is too slow

Code Changes

In outcome-scorer.py, add the following code:

import socket
import json

# Connect to GreyMatter via TCP
def connect_to_greymatter():
    host = 'localhost'
    port = 7433
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((host, port))
    return sock

# Send record_progress RPC
def send_rpc(sock, event_type, prediction_error):
    rpc_data = {
        'event_type': event_type,
        'prediction_error': prediction_error
    }
    sock.sendall(json.dumps(rpc_data).encode())

# Enqueue to hook-worker as "momentum-event" type
def enqueue_momentum_event(event_type, prediction_error):
    # Call enqueue.sh with "momentum-event" type
    # This step is optional and depends on the specific implementation of enqueue.sh
    pass

# Example usage:
sock = connect_to_greymatter()
send_rpc(sock, "outcome", 0.5)

Verification

To verify that the fix worked, check the GreyMatter daemon logs for incoming record_progress RPCs with event_type: "outcome" and the correct prediction_error value.

Extra Tips

  • Make sure to handle TCP connection errors and implement retries if necessary.
  • Consider adding logging and monitoring to track the success and failure of RPC sends and enqueue operations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING