synergyspec-selfevolving 1.3.0 → 2.0.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/README.md +50 -19
- package/dist/commands/learn.d.ts +12 -1
- package/dist/commands/learn.js +373 -31
- package/dist/commands/self-evolution-episode.d.ts +177 -0
- package/dist/commands/self-evolution-episode.js +423 -0
- package/dist/commands/self-evolution.d.ts +12 -190
- package/dist/commands/self-evolution.js +179 -786
- package/dist/commands/workflow/status.js +3 -1
- package/dist/core/archive.d.ts +0 -1
- package/dist/core/archive.js +0 -58
- package/dist/core/artifact-graph/instruction-loader.d.ts +2 -4
- package/dist/core/artifact-graph/instruction-loader.js +3 -31
- package/dist/core/config-prompts.js +4 -0
- package/dist/core/fitness/health/health-metrics.d.ts +26 -56
- package/dist/core/fitness/health/health-metrics.js +19 -58
- package/dist/core/fitness/health/index.d.ts +15 -2
- package/dist/core/fitness/health/index.js +25 -1
- package/dist/core/fitness/health/local-source.d.ts +43 -4
- package/dist/core/fitness/health/local-source.js +181 -25
- package/dist/core/fitness/health/metric-source.d.ts +48 -19
- package/dist/core/fitness/health/metric-source.js +8 -18
- package/dist/core/fitness/health/resolve-source.js +4 -1
- package/dist/core/fitness/loss.d.ts +7 -7
- package/dist/core/fitness/loss.js +6 -6
- package/dist/core/fitness/sample.d.ts +10 -0
- package/dist/core/fitness/test-failures.d.ts +30 -0
- package/dist/core/fitness/test-failures.js +123 -0
- package/dist/core/learn/credit-path.d.ts +36 -0
- package/dist/core/learn/credit-path.js +198 -0
- package/dist/core/learn/trajectory-discovery.d.ts +39 -0
- package/dist/core/learn/trajectory-discovery.js +140 -0
- package/dist/core/learn.d.ts +39 -5
- package/dist/core/learn.js +131 -14
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.js +52 -1
- package/dist/core/self-evolution/candidate-fitness.d.ts +23 -1
- package/dist/core/self-evolution/candidate-fitness.js +31 -5
- package/dist/core/self-evolution/candidates.d.ts +0 -9
- package/dist/core/self-evolution/canonical-targets.d.ts +8 -4
- package/dist/core/self-evolution/canonical-targets.js +8 -4
- package/dist/core/self-evolution/critic-agent.d.ts +150 -0
- package/dist/core/self-evolution/critic-agent.js +487 -0
- package/dist/core/self-evolution/edits-contract.d.ts +53 -0
- package/dist/core/self-evolution/edits-contract.js +89 -0
- package/dist/core/self-evolution/episode-orchestrator.d.ts +197 -0
- package/dist/core/self-evolution/episode-orchestrator.js +534 -0
- package/dist/core/self-evolution/episode-store.d.ts +266 -0
- package/dist/core/self-evolution/episode-store.js +573 -0
- package/dist/core/self-evolution/evolution-switches.d.ts +1 -1
- package/dist/core/self-evolution/evolution-switches.js +5 -10
- package/dist/core/self-evolution/evolving-agent.d.ts +162 -0
- package/dist/core/self-evolution/evolving-agent.js +449 -0
- package/dist/core/self-evolution/health-baseline.d.ts +25 -6
- package/dist/core/self-evolution/health-baseline.js +30 -6
- package/dist/core/self-evolution/host-harness.d.ts +1 -2
- package/dist/core/self-evolution/host-harness.js +1 -2
- package/dist/core/self-evolution/index.d.ts +10 -6
- package/dist/core/self-evolution/index.js +19 -6
- package/dist/core/self-evolution/learn-hints.d.ts +31 -0
- package/dist/core/self-evolution/learn-hints.js +16 -0
- package/dist/core/self-evolution/learn-observation-adapter.d.ts +35 -0
- package/dist/core/self-evolution/learn-observation-adapter.js +285 -10
- package/dist/core/self-evolution/line-diff.d.ts +60 -0
- package/dist/core/self-evolution/line-diff.js +130 -0
- package/dist/core/self-evolution/policy/fs-safe.d.ts +19 -0
- package/dist/core/self-evolution/policy/fs-safe.js +89 -0
- package/dist/core/self-evolution/policy/index.d.ts +13 -0
- package/dist/core/self-evolution/policy/index.js +13 -0
- package/dist/core/self-evolution/policy/policy-store.d.ts +217 -0
- package/dist/core/self-evolution/policy/policy-store.js +774 -0
- package/dist/core/self-evolution/policy/reject-buffer.d.ts +48 -0
- package/dist/core/self-evolution/policy/reject-buffer.js +168 -0
- package/dist/core/self-evolution/promote.d.ts +1 -1
- package/dist/core/self-evolution/promote.js +6 -33
- package/dist/core/self-evolution/promotion.js +1 -2
- package/dist/core/self-evolution/proposer-agent.d.ts +41 -0
- package/dist/core/self-evolution/proposer-agent.js +94 -13
- package/dist/core/self-evolution/proposer-slice.d.ts +26 -0
- package/dist/core/self-evolution/proposer-slice.js +54 -0
- package/dist/core/self-evolution/reward-agent.d.ts +234 -0
- package/dist/core/self-evolution/reward-agent.js +564 -0
- package/dist/core/self-evolution/scope-gate.d.ts +66 -0
- package/dist/core/self-evolution/scope-gate.js +107 -0
- package/dist/core/self-evolution/success-channel.d.ts +79 -0
- package/dist/core/self-evolution/success-channel.js +361 -0
- package/dist/core/self-evolution/target-evolution.d.ts +11 -0
- package/dist/core/self-evolution/target-evolution.js +2 -0
- package/dist/core/self-evolution/tool-evolution.js +2 -13
- package/dist/core/self-evolution/verdict.d.ts +8 -5
- package/dist/core/self-evolution/verdict.js +4 -7
- package/dist/core/templates/skill-templates.d.ts +1 -0
- package/dist/core/templates/skill-templates.js +1 -0
- package/dist/core/templates/workflow-manifest.js +2 -0
- package/dist/core/templates/workflows/learn.d.ts +4 -2
- package/dist/core/templates/workflows/learn.js +25 -166
- package/dist/core/templates/workflows/self-evolving.d.ts +13 -0
- package/dist/core/templates/workflows/self-evolving.js +127 -0
- package/dist/core/trajectory/facts.d.ts +16 -0
- package/dist/core/trajectory/facts.js +12 -4
- package/dist/core/trajectory/skeleton.d.ts +43 -0
- package/dist/core/trajectory/skeleton.js +239 -0
- package/dist/dashboard/data.d.ts +25 -51
- package/dist/dashboard/data.js +68 -180
- package/dist/dashboard/react-client.js +458 -503
- package/dist/dashboard/react-styles.js +3 -3
- package/dist/dashboard/server.js +23 -17
- package/dist/ui/ascii-patterns.d.ts +7 -15
- package/dist/ui/ascii-patterns.js +123 -54
- package/dist/ui/welcome-screen.d.ts +0 -14
- package/dist/ui/welcome-screen.js +16 -35
- package/package.json +3 -1
- package/scripts/code-health.py +1066 -638
- package/scripts/slop_rules.yaml +2151 -0
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ Now tell your AI: `/synspec:propose <what-you-want-to-build>`
|
|
|
133
133
|
→ **[Workflows](docs/workflows.md)**: combos and patterns<br>
|
|
134
134
|
→ **[Commands](docs/commands.md)**: slash commands & skills<br>
|
|
135
135
|
→ **[CLI](docs/cli.md)**: terminal reference<br>
|
|
136
|
-
→ **[
|
|
136
|
+
→ **[Self-Evolution Loop](docs/evaluation-lab.md)**: the loop-v2 in-context RL surface<br>
|
|
137
137
|
→ **[Supported Tools](docs/supported-tools.md)**: tool integrations & install paths<br>
|
|
138
138
|
→ **[Concepts](docs/concepts.md)**: how it all fits<br>
|
|
139
139
|
→ **[Multi-Language](docs/multi-language.md)**: multi-language support<br>
|
|
@@ -199,9 +199,9 @@ The self-evolution machinery lives in-tree under `src/core/fitness` and
|
|
|
199
199
|
`src/core/self-evolution`, exposed through the `synergyspec-selfevolving
|
|
200
200
|
self-evolution` subcommands (not as an ordinary day-to-day skill). It treats the
|
|
201
201
|
spec workflow as a learnable system — a change is a forward pass through the
|
|
202
|
-
artifact templates; `learn` runs the backward pass (a per-change loss); and
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
artifact templates; `learn` runs the backward pass (a per-change loss); and an
|
|
203
|
+
in-context-RL episode improves one design 策略 POLICY lineage from a graded
|
|
204
|
+
advantage, with a rollback that fires *before* any new edit.
|
|
205
205
|
|
|
206
206
|
What actually works today:
|
|
207
207
|
|
|
@@ -211,25 +211,53 @@ What actually works today:
|
|
|
211
211
|
`MetricSource` selected via `health:` in `synergyspec-selfevolving/config.yaml`.
|
|
212
212
|
New projects scaffold `source: local` (default-on): a dependency-free,
|
|
213
213
|
multi-language analyzer (`scripts/code-health.py`, Python 3 stdlib only) that
|
|
214
|
-
scores Python, Rust, C, and C++
|
|
214
|
+
scores Python, Rust, C, and C++ by computing the SlopCodeBench
|
|
215
|
+
`structural_erosion` and `verbosity` scores (for Python, the slop rules are
|
|
216
|
+
the actual SlopCodeBench v0.3 ast-grep rule set, bundled) — no server, no
|
|
217
|
+
network. Set `source: stub` to
|
|
215
218
|
make the loss functional-only; `sonarqube` is also supported; `local-python` is
|
|
216
219
|
a back-compat alias for `local`. See
|
|
217
220
|
[docs/customization.md](docs/customization.md#code-health-metrics-self-evolution).
|
|
218
|
-
- **
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
- **Rollout/critic separation** (`learn` → `synergyspec-selfevolving-self-evolving`):
|
|
222
|
+
the end-of-cycle critique runs in a fresh-context critic subagent — an
|
|
223
|
+
always-installed utility skill that reads only the on-disk record
|
|
224
|
+
(transcripts, hints, evolution result, learn report) and returns a
|
|
225
|
+
`## Critic Verdict` block that the thin `learn` relays. The session that did
|
|
226
|
+
the work never grades its own rollout; hosts without subagents run the critic
|
|
227
|
+
inline, marked as degraded isolation. Headless and fresh-context invokers can
|
|
228
|
+
pass explicit trajectory handles (`--transcript` / `--session-id` on `learn`,
|
|
229
|
+
`learn handoff`, `learn debug-trajectory`, and `evolve-from-edits`, or the
|
|
230
|
+
`SYNERGYSPEC_SELFEVOLVING_TRANSCRIPT` / `SYNERGYSPEC_SELFEVOLVING_SESSION_ID`
|
|
231
|
+
env vars; flags beat env vars, transcript beats session-id). An explicit
|
|
232
|
+
handle beats change-window discovery and never silently grades another
|
|
233
|
+
session: an unresolvable flag is an up-front error (exit non-zero), while a
|
|
234
|
+
missing env handle fails closed — no trajectory, and the observed-verified
|
|
235
|
+
gate refuses to promote.
|
|
236
|
+
- **Code-health gate** (the episode's evolving agent / `evolve-from-edits`): a
|
|
237
|
+
measured code-health regression vs the last accepted state blocks promotion (and
|
|
238
|
+
surfaces a loud `health-signal-unavailable` observation if a configured analyzer
|
|
239
|
+
can't run). No health signal ⇒ no gate, so the loop is never blocked on a missing
|
|
222
240
|
measurement.
|
|
223
241
|
- **Candidate proposals** (`self-evolution propose-canonical`): turns aggregated
|
|
224
242
|
`learn` hints into human-gated candidate packages under
|
|
225
243
|
`.synergyspec-selfevolving/self-evolution/candidates/`. Proposal-only — no
|
|
226
244
|
canonical file is modified, and the frozen gen-test/run-test oracle is never
|
|
227
245
|
touched.
|
|
228
|
-
- **
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
246
|
+
- **In-context-RL episode** (`self-evolution episode --change <name>`): runs ONE
|
|
247
|
+
completed change through a fixed, code-spawned pipeline. A two-arm forward grades
|
|
248
|
+
the **主智能体 MAIN AGENT** (the frozen current 策略 POLICY) from the change's
|
|
249
|
+
`learn` report against a **CRITIC AGENT(基线智能体 baseline agent)** that reruns
|
|
250
|
+
the prior policy on the same change; a **奖励智能体 REWARD AGENT** computes
|
|
251
|
+
**advantage = reward(主臂) − reward(基线臂)** and names the gap; on a bad advantage
|
|
252
|
+
the orchestrator rolls the 策略 POLICY back *before* the **演进智能体 EVOLVING
|
|
253
|
+
AGENT** is called; the evolving agent then makes ONE bounded edit (or refuses)
|
|
254
|
+
after the static / observed-GREEN / 范围⊆诊断 gates pass, writing the next policy
|
|
255
|
+
version onto your LOCAL files — no candidate dir, no republish. A frozen target
|
|
256
|
+
(per the per-target evolution policy) is skipped. Inspect the lineage with
|
|
257
|
+
`self-evolution policy show [--target <id>]`, re-enter a partial run with
|
|
258
|
+
`self-evolution episode resume <id>`, and manually restore a version with
|
|
259
|
+
`self-evolution policy rollback --target <id> --yes`. See
|
|
260
|
+
[docs/evaluation-lab.md](docs/evaluation-lab.md).
|
|
233
261
|
- **Per-target evolution scope** (`selfEvolution:` in
|
|
234
262
|
`synergyspec-selfevolving/config.yaml`): one switch decides which canonical
|
|
235
263
|
targets may evolve, honored end-to-end by `learn` → `propose-canonical` → the
|
|
@@ -242,13 +270,16 @@ What actually works today:
|
|
|
242
270
|
|
|
243
271
|
What is **not** built yet (don't infer it from the architecture diagrams):
|
|
244
272
|
|
|
245
|
-
- No autonomous multi-
|
|
246
|
-
|
|
247
|
-
|
|
273
|
+
- No autonomous multi-episode **breeding** loop. Each `self-evolution episode`
|
|
274
|
+
improves the policy from one change's graded advantage; it never fans out
|
|
275
|
+
competing variants or runs unattended generations. New manual candidates only
|
|
276
|
+
come from the human-gated `propose-canonical` step.
|
|
248
277
|
- No measured benchmark gains. The mechanisms are implemented and unit-tested,
|
|
249
278
|
but the loop has not been run end-to-end to produce quantitative results.
|
|
250
|
-
- The earlier out-of-tree `evolve/` DGM lab (and its `pnpm evolve` harness)
|
|
251
|
-
|
|
279
|
+
- The earlier out-of-tree `evolve/` DGM lab (and its `pnpm evolve` harness) and
|
|
280
|
+
the genetic-algorithm outer loop (`self-evolution evolve` / `--replay`) have
|
|
281
|
+
been removed; the technique was internalized into `src/core` and re-homed on the
|
|
282
|
+
loop-v2 in-context-RL episode.
|
|
252
283
|
|
|
253
284
|
## Contributing
|
|
254
285
|
|
package/dist/commands/learn.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
|
|
2
|
+
import { type RunEpisodeOptions, type RunEpisodeResult, type RunEpisodeBusy } from '../core/self-evolution/episode-orchestrator.js';
|
|
3
|
+
/**
|
|
4
|
+
* Injectable dependencies for {@link registerLearnCommand}. The ONLY seam today
|
|
5
|
+
* is `runEpisode` — the loop-v2 episode runner the autonomous `--apply` entrance
|
|
6
|
+
* invokes. It defaults to the real {@link runEpisode}; learn tests stub it so the
|
|
7
|
+
* evolve path is exercised WITHOUT spawning real agents (the orchestrator's three
|
|
8
|
+
* agents each own a `runHeadlessAgent` spawn, which the stub never reaches).
|
|
9
|
+
*/
|
|
10
|
+
export interface LearnCommandDeps {
|
|
11
|
+
runEpisode?: (opts: RunEpisodeOptions) => Promise<RunEpisodeResult | RunEpisodeBusy>;
|
|
12
|
+
}
|
|
13
|
+
export declare function registerLearnCommand(program: Command, deps?: LearnCommandDeps): void;
|
|
3
14
|
//# sourceMappingURL=learn.d.ts.map
|