@rhize/skill-forge 0.9.0 → 0.10.0

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/LICENSE CHANGED
@@ -22,6 +22,10 @@ Pro Modules
22
22
  - src/organize.ts
23
23
  - src/commands/watch.ts
24
24
  - src/commands/ingest.ts
25
+ - src/refine/models.ts
26
+ - src/refine/store.ts
27
+ - src/refine/patch.ts
28
+ - src/refine/context.ts
25
29
 
26
30
  ...and the portions of built artifacts (e.g. dist/cli.js in the published npm
27
31
  package) generated from these files. Each Pro Module carries a header
package/README.md CHANGED
@@ -75,6 +75,11 @@ skill-forge find [query] [options] Discover skills via skills.sh and
75
75
  skill-forge watch [options] Drift check across every SOURCES.md provenance ledger (Pro)
76
76
  skill-forge ingest [options] Hand the pending-ingestion queue off to a coding agent for the decide/absorb pass (Pro)
77
77
  skill-forge queue close <id> --status <s> Close a queue entry after the decide pass (Pro)
78
+ skill-forge refine [options] Capture a project-scope override from real usage feedback (Pro)
79
+ skill-forge refine list [options] Show refinement history
80
+ skill-forge refine patterns [options] List tracked/ready/generalized/dismissed patterns
81
+ skill-forge refine promote <PATTERN-ID> Merge a ready pattern into the user-scope skill (Pro)
82
+ skill-forge refine which <skill> Print override-resolution order for a skill
78
83
  skill-forge list List skills currently held in quarantine
79
84
  skill-forge status Show configuration and quarantine summary
80
85
  ```
@@ -399,6 +404,118 @@ quarantine/gate pipeline first; `ingest` only ever drains what's already queued.
399
404
  `skill-forge queue close <id> --status ingested|dismissed` lets an agent close out a queue entry
400
405
  after its decide pass without hand-editing `queue.json` — writes are atomic (temp file + rename).
401
406
 
407
+ ### `refine` (v0.10, Pro)
408
+
409
+ ```bash
410
+ skill-forge refine --skill my-skill --category hook --override-type patch \
411
+ --action insert-after --marker "Only check paths" \
412
+ --content "..." --expected "..." --actual "..." --dry-run
413
+ skill-forge refine list [--skill <s>] [--project <p>]
414
+ skill-forge refine patterns [--status tracking|ready|generalized|dismissed] [--skill <s>]
415
+ skill-forge refine promote <PATTERN-ID> [--dry-run] [--force]
416
+ skill-forge refine rollback <backup-id> [--force]
417
+ skill-forge refine which <skill>
418
+ ```
419
+
420
+ Pro (free during the 0.x beta). Captures, applies, and generalizes improvements to installed
421
+ skills from real usage feedback — the npm-package absorption of what was previously the
422
+ `rhize-plugins` repo's `rhize-meta` plugin `skill-refinement` skill (`/refine-skills`,
423
+ `/review-patterns`, `/apply-generalization`); that plugin skill no longer exists (see
424
+ [CLAUDE.md's "refine (v0.10)" section](CLAUDE.md) for the full merge notes, or
425
+ `docs/refinement-schema.md` for the store shape).
426
+
427
+ **Capture never mutates a base `SKILL.md`.** `refine` capture/apply writes ONLY project-scope
428
+ override artifacts — `SKILL.patch.md` / `SKILL.extend.md` / `skill-config.json`, or a whole-file
429
+ override copy for `full`/`hook`/`script` override types. The only command that ever touches a
430
+ user-scope base skill is `refine promote`, and only against a `ready` pattern (or with `--force`).
431
+
432
+ **Override precedence** (unchanged semantics from the plugin, configurable roots):
433
+
434
+ ```
435
+ 1. PROJECT LOCAL <cwd>/.claude/skills/<skill>/ highest
436
+ 2. PROJECT SHARED <cwd>/skills/<skill>/
437
+ 3. USER SCOPE first configured skillsRoots entry outside cwd (fallback ~/.claude/skills)
438
+ ```
439
+
440
+ `refine which <skill>` prints this resolution order and which override files exist at each scope —
441
+ the "why didn't my patch take effect" debugging aid, made explicit and read-only.
442
+
443
+ **Non-interactive capture contract.** Capture flags: `--skill --category --target --override-type
444
+ <patch|extend|config|full|hook|script|new> --action <append|prepend|replace-section|insert-after|
445
+ insert-before|delete-section> --marker --content(-file) --expected --actual --example --outcome
446
+ --root-cause --pattern-id --scope <local|shared> --dry-run --json --yes`. All seven override types
447
+ are supported: `patch`/`extend`/`config` are rendered from the flags; `full`/`hook`/`script` are
448
+ verbatim override-file writes at project scope (content required); `new` creates an extension file
449
+ for a capability that doesn't exist in the base skill yet. Always run `--dry-run` first and confirm
450
+ the preview before writing for real — `--yes` skips re-prompting for a confirmation already given,
451
+ it does not replace the dry-run preview.
452
+
453
+ **The judgment step is the agent's job**, same pattern as `--ingest`/`audit --handoff`: a new
454
+ bundled `assets/refine-prompt.md` carries the gap-analysis rubric (category/override-type decision
455
+ tables, guided-mode triggers ported from the plugin's `analyze_gap.py`), the patch-action syntax,
456
+ the pattern-fingerprint/generalization criteria, and the verification step. `refine --handoff`
457
+ (opt-in) launches your configured agent with it, same handoff plumbing as `--ingest`; `--yes` never
458
+ implies `--handoff`.
459
+
460
+ **Pattern tracking and promotion.** A pattern becomes `ready` only when it recurs in a **second,
461
+ genuinely different project** — repeat captures in the same project never flip it (occurrence
462
+ `count` is derived from unique project identities, not raw refinement counts; see
463
+ `docs/refinement-schema.md`). `refine patterns` lists tracked/ready/generalized/dismissed patterns,
464
+ filterable by `--status --skill --project`. `refine promote <PATTERN-ID>` merges a `ready` pattern
465
+ into the user-scope base skill: it backs up affected files first (manifest with per-file sha256 +
466
+ original bytes + mode, tombstones for files that didn't exist), stages the write, validates, then
467
+ renames into place — `--dry-run` previews the diff without writing, `refine rollback <backup-id>`
468
+ restores from the manifest (refusing if current files have drifted since promote, unless
469
+ `--force`). On promote, a `SOURCES.md` provenance entry is appended (verb `DEFER`, notes
470
+ `"generalized from PAT-xxxx via skill-forge refine"`).
471
+
472
+ **`evolve` vs. `refine`.** Both improve an already-installed skill, but at different scopes and
473
+ triggers: `evolve` (v0.7) is *automated, whole-skill* optimization — it hands the entire skill off
474
+ to SkillOpt-Sleep to propose a fresh replacement, re-gates the proposal, and lets you adopt or
475
+ reject it wholesale. `refine` is *targeted, human/agent-driven* — it captures one specific observed
476
+ gap ("expected X, got Y") and writes the smallest override that closes it, tracked and eventually
477
+ generalized only once the same gap recurs elsewhere. A `refine` patch on top of an `evolve`d skill
478
+ is fine; both record their own provenance entry, so the `SOURCES.md` ledger shows which change came
479
+ from which mechanism.
480
+
481
+ **Legacy store — deliberate skip, not a migration.** The plugin's `~/.claude/skill-refinements/`
482
+ held three flat markdown notes (no structured ledgers, no schema) — there is no migration from it.
483
+ Files there stay readable in place; if anything in them still matters, re-capture it via
484
+ `skill-forge refine` against the greenfield JSON store described in
485
+ [`docs/refinement-schema.md`](docs/refinement-schema.md). The plugin's markdown ledgers
486
+ (`refinement-history/*.md`, `aggregated-patterns.md`, `generalization-queue.md`) are not
487
+ recreated — JSON is the store; `refine list`/`refine patterns` are the human-readable view over it.
488
+
489
+ **Auto-trigger hooks — templates, not automation.** A CLI cannot hook a running Claude Code
490
+ session. The plugin's two auto-trigger hooks ship here as documented templates instead:
491
+ `assets/hooks/refinement-detector.sh` (detects refinement-shaped language in a prompt) and
492
+ `assets/hooks/session-end.sh` (prompts after a substantial session). Both are optional, inert if
493
+ `skill-forge` isn't on `PATH`, and never call `skill-forge` themselves — they only print a
494
+ suggestion. Wire either one in by adding it to your `.claude/settings.json` (or
495
+ `~/.claude/settings.json`) hooks section — the exact snippet is in each script's own header
496
+ comment:
497
+
498
+ ```json
499
+ {
500
+ "hooks": {
501
+ "UserPromptSubmit": [
502
+ { "hooks": [{ "type": "command", "command": "bash /path/to/refinement-detector.sh" }] }
503
+ ],
504
+ "SessionEnd": [
505
+ { "hooks": [{ "type": "command", "command": "bash /path/to/session-end.sh" }] }
506
+ ]
507
+ }
508
+ }
509
+ ```
510
+
511
+ **Security invariants** (same regime as v0.8/v0.9): nothing from a skill being refined is ever
512
+ executed. Patch application writes ONLY under the resolved target scope dir for the named skill
513
+ (containment-checked realpath, refuses a symlinked destination file); promotion writes ONLY under
514
+ user scope, backup first. All child processes are argv arrays (git only, for context gathering).
515
+ Control-char sanitization on every untrusted string that lands in human-readable output. `--yes`
516
+ never implies `--handoff`. Applying a patch whose target `SKILL.md` is missing is refused; promoting
517
+ a non-`ready` pattern without `--force` is refused.
518
+
402
519
  ### `list` / `status`
403
520
 
404
521
  `list` shows what's currently held in quarantine (installed via `add`, answered "hold", not yet
@@ -519,6 +636,7 @@ JSON. Detection/overlap is agent-format-agnostic; writing is JSON-only.
519
636
  | `find` — skills.sh discovery + partner audit verdicts (v0.9) | ✓ | ✓ |
520
637
  | `watch` — provenance drift check across every `SOURCES.md` ledger (v0.9) | | ✓ |
521
638
  | `ingest` + `queue close` — pending-queue drain handoff (v0.9) | | ✓ |
639
+ | `refine` — capture/apply/generalize project-scope skill overrides (v0.10) | | ✓ |
522
640
 
523
641
  Free is the complete safety gate on its own — quarantine, profile, safety scan, and an explicit
524
642
  promote/reject decision, with nothing held back. Pro is the curation layer on top: whether a new
@@ -573,8 +691,10 @@ hands a promoted skill off to one, running the bundled, agent-neutral prompt at
573
691
  `assets/ingest-prompt.md` — works with any agent. (As of v0.9, this fully replaces the `rhize-meta`
574
692
  plugin's `rhize-skill-forge` skill and its `/rhize-meta:forge-ingest`/`forge-scan`/`forge-watch`/
575
693
  `skill-find`/`skill-doctor` commands, which are removed; skill vetting/governance now lives
576
- entirely in this npm package. The plugin's remaining `skill-refinement` skill can still receive
577
- ABSORB extractions from an ingest pass — see [docs/forge-workflow.md](docs/forge-workflow.md).)
694
+ entirely in this npm package. As of v0.10, the `rhize-meta` plugin's remaining `skill-refinement`
695
+ skill is ALSO removed — ABSORB extractions from an ingest pass now route through
696
+ `skill-forge refine` in this same package instead — see [`refine`](#refine-v010-pro) above and
697
+ [docs/forge-workflow.md](docs/forge-workflow.md).)
578
698
  The same flag works on an MCP server promote (`--artifact mcp --ingest`, v0.6): the bundled prompt branches on the
579
699
  queue entry's `artifactType` and runs the matching decide pass — see
580
700
  [MCP gating](#mcp-gating-v05) above.
@@ -655,9 +775,9 @@ skill-forge is open-core with a split license (as of v0.2.0):
655
775
  safety gate, report, promote/hold/reject. See [LICENSE-MIT](LICENSE-MIT).
656
776
  - **Pro modules — Rhize Commercial License.** `src/license.ts`, `src/gate/overlap.ts`,
657
777
  `src/provenance.ts`, `src/queue.ts` (overlap analysis, provenance ledger, pending
658
- queue / `--ingest` handoff). The source is available to read and audit, but production
659
- use of Pro functionality requires a license key — see
660
- [LICENSE-COMMERCIAL](LICENSE-COMMERCIAL).
778
+ queue / `--ingest` handoff), and `src/refine/` (v0.10 — capture/apply/generalize skill
779
+ overrides). The source is available to read and audit, but production use of Pro
780
+ functionality requires a license key — see [LICENSE-COMMERCIAL](LICENSE-COMMERCIAL).
661
781
 
662
782
  [LICENSE](LICENSE) is the authoritative map of which files fall under which license.
663
783
  Versions up to and including 0.1.0 were published entirely under MIT.