ECC/tests/scripts
romanclaudersoai1 8a97868b5b
fix(continuous-learning): /evolve never produces skill or agent candidates (#2664)
* fix(continuous-learning): cluster instincts by keyword overlap in /evolve

`cmd_evolve` grouped instincts by exact string equality of the whole
normalized trigger sentence. Triggers are free-form sentences, so every
instinct landed in its own bucket and `skill_candidates` was always empty.
`agent_candidates` is derived from `skill_candidates`, so agents never
generated either — `/evolve --generate` could only ever emit commands.

Measured on a 42-instinct project: 42 instincts produced 42 unique cluster
keys, largest cluster size 1.

Group on keyword overlap instead. Jaccard is the wrong metric here — trigger
keyword sets average ~7 words, so even clearly related pairs top out around
0.33 — so this uses the overlap coefficient (shared / smaller set) at 0.5,
plus a floor of 2 shared keywords so one incidental word cannot pull
unrelated instincts together. The same 42 instincts now yield 4 clusters.

Also unify the command/agent slug used by the preview and the writer. The
preview called `.replace('a ', '')`, which strips "a " anywhere in the
string, mangling "extracting data from Reddit" into
`/extracting-datfrom-R` while `--generate` wrote `extracting-data-from.md`.
Both paths now share `_evolved_command_name()` / `_evolved_agent_name()`.

Adds tests/scripts/instinct-cli-evolve.test.js, which fails on the previous
implementation (0 clusters instead of 1; preview name `extracting-datfrom-R`)
and covers the negative cases so unrelated triggers still stay apart.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(continuous-learning): correct clustering metric name in docstring

The docstring said "Jaccard" while the implementation uses the overlap
coefficient, which is the point of the change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(continuous-learning): generate every evolve candidate and cut slugs on word boundaries

_generate_evolved() wrote only skill_candidates[:5], workflow_instincts[:5]
and agent_candidates[:3]. On a project with 36 command candidates that meant
5 files and no warning, so the output read as complete while 86% of the
candidates were dropped.

Generation is now unbounded by default and takes a --limit N flag for callers
that want a cap. A cap that truncates says so:

  Note: writing 3 of 36 command candidates (--limit 3); 33 skipped.

The analysis preview keeps showing five per kind but now names the remainder
("... and 31 more command candidates not shown") instead of presenting a
sample as the whole set.

Slugs were also cut with a hard slice, which split words mid-token and
produced /investigating-comple, /learning-about-compl and
/researching-mechanis. _truncate_slug() retreats to the last separator that
fits, and keeps the full head when the cut already lands on one, so
"analyzing large text files" stays /analyzing-large-text rather than losing
a word. A first word longer than the limit still falls back to a hard cut
because no boundary is available.

Shorter slugs collide more easily, and a collision used to mean one file
silently overwriting another. _assign_unique_slugs() suffixes duplicates
(-2, -3) and is called by both the preview and the writer over the same
ordered list, so advertised names and written names cannot drift apart.

Skill directory naming moved to _evolved_skill_name(); it previously used its
own inline slug expression, so it was the one truncation the shared helper
did not cover.

Adds tests/scripts/instinct-cli-evolve-generate.test.js: 7 cases covering
word-boundary cuts, the separator-aligned cut, unbounded generation, --limit
reporting, collision dedup, preview remainder and preview/writer agreement.
Six of the seven fail against the previous implementation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: haelyra <49814733+haelyra@users.noreply.github.com>
2026-08-04 16:57:24 -04:00
..
auto-update.test.js test: normalize auto-update repo root expectation on windows 2026-04-29 21:01:27 -04:00
build-opencode.test.js fix: narrow npm publish surface to the module graph 2026-04-12 23:48:53 -07:00
catalog.test.js
check-unicode-safety.test.js test(ci): regression coverage for newly-covered invisible code points 2026-05-18 21:20:36 -04:00
claw.test.js
codex-hooks.test.js fix: add plugin cache health check (#2249) 2026-06-15 14:01:25 -04:00
consult.test.js fix: tune machine learning workflow routing 2026-05-11 18:11:05 -04:00
control-pane.test.js feat(control-pane): serve 3D agent-airspace viz + /api/proximity feed (#2320) 2026-06-25 16:45:53 -07:00
dashboard-web.test.js fix: harden local dashboard and data boundaries (#2585) 2026-07-27 11:11:29 -07:00
discussion-audit.test.js chore: gate canonical ECC release identity (#1991) 2026-05-19 06:42:17 -04:00
doctor.test.js
ecc-dashboard.test.js fix: port hook session and dashboard safety fixes 2026-05-11 02:53:28 -04:00
ecc.test.js feat: add ECC2 local control pane (#2131) 2026-06-03 21:54:30 +08:00
gemini-adapt-agents.test.js fix: use scalar Claude agent tools (#2583) 2026-07-26 03:20:15 -07:00
github-coordination.test.js docs+chore: add README Security section; fix lint regressions on main 2026-06-16 02:08:14 -04:00
harness-audit.test.js feat: extend harness audit integration scoring (#1990) 2026-05-19 06:20:54 -04:00
install-apply.test.js fix: flatten Claude skill installs (#2582) 2026-07-26 03:20:06 -07:00
install-plan.test.js fix: restore short Claude plugin slug and skill installs (#1712) 2026-05-11 02:10:36 -04:00
install-ps1.test.js fix: document supported claude hook install path 2026-04-12 23:29:45 -07:00
install-readme-clarity.test.js docs: align rules README install namespace 2026-05-15 02:07:43 -04:00
install-sh.test.js fix: document supported claude hook install path 2026-04-12 23:29:45 -07:00
instinct-cli-evolve-generate.test.js fix(continuous-learning): /evolve never produces skill or agent candidates (#2664) 2026-08-04 16:57:24 -04:00
instinct-cli-evolve.test.js fix(continuous-learning): /evolve never produces skill or agent candidates (#2664) 2026-08-04 16:57:24 -04:00
instinct-cli-projects.test.js fix: clean promoted instinct sources (#2587) 2026-07-28 21:31:12 -04:00
ito-cli-bridge.test.js feat(ito): expose guarded live node qualification 2026-07-23 22:10:57 -07:00
ito-compute-sponsor.test.js Use supplied Itō PNG logo (#2570) 2026-07-24 17:40:49 -07:00
list-installed.test.js
loop-status.test.js fix: handle dotted reserved snapshot names 2026-04-30 12:25:14 -04:00
manual-hook-install-docs.test.js fix: document supported claude hook install path 2026-04-12 23:29:45 -07:00
memory-mcp.test.js fix(mcp): accept reserved _meta field in tools/call params (#2670) 2026-08-04 00:28:09 -04:00
memory.test.js feat: add cross-harness memory vault (#2581) 2026-07-26 02:46:59 -07:00
npm-publish-surface.test.js feat: add cross-harness memory vault (#2581) 2026-07-26 02:46:59 -07:00
observability-readiness.test.js security: add supply-chain IOC scanner (#1904) 2026-05-14 21:15:35 -04:00
openclaw-persona-forge-gacha.test.js
operator-readiness-dashboard.test.js docs: sync live native payments gate evidence 2026-05-19 23:25:38 -04:00
orchestrate-codex-worker.test.js
orchestration-status.test.js
plan-canvas.test.js fix: harden plan canvas code scanning alerts 2026-07-22 16:28:07 -04:00
platform-audit.test.js docs: sync selected-target announcement gate (#2020) 2026-05-19 22:09:45 -04:00
post-bash-command-log.test.js
preview-pack-smoke.test.js Add preview pack smoke gate 2026-05-17 15:35:23 -04:00
release-approval-gate.test.js fix(release): derive approval gate paths from version (#2383) 2026-06-29 15:50:55 -07:00
release-publish.test.js test: normalize release workflow line endings 2026-05-18 13:53:26 -04:00
release-video-suite.test.js fix(release): derive video suite paths from version (#2384) 2026-06-29 15:50:57 -07:00
release.test.js test(ecc2): normalize release workflow newlines 2026-04-29 17:31:01 -04:00
repair.test.js test: stabilize repair lifecycle on Windows 2026-05-18 03:48:51 -04:00
session-inspect.test.js
setup-package-manager.test.js
skill-create-output.test.js
sync-ecc-to-codex.test.js feat(codex): add ECC navigation guide (#2525) 2026-07-22 20:44:37 -04:00
trae-install.test.js Finalize and enhance SLSA generic generator workflow (#2197) 2026-06-15 14:01:29 -04:00
uninstall.test.js feat: salvage windows desktop e2e skill 2026-05-11 19:15:02 -04:00
work-items.test.js feat(work-items): add 'claim' command for JIT work pickup 2026-06-18 17:07:24 -04:00