mirai-graph 1.0.0-rc.1
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/CHANGELOG.md +376 -0
- package/CITATION.cff +20 -0
- package/LICENSE +21 -0
- package/LICENSE-DOCS +26 -0
- package/README.md +270 -0
- package/ROADMAP.md +225 -0
- package/benchmarks/protocols/measure-convert-optimize.md +131 -0
- package/benchmarks/synthetic-context-reduction-v0/README.md +70 -0
- package/benchmarks/synthetic-context-reduction-v0/RESULT.md +52 -0
- package/benchmarks/synthetic-context-reduction-v0/expected/context-pack-compact.md +31 -0
- package/benchmarks/synthetic-context-reduction-v0/gates/results.json +12 -0
- package/benchmarks/synthetic-context-reduction-v0/graph/objects.json +114 -0
- package/benchmarks/synthetic-context-reduction-v0/graph/relations.json +74 -0
- package/benchmarks/synthetic-context-reduction-v0/metrics/example-metrics.json +22 -0
- package/benchmarks/synthetic-context-reduction-v0/mirai-graph-package.json +14 -0
- package/benchmarks/synthetic-context-reduction-v0/results/baseline-comparison-result.json +42 -0
- package/benchmarks/synthetic-context-reduction-v0/results/context-pack.json +181 -0
- package/benchmarks/synthetic-context-reduction-v0/results/context-reduction-result.json +8 -0
- package/benchmarks/synthetic-context-reduction-v0/results/profile-conformance-result.json +28 -0
- package/benchmarks/synthetic-context-reduction-v0/results/readiness-score.json +24 -0
- package/benchmarks/synthetic-context-reduction-v0/reviews/semantic-completeness-review.json +78 -0
- package/benchmarks/synthetic-context-reduction-v0/scripts/calculate-context-reduction.js +42 -0
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/audit-events.md +8 -0
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/content-workflow.md +8 -0
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/identity-access.md +8 -0
- package/benchmarks/synthetic-context-reduction-v0/source-corpus/notification-delivery.md +8 -0
- package/benchmarks/synthetic-context-reduction-v0/tasks/tasks.json +31 -0
- package/docs/adoption/adopter-kit.md +179 -0
- package/docs/adoption/ai-employee-graph.md +151 -0
- package/docs/adoption/character-layer.md +196 -0
- package/docs/adoption/choose-profile.md +98 -0
- package/docs/adoption/cli.md +78 -0
- package/docs/adoption/developer-integration-guide.md +93 -0
- package/docs/adoption/end-to-end-control-loop.md +168 -0
- package/docs/adoption/getting-started.md +169 -0
- package/docs/adoption/mirai-graph-transition.md +64 -0
- package/docs/adoption/profile-conformance-fixtures.md +112 -0
- package/docs/adoption/seed-to-validated-package.md +121 -0
- package/docs/concept.md +109 -0
- package/docs/repository-purpose.md +421 -0
- package/docs/research/ai-work-field-instrumentation-bridge.md +126 -0
- package/docs/research/baseline-comparison-protocol.md +79 -0
- package/docs/research/evidence-package-v0.1.md +99 -0
- package/docs/research/evidence-package-v0.2.md +150 -0
- package/docs/research/evidence-package-v0.3.md +226 -0
- package/docs/research/independent-implementation-pilot-plan.md +74 -0
- package/docs/research/limitations-and-threats.md +40 -0
- package/docs/research/practice-science-program.md +232 -0
- package/docs/research/scientific-evidence-package.md +154 -0
- package/docs/research/semantic-completeness-review-protocol.md +70 -0
- package/docs/terminology.md +119 -0
- package/docs/transfer/ai-employee-profile-proposal.md +119 -0
- package/docs/transfer/federation-routing-control-loop-2026-05-31.md +28 -0
- package/docs/transfer/graph-capability-map-2026-05-29.md +126 -0
- package/docs/transfer/graph-skill-to-mirai-graph.md +128 -0
- package/docs/transfer/project-management-standard-harvest-2026-06-02.md +322 -0
- package/docs/transfer/skill-graph-standard-harvest-2026-05-31.md +113 -0
- package/docs/transfer/standard-gap-report-2026-05-28.md +208 -0
- package/examples/ai-employee-minimal/README.md +53 -0
- package/examples/ai-employee-minimal/gates/results.json +35 -0
- package/examples/ai-employee-minimal/graph/objects.json +187 -0
- package/examples/ai-employee-minimal/graph/relations.json +167 -0
- package/examples/ai-employee-minimal/mirai-graph-package.json +14 -0
- package/examples/ai-employee-minimal/results/profile-conformance-result.json +28 -0
- package/examples/character-layer-integration-minimal/README.md +25 -0
- package/examples/character-layer-integration-minimal/results/character-layer-integration.json +53 -0
- package/examples/character-layer-minimal/README.md +29 -0
- package/examples/character-layer-minimal/gates/results.json +57 -0
- package/examples/character-layer-minimal/graph/objects.json +165 -0
- package/examples/character-layer-minimal/graph/relations.json +178 -0
- package/examples/character-layer-minimal/mirai-graph-package.json +14 -0
- package/examples/character-layer-readiness-1-0/README.md +27 -0
- package/examples/character-layer-readiness-1-0/results/character-layer-readiness.json +90 -0
- package/examples/federation-routing-smoke/README.md +19 -0
- package/examples/federation-routing-smoke/federation-health-dashboard.json +42 -0
- package/examples/federation-routing-smoke/route-explanation.json +32 -0
- package/examples/federation-routing-smoke/route-regression-result.json +35 -0
- package/examples/federation-routing-smoke/routes/production-deploy-execution-evidence.json +17 -0
- package/examples/federation-routing-smoke/routes/production-deploy-route-result.json +12 -0
- package/examples/federation-routing-smoke/routes/production-deploy-runtime-preflight.json +8 -0
- package/examples/federation-routing-smoke/routes/production-deploy-stderr.txt +1 -0
- package/examples/federation-routing-smoke/routes/production-deploy-stdout.txt +1 -0
- package/examples/federation-routing-smoke/routes/search-page-execution-evidence.json +17 -0
- package/examples/federation-routing-smoke/routes/search-page-route-result.json +12 -0
- package/examples/federation-routing-smoke/routes/search-page-stderr.txt +1 -0
- package/examples/federation-routing-smoke/routes/search-page-stdout.txt +1 -0
- package/examples/federation-routing-smoke/routing-fixture-run.json +66 -0
- package/examples/federation-routing-smoke/routing-fixtures.json +44 -0
- package/examples/graph-dna-alignment-minimal/README.md +16 -0
- package/examples/graph-dna-alignment-minimal/graph/objects.json +38 -0
- package/examples/graph-dna-alignment-minimal/graph/relations.json +20 -0
- package/examples/graph-dna-alignment-minimal/mirai-graph-package.json +14 -0
- package/examples/graph-dna-alignment-minimal/results/graph-dna-alignment.json +32 -0
- package/examples/graph-seed-minimal/README.md +9 -0
- package/examples/graph-seed-minimal/graph-embryo.json +63 -0
- package/examples/graph-seed-minimal/graph-seed.json +60 -0
- package/examples/implementation-control-cycles/README.md +47 -0
- package/examples/implementation-control-cycles/gates/results.json +22 -0
- package/examples/implementation-control-cycles/graph/objects.json +119 -0
- package/examples/implementation-control-cycles/graph/relations.json +200 -0
- package/examples/implementation-control-cycles/mirai-graph-package.json +14 -0
- package/examples/implementation-control-cycles/results/implementation-control-cycles.json +456 -0
- package/examples/implementation-control-minimal/README.md +39 -0
- package/examples/implementation-control-minimal/gates/results.json +42 -0
- package/examples/implementation-control-minimal/graph/objects.json +128 -0
- package/examples/implementation-control-minimal/graph/relations.json +128 -0
- package/examples/implementation-control-minimal/mirai-graph-package.json +14 -0
- package/examples/implementation-control-minimal/results/implementation-control-loop.json +21 -0
- package/examples/instrumentation-layer-minimal/README.md +32 -0
- package/examples/instrumentation-layer-minimal/gates/results.json +11 -0
- package/examples/instrumentation-layer-minimal/graph/objects.json +74 -0
- package/examples/instrumentation-layer-minimal/graph/relations.json +56 -0
- package/examples/instrumentation-layer-minimal/invalid-cockpit-missing-gates.json +40 -0
- package/examples/instrumentation-layer-minimal/invalid-feedback-accepted-with-blocking.json +38 -0
- package/examples/instrumentation-layer-minimal/invalid-feedback-process-improvement-without-kaizen.json +38 -0
- package/examples/instrumentation-layer-minimal/invalid-traceability-missing-evidence.json +43 -0
- package/examples/instrumentation-layer-minimal/mirai-graph-package.json +14 -0
- package/examples/instrumentation-layer-minimal/results/development-cockpit.json +68 -0
- package/examples/instrumentation-layer-minimal/results/feature-implementation-traceability.json +56 -0
- package/examples/instrumentation-layer-minimal/results/multi-source-quality-feedback.json +72 -0
- package/examples/invalid-character-layer-context-authorization/graph/objects.json +22 -0
- package/examples/invalid-character-layer-context-authorization/graph/relations.json +1 -0
- package/examples/invalid-character-layer-context-authorization/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-correction-loop-no-review/graph/objects.json +22 -0
- package/examples/invalid-character-layer-correction-loop-no-review/graph/relations.json +1 -0
- package/examples/invalid-character-layer-correction-loop-no-review/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-feedback-auto-update/graph/objects.json +22 -0
- package/examples/invalid-character-layer-feedback-auto-update/graph/relations.json +1 -0
- package/examples/invalid-character-layer-feedback-auto-update/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-object-kind/graph/objects.json +22 -0
- package/examples/invalid-character-layer-object-kind/graph/relations.json +1 -0
- package/examples/invalid-character-layer-object-kind/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-relation-direction/graph/objects.json +33 -0
- package/examples/invalid-character-layer-relation-direction/graph/relations.json +13 -0
- package/examples/invalid-character-layer-relation-direction/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-relation-type/graph/objects.json +33 -0
- package/examples/invalid-character-layer-relation-type/graph/relations.json +13 -0
- package/examples/invalid-character-layer-relation-type/mirai-graph-package.json +14 -0
- package/examples/invalid-character-layer-role-permission/graph/objects.json +22 -0
- package/examples/invalid-character-layer-role-permission/graph/relations.json +1 -0
- package/examples/invalid-character-layer-role-permission/mirai-graph-package.json +14 -0
- package/examples/invalid-context-pack-missing-explanation/context-pack.json +25 -0
- package/examples/invalid-missing-relation-target/graph/objects.json +11 -0
- package/examples/invalid-missing-relation-target/graph/relations.json +11 -0
- package/examples/invalid-missing-relation-target/mirai-graph-package.json +11 -0
- package/examples/invalid-profile-object-kind/graph/objects.json +20 -0
- package/examples/invalid-profile-object-kind/graph/relations.json +1 -0
- package/examples/invalid-profile-object-kind/mirai-graph-package.json +11 -0
- package/examples/invalid-profile-relation-type/graph/objects.json +29 -0
- package/examples/invalid-profile-relation-type/graph/relations.json +11 -0
- package/examples/invalid-profile-relation-type/mirai-graph-package.json +11 -0
- package/examples/invalid-relation-id-mismatch/graph/objects.json +29 -0
- package/examples/invalid-relation-id-mismatch/graph/relations.json +11 -0
- package/examples/invalid-relation-id-mismatch/mirai-graph-package.json +11 -0
- package/examples/invalid-seed-unsafe-write/graph-seed.json +27 -0
- package/examples/launch-record-minimal/README.md +29 -0
- package/examples/launch-record-minimal/gates/results.json +12 -0
- package/examples/launch-record-minimal/graph/objects.json +47 -0
- package/examples/launch-record-minimal/graph/relations.json +38 -0
- package/examples/launch-record-minimal/mirai-graph-package.json +11 -0
- package/examples/launch-record-minimal/results/launch-record.json +51 -0
- package/examples/managed-project-control-loop/README.md +43 -0
- package/examples/managed-project-control-loop/gates/results.json +22 -0
- package/examples/managed-project-control-loop/graph/objects.json +119 -0
- package/examples/managed-project-control-loop/graph/relations.json +110 -0
- package/examples/managed-project-control-loop/mirai-graph-package.json +14 -0
- package/examples/managed-project-control-loop/results/managed-loop-result.json +21 -0
- package/examples/minimal-graph/README.md +15 -0
- package/examples/minimal-graph/gates/results.json +12 -0
- package/examples/minimal-graph/graph/objects.json +24 -0
- package/examples/minimal-graph/graph/relations.json +11 -0
- package/examples/minimal-graph/mirai-graph-package.json +14 -0
- package/examples/minimal-graph/results/profile-conformance-result.json +26 -0
- package/examples/model-portability-minimal/README.md +15 -0
- package/examples/model-portability-minimal/results/model-portability-evidence.json +55 -0
- package/examples/organization-governance-minimal/README.md +29 -0
- package/examples/organization-governance-minimal/gates/results.json +21 -0
- package/examples/organization-governance-minimal/graph/objects.json +147 -0
- package/examples/organization-governance-minimal/graph/relations.json +147 -0
- package/examples/organization-governance-minimal/mirai-graph-package.json +15 -0
- package/examples/organization-governance-minimal/results/profile-conformance-result.json +31 -0
- package/examples/process-control-contract-minimal/README.md +19 -0
- package/examples/process-control-contract-minimal/graph/objects.json +38 -0
- package/examples/process-control-contract-minimal/graph/relations.json +29 -0
- package/examples/process-control-contract-minimal/mirai-graph-package.json +11 -0
- package/examples/process-control-contract-minimal/results/process-control-contract.json +58 -0
- package/examples/process-transition-minimal/README.md +25 -0
- package/examples/process-transition-minimal/invalid-missing-launch-record.json +14 -0
- package/examples/process-transition-minimal/invalid-ready-to-written.json +14 -0
- package/examples/process-transition-minimal/invalid-release-missing-evidence.json +14 -0
- package/examples/process-transition-minimal/invalid-sync-to-update.json +14 -0
- package/examples/process-transition-minimal/invalid-terminal-missing-kaizen.json +14 -0
- package/examples/process-transition-minimal/invalid-tests-to-approved.json +14 -0
- package/examples/process-transition-minimal/results/transition-explanation-invalid-ready-to-written.json +35 -0
- package/examples/process-transition-minimal/results/transition-explanation-valid.json +34 -0
- package/examples/process-transition-minimal/state-machine.json +79 -0
- package/examples/process-transition-minimal/transition-request-skip-kaizen.json +14 -0
- package/examples/process-transition-minimal/transition-request.json +14 -0
- package/examples/risk-and-coordination-minimal/README.md +16 -0
- package/examples/risk-and-coordination-minimal/graph/objects.json +47 -0
- package/examples/risk-and-coordination-minimal/graph/relations.json +29 -0
- package/examples/risk-and-coordination-minimal/mirai-graph-package.json +14 -0
- package/examples/risk-and-coordination-minimal/results/multi-agent-coordination.json +25 -0
- package/examples/risk-and-coordination-minimal/results/risk-control-matrix.json +34 -0
- package/examples/skill-runtime-minimal/README.md +29 -0
- package/examples/skill-runtime-minimal/gates/results.json +35 -0
- package/examples/skill-runtime-minimal/graph/objects.json +209 -0
- package/examples/skill-runtime-minimal/graph/relations.json +178 -0
- package/examples/skill-runtime-minimal/mirai-graph-package.json +14 -0
- package/examples/skill-runtime-minimal/results/profile-conformance-result.json +27 -0
- package/examples/source-boundary-minimal/README.md +16 -0
- package/examples/source-boundary-minimal/graph/objects.json +38 -0
- package/examples/source-boundary-minimal/graph/relations.json +20 -0
- package/examples/source-boundary-minimal/mirai-graph-package.json +14 -0
- package/examples/source-boundary-minimal/results/source-boundary-contract.json +37 -0
- package/examples/technology-quality-feedback-minimal/README.md +33 -0
- package/examples/technology-quality-feedback-minimal/graph/objects.json +56 -0
- package/examples/technology-quality-feedback-minimal/graph/relations.json +47 -0
- package/examples/technology-quality-feedback-minimal/invalid-accepted-with-blocking.json +33 -0
- package/examples/technology-quality-feedback-minimal/invalid-evidence-as-authorization.json +22 -0
- package/examples/technology-quality-feedback-minimal/invalid-missing-required-step.json +22 -0
- package/examples/technology-quality-feedback-minimal/invalid-process-improvement-without-kaizen.json +33 -0
- package/examples/technology-quality-feedback-minimal/invalid-spec-gap-without-route.json +33 -0
- package/examples/technology-quality-feedback-minimal/invalid-unclassified-finding.json +33 -0
- package/examples/technology-quality-feedback-minimal/mirai-graph-package.json +11 -0
- package/examples/technology-quality-feedback-minimal/results/technology-quality-feedback.json +80 -0
- package/examples/work-recovery-minimal/README.md +15 -0
- package/examples/work-recovery-minimal/graph/objects.json +47 -0
- package/examples/work-recovery-minimal/graph/relations.json +20 -0
- package/examples/work-recovery-minimal/mirai-graph-package.json +14 -0
- package/examples/work-recovery-minimal/results/recovery-resume-record.json +17 -0
- package/examples/work-recovery-minimal/results/work-state-machine.json +21 -0
- package/package.json +104 -0
- package/packages/cli/adopter-workflow.js +227 -0
- package/packages/cli/context-pack.js +267 -0
- package/packages/cli/instrumentation-report.js +97 -0
- package/packages/cli/mirai-graph.js +121 -0
- package/packages/cli/mirai_graph.js +3 -0
- package/packages/cli/playground-demo.js +114 -0
- package/packages/cli/readiness-score.js +162 -0
- package/packages/cli/release-state.js +329 -0
- package/packages/cli/seed-preview.js +78 -0
- package/packages/cli/validate-adopter-workflow.js +63 -0
- package/packages/cli/validate-baseline-comparison.js +105 -0
- package/packages/cli/validate-mirai-graph.js +2434 -0
- package/packages/cli/validate-process-transition-report.js +105 -0
- package/packages/cli/validate-profile-results.js +64 -0
- package/packages/cli/validate-release-state.js +100 -0
- package/packages/cli/validate-routing-control-examples.js +79 -0
- package/pilots/independent-implementation-001-conference-planning/README.md +40 -0
- package/pilots/independent-implementation-001-conference-planning/gates/results.json +12 -0
- package/pilots/independent-implementation-001-conference-planning/graph/objects.json +74 -0
- package/pilots/independent-implementation-001-conference-planning/graph/relations.json +56 -0
- package/pilots/independent-implementation-001-conference-planning/graph-seed.json +65 -0
- package/pilots/independent-implementation-001-conference-planning/mirai-graph-package.json +14 -0
- package/pilots/independent-implementation-001-conference-planning/reports/pilot-report.md +120 -0
- package/pilots/independent-implementation-001-conference-planning/results/context-pack.json +35 -0
- package/pilots/independent-implementation-001-conference-planning/results/graph-embryo.json +81 -0
- package/pilots/independent-implementation-001-conference-planning/results/package-validation.json +7 -0
- package/pilots/independent-implementation-001-conference-planning/results/profile-conformance-result.json +28 -0
- package/pilots/independent-implementation-001-conference-planning/results/readiness-score.json +26 -0
- package/pilots/independent-implementation-001-conference-planning/results/seed-validation.json +7 -0
- package/pilots/independent-implementation-002-software-specification/README.md +40 -0
- package/pilots/independent-implementation-002-software-specification/gates/results.json +22 -0
- package/pilots/independent-implementation-002-software-specification/graph/objects.json +101 -0
- package/pilots/independent-implementation-002-software-specification/graph/relations.json +92 -0
- package/pilots/independent-implementation-002-software-specification/graph-seed.json +72 -0
- package/pilots/independent-implementation-002-software-specification/mirai-graph-package.json +14 -0
- package/pilots/independent-implementation-002-software-specification/reports/pilot-report.md +142 -0
- package/pilots/independent-implementation-002-software-specification/results/context-pack.json +184 -0
- package/pilots/independent-implementation-002-software-specification/results/graph-embryo.json +90 -0
- package/pilots/independent-implementation-002-software-specification/results/package-validation.json +7 -0
- package/pilots/independent-implementation-002-software-specification/results/profile-conformance-result.json +28 -0
- package/pilots/independent-implementation-002-software-specification/results/readiness-score.json +26 -0
- package/pilots/independent-implementation-002-software-specification/results/seed-validation.json +7 -0
- package/pilots/independent-implementation-002-software-specification/reviews/semantic-completeness-review.json +81 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/README.md +42 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/gates/results.json +30 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/graph/objects.json +156 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/graph/relations.json +147 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/graph-seed.json +90 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/mirai-graph-package.json +15 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/reports/pilot-report.md +49 -0
- package/pilots/independent-implementation-003-ai-employee-workflow/results/profile-conformance-result.json +30 -0
- package/pilots/independent-implementation-004-research-program/README.md +41 -0
- package/pilots/independent-implementation-004-research-program/gates/results.json +21 -0
- package/pilots/independent-implementation-004-research-program/graph/objects.json +102 -0
- package/pilots/independent-implementation-004-research-program/graph/relations.json +84 -0
- package/pilots/independent-implementation-004-research-program/graph-seed.json +76 -0
- package/pilots/independent-implementation-004-research-program/mirai-graph-package.json +15 -0
- package/pilots/independent-implementation-004-research-program/reports/pilot-report.md +50 -0
- package/pilots/independent-implementation-004-research-program/results/profile-conformance-result.json +30 -0
- package/pilots/independent-implementation-005-organization-governance/README.md +42 -0
- package/pilots/independent-implementation-005-organization-governance/gates/results.json +20 -0
- package/pilots/independent-implementation-005-organization-governance/graph/objects.json +137 -0
- package/pilots/independent-implementation-005-organization-governance/graph/relations.json +110 -0
- package/pilots/independent-implementation-005-organization-governance/graph-seed.json +97 -0
- package/pilots/independent-implementation-005-organization-governance/mirai-graph-package.json +14 -0
- package/pilots/independent-implementation-005-organization-governance/reports/pilot-report.md +47 -0
- package/pilots/independent-implementation-005-organization-governance/results/profile-conformance-result.json +29 -0
- package/playground/README.md +78 -0
- package/playground/demo-report.md +84 -0
- package/profiles/README.md +19 -0
- package/profiles/ai-employee/README.md +132 -0
- package/profiles/ai-employee/profile.json +58 -0
- package/profiles/character-layer/README.md +143 -0
- package/profiles/character-layer/profile.json +46 -0
- package/profiles/implementation-control/README.md +170 -0
- package/profiles/implementation-control/profile.json +106 -0
- package/profiles/organization-governance/README.md +61 -0
- package/profiles/organization-governance/profile.json +56 -0
- package/profiles/project-management/README.md +115 -0
- package/profiles/project-management/profile.json +31 -0
- package/profiles/skill-runtime/README.md +94 -0
- package/profiles/skill-runtime/profile.json +58 -0
- package/profiles/software-specification/README.md +142 -0
- package/profiles/software-specification/profile.json +31 -0
- package/publications/README.md +24 -0
- package/publications/preprint-note.md +11 -0
- package/publications/preprint-outline.md +45 -0
- package/releases/0.1.0-alpha.0.md +45 -0
- package/releases/0.1.0-alpha.1.md +63 -0
- package/releases/0.1.0-alpha.10.md +93 -0
- package/releases/0.1.0-alpha.11.md +114 -0
- package/releases/0.1.0-alpha.2.md +37 -0
- package/releases/0.1.0-alpha.3.md +61 -0
- package/releases/0.1.0-alpha.4.md +53 -0
- package/releases/0.1.0-alpha.5.md +48 -0
- package/releases/0.1.0-alpha.6.md +96 -0
- package/releases/0.1.0-alpha.7.md +114 -0
- package/releases/0.1.0-alpha.8.md +92 -0
- package/releases/0.1.0-alpha.9.md +80 -0
- package/releases/1.0.0-rc.1.md +112 -0
- package/releases/README.md +114 -0
- package/schemas/baseline-comparison-result.schema.json +87 -0
- package/schemas/character-layer-integration.schema.json +112 -0
- package/schemas/character-layer-readiness.schema.json +73 -0
- package/schemas/context-pack.schema.json +137 -0
- package/schemas/development-cockpit.schema.json +74 -0
- package/schemas/feature-implementation-traceability.schema.json +80 -0
- package/schemas/federation-health-dashboard.schema.json +47 -0
- package/schemas/gate-result.schema.json +44 -0
- package/schemas/graph-dna-alignment.schema.json +49 -0
- package/schemas/graph-embryo.schema.json +51 -0
- package/schemas/graph-seed.schema.json +137 -0
- package/schemas/implementation-control-cycle.schema.json +265 -0
- package/schemas/implementation-control-loop.schema.json +84 -0
- package/schemas/launch-record.schema.json +78 -0
- package/schemas/model-portability-evidence.schema.json +93 -0
- package/schemas/multi-agent-coordination.schema.json +35 -0
- package/schemas/multi-source-quality-feedback.schema.json +54 -0
- package/schemas/object.schema.json +49 -0
- package/schemas/package-manifest.schema.json +53 -0
- package/schemas/process-control-contract.schema.json +100 -0
- package/schemas/process-transition-request.schema.json +41 -0
- package/schemas/profile.schema.json +56 -0
- package/schemas/readiness-score.schema.json +43 -0
- package/schemas/recovery-resume-record.schema.json +25 -0
- package/schemas/relation.schema.json +43 -0
- package/schemas/risk-control-matrix.schema.json +36 -0
- package/schemas/route-explanation.schema.json +51 -0
- package/schemas/route-regression-result.schema.json +33 -0
- package/schemas/routing-fixture-run.schema.json +45 -0
- package/schemas/routing-fixtures.schema.json +59 -0
- package/schemas/source-boundary-contract.schema.json +31 -0
- package/schemas/technology-quality-feedback.schema.json +116 -0
- package/schemas/work-state-machine.schema.json +34 -0
- package/standard/action-runtime-boundary.md +99 -0
- package/standard/adoption-levels.md +69 -0
- package/standard/conformance-levels.md +133 -0
- package/standard/context-pack-generation.md +141 -0
- package/standard/development-cockpit.md +67 -0
- package/standard/evidence-provenance.md +128 -0
- package/standard/feature-implementation-traceability.md +68 -0
- package/standard/federation-health.md +42 -0
- package/standard/feedback-learning-gate.md +101 -0
- package/standard/governance.md +137 -0
- package/standard/graph-as-ai-brain.md +81 -0
- package/standard/graph-dna-alignment.md +50 -0
- package/standard/graph-dna.md +70 -0
- package/standard/graph-embryo.md +69 -0
- package/standard/graph-seed.md +122 -0
- package/standard/hybrid-source-of-truth.md +91 -0
- package/standard/implementation-control-cycles.md +194 -0
- package/standard/implementation-control.md +102 -0
- package/standard/launch-record.md +53 -0
- package/standard/lifecycle-readiness.md +159 -0
- package/standard/multi-agent-coordination.md +50 -0
- package/standard/multi-source-quality-feedback.md +71 -0
- package/standard/object-model.md +152 -0
- package/standard/organization-governance.md +84 -0
- package/standard/process-control-contract.md +53 -0
- package/standard/profiles.md +233 -0
- package/standard/projection-views.md +69 -0
- package/standard/recovery-resume.md +49 -0
- package/standard/relation-model.md +139 -0
- package/standard/risk-control-matrix.md +53 -0
- package/standard/route-explanation.md +35 -0
- package/standard/route-regression.md +33 -0
- package/standard/routing-fixtures.md +54 -0
- package/standard/runtime-enablement.md +85 -0
- package/standard/source-boundary-contract.md +49 -0
- package/standard/standard-v0.1.md +132 -0
- package/standard/technology-quality-feedback.md +97 -0
- package/standard/test-suite.md +105 -0
- package/standard/work-state-machine.md +62 -0
- package/templates/README.md +64 -0
- package/templates/ai-employee-starter/README.md +9 -0
- package/templates/ai-employee-starter/gates/results.json +12 -0
- package/templates/ai-employee-starter/graph/objects.json +90 -0
- package/templates/ai-employee-starter/graph/relations.json +47 -0
- package/templates/ai-employee-starter/mirai-graph-package.json +14 -0
- package/templates/character-layer-starter/README.md +39 -0
- package/templates/character-layer-starter/gates/results.json +20 -0
- package/templates/character-layer-starter/graph/objects.json +308 -0
- package/templates/character-layer-starter/graph/relations.json +344 -0
- package/templates/character-layer-starter/mirai-graph-package.json +14 -0
- package/templates/organization-governance-starter/README.md +9 -0
- package/templates/organization-governance-starter/gates/results.json +12 -0
- package/templates/organization-governance-starter/graph/objects.json +112 -0
- package/templates/organization-governance-starter/graph/relations.json +65 -0
- package/templates/organization-governance-starter/mirai-graph-package.json +14 -0
- package/templates/research-program-starter/README.md +9 -0
- package/templates/research-program-starter/gates/results.json +12 -0
- package/templates/research-program-starter/graph/objects.json +79 -0
- package/templates/research-program-starter/graph/relations.json +47 -0
- package/templates/research-program-starter/mirai-graph-package.json +14 -0
- package/templates/software-project-starter/README.md +9 -0
- package/templates/software-project-starter/gates/results.json +12 -0
- package/templates/software-project-starter/graph/objects.json +79 -0
- package/templates/software-project-starter/graph/relations.json +47 -0
- package/templates/software-project-starter/mirai-graph-package.json +14 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const root = path.resolve(__dirname, "..", "..");
|
|
7
|
+
|
|
8
|
+
const profiles = [
|
|
9
|
+
{
|
|
10
|
+
role: "developer",
|
|
11
|
+
aliases: ["developer", "software", "software_specification", "engineer"],
|
|
12
|
+
profile: "software_specification",
|
|
13
|
+
starter: "templates/software-project-starter",
|
|
14
|
+
useWhen: "features, requirements, components, implementation tasks and technical risks",
|
|
15
|
+
nextCommands: [
|
|
16
|
+
"node packages/cli/mirai-graph.js validate templates/software-project-starter",
|
|
17
|
+
"node packages/cli/mirai-graph.js report validation templates/software-project-starter",
|
|
18
|
+
"node packages/cli/mirai-graph.js adopter report templates/software-project-starter"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
role: "researcher",
|
|
23
|
+
aliases: ["researcher", "research", "science", "project_management"],
|
|
24
|
+
profile: "project_management",
|
|
25
|
+
starter: "templates/research-program-starter",
|
|
26
|
+
useWhen: "hypotheses, evidence, milestones, review gates and publication risks",
|
|
27
|
+
nextCommands: [
|
|
28
|
+
"node packages/cli/mirai-graph.js validate templates/research-program-starter",
|
|
29
|
+
"node packages/cli/mirai-graph.js report validation templates/research-program-starter",
|
|
30
|
+
"node packages/cli/mirai-graph.js adopter report templates/research-program-starter"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
role: "ai-employee",
|
|
35
|
+
aliases: ["ai-employee", "ai_employee", "agent", "ai", "employee"],
|
|
36
|
+
profile: "ai_employee",
|
|
37
|
+
starter: "templates/ai-employee-starter",
|
|
38
|
+
useWhen: "AI worker roles, skills, tools, policies, actions, feedback and learning gates",
|
|
39
|
+
nextCommands: [
|
|
40
|
+
"node packages/cli/mirai-graph.js validate templates/ai-employee-starter",
|
|
41
|
+
"node packages/cli/mirai-graph.js report validation templates/ai-employee-starter",
|
|
42
|
+
"node packages/cli/mirai-graph.js adopter report templates/ai-employee-starter"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
role: "character-layer",
|
|
47
|
+
aliases: ["character-layer", "character_layer", "character", "behavior", "behaviour", "behavior-governance"],
|
|
48
|
+
profile: "character_layer",
|
|
49
|
+
starter: "templates/character-layer-starter",
|
|
50
|
+
useWhen: "behavior constitution, role character profiles, reflection, violation patterns and correction loops",
|
|
51
|
+
nextCommands: [
|
|
52
|
+
"node packages/cli/mirai-graph.js validate templates/character-layer-starter",
|
|
53
|
+
"node packages/cli/mirai-graph.js report validation templates/character-layer-starter",
|
|
54
|
+
"node packages/cli/mirai-graph.js adopter report templates/character-layer-starter"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
role: "organization",
|
|
59
|
+
aliases: ["organization", "org", "governance", "organization_governance"],
|
|
60
|
+
profile: "organization_governance",
|
|
61
|
+
starter: "templates/organization-governance-starter",
|
|
62
|
+
useWhen: "mission, strategy, departments, programs, policies, controls and metrics",
|
|
63
|
+
nextCommands: [
|
|
64
|
+
"node packages/cli/mirai-graph.js validate templates/organization-governance-starter",
|
|
65
|
+
"node packages/cli/mirai-graph.js report validation templates/organization-governance-starter",
|
|
66
|
+
"node packages/cli/mirai-graph.js adopter report templates/organization-governance-starter"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
function usage() {
|
|
72
|
+
console.error("Usage:");
|
|
73
|
+
console.error(" adopter-workflow choose-profile");
|
|
74
|
+
console.error(" adopter-workflow plan <role-or-profile>");
|
|
75
|
+
console.error(" adopter-workflow report <template-dir>");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function readJson(filePath) {
|
|
79
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function resolveProfile(input) {
|
|
83
|
+
const normalized = String(input || "").trim().toLowerCase().replace(/_/g, "-");
|
|
84
|
+
return profiles.find((item) => {
|
|
85
|
+
if (item.role === normalized) return true;
|
|
86
|
+
if (item.profile.replace(/_/g, "-") === normalized) return true;
|
|
87
|
+
return item.aliases.some((alias) => alias.replace(/_/g, "-") === normalized);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function printProfileMap() {
|
|
92
|
+
console.log("# Mirai Graph Profile Selection");
|
|
93
|
+
console.log("");
|
|
94
|
+
console.log("| Role | Profile | Starter | Use when |");
|
|
95
|
+
console.log("| --- | --- | --- | --- |");
|
|
96
|
+
for (const item of profiles) {
|
|
97
|
+
console.log(`| ${item.role} | \`${item.profile}\` | \`${item.starter}\` | ${item.useWhen} |`);
|
|
98
|
+
}
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log("Boundary: profile selection is a starting point, not adoption proof.");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function printPlan(input) {
|
|
104
|
+
const item = resolveProfile(input);
|
|
105
|
+
if (!item) {
|
|
106
|
+
console.error(`Unknown role or profile: ${input}`);
|
|
107
|
+
console.error(`Known roles: ${profiles.map((profile) => profile.role).join(", ")}`);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
console.log(`# Mirai Graph Adopter Plan: ${item.role}`);
|
|
112
|
+
console.log("");
|
|
113
|
+
console.log(`- Profile: \`${item.profile}\``);
|
|
114
|
+
console.log(`- Starter: \`${item.starter}\``);
|
|
115
|
+
console.log(`- Use when: ${item.useWhen}.`);
|
|
116
|
+
console.log("");
|
|
117
|
+
console.log("## First Workflow");
|
|
118
|
+
console.log("");
|
|
119
|
+
console.log("```text");
|
|
120
|
+
console.log("choose profile -> copy starter -> replace synthetic objects -> validate -> report -> launch/evidence/kaizen");
|
|
121
|
+
console.log("```");
|
|
122
|
+
console.log("");
|
|
123
|
+
console.log("## Commands");
|
|
124
|
+
console.log("");
|
|
125
|
+
console.log("```bash");
|
|
126
|
+
for (const command of item.nextCommands) {
|
|
127
|
+
console.log(command);
|
|
128
|
+
}
|
|
129
|
+
console.log("```");
|
|
130
|
+
console.log("");
|
|
131
|
+
console.log("## Review Boundary");
|
|
132
|
+
console.log("");
|
|
133
|
+
console.log("- Validation confirms the current release-candidate package shape only.");
|
|
134
|
+
console.log("- Reports support review; they do not authorize canonical updates.");
|
|
135
|
+
console.log("- Add launch, evidence and Kaizen controls before using the package for governed work.");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function templateReport(templateDir) {
|
|
139
|
+
const absTemplate = path.resolve(root, templateDir);
|
|
140
|
+
const manifestPath = path.join(absTemplate, "mirai-graph-package.json");
|
|
141
|
+
const objectsPath = path.join(absTemplate, "graph", "objects.json");
|
|
142
|
+
const relationsPath = path.join(absTemplate, "graph", "relations.json");
|
|
143
|
+
const gatesPath = path.join(absTemplate, "gates", "results.json");
|
|
144
|
+
|
|
145
|
+
const missing = [manifestPath, objectsPath, relationsPath].filter((filePath) => !fs.existsSync(filePath));
|
|
146
|
+
if (missing.length > 0) {
|
|
147
|
+
console.error(`Template is missing required files: ${missing.map((filePath) => path.relative(root, filePath)).join(", ")}`);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const manifest = readJson(manifestPath);
|
|
152
|
+
const objects = readJson(objectsPath);
|
|
153
|
+
const relations = readJson(relationsPath);
|
|
154
|
+
const gates = fs.existsSync(gatesPath) ? readJson(gatesPath) : [];
|
|
155
|
+
const profile = profiles.find((item) => item.profile === manifest.profile);
|
|
156
|
+
|
|
157
|
+
console.log(`# Mirai Graph Adopter Report: ${manifest.name}`);
|
|
158
|
+
console.log("");
|
|
159
|
+
console.log(`- Package: \`${manifest.id}\``);
|
|
160
|
+
console.log(`- Profile: \`${manifest.profile}\``);
|
|
161
|
+
console.log(`- Conformance: \`${manifest.conformance_level || "unspecified"}\``);
|
|
162
|
+
console.log(`- Public safety: \`${manifest.public_safety || "unspecified"}\``);
|
|
163
|
+
console.log(`- Objects: \`${objects.length}\``);
|
|
164
|
+
console.log(`- Relations: \`${relations.length}\``);
|
|
165
|
+
console.log(`- Gate results: \`${gates.length}\``);
|
|
166
|
+
console.log("");
|
|
167
|
+
|
|
168
|
+
if (profile) {
|
|
169
|
+
console.log("## Recommended Next Commands");
|
|
170
|
+
console.log("");
|
|
171
|
+
console.log("```bash");
|
|
172
|
+
for (const command of profile.nextCommands) {
|
|
173
|
+
console.log(command.replace(profile.starter, templateDir));
|
|
174
|
+
}
|
|
175
|
+
console.log("```");
|
|
176
|
+
console.log("");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
console.log("## Adoption Checklist");
|
|
180
|
+
console.log("");
|
|
181
|
+
console.log("- Replace synthetic objects with project-specific objects.");
|
|
182
|
+
console.log("- Keep private source material outside public graph packages.");
|
|
183
|
+
console.log("- Run validation before adding launch or process-control artifacts.");
|
|
184
|
+
console.log("- Add evidence references before promoting readiness.");
|
|
185
|
+
console.log("- Add launch/evidence/Kaizen controls before governed execution.");
|
|
186
|
+
console.log("");
|
|
187
|
+
console.log("## Boundary");
|
|
188
|
+
console.log("");
|
|
189
|
+
console.log("This report is an adoption aid. It does not prove completeness, authorize production execution or update canonical graph state.");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const [command, ...args] = process.argv.slice(2);
|
|
193
|
+
|
|
194
|
+
if (!command || command === "--help" || command === "-h") {
|
|
195
|
+
usage();
|
|
196
|
+
process.exit(command ? 0 : 1);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (command === "choose-profile") {
|
|
200
|
+
if (args.length !== 0) {
|
|
201
|
+
usage();
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
printProfileMap();
|
|
205
|
+
process.exit(0);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (command === "plan") {
|
|
209
|
+
if (args.length !== 1) {
|
|
210
|
+
usage();
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
printPlan(args[0]);
|
|
214
|
+
process.exit(0);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (command === "report") {
|
|
218
|
+
if (args.length !== 1) {
|
|
219
|
+
usage();
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
templateReport(args[0]);
|
|
223
|
+
process.exit(0);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
usage();
|
|
227
|
+
process.exit(1);
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
function usage() {
|
|
7
|
+
console.error("Usage: node packages/cli/context-pack.js <package-dir> --task-id <task-id> [--write <output-file>]");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function readJson(filePath) {
|
|
11
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function findManifestPath(packageDir) {
|
|
15
|
+
return path.join(packageDir, "mirai-graph-package.json");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function normalizeToken(token) {
|
|
19
|
+
const normalized = token.toLowerCase();
|
|
20
|
+
const replacements = new Map([
|
|
21
|
+
["notification", "notify"],
|
|
22
|
+
["notifications", "notify"],
|
|
23
|
+
["notifying", "notify"],
|
|
24
|
+
["approval", "approve"],
|
|
25
|
+
["approved", "approve"],
|
|
26
|
+
["approving", "approve"],
|
|
27
|
+
["schedule", "schedule"],
|
|
28
|
+
["speaker", "speaker"],
|
|
29
|
+
["session", "session"],
|
|
30
|
+
["sessions", "session"]
|
|
31
|
+
]);
|
|
32
|
+
if (replacements.has(normalized)) {
|
|
33
|
+
return replacements.get(normalized);
|
|
34
|
+
}
|
|
35
|
+
return normalized
|
|
36
|
+
.replace(/[^a-z0-9_]+/g, "")
|
|
37
|
+
.replace(/(ing|ed|ions|ion|s)$/u, "");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function tokenize(text) {
|
|
41
|
+
return String(text)
|
|
42
|
+
.split(/[^a-zA-Z0-9]+/u)
|
|
43
|
+
.map(normalizeToken)
|
|
44
|
+
.filter((token) => token.length >= 3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function objectText(object) {
|
|
48
|
+
return [
|
|
49
|
+
object.id,
|
|
50
|
+
object.kind,
|
|
51
|
+
object.title,
|
|
52
|
+
object.summary,
|
|
53
|
+
object.profile
|
|
54
|
+
].join(" ");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function addReason(selectionReasons, objectId, reason) {
|
|
58
|
+
if (!selectionReasons.has(objectId)) {
|
|
59
|
+
selectionReasons.set(objectId, new Set());
|
|
60
|
+
}
|
|
61
|
+
selectionReasons.get(objectId).add(reason);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function hasSharedEvidence(object, evidenceIds) {
|
|
65
|
+
return Array.isArray(object.evidence) && object.evidence.some((id) => evidenceIds.has(id));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isSafetyContextObject(object) {
|
|
69
|
+
if (!["constraint", "risk", "governance_gate"].includes(object.kind) && !object.id.startsWith("gate.")) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const text = tokenize(objectText(object));
|
|
73
|
+
const safetyTokens = new Set([
|
|
74
|
+
"credential",
|
|
75
|
+
"leak",
|
|
76
|
+
"log",
|
|
77
|
+
"permission",
|
|
78
|
+
"privacy",
|
|
79
|
+
"public",
|
|
80
|
+
"safety",
|
|
81
|
+
"secret",
|
|
82
|
+
"security",
|
|
83
|
+
"token"
|
|
84
|
+
]);
|
|
85
|
+
return text.some((token) => safetyTokens.has(token));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function scoreObject(object, taskTokens) {
|
|
89
|
+
const text = tokenize(objectText(object));
|
|
90
|
+
const textSet = new Set(text);
|
|
91
|
+
let score = 0;
|
|
92
|
+
const reasons = [];
|
|
93
|
+
for (const token of taskTokens) {
|
|
94
|
+
if (textSet.has(token)) {
|
|
95
|
+
score += 3;
|
|
96
|
+
reasons.push(`exact token match: ${token}`);
|
|
97
|
+
} else if (text.some((candidate) => candidate.includes(token) || token.includes(candidate))) {
|
|
98
|
+
score += 1;
|
|
99
|
+
reasons.push(`partial token match: ${token}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (object.kind === "evidence") {
|
|
103
|
+
score -= 1;
|
|
104
|
+
reasons.push("evidence object penalty until linked by selected graph context");
|
|
105
|
+
}
|
|
106
|
+
if (object.kind === "governance_gate" || object.id.startsWith("gate.")) {
|
|
107
|
+
score += 1;
|
|
108
|
+
reasons.push("governance gate boost");
|
|
109
|
+
}
|
|
110
|
+
return { score, reasons };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function buildContextPack(packageDir, taskId) {
|
|
114
|
+
const manifestPath = findManifestPath(packageDir);
|
|
115
|
+
const manifest = fs.existsSync(manifestPath) ? readJson(manifestPath) : null;
|
|
116
|
+
const objectsPath = manifest
|
|
117
|
+
? path.join(packageDir, manifest.graph.objects)
|
|
118
|
+
: path.join(packageDir, "graph", "objects.json");
|
|
119
|
+
const relationsPath = manifest
|
|
120
|
+
? path.join(packageDir, manifest.graph.relations)
|
|
121
|
+
: path.join(packageDir, "graph", "relations.json");
|
|
122
|
+
const objects = readJson(objectsPath);
|
|
123
|
+
const relations = readJson(relationsPath);
|
|
124
|
+
const taskTokens = tokenize(taskId);
|
|
125
|
+
const scoredObjects = objects.map((object) => ({
|
|
126
|
+
object,
|
|
127
|
+
...scoreObject(object, taskTokens)
|
|
128
|
+
}));
|
|
129
|
+
const directMatches = objects
|
|
130
|
+
.map((object) => scoredObjects.find((entry) => entry.object.id === object.id))
|
|
131
|
+
.filter((entry) => entry.score > 0)
|
|
132
|
+
.sort((a, b) => b.score - a.score)
|
|
133
|
+
.map((entry) => entry.object);
|
|
134
|
+
|
|
135
|
+
const selectedIds = new Set(directMatches.map((object) => object.id));
|
|
136
|
+
const selectionReasons = new Map();
|
|
137
|
+
const objectScores = new Map(scoredObjects.map((entry) => [entry.object.id, entry.score]));
|
|
138
|
+
|
|
139
|
+
for (const entry of scoredObjects) {
|
|
140
|
+
if (entry.score > 0) {
|
|
141
|
+
for (const reason of entry.reasons) {
|
|
142
|
+
addReason(selectionReasons, entry.object.id, reason);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const relevantRelations = relations.filter((relation) => (
|
|
148
|
+
selectedIds.has(relation.source) || selectedIds.has(relation.target)
|
|
149
|
+
));
|
|
150
|
+
const relevantRelationIds = new Set(relevantRelations.map((relation) => relation.id));
|
|
151
|
+
|
|
152
|
+
for (const relation of relevantRelations) {
|
|
153
|
+
if (!selectedIds.has(relation.source)) {
|
|
154
|
+
addReason(selectionReasons, relation.source, `one-hop relation expansion from ${relation.id}`);
|
|
155
|
+
}
|
|
156
|
+
if (!selectedIds.has(relation.target)) {
|
|
157
|
+
addReason(selectionReasons, relation.target, `one-hop relation expansion from ${relation.id}`);
|
|
158
|
+
}
|
|
159
|
+
selectedIds.add(relation.source);
|
|
160
|
+
selectedIds.add(relation.target);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const selectedEvidenceIds = new Set(
|
|
164
|
+
objects
|
|
165
|
+
.filter((object) => selectedIds.has(object.id))
|
|
166
|
+
.flatMap((object) => object.evidence || [])
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
for (const object of objects) {
|
|
170
|
+
if (isSafetyContextObject(object) && hasSharedEvidence(object, selectedEvidenceIds)) {
|
|
171
|
+
if (!selectedIds.has(object.id)) {
|
|
172
|
+
addReason(selectionReasons, object.id, "safety-sensitive object with shared evidence");
|
|
173
|
+
}
|
|
174
|
+
selectedIds.add(object.id);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const expandedRelations = relations.filter((relation) => (
|
|
179
|
+
selectedIds.has(relation.source) && selectedIds.has(relation.target)
|
|
180
|
+
));
|
|
181
|
+
|
|
182
|
+
const selectedObjects = objects.filter((object) => (
|
|
183
|
+
selectedIds.has(object.id) ||
|
|
184
|
+
(object.kind === "evidence" && objects.some((selected) => (
|
|
185
|
+
selectedIds.has(selected.id) && Array.isArray(selected.evidence) && selected.evidence.includes(object.id)
|
|
186
|
+
)))
|
|
187
|
+
));
|
|
188
|
+
for (const object of selectedObjects) {
|
|
189
|
+
if (object.kind === "evidence" && !selectedIds.has(object.id)) {
|
|
190
|
+
addReason(selectionReasons, object.id, "evidence referenced by selected object");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const selectedObjectIds = selectedObjects.map((object) => object.id);
|
|
194
|
+
const relationIds = expandedRelations.map((relation) => relation.id);
|
|
195
|
+
const relationExplanations = expandedRelations.map((relation) => ({
|
|
196
|
+
id: relation.id,
|
|
197
|
+
reason: relevantRelationIds.has(relation.id)
|
|
198
|
+
? "one-hop relation expansion from direct object match"
|
|
199
|
+
: "connects selected objects after safety/evidence expansion",
|
|
200
|
+
source: relation.source,
|
|
201
|
+
target: relation.target
|
|
202
|
+
}));
|
|
203
|
+
const objectExplanations = selectedObjects.map((object) => ({
|
|
204
|
+
id: object.id,
|
|
205
|
+
relevance_score: objectScores.get(object.id) || 0,
|
|
206
|
+
reasons: Array.from(selectionReasons.get(object.id) || ["included as selected graph context"])
|
|
207
|
+
}));
|
|
208
|
+
const evidence = Array.from(new Set([
|
|
209
|
+
...selectedObjects.flatMap((object) => object.evidence || []),
|
|
210
|
+
...expandedRelations.flatMap((relation) => relation.evidence || [])
|
|
211
|
+
]));
|
|
212
|
+
const omittedObjects = objects
|
|
213
|
+
.filter((object) => !selectedObjectIds.includes(object.id))
|
|
214
|
+
.map((object) => object.id);
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
id: `context_pack.${taskId.replace(/[^a-zA-Z0-9_]+/g, "_")}`,
|
|
218
|
+
task_id: taskId,
|
|
219
|
+
source_graph: manifest ? manifest.id : packageDir,
|
|
220
|
+
generated_at: new Date().toISOString(),
|
|
221
|
+
included_objects: selectedObjectIds,
|
|
222
|
+
included_relations: relationIds,
|
|
223
|
+
evidence,
|
|
224
|
+
selection: {
|
|
225
|
+
method: "token_matching_one_hop_relation_expansion_safety_shared_evidence",
|
|
226
|
+
task_tokens: taskTokens,
|
|
227
|
+
object_explanations: objectExplanations,
|
|
228
|
+
relation_explanations: relationExplanations
|
|
229
|
+
},
|
|
230
|
+
assumptions: [
|
|
231
|
+
"Alpha generator uses token matching plus one-hop relation expansion.",
|
|
232
|
+
"Safety-sensitive constraints and risks with shared evidence are included."
|
|
233
|
+
],
|
|
234
|
+
omissions: omittedObjects,
|
|
235
|
+
limitations: [
|
|
236
|
+
"Generated context pack is not canonical state.",
|
|
237
|
+
"This alpha generator does not prove semantic completeness."
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const packageDir = process.argv[2];
|
|
243
|
+
const taskIndex = process.argv.indexOf("--task-id");
|
|
244
|
+
const writeIndex = process.argv.indexOf("--write");
|
|
245
|
+
const taskId = taskIndex >= 0 ? process.argv[taskIndex + 1] : null;
|
|
246
|
+
const outputPath = writeIndex >= 0 ? process.argv[writeIndex + 1] : null;
|
|
247
|
+
|
|
248
|
+
if (!packageDir || !taskId || (writeIndex >= 0 && !outputPath)) {
|
|
249
|
+
usage();
|
|
250
|
+
process.exit(2);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const contextPack = buildContextPack(path.resolve(packageDir), taskId);
|
|
255
|
+
const output = JSON.stringify(contextPack, null, 2);
|
|
256
|
+
|
|
257
|
+
if (outputPath) {
|
|
258
|
+
const resolvedOutputPath = path.resolve(outputPath);
|
|
259
|
+
fs.mkdirSync(path.dirname(resolvedOutputPath), { recursive: true });
|
|
260
|
+
fs.writeFileSync(resolvedOutputPath, `${output}\n`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
console.log(output);
|
|
264
|
+
} catch (error) {
|
|
265
|
+
console.error(error.message);
|
|
266
|
+
process.exit(1);
|
|
267
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
function readJson(filePath) {
|
|
7
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function list(items, emptyText) {
|
|
11
|
+
if (!items || items.length === 0) {
|
|
12
|
+
return `- ${emptyText}`;
|
|
13
|
+
}
|
|
14
|
+
return items.map((item) => `- ${item}`).join("\n");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const packageDir = process.argv[2] || "examples/instrumentation-layer-minimal";
|
|
18
|
+
const resultsDir = path.join(packageDir, "results");
|
|
19
|
+
const cockpit = readJson(path.join(resultsDir, "development-cockpit.json"));
|
|
20
|
+
const traceability = readJson(path.join(resultsDir, "feature-implementation-traceability.json"));
|
|
21
|
+
const feedback = readJson(path.join(resultsDir, "multi-source-quality-feedback.json"));
|
|
22
|
+
|
|
23
|
+
const cockpitInstruments = cockpit.instruments.map(
|
|
24
|
+
(instrument) => `\`${instrument.id}\` ${instrument.family}: ${instrument.score}/${100} (${instrument.band})`
|
|
25
|
+
);
|
|
26
|
+
const mappings = traceability.implementation_mappings.map(
|
|
27
|
+
(mapping) => `\`${mapping.feature_ref}\` -> ${mapping.implementation_refs.length} implementation refs, ${mapping.test_refs.length} test refs, ${mapping.evidence_refs.length} evidence refs`
|
|
28
|
+
);
|
|
29
|
+
const findings = feedback.findings.map(
|
|
30
|
+
(finding) => `\`${finding.id}\` ${finding.classification}, severity ${finding.severity}, blocking ${finding.blocking ? "true" : "false"}, route ${finding.next_route}`
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const lines = [
|
|
34
|
+
"# Mirai Graph Instrumentation Report",
|
|
35
|
+
"",
|
|
36
|
+
`- Package: \`${packageDir}\``,
|
|
37
|
+
`- Cockpit: \`${cockpit.id}\``,
|
|
38
|
+
`- Traceability: \`${traceability.id}\``,
|
|
39
|
+
`- Multi-source feedback: \`${feedback.id}\``,
|
|
40
|
+
`- Transition verdict: \`${feedback.verdict}\``,
|
|
41
|
+
`- Next transition: \`${feedback.next_transition}\``,
|
|
42
|
+
"",
|
|
43
|
+
"## Control Pattern",
|
|
44
|
+
"",
|
|
45
|
+
"```text",
|
|
46
|
+
"feature intent -> implementation traceability -> cockpit signals -> multi-source feedback -> transition decision -> Kaizen route",
|
|
47
|
+
"```",
|
|
48
|
+
"",
|
|
49
|
+
"## Cockpit",
|
|
50
|
+
"",
|
|
51
|
+
`- Subject: \`${cockpit.subject_ref}\``,
|
|
52
|
+
`- Production readiness: \`${cockpit.readiness.production_readiness}\``,
|
|
53
|
+
`- Next action: \`${cockpit.next_best_action.action}\``,
|
|
54
|
+
`- Target cycle: \`${cockpit.next_best_action.target_cycle}\``,
|
|
55
|
+
"",
|
|
56
|
+
"### Instruments",
|
|
57
|
+
"",
|
|
58
|
+
list(cockpitInstruments, "No cockpit instruments declared."),
|
|
59
|
+
"",
|
|
60
|
+
"### Required Gates",
|
|
61
|
+
"",
|
|
62
|
+
list(cockpit.next_best_action.required_gates, "No required gates declared."),
|
|
63
|
+
"",
|
|
64
|
+
"## Traceability",
|
|
65
|
+
"",
|
|
66
|
+
`- Features: \`${traceability.coverage_summary.feature_count}\``,
|
|
67
|
+
`- Mapped features: \`${traceability.coverage_summary.mapped_feature_count}\``,
|
|
68
|
+
`- Evidence-backed mappings: \`${traceability.coverage_summary.evidence_backed_mapping_count}\``,
|
|
69
|
+
`- Accepted features: \`${traceability.coverage_summary.accepted_feature_count}\``,
|
|
70
|
+
"",
|
|
71
|
+
"### Mappings",
|
|
72
|
+
"",
|
|
73
|
+
list(mappings, "No mappings declared."),
|
|
74
|
+
"",
|
|
75
|
+
"## Multi-Source Feedback",
|
|
76
|
+
"",
|
|
77
|
+
`- Sources: \`${feedback.sources.length}\``,
|
|
78
|
+
`- Findings: \`${feedback.findings.length}\``,
|
|
79
|
+
`- Blocking findings: \`${feedback.blocking_findings.length}\``,
|
|
80
|
+
"",
|
|
81
|
+
"### Findings",
|
|
82
|
+
"",
|
|
83
|
+
list(findings, "No findings declared."),
|
|
84
|
+
"",
|
|
85
|
+
"### Kaizen Refs",
|
|
86
|
+
"",
|
|
87
|
+
list(feedback.kaizen_refs, "No Kaizen refs declared."),
|
|
88
|
+
"",
|
|
89
|
+
"## Boundary",
|
|
90
|
+
"",
|
|
91
|
+
"- Cockpit scores are not acceptance.",
|
|
92
|
+
"- Feature mappings are not implementation by themselves.",
|
|
93
|
+
"- Tests and evidence do not authorize canonical updates.",
|
|
94
|
+
"- Multi-source feedback calibrates transition decisions; blocking findings stop the transitions they block."
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
console.log(lines.join("\n"));
|