@sreetej510/pi-shipd-checks 0.10.13 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # @sreetej510/pi-shipd-checks
2
2
 
3
- A [pi](https://github.com/earendil-works/pi) coding agent extension that analyzes benchmark
4
- tests for behavioral coverage gaps, fairness, and test strength.
3
+ A [pi](https://github.com/earendil-works/pi) coding agent extension for benchmark-test analysis, prompt humanization, and Shipd quality checks.
5
4
 
6
5
  ## What it does
7
6
 
@@ -30,34 +29,51 @@ The agent-callable `solution-precheck` tool runs one exhaustive read-only soluti
30
29
  `details.solutionAuditFindings`. It checks contract gaps, regressions, failure safety, architecture, dead code, and
31
30
  unrelated changes.
32
31
 
33
- The agent-callable `quality-check` tool runs `create_patches.sh` in the current working directory, reads
34
- `agent_prompt.md`, `test.patch`, and `solution.patch`, first runs a Fargate patch precheck against a clean `HEAD`, then
35
- fills the authenticated Shipd draft fields, runs fresh checks with a `Run` button, reruns checks marked `Stale`, skips
36
- current checks, starts Test Quality before Solution Quality in one browser tab, waits for any started jobs, and returns only the useful report data:
32
+ The opt-in `humanize-agent-prompt` tool reads the complete current-project `agent_prompt.md`, requests 3 experimental
33
+ rewrite drafts from the CoreWeave Nemotron LoRA, scores every draft through a configured HTTPS detector endpoint, and
34
+ returns the top 2 as JSON (defaults are configurable). It never edits files: the local agent must review every source
35
+ requirement before applying a draft. Detector scores are exploratory triage, not confidence, authorship, semantic-fidelity,
36
+ or correctness evidence. The adapter is experimental and was trained on all 519 pairs, including records originally
37
+ assigned to EVAL and HOLDOUT; treat all outputs as unapproved drafts.
38
+
39
+ The agent-callable `quality-check` tool runs `create_patches.sh` in the current working directory and reads
40
+ `agent_prompt.md`, `test.patch`, and `solution.patch`. It fills the authenticated Shipd draft fields and computes a SHA-256
41
+ of the exact prompt content. The last passing prompt hash is stored as a custom entry in the current chat session. If the
42
+ hash matches, it skips the Shipd Prompt Quality check entirely and reports a cached `PASS`; if it differs or is absent, it
43
+ checks the refreshed status after filling the fields and runs only when the check is stale or has a `Run` button. Otherwise it
44
+ 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`.
45
+ Only after Prompt Quality passes or has a matching cached pass does it run the Fargate patch precheck against a clean `HEAD`;
46
+ only if that passes does it run Test Quality and Solution Quality. Those checks run fresh jobs, rerun stale reports, skip
47
+ current reports, and wait for started jobs. It returns only the useful report data:
37
48
  `details.testQuality.verdict`, `details.testQuality.coverageSuggestions`, `details.testQuality.unfairnessCount`, and
38
49
  `details.testQuality.tests` filtered to blocks whose `concerns` array is non-empty or whose `fairness` is exactly `"Not fair"`,
39
- plus `details.solutionQuality.verdict` and its evaluation fields with `level` and `overall_feedback` removed.
40
- Fairness-only blocks with an empty `concerns` array are marked `Not fully fair`. Test Quality is `PASS` only when both
41
- filtered tests and coverage suggestions are empty; otherwise it is `FAIL`. Solution Quality is `PASS` only when every
42
- reported score equals its corresponding `max_score`; otherwise it is `FAIL`. Neither quality result includes `completed` or
43
- `skipped`. Its compact UI is labeled `Quality Checks`, shows live elapsed time, and only displays the unfairness count
44
- (including concern blocks), suggestion count, code-quality score, and
45
- comprehensiveness score. It takes no parameters. It uses one fresh headless browser tab at a time: it closes the
46
- browser after starting the needed jobs, checks after 5 minutes, then reopens every 90 seconds until those jobs finish, with no
47
- client-side overall timeout. If
48
- all checks are current, it uses existing reports without starting a job. Each
49
- browser context blocks images, fonts, and media to reduce memory use. It does not click the final orange
50
+ `details.promptQuality` and its verdict, reason, and major comments (only `category`, `quote`, and `suggestion`), plus
51
+ `details.solutionQuality.verdict` and its evaluation fields with `level` and `overall_feedback` removed. Fairness-only blocks
52
+ with an empty `concerns` array are marked `Not fully fair`. Test Quality is `PASS` only when there are no filtered unfair
53
+ tests, reported `unfairTestCount` is zero (when present), and coverage suggestions are empty. Prompt Quality is `PASS` only when the completed report and evaluation
54
+ verdicts are both `PASS`, `requirementCount` is not blocking, and the AI gate does not flag the prompt. The prompt is
55
+ flagged as AI when a Prompt Quality comment has category `ai_generated`; the major comment details are included with the humanizer guidance. A cached Prompt Quality pass is marked
56
+ `cached: true`. Test and Solution Quality return compact `PASS` results; failures include only actionable feedback. Prompt
57
+ Quality failures return a concise reason or major comments. Returned quality results omit `completed` and `skipped`. Its
58
+ compact UI is labeled `Quality Checks`, shows live elapsed time, and summarizes each stage; it does not print full pass
59
+ criteria in the tool description. It takes no parameters. Transient status and report-dialog operations retry up to three
60
+ times; after clicking Run, the tool verifies the stale state clears or the job shows running before it begins polling. It
61
+ uses one fresh headless browser tab at a time: for Prompt Quality
62
+ it checks after 2 minutes, then every 30 seconds; for Test and Solution Quality it checks after 5 minutes, then reopens
63
+ every 90 seconds until those jobs finish, with no client-side overall timeout. If all checks are current, it uses existing
64
+ reports without starting a job. Each browser context blocks images, fonts, and media to reduce memory use. It does not click the final orange
50
65
  challenge-submit button. Authentication comes from `SHIPD_STORAGE_STATE` or the saved state created by
51
66
  `/shipd:auth`. `/shipd:auth` launches the installed browser as a normal visible process and attaches over local CDP,
52
67
  which supports Google/SSO sign-in better than an automated browser launch.
53
68
 
54
- The analysis tools are read-only and each uses one agent. Invoke them only when the user asks, never in parallel, and
55
- run repeated requests sequentially after applying each result. `quality-check` consumes Shipd tokens; do not run
56
- overlapping invocations for the same challenge.
69
+ The gap-finder and solution-precheck tools are read-only and each uses one agent. Invoke them only when the user asks,
70
+ never in parallel, and run repeated requests sequentially after applying each result. The prompt humanizer also requires
71
+ an explicit user request and sends the prompt to CoreWeave and the configured detector endpoint. `quality-check` consumes
72
+ Shipd tokens; do not run overlapping invocations for the same challenge.
57
73
 
58
74
  ## Commands
59
75
 
60
- `--config` must be used alone; solver-gap-finder is the only `/checks` run mode. The gap-finder and solution-precheck tools are enabled per project with `/analyze:on`.
76
+ `--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`.
61
77
 
62
78
  | Command | Effect |
63
79
  |---|---|
@@ -66,8 +82,8 @@ overlapping invocations for the same challenge.
66
82
  | `/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 |
67
83
  | `/shipd:auth` | Open a browser for first-time Shipd sign-in and save the session |
68
84
  | `/shipd:link <url>` | Save the Shipd job link for the current chat session |
69
- | `/analyze:on` | Enable the gap-finder and solution-precheck tools for the current project |
70
- | `/analyze:off` | Disable the gap-finder and solution-precheck tools for the current project |
85
+ | `/analyze:on` | Enable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project |
86
+ | `/analyze:off` | Disable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project |
71
87
 
72
88
  **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.
73
89
 
@@ -82,6 +98,21 @@ overlapping invocations for the same challenge.
82
98
  `analyzeGap.timeoutMinutes`, `analyzeGap.provider`, `analyzeGap.modelId`, and
83
99
  `analyzeGap.thinkingLevel`. Fargate resources are selected automatically and are not configurable in this menu.
84
100
 
101
+ The humanizer candidate counts are configured separately in `~/.pi/agent/checks-config.json`. `candidateCount` controls
102
+ how many drafts are requested from CoreWeave (1–10); `topCount` controls the maximum returned (1–10, capped at
103
+ `candidateCount`). Only drafts below the detector's reported Human-like cutoff are returned; if none pass, `candidates` is empty:
104
+
105
+ ```json
106
+ {
107
+ "promptHumanizer": {
108
+ "candidateCount": 3,
109
+ "topCount": 2
110
+ }
111
+ }
112
+ ```
113
+
114
+ 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.
115
+
85
116
  AWS credentials stay local. Configure the AWS CLI profile, then set `AWS_PROFILE`/`AWS_REGION` (or add
86
117
  `fargate.awsProfile`/`fargate.region` to `checks-config.json`). The runner discovers the default
87
118
  VPC, public subnets, security group, ECS cluster, and an account-scoped private S3 bucket unless
@@ -160,7 +191,7 @@ On-Demand fallback. Spot interruptions are retried according to `fargate.maxRetr
160
191
  `/checks --solver-gap-finder`. Projects need `Dockerfile`, `agent_prompt.md`,
161
192
  `solution.patch`, `test.patch`, and `test.sh`.
162
193
 
163
- Use `/analyze:on` and `/analyze:off` to control the gap-finder and solution-precheck tools per project, like HPC. The
194
+ Use `/analyze:on` and `/analyze:off` to control the gap-finder, solution-precheck, and prompt-humanizer tools per project, like HPC. The
164
195
  enabled project list is stored alongside the other settings in `~/.pi/agent/checks-config.json`.
165
196
 
166
197
  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
@@ -170,7 +201,8 @@ before Shipd is opened and includes the Linux platform, a human-readable phase,
170
201
 
171
202
  The `gap-finder` and `solution-precheck` tools are read-only and return repair recommendations; the caller changes the
172
203
  tests, prompt, or solution. Invoke them only when the user asks, never in parallel, and run repeated requests
173
- sequentially after applying each result.
204
+ sequentially after applying each result. The humanizer does not modify `agent_prompt.md`; validate all requirements and
205
+ apply any selected draft locally.
174
206
 
175
207
 
176
208
  ```json
@@ -215,7 +247,7 @@ Or, for local development, point at the entry point directly:
215
247
  | `src/agents.ts` | Spawns and races the gap-finder, solution-precheck, reviewer, and solver agent sessions |
216
248
  | `src/solvergap.ts` | Local solver result persistence and comparison artifacts |
217
249
  | `src/fargate-docker.ts` | Supported Dockerfile parsing for remote solver setup |
218
- | `src/fargate-runner.ts` | ECS Fargate Spot/S3 orchestration for solver and patch-precheck tasks, retries, cleanup, and telemetry |
250
+ | `src/fargate-runner.ts` | ECS Fargate Spot/S3 orchestration for solver, patch-precheck, and batched detector tasks; retries and cleanup |
219
251
  | `src/fargate-worker.ts` | ESM worker that runs solver workspaces or patch prechecks in the shared task |
220
252
  | `src/resource-usage.ts` | Container CPU sampling for adaptive profile selection |
221
253
  | `src/prompts.ts` | All prompt text sent to those agents |
@@ -223,14 +255,16 @@ Or, for local development, point at the entry point directly:
223
255
  | `src/rubric.ts` | Embedded guidelines/fairness rubric text + per-role section loaders |
224
256
  | `src/roles.ts` | The 3 reviewer roles (description/tests/solution) metadata |
225
257
  | `src/report.ts` | `shipd_report.json` load/merge/summary logic |
226
- | `src/config.ts` | `~/.pi/agent/checks-config.json` + `settings.json` helpers (models, thinking levels, shell path) |
258
+ | `src/config.ts` | `~/.pi/agent/checks-config.json` + `settings.json` helpers (models, humanizer counts, thinking levels, shell path) |
259
+ | `src/humanize.ts` | Opt-in CoreWeave draft generation, detector scoring, and ranked JSON output |
227
260
  | `src/git.ts` | Clean, non-mutating git `HEAD` snapshot into a scratch directory |
228
261
  | `src/progress.ts` | Progress-bar widget rendering |
229
262
  | `src/state.ts` | Shared "run in progress" / cancel state between the command and the shortcut |
230
263
  | `src/types.ts` | Shared TypeScript types |
231
264
 
232
265
  To change reviewer strictness or wording, edit `prompts.ts`. To change the rubric/fairness text
233
- itself, edit `rubric.ts`. To add a new tool, add it in `tools.ts` and wire it up in `agents.ts`.
266
+ itself, edit `rubric.ts`. Agent result-submission tools are defined in `tools.ts` and wired up in `agents.ts`; direct
267
+ extension tools are registered from their feature modules and synchronized in `tool-sync.ts`.
234
268
 
235
269
  ## Development
236
270