chore(keyword-detector): revert ultrawork to stronger agent utilization instructions
- Restore [CODE RED] maximum precision requirement - Restore YOU MUST LEVERAGE ALL AVAILABLE AGENTS directive - Restore TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW - Restore explicit parallel exploration/librarian spawn workflow - Keep mandatory ULTRAWORK MODE ENABLED! message - Simplify constants structure for better maintainability This addresses the issue where explore/librarian agents were being called less frequently after recent prompt changes. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -1,41 +1,7 @@
|
||||
export const CODE_BLOCK_PATTERN = /```[\s\S]*?```/g
|
||||
export const INLINE_CODE_PATTERN = /`[^`]+`/g
|
||||
|
||||
const ULTRAWORK_TODO_SECTION = `## TODO IS YOUR LIFELINE (NON-NEGOTIABLE)
|
||||
|
||||
**USE TodoWrite OBSESSIVELY. This is the #1 most important tool.**
|
||||
|
||||
### TODO Rules
|
||||
1. **BEFORE any action**: Create TODOs FIRST. Break down into atomic, granular steps.
|
||||
2. **Be excessively detailed**: 10 small TODOs > 3 vague TODOs. Err on the side of too many.
|
||||
3. **Real-time updates**: Mark \`in_progress\` before starting, \`completed\` IMMEDIATELY after. NEVER batch.
|
||||
4. **One at a time**: Only ONE TODO should be \`in_progress\` at any moment.
|
||||
5. **Sub-tasks**: Complex TODO? Break it into sub-TODOs. Keep granularity high.
|
||||
6. **Questions too**: User asks a question? TODO: "Answer with evidence: [question]"
|
||||
|
||||
### Example TODO Granularity
|
||||
BAD: "Implement user auth"
|
||||
GOOD:
|
||||
- "Read existing auth patterns in codebase"
|
||||
- "Create auth schema types"
|
||||
- "Implement login endpoint"
|
||||
- "Implement token validation middleware"
|
||||
- "Add auth tests - login success case"
|
||||
- "Add auth tests - login failure case"
|
||||
- "Verify LSP diagnostics clean"
|
||||
|
||||
**YOUR WORK IS INVISIBLE WITHOUT TODOs. USE THEM.**`
|
||||
|
||||
const ULTRAWORK_AGENT_UTILIZATION_DEFAULT = `## AGENT UTILIZATION PRINCIPLES (by capability, not by name)
|
||||
- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS for file patterns, internal implementations, project structure
|
||||
- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS for API references, examples, external library docs
|
||||
- **Planning & Strategy**: NEVER plan yourself - use \`plan\` agent for work breakdown
|
||||
- **CRITICAL**: Use the regular \`plan\` agent (subagent_type="plan"), NOT Prometheus, NOT Metis, NOT any other planner
|
||||
- The \`plan\` agent is specifically designed for ultrawork workflows
|
||||
- **High-IQ Reasoning**: Leverage specialized agents for architecture decisions, code review, strategic planning
|
||||
- **Frontend/UI Tasks**: Delegate to UI-specialized agents for design and implementation`
|
||||
|
||||
const ULTRAWORK_AGENT_UTILIZATION_PLANNER = `## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER
|
||||
const ULTRAWORK_PLANNER_SECTION = `## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER
|
||||
|
||||
**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**
|
||||
You ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.
|
||||
@@ -85,115 +51,6 @@ You ARE the planner. Your job: create bulletproof work plans.
|
||||
|
||||
**NEVER plan blind. Context first, plan second.**`
|
||||
|
||||
const ULTRAWORK_EXECUTION_DEFAULT = `## EXECUTION RULES
|
||||
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.
|
||||
- **PARALLEL**: Fire independent agent calls simultaneously via sisyphus_task - NEVER wait sequentially.
|
||||
- **BACKGROUND FIRST**: Use sisyphus_task for exploration/research agents (10+ concurrent if needed).
|
||||
- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.
|
||||
- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.
|
||||
|
||||
## MANDATORY INITIAL TODOS (CREATE IMMEDIATELY)
|
||||
|
||||
Upon detecting ultrawork, you MUST create these todos FIRST before any other action:
|
||||
|
||||
\`\`\`
|
||||
TodoWrite([
|
||||
{"id": "pre-0", "content": "Check if test infrastructure exists (bun test, npm test, pytest, etc.)", "status": "pending", "priority": "high"},
|
||||
{"id": "pre-1", "content": "Decide TDD vs regular flow based on test infrastructure", "status": "pending", "priority": "high"},
|
||||
{"id": "pre-2", "content": "Use plan agent (NOT Prometheus!) via task(subagent_type='plan') to create work breakdown", "status": "pending", "priority": "high"}
|
||||
])
|
||||
\`\`\`
|
||||
|
||||
## WORKFLOW
|
||||
1. **Create mandatory todos above FIRST**
|
||||
2. Check test infrastructure: run \`bun test --help\` or check package.json scripts
|
||||
3. If tests exist → TDD flow. If not → regular flow.
|
||||
4. **Use \`plan\` agent (NOT Prometheus!) to create detailed work breakdown**
|
||||
- Call: \`task(subagent_type="plan", prompt="...")\`
|
||||
- DO NOT call Prometheus, Metis, or any other planner variant
|
||||
5. Execute with continuous verification against original requirements`
|
||||
|
||||
const ULTRAWORK_EXECUTION_PLANNER = `## EXECUTION RULES
|
||||
- **TODO**: Track EVERY research/planning step. Mark complete IMMEDIATELY after each.
|
||||
- **PARALLEL**: Fire explore/librarian agents simultaneously - NEVER wait sequentially.
|
||||
- **BACKGROUND FIRST**: Use sisyphus_task for all context gathering (10+ concurrent if needed).
|
||||
- **VERIFY**: Re-read user request after planning. Check plan addresses ALL requirements.
|
||||
|
||||
## MANDATORY INITIAL TODOS (CREATE IMMEDIATELY)
|
||||
|
||||
Upon detecting ultrawork, you MUST create these todos FIRST:
|
||||
|
||||
\`\`\`
|
||||
TodoWrite([
|
||||
{"id": "pre-0", "content": "Fire explore agents for codebase patterns and structure", "status": "pending", "priority": "high"},
|
||||
{"id": "pre-1", "content": "Fire librarian agents for external docs and OSS examples", "status": "pending", "priority": "high"},
|
||||
{"id": "pre-2", "content": "Collect and synthesize research results", "status": "pending", "priority": "high"},
|
||||
{"id": "pre-3", "content": "Draft comprehensive work plan based on findings", "status": "pending", "priority": "high"}
|
||||
])
|
||||
\`\`\`
|
||||
|
||||
## WORKFLOW
|
||||
1. **Create todos above FIRST**
|
||||
2. Launch parallel explore/librarian agents for context
|
||||
3. Collect results - understand codebase state, patterns, constraints
|
||||
4. Draft plan incorporating research findings
|
||||
5. Verify plan addresses ALL user requirements`
|
||||
|
||||
const ULTRAWORK_COMMON_TAIL = `## TDD FLOW (when test infrastructure exists)
|
||||
|
||||
Check for test infrastructure FIRST. If exists, follow strictly:
|
||||
|
||||
1. **RED**: Write failing test FIRST → \`bun test\` must FAIL
|
||||
2. **GREEN**: Write MINIMAL code to pass → \`bun test\` must PASS
|
||||
3. **REFACTOR**: Clean up, tests stay green → \`bun test\` still PASS
|
||||
4. **REPEAT**: Next test case, loop until complete
|
||||
|
||||
**NEVER write implementation before test. NEVER delete failing tests.**
|
||||
|
||||
## AGENT DEPLOYMENT
|
||||
|
||||
Fire available agents in PARALLEL via background tasks. Use explore/librarian agents liberally (multiple concurrent if needed).
|
||||
|
||||
## EVIDENCE-BASED ANSWERS
|
||||
|
||||
- Every claim: code snippet + file path + line number
|
||||
- No "I think..." - find and SHOW actual code
|
||||
- Local search fails? → librarian for external sources
|
||||
- **NEVER acceptable**: "I couldn't find it"
|
||||
|
||||
## ZERO TOLERANCE FOR SHORTCUTS (RIGOROUS & HONEST EXECUTION)
|
||||
|
||||
**CORE PRINCIPLE**: Execute user's ORIGINAL INTENT with maximum rigor. No shortcuts. No compromises. No matter how large the task.
|
||||
|
||||
### ABSOLUTE PROHIBITIONS
|
||||
| Violation | Why It's Forbidden |
|
||||
|-----------|-------------------|
|
||||
| **Mocking/Stubbing** | Never use mocks, stubs, or fake implementations unless explicitly requested. Real implementation only. |
|
||||
| **Scope Reduction** | Never make "demo", "skeleton", "simplified", "basic", "minimal" versions. Deliver FULL implementation. |
|
||||
| **Partial Completion** | Never stop at 60-80% saying "you can extend this...", "as an exercise...", "you can add...". Finish 100%. |
|
||||
| **Lazy Placeholders** | Never use "// TODO", "...", "etc.", "and so on" in actual code. Complete everything. |
|
||||
| **Assumed Shortcuts** | Never skip requirements deemed "optional" or "can be added later". All requirements are mandatory. |
|
||||
| **Test Deletion** | Never delete or skip failing tests. Fix the code, not the tests. |
|
||||
| **Evidence-Free Claims** | Never say "I think...", "probably...", "should work...". Show actual code/output. |
|
||||
|
||||
### RIGOROUS EXECUTION MANDATE
|
||||
1. **Parse Original Intent**: What did the user ACTUALLY want? Not what's convenient. The REAL, COMPLETE request.
|
||||
2. **No Task Too Large**: If the task requires 100 files, modify 100 files. If it needs 1000 lines, write 1000 lines. Size is irrelevant.
|
||||
3. **Honest Assessment**: If you cannot complete something, say so BEFORE starting. Don't fake completion.
|
||||
4. **Evidence-Based Verification**: Every claim backed by code snippets, file paths, line numbers, and actual outputs.
|
||||
5. **Complete Verification**: Re-read original request after completion. Check EVERY requirement was met.
|
||||
|
||||
### FAILURE RECOVERY
|
||||
If you realize you've taken shortcuts:
|
||||
1. STOP immediately
|
||||
2. Identify what you skipped/faked
|
||||
3. Create TODOs for ALL remaining work
|
||||
4. Execute to TRUE completion - not "good enough"
|
||||
|
||||
**THE USER ASKED FOR X. DELIVER EXACTLY X. COMPLETELY. HONESTLY. NO MATTER THE SIZE.**
|
||||
|
||||
## SUCCESS = All TODOs Done + All Requirements Met + Evidence Provided`
|
||||
|
||||
/**
|
||||
* Determines if the agent is a planner-type agent.
|
||||
* Planner agents should NOT be told to call plan agent (they ARE the planner).
|
||||
@@ -207,30 +64,73 @@ function isPlannerAgent(agentName?: string): boolean {
|
||||
/**
|
||||
* Generates the ultrawork message based on agent context.
|
||||
* Planner agents get context-gathering focused instructions.
|
||||
* Other agents get plan-delegation instructions.
|
||||
* Other agents get the original strong agent utilization instructions.
|
||||
*/
|
||||
export function getUltraworkMessage(agentName?: string): string {
|
||||
const isPlanner = isPlannerAgent(agentName)
|
||||
|
||||
const agentSection = isPlanner
|
||||
? ULTRAWORK_AGENT_UTILIZATION_PLANNER
|
||||
: ULTRAWORK_AGENT_UTILIZATION_DEFAULT
|
||||
if (isPlanner) {
|
||||
return `<ultrawork-mode>
|
||||
|
||||
const executionSection = isPlanner
|
||||
? ULTRAWORK_EXECUTION_PLANNER
|
||||
: ULTRAWORK_EXECUTION_DEFAULT
|
||||
**MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
|
||||
|
||||
${ULTRAWORK_PLANNER_SECTION}
|
||||
|
||||
</ultrawork-mode>
|
||||
|
||||
---
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
return `<ultrawork-mode>
|
||||
|
||||
**MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
|
||||
|
||||
${ULTRAWORK_TODO_SECTION}
|
||||
[CODE RED] Maximum precision required. Ultrathink before acting.
|
||||
|
||||
${agentSection}
|
||||
YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
|
||||
TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
||||
|
||||
${executionSection}
|
||||
## AGENT UTILIZATION PRINCIPLES (by capability, not by name)
|
||||
- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS for file patterns, internal implementations, project structure
|
||||
- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS for API references, examples, external library docs
|
||||
- **Planning & Strategy**: NEVER plan yourself - ALWAYS spawn a dedicated planning agent for work breakdown
|
||||
- **High-IQ Reasoning**: Leverage specialized agents for architecture decisions, code review, strategic planning
|
||||
- **Frontend/UI Tasks**: Delegate to UI-specialized agents for design and implementation
|
||||
|
||||
${ULTRAWORK_COMMON_TAIL}
|
||||
## EXECUTION RULES
|
||||
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.
|
||||
- **PARALLEL**: Fire independent agent calls simultaneously via background_task - NEVER wait sequentially.
|
||||
- **BACKGROUND FIRST**: Use background_task for exploration/research agents (10+ concurrent if needed).
|
||||
- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.
|
||||
- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.
|
||||
|
||||
## WORKFLOW
|
||||
1. Analyze the request and identify required capabilities
|
||||
2. Spawn exploration/librarian agents via background_task in PARALLEL (10+ if needed)
|
||||
3. Always Use Plan agent with gathered context to create detailed work breakdown
|
||||
4. Execute with continuous verification against original requirements
|
||||
|
||||
## TDD (if test infrastructure exists)
|
||||
|
||||
1. Write spec (requirements)
|
||||
2. Write tests (failing)
|
||||
3. RED: tests fail
|
||||
4. Implement minimal code
|
||||
5. GREEN: tests pass
|
||||
6. Refactor if needed (must stay green)
|
||||
7. Next feature, repeat
|
||||
|
||||
## ZERO TOLERANCE FAILURES
|
||||
- **NO Scope Reduction**: Never make "demo", "skeleton", "simplified", "basic" versions - deliver FULL implementation
|
||||
- **NO MockUp Work**: When user asked you to do "port A", you must "port A", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.
|
||||
- **NO Partial Completion**: Never stop at 60-80% saying "you can extend this..." - finish 100%
|
||||
- **NO Assumed Shortcuts**: Never skip requirements you deem "optional" or "can be added later"
|
||||
- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified
|
||||
- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.
|
||||
|
||||
THE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.
|
||||
|
||||
</ultrawork-mode>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user