@claude-flow/cli 3.16.2 → 3.17.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.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: harness-gepa
3
+ description: Inspect and audit GEPA genomes via the `@metaharness/darwin/gepa` library entry (darwin 0.8.0) — load/validate a genome (default: the shipped cand-6 promotion), render the system prompt a genome compiles to, or classify failure modes in a run transcript. The `gepaOptimize` loop itself is library-only (bring your own evaluator) and not surfaced here — use `harness-evolve` for sandbox-scored evolution. Degrades gracefully when @metaharness/darwin is absent.
4
+ argument-hint: "--op genome|validate|render|analyze [--path <genome.json>] [--transcript <t.json>] [--alert-on-invalid]"
5
+ allowed-tools: Bash
6
+ ---
7
+
8
+ Surfaces the GEPA (genetic-evolution prompt-adaptation) *library* exports
9
+ from `@metaharness/darwin/gepa`. Unlike the other skills in this plugin
10
+ there is no CLI binary behind this — the script dynamic-imports the library
11
+ (local resolution first, versioned cache install as fallback) and calls the
12
+ subprocess-safe subset.
13
+
14
+ ## When to use
15
+
16
+ - **Adopting an evolved policy**: `--op render` shows the actual system
17
+ prompt a genome compiles to — read THAT, not the raw JSON, before
18
+ wiring a genome into a harness.
19
+ - **Auditing a promotion**: `--op genome` loads + validates the shipped
20
+ cand-6 genome (first holdout-confirmed cheap-tier promotion; provenance
21
+ ships in the package) or any genome file you point at.
22
+ - **CI gate on genome edits**: `--op validate --alert-on-invalid` exits 1
23
+ on structural errors.
24
+ - **Debugging a bad run**: `--op analyze --transcript run.json` classifies
25
+ failure modes (GEPA's failure-class taxonomy) from a transcript array.
26
+
27
+ ## What is deliberately NOT here
28
+
29
+ `gepaOptimize` — the optimization loop takes an in-process
30
+ `evaluate(candidate)` callback ("bring your own evaluator") that cannot
31
+ cross a subprocess boundary. Two supported paths instead:
32
+
33
+ 1. **Library consumers**: `import { gepaOptimize, loadCand6Genome } from '@metaharness/darwin/gepa'`
34
+ 2. **Sandbox-scored evolution**: `harness-evolve` (darwin CLI `evolve`),
35
+ which pairs GEPA with its own sandbox evaluators.
36
+
37
+ ## Algorithm
38
+
39
+ Implementation: [`scripts/gepa.mjs`](../../scripts/gepa.mjs).
40
+
41
+ 1. `import('@metaharness/darwin/gepa')`; on MODULE_NOT_FOUND fall back to a
42
+ one-time `npm install --prefix ~/.ruflo/darwin-cache-0.8.0` and import
43
+ the cached `dist/gepa/index.js` (versioned dir → pin bumps invalidate).
44
+ 2. Dispatch `--op`:
45
+ - `genome` → `loadGenome(fs, path)` or `loadCand6Genome()` + `validateGenome`
46
+ - `validate` → `validateGenome(rawJson)` (raw parse so broken files reach
47
+ the validator instead of throwing in the loader)
48
+ - `render` → `buildSystemFromGenome(genome, ext?, glob?)`
49
+ - `analyze` → `analyzeTranscript(entries)`
50
+ 3. Emit one JSON object; exit 0 (or 1 under `--alert-on-invalid`, 2 on bad input).
51
+
52
+ ## Examples
53
+
54
+ ```bash
55
+ node scripts/gepa.mjs --op genome # cand-6 + validation
56
+ node scripts/gepa.mjs --op render | jq -r .system # what does cand-6 SAY?
57
+ node scripts/gepa.mjs --op validate --path my-genome.json --alert-on-invalid
58
+ node scripts/gepa.mjs --op analyze --transcript run.json
59
+ ```
60
+
61
+ ## Exit codes
62
+
63
+ - `0` — op completed (or degraded — darwin not installable)
64
+ - `1` — `--alert-on-invalid` and validation found errors
65
+ - `2` — config error (unknown op, missing/broken input file)
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: harness-learn
3
+ description: Run a GEPA learning cycle via `metaharness learn` (upstream ADR-235, metaharness@0.3.0) — optimizes a harness genome against a SWE-bench-style slice manifest. $0 dry-run by default; `--run` is the explicit spend opt-in. Requires a metaharness repo checkout (`--repo` or $METAHARNESS_REPO) — without one it reports `checkout-required` with clone instructions. Degrades gracefully when metaharness is absent.
4
+ argument-hint: "--host <h> --model <m> --slice <manifest> [--repo <checkout>] [--run] [--alert-on-fail]"
5
+ allowed-tools: Bash
6
+ ---
7
+
8
+ Surfaces `metaharness learn` — the upstream GEPA learning harness that
9
+ evolves harness policy genomes against a scored task corpus instead of
10
+ hand-editing prompts. Candidates are scored on held-out slices and only
11
+ measured winners promote (the shipped cand-6 genome is the first such
12
+ promotion: holdout gold 2/12 → 3/12, zero regressions).
13
+
14
+ ## When to use
15
+
16
+ - A harness's policy prompt underperforms on a task family and you want a
17
+ measured improvement loop rather than manual prompt iteration.
18
+ - Pricing a learning run before committing spend — the default dry-run
19
+ resolves the slice manifest and reports cost without any model calls.
20
+ - After a learn run promotes a genome: pair with `harness-gepa --op render`
21
+ to inspect what the promoted policy actually says.
22
+
23
+ ## Preconditions (upstream design)
24
+
25
+ The learning harness (GEPA + SWE-bench + Docker) is too heavy for the npm
26
+ package, so `learn` needs a local clone:
27
+
28
+ ```bash
29
+ git clone https://github.com/ruvnet/metaharness.git
30
+ node scripts/learn.mjs --repo ./metaharness --host claude-code --model haiku --slice slices/lite.json
31
+ ```
32
+
33
+ Without a checkout the script emits `{status: "checkout-required"}` and
34
+ exits 0 — a precondition report, not an error (distinct from
35
+ `degraded: true`, which means the npm package itself is absent). The
36
+ managed-service path (gateway-side learn jobs, no checkout) is upstream's
37
+ ADR-235 follow-up and not available yet.
38
+
39
+ ## Algorithm
40
+
41
+ Implementation: [`scripts/learn.mjs`](../../scripts/learn.mjs).
42
+
43
+ 1. Validate `--repo` exists when given; export it as `$METAHARNESS_REPO`.
44
+ 2. Shell to `npx -y metaharness@latest learn --host <h> --model <m> --slice <s> [--run]`
45
+ via `_harness.mjs` (graceful degradation, hard timeout).
46
+ 3. Default timeouts: 120s dry-run, 600s with `--run` — real runs on larger
47
+ slices need an explicit `--timeout-ms` matched to slice size × model cost.
48
+ 4. Detect the checkout-required message → structured payload, exit 0.
49
+ 5. Parse the trailing JSON report when upstream emits one; otherwise return
50
+ the raw report text under `rawReport`.
51
+
52
+ ## Cost note
53
+
54
+ `--run` is the ONLY path that spends. Everything else — dry-run, checkout
55
+ probe, degraded path — is $0. The MCP tool (`metaharness_learn`) has a 120s
56
+ subprocess budget; run real learning cycles from a terminal via
57
+ `ruflo metaharness learn ... --run --timeout-ms <big>`.
58
+
59
+ ## Exit codes
60
+
61
+ - `0` — report produced (or dry-run, checkout-required, degraded)
62
+ - `1` — `--alert-on-fail` and the learn run reported failure
63
+ - `2` — config error (bad `--repo` path)
@@ -29,7 +29,7 @@ ground-truth set. Running this nightly gives us:
29
29
 
30
30
  Implementation: [`scripts/security-bench.mjs`](../../scripts/security-bench.mjs).
31
31
 
32
- 1. Shell to `npx -y @metaharness/darwin@~0.3.1 metaharness-darwin security bench --population N --cycles N [--seed S]`.
32
+ 1. Shell to `npx -y @metaharness/darwin@~0.8.0 metaharness-darwin security bench --population N --cycles N [--seed S]`.
33
33
  2. Default timeout = `3s × 19 evaluations × population × cycles + 30s overhead`.
34
34
  At default `--population 2 --cycles 1` ≈ 144s; at `--population 4 --cycles 3` ≈ 12 min.
35
35
  3. Parse the markdown report — overall PASS/FAIL plus per-gate