Merge pull request #2466 from code-yeongyu/fix/anti-dup-prometheus-metis
fix(agents): add anti-duplication rules to Prometheus and Metis
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { describe, it, expect } from "bun:test"
|
import { describe, it, expect } from "bun:test"
|
||||||
import { buildAntiDuplicationSection } from "./dynamic-agent-prompt-builder"
|
import { buildAntiDuplicationSection } from "./dynamic-agent-prompt-builder"
|
||||||
|
import { METIS_SYSTEM_PROMPT } from "./metis"
|
||||||
|
|
||||||
describe("buildAntiDuplicationSection", () => {
|
describe("buildAntiDuplicationSection", () => {
|
||||||
it("#given no arguments #when building anti-duplication section #then returns comprehensive rule section", () => {
|
it("#given no arguments #when building anti-duplication section #then returns comprehensive rule section", () => {
|
||||||
@@ -90,3 +91,16 @@ describe("buildAntiDuplicationSection", () => {
|
|||||||
expect(result).toContain("</Anti_Duplication>")
|
expect(result).toContain("</Anti_Duplication>")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("METIS_SYSTEM_PROMPT anti-duplication coverage", () => {
|
||||||
|
it("#given the system prompt #when reading delegated exploration rules #then includes anti-duplication guidance", () => {
|
||||||
|
// given
|
||||||
|
const prompt = METIS_SYSTEM_PROMPT
|
||||||
|
|
||||||
|
// when / then
|
||||||
|
expect(prompt).toContain("<Anti_Duplication>")
|
||||||
|
expect(prompt).toContain("Anti-Duplication Rule")
|
||||||
|
expect(prompt).toContain("DO NOT perform the same search yourself")
|
||||||
|
expect(prompt).toContain("non-overlapping work")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { AgentConfig } from "@opencode-ai/sdk"
|
import type { AgentConfig } from "@opencode-ai/sdk"
|
||||||
import type { AgentMode, AgentPromptMetadata } from "./types"
|
import type { AgentMode, AgentPromptMetadata } from "./types"
|
||||||
|
import { buildAntiDuplicationSection } from "./dynamic-agent-prompt-builder"
|
||||||
import { createAgentToolRestrictions } from "../shared/permission-compat"
|
import { createAgentToolRestrictions } from "../shared/permission-compat"
|
||||||
|
|
||||||
const MODE: AgentMode = "subagent"
|
const MODE: AgentMode = "subagent"
|
||||||
@@ -25,6 +26,8 @@ export const METIS_SYSTEM_PROMPT = `# Metis - Pre-Planning Consultant
|
|||||||
- **READ-ONLY**: You analyze, question, advise. You do NOT implement or modify files.
|
- **READ-ONLY**: You analyze, question, advise. You do NOT implement or modify files.
|
||||||
- **OUTPUT**: Your analysis feeds into Prometheus (planner). Be actionable.
|
- **OUTPUT**: Your analysis feeds into Prometheus (planner). Be actionable.
|
||||||
|
|
||||||
|
${buildAntiDuplicationSection()}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## PHASE 0: INTENT CLASSIFICATION (MANDATORY FIRST STEP)
|
## PHASE 0: INTENT CLASSIFICATION (MANDATORY FIRST STEP)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { describe, test, expect } from "bun:test"
|
import { describe, test, expect } from "bun:test"
|
||||||
import { PROMETHEUS_SYSTEM_PROMPT } from "./prometheus"
|
import { PROMETHEUS_SYSTEM_PROMPT } from "./prometheus"
|
||||||
|
import { PROMETHEUS_GPT_SYSTEM_PROMPT } from "./prometheus/gpt"
|
||||||
|
import { PROMETHEUS_GEMINI_SYSTEM_PROMPT } from "./prometheus/gemini"
|
||||||
|
|
||||||
describe("PROMETHEUS_SYSTEM_PROMPT Momus invocation policy", () => {
|
describe("PROMETHEUS_SYSTEM_PROMPT Momus invocation policy", () => {
|
||||||
test("should direct providing ONLY the file path string when invoking Momus", () => {
|
test("should direct providing ONLY the file path string when invoking Momus", () => {
|
||||||
@@ -82,3 +84,22 @@ describe("PROMETHEUS_SYSTEM_PROMPT zero human intervention", () => {
|
|||||||
expect(lowerPrompt).toMatch(/zero acceptance criteria require human/)
|
expect(lowerPrompt).toMatch(/zero acceptance criteria require human/)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("Prometheus prompts anti-duplication coverage", () => {
|
||||||
|
test("all variants should include anti-duplication rules for delegated exploration", () => {
|
||||||
|
// given
|
||||||
|
const prompts = [
|
||||||
|
PROMETHEUS_SYSTEM_PROMPT,
|
||||||
|
PROMETHEUS_GPT_SYSTEM_PROMPT,
|
||||||
|
PROMETHEUS_GEMINI_SYSTEM_PROMPT,
|
||||||
|
]
|
||||||
|
|
||||||
|
// when / then
|
||||||
|
for (const prompt of prompts) {
|
||||||
|
expect(prompt).toContain("<Anti_Duplication>")
|
||||||
|
expect(prompt).toContain("Anti-Duplication Rule")
|
||||||
|
expect(prompt).toContain("DO NOT perform the same search yourself")
|
||||||
|
expect(prompt).toContain("non-overlapping work")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
* - Tool-call mandate for every phase transition
|
* - Tool-call mandate for every phase transition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { buildAntiDuplicationSection } from "../dynamic-agent-prompt-builder"
|
||||||
|
|
||||||
export const PROMETHEUS_GEMINI_SYSTEM_PROMPT = `
|
export const PROMETHEUS_GEMINI_SYSTEM_PROMPT = `
|
||||||
<identity>
|
<identity>
|
||||||
You are Prometheus - Strategic Planning Consultant from OhMyOpenCode.
|
You are Prometheus - Strategic Planning Consultant from OhMyOpenCode.
|
||||||
@@ -43,6 +45,8 @@ A plan is "decision complete" when the implementer needs ZERO judgment calls —
|
|||||||
This is your north star quality metric.
|
This is your north star quality metric.
|
||||||
</mission>
|
</mission>
|
||||||
|
|
||||||
|
${buildAntiDuplicationSection()}
|
||||||
|
|
||||||
<core_principles>
|
<core_principles>
|
||||||
## Three Principles
|
## Three Principles
|
||||||
|
|
||||||
@@ -325,4 +329,4 @@ You are Prometheus, the strategic planning consultant. You bring foresight and s
|
|||||||
|
|
||||||
export function getGeminiPrometheusPrompt(): string {
|
export function getGeminiPrometheusPrompt(): string {
|
||||||
return PROMETHEUS_GEMINI_SYSTEM_PROMPT
|
return PROMETHEUS_GEMINI_SYSTEM_PROMPT
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
* - Principle-driven: Decision Complete, Explore Before Asking, Two Kinds of Unknowns
|
* - Principle-driven: Decision Complete, Explore Before Asking, Two Kinds of Unknowns
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { buildAntiDuplicationSection } from "../dynamic-agent-prompt-builder";
|
||||||
|
|
||||||
export const PROMETHEUS_GPT_SYSTEM_PROMPT = `
|
export const PROMETHEUS_GPT_SYSTEM_PROMPT = `
|
||||||
<identity>
|
<identity>
|
||||||
You are Prometheus - Strategic Planning Consultant from OhMyOpenCode.
|
You are Prometheus - Strategic Planning Consultant from OhMyOpenCode.
|
||||||
@@ -25,6 +27,8 @@ A plan is "decision complete" when the implementer needs ZERO judgment calls —
|
|||||||
This is your north star quality metric.
|
This is your north star quality metric.
|
||||||
</mission>
|
</mission>
|
||||||
|
|
||||||
|
${buildAntiDuplicationSection()}
|
||||||
|
|
||||||
<core_principles>
|
<core_principles>
|
||||||
## Three Principles (Read First)
|
## Three Principles (Read First)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
* Includes intent classification, research patterns, and anti-patterns.
|
* Includes intent classification, research patterns, and anti-patterns.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { buildAntiDuplicationSection } from "../dynamic-agent-prompt-builder"
|
||||||
|
|
||||||
export const PROMETHEUS_INTERVIEW_MODE = `# PHASE 1: INTERVIEW MODE (DEFAULT)
|
export const PROMETHEUS_INTERVIEW_MODE = `# PHASE 1: INTERVIEW MODE (DEFAULT)
|
||||||
|
|
||||||
## Step 0: Intent Classification (EVERY request)
|
## Step 0: Intent Classification (EVERY request)
|
||||||
@@ -29,6 +31,8 @@ Before diving into consultation, classify the work intent. This determines your
|
|||||||
- **Simple** (1-2 files, clear scope, <30 min work) — **Lightweight**: 1-2 targeted questions → propose approach.
|
- **Simple** (1-2 files, clear scope, <30 min work) — **Lightweight**: 1-2 targeted questions → propose approach.
|
||||||
- **Complex** (3+ files, multiple components, architectural impact) — **Full consultation**: Intent-specific deep interview.
|
- **Complex** (3+ files, multiple components, architectural impact) — **Full consultation**: Intent-specific deep interview.
|
||||||
|
|
||||||
|
${buildAntiDuplicationSection()}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Intent-Specific Interview Strategies
|
## Intent-Specific Interview Strategies
|
||||||
|
|||||||
Reference in New Issue
Block a user