omp packages

@sreetej510/pi-shipd-checks0.11.7

Pi extension for Shipd checks, behavioral test-gap analysis, and opt-in CoreWeave-backed agent_prompt.md humanization.

sreetej510 Published 2 days ago MIT ~2.3K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@sreetej510/pi-shipd-checks

A pi coding agent extension for benchmark-test analysis, prompt humanization, and Shipd quality checks.

What it does

For /checks:

  1. Snapshots the current git HEAD into a throwaway temp directory (via git archive HEAD | tar -x) — it never touches your working directory, staged, or uncommitted changes.
  2. Copies agent_prompt.md, solution.patch, and test.patch from your project root into that temp dir.
  3. Optionally runs the solver gap finder: several (configurable, default 3) TDD-style solver agents, each in its own throwaway git repo with test.patch and agent_prompt.md applied (never solution.patch), given write/edit/bash access to iterate until ./test.sh new passes or they give up. The extension independently re-verifies each solver's result and compares passing solver diffs with the reference to surface behavioral gaps.
  4. Runs solver workers in one AWS ECS Fargate Spot task when enabled, with the source snapshot and partial results in S3. A Spot interruption retries the task and resumes completed solver indexes.
  5. Posts a chat summary and merges solver results into shipd_report.json in your project root.

The agent-callable gap-finder tool runs one exhaustive read-only agent over the prompt, repository, and tests. It reviews requirements sentence by sentence, performs its own evidence and fairness check, and returns confirmed behavioral test gaps in details.testGaps.

The agent-callable solution-precheck tool runs one exhaustive read-only solution-quality agent and returns findings in details.solutionAuditFindings. It checks contract gaps, regressions, failure safety, architecture, dead code, and unrelated changes.

The opt-in humanize-agent-prompt tool reads the complete current-project agent_prompt.md, requests 3 experimental rewrite drafts from the CoreWeave Nemotron LoRA, scores every draft through a configured HTTPS detector endpoint, and returns the top 2 as JSON (defaults are configurable). It never edits files: the local agent must review every source requirement before applying a draft. Detector scores are exploratory triage, not confidence, authorship, semantic-fidelity, or correctness evidence. The adapter is experimental and was trained on all 519 pairs, including records originally assigned to EVAL and HOLDOUT; treat all outputs as unapproved drafts.

The agent-callable quality-check tool runs create_patches.sh in the current working directory and reads agent_prompt.md, test.patch, and solution.patch. Before checking or running Prompt Quality, it uploads all three contents to the authenticated Shipd draft fields and waits for the editor update to settle. It computes a SHA-256 of the exact prompt content. The last passing prompt hash is stored as a custom entry in the current chat session. If the hash matches, it skips the Shipd Prompt Quality check entirely and reports a cached PASS; if it differs or is absent, it checks the refreshed status after filling the fields and runs only when the check is stale or has a Run button. Otherwise it uses the current report. A new hash is saved only after Prompt Quality passes. On failure, only promptQuality is returned; there are no Test/Solution results or stoppedReason. Only after Prompt Quality passes or has a matching cached pass does it run the Fargate patch precheck against a clean HEAD; only if that passes does it run Test Quality and Solution Quality. Those checks run fresh jobs, rerun stale reports, skip current reports, and wait for started jobs. It returns only the useful report data: details.testQuality.verdict, details.testQuality.coverageSuggestions, details.testQuality.unfairnessCount, and details.testQuality.tests filtered to blocks whose concerns array is non-empty or whose fairness is exactly "Not fair", details.promptQuality and its verdict, reason, and major non-AI comments (only category, quote, and suggestion; AI-category comments are omitted), plus details.solutionQuality.verdict and its evaluation fields with level and overall_feedback removed. Fairness-only blocks with an empty concerns array are marked Not fully fair. Test Quality is PASS only when there are no filtered unfair tests, reported unfairTestCount is zero (when present), and coverage suggestions are empty. Prompt Quality is PASS only when the completed report and evaluation verdicts are both PASS, requirementCount is not blocking, and the AI gate does not flag the prompt. The prompt is flagged as AI when a Prompt Quality comment category identifies AI (for example, ai_generated). AI-category quote and suggestion details are omitted; guidance recommends humanizer for a broader rewrite or a small targeted manual edit for a recent change. A cached Prompt Quality pass is marked cached: true. Test and Solution Quality return compact PASS results; failures include only actionable feedback. Prompt Quality failures return a concise reason or major comments. Returned quality results omit completed and skipped. Its compact UI is labeled Quality Checks, shows live elapsed time, and summarizes each stage; it does not print full pass criteria in the tool description. It takes no parameters. Transient status and report-dialog operations retry up to three times; after clicking Run, the tool verifies the stale state clears or the job shows running before it begins polling. It uses one fresh headless browser tab at a time: for Prompt Quality it checks after 2 minutes, then every 30 seconds; for Test and Solution Quality it checks after 5 minutes, then reopens every 90 seconds until those jobs finish, with no client-side overall timeout. If all checks are current, it uses existing reports without starting a job. Each browser context blocks images, fonts, and media to reduce memory use. It does not click the final orange challenge-submit button. Authentication comes from SHIPD_STORAGE_STATE or the saved state created by /shipd:auth. /shipd:auth launches the installed browser as a normal visible process and attaches over local CDP, which supports Google/SSO sign-in better than an automated browser launch.

The gap-finder and solution-precheck tools are read-only and each uses one agent. Invoke them only when the user asks, never in parallel, and run repeated requests sequentially after applying each result. The prompt humanizer also requires an explicit user request and sends the prompt to CoreWeave and the configured detector endpoint. quality-check consumes Shipd tokens; do not run overlapping invocations for the same challenge.

Commands

--config must be used alone; solver-gap-finder is the only /checks run mode. The gap-finder, solution-precheck, and prompt-humanizer tools are enabled per project with /analyze:on.

Command Effect
/checks Open a menu with config and solver-gap-finder options
/checks --config Configure reviewer, solver, and analysis models
/checks --solver-gap-finder Run several solver agents TDD-style against agent_prompt.md + test.patch, then compare their solutions to the real solution to find gaps
/shipd:auth Open a browser for first-time Shipd sign-in and save the session
/shipd:link <url> Save the Shipd job link for the current chat session
/analyze:on Enable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project
/analyze:off Disable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project

Shortcut: Ctrl+Shift+X cancels an in-progress /checks run. Cancellation is propagated to active solver sessions and their spawned shell/test process trees; post-cancel verification, comparison, and artifact writing are skipped.

Configuration

/checks --config opens the row-based settings menu with two sections:

  • Solver: reviewer model and thinking level for the final solver-result reviewer, plus the solver model, thinking level, timeout, parallel solver count, and artifact-saving setting.
  • Analysis Tools: timeout, model, and thinking level shared by the agent-callable gap-finder and solution-precheck tools. The timeout applies to each read-only agent. These are stored under analyzeGap.timeoutMinutes, analyzeGap.provider, analyzeGap.modelId, and analyzeGap.thinkingLevel. Fargate resources are selected automatically and are not configurable in this menu.

The humanizer candidate counts are configured separately in ~/.pi/agent/checks-config.json. candidateCount controls how many drafts are requested from CoreWeave (1–10); topCount controls the maximum returned (1–10, capped at candidateCount). Only drafts below the detector's reported Human-like cutoff are returned; if none pass, candidates is empty:

{
  "promptHumanizer": {
    "candidateCount": 3,
    "topCount": 2
  }
}

The detector runs as one on-demand FARGATE_SPOT task per humanizer invocation. The generated drafts are sent as one batch through short-lived, pre-signed S3 URLs; the task exits after scoring and the extension removes the run objects. There is no always-on detector task, API Gateway endpoint, or NLB in this execution path. The current task definition is 1 vCPU/2 GiB; the smoke test returned scores in about 83 seconds overall (the task ran about 27 seconds). The earlier 2-vCPU/4-GiB test took about 68 seconds; cold-start time varies. From the Pi agent directory, deploy the worker image/task definition with bash shipd-humanizer-assets/shipd-detector/deploy_fargate_spot_worker.sh before using the humanizer. The CoreWeave key can come from COREWEAVE_API_KEY, COREWEAVE_API_KEY_FILE, or the local path in promptHumanizer.coreweaveApiKeyFile; only the path, never the secret, is stored in checks-config.json. COREWEAVE_BASE_URL defaults to https://api.inference.wandb.ai/v1; COREWEAVE_PROJECT and NEMOTRON_MODEL default to the handoff's v1 LoRA. Output is intentionally compact: each candidate has rank, text, and a raw triage_score. It is exploratory triage, not a confidence percentage. Candidates that fail the detector's Human-like cutoff are discarded; passing candidates are ranked by ascending detector score, up to topCount. A CoreWeave finish_reason: "length" or reported completion count at the 900-token cap is rejected before scoring. If CoreWeave reports a normal stop despite an incomplete draft, there is no reliable automatic completeness check; compare each draft with the source. Detector scoring processes the full text in windows.

AWS credentials stay local. Configure the AWS CLI profile, then set AWS_PROFILE/AWS_REGION (or add fargate.awsProfile/fargate.region to checks-config.json). The runner discovers the default VPC, public subnets, security group, ECS cluster, and an account-scoped private S3 bucket unless explicit IDs are configured. It uses the FARGATE_SPOT capacity provider only; there is no On-Demand fallback. Spot interruptions are retried according to fargate.maxRetries.

Fargate setup

  1. Create a dedicated, least-privilege IAM user in the AWS Console (do not use root), create an access key under Security credentials, and save it locally in %USERPROFILE%\\.aws\\credentials—no AWS CLI is required:

    [shipd-static]
    aws_access_key_id = YOUR_ACCESS_KEY_ID
    aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
    

    Use "awsProfile": "shipd-static" in the checks config. The AWS SDK reads this file directly. Keep it outside the repository, rotate the key periodically, and never paste it into chat or commit it. The IAM user needs the runtime ECS, S3, EC2-discovery, STS, and iam:PassRole permissions for the configured task/execution roles.

    Alternatively, AWS CLI browser login/SSO profiles work and are automatically refreshed by the SDK; CLI setup is optional.

  2. Create an ECS task role with this trust policy (ecs-tasks.amazonaws.com) and an inline S3 policy. Use an explicit bucket name so the policy stays narrow:

    {
      "Version": "2012-10-17",
      "Statement": [{
        "Effect": "Allow",
        "Action": ["s3:GetObject", "s3:PutObject"],
        "Resource": "arn:aws:s3:::BUCKET_NAME/runs/*"
      }]
    }
    

    The task role is required for long-running jobs because temporary presigned URLs can expire while dependencies or agents are running.

  3. Create an ECS execution role trusted by ecs-tasks.amazonaws.com, attach the AWS-managed service-role/AmazonECSTaskExecutionRolePolicy, and create the CloudWatch log group. The execution role is used for awslogs and image startup; the task role is used for S3 data.

  4. Add the role ARNs and bucket to ~/.pi/agent/checks-config.json:

    {
      "fargate": {
        "awsProfile": "shipd-static",
        "region": "us-east-1",
        "bucket": "BUCKET_NAME",
        "taskRoleArn": "arn:aws:iam::ACCOUNT_ID:role/pi-shipd-checks-task",
        "executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/pi-shipd-checks-execution",
        "logGroup": "/aws/ecs/pi-shipd-checks",
        "resourceProfile": "medium",
        "adaptiveResourceProfile": true,
        "maxRetries": 1
      }
    }
    

    cluster, subnetIds, and securityGroupId are optional when a default VPC is available. With adaptiveResourceProfile: true, solver-gap runs use resourceProfile initially and adapt on later runs (unless projectProfiles already overrides the repository). They upgrade when normalized CPU is at least 95% for more than seven minutes, downgrade when CPU is at least 95% for under two minutes, and otherwise retain the profile. Only the selected next profile is written to projectProfiles; CPU telemetry is included in shipd_report.json for solver-gap runs, but no telemetry history is retained. Quality patch prechecks always use the medium profile and do not update adaptive sizing. Set projectProfiles to override solver-gap resources per repository: {"C:/path/to/repo":"large"}.

  5. Restart pi, use /checks --config to select the solver and reviewer models, then run /checks --solver-gap-finder. Projects need Dockerfile, agent_prompt.md, solution.patch, test.patch, and test.sh.

Use /analyze:on and /analyze:off to control the gap-finder, solution-precheck, and prompt-humanizer tools per project, like HPC. The enabled project list is stored alongside the other settings in ~/.pi/agent/checks-config.json.

The patch precheck always uses the medium Fargate profile. It applies test.patch, creates isolated workspaces with and without solution.patch, and runs the base suites concurrently in both workspaces followed by the new suites concurrently in both workspaces. It requires ./test.sh base to pass, requires every ./test.sh new testcase to fail or error individually (with no suite-level error) before solution.patch, then requires both base and new suites to pass after the solution patch. Pytest subtest totals are not treated as passing testcase records; emitted <testcase> statuses and explicit SUBPASSED records are used for the pre-solution invariant. A failed precheck aborts before Shipd is opened and includes the Linux platform, a human-readable phase, and failed/errored test names in the tool error.

The gap-finder and solution-precheck tools are read-only and return repair recommendations; the caller changes the tests, prompt, or solution. Invoke them only when the user asks, never in parallel, and run repeated requests sequentially after applying each result. The humanizer does not modify agent_prompt.md; validate all requirements and apply any selected draft locally.

{
  "enabledProjects": ["/path/to/project"]
}

Use ↑/↓ to select a row and Enter/Space to change it. The currently selected model is shown first in its picker. Model settings are saved to ~/.pi/agent/checks-config.json; solver settings are nested under solverGap and analyze-tool model settings under analyzeGap.

Install

npm install -g @sreetej510/pi-shipd-checks

Then add it to your pi settings.json:

{
  "packages": ["npm:@sreetej510/pi-shipd-checks"]
}

Or, for local development, point at the entry point directly:

{
  "extensions": ["/absolute/path/to/pi-extensions/extensions/pi-shipd-checks/src/index.ts"]
}

File layout

File Responsibility
src/index.ts Extension entry point: message renderer, cancel shortcut, command registration
src/submit.ts quality-check: Playwright draft filling, sequential quality checks, scheduled polling, and report extraction
src/command.ts The /checks command: argument parsing, --config flow, run orchestration
src/agents.ts Spawns and races the gap-finder, solution-precheck, reviewer, and solver agent sessions
src/solvergap.ts Local solver result persistence and comparison artifacts
src/fargate-docker.ts Supported Dockerfile parsing for remote solver setup
src/fargate-runner.ts ECS Fargate Spot/S3 orchestration for solver, patch-precheck, and batched detector tasks; retries and cleanup
src/fargate-worker.ts ESM worker that runs solver workspaces or patch prechecks in the shared task
src/resource-usage.ts Container CPU sampling for adaptive profile selection
src/prompts.ts All prompt text sent to those agents
src/tools.ts Custom tools the agents call to submit their structured results
src/rubric.ts Embedded guidelines/fairness rubric text + per-role section loaders
src/roles.ts The 3 reviewer roles (description/tests/solution) metadata
src/report.ts shipd_report.json load/merge/summary logic
src/config.ts ~/.pi/agent/checks-config.json + settings.json helpers (models, humanizer counts, thinking levels, shell path)
src/humanize.ts Opt-in CoreWeave draft generation, detector scoring, and ranked JSON output
src/git.ts Clean, non-mutating git HEAD snapshot into a scratch directory
src/progress.ts Progress-bar widget rendering
src/state.ts Shared "run in progress" / cancel state between the command and the shortcut
src/types.ts Shared TypeScript types

To change reviewer strictness or wording, edit prompts.ts. To change the rubric/fairness text itself, edit rubric.ts. Agent result-submission tools are defined in tools.ts and wired up in agents.ts; direct extension tools are registered from their feature modules and synchronized in tool-sync.ts.

Development

npm install
npm run --workspace @sreetej510/pi-shipd-checks check     # biome + typecheck
npm run --workspace @sreetej510/pi-shipd-checks format