[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6P399ES8EYWKE1YES03WFPX":3,"skill-same:01M6P399ES8EYWKE1YES03WFPX":43},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":12,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":27,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M6P399ES8EYWKE1YES03WFPX","optimization",null,"dexter-cnx\u002Fagent-engineering-toolkit","dexter-cnx","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F73522389?v=4","01M6K09WYAAXJXMR26H00WJ2AT","01M6P370Z0XCZ7NC67MJ2MRW94",0,"MIT","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Foverlays\u002Fagent-karpathy\u002Fskills\u002Foptimization\u002FSKILL.md",[],[17],"Optimization","2026-11-10 10:12:30",false,"# karpathy-optimizer\n\n## Purpose\nSelect the best mutation candidate using token efficiency policy and score delta, then promote it to disk or return a REJECT decision with reasoning.\n\n## Use when\n- You have a set of regression-passing candidate EvalResults and need to decide which (if any) to promote\n- The final_score of at least one candidate exceeds the baseline final_score\n- You need a machine-readable PromotionDecision dict for downstream reporting\n- You are running the last stage of a full optimization cycle before writing the report\n\n## Do NOT use when\n- Regression checks have not been run yet — call `karpathy-regression` first — use a more specific skill instead.\n- No candidates passed regression — the optimizer requires at least one passing candidate — use a more specific skill instead.\n- You want to force-promote a candidate regardless of score — the optimizer enforces the 0.60 floor — use a more specific skill instead.\n- You are in a dry-run context where you only want to see the decision without writing to disk — pass `dry_run=True` to the runner\n\n## Inputs required\n- The baseline EvalResult (from `karpathy-evaluation` run on the unmodified skill)\n- A list of candidate EvalResults (from `karpathy-evaluation` run on each passing candidate)\n- A list of MutationCandidate dicts (matching the candidate_evals by candidate_id)\n- The skill_path to write the promoted content (if decision is PROMOTE and not dry-run)\n- A dry_run flag (default: False for production runs, True for CI eval-only workflows)\n\n## Constraints\n- Apply token policy before ranking: reject any candidate where token increase > 35% AND score improvement \u003C 5%\n- A candidate must score at least 0.60 (absolute floor) to be eligible for promotion\n- A candidate must exceed the baseline score to be eligible for promotion — equal score is a REJECT\n- Back up the existing SKILL.md as `SKILL.\u003Ctimestamp>.bak.md` before writing the winner\n- The PromotionDecision must include reasoning that names the winner_id, mutation_type, score_delta, and token_delta_pct\n\n## Step-by-step workflow\n1. For each candidate EvalResult, compute token_increase_pct = (candidate_tokens - baseline_tokens) \u002F baseline_tokens.\n2. Apply token policy: if token_increase_pct > 0.35 AND score_improvement \u003C 0.05, mark as token_policy_passed = False and exclude from ranking.\n3. Sort remaining candidates by final_score descending.\n4. Select the top-scoring candidate as the winner.\n5. If winner.final_score \u003C= baseline.final_score, return decision = REJECT with reasoning.\n6. If winner.final_score \u003C 0.60, return decision = REJECT with reasoning.\n7. If not dry_run, write backup of existing skill and write winner content to skill_path.\n8. Return PromotionDecision with: winner_id, decision = PROMOTE, reasoning, score_delta, token_delta_pct, promoted_path.\n\n## Output contract\n- A PromotionDecision dict with: winner_id (str or null), decision (\"PROMOTE\" or \"REJECT\"), reasoning (str), score_delta (float or null), token_delta_pct (float or null), promoted_path (str or null), token_policy_applied (bool), token_policy_rejections (list of str)\n- If PROMOTE: the winning SKILL.md is written to skill_path and the previous version is backed up\n- The decision is appended to `memory\u002Fscore_history.json` via the Orchestrator\n\n## Validation checklist\n- Confirm token_policy_rejections contains all candidate_ids where token_increase_pct > 0.35 and score_improvement \u003C 0.05\n- Confirm winner_id is null when decision is REJECT\n- Confirm the backup file exists at `SKILL.\u003Ctimestamp>.bak.md` when decision is PROMOTE and not dry_run\n- Run `python -m runners.promotion_runner --dry-run ...` and confirm no file is written\n\n## Related skills\n- `karpathy-regression` — must complete before calling this skill\n- `karpathy-evaluation` — provides the EvalResult inputs this skill needs\n- `karpathy-guidelines` — for understanding why a candidate scored as it did\n\n## References\n- [`..\u002F..\u002Fagents\u002Fpromotion_agent.py`](..\u002F..\u002Fagents\u002Fpromotion_agent.py)\n- [`..\u002F..\u002Fdocs\u002Fpromotion-system.md`](..\u002F..\u002Fdocs\u002Fpromotion-system.md)\n- [`..\u002F..\u002Fdocs\u002Ftoken-optimizer.md`](..\u002F..\u002Fdocs\u002Ftoken-optimizer.md)\n\n## Real example\nHistorical static snapshot: three candidates pass regression for the flutter deep link skill. Candidate `baseline-token_budget` is rejected by token policy (+40% tokens, only +2% score). Of the remaining two, `baseline-decomposition_steps` scores 0.7834 (+0.06 above baseline) and `baseline-verification_ordering` scores 0.7612 (+0.04). The optimizer promotes `baseline-decomposition_steps`, writes the backup, and returns reasoning: \"Candidate baseline-decomposition_steps improved score by +0.0600 (+8.3%) with token delta +2.1%.\"\n\n## Real file output sample\n```text\noverlays\u002Fagent-karpathy\u002Fskills\u002Fevaluation\u002FSKILL.20260417T120000.bak.md\noverlays\u002Fagent-karpathy\u002Fskills\u002Fevaluation\u002FSKILL.md\nreports\u002Flatest_report.md\n```\n",{},"main","3035171e2986d5fdb445e694b9013fbdf58b3ff6","overlays\u002Fagent-karpathy\u002Fskills\u002Foptimization","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit","https:\u002F\u002Fgithub.com\u002Fdexter-cnx","https:\u002F\u002Fdexter-cnx.github.io\u002Fportfolio\u002F","2026-05-26 14:24:27",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add dexter-cnx\u002Fagent-engineering-toolkit --skill optimization",{"tool":35,"command":36},"bunx","bunx skills add dexter-cnx\u002Fagent-engineering-toolkit --skill optimization",{"tool":38,"command":39},"pnpm","pnpm dlx skills add dexter-cnx\u002Fagent-engineering-toolkit --skill optimization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Foverlays\u002Fagent-karpathy\u002Fskills\u002Foptimization\u002FSKILL.md",true,[],[44,71,91,100,112,124],{"skillNo":45,"name":46,"nameZh":6,"description":47,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":18},"01M6P4P9S9017DTSFMRKGA7XW2","toolkit-i18n-operator","Use the toolkit-i18n CLI for repeated Flutter localization workflows with compact outputs, CSV validation, key coverage reporting, generated JSON exports, and safe non-mutating behavior.","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Ftools\u002Ftoolkit-i18n\u002Fskills\u002Ftoolkit-i18n-operator\u002FSKILL.md",[],[51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70],"toolkit i18n operator","i18n","operator","toolkit","flutter localization","cli","safe","workflows","for","validation","with","csv","compact","reporting","json","flutter","behavior","coverage","generated","use",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":87,"publishedAt":18},"01M6P4NREKE3P0XYV3RBBWC987","toolkit-design-operator","Use the toolkit-design CLI for repeated repository workflows.","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Ftools\u002Ftoolkit-design\u002Fskills\u002Ftoolkit-design-operator\u002FSKILL.md",[77,82],{"categoryNo":78,"categoryName":79,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[88,53,54,89,59,56,58,90,70],"toolkit design operator","design","repository",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":18},"01M6P4NNSQ09QFPYG2PMPWEA94","toolkit-ci-operator","Use the toolkit-ci CLI for repeated repository workflows.","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Ftools\u002Ftoolkit-ci\u002Fskills\u002Ftoolkit-ci-operator\u002FSKILL.md",[],[98,99,53,54,90,56,58,70,59],"toolkit ci operator","ci",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":18},"01M6P4NK636991P6WWQ6X8HDYX","toolkit-arch-operator","Use the toolkit-arch CLI for repeated repository workflows, including Flutter i18n usage scans, layer checks, and localization coverage.","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Ftools\u002Ftoolkit-arch\u002Fskills\u002Ftoolkit-arch-operator\u002FSKILL.md",[],[107,108,54,53,52,109,110,59,70,68,66,111,90,58,56],"toolkit arch operator","arch","usage","layer","localization",{"skillNo":113,"name":114,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":120,"publishedAt":18},"01M6P4NF18XGVSG2NR01E1DX0R","web-testing","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Foverlays\u002Fweb-frontend\u002Fskills\u002Fweb-testing\u002Fskill.md",[117],{"categoryNo":118,"categoryName":119,"taxonomyType":80,"taxonomyTypeDesc":81},"01JBSEEDCAT000000000000008","测试与质量",[121,122,123],"web testing","web","testing",{"skillNo":125,"name":126,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":18},"01M6P4MVK07EJ75FQTFN54AGPM","web-state","https:\u002F\u002Fgithub.com\u002Fdexter-cnx\u002Fagent-engineering-toolkit\u002Fblob\u002Fmain\u002Foverlays\u002Fweb-frontend\u002Fskills\u002Fweb-state\u002Fskill.md",[],[122,130,131],"state","web state"]