@mutagent/helix 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/mutagent-helix/SKILL.md +113 -0
- package/.claude/skills/mutagent-helix/scripts/cli/codex-transcode.ts +143 -0
- package/.claude/skills/mutagent-helix/scripts/cli/doctor.ts +111 -0
- package/.claude/skills/mutagent-helix/scripts/cli/init.ts +382 -0
- package/.claude/skills/mutagent-helix/scripts/cli/run.sh +61 -0
- package/CLAUDE.md +193 -0
- package/LICENSE +201 -0
- package/NOTICE +22 -0
- package/README.md +209 -0
- package/assets/adl-loop.svg +162 -0
- package/assets/system-status.svg +422 -0
- package/bin/mutagent-cli.mjs +9950 -0
- package/bin/mutagent-helix.mjs +78 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/CLAUDE.md +28 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/SKILL.md +138 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/assets/templates/agentspec.yaml.tpl +247 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/frameworks/doc-pins.md +53 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/principles.md +91 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/requirements.yaml +295 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/workflows/orchestrator-protocol.md +302 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/doctor.ts +116 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/init.ts +230 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/run.sh +60 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/config/resolve-spec-dir.ts +199 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/contract/agentspec.schema.ts +455 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/setup/detect.ts +67 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/validate/validate-spec.ts +93 -0
- package/mutagent-agentspec/LICENSE +201 -0
- package/mutagent-agentspec/NOTICE +19 -0
- package/mutagent-agentspec/README.md +44 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/SKILL.md +100 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-architect.md +312 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-engineer.md +357 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/templates/build-report.md.tpl +39 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/principles.md +31 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/build-protocol.md +61 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/improve-handoff.md +23 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/cli/run.sh +60 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/handoff/validate-build-input.ts +72 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/sync-spec/check-sync-spec.ts +499 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/verify/spec-impl-coverage.ts +182 -0
- package/mutagent-builder/CLAUDE.md +25 -0
- package/mutagent-builder/README.md +26 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/README.md +192 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/SKILL.md +352 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-architect.md +256 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-engineer.md +344 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/diagnostics-analyzer.md +576 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/discovery.md +425 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.json.tpl +24 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.md.tpl +49 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/config.yaml.tpl +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/pr-body.md.tpl +56 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/report.html.tpl +327 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/README.md +27 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/iter-N-handover.md.tpl +125 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/self-diagnosis-contract.v0.1.0.yaml.tpl +234 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/spec.yaml.tpl +152 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/team.yaml.tpl +127 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/wave-N-dashboard.html.tpl +1712 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.1-nl-query.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.2-tier0-progress.md +58 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.3-analysis-progress.md +44 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.4-html-report.md +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.5-rca-detail.md +69 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.6-stale-warning.md +53 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.1-welcome.md +60 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.2-source-platform-picker.md +41 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.3-source-auth.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.4-target-picker.md +48 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.5-ask-tool.md +43 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.6-config-review.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.7-filter-defaults.md +52 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.8-first-run.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-findings.json +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-meta.json +47 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/adapter-strategy.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config-migration.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config.md +159 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/filter-search-matrix.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/harness-knowledge.md +22 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/memory-format.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/onboarding-decisions.yaml +187 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/operation-inventory.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/overview.md +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/reference.md +119 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/script-index.md +101 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-adapter-contract.md +93 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/claude-code-transcripts.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex-transcripts.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex.md +145 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/install-paths.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/langfuse.md +178 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/local-jsonl.md +55 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/openobserve.md +102 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/otel.md +63 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/cloud-rest.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-claude.md +65 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cloud-agent-sdk.md +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-codex.md +72 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cursor.md +108 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-mastra.md +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-opencode.md +70 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/apply-pr-comment-format.md +82 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/diagnostics.md +35 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/handover-contract.md +247 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/onboarding.md +300 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/orchestrator-protocol.md +1861 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rca.md +331 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rendering-anatomy.md +314 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/schedule-prep.md +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/scope-model.md +128 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/verification-methodology.md +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/aggregate/sort-findings.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/blind-spots.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/llm-sample.ts +681 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/doctor.ts +215 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/init.ts +1013 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/install-agents.ts +350 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/run.sh +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/shared-templates.ts +79 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/load.ts +392 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/resolve-credential.ts +120 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/schema.ts +641 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/validate.ts +134 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/build-diagnosis-context.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/load-context.ts +105 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/contract/types.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/build-render-input.ts +1964 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/corpus-severity.ts +172 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/dismissal-match.ts +270 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/rank-remedies.ts +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/install-hooks.sh +46 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/pre-push.sh +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/invocation/parse-brief.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/match.ts +114 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/paths.ts +95 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/store.ts +535 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/types.ts +181 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/lint/template-inline-js.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/append.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/read.ts +218 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/platforms/entity-context.ts +686 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/read-unitf.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/trace.ts +1078 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-adapter.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-types.ts +213 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/persist-selections.ts +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/render.ts +3254 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/diagnose.ts +64 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/session.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/caps.ts +345 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/deep-read-gate.ts +424 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/representative.ts +584 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/objection.ts +224 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/trajectory.ts +489 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/dispatch.ts +135 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/probe.ts +170 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/detect.ts +307 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/ensure-cli.ts +315 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/reconfigure.ts +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/verify-agents.ts +207 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/slicer.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/claude-code.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/codex.ts +11 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/langfuse.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/local-jsonl.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/otel.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/index.ts +54 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/registry.ts +45 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/types.ts +86 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/stale-detector.ts +74 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/test/render-playwright.cli.ts +477 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/claude-code.ts +133 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/langfuse.ts +143 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0-scan.ts +423 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/completeness-check.ts +436 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/doc-refs.ts +190 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/finalize-gate.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/findings-contract.ts +628 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/render-js-syntax.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/report-checklist.yaml +217 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/trace-shape.ts +262 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/wave6-checklist.ts +326 -0
- package/mutagent-diagnostics/CLAUDE.md +41 -0
- package/mutagent-diagnostics/LICENSE +201 -0
- package/mutagent-diagnostics/NOTICE +18 -0
- package/mutagent-diagnostics/README.md +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/SKILL.md +548 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/audit-executor.md +169 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/dataset-builder.md +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/discovery.md +425 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +1108 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/theme.css +213 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/wordmark.html +9 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/context-flow-lens.md +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/data-lens.md +47 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/decision-lens.md +48 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +53 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/trajectory-lens.md +44 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/build-review-interface.md +83 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/edd-loop.md +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/error-analysis.md +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-audit.md +154 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-stage.md +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/generate-synthetic-data.md +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/grounded-adjudication.md +221 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/memory-format.md +65 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/methodology.md +201 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/operation-inventory.md +197 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/validate-evaluator.md +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/workflows/orchestrator-protocol.md +300 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/write-judge-prompt.md +123 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/behavior-tree.schema.yaml +73 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/dataset.schema.yaml +66 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/edd-change-request.schema.yaml +114 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/eval-matrix.schema.yaml +74 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-graph.schema.yaml +69 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-profile.schema.yaml +49 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +40 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/scorecard.schema.yaml +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/aggregate-discover.ts +543 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/artifact-paths.ts +115 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/assemble-scorecard.ts +172 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-dataset.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-evals.ts +93 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +393 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/check-method-router.ts +170 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/aggregate.ts +112 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/audit-run.ts +182 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/doctor.ts +211 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/dogfood.ts +133 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/init.ts +601 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/methodology-review.ts +122 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +295 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +165 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/run.sh +56 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/variance-check.ts +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-eval.ts +248 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-quality-verdict.ts +285 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/codegen-evals.ts +173 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-project.ts +151 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-sampler.ts +267 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/load.ts +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +380 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/agentspec-evals.ts +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/dataset.ts +149 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-engine.ts +118 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +577 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-types.ts +1074 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/flow-graph.ts +194 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/types.ts +303 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/validation.ts +193 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/derive-dataset.ts +152 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +219 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/diff-discriminate.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/discover-criteria.ts +348 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/variance-gate.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/emit-completeness.ts +111 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/eval-engine.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/evaluate.ts +333 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/flow-graph.ts +230 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +253 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-provider.ts +135 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-grounding.ts +229 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-uniformity.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/living-suite.ts +109 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-bundle.ts +203 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile-vocab.ts +64 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/mask.ts +138 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/materialize-dataset.ts +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/matrix-judge.ts +750 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +215 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/read.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/persist-eval-criteria.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/profile-subject.ts +310 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/publish-report.ts +131 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +195 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-discover-report.ts +1640 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +3838 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-report.ts +212 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-credential.ts +110 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-ref.ts +98 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/result-verify.ts +129 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +330 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-deterministic.ts +367 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-evaluate.ts +719 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-judge.ts +155 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +175 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sample-traces.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/self-audit.ts +387 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/source-map.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/substrate.ts +162 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sync-eval-criteria.ts +244 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/ui-slots.ts +119 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +284 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/validate-judge.ts +358 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/variance-compare.ts +177 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/behavior-tree.yaml +140 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/eval-matrix.yaml +1270 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/methodology-review.yaml +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/audit.workflow.js +82 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/data-leak.workflow.js +236 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/variance.workflow.js +163 -0
- package/mutagent-evaluator/CLAUDE.md +45 -0
- package/mutagent-evaluator/LICENSE +201 -0
- package/mutagent-evaluator/NOTICE +23 -0
- package/mutagent-evaluator/README.md +88 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/SKILL.md +287 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/contracts/amend-request.ts +503 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/improve-loop-run.ts +304 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state-cli.ts +300 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state.ts +440 -0
- package/mutagent-optimize/CLAUDE.md +49 -0
- package/mutagent-optimize/README.md +26 -0
- package/mutagent-orchestrator/CLAUDE.md +102 -0
- package/mutagent-orchestrator/README.md +20 -0
- package/mutagent-orchestrator/assets/agents/discovery.md +425 -0
- package/mutagent-orchestrator/assets/agents/dogfood-monitor.md +266 -0
- package/mutagent-orchestrator/assets/agents/monitor.md +258 -0
- package/mutagent-orchestrator/orchestrator.md +782 -0
- package/mutagent-orchestrator/references/MONITORING.md +209 -0
- package/mutagent-orchestrator/references/config-fields.md +132 -0
- package/mutagent-orchestrator/references/config-migration.md +132 -0
- package/mutagent-orchestrator/references/index-registry.md +92 -0
- package/mutagent-orchestrator/routing.yaml +391 -0
- package/mutagent-orchestrator/scripts/config-schema.ts +1010 -0
- package/mutagent-orchestrator/scripts/dispatch.ts +439 -0
- package/mutagent-orchestrator/scripts/dogfood/extract-feedback.ts +203 -0
- package/mutagent-orchestrator/scripts/dogfood/reconstruct-trajectory.ts +327 -0
- package/mutagent-orchestrator/scripts/dogfood/render-dogfood-report.ts +347 -0
- package/mutagent-orchestrator/scripts/dogfood/resolve-subagents.ts +160 -0
- package/mutagent-orchestrator/scripts/dogfood/run-report.ts +264 -0
- package/mutagent-orchestrator/scripts/dogfood/slack-thread.ts +106 -0
- package/mutagent-orchestrator/scripts/dogfood/types.ts +257 -0
- package/mutagent-orchestrator/scripts/eval-routing.ts +753 -0
- package/mutagent-orchestrator/scripts/gate.ts +219 -0
- package/mutagent-orchestrator/scripts/handover-contract.ts +362 -0
- package/mutagent-orchestrator/scripts/index/build-index.ts +351 -0
- package/mutagent-orchestrator/scripts/index/render-index.ts +110 -0
- package/mutagent-orchestrator/scripts/monitor/slack-notify.ts +111 -0
- package/mutagent-orchestrator/scripts/monitor/triggers.ts +162 -0
- package/mutagent-orchestrator/scripts/onboarding-check.ts +369 -0
- package/mutagent-orchestrator/scripts/render-roster.ts +308 -0
- package/mutagent-orchestrator/scripts/resolve-credential.ts +185 -0
- package/mutagent-orchestrator/scripts/resolve-paths.ts +114 -0
- package/mutagent-orchestrator/scripts/slack/format.ts +63 -0
- package/mutagent-orchestrator/scripts/slack/post.ts +115 -0
- package/mutagent-orchestrator/scripts/sync-index.ts +311 -0
- package/package.json +64 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# mutagent-agentspec — Orchestrator Protocol
|
|
2
|
+
|
|
3
|
+
> The runtime FSM for `mutagent-agentspec`. The **parent session IS the domain orchestrator** — it
|
|
4
|
+
> runs the `*spec` interview itself and does **NOT** dispatch a coordinator sub-agent (PR-006). On
|
|
5
|
+
> Claude Code the interview uses **AskUserQuestion**; elsewhere it uses a chat-based multi-choice
|
|
6
|
+
> fallback. `*build` is owned by `mutagent-builder`; `*eval` is a routed handoff to EVALUATE.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Star-command resolution contract (verbatim)
|
|
11
|
+
|
|
12
|
+
When you encounter a `*<name>` token:
|
|
13
|
+
1. **RESERVED** — `*` marks a command. NOT prose, NOT a file path, NOT an external shortcut.
|
|
14
|
+
`*command` = THIS skill's semantic map (internal). Never improvise.
|
|
15
|
+
2. **RESOLVE** — look up `<name>` in the `commands:` block in `SKILL.md §0.1`. Not found ⇒ ERROR +
|
|
16
|
+
ask the operator. NEVER guess.
|
|
17
|
+
3. **BINDING** — read `kind:` + `binds:`:
|
|
18
|
+
- `kind: script` ⇒ `binds:` a relative script path ⇒ CALL the script via `scripts/cli/run.sh`.
|
|
19
|
+
Do NOT re-implement it in prose.
|
|
20
|
+
- `kind: agent-chain` ⇒ `binds:` a workflow file#section ⇒ load + run the steps in order.
|
|
21
|
+
- `kind: hybrid` ⇒ `binds:` both ⇒ call script(s) for deterministic parts, reason for the rest.
|
|
22
|
+
4. **PRE-GATE** — load any `pre_gate.loads:`.
|
|
23
|
+
5. **EXECUTE** — run the steps IN ORDER. Invent nothing.
|
|
24
|
+
6. `purpose:` / `impact:` explain WHY (not executed). Steps MAY reference other `*commands`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## `*spec` — the guided interview FSM (parent session, full)
|
|
29
|
+
|
|
30
|
+
**Goal:** walk the operator through the `agentspec.yaml` Definition + Build, emit the spec, and gate
|
|
31
|
+
it with `*validate-spec`. The interview is parent-only (AskUserQuestion cannot run inside a
|
|
32
|
+
sub-agent, PR-006). Every fork is an AskUserQuestion (Claude Code) or a chat multi-choice
|
|
33
|
+
(elsewhere) — never a bare inline prose ask. Capture VERBOSE descriptions on every entry (PR-015) —
|
|
34
|
+
the description is the primary field the implementing LLM reads.
|
|
35
|
+
|
|
36
|
+
The FSM walks the blocks in order. State accumulates into the in-progress spec object; the operator
|
|
37
|
+
may revise an earlier answer at any point (the spec is the working record).
|
|
38
|
+
|
|
39
|
+
> **FRAMEWORK-BEFORE-TOOLING ordering (dogfood F3).** The implementation **target** (`build.target_framework`,
|
|
40
|
+
> the **B0** step) is chosen **EARLY — before `context_sources` (D3) and `tools` (D4)** — because the chosen
|
|
41
|
+
> framework/ecosystem SCOPES how each tool binds (an MCP ref vs a CLI vs a framework-native SDK call) and
|
|
42
|
+
> which integration idioms/language are even available (F12). Asking tools first and the target second forced
|
|
43
|
+
> a re-think of every tool binding once the target landed. The FSM therefore runs **D0 → D1 → D2 → B0 → D3 →
|
|
44
|
+
> D4 → D5 → …**: identity + persona + jobs first (they INFORM the target recommendation), then the target,
|
|
45
|
+
> then the framework-scoped tooling questions. The remaining Build steps (B1 runtime, B2 eval-framework) and
|
|
46
|
+
> the Appendix/Meta phases follow as before.
|
|
47
|
+
|
|
48
|
+
### Phase D — DEFINITION (the interface — WHAT the agent is)
|
|
49
|
+
|
|
50
|
+
| # | State | Captures | Schema target |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| D0 | **identity** | name · version · description · kind (agent\|skill\|composite). INFER `kind` from the description and PROPOSE it (F2 — see below); do NOT cold-ask. | `definition.identity` |
|
|
53
|
+
| D1 | **persona + system_prompt** | role · verbose persona; then the ACTUAL operative system prompt (full text, not a summary, PR-014) | `definition.persona`, `definition.system_prompt` |
|
|
54
|
+
| D2 | **jobs_to_be_done** | per job: id · verbose what+why description · expected_output | `definition.jobs_to_be_done[]` |
|
|
55
|
+
| **B0** | **target_framework** *(asked HERE — framework-before-tooling, F3)* | the implementation target — a framework (mastra\|deepagents\|pydantic-ai\|langgraph) OR a harness (`harness:claude-code`\|`harness:codex`\|`harness:<other>`) OR a future target (String, PR-005). RECOMMEND one from the Definition so far (D0–D2). Chosen NOW because it scopes D3/D4 tool binding + ecosystem idioms. | `build.target_framework` |
|
|
56
|
+
| D3 | **context_sources** | per source: id · kind (api\|saas\|internal-service\|mcp\|cli) · verbose description · where_from · optional auth_ref. Bind in the chosen target's idiom (B0 is already known). | `definition.context_sources[]` |
|
|
57
|
+
| D4 | **tools** | four buckets — integration (cli\|saas\|mcp, **binding preference resolved by the chosen target** per the revised PR-004 — see below) · code (lang+sandbox) · skills · subagents (verbose, optional tools/model honored verbatim per PR-003). Every entry carries a verbose description (PR-015). **Tooling matches the target's language/ecosystem (F12).** | `definition.tools.{integration,code,skills,subagents}` |
|
|
58
|
+
| D5 | **agent_type** | conversational \| automation \| orchestrator. INFER from the description + jobs and PROPOSE it (F2 — see below); do NOT cold-ask. | `definition.agent_type` |
|
|
59
|
+
| D6 | **triggers** | per trigger: id · kind (a2a\|webhook\|schedule\|queue\|event\|mcp\|manual) · verbose description · optional config. These are the DESIGNED agent's inbound activation events — DISTINCT from the in-system `*monitor` (PR-017). | `definition.triggers[]` |
|
|
60
|
+
| D7 | **modeling** | decision_graph (state · nodes · edges{from,to,condition?}) LangGraph-aligned + freeform workflows | `definition.modeling` |
|
|
61
|
+
| D8 | **sop** | per entry: id · when (trigger condition) · context (what is loaded/required) · verbose procedure · optional on_outcome{success,failure} (PR-016) | `definition.sop[]` |
|
|
62
|
+
| D9 | **evals · success_criteria** | per criterion: id · binary-actionable criterion · type (llm-judge\|code-check) · goal. Append-extensible — you cannot pre-know them all (PR-019). | `definition.evals.success_criteria[]` |
|
|
63
|
+
| D10 | **evals · scenarios** | the SITUATIONS the agent must handle — per scenario: id · verbose description (the situation) · expected_behavior · optional category · optional `edge_case` flag. Probe explicitly for the HARD / adversarial cases a naive spec forgets (dogfood F1). | `definition.evals.scenarios[]` |
|
|
64
|
+
| D11 | **evals · dataset_categories** | the GOLDEN eval-suite slices the `*eval` dataset must cover — per category: id · verbose description (the use-case slice) · `edge_cases[]`. This is the dataset DEFINITION handed to the evaluator (seed, don't duplicate, PR-018; dogfood F2). | `definition.evals.dataset_categories[]` |
|
|
65
|
+
|
|
66
|
+
#### INFER → PROPOSE → CONFIRM — `identity.kind` (D0) + `agent_type` (D5) (dogfood F2)
|
|
67
|
+
|
|
68
|
+
> **Don't cold-ask the obvious.** The operator described the agent in D0–D2; both `identity.kind` and
|
|
69
|
+
> `definition.agent_type` are usually DERIVABLE from that description + the jobs. So the interview
|
|
70
|
+
> **INFERS** the value, **PROPOSES** it as the pre-selected default in the AskUserQuestion (Claude Code) /
|
|
71
|
+
> chat multi-choice (elsewhere), and lets the operator **CONFIRM or CORRECT** — it never presents the
|
|
72
|
+
> bare enum with no recommendation. A cold "is this conversational, automation, or orchestrator?" wastes
|
|
73
|
+
> the operator's attention on a call the description already answers.
|
|
74
|
+
|
|
75
|
+
**`definition.agent_type` inference map** (ship this exact mapping — propose the matching value, with the
|
|
76
|
+
gloss as the rationale shown to the operator):
|
|
77
|
+
|
|
78
|
+
| The description sounds like… | PROPOSE `agent_type` | Gloss (the WHY shown to the operator) |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| a chatbot / customer-facing assistant / support agent / conversational helper | `conversational` | a back-and-forth dialog agent |
|
|
81
|
+
| an orchestrator / router / coordinator that delegates to other agents | `orchestrator` | an **a2a-router** — routes agents-to-agents |
|
|
82
|
+
| an automation / pipeline / end-to-end job that runs without a human turn | `automation` | a **one-shot end-to-end** run |
|
|
83
|
+
|
|
84
|
+
**`definition.identity.kind` inference** (D0): INFER `agent` for a standalone autonomous agent, `skill` for
|
|
85
|
+
a reusable capability invoked by a host runtime, `composite` for a multi-part agent-of-agents; PROPOSE the
|
|
86
|
+
inferred value, operator confirms/corrects.
|
|
87
|
+
|
|
88
|
+
**Mechanism (both D0 and D5):** read the D0 `description` (+ D2 jobs for D5); pick the best-matching row;
|
|
89
|
+
PROPOSE that value as the DEFAULT option with the gloss as its preview/rationale; the operator confirms it
|
|
90
|
+
or picks another. On a low-confidence inference, still propose the best guess but flag it as a guess.
|
|
91
|
+
|
|
92
|
+
### Phase B — BUILD (the implementation target — a guided choice)
|
|
93
|
+
|
|
94
|
+
> **B0 (`target_framework`) is asked EARLY — during Phase D, right after D2 (jobs) and before D3/D4
|
|
95
|
+
> (context + tools)** — per the framework-before-tooling ordering (F3). It is listed here too for the
|
|
96
|
+
> schema-target map, but in the live FSM it has already been captured by the time these rows run. B1
|
|
97
|
+
> (runtime) and B2 (eval-framework) are asked in their Phase-B position as before.
|
|
98
|
+
|
|
99
|
+
| # | State | Captures | Schema target |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| B0 | **target_framework** *(captured early in Phase D — see D-table; restated here for the schema map)* | the implementation target — a framework (mastra\|deepagents\|pydantic-ai\|langgraph) OR a harness (`harness:claude-code`\|`harness:codex`\|`harness:<other>`) OR a future target (String, PR-005). RECOMMEND one from the Definition (e.g. langgraph for a declarative graph; harness:* for a coding-agent skill). | `build.target_framework` |
|
|
102
|
+
| B1 | **runtime** | the execution runtime the implementation targets (bun\|node\|deno\|python\|shell\|…) — PIN it at spec-time so `*build` implements ONCE (no bash→Bun rebuild, dogfood F4). RECOMMEND from the target: harness:claude-code → bun/node; langgraph/pydantic-ai → python. | `build.runtime` |
|
|
103
|
+
| B2 | **target_eval_framework** | mutagent-evaluator \| export:vitest\|promptfoo\|braintrust | `build.target_eval_framework` |
|
|
104
|
+
|
|
105
|
+
#### D4 tool-binding — target-conditional, NOT blanket MCP-first (dogfood F5, revised PR-004)
|
|
106
|
+
|
|
107
|
+
> By D4 the target is already chosen (B0, asked early per F3), so resolve each tool's binding preference
|
|
108
|
+
> FROM the target rather than always reaching for MCP. This is the operator-directed revision of PR-004
|
|
109
|
+
> (see `references/principles.md` PR-004):
|
|
110
|
+
>
|
|
111
|
+
> - **harness target** (`harness:claude-code` / `harness:codex`) → **CLI-first**. Prefer the native CLI
|
|
112
|
+
> tools the harness binds directly (`gh` / `git` / a framework `cli`); use `tools.integration[].kind: cli`.
|
|
113
|
+
> - **code-framework target** (langgraph / mastra / pydantic-ai / deepagents) → **MCP / Composio / SDK-first**.
|
|
114
|
+
> Prefer an MCP `ref` (the portable tool layer), a Composio binding, or the framework's native SDK
|
|
115
|
+
> integration; use `kind: mcp` (or `saas` for a Composio/SDK binding) as appropriate.
|
|
116
|
+
>
|
|
117
|
+
> Propose the target-favored binding for each integration tool; the operator may override per-tool.
|
|
118
|
+
|
|
119
|
+
#### D4 tooling matches the target's LANGUAGE / ecosystem (dogfood F12)
|
|
120
|
+
|
|
121
|
+
> Once the target is chosen (B0), bias every tool / integration / SDK choice to that ecosystem's
|
|
122
|
+
> idioms and LANGUAGE — don't propose a cross-language tool the target can't bind natively. Examples:
|
|
123
|
+
>
|
|
124
|
+
> - **TS framework** (mastra / TS harness) → the **TypeScript** ecosystem: prefer the **Vercel AI SDK**,
|
|
125
|
+
> TS-native MCP clients, and `npm`/`bun` packages. Pin `build.runtime` to bun/node (F4).
|
|
126
|
+
> - **Python framework** (langgraph / pydantic-ai / deepagents) → the **Python** ecosystem: prefer the
|
|
127
|
+
> provider Python SDKs, `pip`-installable integrations, and Python MCP clients. Pin `build.runtime` to python.
|
|
128
|
+
> - **harness target** → the harness's own tool surface + the language its skills/agents are authored in.
|
|
129
|
+
>
|
|
130
|
+
> The chosen target's language is the constraint; propose tools idiomatic to it, not a generic best-of-breed
|
|
131
|
+
> from another stack. This keeps the binding implementable at `*build` without a language bridge.
|
|
132
|
+
|
|
133
|
+
### Phase A — APPENDIX (pinned references)
|
|
134
|
+
|
|
135
|
+
| # | State | Captures | Schema target |
|
|
136
|
+
|---|---|---|---|
|
|
137
|
+
| A0 | **framework_docs** | pin the doc roots for the chosen target (seed from `references/frameworks/doc-pins.md`; the operator may add/override). Crawled FRESH at `*build` (PR-002). | `appendix.framework_docs` |
|
|
138
|
+
| A1 | **references** | decisions · glossary · operator notes | `appendix.references` |
|
|
139
|
+
|
|
140
|
+
### Phase M — META (identity anchor + loop position) — set by the skill, confirmed by the operator
|
|
141
|
+
|
|
142
|
+
| # | State | Captures | Schema target |
|
|
143
|
+
|---|---|---|---|
|
|
144
|
+
| M0 | **spec_id + spec_version** | a stable `spec_id` (survives every version, PR-012) + the spec_version | `meta.spec_id`, `meta.spec_version` |
|
|
145
|
+
| M1 | **loop_state** | `stage: spec` at emit-time + an injected `updated_at`; `last_verdict` omitted until the loop runs (PR-010). NO downstream links — the spec is implementation-agnostic (PR-013). | `meta.loop_state` |
|
|
146
|
+
|
|
147
|
+
### Phase E — EMIT + GATE
|
|
148
|
+
|
|
149
|
+
1. **Resolve the output directory** (do NOT hard-code a path). Call the output-dir resolver:
|
|
150
|
+
`scripts/cli/run.sh scripts/config/resolve-spec-dir.ts` — it reads
|
|
151
|
+
`lifecycle.agentspec.spec_dir` from `<root>/.mutagent/config.yaml` and prints the resolved
|
|
152
|
+
absolute `dir` + the winning `source` (`flag`|`config`|`default`). **Precedence: flag > config >
|
|
153
|
+
default.** With ZERO config (no `.mutagent/config.yaml`, or the block/field absent) it returns the
|
|
154
|
+
DEFAULT `.mutagent/specs` — so `*spec` always runs. Then assemble the accumulated state into a
|
|
155
|
+
single `agentspec.yaml` at `<resolved-dir>/<spec_id>/agentspec.yaml` (so `*sync` can index the new
|
|
156
|
+
marker — see the cold-start note below).
|
|
157
|
+
2. Run `*validate-spec <path>` (`scripts/validate/validate-spec.ts`). On FAIL, surface the
|
|
158
|
+
field-pathed errors, return to the offending phase, fix, re-emit, re-gate. On PASS, the spec is
|
|
159
|
+
the validated Definition + a trackable subject (a planned, not-yet-built agent is first-class
|
|
160
|
+
from spec-time, PR-010).
|
|
161
|
+
3. SUGGEST the next stage (`*build`) — but NEVER auto-advance. The transition needs explicit
|
|
162
|
+
operator intent (PR-009).
|
|
163
|
+
|
|
164
|
+
> **Cold-start note (PR-010).** `*spec` writes `agentspec.yaml` (under the resolved `spec_dir`, default
|
|
165
|
+
> `.mutagent/specs`) with `meta.loop_state` — the spec IS the subject record. There is no separate
|
|
166
|
+
> registry; Helix reads `meta.loop_state.stage` for loop position and `*sync` learns to index the new
|
|
167
|
+
> marker. This closes the cold-start gap where the indexer only ever saw BUILT artifacts.
|
|
168
|
+
|
|
169
|
+
> **Output-dir note (config v0.2.0).** WHERE `*spec` writes is resolved by
|
|
170
|
+
> `scripts/config/resolve-spec-dir.ts` — precedence **flag > config > default**. The config field is
|
|
171
|
+
> `lifecycle.agentspec.spec_dir` in `<root>/.mutagent/config.yaml` (the LOCAL install root, found by
|
|
172
|
+
> walking up to the nearest `.mutagent/`). The block is OPTIONAL: with no config the resolver returns
|
|
173
|
+
> the default `.mutagent/specs`, so `*spec` runs with zero config. A relative `spec_dir` is anchored
|
|
174
|
+
> at the config root; an absolute one is honored as-is. The resolver is minimal by design — it reads
|
|
175
|
+
> ONLY `spec_dir` and never cross-imports the orchestrator's config schema (standalone invariant).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## `*sync-spec` — reconcile the spec + eval triad against a target (delegated)
|
|
180
|
+
|
|
181
|
+
> **The canonical spec-reconcile (dogfood F10).** `*sync-spec` FUSES the former `*spec-from-impl`
|
|
182
|
+
> (brownfield reverse-generate) and the former builder-owned `*spec-sync` (drift resync) into ONE
|
|
183
|
+
> operation — because reverse-generate is just *drift from nothing* (empty spec vs code). Cold (no
|
|
184
|
+
> `agentspec.yaml` yet → CONSTRUCT one) and warm (a spec exists but code drifted → RECONCILE the delta)
|
|
185
|
+
> are the SAME op with different starting points.
|
|
186
|
+
>
|
|
187
|
+
> **A THREE-leg triad (def → impl → EVAL), W2I5 · KP-003.** The reconcile keeps the spec leg AND the
|
|
188
|
+
> **eval-criteria leg** in lockstep with the impl (PR-011): when the impl amends, the eval criteria that
|
|
189
|
+
> ground the subject's evaluation can go stale exactly as the spec can. The eval leg's shape follows the
|
|
190
|
+
> subject kind — **eval-suite criteria** for an agent/skill subject, **code-quality criteria** for a code
|
|
191
|
+
> subject. `ai-architect #sync-spec` reconciles both legs; the eval-leg maintenance is the evaluator's:
|
|
192
|
+
> `sync-eval-criteria.ts` `reconcileEvalCriteria` COMPUTES the grown criteria set, and the evaluator session
|
|
193
|
+
> then PERSISTS it with `persist-eval-criteria.ts` `persistEvalCriteria` (the write that bumps the artifact's
|
|
194
|
+
> freshness → returns the eval leg to `in-sync`) — criteria maintenance, NOT judging; the evaluator stays
|
|
195
|
+
> judge-only, EV-051.
|
|
196
|
+
>
|
|
197
|
+
> **AgentSpec owns the entry but NEVER reads code.** It DELEGATES the target-read to builder's
|
|
198
|
+
> `ai-architect #sync-spec` (the single implementation-reader), Helix-mediated via a HandoverBundle
|
|
199
|
+
> (kind:agent — the same mechanism as the discovery agent). `ai-architect` returns a constructed /
|
|
200
|
+
> reconciled draft (spec leg + eval leg); AgentSpec `*validate-spec`-gates the spec and OWNS the result.
|
|
201
|
+
> Generic + subject-agnostic — no connector- or app-specific logic.
|
|
202
|
+
|
|
203
|
+
**Inputs:** a TARGET ref — a path/repo to the existing implementation (or a cloud agent definition),
|
|
204
|
+
optionally its env/config surface (`.env(.example)`, framework config, manifest/package files, MCP/tool
|
|
205
|
+
registrations), the existing `agentspec.yaml` if one exists (warm reconcile), and the existing
|
|
206
|
+
eval-criteria artifact if one exists (the eval leg — auto-located under `.mutagent/evaluator/living-suite/`
|
|
207
|
+
when not passed).
|
|
208
|
+
|
|
209
|
+
**Flow (parent-session, same interview discipline as `*spec`):**
|
|
210
|
+
|
|
211
|
+
1. **Emit the delegation bundle.** AgentSpec builds a `HandoverBundle{ adl_stage: build,
|
|
212
|
+
subject:{kind:agent, name:"ai-architect"}, intent:{command:"*sync-spec"}, inputs:[ target-ref,
|
|
213
|
+
existing agentspec.yaml? ] }` and hands it to Helix, which DISPATCHES builder's `ai-architect
|
|
214
|
+
#sync-spec`. AgentSpec itself reads NO implementation source.
|
|
215
|
+
2. **ai-architect reads the target + drafts the spec** (builder-side, `#sync-spec` mode). It inspects the
|
|
216
|
+
source — system prompt / persona text, tools + integrations it wires, context sources it reads,
|
|
217
|
+
sub-agents it dispatches, activation surface (entrypoints / handlers / triggers), and env/integration
|
|
218
|
+
surface — and PROJECTS it onto the `definition` blocks: `persona` + `system_prompt` (impl's operative
|
|
219
|
+
text VERBATIM, PR-014), `jobs_to_be_done`, `context_sources`, `tools` (four buckets), `agent_type`
|
|
220
|
+
(INFER + PROPOSE per F2), `triggers`, `modeling` + `sop`, and seeds `evals` from jobs + observed
|
|
221
|
+
behavior. INFERs `build.target_framework` + `build.runtime` from the OBSERVED impl (the one case where
|
|
222
|
+
the target is observed, not chosen). Cold → constructs from scratch; warm → emits the reconcile DELTA
|
|
223
|
+
against the existing spec. Returns a `HandoverBundle` carrying the draft/reconciled `agentspec.yaml` +
|
|
224
|
+
a change summary. Read files in full — do not guess from filenames.
|
|
225
|
+
3. **CONFIRM the draft with the operator.** AgentSpec surfaces every INFERRED field as a proposal
|
|
226
|
+
(AskUserQuestion / chat fallback) — the operator confirms or corrects. A reverse-generated draft is a
|
|
227
|
+
proposal, never a silent fact; the operator owns the final Definition (the same parent-session,
|
|
228
|
+
propose-don't-assume discipline as `*spec`).
|
|
229
|
+
4. **Emit + GATE + own.** AgentSpec writes `agentspec.yaml` (with `meta.loop_state.stage: spec`) and runs
|
|
230
|
+
`*validate-spec`. On FAIL, surface the field-pathed errors, fix the offending block, re-emit, re-gate.
|
|
231
|
+
On PASS, the reconciled spec is a trackable Definition AgentSpec OWNS — `*build` re-running against it
|
|
232
|
+
now cascade-updates the impl (def → impl, PR-001). When the sync yields spec WRITES that touch the
|
|
233
|
+
impl, `ai-engineer` applies them (gated).
|
|
234
|
+
5. **Reconcile the EVAL leg (the third leg, W2I5).** When `ai-architect`'s freshness probe flags the eval
|
|
235
|
+
leg (`driftedLegs` contains `eval` — the impl amended past the eval criteria), it also drafts an
|
|
236
|
+
eval-criteria reconcile delta for the applicable leg (eval-suite criteria for an agent/skill subject,
|
|
237
|
+
code-quality criteria for a code subject). AgentSpec surfaces the delta to the operator (propose,
|
|
238
|
+
don't assume) exactly as for a spec field, then the **evaluator's criteria-maintenance hook**
|
|
239
|
+
(`reconcileEvalCriteria`) COMPUTES the grown set under the gate — an append-only upsert that never drops a
|
|
240
|
+
criterion (EV-053) — and the **evaluator session PERSISTS** `result.criteria` to the located artifact
|
|
241
|
+
(`persist-eval-criteria.ts` `persistEvalCriteria` → `.mutagent/evaluator/living-suite/<leg>.criteria.json`).
|
|
242
|
+
The hook COMPUTES; the persist is the WRITE — and that write bumps the artifact's freshness, which is what
|
|
243
|
+
returns the eval leg to `in-sync`. This is criteria maintenance, NOT judging; the evaluator stays
|
|
244
|
+
judge-only (EV-051). The spec leg and the eval leg move together so def → impl → eval never falls out of
|
|
245
|
+
lockstep.
|
|
246
|
+
6. **Re-probe to confirm in-sync (closing self-heal).** After the gated writes land (spec via `ai-engineer`,
|
|
247
|
+
eval criteria via `persistEvalCriteria`), RE-RUN the freshness probe (`check-sync-spec.ts`) one final time.
|
|
248
|
+
The procedure only completes when it reports `in-sync` on every leg that drifted (`driftedLegs` empty);
|
|
249
|
+
`eval` still in `driftedLegs` means the criteria write was skipped or landed stale — the re-probe SURFACES
|
|
250
|
+
it so the persist can be re-run, rather than closing `*sync-spec` on an unpersisted (still-drifted) leg.
|
|
251
|
+
|
|
252
|
+
> **Scope (subject-agnostic).** `*sync-spec` reads an arbitrary implementation surface (via
|
|
253
|
+
> `ai-architect`); it embeds NO per-connector / per-app logic. The drift is detected by a deterministic
|
|
254
|
+
> code predicate (`check-sync-spec.ts`, spec + eval legs); the reconcile itself is `ai-architect`
|
|
255
|
+
> reasoning, session-dispatched (Model-B — code detects, the agent reconciles). Builder ALSO reuses
|
|
256
|
+
> `ai-architect #sync-spec` build-internally when it detects drift mid-`*build`.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## `*validate-spec` — the schema gate (script)
|
|
261
|
+
|
|
262
|
+
`kind: script` · `binds: scripts/validate/validate-spec.ts`. Reads a YAML spec path, parses it,
|
|
263
|
+
validates against the frozen `agentspec.v0.1.0` contract (`scripts/contract/agentspec.schema.ts`),
|
|
264
|
+
prints field-pathed errors + exits non-zero on failure, or `[validate-spec] PASS` + exit 0 on
|
|
265
|
+
success. The worked template (`assets/templates/agentspec.yaml.tpl`) is asserted valid by the
|
|
266
|
+
test suite — copy it as a starting point.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## `*build` — handoff to BUILD (`mutagent-builder`)
|
|
271
|
+
|
|
272
|
+
`mutagent-agentspec` validates and emits `agentspec.yaml`. The next explicit operator command is
|
|
273
|
+
`*build`, routed by Helix to `mutagent-builder`. BUILD consumes the validated Definition, reuses
|
|
274
|
+
`ai-architect #sync-spec` build-internally when it detects drift, dispatches `ai-engineer` /
|
|
275
|
+
`ai-architect`, runs TDD + spec implementation coverage, and emits the build report + EVALUATE handoff
|
|
276
|
+
bundle. (The `*sync-spec` COMMAND is now owned by `mutagent-agentspec` — it delegates the same
|
|
277
|
+
`ai-architect #sync-spec` read.)
|
|
278
|
+
|
|
279
|
+
Agentspec does **not** keep an executable build owner row, build agents, or coverage gate. Its boundary
|
|
280
|
+
ends at a schema-valid spec plus the handoff suggestion.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## `*eval` — eval-driven development handoff (OUTLINED — Wave-3)
|
|
285
|
+
|
|
286
|
+
> A designed FEATURE at the doc/protocol level only — never a code import (PR-018). `mutagent-agentspec`
|
|
287
|
+
> does NOT depend on an evaluator skill to run standalone.
|
|
288
|
+
|
|
289
|
+
**Shape:** hand the built agent + its `definition.evals.success_criteria` to an evaluator (the ADL
|
|
290
|
+
EVALUATE stage) for eval-driven development. The spec's success_criteria SEED the evaluator's
|
|
291
|
+
eval-matrix (link, don't duplicate). When composed via Helix, `*eval` routes to the evaluator
|
|
292
|
+
skill; standalone, agentspec emits the eval criteria + (optionally) a thin self-contained eval stub.
|
|
293
|
+
The triad (spec ↔ impl ↔ eval) stays in lockstep with auto-spec-correction (PR-011) — the mechanism
|
|
294
|
+
lands with this stage.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Loop position + transitions (PR-009)
|
|
299
|
+
|
|
300
|
+
The orchestrator KNOWS the next stage and proactively SUGGESTS it + renders loop position (read from
|
|
301
|
+
`meta.loop_state.stage`), but EVERY transition needs explicit operator confirmation. "Auto-orchestrate"
|
|
302
|
+
means suggest, never auto-run. Never auto-advance through a gate.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/cli/doctor.ts
|
|
3
|
+
* Runtime probe + JSON health report.
|
|
4
|
+
* Type A — Pure Script (deterministic environment inspection).
|
|
5
|
+
*
|
|
6
|
+
* Detects the JS runtime (bun | pnpm-tsx | npx-tsx | node), reports the SKILL.md version, the
|
|
7
|
+
* lock-file present in the skill root, and whether git is available. agentspec has NO external
|
|
8
|
+
* provider deps (no Langfuse/Google), so there is NO required-env-var probe — keeping doctor lean.
|
|
9
|
+
*
|
|
10
|
+
* Usage: scripts/cli/run.sh scripts/cli/doctor.ts
|
|
11
|
+
* Output: { runtime, version, lockFile, gitAvailable, errors[] }
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
15
|
+
import { execSync } from "node:child_process";
|
|
16
|
+
import { join, resolve } from "node:path";
|
|
17
|
+
|
|
18
|
+
export type DoctorRuntime = "bun" | "pnpm-tsx" | "npx-tsx" | "node";
|
|
19
|
+
|
|
20
|
+
export interface DoctorReport {
|
|
21
|
+
/** JS runtime executing this skill's scripts. */
|
|
22
|
+
runtime: DoctorRuntime;
|
|
23
|
+
/** Skill version string from SKILL.md frontmatter/metadata, or null if unreadable. */
|
|
24
|
+
version: string | null;
|
|
25
|
+
/** Lock-file detected in the skill root, or null. */
|
|
26
|
+
lockFile: string | null;
|
|
27
|
+
/** Whether `git` is available in PATH. */
|
|
28
|
+
gitAvailable: boolean;
|
|
29
|
+
/** Non-fatal warnings. Exit code is still 0. */
|
|
30
|
+
errors: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Detect the JS runtime executing this script.
|
|
35
|
+
* 1. Bun: process.versions.bun set under Bun.
|
|
36
|
+
* 2. pnpm-tsx: npm_config_user_agent starts with "pnpm".
|
|
37
|
+
* 3. npx-tsx: npm_execpath set (npm/npx).
|
|
38
|
+
* 4. node: bare node fallback.
|
|
39
|
+
*/
|
|
40
|
+
export function detectJsRuntime(): DoctorRuntime {
|
|
41
|
+
const versions = process.versions as Record<string, string | undefined>;
|
|
42
|
+
if (versions.bun) return "bun";
|
|
43
|
+
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
44
|
+
if (userAgent.startsWith("pnpm")) return "pnpm-tsx";
|
|
45
|
+
if (process.env.npm_execpath) return "npx-tsx";
|
|
46
|
+
return "node";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Read the skill version from SKILL.md (the `version:` key, possibly indented under `metadata:`).
|
|
51
|
+
* Returns null if SKILL.md is absent or the version field is missing.
|
|
52
|
+
* SKILL.md lives at <skill-root>/SKILL.md; this script is at <skill-root>/scripts/cli/doctor.ts.
|
|
53
|
+
*/
|
|
54
|
+
export function readSkillVersion(scriptDir: string): string | null {
|
|
55
|
+
const skillMd = resolve(scriptDir, "../..", "SKILL.md");
|
|
56
|
+
if (!existsSync(skillMd)) return null;
|
|
57
|
+
try {
|
|
58
|
+
const content = readFileSync(skillMd, "utf8");
|
|
59
|
+
const match = content.match(/^\s*version:\s*["']?([^"'\n\r]+?)["']?\s*$/m);
|
|
60
|
+
return match ? match[1].trim() : null;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Detect the first lock file present in `dir`. */
|
|
67
|
+
export function detectLockFile(dir: string): string | null {
|
|
68
|
+
const candidates = ["bun.lockb", "bun.lock", "pnpm-lock.yaml", "package-lock.json", "yarn.lock"];
|
|
69
|
+
for (const name of candidates) {
|
|
70
|
+
if (existsSync(join(dir, name))) return name;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Check whether `git` is available in PATH. */
|
|
76
|
+
export function checkGitAvailable(): boolean {
|
|
77
|
+
try {
|
|
78
|
+
execSync("git --version", { stdio: "ignore" });
|
|
79
|
+
return true;
|
|
80
|
+
} catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Run the full doctor probe and return a structured report. Never throws. */
|
|
86
|
+
export function runDoctor(): DoctorReport {
|
|
87
|
+
const errors: string[] = [];
|
|
88
|
+
const scriptDir = realpathSync(
|
|
89
|
+
import.meta.dirname ??
|
|
90
|
+
import.meta.url.replace(/^file:\/\//, "").replace(/\/[^/]+$/, ""),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const runtime = detectJsRuntime();
|
|
94
|
+
const version = readSkillVersion(scriptDir);
|
|
95
|
+
const lockFile = detectLockFile(resolve(scriptDir, "../.."));
|
|
96
|
+
const gitAvailable = checkGitAvailable();
|
|
97
|
+
|
|
98
|
+
if (!gitAvailable) {
|
|
99
|
+
errors.push("git not found in PATH — branch-hygiene operations will fail");
|
|
100
|
+
}
|
|
101
|
+
if (version === null) {
|
|
102
|
+
errors.push("Could not read SKILL.md version");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return { runtime, version, lockFile, gitAvailable, errors };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ── CLI entrypoint ────────────────────────────────────────────────────────────
|
|
109
|
+
const isMain =
|
|
110
|
+
typeof import.meta !== "undefined" &&
|
|
111
|
+
(import.meta as unknown as { main?: boolean }).main === true;
|
|
112
|
+
if (isMain) {
|
|
113
|
+
const report = runDoctor();
|
|
114
|
+
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/cli/init.ts
|
|
3
|
+
* LEAN cross-platform installer for mutagent-agentspec.
|
|
4
|
+
* Invoked as: pnpx @mutagent/agentspec init
|
|
5
|
+
*
|
|
6
|
+
* Wave-1 keeps this minimal — NO onboarding FSM (that is a later wave). init's whole job:
|
|
7
|
+
* 1. Detect installed coding-agent platforms via home markers (~/.claude, ~/.codex).
|
|
8
|
+
* 2. Copy the skill tree into the install target:
|
|
9
|
+
* project (DEFAULT) → <cwd>/.claude/skills/mutagent-agentspec (and .codex)
|
|
10
|
+
* global (--global) → ~/.claude/skills/mutagent-agentspec (and ~/.codex)
|
|
11
|
+
* 3. Copy the two shipped sub-agent contracts (assets/agents/*.md) into <target>/.claude/agents.
|
|
12
|
+
*
|
|
13
|
+
* cwd discipline: the SOURCE skill dir is resolved from import.meta (correct through any symlink
|
|
14
|
+
* chain); the install TARGET root is the user's invocation cwd (process.cwd()), NEVER the script
|
|
15
|
+
* dir — overriding it would install the skill into itself.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
existsSync,
|
|
20
|
+
readdirSync,
|
|
21
|
+
mkdirSync,
|
|
22
|
+
cpSync,
|
|
23
|
+
copyFileSync,
|
|
24
|
+
realpathSync,
|
|
25
|
+
} from "node:fs";
|
|
26
|
+
import { join, resolve } from "node:path";
|
|
27
|
+
import { homedir } from "node:os";
|
|
28
|
+
|
|
29
|
+
export type Scope = "project" | "global";
|
|
30
|
+
export type PlatformId = "claude-code" | "codex";
|
|
31
|
+
|
|
32
|
+
export interface DetectedPlatform {
|
|
33
|
+
id: PlatformId;
|
|
34
|
+
label: string;
|
|
35
|
+
/** Home marker probed to decide whether the platform exists on this machine. */
|
|
36
|
+
detectionMarker: string;
|
|
37
|
+
detected: boolean;
|
|
38
|
+
/** Where the skill tree is installed (follows scope). */
|
|
39
|
+
skillInstallPath: string;
|
|
40
|
+
/** Where the sub-agent .md files are installed (follows scope). */
|
|
41
|
+
agentsInstallPath: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PlatformInstallResult {
|
|
45
|
+
platform: PlatformId;
|
|
46
|
+
success: boolean;
|
|
47
|
+
steps: Array<{ step: string; ok: boolean; note: string }>;
|
|
48
|
+
errors: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Resolve install scope from argv. DEFAULT is project-local; `--global` opts into the home dir. */
|
|
52
|
+
export function resolveScope(argv: string[]): Scope {
|
|
53
|
+
return argv.includes("--global") ? "global" : "project";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Probe the filesystem for installed coding-agent platforms. Detection uses HOME markers (does the
|
|
58
|
+
* runtime exist on this machine?); the install TARGET follows `scope`:
|
|
59
|
+
* project (DEFAULT) → <cwd>/.claude|.codex/… global → <home>/.claude|.codex/…
|
|
60
|
+
*/
|
|
61
|
+
export function detectInstalledPlatforms(
|
|
62
|
+
cwd: string = process.cwd(),
|
|
63
|
+
scope: Scope = "project",
|
|
64
|
+
home: string = homedir(),
|
|
65
|
+
): DetectedPlatform[] {
|
|
66
|
+
const claudeRoot = scope === "global" ? join(home, ".claude") : join(cwd, ".claude");
|
|
67
|
+
const codexRoot = scope === "global" ? join(home, ".codex") : join(cwd, ".codex");
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
id: "claude-code",
|
|
71
|
+
label: "Claude Code",
|
|
72
|
+
detectionMarker: join(home, ".claude"),
|
|
73
|
+
detected: existsSync(join(home, ".claude")),
|
|
74
|
+
skillInstallPath: join(claudeRoot, "skills", "mutagent-agentspec"),
|
|
75
|
+
agentsInstallPath: join(claudeRoot, "agents"),
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "codex",
|
|
79
|
+
label: "Codex",
|
|
80
|
+
detectionMarker: join(home, ".codex"),
|
|
81
|
+
detected: existsSync(join(home, ".codex")),
|
|
82
|
+
skillInstallPath: join(codexRoot, "skills", "mutagent-agentspec"),
|
|
83
|
+
agentsInstallPath: join(codexRoot, "agents"),
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Install the skill + its sub-agent contracts to a single platform.
|
|
90
|
+
* Pure-ish: all filesystem effects are scoped to the platform's install paths; the source dir is
|
|
91
|
+
* injected so the function is testable against temp trees.
|
|
92
|
+
*/
|
|
93
|
+
export function installToPlatform(
|
|
94
|
+
platform: DetectedPlatform,
|
|
95
|
+
skillSourceDir: string,
|
|
96
|
+
force = false,
|
|
97
|
+
): PlatformInstallResult {
|
|
98
|
+
const result: PlatformInstallResult = {
|
|
99
|
+
platform: platform.id,
|
|
100
|
+
success: false,
|
|
101
|
+
steps: [],
|
|
102
|
+
errors: [],
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// ── Step 1: copy the skill tree ──────────────────────────────────────────────
|
|
106
|
+
const skillDest = platform.skillInstallPath;
|
|
107
|
+
try {
|
|
108
|
+
if (existsSync(skillDest) && !force) {
|
|
109
|
+
result.steps.push({
|
|
110
|
+
step: "copy-skill",
|
|
111
|
+
ok: true,
|
|
112
|
+
note: `Skill already exists at ${skillDest} (use --force to overwrite).`,
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
mkdirSync(skillDest, { recursive: true });
|
|
116
|
+
cpSync(skillSourceDir, skillDest, { recursive: true, force: true });
|
|
117
|
+
result.steps.push({ step: "copy-skill", ok: true, note: `Copied skill to ${skillDest}.` });
|
|
118
|
+
}
|
|
119
|
+
} catch (err) {
|
|
120
|
+
const msg = `Failed to copy skill to ${skillDest}: ${err instanceof Error ? err.message : String(err)}`;
|
|
121
|
+
result.steps.push({ step: "copy-skill", ok: false, note: msg });
|
|
122
|
+
result.errors.push(msg);
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ── Step 2: copy the shipped sub-agent contracts ─────────────────────────────
|
|
127
|
+
const agentsSrc = join(skillSourceDir, "assets", "agents");
|
|
128
|
+
const agentsDest = platform.agentsInstallPath;
|
|
129
|
+
try {
|
|
130
|
+
if (existsSync(agentsSrc)) {
|
|
131
|
+
const agentFiles = readdirSync(agentsSrc).filter((f) => f.endsWith(".md"));
|
|
132
|
+
mkdirSync(agentsDest, { recursive: true });
|
|
133
|
+
for (const f of agentFiles) {
|
|
134
|
+
copyFileSync(join(agentsSrc, f), join(agentsDest, f));
|
|
135
|
+
}
|
|
136
|
+
result.steps.push({
|
|
137
|
+
step: "install-agents",
|
|
138
|
+
ok: true,
|
|
139
|
+
note: `Installed ${agentFiles.length} sub-agent contract(s) to ${agentsDest}.`,
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
result.steps.push({ step: "install-agents", ok: true, note: "No assets/agents/ — skipped." });
|
|
143
|
+
}
|
|
144
|
+
} catch (err) {
|
|
145
|
+
const msg = `Failed to install agents to ${agentsDest}: ${err instanceof Error ? err.message : String(err)}`;
|
|
146
|
+
result.steps.push({ step: "install-agents", ok: false, note: msg });
|
|
147
|
+
result.errors.push(msg);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
result.success = result.errors.length === 0;
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ── Usage ─────────────────────────────────────────────────────────────────────
|
|
155
|
+
const USAGE = `
|
|
156
|
+
mutagent-agentspec init — cross-platform skill installer
|
|
157
|
+
|
|
158
|
+
USAGE
|
|
159
|
+
pnpx @mutagent/agentspec init [--global] [--yes] [--force]
|
|
160
|
+
|
|
161
|
+
INSTALL SCOPE
|
|
162
|
+
(default) PROJECT-LOCAL — install into the directory you ran init in:
|
|
163
|
+
Claude Code → <cwd>/.claude/… Codex → <cwd>/.codex/…
|
|
164
|
+
--global HOME DIR — install into ~/.claude/… and ~/.codex/…
|
|
165
|
+
|
|
166
|
+
OPTIONS
|
|
167
|
+
--global Install into the home dir instead of the project (default: project-local)
|
|
168
|
+
--yes Non-interactive: install to all detected platforms
|
|
169
|
+
--force Overwrite an existing skill install
|
|
170
|
+
--help Show this message
|
|
171
|
+
|
|
172
|
+
After install, open your coding agent and invoke the skill, then *spec to begin.
|
|
173
|
+
`.trim();
|
|
174
|
+
|
|
175
|
+
// ── CLI entrypoint ──────────────────────────────────────────────────────────────
|
|
176
|
+
const isMain =
|
|
177
|
+
typeof import.meta !== "undefined" &&
|
|
178
|
+
(import.meta as unknown as { main?: boolean }).main === true;
|
|
179
|
+
if (isMain) {
|
|
180
|
+
const argv = (typeof Bun !== "undefined" ? Bun.argv : process.argv).slice(2);
|
|
181
|
+
|
|
182
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
183
|
+
process.stdout.write(USAGE + "\n");
|
|
184
|
+
process.exit(0);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const scope = resolveScope(argv);
|
|
188
|
+
const force = argv.includes("--force");
|
|
189
|
+
const cwd = process.cwd();
|
|
190
|
+
|
|
191
|
+
// SOURCE skill dir = two levels up from scripts/cli/ (resolved through symlinks).
|
|
192
|
+
const scriptDir = realpathSync(
|
|
193
|
+
import.meta.dirname ??
|
|
194
|
+
import.meta.url.replace(/^file:\/\//, "").replace(/\/[^/]+$/, ""),
|
|
195
|
+
);
|
|
196
|
+
const skillDir = resolve(scriptDir, "..", "..");
|
|
197
|
+
|
|
198
|
+
const platforms = detectInstalledPlatforms(cwd, scope).filter((p) => p.detected);
|
|
199
|
+
if (platforms.length === 0) {
|
|
200
|
+
process.stderr.write(
|
|
201
|
+
"[init] No coding-agent platforms detected (~/.claude or ~/.codex).\n" +
|
|
202
|
+
" Install Claude Code or Codex first, then re-run init.\n",
|
|
203
|
+
);
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
process.stdout.write(
|
|
208
|
+
`[init] Install scope: ${scope}${scope === "project" ? ` (${cwd})` : " (home dir)"}\n`,
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
let anyFailure = false;
|
|
212
|
+
for (const platform of platforms) {
|
|
213
|
+
process.stdout.write(`\n[init] Installing to ${platform.label}...\n`);
|
|
214
|
+
const r = installToPlatform(platform, skillDir, force);
|
|
215
|
+
for (const step of r.steps) {
|
|
216
|
+
process.stdout.write(` ${step.ok ? "ok" : "FAIL"} ${step.step}: ${step.note}\n`);
|
|
217
|
+
}
|
|
218
|
+
if (r.success) {
|
|
219
|
+
process.stdout.write(`[init] ${platform.label}: install complete.\n`);
|
|
220
|
+
if (platform.id === "claude-code") {
|
|
221
|
+
process.stdout.write(" Restart your Claude Code session, then invoke *spec.\n");
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
process.stderr.write(`[init] ${platform.label}: FAILED — ${r.errors.join("; ")}\n`);
|
|
225
|
+
anyFailure = true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
process.exit(anyFailure ? 1 : 0);
|
|
230
|
+
}
|