sneakoscope 4.8.4 → 4.8.6

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.
Files changed (81) hide show
  1. package/README.md +3 -3
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/bin/sks.js +1 -1
  6. package/dist/cli/command-registry.js +1 -0
  7. package/dist/core/agents/agent-central-ledger.js +10 -5
  8. package/dist/core/agents/agent-orchestrator.js +22 -1
  9. package/dist/core/agents/agent-runner-codex-exec.js +24 -0
  10. package/dist/core/agents/fast-mode-policy.js +3 -4
  11. package/dist/core/agents/native-cli-session-proof.js +1 -1
  12. package/dist/core/agents/native-cli-worker.js +73 -113
  13. package/dist/core/agents/worker-pane-communication-contract.js +2 -3
  14. package/dist/core/codex/codex-cli-syntax-builder.js +2 -0
  15. package/dist/core/codex-app/codex-init-deep.js +10 -3
  16. package/dist/core/codex-control/codex-reliability-shield.js +36 -17
  17. package/dist/core/codex-control/codex-sdk-adapter.js +2 -2
  18. package/dist/core/codex-control/codex-sdk-config-policy.js +4 -0
  19. package/dist/core/codex-control/codex-task-runner.js +23 -11
  20. package/dist/core/codex-native/core-skill-manifest.js +2 -1
  21. package/dist/core/commands/gates-command.js +58 -0
  22. package/dist/core/commands/release-command.js +5 -5
  23. package/dist/core/commands/stop-gate-command.js +1 -1
  24. package/dist/core/fsx.js +1 -1
  25. package/dist/core/hooks-runtime/team-digest.js +86 -0
  26. package/dist/core/hooks-runtime.js +1 -82
  27. package/dist/core/init/skills.js +395 -0
  28. package/dist/core/init.js +2 -376
  29. package/dist/core/lean-engineering-policy.js +2 -1
  30. package/dist/core/naruto/naruto-active-pool.js +36 -7
  31. package/dist/core/naruto/naruto-real-worker-child.js +67 -11
  32. package/dist/core/permission-gates.js +45 -19
  33. package/dist/core/pipeline-internals/runtime-gates.js +26 -45
  34. package/dist/core/ppt/artifacts.js +19 -0
  35. package/dist/core/ppt/html.js +96 -0
  36. package/dist/core/ppt/style-tokens.js +248 -0
  37. package/dist/core/ppt.js +6 -352
  38. package/dist/core/qa-loop/{qa-contract-v2.js → qa-contract.js} +1 -1
  39. package/dist/core/qa-loop/{qa-gate-v2.js → qa-gate.js} +1 -1
  40. package/dist/core/qa-loop/qa-runtime-artifacts.js +2 -2
  41. package/dist/core/qa-loop.js +11 -4
  42. package/dist/core/recallpulse/policy.js +226 -0
  43. package/dist/core/recallpulse.js +2 -225
  44. package/dist/core/release/release-gate-dag.js +6 -2
  45. package/dist/core/research/mock-result.js +406 -0
  46. package/dist/core/research/prompt.js +15 -0
  47. package/dist/core/research.js +2 -402
  48. package/dist/core/routes/constants.js +48 -0
  49. package/dist/core/routes/design-policy.js +37 -0
  50. package/dist/core/routes/evidence.js +77 -0
  51. package/dist/core/routes/ppt-policy.js +26 -0
  52. package/dist/core/routes.js +8 -179
  53. package/dist/core/safety/mutation-ledger.js +2 -0
  54. package/dist/core/safety/ssot-guard.js +2 -2
  55. package/dist/core/stop-gate/stop-gate-check.js +10 -17
  56. package/dist/core/version.js +1 -1
  57. package/dist/core/zellij/zellij-slot-pane-renderer.js +15 -8
  58. package/dist/core/zellij/zellij-slot-telemetry.js +28 -12
  59. package/dist/scripts/check-pipeline-budget.js +1 -7
  60. package/dist/scripts/check-pipeline-runtime.js +1 -8
  61. package/dist/scripts/codex-control-all-pipelines-check.js +5 -14
  62. package/dist/scripts/codex-sdk-all-pipelines-check.js +5 -9
  63. package/dist/scripts/fast-codex-service-tier-proof-check.js +2 -2
  64. package/dist/scripts/gate-policy-audit-check.js +70 -0
  65. package/dist/scripts/official-docs-compat-report.js +2 -2
  66. package/dist/scripts/product-design-plugin-routing-check.js +10 -5
  67. package/dist/scripts/qa-loop-surface-router-check.js +2 -2
  68. package/dist/scripts/release-check-dynamic-execute.js +32 -35
  69. package/dist/scripts/release-check-dynamic.js +19 -28
  70. package/dist/scripts/release-check-stamp.js +2 -2
  71. package/dist/scripts/release-dag-full-coverage-check.js +57 -394
  72. package/dist/scripts/release-dynamic-performance-check.js +18 -19
  73. package/dist/scripts/release-dynamic-presets-check.js +2 -2
  74. package/dist/scripts/release-gate-dag-runner.js +3 -1
  75. package/dist/scripts/release-gate-existence-audit.js +59 -91
  76. package/dist/scripts/release-gate-planner.js +43 -23
  77. package/dist/scripts/release-metadata-1-19-check.js +100 -12
  78. package/dist/scripts/worker-pane-communication-contract-check.js +1 -2
  79. package/dist/scripts/zellij-slot-pane-renderer-check.js +3 -2
  80. package/package.json +13 -965
  81. package/dist/core/pipeline-runtime.js +0 -2
package/dist/core/init.js CHANGED
@@ -14,6 +14,8 @@ import { codexCommandHookCurrentHash } from './codex-hooks/codex-hook-hash.js';
14
14
  import { buildSksCoreSkillManifest, isCoreSkillName } from './codex-native/core-skill-manifest.js';
15
15
  import { syncCoreSkillsIntegrity } from './codex-native/core-skill-integrity.js';
16
16
  import { dbSafetyGuardSkillText, madDbSkillText } from './mad-db/mad-db-policy.js';
17
+ import { currentGeneratedFileInventory, installCodexAgents, installSkills, pruneStaleGeneratedFiles } from './init/skills.js';
18
+ export { installSkills } from './init/skills.js';
17
19
  const REFLECTION_MEMORY_PATH = '.sneakoscope/memory/q2_facts/post-route-reflection.md';
18
20
  const SKS_GENERATED_GIT_PATTERNS = [
19
21
  '.sneakoscope/missions/',
@@ -1028,383 +1030,7 @@ function codexAppQuickReference(scope, commandPrefix) {
1028
1030
  `Guard: generated harness files are immutable outside the engine source repo; check ${commandPrefix} guard check; conflicts use ${commandPrefix} conflicts prompt with human approval.`
1029
1031
  ].join('\n') + '\n';
1030
1032
  }
1031
- export async function installSkills(root) {
1032
- const imageUxReviewSkill = (name) => `---\nname: ${name}\ndescription: $Image-UX-Review/$UX-Review imagegen/gpt-image-2 annotated UI/UX review loop.\n---\n\nUse only for $Image-UX-Review, $UX-Review, $visual-review, or $ui-ux-review UI/UX review requests. ${imageUxReviewPipelinePolicyText()} Core loop: capture or attach source UI screenshots, then invoke Codex App $imagegen with gpt-image-2 to create a new generated annotated review image from each source screenshot, then analyze the generated review image with vision/OCR into image-ux-issue-ledger.json, then apply only requested safe fixes and recheck changed screens. Text-only screenshot critique cannot satisfy full verification; missing generated annotated review images keep full image-ux-review-gate.json verification blocked, but may close verified_partial/reference-only when source screenshots plus hashes, docs evidence, source Image Voxel anchors, and Honest Mode evidence exist. For live web/browser/webapp capture use Codex Chrome Extension first and halt if it is not installed/enabled; use Codex Computer Use only for native Mac/non-web app screens. Required artifacts: image-ux-review-policy.json, image-ux-screen-inventory.json, image-ux-generated-review-ledger.json, image-ux-issue-ledger.json, image-ux-iteration-report.json, image-ux-review-gate.json. Finish with reflection and Honest Mode.\n`;
1033
- const skills = {
1034
- 'dfix': `---\nname: dfix\ndescription: Direct Fix mode for $DFix or $dfix requests and inferred tiny copy/config/docs/labels/spacing/translation/simple mechanical edits.\n---\n\nUse for tiny copy/config/docs/labels/spacing/translation/simple mechanical edits. List exact micro-edits, inspect only needed files, apply only those edits, and run cheap verification. Keep broad implementation routed to Team; for UI/UX micro-edits read \`design.md\` when present and use imagegen for image/logo/raster assets. Bypass broad SKS routing, mission state, TriWiki/TriFix/reflection/state recording, Goal, Research, eval, redesign, and repeated full-route Honest Mode loops. Start the final answer with \`DFix 완료 요약:\` and include one \`DFix 솔직모드:\` line covering verified, not verified, and remaining issues. ${CODEX_IMAGEGEN_REQUIRED_POLICY}\n`,
1035
- 'answer': `---\nname: answer\ndescription: Answer-only research route for ordinary questions that should not start implementation.\n---\n\nUse for explanations, comparisons, status, facts, source-backed research, or docs guidance. Use repo/TriWiki first for project-local facts; hydrate low-trust claims from source. Browse or use Context7 for current external package/API/framework/MCP docs. End with a concise answer summary plus Honest Mode; do not create missions, subagents, or file edits.\n`,
1036
- 'sks': `---\nname: sks\ndescription: General Sneakoscope Codex command route for $SKS or $sks usage, setup, status, and workflow help.\n---\n\nUse local SKS commands: bootstrap, deps, commands, quickstart, codex-app, context7, guard, conflicts, reasoning, wiki, pipeline status, pipeline plan, skill-dream. Promote code-changing work to Team unless Answer/DFix/Help/Wiki/safety route fits. Surface route/guard/scope, use TriWiki, do not edit installed harness files outside this engine repo, and require human-approved conflict cleanup. ${skillDreamPolicyText()}\n`,
1037
- 'fast-mode': `---\nname: fast-mode\ndescription: Dollar-command route for $Fast-Mode, $Fast-On, and $Fast-Off project-local Fast mode toggles.\n---\n\nUse when the user invokes $Fast-Mode, $Fast-On, $Fast-Off, or asks to turn SKS Fast mode on/off for dollar commands. Prefer \`sks fast-mode on|off|status|clear --json\`. The command writes only .sneakoscope/state/fast-mode.json in the active project. Explicit runtime flags still win: \`--fast\`, \`--no-fast\`, and \`--service-tier standard|fast\` override the saved preference for that run. Finish with a short status and Honest Mode; do not start Team or broad implementation for a toggle-only request.\n`,
1038
- 'fast-on': `---\nname: fast-on\ndescription: Alias for $Fast-On project-local SKS Fast mode enablement.\n---\n\nUse the same rules as fast-mode. Run or instruct \`sks fast-mode on --json\`, then report the active state, state file, and the fact that explicit per-run flags still override the saved preference.\n`,
1039
- 'fast-off': `---\nname: fast-off\ndescription: Alias for $Fast-Off project-local SKS Fast mode disablement.\n---\n\nUse the same rules as fast-mode. Run or instruct \`sks fast-mode off --json\`, then report the active state, state file, and the fact that explicit per-run flags still override the saved preference.\n`,
1040
- 'with-local-llm-on': `---\nname: with-local-llm-on\ndescription: Dollar-command route for $with-local-llm-on local Ollama worker enablement.\n---\n\nUse when the user invokes $with-local-llm-on or asks to enable the optional local Ollama worker backend. Prefer \`sks with-local-llm on --json\`. The command writes the machine-local config at \`~/.sneakoscope/local-model.json\`. Default off means SKS stays GPT-only until this command enables local workers. Enabled mode only lets policy-eligible simple code patch-envelope or read-only collection worker slices use Ollama; GPT/Codex still owns strategy, planning, design, review, verification, safety, and integration. \`--no-ollama\` and \`SKS_OLLAMA_WORKERS=0\` still force local workers off for a run. Finish with a short status and Honest Mode; do not start Team for a toggle-only request.\n`,
1041
- 'with-local-llm-off': `---\nname: with-local-llm-off\ndescription: Dollar-command route for $with-local-llm-off local Ollama worker disablement.\n---\n\nUse when the user invokes $with-local-llm-off or asks to disable the optional local Ollama worker backend. Prefer \`sks with-local-llm off --json\`. The command writes the machine-local config at \`~/.sneakoscope/local-model.json\`. Disabled mode keeps SKS GPT-only by default. Strategy, planning, design, review, verification, safety, and integration remain GPT/Codex-owned regardless of this toggle. Finish with a short status and Honest Mode; do not start Team for a toggle-only request.\n`,
1042
- 'wiki': `---\nname: wiki\ndescription: Dollar-command route for $Wiki TriWiki refresh, pack, validate, and prune commands.\n---\n\nUse for $Wiki or Korean wiki-refresh requests. Refresh/update/갱신: run sks wiki refresh, then validate .sneakoscope/wiki/context-pack.json. Pack: run sks wiki pack, then validate. Prune/clean/정리: use sks wiki refresh --prune, or sks wiki prune --dry-run for inspection. Report claims, anchors, trust, attention.use_first/hydrate_first, validation, and blockers. Do not start ambiguity-gated implementation, subagents, or unrelated work.\n`,
1043
- 'team': `---\nname: team\ndescription: SKS Team orchestration for $Team/code work; $From-Chat-IMG is the explicit chat-image alias.\n---\n\nUse for $Team/code work. Auto-seal the route contract from prompt, TriWiki/current-code defaults, and conservative policy; do not surface a prequestion sheet. Read pipeline-plan.json or run sks pipeline plan to see the runtime lane, kept/skipped stages, and verification before implementation. Write team-roster.json; team-gate.json needs team_roster_confirmed=true. executor:N means N native analysis agents, N debate voices, then fresh N executors. ${MIN_TEAM_REVIEW_POLICY_TEXT} After consensus, compile team-graph.json, team-runtime-tasks.json, team-decomposition-report.json, and team-inbox/ so worker handoff uses concrete runtime task ids with role/path/domain/lane hints. Refresh/validate TriWiki before debate, implementation, review, and final; consume attention.use_first and hydrate attention.hydrate_first before risky decisions. ${leanEngineeringCompactText()} ${outcomeRubricPolicyText()} ${speedLanePolicyText()} ${solutionScoutPolicyText('fix this broken behavior')} ${skillDreamPolicyText()} Log events and use sks team message for bounded inter-agent communication in transcript/lane panes. Color-coded Zellij lanes distinguish overview/native-analysis/planning/execution/review/safety sessions in one Zellij window using split panes when Zellij is available. $Team/$team plus sks --mad uses the MAD-SKS permission gate module: user-authorized target-project scopes such as files, shell, packages, services, network, browser/Computer Use, generated assets, file permissions, migrations, normal DB writes, Supabase MCP writes, direct SQL, and schema cleanup are open only for the active invocation; catastrophic wipe/all-row/project-management, credential exfiltration, persistent security weakening, and unrequested fallback guards remain. End with cleanup-zellij or a cleanup event so follow panes show cleanup and stop; pass team-session-cleanup.json, then reflection and Honest Mode. Parent integrates/verifies.\n\n${chatCaptureIntakeText()}\n`,
1044
- 'from-chat-img': `---\nname: from-chat-img\ndescription: Explicit $From-Chat-IMG Team alias for chat screenshot plus attachment analysis.\n---\n\nUse only for From-Chat-IMG/$From-Chat-IMG. It enters the normal Team pipeline. Treat uploads as chat screenshot plus originals. For web/browser/webapp targets use Codex Chrome Extension first; for native Mac/non-web app surfaces use Codex Computer Use visual inspection when available. List requirements first, match regions to attachments with confidence, write ${FROM_CHAT_IMG_COVERAGE_ARTIFACT}, ${FROM_CHAT_IMG_CHECKLIST_ARTIFACT}, ${FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT}, and ${FROM_CHAT_IMG_QA_LOOP_ARTIFACT}, then continue Team gates, review, reflection, and Honest Mode. ${CODEX_WEB_VERIFICATION_POLICY} ${CODEX_COMPUTER_USE_ONLY_POLICY} The ledger must account for every visible customer request, screenshot image region, and separate attachment; ${FROM_CHAT_IMG_CHECKLIST_ARTIFACT} must have a checked item for each request, image-region/attachment match, work item, scoped QA-LOOP, and verification step; ${FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT} stores temporary TriWiki-backed session context with expires_after_sessions=${FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS}. ${FROM_CHAT_IMG_QA_LOOP_ARTIFACT} must prove QA-LOOP ran over the exact customer-request work-order range after implementation, with every work item covered, post-fix verification complete, and zero unresolved findings. team-gate.json cannot pass From-Chat-IMG completion until unresolved_items is empty, every checklist box is checked, and scoped_qa_loop_completed=true.\n`,
1045
- 'naruto': `---\nname: naruto\ndescription: $Naruto Shadow Clone Swarm (影分身 / Kage Bunshin no Jutsu) fans out up to 100 parallel clone sessions on the native agent kernel for high-throughput work.\n---\n\nUse when the user invokes $Naruto, $ShadowClone, or $Kagebunshin, or asks to fan out many parallel agent clones for high-throughput sweeps. Naruto runs on the native agent kernel and layers on the Team route: it loads the team, pipeline-runner, prompt-pipeline, and honest-mode skills. Prefer \`sks naruto run "<task>" [--clones N] [--backend codex-exec|fake] [--work-items N] [--real] [--readonly] [--json]\` and \`sks naruto status [--mission <id>] [--json]\`. Clones default to the native kernel and are throttled to host capacity (cores/free memory); the requested clone count is the ceiling, not a guarantee, and the scheduler backfills slots as clones complete. Shadow clones always run in fast service tier; \`--no-fast\`/standard requests are not honored for clones. Writes are lease-based and non-overlapping: each clone takes a path lease before writing so parallel clones never edit the same file, and every clone emits its own proof. Keep agent-central-ledger.json, agent-task-board.json, agent-effort-policy.json, agent-scheduler-state.json, agent-proof-evidence.json, and agent-session-cleanup.json; the parent session owns integration, verification, and final claims. Use \`--backend fake\` only for fixtures/selftests; remove it when real clone evidence is intended. Lifecycle: clone roster build, work partition, parallel clone scheduling, lease-based write swarm, per-clone proof, session cleanup, then reflection and Honest Mode. Refresh/validate TriWiki before risky decisions and consume attention.use_first/hydrate_first. Catastrophic safeguards remain active for every clone. Finish with a concise completion summary and Honest Mode covering verified clones, unverified work, and any blockers.\n`,
1046
- 'shadow-clone': `---\nname: shadow-clone\ndescription: $ShadowClone alias for the $Naruto Shadow Clone Swarm high-scale parallel agent route.\n---\n\nUse the same rules as the naruto skill: this is the English alias for $Naruto / Kage Bunshin no Jutsu. Fan out up to 100 lease-safe parallel clone sessions on the native agent kernel via \`sks naruto run "<task>" [--clones N] [--backend codex-exec|fake] [--work-items N] [--json]\`. Clones run in fast service tier, are throttled to host capacity, take path leases for non-overlapping writes, and each emit per-clone proof; the parent integrates and verifies. Keep the same agent ledgers and finish with reflection and Honest Mode.\n`,
1047
- 'kage-bunshin': `---\nname: kage-bunshin\ndescription: $Kagebunshin alias for the $Naruto Shadow Clone Swarm (影分身) high-scale parallel agent route.\n---\n\nUse the same rules as the naruto skill: this is the 影分身 / Kage Bunshin no Jutsu alias for $Naruto. Fan out up to 100 lease-safe parallel clone sessions on the native agent kernel via \`sks naruto run "<task>" [--clones N] [--backend codex-exec|fake] [--work-items N] [--json]\`. Clones run in fast service tier, are throttled to host capacity, take path leases for non-overlapping writes, and each emit per-clone proof; the parent integrates and verifies. Keep the same agent ledgers and finish with reflection and Honest Mode.\n`,
1048
- 'qa-loop': `---\nname: qa-loop\ndescription: $QA-LOOP dogfoods UI/API as human proxy with safety gates, Codex Chrome Extension-first web UI evidence, safe fixes, rechecks, and a QA report.\n---\n\nUse only $QA-LOOP. Infer scope, target, mutation policy, and login boundary from the prompt plus TriWiki/current-code defaults; do not surface a prequestion sheet. Credentials are runtime-only; never save secrets. Web/browser/webapp UI-level E2E must run the Codex Chrome Extension readiness gate first; if the extension is missing or disabled, rapidly halt and ask the user to set it up, then resume only after the user confirms installation is complete. Codex Computer Use is reserved for native Mac/non-web surfaces and must not satisfy web UI evidence. Playwright, Selenium, Puppeteer, Browser Use, Chrome MCP, screenshots fabricated from code, and prose-only checks do not satisfy web UI/browser verification. ${CODEX_WEB_VERIFICATION_POLICY} Deployed targets are read-only; destructive removal is forbidden. After answer/run, dogfood real flows, apply safe contract-allowed code/test/docs fixes, recheck, and do not pass qa-gate.json with unresolved findings or without post_fix_verification_complete. Finish qa-ledger, date/version report, gate, completion summary, and Honest Mode.\n`,
1049
- 'ppt': `---\nname: ppt\ndescription: $PPT information-first HTML/PDF presentation pipeline with inferred STP, audience, pain-point, format, research, design-system, and verification contract.\n---\n\nUse only when the user invokes $PPT or asks to create a presentation, deck, slides, pitch deck, proposal deck, HTML presentation, or PDF presentation artifact. Before artifact work, auto-seal presentation-specific answers from prompt, TriWiki/current-code defaults, and conservative policy: delivery context, target audience profile including role/average age/job/industry/topic familiarity/decision power, STP strategy, decision context and objections, and 3+ pain-point to solution mappings with expected aha moments. Do not surface a prequestion sheet. Presentation design must be simple, restrained, and information-first: avoid over-designed decoration, ornamental gradients, nested cards, and effects that compete with the message. Design detail should be embedded through typography hierarchy, spacing, alignment, thin rules, source clarity, and subtle accents. ${pptPipelineAllowlistPolicyText()} Use Product Design plugin first for context, ideation, prototype direction, audit, design QA, and share handoff. Use design.md only as an existing project-local cache or fallback SSOT when Product Design is unavailable; if fallback creation is needed, use docs/Design-Sys-Prompt.md plus getdesign-reference and curated DESIGN.md examples from ${AWESOME_DESIGN_MD_REFERENCE.url} only as source inputs, then fuse them into route-local PPT style tokens with a recorded design_ssot instead of treating references as parallel authorities. The $PPT route always loads imagegen as a required skill. When the sealed contract needs a generated raster asset or generated slide visual critique, immediately invoke Codex App \`$imagegen\` with gpt-image-2, move/copy the selected output into the mission assets or review evidence path, and record the real file path in ppt-image-asset-ledger.json or ppt-review-ledger.json before building or passing the gate. Direct API fallback, placeholder files, HTML/CSS stand-ins, and prose-only substitutes do not satisfy the route gate. ${productDesignPluginPolicyText()} ${CODEX_IMAGEGEN_REQUIRED_POLICY} Use web or Context7 evidence only when external facts/libraries/current docs are required by the PPT contract, record verified claims in ppt-fact-ledger.json, record generated image asset plans/results/blockers in ppt-image-asset-ledger.json, then create the PDF plus editable source HTML under source-html/, keep independent strategy/render/file-write phases parallel where inputs allow, record ppt-parallel-report.json, run the bounded ppt-review-policy/ppt-review-ledger/ppt-iteration-report loop, and verify readability, overlap, format fit, source coverage, export state, unsupported-claim status, image-asset completion, review-loop termination, and temporary build files cleanup. Finish with reflection and Honest Mode.\n`,
1050
- 'computer-use-fast': `---\nname: computer-use-fast\ndescription: Alias for the maximum-speed $Computer-Use/$CU native Codex Computer Use lane.\n---\n\nUse the same rules as computer-use: skip Team debate, QA-LOOP clarification, upfront TriWiki refresh, Context7, subagents, and reflection unless explicitly requested. Use Codex Computer Use directly only for native macOS, desktop-app, OS-settings, or non-web visual tasks. Browser, localhost, website, webapp, and web-based app verification must use the Codex Chrome Extension path first and must halt if that extension is not installed/enabled. At the end only, refresh/pack TriWiki, validate it, then provide a concise completion summary plus Honest Mode. ${CODEX_WEB_VERIFICATION_POLICY} ${CODEX_COMPUTER_USE_ONLY_POLICY}\n`,
1051
- 'cu': `---\nname: cu\ndescription: Short alias for the maximum-speed native $Computer-Use Codex Computer Use lane.\n---\n\nUse the same rules as computer-use. This is a speed lane for native macOS, desktop-app, OS-settings, and non-web visual tasks requiring Codex Computer Use evidence, with TriWiki refresh/validate and Honest Mode deferred to final closeout. Web/browser/webapp verification must use Codex Chrome Extension first and stop if the extension is not installed/enabled. ${CODEX_WEB_VERIFICATION_POLICY} ${CODEX_COMPUTER_USE_ONLY_POLICY}\n`,
1052
- 'goal': `---\nname: goal\ndescription: Fast $Goal/$goal bridge overlay for Codex native persisted /goal workflows.\n---\n\nUse when the user invokes $Goal/$goal or asks to persist a workflow with Codex native /goal continuation. Prepare with sks goal create or the $Goal route, write only the lightweight bridge artifacts, then use native Codex /goal create, pause, resume, and clear controls where available. Goal does not replace Team, QA, DB, or other SKS execution routes; continue implementation through the selected route and use Context7 only when external API/library docs are involved. Do not recreate the old no-question loop.\n`,
1053
- 'release-review': `---\nname: release-review\ndescription: Native release review route for $Release-Review multi-session agent release audits.\n---\n\nUse only when the user invokes $Release-Review or asks for release-readiness review with native multi-session agents. Prefer \`sks agent run \"release audit\" --route \"$Release-Review\" --agents <n> --concurrency <n> --mock --json\` for deterministic fixtures and remove \`--mock\` only when real backend evidence is intended. Manual scaling is explicit: \`--agents N\` controls total agents and \`--concurrency M\` controls simultaneous sessions; keep leases/no-overlap proof, agent-central-ledger.json, agent-task-board.json, agent-effort-policy.json, agent-proof-evidence.json, and agent-session-cleanup.json. Dynamic effort is assigned by the main session per slice; parent owns integration and final release claims. Removed legacy multi-agent commands do not satisfy release collaboration proof. Finish with release-readiness verification and Honest Mode.\n`,
1054
- 'commit': `---\nname: commit\ndescription: Simple git-only route for $Commit requests that stage current changes and create one commit without the full SKS pipeline.\n---\n\nUse only when the user invokes $Commit or explicitly asks to commit the current repository changes without pushing. Keep this route lightweight: inspect git status and the relevant diff summary, avoid Team/pipeline/TriWiki route work unless separately requested, stage the intended current changes, and create one git commit. The commit message must summarize the actual work and include exactly one trailer: Co-authored-by: Codex <noreply@openai.com>. Do not push. If there are no changes, report that no commit was created. Finish with a concise result and a one-line Honest Mode covering the commit hash and any unverified items.\n`,
1055
- 'commit-and-push': `---\nname: commit-and-push\ndescription: Simple git-only route for $Commit-And-Push requests that stage current changes, create one commit, and push without the full SKS pipeline.\n---\n\nUse only when the user invokes $Commit-And-Push or explicitly asks to commit and push the current repository changes. Keep this route lightweight: inspect git status and the relevant diff summary, avoid Team/pipeline/TriWiki route work unless separately requested, stage the intended current changes, create one git commit, then push the current branch. The commit message must summarize the actual work and include exactly one trailer: Co-authored-by: Codex <noreply@openai.com>. If there are no changes, do not create an empty commit unless the user explicitly asks for one. Finish with a concise result and a one-line Honest Mode covering the commit hash, pushed branch, and any unverified items.\n`,
1056
- 'research': `---\nname: research\ndescription: Dollar-command route for $Research or $research frontier discovery workflows.\n---\n\nUse when the user invokes $Research/$research or asks for research, hypotheses, new mechanisms, falsification, or testable predictions. Prefer sks research prepare and sks research run. Research is not an implementation route: do not edit repository source, docs, package metadata, generated skills, or harness files; write only route-local mission artifacts under .sneakoscope/missions/<mission-id>/. Run the genius-lens agent council with named persona-inspired cognitive roles: Einstein Agent, Feynman Agent, Turing Agent, von Neumann Agent, and Skeptic Agent. These are lenses only; do not impersonate the historical people. Every Research agent ledger row must include display_name, persona, persona_boundary, effort=xhigh, reasoning_effort=xhigh, service_tier when available, one literal "Eureka!" idea, falsifiers, cheap_probes, and challenge_or_response before synthesis. This is not a fixed three-cycle route: repeat source gathering, Eureka ideas, evidence-bound debate, falsification, and synthesis pressure until every agent records final agreement, or until the explicit max-cycle safety cap pauses with an unpassed gate. Create research-source-skill.md as a route-local Skill Creator artifact, then maximize layered public web/source search across latest papers, official/government or leading-institution data, standards/primary docs, current news, public discourse, developer/practitioner sources, traditional background sources, and counterevidence before synthesis. Record research-source-skill.md, source-ledger.json, agent-ledger.json, debate-ledger.json, novelty-ledger.json, falsification-ledger.json, research-report.md, research-paper.md, genius-opinion-summary.md, and research-gate.json. debate-ledger.json must include consensus_iterations, unanimous_consensus, and per-agent agreements; research-gate.json cannot pass until unanimous_consensus=true with every agent agreement recorded. Context7 is optional and only needed when the research topic depends on external package/API/framework docs; do not use it as the default research evidence layer. Normal Research may take one or two hours when needed; favor real source collection, cross-layer comparison, falsification, and a concise paper manuscript over speed. Do not use --mock except for selftests or dry harness checks; if live source execution is unavailable, record a blocker and keep the gate unpassed. Do not use for ordinary code edits.\n`,
1057
- 'autoresearch': `---\nname: autoresearch\ndescription: Dollar-command route for $AutoResearch or $autoresearch iterative experiment loops.\n---\n\nUse for $AutoResearch, iterative improvement, ranking, workflow, benchmark, or experiments. Define program, hypothesis, experiment, metric, keep/discard, falsification, next step, and Honest Mode. Do not become the parent identity for SEO/GEO; $SEO-GEO-OPTIMIZER may call research as a child stage for query, market, or competitor discovery while keeping the parent mission, gate, and Completion Proof on $SEO-GEO-OPTIMIZER.\n`,
1058
- 'db': `---\nname: db\ndescription: Dollar-command route for $DB or $db database and Supabase safety checks.\n---\n\nUse when the user invokes $DB/$db or the task touches SQL, Supabase, Postgres, migrations, Prisma, Drizzle, Knex, MCP database tools, or production data. Run or follow sks db policy, sks db scan, sks db classify, and sks db check. Destructive database operations remain forbidden.\n`,
1059
- 'mad-db': `${madDbSkillText()}\n`,
1060
- 'mad-sks': `---\nname: mad-sks\ndescription: Explicit high-risk authorization modifier for $MAD-SKS scoped permission widening across approved target-project surfaces.\n---\n\nUse only when the user explicitly invokes $MAD-SKS or top-level sks --mad. It can be combined with another route, such as $MAD-SKS $Team or $DB ... $MAD-SKS; in that case the other command remains the primary workflow and MAD-SKS is only the temporary permission grant. The widened permission applies only while the active mission gate is open, must be deactivated when the task ends, and can open approved scopes such as target-project file writes, shell commands, package installs, local service control, network operations, browser/Computer Use workflows, generated assets, file permissions, migrations, Supabase MCP database writes, column/schema cleanup, direct execute SQL, and normal targeted DB writes. Keep catastrophic safeguards active: whole database/schema/table removal, truncate, all-row delete/update, reset, dangerous project/branch management, credential exfiltration, persistent security weakening, destructive delete without explicit confirmation, and unrequested fallback implementation remain blocked. Do not carry MAD-SKS permission into later prompts or routes. The permission profile source is centralized in src/core/permission-gates.ts and emitted as dist/core/permission-gates.js so skill/hook/MCP-style gates share one decision function.\n`,
1061
- 'gx': `---\nname: gx\ndescription: Dollar-command route for $GX or $gx deterministic GX visual context cartridges.\n---\n\nUse when the user invokes $GX/$gx or asks for architecture/context visualization through SKS. Prefer sks gx init, render, validate, drift, and snapshot. vgraph.json remains the source of truth.\n`,
1062
- 'help': `---\nname: help\ndescription: Dollar-command route for $Help or $help explaining installed SKS commands and workflows.\n---\n\nUse when the user invokes $Help/$help or asks what commands exist. Prefer concise output from sks commands, sks usage <topic>, sks quickstart, sks aliases, and sks codex-app.\n`,
1063
- 'prompt-pipeline': `---\nname: prompt-pipeline\ndescription: Default SKS prompt optimization pipeline for execution prompts; Answer and DFix bypass it.\n---\n\nClassify intent: Answer only for real questions; question-shaped implicit instructions, complaints, and mandatory-policy statements route to Team. DFix handles Direct Fix work: tiny copy/config/docs/labels/spacing/translation/simple mechanical edits; code and broad implementation default to Team unless safety/research/GX route fits. Infer goal, target, constraints, acceptance, risk, and smallest safe route from prompt, TriWiki/current-code defaults, and conservative SKS policy. Do not surface a prequestion sheet. Materialize pipeline-plan.json for the runtime lane, kept/skipped stages, no-fallback invariant, lean_decision, and verification; inspect with sks pipeline plan, adding --proof-field when changed files are known. Code work surfaces route/guard/scopes, materializes team-roster.json from default or explicit counts before implementation, compiles concrete Team runtime graph/inbox artifacts after consensus, and parent owns integration/tests/Context7/Honest Mode. ${leanEngineeringCompactText()} ${outcomeRubricPolicyText()} ${speedLanePolicyText()} ${solutionScoutPolicyText('fix this broken behavior')} ${skillDreamPolicyText()}\n\n${chatCaptureIntakeText()}\n\nDesign: non-PPT UI/UX uses Product Design plugin first; legacy design.md/design-system-builder/design-ui-editor/design-artifact-expert/getdesign-reference are fallback only when the plugin is unavailable or an existing project design.md must be respected. Use imagegen for image/logo/raster, and imagegen must prefer Codex App built-in image generation (${CODEX_APP_IMAGE_GENERATION_DOC_URL}) before API generation. ${productDesignPluginPolicyText()} ${CODEX_IMAGEGEN_REQUIRED_POLICY} For UI/UX review/audit requests that mention image generation, gpt-image-2, callouts, or annotated review images, route to $Image-UX-Review/$UX-Review and require generated annotated review image evidence before issue extraction; do not satisfy that route with text-only critique. For $PPT, ${pptPipelineAllowlistPolicyText()} ${getdesignReferencePolicyText()} TriWiki context-tracking SSOT: .sneakoscope/wiki/context-pack.json; read only the latest coordinate+voxel overlay pack before every route stage, run sks wiki refresh/pack after changes, validate before handoffs/final.\n`,
1064
- [SOLUTION_SCOUT_SKILL_NAME]: `---\nname: ${SOLUTION_SCOUT_SKILL_NAME}\ndescription: Web-similarity scout hook for SKS problem-solving and repair requests.\n---\n\n${solutionScoutPolicyText('fix this broken behavior')}\n\nUse this as a pipeline hook, not as a standalone route: when a user asks to solve, fix, repair, troubleshoot, or investigate broken behavior, search first for similar resolution cases, summarize the useful patterns with sources, then combine them with current repo evidence before editing. If browsing is unavailable, mark the external scout unverified and continue with local evidence only.\n`,
1065
- 'reasoning-router': `---\nname: reasoning-router\ndescription: Temporary SKS reasoning-effort routing for every command and pipeline route.\n---\n\nmedium: simple copy/color/discovery/setup/mechanical edits. high: logic, safety, architecture, DB, orchestration, refactor, multi-file work. xhigh: research, AutoResearch, falsification, benchmarks, SEO/GEO, open-ended discovery, and From-Chat-IMG image work-order analysis. Routing is temporary; return to default after the gate. Inspect with sks reasoning and sks pipeline status.\n`,
1066
- 'pipeline-runner': `---\nname: pipeline-runner\ndescription: Execute SKS dollar-command routes as stateful pipelines with mission artifacts, route gates, Context7 evidence, temporary reasoning routing, reflection, and Honest Mode.\n---\n\nEvery $ command is a route. Use current.json, mission artifacts, and pipeline-plan.json as the execution plan: it records the lane, skipped stages, kept stages, verification, lean_decision, and no-unrequested-fallback invariant. Use temporary reasoning, TriWiki before stages, source hydration, Context7 when required, Team cleanup before reflection, reflection for full routes, and completion summary plus Honest Mode before final. Surface guard/scopes, record evidence, refresh/pack/validate TriWiki, and check sks pipeline status/resume/plan. ${leanEngineeringCompactText()} ${speedLanePolicyText()} ${skillDreamPolicyText()}\n`,
1067
- 'context7-docs': `---\nname: context7-docs\ndescription: Enforce Context7 MCP documentation evidence for SKS routes that depend on external libraries, frameworks, APIs, MCPs, package managers, DB SDKs, or generated docs.\n---\n\nWhen required, resolve-library-id, then query-docs for the resolved id. Legacy get-library-docs evidence is accepted. Prefer sks context7 tools/resolve/docs/evidence and finish only after both evidence stages exist. Check setup with sks context7 check.\n`,
1068
- 'insane-search': `---\nname: insane-search\ndescription: Dollar-command route for $Insane-Search/$InsaneSearch provider-independent source intelligence.\n---\n\nUse when the user invokes $Insane-Search, $InsaneSearch, legacy $Ultra-Search/$UltraSearch, or asks for InsaneSearch source intelligence, source acquisition, X-search-style collection, URL acquisition, source normalization, claim ledgers, or citation proof. Prefer \`sks insane-search doctor --json\` for readiness and \`sks insane-search run "<query>" --mode balanced --json\` for provider-independent source proof; use \`sks insane-search x "<query>" --json\` for X-search intent and \`sks insane-search fetch "<url>" --json\` for URL acquisition. Context7 is required only when the query depends on current package/API/framework/MCP/generated documentation behavior. xAI/Grok credentials are optional and must not be required for route readiness. Evidence/artifacts remain under \`.sneakoscope/missions/<ultra-* or route mission>/ultra-search/\`: intent.json, axes.json, query-variants.json, provider-plan.json, source-ledger.json, lead-ledger.json, claim-ledger.json, synthesis.md, ultra-search-proof.json, ultra-search-gate.json, and ultra-search-result.json. Do not turn weak discovery into supported claims; finish with an Honest Mode summary of verified sources, blockers, and unverified external coverage.\n`,
1069
- 'ultra-search': `---\nname: ultra-search\ndescription: Compatibility alias for $Insane-Search/$InsaneSearch provider-independent source intelligence.\n---\n\nUse when the user invokes legacy $Ultra-Search/$UltraSearch or asks for InsaneSearch source intelligence, source acquisition, X-search-style collection, URL acquisition, source normalization, claim ledgers, or citation proof. Prefer \`sks ultra-search doctor --json\` for readiness and \`sks ultra-search run "<query>" --mode balanced --json\` for provider-independent source proof; use \`sks ultra-search x "<query>" --json\` for X-search intent and \`sks ultra-search fetch "<url>" --json\` for URL acquisition. Context7 is required only when the query depends on current package/API/framework/MCP/generated documentation behavior. xAI/Grok credentials are optional and must not be required for route readiness. Evidence/artifacts live under \`.sneakoscope/missions/<ultra-* or route mission>/ultra-search/\`: intent.json, axes.json, query-variants.json, provider-plan.json, source-ledger.json, lead-ledger.json, claim-ledger.json, synthesis.md, ultra-search-proof.json, ultra-search-gate.json, and ultra-search-result.json. Do not turn weak discovery into supported claims; finish with an Honest Mode summary of verified sources, blockers, and unverified external coverage.\n`,
1070
- 'search-visibility-core': `---\nname: search-visibility-core\ndescription: Shared kernel for seo-geo-optimizer audit, plan, explicit apply, rollback, verification, gates, and Completion Proof.\n---\n\nPurpose: keep Search Engine Optimization and Generative Engine Optimization on one typed search-visibility kernel instead of duplicate implementations. Use when $SEO-GEO-OPTIMIZER or \`sks seo-geo-optimizer\` is selected. Workflow: doctor detects package/static/Next evidence; audit writes source-backed inventory and findings; plan compiles safe mutation operations; apply requires explicit \`--apply\`; verify separates source, build, HTTP, browser, production, and measured outcome; rollback only reverses mission-owned operations. Safety: default read-only, never overwrite unmanaged robots.txt, sitemap, llms.txt, metadata, or structured data; do not hard-code customer routes; do not invent prices, reviews, availability, rankings, traffic, or AI citation outcomes. Evidence/artifacts: search-visibility/intake.json, adapter-detection.json, site-inventory.json, route-graph.json, robots-policy.json, structured-data-ledger.json, mutation-plan.json, mutation-journal.jsonl, rollback-manifest.json, verification-report.json, route gate, and completion-proof.json. Failure/recovery: unsupported frameworks stay audit/plan-only; missing production/browser/Search Console evidence remains unverified, not fabricated. CLI entrypoint: \`sks seo-geo-optimizer ... --mode seo|geo\`.\n`,
1071
- 'seo-geo-optimizer': `---\nname: seo-geo-optimizer\ndescription: Unified $SEO-GEO-OPTIMIZER route for Search Engine Optimization and Generative Engine Optimization.\n---\n\nPurpose: use one route name for SEO and GEO work while keeping the internal search-visibility mode explicit. Use when: the user asks for SEO audit/fix/verification, package/npm/GitHub search visibility, canonical, sitemap, robots.txt, hreflang, metadata, structured data, AI answer visibility, LLM citation readiness, answerability, entity/claim provenance, crawler policy, OAI-SearchBot/GPTBot/ChatGPT-User, Claude-SearchBot/ClaudeBot/Claude-User, or optional llms.txt planning. GEO means Generative Engine Optimization, not geolocation, GeoIP, maps, CDN geography, location permission, or regional redirect bugs. Workflow: run \`sks seo-geo-optimizer doctor --mode seo|geo\`, then audit, plan, explicit apply, verify, status, and rollback. Use \`--mode seo\` for technical/package search optimization and \`--mode geo\` for entity facts, claim evidence, answerability, crawler policy, and optional llms.txt. Safety: audit and plan must not mutate source; apply checks base hashes, ownership, scope, protected paths, rollback manifest, and post-verify. AI crawler policy must split search, training, user-directed retrieval, and ads/other; never use one allow_ai toggle and never auto-allow training crawlers. Evidence/artifacts: site-inventory.json, route-graph.json, seo-findings.json or geo-findings.json, entity-facts.json, claim-evidence-ledger.json, answerability-report.json, ai-crawler-policy.json, llms-txt-plan.json, mutation-plan.json, verification-report.json, seo-gate.json or geo-gate.json, completion-proof.json. Failure/recovery: unsupported frameworks stay plan-only; browser/production/Search Console/analytics outcomes are marked unverified when not actually run. Forbidden claims: no ranking, indexing, traffic lift, rich-result, answer inclusion, or AI citation guarantee; no keyword stuffing, doorway pages, fake reviews, fake prices, fake availability, fake shipping, fake awards, hidden AI-only text, or scaled spam. CLI entrypoint: \`sks seo-geo-optimizer doctor|audit|plan|apply|verify|status|rollback|fixture --mode seo|geo\`.\n`,
1072
- 'reflection': `---\nname: reflection\ndescription: Post-route self-review for full SKS routes that records real misses, gaps, and corrective lessons into TriWiki memory.\n---\n\nUse after full route work/tests and before final. DFix, Answer, Help, Wiki, SKS discovery are exempt. Do not invent faults. Write reflection.md; append real lessons to ${REFLECTION_MEMORY_PATH}; refresh/pack, validate context-pack.json, pass reflection-gate.json.\n\n${reflectionInstructionText()}\n`,
1073
- 'honest-mode': `---\nname: honest-mode\ndescription: Required final SKS verification pass before claiming a task is complete.\n---\n\nBefore final: include a completion summary explaining what was done, what changed for the user/repo, what was verified, and what remains unverified or blocked. Then restate the goal, compare result to evidence, list tests/commands/inspections, state uncertainty or blockers plainly, and do not claim completion beyond evidence. Full routes must pass reflection-gate.json first. Include concise SKS Honest Mode or 솔직모드 when required.\n`,
1074
- 'autoresearch-loop': `---\nname: autoresearch-loop\ndescription: Iterative AutoResearch-style loop for open-ended improvement, discovery, prompt, ranking, SEO/GEO, and workflow-quality tasks.\n---\n\nUse for research, ranking, prompt/workflow improvement, benchmark gains, or repeated refinement. Loop: program, hypothesis, smallest falsifying experiment, metric, keep/discard, falsify, next step. Keep a ledger and do not claim improvement without evidence.\n`,
1075
- 'hproof-claim-ledger': `---\nname: hproof-claim-ledger\ndescription: Extract atomic claims and classify support status.\n---\n\nEvery factual statement must become an atomic claim. Unsupported critical claims cannot be used for implementation or final answer. Database claims require DB safety evidence.\n`,
1076
- 'hproof-evidence-bind': `---\nname: hproof-evidence-bind\ndescription: Bind claims to code, tests, decision contract, vgraph, beta, wiki, or GX render evidence.\n---\n\nEvidence priority: current code/tests, decision-contract.json, vgraph.json, beta.json, GX snapshot/render metadata, LLM Wiki coordinate index, user prompt. Database claims must respect .sneakoscope/db-safety.json. Wiki claims should carry id, hash, source path, and RGBA/trig coordinate anchors so they can be hydrated instead of treated as unsupported summaries.\n`,
1077
- 'db-safety-guard': `${dbSafetyGuardSkillText()}\n`,
1078
- 'gx-visual-generate': `---\nname: gx-visual-generate\ndescription: Render a deterministic SVG/HTML visual sheet from vgraph.json and beta.json.\n---\n\nUse sks gx render. vgraph.json is source of truth; renders embed source hash and RGBA wiki anchors.\n`,
1079
- 'gx-visual-read': `---\nname: gx-visual-read\ndescription: Read a Sneakoscope Codex deterministic visual sheet and produce context notes.\n---\n\nExtract nodes, edges, invariants, tests, risks, uncertainties, and RGBA anchors from source/render/snapshot. Do not infer hidden nodes.\n`,
1080
- 'gx-visual-validate': `---\nname: gx-visual-validate\ndescription: Validate render metadata against vgraph.json and beta.json.\n---\n\nRun sks gx validate and drift; fail stale or incomplete hashes, nodes, edges, invariants, or anchors.\n`,
1081
- 'turbo-context-pack': `---\nname: turbo-context-pack\ndescription: Build ultra-low-token context packet with Q4 bits, Q3 tags, top-K claims, and minimal evidence.\n---\n\nDefault to Q4/Q3 plus TriWiki RGBA anchors and attention.use_first. Add Q2/Q1 only when needed or when attention.hydrate_first says source hydration is required. Keep id, hash, path, and coordinate tuple for hydration.\n`,
1082
- 'research-discovery': `---\nname: research-discovery\ndescription: Run SKS Research Mode for frontier-style research, hypotheses, novelty ledgers, falsification, and experiments.\n---\n\nFrame criteria, map assumptions, run maximum available web/source search, generate xhigh agent intake findings through Einstein Agent, Feynman Agent, Turing Agent, von Neumann Agent, and Skeptic Agent persona-inspired lenses, require each agent to record display_name/persona/persona_boundary plus a literal "Eureka!" idea, run evidence-bound debate, falsify, keep surviving insights, and record source ids, novelty/confidence/falsifiers/next experiments. Do not impersonate historical people and do not overclaim.\n`,
1083
- 'performance-evaluator': `---\nname: performance-evaluator\ndescription: Evaluate SKS performance, token-saving, accuracy-proxy, context-compression, or workflow improvements.\n---\n\nUse sks eval run/compare before claims. Report token_savings_pct, accuracy_delta/proxy, required_recall, support, and meaningful_improvement.\n`,
1084
- 'image-ux-review': imageUxReviewSkill('image-ux-review'),
1085
- 'ux-review': imageUxReviewSkill('ux-review'),
1086
- 'visual-review': imageUxReviewSkill('visual-review'),
1087
- 'ui-ux-review': imageUxReviewSkill('ui-ux-review'),
1088
- 'imagegen': `---\nname: imagegen\ndescription: Required bridge to Codex App built-in image generation for logos, image assets, raster visuals, and image edits.\n---\n\nUse for generated or edited image assets: logo, product image, illustration, sprite, mockup, texture, cutout, or bitmap. Prefer the official Codex App built-in image generation feature documented at ${CODEX_APP_IMAGE_GENERATION_DOC_URL}: ask naturally or invoke \`$imagegen\`. For newest-model requests, make the prompt explicit: "Use ChatGPT Images 2.0 / GPT Image 2.0 with gpt-image-2." Useful official references are ${OPENAI_CHATGPT_IMAGES_2_DOC_URL}, ${OPENAI_GPT_IMAGE_2_MODEL_DOC_URL}, and ${OPENAI_IMAGE_GENERATION_DOC_URL}. Codex App image generation counts against Codex usage limits. Capability detection is not output proof; full SKS evidence requires a real selected raster output path or generated review image artifact. Direct OpenAI API fallback is non-Codex evidence and does not satisfy SKS route evidence unless a separate non-Codex API task is explicitly requested. ${IMAGEGEN_SOCIAL_SOURCE_POLICY} ${CODEX_IMAGEGEN_REQUIRED_POLICY} Do not substitute placeholder SVG/HTML/CSS for requested raster assets; follow design.md when relevant.\n`,
1089
- 'imagegen-source-scout': `---\nname: imagegen-source-scout\ndescription: Source scout for current GPT Image 2.0/gpt-image-2 prompt guidance, official docs, and X/social workflow signals.\n---\n\nUse when the user asks for the latest imagegen docs, ChatGPT Images 2.0 / GPT Image 2.0 / gpt-image-2 behavior, X/social reactions, prompt examples, or community workflow hints before creating an image prompt or SKS imagegen policy. Source order: official OpenAI announcement (${OPENAI_CHATGPT_IMAGES_2_DOC_URL}), Codex App image generation docs (${CODEX_APP_IMAGE_GENERATION_DOC_URL}), gpt-image-2 model docs (${OPENAI_GPT_IMAGE_2_MODEL_DOC_URL}), OpenAI Image Generation API docs (${OPENAI_IMAGE_GENERATION_DOC_URL}), then public X/social/community search for prompt-quality heuristics only. ${IMAGEGEN_SOCIAL_SOURCE_POLICY} If X/Grok or web search is unavailable, record that social coverage is unverified and continue from official docs. Output a compact evidence split: official capability/evidence rules, prompt heuristics, social/workflow signals, and blockers. Do not generate images itself; pair this with the imagegen skill for actual raster output.\n`,
1090
- 'getdesign-reference': `---\nname: getdesign-reference\ndescription: Use getdesign.md official design reference as an input to the design.md SSOT for UI/UX, presentation, and HTML/PDF systems.\n---\n\nUse when creating or improving design.md, UI/UX design systems, deck-like HTML artifacts, presentation PDFs, or brand-inspired visual systems. design.md is the only design decision SSOT; reference ${GETDESIGN_REFERENCE.url}, ${GETDESIGN_REFERENCE.docs_url}, and ${AWESOME_DESIGN_MD_REFERENCE.url} only as source inputs to synthesize or update that SSOT or a route-local style-token artifact. Prefer the official Codex skill if available with \`${GETDESIGN_REFERENCE.codex_skill_install}\`. If the skill CLI is unavailable, use this generated skill plus official docs/API/CLI/SDK references and curated DESIGN.md examples as inputs. Do not claim getdesign MCP is configured unless a current official MCP surface is actually installed.\n`,
1091
- 'design-system-builder': `---\nname: design-system-builder\ndescription: Legacy fallback to create design.md from docs/Design-Sys-Prompt.md only when Product Design plugin is unavailable or explicit local SSOT is required.\n---\n\nUse Product Design plugin first. Only when the plugin is unavailable or the route explicitly needs a local fallback SSOT, read docs/Design-Sys-Prompt.md as the builder prompt, inspect product/UI context, and use getdesign-reference, official getdesign.md docs, and curated DESIGN.md examples from ${AWESOME_DESIGN_MD_REFERENCE.url} only as source inputs. Fuse those inputs into one design.md fallback/cache with tokens, components, states, imagery, accessibility, and verification rules; do not leave multiple design files or references as competing authorities. Use the plan tool only for real ambiguity plus default font recommendation. Use imagegen for assets. ${productDesignPluginPolicyText()} ${CODEX_IMAGEGEN_REQUIRED_POLICY}\n`,
1092
- 'design-ui-editor': `---\nname: design-ui-editor\ndescription: Legacy fallback UI/UX editor for existing design.md systems when Product Design plugin is unavailable.\n---\n\nUse Product Design plugin first. When falling back, read \`design.md\`, inspect relevant UI/assets/tests, consult getdesign-reference when improving the design system, apply the smallest design-system-conformant change, use imagegen for image/logo/raster assets, and verify render quality. ${productDesignPluginPolicyText()} ${CODEX_IMAGEGEN_REQUIRED_POLICY} If design.md is missing and Product Design is unavailable, use design-system-builder as fallback.\n`,
1093
- 'design-artifact-expert': `---\nname: design-artifact-expert\ndescription: Legacy fallback for high-fidelity HTML/UI/prototype artifacts when Product Design plugin cannot be used.\n---\n\nUse Product Design plugin first for design/UI/prototype work. When falling back, read design.md when present, consult getdesign-reference for design-system grounding, build the usable artifact first, preserve state, verify overlap/readability/responsiveness, and use imagegen for required assets. ${productDesignPluginPolicyText()} ${CODEX_IMAGEGEN_REQUIRED_POLICY}\n`
1094
- };
1095
- const nonCoreSkillNames = Object.keys(skills).filter((name) => !isCoreSkillName(name));
1096
- for (const [name, content] of Object.entries(skills)) {
1097
- if (isCoreSkillName(name))
1098
- continue;
1099
- const dir = path.join(root, '.agents', 'skills', name);
1100
- const skillContent = enrichSkillContent(name, content);
1101
- await ensureDir(dir);
1102
- await writeTextAtomic(path.join(dir, 'SKILL.md'), `${skillContent.trim()}\n`);
1103
- await writeSkillMetadata(dir, name);
1104
- }
1105
- const coreManifest = buildSksCoreSkillManifest();
1106
- const coreByName = new Map(coreManifest.skills.map((skill) => [skill.canonical_name, skill.content_sha256]));
1107
- const coreIntegrity = await syncCoreSkillsIntegrity({
1108
- root,
1109
- apply: true,
1110
- skillsRoot: path.join(root, '.agents', 'skills'),
1111
- reportPath: path.join(root, '.sneakoscope', 'reports', 'core-skill-integrity.json')
1112
- });
1113
- const managedCoreSkillNames = coreIntegrity.rows
1114
- .filter((row) => row.after_sha256 === coreByName.get(row.canonical_name) && row.action !== 'skip-user-authored')
1115
- .map((row) => row.canonical_name);
1116
- for (const name of managedCoreSkillNames) {
1117
- await writeSkillMetadata(path.join(root, '.agents', 'skills', name), name);
1118
- }
1119
- const skillNames = [...nonCoreSkillNames, ...managedCoreSkillNames];
1120
- const removedStaleGeneratedSkills = await removeStaleGeneratedSkillsFromManifest(root, skillNames);
1121
- const removedPluginSkillCollisions = await removeGeneratedPluginSkillCollisions(root);
1122
- await writeGeneratedSkillManifest(root, skillNames);
1123
- return {
1124
- installed_skills: skillNames,
1125
- generated_files: generatedSkillFiles(skillNames),
1126
- core_skill_integrity: {
1127
- ok: coreIntegrity.ok,
1128
- template_version: coreIntegrity.template_version,
1129
- installed_count: coreIntegrity.installed_count,
1130
- restored_count: coreIntegrity.restored_count,
1131
- user_collision_count: coreIntegrity.user_collision_count,
1132
- report: '.sneakoscope/reports/core-skill-integrity.json'
1133
- },
1134
- removed_stale_generated_skills: [...removedStaleGeneratedSkills, ...removedPluginSkillCollisions].sort(),
1135
- removed_agent_skill_aliases: await removeGeneratedAgentSkillAliases(root, skillNames),
1136
- removed_codex_skill_mirrors: await removeGeneratedCodexSkillMirrors(root, skillNames)
1137
- };
1138
- }
1139
- function generatedSkillFiles(skillNames) {
1140
- return skillNames.flatMap((name) => [
1141
- `.agents/skills/${name}/SKILL.md`,
1142
- `.agents/skills/${name}/agents/openai.yaml`
1143
- ]).sort();
1144
- }
1145
- function generatedSkillManifestPath(root) {
1146
- return path.join(root, '.agents', 'skills', SKS_SKILL_MANIFEST_FILE);
1147
- }
1148
- async function writeGeneratedSkillManifest(root, skillNames) {
1149
- const manifestPath = generatedSkillManifestPath(root);
1150
- await writeJsonAtomic(manifestPath, {
1151
- schema_version: 1,
1152
- generated_by: 'sneakoscope',
1153
- version: PACKAGE_VERSION,
1154
- prune_policy: GENERATED_PRUNE_POLICY,
1155
- skills: [...skillNames].sort(),
1156
- files: generatedSkillFiles(skillNames)
1157
- });
1158
- }
1159
- async function removeStaleGeneratedSkillsFromManifest(root, skillNames) {
1160
- const previous = await readJson(generatedSkillManifestPath(root), null);
1161
- const previousSkills = Array.isArray(previous?.skills) ? previous.skills : [];
1162
- if (!previousSkills.length)
1163
- return [];
1164
- const current = new Set(skillNames);
1165
- const removed = [];
1166
- for (const name of previousSkills) {
1167
- const skillName = String(name || '').trim();
1168
- if (!skillName || current.has(skillName) || !/^[a-z0-9-]+$/.test(skillName))
1169
- continue;
1170
- if (isCoreSkillName(skillName))
1171
- continue;
1172
- const dir = path.join(root, '.agents', 'skills', skillName);
1173
- if (!(await exists(dir)))
1174
- continue;
1175
- await fsp.rm(dir, { recursive: true, force: true });
1176
- removed.push(path.relative(root, dir));
1177
- }
1178
- return removed.sort();
1179
- }
1180
- async function removeGeneratedPluginSkillCollisions(root) {
1181
- const removed = [];
1182
- for (const name of RESERVED_CODEX_PLUGIN_SKILL_NAMES) {
1183
- const dir = path.join(root, '.agents', 'skills', name);
1184
- const skillPath = path.join(dir, 'SKILL.md');
1185
- const text = await readText(skillPath, null);
1186
- if (!isGeneratedSksPluginCollisionSkill(text, name))
1187
- continue;
1188
- await fsp.rm(dir, { recursive: true, force: true });
1189
- removed.push(path.relative(root, dir));
1190
- }
1191
- return removed.sort();
1192
- }
1193
- function isGeneratedSksPluginCollisionSkill(text, name) {
1194
- if (typeof text !== 'string')
1195
- return false;
1196
- const s = String(text);
1197
- if (!new RegExp(`^name:\\s*${escapeRegExp(name)}\\s*$`, 'm').test(s))
1198
- return false;
1199
- if (/\bnot generated by SKS\b/i.test(s))
1200
- return false;
1201
- return /Maximum-speed \$Computer-Use\/\$CU lane|Codex App pipeline activation:|Sneakoscope generated|Dollar-command route generated by SKS/i.test(s);
1202
- }
1203
- function enrichSkillContent(name, content) {
1204
- if (!['sks', 'answer', 'wiki', 'team', 'qa-loop', 'ppt', 'image-ux-review', 'ux-review', 'visual-review', 'ui-ux-review', 'computer-use-fast', 'cu', 'goal', 'research', 'autoresearch', 'db', 'gx', 'reflection', 'prompt-pipeline', 'pipeline-runner', 'context7-docs', 'turbo-context-pack', 'hproof-evidence-bind'].includes(name))
1205
- return content;
1206
- const text = String(content || '').trimEnd();
1207
- const activation = pipelineActivationText(name);
1208
- if (text.includes('TriWiki context-tracking SSOT')) {
1209
- return activation && !text.includes('Codex App pipeline activation:') ? `${text}\n\n${activation}` : text;
1210
- }
1211
- return `${text}${activation ? `\n\n${activation}` : ''}
1212
-
1213
- Context tracking:
1214
- - Ask only ambiguity that can change scope, safety, behavior, or acceptance; infer the rest from TriWiki/current code and seal answers before execution.
1215
- - TriWiki SSOT: .sneakoscope/wiki/context-pack.json. Use only the latest coordinate+voxel overlay pack; coordinate-only legacy packs are invalid and must be refreshed before use. Use attention.use_first for compact high-trust recall and hydrate attention.hydrate_first from source before risky/lower-trust decisions. Refresh/pack after findings or artifact changes; validate before handoffs/final claims.
1216
- - ${stackCurrentDocsPolicyText()}
1217
- - Keep non-selected claims hydratable by id, hash, source path, and RGBA/trig coordinate. Hydrate low-trust claims before relying on them.
1218
- - Hook output is limited; use mission files, team events, or normal updates for live detail.
1219
- `;
1220
- }
1221
- function pipelineActivationText(name) {
1222
- const stateful = new Set(['sks', 'team', 'qa-loop', 'ppt', 'image-ux-review', 'ux-review', 'visual-review', 'ui-ux-review', 'computer-use-fast', 'cu', 'goal', 'research', 'autoresearch', 'db', 'gx', 'prompt-pipeline', 'pipeline-runner']);
1223
- if (!stateful.has(name))
1224
- return '';
1225
- return `Codex App pipeline activation:
1226
- - If the SKS UserPromptSubmit hook already injected route context, follow that context.
1227
- - If no SKS hook context is visible in the current turn, immediately run \`sks hook user-prompt-submit\` from the target repo root with JSON input containing the current prompt, for example: \`printf '%s' '{"prompt":"<user prompt>","cwd":"<repo root>"}' | sks hook user-prompt-submit\`.
1228
- - Use the returned \`hookSpecificOutput.additionalContext\` as authoritative route context before answering or editing. If it creates a mission, continue through \`sks pipeline status\`, \`sks pipeline plan\`, and \`sks pipeline answer\` as directed.
1229
- - Do not treat this skill text alone as completion of the SKS route; a stateful SKS route must materialize mission/pipeline artifacts or explicitly report why the hook could not run.`;
1230
- }
1231
- async function writeSkillMetadata(dir, name) {
1232
- const effort = ['computer-use-fast', 'cu'].includes(name)
1233
- ? 'low'
1234
- : ['research', 'autoresearch', 'research-discovery', 'autoresearch-loop', 'from-chat-img'].includes(name)
1235
- ? 'xhigh'
1236
- : (['dfix', 'sks', 'help'].includes(name) ? 'medium' : 'high');
1237
- await ensureDir(path.join(dir, 'agents'));
1238
- await writeTextAtomic(path.join(dir, 'agents', 'openai.yaml'), `name: ${name}\nmodel_reasoning_effort: ${effort}\nrouting: temporary\nreturn_to_default_after_route: true\n`);
1239
- }
1240
- async function removeGeneratedCodexSkillMirrors(root, skillNames) {
1241
- const legacyRoot = path.join(root, '.codex', 'skills');
1242
- if (!(await exists(legacyRoot)))
1243
- return [];
1244
- const removed = [];
1245
- const names = Array.from(new Set([...skillNames, ...DOLLAR_COMMANDS.map((c) => c.command.slice(1)), 'ralph', 'Ralph', 'ralph-supervisor', 'ralph-resolver']));
1246
- for (const name of names) {
1247
- const dir = path.join(legacyRoot, name);
1248
- const skillPath = path.join(dir, 'SKILL.md');
1249
- const text = await readText(skillPath, null);
1250
- if (!isGeneratedSksLegacySkill(text, name))
1251
- continue;
1252
- await fsp.rm(dir, { recursive: true, force: true });
1253
- removed.push(path.relative(root, dir));
1254
- }
1255
- await removeDirIfEmpty(legacyRoot);
1256
- await removeDirIfEmpty(path.join(root, '.agents'));
1257
- return removed;
1258
- }
1259
- async function removeGeneratedAgentSkillAliases(root, skillNames) {
1260
- const current = new Set(skillNames);
1261
- const obsolete = ['agent-team', 'qaloop', 'wiki-refresh', 'wikirefresh', 'ralph', 'ralph-supervisor', 'ralph-resolver'];
1262
- const removed = [];
1263
- for (const name of obsolete) {
1264
- if (current.has(name))
1265
- continue;
1266
- const dir = path.join(root, '.agents', 'skills', name);
1267
- const skillPath = path.join(dir, 'SKILL.md');
1268
- const text = await readText(skillPath, null);
1269
- if (!isGeneratedSksAgentSkill(text, name))
1270
- continue;
1271
- await fsp.rm(dir, { recursive: true, force: true });
1272
- removed.push(path.relative(root, dir));
1273
- }
1274
- return removed;
1275
- }
1276
- function isGeneratedSksAgentSkill(text, name) {
1277
- if (!text)
1278
- return false;
1279
- const s = String(text);
1280
- if (!new RegExp(`name:\\s*${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`).test(s))
1281
- return false;
1282
- if (/\bnot generated by SKS\b/i.test(s))
1283
- return false;
1284
- return /Sneakoscope generated|Fallback Codex App picker alias|Codex App picker alias for|Dollar-command route generated by SKS/i.test(s);
1285
- }
1286
- function isGeneratedSksLegacySkill(text, name) {
1287
- if (typeof text !== 'string')
1288
- return false;
1289
- return text.startsWith('---') && new RegExp(`^name:\\s*${escapeRegExp(name)}\\s*$`, 'm').test(text);
1290
- }
1291
1033
  function escapeRegExp(value) {
1292
1034
  return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1293
1035
  }
1294
- async function removeDirIfEmpty(dir) {
1295
- try {
1296
- const entries = await fsp.readdir(dir);
1297
- if (!entries.length)
1298
- await fsp.rmdir(dir);
1299
- }
1300
- catch { }
1301
- }
1302
- async function installCodexAgents(root) {
1303
- const agents = {
1304
- 'analysis-scout.toml': `name = "analysis_scout"\ndescription = "SKS analysis scout with bounded write capability retained for stale Codex agent-role config repair."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "low"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are an SKS analysis scout.\nOnly edit bounded files assigned by the parent orchestrator; otherwise inspect only and return concise source-backed findings.\n"""\n`,
1305
- 'native-agent-intake.toml': `name = "native_agent"\ndescription = "Team native agent with bounded write capability. Maps one independent repo/docs/tests/API/risk/user-friction slice and can produce patch-envelope work when assigned."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "low"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are an SKS Team native agent.\nOnly edit bounded files assigned by the parent orchestrator.\nOwn exactly one investigation or implementation slice assigned by the parent orchestrator.\nUse the mission roster or worker inbox model and model_reasoning_effort when the host exposes it: simple bounded work may use gpt-5.4-mini, ordinary tool work uses gpt-5.5 low, and knowledge/research/safety/release work uses gpt-5.5 high.\nMap relevant source files, docs, tests, APIs, DB or safety risks, UX friction, and likely implementation boundaries.\nReturn concise source-backed claims suitable for team-analysis.md and TriWiki ingestion: claim, source path, evidence hash or quoted anchor, risk, confidence, and recommended implementation slice.\nDo not debate the final plan. Implement only when the assigned slice includes write paths.\nAlso return a concise LIVE_EVENT line that the parent can record with sks team event.\n"""\n`,
1306
- 'team-consensus.toml': `name = "team_consensus"\ndescription = "Planning and debate specialist for SKS Team mode with bounded write capability. Maps options, constraints, role-persona risks, and proposes the agreed objective before implementation starts."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "high"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are the SKS Team consensus specialist.\nOnly edit bounded files assigned by the parent orchestrator.\nUse the mission roster model and model_reasoning_effort when the host exposes them; planning normally uses gpt-5.5 low or high depending on risk.\nMap the affected code paths, viable approaches, constraints, risks, and acceptance criteria.\nRun the debate as role-persona synthesis: final users are low-context, self-interested, stubborn, and inconvenience-averse; executors are capable developers; reviewers are strict.\nArgue for the smallest coherent objective that can be handed to a fresh executor_N development team.\nPlan for at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA validation lanes before integration or final.\nReturn: recommended objective, rejected alternatives, implementation slices, required reviewers, user-friction risks, and unresolved risks.\nAlso return a concise LIVE_EVENT line that the parent can record with sks team event.\n"""\n`,
1307
- 'implementation-worker.toml': `name = "implementation_worker"\ndescription = "Implementation specialist for SKS Team mode. Owns one bounded write set and coordinates with other executor_N workers."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "medium"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are an SKS Team executor/developer in the fresh development bundle.\nYou are not alone in the codebase. Other executor_N workers may be editing disjoint files.\nUse the mission roster or worker inbox reasoning_effort when the host exposes it; simple bounded changes can use low, tool-heavy implementation medium, and safety/release/DB work high.\nOnly edit the files or module slice assigned to you.\nDo not revert or overwrite edits made by others.\nRead local patterns first, make the smallest correct change, avoid adding user friction, run focused verification for your slice, and report changed paths plus evidence.\nDo not create fallback implementation code, substitute behavior, mock behavior, or compatibility shims unless the user or sealed decision contract explicitly requested them.\nRespect all SKS hooks, DB safety rules, no-question run rules, and H-Proof completion gates.\nAlso return concise LIVE_EVENT lines for started, blocked, changed files, verification, and final result so the parent can record them.\n"""\n`,
1308
- 'db-safety-reviewer.toml': `name = "db_safety_reviewer"\ndescription = "Database safety reviewer with bounded write capability for SQL, migrations, Supabase, RLS, destructive-operation risk, and rollback safety."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "high"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are a database safety reviewer.\nOnly edit bounded files assigned by the parent orchestrator. Never execute destructive commands.\nReview migrations, SQL, Supabase RLS, transaction boundaries, rollback safety, and MCP database tool usage.\nBlock DROP, TRUNCATE, mass DELETE/UPDATE, db reset, db push, project deletion, branch reset/merge/delete, RLS disabling, and live execute_sql writes.\nReturn concrete risks, exact file references, and required fixes.\nAlso return a concise LIVE_EVENT line that the parent can record with sks team event.\n"""\n`,
1309
- 'qa-reviewer.toml': `name = "qa_reviewer"\ndescription = "Strict verification reviewer with bounded write capability for correctness, regressions, missing tests, user friction, and final evidence."\nmodel = "gpt-5.5"\nmodel_reasoning_effort = "high"\nsandbox_mode = "workspace-write"\ndeveloper_instructions = """\nYou are an SKS Team strict reviewer.\nOnly edit bounded files assigned by the parent orchestrator.\nReview correctness, edge cases, regression risk, missing tests, unsupported claims, and whether the final evidence proves the claimed outcome.\nTeam review must cover at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA validation lanes before integration or final; flag missing review lane evidence.\nAlso evaluate practical friction from the viewpoint of a stubborn, low-context final user who dislikes inconvenience.\nPrioritize concrete findings with file references and focused verification suggestions.\nFlag any unrequested fallback implementation code, substitute behavior, mock behavior, or compatibility shim as a blocking finding unless the user or sealed decision contract explicitly requested it.\nReturn no findings if the implementation is sound, and clearly list residual test gaps.\nAlso return a concise LIVE_EVENT line that the parent can record with sks team event.\n"""\n`
1310
- };
1311
- const dir = path.join(root, '.codex', 'agents');
1312
- await ensureDir(dir);
1313
- for (const [file, content] of Object.entries(agents)) {
1314
- await writeTextAtomic(path.join(dir, file), content);
1315
- }
1316
- return {
1317
- installed_agents: Object.keys(agents),
1318
- generated_files: Object.keys(agents).map((file) => `.codex/agents/${file}`).sort()
1319
- };
1320
- }
1321
- function currentGeneratedFileInventory(skillInstall = {}, agentInstall = {}) {
1322
- return Array.from(new Set([
1323
- '.codex/config.toml',
1324
- '.codex/SNEAKOSCOPE.md',
1325
- '.codex/hooks.json',
1326
- '.sneakoscope/harness-guard.json',
1327
- '.sneakoscope/db-safety.json',
1328
- '.sneakoscope/policy.json',
1329
- '.agents/skills/.sks-generated.json',
1330
- ...(Array.isArray(skillInstall.generated_files) ? skillInstall.generated_files : []),
1331
- ...(Array.isArray(agentInstall.generated_files) ? agentInstall.generated_files : [])
1332
- ])).sort();
1333
- }
1334
- async function pruneStaleGeneratedFiles(root, previousManifest, currentFiles) {
1335
- const previousFiles = Array.isArray(previousManifest?.generated_files?.files) ? previousManifest.generated_files.files : [];
1336
- if (!previousFiles.length)
1337
- return { pruned: [] };
1338
- const current = new Set(currentFiles);
1339
- const pruned = [];
1340
- const already_absent = [];
1341
- for (const rel of previousFiles) {
1342
- const relPath = normalizeGeneratedRelPath(rel);
1343
- if (!relPath || current.has(relPath) || !isPrunableGeneratedPath(relPath))
1344
- continue;
1345
- const removed = await removeGeneratedRelPath(root, relPath);
1346
- if (removed)
1347
- pruned.push(removed);
1348
- else
1349
- already_absent.push(relPath);
1350
- }
1351
- return { pruned: pruned.sort(), already_absent: already_absent.sort() };
1352
- }
1353
- function normalizeGeneratedRelPath(value) {
1354
- const rel = String(value || '').trim().replaceAll('\\', '/');
1355
- if (!rel || rel.startsWith('/') || rel.includes('\0'))
1356
- return null;
1357
- if (rel.split('/').some((part) => part === '..'))
1358
- return null;
1359
- return rel;
1360
- }
1361
- function isPrunableGeneratedPath(rel) {
1362
- if (rel.startsWith('.agents/skills/'))
1363
- return true;
1364
- if (rel.startsWith('.codex/agents/'))
1365
- return true;
1366
- if (rel.startsWith('.codex/skills/'))
1367
- return true;
1368
- return new Set([
1369
- '.codex/config.toml',
1370
- '.codex/SNEAKOSCOPE.md',
1371
- '.codex/hooks.json',
1372
- '.sneakoscope/harness-guard.json',
1373
- '.sneakoscope/db-safety.json',
1374
- '.sneakoscope/policy.json'
1375
- ]).has(rel);
1376
- }
1377
- async function removeGeneratedRelPath(root, rel) {
1378
- const absRoot = path.resolve(root);
1379
- const abs = path.resolve(absRoot, rel);
1380
- if (abs !== absRoot && !abs.startsWith(`${absRoot}${path.sep}`))
1381
- return null;
1382
- if (!(await exists(abs)))
1383
- return null;
1384
- await fsp.rm(abs, { recursive: true, force: true });
1385
- await removeEmptyGeneratedParents(root, rel);
1386
- return rel;
1387
- }
1388
- async function removeEmptyGeneratedParents(root, rel) {
1389
- const parts = rel.split('/');
1390
- if (parts.length <= 1)
1391
- return;
1392
- const stopDirs = new Set([
1393
- path.resolve(root, '.agents', 'skills'),
1394
- path.resolve(root, '.codex', 'agents'),
1395
- path.resolve(root, '.codex', 'skills'),
1396
- path.resolve(root, '.codex'),
1397
- path.resolve(root, '.sneakoscope')
1398
- ]);
1399
- let dir = path.resolve(root, ...parts.slice(0, -1));
1400
- while (!stopDirs.has(dir) && dir.startsWith(path.resolve(root))) {
1401
- await removeDirIfEmpty(dir);
1402
- const parent = path.dirname(dir);
1403
- if (parent === dir)
1404
- break;
1405
- dir = parent;
1406
- }
1407
- if (rel.startsWith('.codex/skills/'))
1408
- await removeDirIfEmpty(path.join(root, '.codex', 'skills'));
1409
- }
1410
1036
  //# sourceMappingURL=init.js.map
@@ -18,6 +18,7 @@ const LEAN_ENGINEERING_POLICY_CANONICAL = [
18
18
  'Fix shared root causes instead of duplicating caller-specific symptom guards.',
19
19
  'Capability and compatibility fallbacks require one authority, proof, bounded scope, and honest verification level.',
20
20
  'Never remove trust-boundary validation, data-loss protection, security, permissions, rollback, accessibility, or explicit user requirements to shrink a diff.',
21
+ 'Release verification must stay lean: release preset gates <= 200, package scripts <= 100, and one distinct user concern per gate.',
21
22
  'Non-trivial logic needs one smallest runnable check.'
22
23
  ].join('\n');
23
24
  export const LEAN_ENGINEERING_POLICY_HASH = createHash('sha256')
@@ -35,7 +36,7 @@ export function leanEngineeringCompactText() {
35
36
  `Lean Engineering Policy (${LEAN_ENGINEERING_POLICY_ID}/${LEAN_ENGINEERING_POLICY_HASH}):`,
36
37
  'Read the touched flow first, then stop at the highest sufficient rung: skip, reuse existing, stdlib, native platform, installed dependency, safe single expression, minimal custom.',
37
38
  'No unrequested route/command/daemon/dependency/abstraction/config flag/shim/hidden fallback; required capability/compatibility fallback needs one authority, proof, and bounded scope.',
38
- 'Fix root cause once, preserve trust-boundary validation/security/rollback/accessibility/user requirements, and leave one runnable check for non-trivial logic.'
39
+ 'Fix root cause once, preserve trust-boundary validation/security/rollback/accessibility/user requirements, keep release gates <= 200 and package scripts <= 100, and leave one runnable check for non-trivial logic.'
39
40
  ].join('\n');
40
41
  }
41
42
  export function leanEngineeringLongText() {
@@ -40,14 +40,14 @@ export async function runNarutoRealActivePool(input) {
40
40
  }
41
41
  maxObserved = Math.max(maxObserved, active.size);
42
42
  timeline.push({ tick, active: active.size, pending: pending.length, completed: completed.size, event: launched ? 'refill' : 'wait' });
43
- const done = await nextCollectableWorkers(active);
43
+ const done = await nextCollectableWorkers(active, input.hardTimeoutMs);
44
44
  if (!done.length)
45
45
  break;
46
46
  for (const handle of done) {
47
47
  active.delete(handle.id);
48
48
  if (handle.placement.placement === 'zellij-pane')
49
49
  visibleRunning = Math.max(0, visibleRunning - 1);
50
- const result = await input.collectWorker(handle);
50
+ const result = handle.force_timed_out ? await forceCollectTimedOutWorker(handle) : await input.collectWorker(handle);
51
51
  completed.set(result.item.id, result);
52
52
  const row = lifecycle.find((entry) => entry.work_item_id === result.item.id && entry.completed_at == null);
53
53
  if (row) {
@@ -113,17 +113,46 @@ export async function runNarutoRealActivePool(input) {
113
113
  blockers
114
114
  };
115
115
  }
116
- async function nextCollectableWorkers(active) {
116
+ async function nextCollectableWorkers(active, hardTimeoutMs = 10 * 60 * 1000) {
117
117
  const handles = [...active.values()];
118
+ const now = Date.now();
119
+ const timedOut = handles.filter((handle) => now - Number(handle.started_at || now) > hardTimeoutMs);
120
+ if (timedOut.length)
121
+ return timedOut.map((handle) => ({ ...handle, force_timed_out: true }));
118
122
  const handlesWithExit = handles.filter((handle) => typeof handle.exit?.then === 'function');
119
123
  if (!handlesWithExit.length)
120
124
  return handles.slice(0, Math.max(1, Math.ceil(active.size / 2)));
121
- const completed = await Promise.race(handlesWithExit.map(async (handle) => {
122
- await handle.exit.catch(() => undefined);
123
- return handle;
124
- }));
125
+ const completed = await Promise.race([
126
+ ...handlesWithExit.map(async (handle) => {
127
+ await handle.exit.catch(() => undefined);
128
+ return handle;
129
+ }),
130
+ delay(1000).then(() => null)
131
+ ]);
125
132
  return completed ? [completed] : [];
126
133
  }
134
+ async function forceCollectTimedOutWorker(handle) {
135
+ if (Number.isFinite(Number(handle.pid))) {
136
+ try {
137
+ process.kill(Number(handle.pid), 'SIGTERM');
138
+ }
139
+ catch { }
140
+ }
141
+ return {
142
+ id: handle.id,
143
+ ok: false,
144
+ item: handle.item,
145
+ placement: handle.placement,
146
+ completed_at: Date.now(),
147
+ pid: handle.pid || null,
148
+ worker_artifact_dir: handle.worker_artifact_dir || null,
149
+ status: 'timed_out',
150
+ blockers: ['naruto_worker_hard_timeout']
151
+ };
152
+ }
153
+ function delay(ms) {
154
+ return new Promise((resolve) => setTimeout(resolve, ms));
155
+ }
127
156
  export async function runNarutoActivePool(input) {
128
157
  const base = simulateNarutoActivePool(input);
129
158
  const allocations = [];