Skip to content

Conversation

@imarshallwidjaja
Copy link
Contributor

@imarshallwidjaja imarshallwidjaja commented Jan 10, 2026

Summary

While playing around I found that no matter what happens the first prompt from Prometheus to Momus always results in a rejection because of content wrapping the plan path. I also found after every reviewed loop prometheus will forget about the rejection again, this means there are repeat "useless" calls to Momus. Fix the planning workflow where Momus (Plan Reviewer) rejects execution due to strict input format validation when the incoming string contains wrapper text or system directives injected by Prometheus task tools.

Problem

When Prometheus calls task tools (sisyphus_task, task, call_omo_agent), the prometheus-md-only hook appends a multi-line system directive block (PLANNING_CONSULT_WARNING) to the tool prompt. This means Momus routinely receives non-path text even when Prometheus tries to pass only a path.

On top of that it seems that Prometheus will occasionally forget its directive on how to communicate with Prometheus and begin appending soft phrases around the file path again.

The original Momus prompt had a strict validation rule: "reject if any additional words exist beyond the file path." This caused valid invocations like Please review: .sisyphus/plans/issue-623.md (with or without the injected system directive block) to be rejected, blocking plan reviews.

Solution Approach

  • Momus should be liberal in what it accepts: extract a plan file path from noisy input (including appended system directive blocks) and proceed.
  • Prometheus should be conservative in what it sends: avoid adding additional conversational wrappers beyond the path (though system hooks may still append directives).

Changes

Momus Agent (src/agents/momus.ts)

  • Replaced strict input validation with an extraction algorithm:

    1. Ignore injected system directive blocks, especially [SYSTEM DIRECTIVE - READ-ONLY PLANNING CONSULTATION] (remove the whole block, including --- separators and bullet lines)
    2. Strip other system directive wrappers (bracket-style blocks and XML-style tags)
    3. Strip markdown wrappers around paths (code fences and inline backticks)
    4. Extract plan paths by finding all substrings containing .sisyphus/plans/ and ending in .md
    5. If exactly 1 match → ACCEPT and proceed
    6. If 0 matches → REJECT with "no plan path found"
    7. If 2+ matches → REJECT with "ambiguous: multiple plan paths"
  • Updated examples: Moved Please review .sisyphus/plans/plan.md from INVALID to VALID

  • Updated rejection messages: Include specific reason (Reason: no plan path found or Reason: multiple plan paths found)

Prometheus Agent (src/agents/prometheus-prompt.ts)

  • Added explicit "MOMUS INVOCATION RULE": When invoking Momus, provide ONLY the file path string as the prompt
  • Clarified: Do NOT wrap in explanations, markdown, or conversational text (system hooks may append directives, which is expected)

Test Coverage (src/agents/momus.test.ts, src/agents/prometheus-prompt.test.ts)

  • Added prompt policy tests that verify the new behavior requirements
  • Tests use stable anchor strings rather than brittle full-text matching
  • Follow TDD workflow: tests added first (RED), prompts updated (GREEN)

Before:

  • Input: Please review: .sisyphus/plans/issue-623.md → ❌ I REJECT (Input Format Validation)
  • Input: .sisyphus/plans/plan.md with appended [SYSTEM DIRECTIVE...] block → ❌ Rejected

After:

  • Input: Please review: .sisyphus/plans/issue-623.md → ✅ Extracts path, proceeds to review
  • Input: .sisyphus/plans/plan.md with appended [SYSTEM DIRECTIVE...] block → ✅ Strips directive block, extracts path, proceeds

Testing

bun test src/agents/momus.test.ts
bun test src/agents/prometheus-prompt.test.ts
bun test
  • 4 new tests in momus.test.ts (prompt policy requirements)
  • 2 new tests in prometheus-prompt.test.ts (invocation policy)
  • All tests pass
  • Manual verification:
    • Static analysis of prompt content confirms extraction algorithm and policy changes
    • Prompting Sisyphus to prompt Momus, replicating several prompt and tracking which elicits a response and which gets a rejection:

Test Results

Input Type Input Result Expected
Clean path .sisyphus/plans/issue-623.md ✅ OKAY - proceeded to evaluate plan ✅ Pass
Conversational wrapper Please review: .sisyphus/plans/issue-623.md ✅ OKAY - proceeded to evaluate plan ✅ Pass
Mode block wrapper [analyze-mode]\nPlease review: .sisyphus/plans/issue-623.md ✅ OKAY - proceeded to evaluate plan ✅ Pass
With PLANNING_CONSULT_WARNING Path + full [SYSTEM DIRECTIVE - READ-ONLY PLANNING CONSULTATION] block ✅ OKAY - proceeded to evaluate plan ✅ Pass
No plan path Review the plan. I REJECT (Input Format Validation)
Reason: no plan path found
✅ Pass
Multiple plan paths Please review both .sisyphus/plans/issue-623.md and .sisyphus/plans/momus-input-validation-prometheus-handoff.md I REJECT (Input Format Validation)
Reason: multiple plan paths found
✅ Pass

Related Issues


Summary by cubic

Fixes false rejections when Prometheus passes plan paths to Momus by relaxing Momus input validation and tightening Prometheus’s Momus calls. This unblocks plan reviews and cuts repeated calls.

  • Bug Fixes
    • Momus: replace strict “path-only” check with path extraction that ignores system directive blocks and wrappers; accept exactly one .sisyphus/plans/*.md; reject none/multiple with clear reasons.
    • Prometheus: add rule to send only the file path (no markdown or chatter); system hook directives are expected.
    • Tests: add prompt policy tests for both agents to lock this behavior.

Written for commit 49555ca. Summary will update on new commits.

imarshallwidjaja and others added 2 commits January 10, 2026 23:51
Add test assertions that encode the new expected prompt behavior for
Momus input validation and Prometheus Momus invocation policy.

Tests verify that:
- Momus prompt treats SYSTEM DIRECTIVE blocks as ignorable
- Momus prompt extracts paths containing .sisyphus/plans/ and ending in .md
- Momus prompt allows conversational wrappers (removes old "Please review" rejection)
- Momus prompt handles ambiguity (multiple paths) and "no path found" cases
- Prometheus prompt directs path-only invocation for Momus (no wrappers)

These tests will fail until the prompt updates in the next commit (TDD RED phase).

Co-Authored-By: Sisyphus <[email protected]>
…s calls

Fix the planning workflow where Momus (Plan Reviewer) rejects execution
due to strict input format validation when the incoming string contains
wrapper text or system directives.

Changes:
- Momus prompt: Replace strict "ONLY file path" rule with extraction
  algorithm that finds .sisyphus/plans/*.md paths anywhere in input
- Momus prompt: Explicitly ignore [SYSTEM DIRECTIVE - READ-ONLY PLANNING
  CONSULTATION] blocks appended by Prometheus task tools
- Momus prompt: Strip markdown wrappers (backticks, code fences) before
  path extraction
- Momus prompt: Update rejection logic to only reject when no path found
  or multiple paths found (not when conversational wrappers present)
- Momus prompt: Move "Please review .sisyphus/plans/plan.md" from INVALID
  to VALID examples
- Prometheus prompt: Add explicit "MOMUS INVOCATION RULE" directing
  path-only prompts (even though system hooks may append directives)

This unblocks plan reviews by making Momus reliably locate plan file paths
from real-world input strings, while tightening Prometheus guidance to
avoid adding noise.

Tests: All prompt policy tests now pass (TDD GREEN phase)
Co-Authored-By: Sisyphus <[email protected]>
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Was made when testing across different models. Forgot to change it back

Co-Authored-By: Sisyphus <[email protected]>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Confidence score: 4/5

  • Unescaped dots in src/agents/momus.test.ts mean the constructed regex could match unintended files, so the tests might not actually cover the intended cases.
  • Given it affects only test reliability, the risk to production behavior remains low and the PR still feels safe to merge with a quick follow-up fix.
  • Pay close attention to src/agents/momus.test.ts - the regex should escape literal dots to ensure accurate test matching.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/agents/momus.test.ts">

<violation number="1" location="src/agents/momus.test.ts:33">
P2: Unescaped regex special characters in `new RegExp()`. The `.` characters in the file path will match any character instead of literal dots, potentially causing incorrect test behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/agents/momus.ts">

<violation number="1">
P2: Model change contradicts PR description. The description claims to switch to `opencode/grok-code`, but the code actually switches to `openai/gpt-5.2`. Please clarify the intended model and update either the code or the PR description to match.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Escape regex special characters when building RegExp from file path in
momus.test.ts. The `.` characters in ".sisyphus/plans/plan.md" were matching
any character instead of literal dots.

Added escapeRegExp() helper and applied it when constructing the regex pattern.
All tests pass.

Co-Authored-By: Sisyphus <[email protected]>
@code-yeongyu code-yeongyu merged commit f27e93b into code-yeongyu:dev Jan 11, 2026
3 checks passed
@imarshallwidjaja imarshallwidjaja deleted the fix/Fix-Momus-Agent-Input-Validation-&-Prometheus-Handoff branch January 13, 2026 00:06
kdcokenny pushed a commit that referenced this pull request Jan 13, 2026
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