From ouroboros-loops
Post-evaluate autonomous judgment stage for the Ouroboros loop. Performs a comprehensive assessment of codebase health, stagnation detection, and natural-language evaluation of the completionPrompt condition. Returns OUROBOROS_RESULT: done or continue. Runs after evaluate in the step sequence.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ouroboros-loops:determineopusThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Perform autonomous judgment on whether the loop has achieved its goal and should terminate. This step runs after `evaluate` and augments its simple condition checks with deeper reasoning about codebase health, progress trends, and stagnation.
Perform autonomous judgment on whether the loop has achieved its goal and should terminate. This step runs after evaluate and augments its simple condition checks with deeper reasoning about codebase health, progress trends, and stagnation.
The determine step is invoked as the final step in each iteration after evaluate returns OUROBOROS_RESULT: continue. It provides a second, higher-quality judgment layer that can override continue with done when genuine completion is detected, or confirm continue when real work remains.
completionPrompt condition using natural language reasoning, not just substring matchingOUROBOROS_RESULT decisionRead .ouroboros/state.json and collect:
goal: the original improvement objectivecompletionPrompt: natural language completion condition (may be null)iteration: number of iterations completed so far (post-evaluate increment)maxIterations: upper boundfindings: full findings object including [RESOLVED] entriescurrent_iteration.fixes and current_iteration.enhancements: what was done this cycle (may be empty if evaluate already reset them — in that case, read the latest report instead)Also read the most recent .ouroboros/reports/iteration-N.md for the summary of this cycle's work.
Read .ouroboros/handoff-history/ to assess recent history (up to 3 most recent handoff files) and identify patterns across iterations.
For each unresolved finding in findings.bugs, findings.quality_issues, and findings.enhancement_opportunities (entries NOT prefixed with [RESOLVED] or [DEFERRED]):
Count how many consecutive iterations this finding has appeared without being resolved. Use the report files (.ouroboros/reports/iteration-N.md) to check if the finding was present but not acted on in previous cycles.
If a finding has been present and unresolved for 3 or more consecutive iterations:
[DEFERRED] in state.json findings by prefixing the entry with [DEFERRED].[DEFERRED] <finding summary> — present for 3+ iterations without resolutionAfter deferring stagnant items, if ALL remaining unresolved findings are either [RESOLVED] or [DEFERRED], this is a completion signal (see step 4, Condition D).
Deferral write procedure:
Read state.json, update the affected finding entries by prefixing them with [DEFERRED], then write back. Preserve all other fields.
Calculate net progress for this iteration:
[RESOLVED] this iteration (appeared without [RESOLVED] in the previous report, now have it).Classify net progress:
score > 0: positive progress — real improvement madescore == 0: neutral — found new issues but resolved equal number, or did nothingscore < 0: regression — more issues introduced than resolved (rare but possible)A negative score for 2+ consecutive iterations is a strong signal to stop (the loop may be making things worse, or the research step is over-discovering).
Evaluate all conditions. Signal done if any of the following are true:
Condition A: Iteration limit already reached (safety catch — evaluate should have caught this first)
iteration >= maxIterations
Condition B: Natural language completionPrompt evaluation
completionPrompt is set, read the goal and the completionPrompt text."completionPrompt satisfied: <brief justification>"continue (false negatives are safer than false positives here)Condition C: No remaining actionable work
findings.bugs, findings.quality_issues, and findings.enhancement_opportunities are [RESOLVED] or [DEFERRED]."no remaining actionable work after N iterations"Condition D: Stagnation-driven completion
[RESOLVED] nor [DEFERRED])."all remaining issues deferred after 3+ iterations without resolution"Condition E: Regression loop detected
"no net progress detected for 3+ consecutive iterations"Default: if none of the above conditions are met, signal continue.
Communicate the result explicitly:
If done:
OUROBOROS_RESULT: done
Reason: <specific condition that triggered termination>
Total iterations completed: N
Stagnation deferred: <count> findings
Then delete .ouroboros/active if it exists.
If continuing:
OUROBOROS_RESULT: continue
Net progress this iteration: <score> (+resolved / -new_issues)
Remaining actionable findings: <count>
Deferred findings: <count>
Starting next cycle.
Write the determination outcome to state.json under a determine_log field. This provides a persistent record of each iteration's judgment:
{
"determine_log": [
{
"iteration": 2,
"result": "continue",
"net_progress": 3,
"deferred_count": 0,
"stagnation_detected": false,
"reason": "3 issues resolved, 1 new issue found. Actionable work remains."
}
]
}
If determine_log already exists, append the new entry — do not overwrite prior entries.
After completing this step, output a completion message. The agent (not this skill) is responsible for invoking ouroboros-loops:context-handoff next.
determine runs after evaluate. The intended flow is:
... → report → evaluate → determine → (next iteration or done)
The evaluate skill performs fast, deterministic checks (iteration limit, substring match, empty findings). The determine skill performs slower, reasoning-based checks (natural language completionPrompt, stagnation, net progress trends). Together they form a two-layer termination gate:
evaluate: "Are the mechanical conditions for stopping met?"determine: "Is it actually wise to keep going?"If evaluate returns done, the loop ends immediately — determine is not invoked. If evaluate returns continue, determine gets a chance to override that decision.
Important: determine should NOT re-increment the iteration counter (that is evaluate's responsibility). It only reads the post-evaluate state and returns a result.
The context-handoff skill needs to map determine to the correct next step. Add the following mapping:
| completed_step | next_step |
|---|---|
| determine | (end of iteration — same as evaluate) |
This tells the handoff skill that after determine, the iteration is complete and the next step is research (beginning of the next iteration).
This skill runs on opus (same as evaluate). The stagnation detection and natural-language completionPrompt evaluation require reasoning beyond Sonnet's capability. When OUROBOROS_MODEL_DETERMINE is set, that value overrides the default.
| Prefix | Meaning |
|---|---|
[RESOLVED] | Issue was actively fixed or enhanced |
[DEFERRED] | Issue is real but not being addressed after 3+ iterations; loop may still continue if other work exists |
| (no prefix) | Issue is unresolved and eligible for attention in the next iteration |
Deferred items appear in determine_log for transparency but are NOT re-surfaced to the analyze step as new findings. The analyze step MUST respect [DEFERRED] entries the same way it respects [RESOLVED] entries — do not re-add them as fresh findings.
npx claudepluginhub juyeongyi/jylee_claude_marketplace --plugin ouroboros-loopsGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.