mustflow 2.59.0 → 2.68.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -0
  2. package/dist/cli/commands/context.js +81 -6
  3. package/dist/cli/commands/skill.js +116 -0
  4. package/dist/cli/i18n/en.js +3 -1
  5. package/dist/cli/i18n/es.js +3 -1
  6. package/dist/cli/i18n/fr.js +3 -1
  7. package/dist/cli/i18n/hi.js +3 -1
  8. package/dist/cli/i18n/ko.js +3 -1
  9. package/dist/cli/i18n/zh.js +3 -1
  10. package/dist/cli/lib/agent-context.js +981 -8
  11. package/dist/cli/lib/command-registry.js +6 -0
  12. package/dist/cli/lib/local-index/constants.js +4 -5
  13. package/dist/cli/lib/local-index/freshness.js +5 -1
  14. package/dist/cli/lib/local-index/index.js +1 -1
  15. package/dist/cli/lib/repo-map.js +7 -1
  16. package/dist/cli/lib/validation/constants.js +3 -0
  17. package/dist/cli/lib/validation/index.js +41 -2
  18. package/dist/core/check-issues.js +5 -0
  19. package/dist/core/prompt-cache-rendering.js +19 -0
  20. package/dist/core/public-json-contracts.js +26 -0
  21. package/dist/core/quality-gaming.js +4 -0
  22. package/dist/core/skill-route-fixtures.js +173 -0
  23. package/dist/core/skill-route-resolution.js +398 -0
  24. package/dist/core/source-anchors.js +91 -5
  25. package/package.json +1 -1
  26. package/schemas/README.md +7 -2
  27. package/schemas/context-report.schema.json +442 -0
  28. package/schemas/quality-gaming-report.schema.json +1 -0
  29. package/schemas/route-fixture.schema.json +57 -0
  30. package/schemas/skill-route-report.schema.json +242 -0
  31. package/templates/default/common/.mustflow/config/commands.toml +18 -2
  32. package/templates/default/common/.mustflow/config/mustflow.toml +16 -10
  33. package/templates/default/i18n.toml +9 -9
  34. package/templates/default/locales/en/.mustflow/context/PROJECT.md +5 -3
  35. package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +13 -9
  36. package/templates/default/locales/en/.mustflow/skills/INDEX.md +2 -2
  37. package/templates/default/locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md +5 -2
  38. package/templates/default/locales/en/.mustflow/skills/quality-gaming-guard/SKILL.md +8 -6
  39. package/templates/default/locales/en/.mustflow/skills/router.toml +67 -0
  40. package/templates/default/locales/en/AGENTS.md +15 -7
  41. package/templates/default/locales/ko/.mustflow/context/PROJECT.md +4 -2
  42. package/templates/default/locales/ko/.mustflow/docs/agent-workflow.md +18 -12
  43. package/templates/default/locales/ko/AGENTS.md +8 -6
  44. package/templates/default/manifest.toml +2 -1
@@ -79,6 +79,9 @@
79
79
  "stable_prefix": { "$ref": "#/$defs/stablePrefixLayer" },
80
80
  "task_context": { "$ref": "#/$defs/taskContextLayer" },
81
81
  "volatile_suffix": { "$ref": "#/$defs/volatileSuffixLayer" },
82
+ "prompt_bundle": { "$ref": "#/$defs/promptBundle" },
83
+ "prompt_bundle_diff": { "$ref": "#/$defs/promptBundleDiff" },
84
+ "cache_audit": { "$ref": "#/$defs/promptCacheAudit" },
82
85
  "issues": {
83
86
  "type": "array",
84
87
  "items": { "type": "string" }
@@ -375,9 +378,79 @@
375
378
  "type": "array",
376
379
  "items": { "type": "string" }
377
380
  },
381
+ "route_read_plan": { "$ref": "#/$defs/taskRouteReadPlan" },
382
+ "repo_map_read_plan": { "$ref": "#/$defs/taskRepoMapReadPlan" },
378
383
  "local_index": { "$ref": "#/$defs/promptCacheLocalIndex" }
379
384
  }
380
385
  },
386
+ "taskRouteReadPlan": {
387
+ "type": "object",
388
+ "additionalProperties": false,
389
+ "required": [
390
+ "resolver_command",
391
+ "stable_kernel",
392
+ "route_sources",
393
+ "selected_skill_paths_source",
394
+ "route_metadata_fallback",
395
+ "expanded_index_fallback",
396
+ "selection_limits"
397
+ ],
398
+ "properties": {
399
+ "resolver_command": {
400
+ "type": "array",
401
+ "items": { "type": "string" }
402
+ },
403
+ "stable_kernel": {
404
+ "type": "array",
405
+ "items": { "type": "string" }
406
+ },
407
+ "route_sources": {
408
+ "type": "array",
409
+ "items": { "type": "string" }
410
+ },
411
+ "selected_skill_paths_source": { "type": "string" },
412
+ "route_metadata_fallback": { "$ref": "#/$defs/taskRouteFallback" },
413
+ "expanded_index_fallback": { "$ref": "#/$defs/taskRouteFallback" },
414
+ "selection_limits": { "$ref": "#/$defs/taskRouteSelectionLimits" }
415
+ }
416
+ },
417
+ "taskRouteFallback": {
418
+ "type": "object",
419
+ "additionalProperties": false,
420
+ "required": ["path", "read_when", "avoid_by_default"],
421
+ "properties": {
422
+ "path": { "type": "string" },
423
+ "read_when": {
424
+ "type": "array",
425
+ "items": { "type": "string" }
426
+ },
427
+ "avoid_by_default": { "type": "boolean" }
428
+ }
429
+ },
430
+ "taskRouteSelectionLimits": {
431
+ "type": "object",
432
+ "additionalProperties": false,
433
+ "required": ["candidates", "main", "adjuncts"],
434
+ "properties": {
435
+ "candidates": { "type": "integer", "minimum": 0 },
436
+ "main": { "type": "integer", "minimum": 0 },
437
+ "adjuncts": { "type": "integer", "minimum": 0 }
438
+ }
439
+ },
440
+ "taskRepoMapReadPlan": {
441
+ "type": "object",
442
+ "additionalProperties": false,
443
+ "required": ["source", "strategy", "anchor_sources", "fallback"],
444
+ "properties": {
445
+ "source": { "const": "repo_map_navigation" },
446
+ "strategy": { "const": "select_anchors_or_spans_before_full_map" },
447
+ "anchor_sources": {
448
+ "type": "array",
449
+ "items": { "type": "string" }
450
+ },
451
+ "fallback": { "$ref": "#/$defs/taskRouteFallback" }
452
+ }
453
+ },
381
454
  "promptCacheLocalIndex": {
382
455
  "type": "object",
383
456
  "additionalProperties": false,
@@ -425,6 +498,375 @@
425
498
  "include_absolute_root": { "const": false },
426
499
  "include_latest_run": { "const": false }
427
500
  }
501
+ },
502
+ "promptCacheAudit": {
503
+ "type": "object",
504
+ "additionalProperties": false,
505
+ "required": ["measurement", "estimator", "canonicalization", "summary", "layers", "issues"],
506
+ "properties": {
507
+ "measurement": { "const": "reference_bundle" },
508
+ "estimator": { "$ref": "#/$defs/promptCacheAuditEstimator" },
509
+ "canonicalization": {
510
+ "type": "array",
511
+ "items": { "type": "string" }
512
+ },
513
+ "summary": { "$ref": "#/$defs/promptCacheAuditSummary" },
514
+ "layers": {
515
+ "type": "array",
516
+ "items": { "$ref": "#/$defs/promptCacheAuditLayer" }
517
+ },
518
+ "issues": {
519
+ "type": "array",
520
+ "items": { "type": "string" }
521
+ }
522
+ }
523
+ },
524
+ "promptBundle": {
525
+ "type": "object",
526
+ "additionalProperties": false,
527
+ "required": [
528
+ "schema_version",
529
+ "renderer",
530
+ "content_included",
531
+ "request_shape_hash",
532
+ "bundle_hash",
533
+ "layers",
534
+ "issues"
535
+ ],
536
+ "properties": {
537
+ "schema_version": { "const": "1" },
538
+ "renderer": { "const": "reference_bundle_utf8_lf_v1" },
539
+ "content_included": { "const": false },
540
+ "request_shape_hash": { "type": "string" },
541
+ "bundle_hash": { "type": "string" },
542
+ "layers": {
543
+ "type": "array",
544
+ "items": { "$ref": "#/$defs/promptBundleLayer" }
545
+ },
546
+ "issues": {
547
+ "type": "array",
548
+ "items": { "type": "string" }
549
+ }
550
+ }
551
+ },
552
+ "promptBundleLayer": {
553
+ "type": "object",
554
+ "additionalProperties": false,
555
+ "required": ["cache_layer", "blocks"],
556
+ "properties": {
557
+ "cache_layer": { "enum": ["stable", "task", "volatile"] },
558
+ "blocks": {
559
+ "type": "array",
560
+ "items": { "$ref": "#/$defs/promptBundleBlock" }
561
+ }
562
+ }
563
+ },
564
+ "promptBundleBlock": {
565
+ "type": "object",
566
+ "additionalProperties": false,
567
+ "required": [
568
+ "id",
569
+ "cache_layer",
570
+ "order",
571
+ "kind",
572
+ "path",
573
+ "source",
574
+ "source_kind",
575
+ "selection_policy",
576
+ "content_included",
577
+ "content_hash",
578
+ "rendered_digest",
579
+ "rendered_bytes",
580
+ "estimated_tokens",
581
+ "cacheability",
582
+ "reload_on",
583
+ "issue"
584
+ ],
585
+ "properties": {
586
+ "id": { "type": "string" },
587
+ "cache_layer": { "enum": ["stable", "task", "volatile"] },
588
+ "order": { "type": "integer", "minimum": 1 },
589
+ "kind": { "enum": ["file", "source_placeholder"] },
590
+ "path": { "type": ["string", "null"] },
591
+ "source": { "type": ["string", "null"] },
592
+ "source_kind": { "enum": ["file_reference", "dynamic_selection", "runtime_volatile"] },
593
+ "selection_policy": {
594
+ "enum": [
595
+ "always_rendered",
596
+ "read_when_selected",
597
+ "fallback_when_needed",
598
+ "selected_at_runtime",
599
+ "volatile_runtime"
600
+ ]
601
+ },
602
+ "content_included": { "const": false },
603
+ "content_hash": { "type": ["string", "null"] },
604
+ "rendered_digest": { "type": ["string", "null"] },
605
+ "rendered_bytes": { "type": ["integer", "null"], "minimum": 0 },
606
+ "estimated_tokens": { "type": ["integer", "null"], "minimum": 0 },
607
+ "cacheability": {
608
+ "enum": [
609
+ "provider_prefix_candidate",
610
+ "task_selective",
611
+ "task_fallback",
612
+ "runtime_selection",
613
+ "volatile_suffix"
614
+ ]
615
+ },
616
+ "reload_on": {
617
+ "type": "array",
618
+ "items": { "type": "string" }
619
+ },
620
+ "issue": { "type": ["string", "null"] }
621
+ }
622
+ },
623
+ "promptBundleDiff": {
624
+ "type": "object",
625
+ "additionalProperties": false,
626
+ "required": [
627
+ "baseline_path",
628
+ "status",
629
+ "baseline_request_shape_hash",
630
+ "current_request_shape_hash",
631
+ "request_shape_changed",
632
+ "baseline_bundle_hash",
633
+ "current_bundle_hash",
634
+ "bundle_changed",
635
+ "first_difference",
636
+ "stable_diff",
637
+ "changed_blocks",
638
+ "issues"
639
+ ],
640
+ "properties": {
641
+ "baseline_path": { "type": "string" },
642
+ "status": {
643
+ "enum": [
644
+ "unchanged",
645
+ "changed",
646
+ "baseline_missing",
647
+ "baseline_unreadable",
648
+ "baseline_invalid",
649
+ "baseline_without_prompt_bundle"
650
+ ]
651
+ },
652
+ "baseline_request_shape_hash": { "type": ["string", "null"] },
653
+ "current_request_shape_hash": { "type": "string" },
654
+ "request_shape_changed": { "type": ["boolean", "null"] },
655
+ "baseline_bundle_hash": { "type": ["string", "null"] },
656
+ "current_bundle_hash": { "type": "string" },
657
+ "bundle_changed": { "type": ["boolean", "null"] },
658
+ "first_difference": {
659
+ "anyOf": [
660
+ { "type": "null" },
661
+ { "$ref": "#/$defs/promptBundleBlockDiff" }
662
+ ]
663
+ },
664
+ "stable_diff": { "$ref": "#/$defs/promptBundleStableDiff" },
665
+ "changed_blocks": {
666
+ "type": "array",
667
+ "items": { "$ref": "#/$defs/promptBundleBlockDiff" }
668
+ },
669
+ "issues": {
670
+ "type": "array",
671
+ "items": { "type": "string" }
672
+ }
673
+ }
674
+ },
675
+ "promptBundleStableDiff": {
676
+ "type": "object",
677
+ "additionalProperties": false,
678
+ "required": [
679
+ "stable_block_count",
680
+ "baseline_stable_block_count",
681
+ "matching_prefix_blocks",
682
+ "matching_prefix_ratio",
683
+ "stable_prefix_preserved",
684
+ "first_stable_difference",
685
+ "first_stable_invalidation_reason"
686
+ ],
687
+ "properties": {
688
+ "stable_block_count": { "type": "integer", "minimum": 0 },
689
+ "baseline_stable_block_count": { "type": ["integer", "null"], "minimum": 0 },
690
+ "matching_prefix_blocks": { "type": "integer", "minimum": 0 },
691
+ "matching_prefix_ratio": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
692
+ "stable_prefix_preserved": { "type": ["boolean", "null"] },
693
+ "first_stable_difference": {
694
+ "anyOf": [
695
+ { "type": "null" },
696
+ { "$ref": "#/$defs/promptBundleBlockDiff" }
697
+ ]
698
+ },
699
+ "first_stable_invalidation_reason": { "type": ["string", "null"] }
700
+ }
701
+ },
702
+ "promptBundleBlockDiff": {
703
+ "type": "object",
704
+ "additionalProperties": false,
705
+ "required": [
706
+ "kind",
707
+ "cache_layer",
708
+ "order",
709
+ "current_id",
710
+ "baseline_id",
711
+ "reason",
712
+ "fields"
713
+ ],
714
+ "properties": {
715
+ "kind": { "enum": ["added", "removed", "changed"] },
716
+ "cache_layer": { "type": ["string", "null"], "enum": ["stable", "task", "volatile", null] },
717
+ "order": { "type": ["integer", "null"], "minimum": 1 },
718
+ "current_id": { "type": ["string", "null"] },
719
+ "baseline_id": { "type": ["string", "null"] },
720
+ "reason": { "type": "string" },
721
+ "fields": {
722
+ "type": "array",
723
+ "items": { "type": "string" }
724
+ }
725
+ }
726
+ },
727
+ "promptCacheAuditEstimator": {
728
+ "type": "object",
729
+ "additionalProperties": false,
730
+ "required": ["name", "estimated_bytes_per_token", "caveat"],
731
+ "properties": {
732
+ "name": { "const": "reference_bundle_utf8_lf_v1" },
733
+ "estimated_bytes_per_token": { "const": 4 },
734
+ "caveat": { "type": "string" }
735
+ }
736
+ },
737
+ "promptCacheAuditSummary": {
738
+ "type": "object",
739
+ "additionalProperties": false,
740
+ "required": [
741
+ "rendered_bytes",
742
+ "estimated_tokens",
743
+ "measured_block_count",
744
+ "dynamic_source_count",
745
+ "unresolved_reference_count",
746
+ "volatile_before_stable_count",
747
+ "serialization_deterministic",
748
+ "stable_leaf_skill_isolated",
749
+ "stable_leaf_skill_risk_paths",
750
+ "leaf_skill_change_stable_hash_delta",
751
+ "stable_rendered_bytes",
752
+ "stable_estimated_tokens",
753
+ "stable_budget_status",
754
+ "stable_largest_block_budget_share",
755
+ "task_budget_status",
756
+ "volatile_budget_status"
757
+ ],
758
+ "properties": {
759
+ "rendered_bytes": { "type": ["integer", "null"], "minimum": 0 },
760
+ "estimated_tokens": { "type": ["integer", "null"], "minimum": 0 },
761
+ "measured_block_count": { "type": "integer", "minimum": 0 },
762
+ "dynamic_source_count": { "type": "integer", "minimum": 0 },
763
+ "unresolved_reference_count": { "type": "integer", "minimum": 0 },
764
+ "volatile_before_stable_count": { "type": "integer", "minimum": 0 },
765
+ "serialization_deterministic": { "const": true },
766
+ "stable_leaf_skill_isolated": { "type": ["boolean", "null"] },
767
+ "stable_leaf_skill_risk_paths": {
768
+ "type": "array",
769
+ "items": { "type": "string" }
770
+ },
771
+ "leaf_skill_change_stable_hash_delta": {
772
+ "type": ["integer", "null"],
773
+ "enum": [0, null]
774
+ },
775
+ "stable_rendered_bytes": { "type": ["integer", "null"], "minimum": 0 },
776
+ "stable_estimated_tokens": { "type": ["integer", "null"], "minimum": 0 },
777
+ "stable_budget_status": {
778
+ "type": ["string", "null"],
779
+ "enum": ["within_budget", "over_budget", "unknown", null]
780
+ },
781
+ "stable_largest_block_budget_share": { "type": ["number", "null"], "minimum": 0 },
782
+ "task_budget_status": {
783
+ "type": ["string", "null"],
784
+ "enum": ["within_budget", "over_budget", "unknown", null]
785
+ },
786
+ "volatile_budget_status": {
787
+ "type": ["string", "null"],
788
+ "enum": ["within_budget", "over_budget", "unknown", null]
789
+ }
790
+ }
791
+ },
792
+ "promptCacheAuditLayer": {
793
+ "type": "object",
794
+ "additionalProperties": false,
795
+ "required": [
796
+ "cache_layer",
797
+ "budget_kb",
798
+ "budget_bytes",
799
+ "rendered_bytes",
800
+ "estimated_tokens",
801
+ "budget_status",
802
+ "blocks",
803
+ "largest_blocks",
804
+ "issues"
805
+ ],
806
+ "properties": {
807
+ "cache_layer": { "enum": ["stable", "task", "volatile"] },
808
+ "budget_kb": { "type": ["integer", "null"] },
809
+ "budget_bytes": { "type": ["integer", "null"] },
810
+ "target_kb": { "type": ["integer", "null"] },
811
+ "target_bytes": { "type": ["integer", "null"] },
812
+ "target_status": { "enum": ["within_budget", "over_budget", "unknown"] },
813
+ "rendered_bytes": { "type": ["integer", "null"], "minimum": 0 },
814
+ "estimated_tokens": { "type": ["integer", "null"], "minimum": 0 },
815
+ "budget_status": { "enum": ["within_budget", "over_budget", "unknown"] },
816
+ "blocks": {
817
+ "type": "array",
818
+ "items": { "$ref": "#/$defs/promptCacheAuditBlock" }
819
+ },
820
+ "largest_blocks": {
821
+ "type": "array",
822
+ "items": { "$ref": "#/$defs/promptCacheAuditBlock" }
823
+ },
824
+ "issues": {
825
+ "type": "array",
826
+ "items": { "type": "string" }
827
+ }
828
+ }
829
+ },
830
+ "promptCacheAuditBlock": {
831
+ "type": "object",
832
+ "additionalProperties": false,
833
+ "required": [
834
+ "id",
835
+ "kind",
836
+ "path",
837
+ "source",
838
+ "exists",
839
+ "content_hash",
840
+ "rendered_bytes",
841
+ "estimated_tokens",
842
+ "budget_share",
843
+ "issue"
844
+ ],
845
+ "properties": {
846
+ "id": { "type": "string" },
847
+ "kind": { "enum": ["file", "source_placeholder"] },
848
+ "path": { "type": ["string", "null"] },
849
+ "source": { "type": ["string", "null"] },
850
+ "source_kind": { "enum": ["file_reference", "dynamic_selection", "runtime_volatile"] },
851
+ "selection_policy": {
852
+ "enum": [
853
+ "always_rendered",
854
+ "read_when_selected",
855
+ "fallback_when_needed",
856
+ "selected_at_runtime",
857
+ "volatile_runtime"
858
+ ]
859
+ },
860
+ "measurement_status": { "enum": ["measured", "hash_only_deferred", "dynamic_unmeasured"] },
861
+ "candidate_exists": { "type": ["boolean", "null"] },
862
+ "candidate_content_hash": { "type": ["string", "null"] },
863
+ "exists": { "type": ["boolean", "null"] },
864
+ "content_hash": { "type": ["string", "null"] },
865
+ "rendered_bytes": { "type": ["integer", "null"], "minimum": 0 },
866
+ "estimated_tokens": { "type": ["integer", "null"], "minimum": 0 },
867
+ "budget_share": { "type": ["number", "null"], "minimum": 0 },
868
+ "issue": { "type": ["string", "null"] }
869
+ }
428
870
  }
429
871
  }
430
872
  }
@@ -60,6 +60,7 @@
60
60
  "type_escape_added",
61
61
  "test_bypass_marker_added",
62
62
  "placeholder_added",
63
+ "empty_catch_swallow_added",
63
64
  "generated_or_vendor_logic_added",
64
65
  "large_helper_container_added"
65
66
  ]
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mustflow.github.io/schemas/route-fixture.schema.json",
4
+ "title": "mustflow skill route fixture",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "cases"],
8
+ "properties": {
9
+ "schema_version": { "const": "1" },
10
+ "cases": {
11
+ "type": "array",
12
+ "items": { "$ref": "#/$defs/case" }
13
+ }
14
+ },
15
+ "$defs": {
16
+ "nonEmptyString": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "nonEmptyStringArray": {
21
+ "type": "array",
22
+ "minItems": 1,
23
+ "items": { "$ref": "#/$defs/nonEmptyString" }
24
+ },
25
+ "case": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["id", "paths", "reasons"],
29
+ "anyOf": [
30
+ { "required": ["required_main"] },
31
+ { "required": ["required_candidates"] },
32
+ { "required": ["required_adjuncts"] },
33
+ { "required": ["forbidden_candidates"] }
34
+ ],
35
+ "properties": {
36
+ "id": { "$ref": "#/$defs/nonEmptyString" },
37
+ "task": {
38
+ "oneOf": [
39
+ { "$ref": "#/$defs/nonEmptyString" },
40
+ { "type": "null" }
41
+ ]
42
+ },
43
+ "paths": { "$ref": "#/$defs/nonEmptyStringArray" },
44
+ "reasons": { "$ref": "#/$defs/nonEmptyStringArray" },
45
+ "max_candidates": {
46
+ "type": "integer",
47
+ "minimum": 1,
48
+ "maximum": 10
49
+ },
50
+ "required_main": { "$ref": "#/$defs/nonEmptyString" },
51
+ "required_candidates": { "$ref": "#/$defs/nonEmptyStringArray" },
52
+ "required_adjuncts": { "$ref": "#/$defs/nonEmptyStringArray" },
53
+ "forbidden_candidates": { "$ref": "#/$defs/nonEmptyStringArray" }
54
+ }
55
+ }
56
+ }
57
+ }