@sreetej510/pi-shipd-checks 0.10.13 → 0.11.1

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,50 @@ 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
+ force-runs Shipd's Task Prompt Quality check even if Shipd labels the existing report current. A new hash is saved only after
44
+ 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 both filtered tests and coverage
53
+ suggestions are empty; otherwise it is `FAIL`. 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 only when `aiDetection.blocking` is `true` and `aiDetection.fractionAi` is at least `0.5`; the prediction
56
+ label is not a gate. A cached Prompt Quality pass is marked
57
+ `cached: true`. Test and Solution Quality return compact `PASS` results; failures include only actionable feedback. Prompt
58
+ Quality failures return a concise reason or major comments. Returned quality results omit `completed` and `skipped`. Its
59
+ compact UI is labeled `Quality Checks`, shows live elapsed time, and summarizes each stage; it does not print full pass
60
+ criteria in the tool description. It takes no parameters. It uses one fresh headless browser tab at a time: for Prompt Quality
61
+ it checks after 2 minutes, then every 30 seconds; for Test and Solution Quality it checks after 5 minutes, then reopens
62
+ every 90 seconds until those jobs finish, with no client-side overall timeout. If all checks are current, it uses existing
63
+ 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
64
  challenge-submit button. Authentication comes from `SHIPD_STORAGE_STATE` or the saved state created by
51
65
  `/shipd:auth`. `/shipd:auth` launches the installed browser as a normal visible process and attaches over local CDP,
52
66
  which supports Google/SSO sign-in better than an automated browser launch.
53
67
 
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.
68
+ The gap-finder and solution-precheck tools are read-only and each uses one agent. Invoke them only when the user asks,
69
+ never in parallel, and run repeated requests sequentially after applying each result. The prompt humanizer also requires
70
+ an explicit user request and sends the prompt to CoreWeave and the configured detector endpoint. `quality-check` consumes
71
+ Shipd tokens; do not run overlapping invocations for the same challenge.
57
72
 
58
73
  ## Commands
59
74
 
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`.
75
+ `--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
76
 
62
77
  | Command | Effect |
63
78
  |---|---|
@@ -66,8 +81,8 @@ overlapping invocations for the same challenge.
66
81
  | `/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
82
  | `/shipd:auth` | Open a browser for first-time Shipd sign-in and save the session |
68
83
  | `/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 |
84
+ | `/analyze:on` | Enable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project |
85
+ | `/analyze:off` | Disable the gap-finder, solution-precheck, and prompt-humanizer tools for the current project |
71
86
 
72
87
  **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
88
 
@@ -82,6 +97,21 @@ overlapping invocations for the same challenge.
82
97
  `analyzeGap.timeoutMinutes`, `analyzeGap.provider`, `analyzeGap.modelId`, and
83
98
  `analyzeGap.thinkingLevel`. Fargate resources are selected automatically and are not configurable in this menu.
84
99
 
100
+ The humanizer candidate counts are configured separately in `~/.pi/agent/checks-config.json`. `candidateCount` controls
101
+ how many drafts are requested from CoreWeave (1–10); `topCount` controls the maximum returned (1–10, capped at
102
+ `candidateCount`). Only drafts below the detector's reported Human-like cutoff are returned; if none pass, `candidates` is empty:
103
+
104
+ ```json
105
+ {
106
+ "promptHumanizer": {
107
+ "candidateCount": 3,
108
+ "topCount": 2
109
+ }
110
+ }
111
+ ```
112
+
113
+ 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.
114
+
85
115
  AWS credentials stay local. Configure the AWS CLI profile, then set `AWS_PROFILE`/`AWS_REGION` (or add
86
116
  `fargate.awsProfile`/`fargate.region` to `checks-config.json`). The runner discovers the default
87
117
  VPC, public subnets, security group, ECS cluster, and an account-scoped private S3 bucket unless
@@ -160,7 +190,7 @@ On-Demand fallback. Spot interruptions are retried according to `fargate.maxRetr
160
190
  `/checks --solver-gap-finder`. Projects need `Dockerfile`, `agent_prompt.md`,
161
191
  `solution.patch`, `test.patch`, and `test.sh`.
162
192
 
163
- Use `/analyze:on` and `/analyze:off` to control the gap-finder and solution-precheck tools per project, like HPC. The
193
+ Use `/analyze:on` and `/analyze:off` to control the gap-finder, solution-precheck, and prompt-humanizer tools per project, like HPC. The
164
194
  enabled project list is stored alongside the other settings in `~/.pi/agent/checks-config.json`.
165
195
 
166
196
  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 +200,8 @@ before Shipd is opened and includes the Linux platform, a human-readable phase,
170
200
 
171
201
  The `gap-finder` and `solution-precheck` tools are read-only and return repair recommendations; the caller changes the
172
202
  tests, prompt, or solution. Invoke them only when the user asks, never in parallel, and run repeated requests
173
- sequentially after applying each result.
203
+ sequentially after applying each result. The humanizer does not modify `agent_prompt.md`; validate all requirements and
204
+ apply any selected draft locally.
174
205
 
175
206
 
176
207
  ```json
@@ -215,7 +246,7 @@ Or, for local development, point at the entry point directly:
215
246
  | `src/agents.ts` | Spawns and races the gap-finder, solution-precheck, reviewer, and solver agent sessions |
216
247
  | `src/solvergap.ts` | Local solver result persistence and comparison artifacts |
217
248
  | `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 |
249
+ | `src/fargate-runner.ts` | ECS Fargate Spot/S3 orchestration for solver, patch-precheck, and batched detector tasks; retries and cleanup |
219
250
  | `src/fargate-worker.ts` | ESM worker that runs solver workspaces or patch prechecks in the shared task |
220
251
  | `src/resource-usage.ts` | Container CPU sampling for adaptive profile selection |
221
252
  | `src/prompts.ts` | All prompt text sent to those agents |
@@ -223,14 +254,16 @@ Or, for local development, point at the entry point directly:
223
254
  | `src/rubric.ts` | Embedded guidelines/fairness rubric text + per-role section loaders |
224
255
  | `src/roles.ts` | The 3 reviewer roles (description/tests/solution) metadata |
225
256
  | `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) |
257
+ | `src/config.ts` | `~/.pi/agent/checks-config.json` + `settings.json` helpers (models, humanizer counts, thinking levels, shell path) |
258
+ | `src/humanize.ts` | Opt-in CoreWeave draft generation, detector scoring, and ranked JSON output |
227
259
  | `src/git.ts` | Clean, non-mutating git `HEAD` snapshot into a scratch directory |
228
260
  | `src/progress.ts` | Progress-bar widget rendering |
229
261
  | `src/state.ts` | Shared "run in progress" / cancel state between the command and the shortcut |
230
262
  | `src/types.ts` | Shared TypeScript types |
231
263
 
232
264
  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`.
265
+ itself, edit `rubric.ts`. Agent result-submission tools are defined in `tools.ts` and wired up in `agents.ts`; direct
266
+ extension tools are registered from their feature modules and synchronized in `tool-sync.ts`.
234
267
 
235
268
  ## Development
236
269