npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@musuhi-ng/iterative-verification

v1.0.1

Published

Task-by-task execution with human review checkpoints for early error detection

Readme

@musuhi-ng/iterative-verification

Task-by-task execution with human review checkpoints for early error detection.

Overview

The Iterative Verification package provides a systematic approach to task execution with human-in-the-loop verification at each step. This enables early error detection (40% earlier according to AC-7.8 metrics) and gives users control over the execution workflow.

Features

AC-7.1: Task-by-Task Mode

Execute one task at a time with approval checkpoints.

import { IterativeVerifier } from '@musuhi-ng/iterative-verification';

const verifier = new IterativeVerifier('/project/root', '/project/tasks.md');
await verifier.initialize();

await verifier.executeTasks(tasks);

AC-7.2: Task Completion Prompt

Display task results and prompt for user action (Continue/Revise/Rollback).

==================================================================
Task Completed: Implement User Authentication
==================================================================

Status: ✅ Success
Duration: 2.45s

Changes (3 files):
  ➕ src/auth/login.ts
  ✏️  src/auth/index.ts
  ➕ src/auth/login.test.ts

Options:
  [C]ontinue  - Mark complete and proceed to next task
  [R]evise    - Provide revision instructions and re-execute
  [B]ack      - Rollback changes and mark task failed
  [S]kip      - Skip this task
  [A]bort     - Abort entire workflow
==================================================================

AC-7.3: Continue Option

Mark task as complete and proceed to the next task.

AC-7.4: Revise Option

Provide revision instructions and re-execute the task.

AC-7.5: Rollback Option

Undo all file changes and mark the task as failed.

import { RollbackManager } from '@musuhi-ng/iterative-verification';

const rollbackManager = new RollbackManager();
await rollbackManager.rollback(taskResult);

AC-7.6: Resume from Checkpoint

Restart workflow from the last completed task after interruption.

// Checkpoint is automatically saved after each task
const checkpoint = await checkpointManager.loadCheckpoint();

// Resume execution from checkpoint
await verifier.executeTasks(tasks);

AC-7.7: Progress Checkboxes

Automatically update tasks.md checkboxes on task completion.

<!-- Before -->

- [ ] Task 1: Implement authentication
- [ ] Task 2: Add tests

<!-- After Task 1 completes -->

- [x] Task 1: Implement authentication
- [ ] Task 2: Add tests

AC-7.8: Error Detection Metrics

Track error detection rates and timing.

const metrics = verifier.getMetrics();
console.log(`Total tasks: ${metrics.totalTasks}`);
console.log(`Tasks with errors: ${metrics.tasksWithErrors}`);
console.log(`Detection rate: ${metrics.detectionRate.toFixed(1)}%`);
console.log(
  `Average errors per task: ${metrics.averageErrorsPerTask.toFixed(2)}`
);

const stats = verifier.getDetectionStats();
console.log(`Errors caught: ${stats.errorsCaught}`);
console.log(`Catch rate: ${stats.catchRate.toFixed(1)}%`);
console.log(
  `Avg time to detection: ${stats.timeToDetection.toFixed(1)} minutes`
);

AC-7.9: Mode Persistence

Save and apply verification mode preference.

// Enable iterative mode (default)
await verifier.setMode('enabled');

// Disable iterative mode (auto-continue all tasks)
await verifier.setMode('disabled');

// Mode is persisted to .musuhi/verification-mode.json

Architecture

Components

  • TaskExecutor: Executes tasks with optional verification checkpoints
  • CheckpointManager: Manages checkpoint persistence for workflow resume
  • RollbackManager: Reverts file changes when tasks need to be rolled back
  • MetricsTracker: Collects error detection metrics
  • CompletionPrompt: Displays task results and prompts for user action
  • RevisionPrompt: Prompts for revision instructions
  • ProgressUpdater: Updates tasks.md checkboxes
  • ModeStorage: Persists verification mode preference

Type Definitions

  • Task: Task representation with status, dependencies, and results
  • TaskResult: Execution result with changes, errors, duration
  • Checkpoint: Checkpoint snapshot for workflow resume
  • VerificationMode: 'enabled' or 'disabled'
  • UserAction: 'continue' | 'revise' | 'rollback' | 'skip' | 'abort'

Usage Examples

Basic Usage

import { IterativeVerifier } from '@musuhi-ng/iterative-verification';
import type { Task } from '@musuhi-ng/iterative-verification';

const tasks: Task[] = [
  {
    id: 't1',
    title: 'Implement login feature',
    description: 'Create login component and authentication logic',
    dependencies: [],
    status: 'pending',
    createdAt: new Date(),
  },
  {
    id: 't2',
    title: 'Add login tests',
    description: 'Write unit and integration tests for login',
    dependencies: ['t1'],
    status: 'pending',
    createdAt: new Date(),
  },
];

const verifier = new IterativeVerifier('/path/to/project', '/path/to/tasks.md');
await verifier.initialize();

// Execute tasks with iterative verification
await verifier.executeTasks(tasks);

// Get metrics
const metrics = verifier.getMetrics();
console.log(`Completed ${metrics.totalTasks} tasks`);
console.log(`Error detection rate: ${metrics.detectionRate}%`);

Rollback Example

import { RollbackManager } from '@musuhi-ng/iterative-verification';
import type { TaskResult } from '@musuhi-ng/iterative-verification';

const rollbackManager = new RollbackManager();

const taskResult: TaskResult = {
  success: false,
  changes: [
    { path: '/src/auth/login.ts', type: 'created', afterContent: '...' },
    {
      path: '/src/auth/index.ts',
      type: 'modified',
      beforeContent: '...',
      afterContent: '...',
    },
  ],
  errors: [{ message: 'Syntax error', severity: 'error' }],
  duration: 1500,
  output: 'Task failed',
};

// Rollback all changes
await rollbackManager.rollback(taskResult);
// - /src/auth/login.ts is deleted
// - /src/auth/index.ts is restored to original content

Checkpoint Resume Example

import { CheckpointManager } from '@musuhi-ng/iterative-verification';

const checkpointManager = new CheckpointManager('/path/to/project');

// Load checkpoint from previous session
const checkpoint = await checkpointManager.loadCheckpoint();

if (checkpoint) {
  console.log(`Resuming from task: ${checkpoint.taskId}`);
  console.log(`Completed tasks: ${checkpoint.completedTasks.length}`);
  console.log(`Pending tasks: ${checkpoint.pendingTasks.length}`);
}

// Clear checkpoint when workflow completes
await checkpointManager.clearCheckpoint();

Testing

Run tests with:

pnpm test

Run tests with coverage:

pnpm test:coverage

Requirements Coverage

  • ✅ AC-7.1: Task-by-Task Mode
  • ✅ AC-7.2: Task Completion Prompt
  • ✅ AC-7.3: Continue Option
  • ✅ AC-7.4: Revise Option
  • ✅ AC-7.5: Rollback Option
  • ✅ AC-7.6: Resume from Checkpoint
  • ✅ AC-7.7: Progress Checkboxes
  • ✅ AC-7.8: Error Detection Metrics
  • ✅ AC-7.9: Mode Persistence

Expected Impact

  • 40% earlier error detection (AC-7.8)
  • Reduced rework through immediate feedback
  • User control over AI-generated code
  • Safe rollback mechanism
  • Automatic progress tracking

License

MIT