refine

Iteratively audits and refines existing code artifacts through adversarial subagent sweeps until convergence.

10|2|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/nrdxp/predicate --skill refine-nrdxp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refine
Source: https://github.com/nrdxp/predicate/tree/main/skills/refine
Command: npx skills add https://github.com/nrdxp/predicate --skill refine-nrdxp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Long-running AI coding sessions tend to drift, over-engineer, or self-certify flawed work. This Skill enforces a disciplined refinement loop that audits pre-existing code artifacts, tracks every issue in a structured ledger, and blocks completion until independent adversarial reviewers confirm the artifact has converged to a stable, verified state. ## Core Features & Use Cases - Contraction-Mapping Refinement Loop: Executes Absorb, Audit, Iterate, Sweep, Review, and Report phases with measurable convergence metrics (error counts, convergence rates, workspace hashes) to detect oscillation and limit cycles. - Multi-Boundary Subagent Sweeps (MBSS): Spawns isolated adversarial subagents with distinct review rubrics (security, edge cases, performance, compliance) that are blind to each other, preventing self-congratulatory bias. - Deterministic Grounding & Rollback: Rejects subjective critiques unless backed by a failing test, linter error, or spec violation, and rolls back changes that break regression tests. - Isolated Git Worktree Execution: Performs all edits in a dedicated worktree and branch, keeping the user's working directory untouched, with sketch files committed to a .ledger/ sub-repository via the sync script. - Use Case: After implementing a feature, invoke /refine to exhaustively audit the module, prune redundant code added during iteration, run parallel adversarial reviews, and produce a verified, maintainer-approved result. ## Quick Start Ask the agent to run the /refine workflow on a specific module or file to audit, optimize, and adversarially verify it until convergence.

Frequently Asked Questions about refine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run an automated code refinement loop on existing code?

Invoke the /refine workflow with the target artifact paths and goal. The loop audits the code, populates a refinement ledger, iterates fixes with TDD verification, and runs adversarial subagent sweeps until consecutive clean sweeps confirm convergence.

What is the difference between /refine and /core workflows?

The /refine workflow optimizes and polishes pre-existing artifacts only, while /core handles implementing new features. If a refinement session starts adding new functional scope, the protocol halts and returns control to the human.

How does the refinement loop prevent AI self-correction bias?

It uses Multi-Boundary Subagent Sweeps where independent subagents with isolated contexts and distinct rubrics review the code, blind to the refiner's history and each other. Findings must be backed by deterministic failures like test errors or linter warnings.

Does the refine workflow modify my working directory?

No. All edits, test runs, and commits execute inside an isolated git worktree at .worktrees/refine-<topic> on a private agent branch, leaving your active working directory completely untouched.

When does the refinement loop stop iterating?

The loop halts when the ledger is empty and a configured number of consecutive clean adversarial sweeps pass, with minimum loop counts and a divergence boundary preventing infinite cycles. Any code modification resets the clean sweep counter.

Why are subjective code review suggestions rejected during refinement?

The Verifier Grounding rule rejects any critique that cannot map to a deterministic failure such as a compiler error, linter warning, failed test, or documented spec violation. This prevents stochastic noise and overcorrection cascades from degrading correct code.