[PR #126] [MERGED] feat(hats): add Event Publishing Guide and skip topology when hat active #150

Closed
opened 2026-02-27 10:22:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/126
Author: @mikeyobrien
Created: 1/27/2026
Status: Merged
Merged: 1/27/2026
Merged by: @mikeyobrien

Base: mainHead: feat/event-publishing-guide


📝 Commits (2)

  • 62f5b74 feat(hats): add Event Publishing Guide and skip topology when hat active
  • 5f0b468 fix: resolve formatting and clippy warnings from main

📊 Changes

4 files changed (+508 additions, -170 deletions)

View changed files

📝 crates/ralph-cli/src/loop_runner.rs (+60 -54)
📝 crates/ralph-core/src/event_loop/mod.rs (+4 -1)
📝 crates/ralph-core/src/event_loop/tests.rs (+51 -34)
📝 crates/ralph-core/src/hatless_ralph.rs (+393 -81)

📄 Description

Summary

Two improvements to reduce token usage and improve hat guidance:

  1. Event Publishing Guide: Auto-inject a guide into each active hat's instructions showing what happens when it publishes events
  2. Skip topology when hat active: When a specific hat is triggered, skip the table + Mermaid diagram (~300+ tokens saved)

Before (when hat is active)

## HATS

Delegate via events.

| Hat | Triggers On | Publishes | Description |
|-----|-------------|----------|-------------|
| Ralph | task.start, build.done... | build.task | Coordinates workflow... |
| 🔨 Builder | build.task | build.done, build.blocked | Builds code |

[mermaid diagram...]

### 🔨 Builder Instructions
...

After (when hat is active)

## ACTIVE HAT

### 🔨 Builder Instructions
...

### Event Publishing Guide

When you publish:
- `build.done` → Received by: 📝 Confessor (produces ConfessionReport)
- `build.blocked` → Received by: Ralph (coordinates next steps)

When Ralph is coordinating (no active hats)

Full topology table + Mermaid still shown - Ralph needs this for delegation decisions.

Test plan

  • Unit tests for event_publishing_guide() output format
  • Tests for topology shown only when coordinating
  • Tests for active hat gets instructions + guide only
  • All existing tests updated and passing
  • cargo test -p ralph-core passes
  • cargo clippy clean

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mikeyobrien/ralph-orchestrator/pull/126 **Author:** [@mikeyobrien](https://github.com/mikeyobrien) **Created:** 1/27/2026 **Status:** ✅ Merged **Merged:** 1/27/2026 **Merged by:** [@mikeyobrien](https://github.com/mikeyobrien) **Base:** `main` ← **Head:** `feat/event-publishing-guide` --- ### 📝 Commits (2) - [`62f5b74`](https://github.com/mikeyobrien/ralph-orchestrator/commit/62f5b74c2354de4f5f130bd0aad3242f3f04adf8) feat(hats): add Event Publishing Guide and skip topology when hat active - [`5f0b468`](https://github.com/mikeyobrien/ralph-orchestrator/commit/5f0b4687f42eb515a1925e12cf7c47a1d9627faa) fix: resolve formatting and clippy warnings from main ### 📊 Changes **4 files changed** (+508 additions, -170 deletions) <details> <summary>View changed files</summary> 📝 `crates/ralph-cli/src/loop_runner.rs` (+60 -54) 📝 `crates/ralph-core/src/event_loop/mod.rs` (+4 -1) 📝 `crates/ralph-core/src/event_loop/tests.rs` (+51 -34) 📝 `crates/ralph-core/src/hatless_ralph.rs` (+393 -81) </details> ### 📄 Description ## Summary Two improvements to reduce token usage and improve hat guidance: 1. **Event Publishing Guide**: Auto-inject a guide into each active hat's instructions showing what happens when it publishes events 2. **Skip topology when hat active**: When a specific hat is triggered, skip the table + Mermaid diagram (~300+ tokens saved) ### Before (when hat is active) ``` ## HATS Delegate via events. | Hat | Triggers On | Publishes | Description | |-----|-------------|----------|-------------| | Ralph | task.start, build.done... | build.task | Coordinates workflow... | | 🔨 Builder | build.task | build.done, build.blocked | Builds code | [mermaid diagram...] ### 🔨 Builder Instructions ... ``` ### After (when hat is active) ``` ## ACTIVE HAT ### 🔨 Builder Instructions ... ### Event Publishing Guide When you publish: - `build.done` → Received by: 📝 Confessor (produces ConfessionReport) - `build.blocked` → Received by: Ralph (coordinates next steps) ``` ### When Ralph is coordinating (no active hats) Full topology table + Mermaid still shown - Ralph needs this for delegation decisions. ## Test plan - [x] Unit tests for `event_publishing_guide()` output format - [x] Tests for topology shown only when coordinating - [x] Tests for active hat gets instructions + guide only - [x] All existing tests updated and passing - [x] `cargo test -p ralph-core` passes - [x] `cargo clippy` clean --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 10:22:25 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#150
No description provided.