@holdyourvoice/hyv 3.3.0 → 3.3.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
@@ -14,7 +14,7 @@ Those programs keep separate findings, scores, and pass states. A strong result
14
14
 
15
15
  Everything in the CLI runs from local files: accounts, API calls, telemetry, payment collection, and runtime network requests stay out of the core path. The optional Claude extension adds a local stdio MCP adapter around that same engine; it is not a hosted service.
16
16
 
17
- > **Status:** the public CLI is published as [`@holdyourvoice/hyv`](https://www.npmjs.com/package/@holdyourvoice/hyv). It runs locally and makes no runtime network requests. Version 3.3.0 adds pre-edit judgments, range edits, and authorized rebuild. Writer-study kits remain blocked optional research. Product publish uses the version bump and CI.
17
+ > **Status:** [`@holdyourvoice/hyv`](https://www.npmjs.com/package/@holdyourvoice/hyv) **3.3.1** is the public founder-aware rewrite. It runs locally and makes no runtime network requests. The package includes Profile v3 policy, pre-edit SHIP/EDIT/REBUILD judgments, contiguous range edits, authorized rebuild, and a signed semantic lifecycle.
18
18
 
19
19
  ## Why it exists
20
20
 
@@ -27,6 +27,7 @@ Hold Your Voice keeps the work visible:
27
27
  | Does the draft still resemble this writer’s observable mechanics? | VoiceDNA | A profile-based score, findings, and pass state. |
28
28
  | Does the draft contain a configured editorial pattern worth inspecting? | AI Editor | A rule-based score, sentence findings, and pass state. |
29
29
  | Did the rewrite introduce a new blocker or replace too much? | Verification | Regressions, preservation score, and a release decision. |
30
+ | Should this draft ship, take a bounded edit, or rebuild? | Judgment | A SHIP, EDIT, or REBUILD recommendation bound to the draft and profile. |
30
31
 
31
32
  Its scope is a local writing gate. Authorship detection, fact checking, plagiarism review, and hosted generation each need their own tools. Hold Your Voice gives a writer or chosen model a narrow editing brief, then asks the same two engines to inspect the result.
32
33
 
@@ -228,7 +229,27 @@ flowchart LR
228
229
  G --> R[Pass or inspect regressions]
229
230
  ```
230
231
 
231
- The tool never applies changes to your draft. You decide which findings are valid, apply replacement sentences deliberately, and run the final check.
232
+ The tool never applies changes to your draft. You decide which findings are valid, apply replacement sentences or an authorized rebuild deliberately, and run the final check.
233
+
234
+ ## Founder-aware rewrite
235
+
236
+ 3.3.0 keeps the original analyze → brief → verify loop and adds a structured rewrite path.
237
+
238
+ 1. Prepare a pre-edit judgment. Findings reduce to **SHIP**, bounded **EDIT**, or **REBUILD**.
239
+ 2. **SHIP** returns the original bytes. No model call.
240
+ 3. **EDIT** applies eligible sentence replacements or contiguous range edits through `prepare-rewrite` / `apply-rewrite`. Clean and unflagged text stays in place. Overlapping, out-of-order, or partly locked ranges fail before a candidate is built.
241
+ 4. **REBUILD** prepares a whole-document candidate only after a matching REBUILD recommendation, a CopySpec, and a signed `hyv.rebuild-authorization` capability. `prepare-rebuild` / `apply-rebuild` re-check that capability and the bound profile. Claim, polarity, hygiene, and semantic gates stay in force. Edit and rebuild responses are mutually incompatible.
242
+
243
+ ```bash
244
+ hyv prepare-judgment pre-edit argument draft.md profile.json task.json
245
+ hyv reduce-judgment envelope-a.json envelope-b.json envelope-c.json
246
+ hyv prepare-rewrite draft.md profile.json task.json
247
+ hyv apply-rewrite task.json response.json profile.json
248
+ hyv prepare-rebuild draft.md profile.json reduction.json copy-spec.json task.json --capability-file capability.json
249
+ hyv apply-rebuild task.json response.json profile.json --capability-file capability.json
250
+ ```
251
+
252
+ CLI and MCP expose the same contracts. The engine never calls a model. An editor or chosen model still sits outside the package.
232
253
 
233
254
  ## The five rewrite tiers
234
255
 
@@ -240,7 +261,7 @@ The prompt has an order. Lower tiers can refine a higher tier; they cannot overr
240
261
  4. **Tier 3: AI Editor.** Inspect yellow findings. Change a line only when the repair helps.
241
262
  5. **Tier 4: output.** Return replacement sentences keyed by sentence number.
242
263
 
243
- This order protects meaning before style. Read the complete [prompt contract](docs/PROMPT-CONTRACT.md) before changing it.
264
+ This order protects meaning before style. Rebuild is a separate whole-document contract; it does not use sentence-number replacements. Read the complete [prompt contract](docs/PROMPT-CONTRACT.md) before changing either path.
244
265
 
245
266
  ## VoiceDNA: 13 observable elements
246
267
 
@@ -302,8 +323,12 @@ The preservation score is a guardrail based on retained original words longer th
302
323
  | `hyv hygiene <draft> [--fix] [--output=path]` | Draft | Hygiene report or cleaned copy plus receipt | You need to inspect or conservatively clean hidden Unicode. |
303
324
  | `hyv final-check <path\|->` | Any final text | Exact accepted text on stdout or a withheld-output report on stderr | Text is about to cross a user-facing boundary. |
304
325
  | `hyv rewrite-prompt <draft> <profile.json>` | Draft and profile | Markdown editing brief | You need a constrained request for an editor or model. |
305
- | `hyv prepare-rewrite <draft> <profile.json> <task.json>` | Draft and profile | Versioned task file plus metadata | A host needs a fingerprint-bound sentence-edit task. |
326
+ | `hyv prepare-rewrite <draft> <profile.json> <task.json>` | Draft and profile | Versioned task file plus metadata | A host needs a fingerprint-bound sentence-edit or range-edit task. |
306
327
  | `hyv apply-rewrite <task.json> <response.json> <profile.json>` | Task, response, and profile | Candidate evaluation JSON | A host needs to apply and recheck eligible sentence replacements. |
328
+ | `hyv prepare-judgment <pre-edit\|post-candidate> <kind> <draft> <profile.json> <task.json> [candidate.md]` | Draft, profile, and optional candidate | Versioned judgment task | Findings need a SHIP, EDIT, or REBUILD recommendation. |
329
+ | `hyv reduce-judgment <envelope.json> <envelope.json> [envelope.json...]` | Signed judgment envelopes | Recommendation JSON | Multiple judgment envelopes must reduce to one decision. |
330
+ | `hyv prepare-rebuild <draft> <profile.json> <reduction.json> <copy-spec.json> <task.json>` | Draft, recommendation, CopySpec, and capability | Versioned rebuild task | An upstream REBUILD recommendation needs a whole-document candidate. |
331
+ | `hyv apply-rebuild <task.json> <response.json> <profile.json>` | Task, response, profile, and capability | Candidate evaluation JSON | A host needs to apply and recheck an authorized rebuild. |
307
332
  | `hyv verify <original> <candidate> <profile.json>` | Original, candidate, profile | Verification JSON and exit code | You need the candidate gate. |
308
333
  | `hyv verify-spec <original> <candidate> <profile.json> <copy-spec.json>` | Original, candidate, profile, CopySpec | Verification JSON with hard claim gate | A brief contains locked facts or prohibited claims. |
309
334
  | `hyv learning <show\|inspect\|add\|record\|ratify\|supersede\|migrate\|clear> ...` | Profile, operation value, and bounded metadata options | Preferences or a text-free mutation receipt | You need to inspect, migrate, or manage profile-scoped learning. |
@@ -314,7 +339,7 @@ Every file argument can be `-` when the command accepts text input from standard
314
339
 
315
340
  Profile v3 learning is keyed by its stable local profile ID, so compatible history survives profile revisions. `record`, `ratify`, and `supersede` accept bounded `--mutation-id`, `--authority`, `--provenance`, `--weight`, and `--compatibility` options. `ratify` and `supersede` require Profile v3. `migrate` explicitly copies compatible legacy Profile v2 learning into one Profile v3 identity. Replaying an identical mutation is idempotent; reusing its ID for a different operation returns a conflict. Inspection and receipts expose event metadata only, never stored instructions or draft text.
316
341
 
317
- The standalone CLI supports normal-policy semantic review. High-assurance review requires a trusted embedding and is rejected by the CLI. Approval capabilities are accepted only through `--capability-stdin` or a permission-checked `--capability-file`; adapters validate capabilities but never mint them. Rejection needs no capability. Approval and `learning record-approved` require the matching signed final-approval capability. `apply-rewrite`, `lifecycle submit-verdict`, and `lifecycle finalize` exit `2` when the candidate or transition is not accepted, while usage and runtime failures exit `1`.
342
+ The standalone CLI supports normal-policy semantic review. High-assurance review requires a trusted embedding and is rejected by the CLI. Approval and rebuild capabilities are accepted only through `--capability-stdin` or a permission-checked `--capability-file`; adapters validate capabilities but never mint them. Rejection needs no capability. Approval and `learning record-approved` require the matching signed final-approval capability. `apply-rewrite`, `apply-rebuild`, `lifecycle submit-verdict`, and `lifecycle finalize` exit `2` when the candidate or transition is not accepted, while usage and runtime failures exit `1`.
318
343
 
319
344
  ## Project map
320
345
 
@@ -328,7 +353,9 @@ The standalone CLI supports normal-policy semantic review. High-assurance review
328
353
  | `src/editorial-packs.ts` | Parses WritingBrief context and runs format and batch checks. |
329
354
  | `src/learning.ts` | Stores text-free, profile-scoped verified repairs and composes bounded local preferences. |
330
355
  | `src/pipeline.ts` | Combines scored pass states, makes briefs, and verifies candidates. |
331
- | `src/rewrite-task.ts` | Prepares and evaluates fingerprint-bound sentence-replacement tasks. |
356
+ | `src/rewrite-task.ts` | Prepares and evaluates fingerprint-bound sentence-replacement and range-edit tasks. |
357
+ | `src/judgment-task.ts` | Reduces pre-edit SHIP/EDIT/REBUILD recommendations and post-candidate clearance. |
358
+ | `src/rebuild-task.ts` | Prepares whole-document rebuild after a matching recommendation, CopySpec, and signed capability. |
332
359
  | `src/semantic-review.ts` | Defines and reduces semantic and human-review lifecycle artifacts. |
333
360
  | `src/approval-capability.ts` | Verifies canonical signed approval capabilities. |
334
361
  | `src/approval-context.ts` | Loads permission-checked trust roots and evaluator authorization. |
@@ -378,7 +405,7 @@ Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request. Keep chan
378
405
 
379
406
  ## npm releases
380
407
 
381
- `@holdyourvoice/hyv` is published automatically after a change to the package source reaches `main`. The workflow publishes only when the version in `package.json` is not already on npm, so bump that version in the same pull request as a release-worthy change. It runs the tests and release audit before publishing, then verifies that npm reports the package as MIT licensed. Writer-study kits stay optional research. Product publish uses the version bump and CI. Keep writer-checkpoint claims off the publish.
408
+ `@holdyourvoice/hyv` is published automatically after a change to the package source reaches `main`. The workflow publishes only when the version in `package.json` is not already on npm, so bump that version in the same pull request as a release-worthy change. It runs the tests and release audit before publishing, then verifies that npm reports the package as MIT licensed.
382
409
 
383
410
  ## Support
384
411
 
@@ -162,7 +162,7 @@ test('CLI and MCP rebuild helpers share fingerprints', () => {
162
162
  version: '1', audience: 'operators', intent: 'explain', format: 'outreach',
163
163
  });
164
164
  assert.match(briefTask.prompt, /# WritingBrief/);
165
- assert.equal(HYV_VERSION, '3.3.0');
165
+ assert.equal(HYV_VERSION, '3.3.1');
166
166
  });
167
167
  test('apply rejects forged tasks, missing capability, and substituted profiles', () => {
168
168
  const reduction = rebuildRecommendation();
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const HYV_VERSION = '3.3.0';
1
+ export const HYV_VERSION = '3.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holdyourvoice/hyv",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "A local-first dual-engine writing gate that protects voice and catches generic AI patterns.",
5
5
  "type": "module",
6
6
  "bin": { "hyv": "dist/cli.js" },