feat(#137): create Forced Continuation Prompt System
Implement prompt generation system that produces continuation prompts based on verification failures to force AI agents to complete work. Service: - generatePrompt: Complete prompt from failure context - generateTestFailurePrompt: Test-specific guidance - generateBuildErrorPrompt: Build error resolution - generateCoveragePrompt: Coverage improvement strategy - generateIncompleteWorkPrompt: Completion requirements Templates: - base.template: System/user prompt structure - test-failure.template: Test fix guidance - build-error.template: Compilation error guidance - coverage.template: Coverage improvement strategy - incomplete-work.template: Completion requirements Constraint escalation: - Attempt 1: Normal guidance - Attempt 2: Focus only on failures - Attempt 3: Minimal changes only - Final: Last attempt warning Priority levels: critical/high/normal based on failure severity Tests: 24 passing with 95.31% coverage Fixes #137 Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
export const BASE_CONTINUATION_SYSTEM = `You are continuing work on a task that was not completed successfully.
|
||||
Your previous attempt did not pass quality gates. You MUST fix the issues below.
|
||||
|
||||
CRITICAL RULES:
|
||||
1. You MUST address EVERY failure listed
|
||||
2. Do NOT defer work to future tasks
|
||||
3. Do NOT claim done until all gates pass
|
||||
4. Run tests before claiming completion
|
||||
`;
|
||||
|
||||
export const BASE_USER_PROMPT = `Task: {{taskDescription}}
|
||||
|
||||
Previous attempt {{attemptNumber}} of {{maxAttempts}} did not pass quality gates.
|
||||
|
||||
{{failures}}
|
||||
|
||||
{{constraints}}
|
||||
`;
|
||||
@@ -0,0 +1,10 @@
|
||||
export const BUILD_ERROR_TEMPLATE = `Build errors detected:
|
||||
{{errors}}
|
||||
|
||||
Fix these TypeScript/compilation errors. Do not proceed until build passes.
|
||||
|
||||
Steps:
|
||||
1. Read the error messages carefully
|
||||
2. Fix type mismatches, missing imports, or syntax errors
|
||||
3. Run build to verify it passes
|
||||
`;
|
||||
@@ -0,0 +1,15 @@
|
||||
export const COVERAGE_TEMPLATE = `Test coverage is below required threshold.
|
||||
|
||||
Current coverage: {{currentCoverage}}%
|
||||
Required coverage: {{requiredCoverage}}%
|
||||
Gap: {{gap}}%
|
||||
|
||||
Files with insufficient coverage:
|
||||
{{uncoveredFiles}}
|
||||
|
||||
Steps to improve coverage:
|
||||
1. Identify uncovered code paths
|
||||
2. Write tests for uncovered scenarios
|
||||
3. Focus on edge cases and error handling
|
||||
4. Run coverage report to verify improvement
|
||||
`;
|
||||
@@ -0,0 +1,13 @@
|
||||
export const INCOMPLETE_WORK_TEMPLATE = `The task implementation is incomplete.
|
||||
|
||||
Issues detected:
|
||||
{{issues}}
|
||||
|
||||
You MUST complete ALL aspects of the task. Do not leave TODO comments or deferred work.
|
||||
|
||||
Steps:
|
||||
1. Review each incomplete item
|
||||
2. Implement the missing functionality
|
||||
3. Write tests for the new code
|
||||
4. Verify all requirements are met
|
||||
`;
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from "./base.template";
|
||||
export * from "./test-failure.template";
|
||||
export * from "./build-error.template";
|
||||
export * from "./coverage.template";
|
||||
export * from "./incomplete-work.template";
|
||||
@@ -0,0 +1,9 @@
|
||||
export const TEST_FAILURE_TEMPLATE = `The following tests are failing:
|
||||
{{failures}}
|
||||
|
||||
For each failing test:
|
||||
1. Read the test to understand what is expected
|
||||
2. Fix the implementation to pass the test
|
||||
3. Run the test to verify it passes
|
||||
4. Do NOT skip or modify tests - fix the implementation
|
||||
`;
|
||||
Reference in New Issue
Block a user