archctx 0.6.3 → 0.7.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.
@@ -0,0 +1,2463 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/runtime-recommendation-show.schema.json",
4
+ "title": "RuntimeRecommendationShowV1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "recommendationId",
10
+ "source",
11
+ "status",
12
+ "recommendation",
13
+ "evidence",
14
+ "baseline",
15
+ "affectedModules",
16
+ "decisions",
17
+ "worktree",
18
+ "privacy"
19
+ ],
20
+ "properties": {
21
+ "schemaVersion": {
22
+ "const": "archcontext.runtime-recommendation-show/v1"
23
+ },
24
+ "recommendationId": {
25
+ "type": "string"
26
+ },
27
+ "source": {
28
+ "enum": [
29
+ "ledger",
30
+ "scan-candidate"
31
+ ]
32
+ },
33
+ "status": {
34
+ "enum": [
35
+ "open",
36
+ "acknowledged",
37
+ "accepted",
38
+ "rejected",
39
+ "deferred",
40
+ "waived",
41
+ "resolved",
42
+ "superseded",
43
+ "expired"
44
+ ]
45
+ },
46
+ "recommendation": {
47
+ "if": {
48
+ "properties": {
49
+ "schemaVersion": {
50
+ "const": "archcontext.recommendation/v3"
51
+ }
52
+ }
53
+ },
54
+ "then": {
55
+ "$ref": "#/$defs/recommendationV3"
56
+ },
57
+ "else": {
58
+ "$ref": "recommendation.schema.json"
59
+ }
60
+ },
61
+ "evidence": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": [
65
+ "items",
66
+ "bindings"
67
+ ],
68
+ "properties": {
69
+ "items": {
70
+ "type": "array",
71
+ "items": {
72
+ "$ref": "evidence-item.schema.json"
73
+ }
74
+ },
75
+ "bindings": {
76
+ "type": "array",
77
+ "items": {
78
+ "$ref": "evidence-binding.schema.json"
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "baseline": {
84
+ "oneOf": [
85
+ {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": [
89
+ "status",
90
+ "snapshotDigest"
91
+ ],
92
+ "properties": {
93
+ "status": {
94
+ "enum": [
95
+ "measured",
96
+ "unverifiable"
97
+ ]
98
+ },
99
+ "snapshotDigest": {
100
+ "$ref": "#/$defs/sha256"
101
+ }
102
+ }
103
+ },
104
+ {
105
+ "type": "object",
106
+ "additionalProperties": false,
107
+ "required": [
108
+ "status",
109
+ "snapshotDigest"
110
+ ],
111
+ "properties": {
112
+ "status": {
113
+ "const": "missing"
114
+ },
115
+ "snapshotDigest": {
116
+ "type": "null"
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ },
122
+ "affectedModules": {
123
+ "type": "array",
124
+ "items": {
125
+ "$ref": "#/$defs/moduleStatistics"
126
+ }
127
+ },
128
+ "decisions": {
129
+ "type": "array",
130
+ "items": {
131
+ "$ref": "recommendation-feedback.schema.json"
132
+ }
133
+ },
134
+ "worktree": {
135
+ "oneOf": [
136
+ {
137
+ "type": "null"
138
+ },
139
+ {
140
+ "type": "object",
141
+ "additionalProperties": false,
142
+ "required": [
143
+ "headSha",
144
+ "worktreeDigest"
145
+ ],
146
+ "properties": {
147
+ "headSha": {
148
+ "type": "string"
149
+ },
150
+ "worktreeDigest": {
151
+ "$ref": "#/$defs/sha256"
152
+ }
153
+ }
154
+ }
155
+ ]
156
+ },
157
+ "privacy": {
158
+ "$ref": "#/$defs/privacy"
159
+ }
160
+ },
161
+ "if": {
162
+ "properties": {
163
+ "source": {
164
+ "const": "scan-candidate"
165
+ }
166
+ }
167
+ },
168
+ "then": {
169
+ "properties": {
170
+ "worktree": {
171
+ "type": "object"
172
+ }
173
+ }
174
+ },
175
+ "else": {
176
+ "properties": {
177
+ "worktree": {
178
+ "type": "null"
179
+ }
180
+ }
181
+ },
182
+ "$defs": {
183
+ "sha256": {
184
+ "type": "string",
185
+ "pattern": "^sha256:[a-f0-9]{64}$"
186
+ },
187
+ "repoRelativePath": {
188
+ "type": "string",
189
+ "minLength": 1,
190
+ "pattern": "^(?!/)(?!.*\\\\)(?!(?:.*/)?\\.\\.(?:/|$)).+$"
191
+ },
192
+ "evidenceLine": {
193
+ "type": [
194
+ "integer",
195
+ "null"
196
+ ],
197
+ "minimum": 1
198
+ },
199
+ "evidenceSpecifier": {
200
+ "type": "string",
201
+ "minLength": 1,
202
+ "maxLength": 512,
203
+ "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
204
+ },
205
+ "evidenceIdList": {
206
+ "type": "array",
207
+ "maxItems": 32,
208
+ "uniqueItems": true,
209
+ "items": {
210
+ "type": "string"
211
+ }
212
+ },
213
+ "observationMetrics": {
214
+ "type": "object",
215
+ "additionalProperties": {
216
+ "type": [
217
+ "number",
218
+ "null"
219
+ ]
220
+ }
221
+ },
222
+ "evidenceImportEdge": {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "required": [
226
+ "fromPath",
227
+ "fromLine",
228
+ "toPath",
229
+ "specifier",
230
+ "fromNodeId",
231
+ "toNodeId"
232
+ ],
233
+ "properties": {
234
+ "fromPath": {
235
+ "$ref": "#/$defs/repoRelativePath"
236
+ },
237
+ "fromLine": {
238
+ "$ref": "#/$defs/evidenceLine"
239
+ },
240
+ "toPath": {
241
+ "$ref": "#/$defs/repoRelativePath"
242
+ },
243
+ "specifier": {
244
+ "$ref": "#/$defs/evidenceSpecifier"
245
+ },
246
+ "fromNodeId": {
247
+ "type": "string",
248
+ "minLength": 1,
249
+ "pattern": "\\S"
250
+ },
251
+ "toNodeId": {
252
+ "type": "string",
253
+ "minLength": 1,
254
+ "pattern": "\\S"
255
+ }
256
+ }
257
+ },
258
+ "evidenceDirectionViolation": {
259
+ "type": "object",
260
+ "additionalProperties": false,
261
+ "required": [
262
+ "fromPath",
263
+ "fromLine",
264
+ "toPath",
265
+ "specifier",
266
+ "fromNodeId",
267
+ "toNodeId",
268
+ "constraintId"
269
+ ],
270
+ "properties": {
271
+ "fromPath": {
272
+ "$ref": "#/$defs/repoRelativePath"
273
+ },
274
+ "fromLine": {
275
+ "$ref": "#/$defs/evidenceLine"
276
+ },
277
+ "toPath": {
278
+ "$ref": "#/$defs/repoRelativePath"
279
+ },
280
+ "specifier": {
281
+ "$ref": "#/$defs/evidenceSpecifier"
282
+ },
283
+ "fromNodeId": {
284
+ "type": "string",
285
+ "minLength": 1,
286
+ "pattern": "\\S"
287
+ },
288
+ "toNodeId": {
289
+ "type": "string",
290
+ "minLength": 1,
291
+ "pattern": "\\S"
292
+ },
293
+ "constraintId": {
294
+ "type": "string"
295
+ }
296
+ }
297
+ },
298
+ "evidencePath": {
299
+ "type": "object",
300
+ "additionalProperties": false,
301
+ "required": [
302
+ "path",
303
+ "candidateOwnerNodeIds",
304
+ "candidateOwnerCount"
305
+ ],
306
+ "properties": {
307
+ "path": {
308
+ "$ref": "#/$defs/repoRelativePath"
309
+ },
310
+ "candidateOwnerNodeIds": {
311
+ "$ref": "#/$defs/evidenceIdList"
312
+ },
313
+ "candidateOwnerCount": {
314
+ "type": "integer",
315
+ "minimum": 0
316
+ }
317
+ }
318
+ },
319
+ "evidenceUnresolvedImport": {
320
+ "type": "object",
321
+ "additionalProperties": false,
322
+ "required": [
323
+ "fromPath",
324
+ "fromLine",
325
+ "specifier"
326
+ ],
327
+ "properties": {
328
+ "fromPath": {
329
+ "$ref": "#/$defs/repoRelativePath"
330
+ },
331
+ "fromLine": {
332
+ "$ref": "#/$defs/evidenceLine"
333
+ },
334
+ "specifier": {
335
+ "$ref": "#/$defs/evidenceSpecifier"
336
+ }
337
+ }
338
+ },
339
+ "observationEvidence": {
340
+ "oneOf": [
341
+ {
342
+ "type": "object",
343
+ "additionalProperties": false,
344
+ "required": [
345
+ "kind",
346
+ "memberNodeIds",
347
+ "edges",
348
+ "totalCount",
349
+ "truncated"
350
+ ],
351
+ "properties": {
352
+ "kind": {
353
+ "const": "cycle"
354
+ },
355
+ "memberNodeIds": {
356
+ "$ref": "#/$defs/evidenceIdList"
357
+ },
358
+ "edges": {
359
+ "type": "array",
360
+ "maxItems": 20,
361
+ "items": {
362
+ "$ref": "#/$defs/evidenceImportEdge"
363
+ }
364
+ },
365
+ "totalCount": {
366
+ "type": "integer",
367
+ "minimum": 0
368
+ },
369
+ "truncated": {
370
+ "type": "boolean"
371
+ }
372
+ }
373
+ },
374
+ {
375
+ "type": "object",
376
+ "additionalProperties": false,
377
+ "required": [
378
+ "kind",
379
+ "constraintIds",
380
+ "constraintCount",
381
+ "violations",
382
+ "totalCount",
383
+ "truncated"
384
+ ],
385
+ "properties": {
386
+ "kind": {
387
+ "const": "direction-violation"
388
+ },
389
+ "constraintIds": {
390
+ "$ref": "#/$defs/evidenceIdList"
391
+ },
392
+ "constraintCount": {
393
+ "type": "integer",
394
+ "minimum": 0
395
+ },
396
+ "violations": {
397
+ "type": "array",
398
+ "maxItems": 20,
399
+ "items": {
400
+ "$ref": "#/$defs/evidenceDirectionViolation"
401
+ }
402
+ },
403
+ "totalCount": {
404
+ "type": "integer",
405
+ "minimum": 0
406
+ },
407
+ "truncated": {
408
+ "type": "boolean"
409
+ }
410
+ }
411
+ },
412
+ {
413
+ "type": "object",
414
+ "additionalProperties": false,
415
+ "required": [
416
+ "kind",
417
+ "paths",
418
+ "totalCount",
419
+ "truncated"
420
+ ],
421
+ "properties": {
422
+ "kind": {
423
+ "enum": [
424
+ "ownership-ambiguous",
425
+ "undeclared-footprint",
426
+ "unowned-paths"
427
+ ]
428
+ },
429
+ "paths": {
430
+ "type": "array",
431
+ "maxItems": 20,
432
+ "items": {
433
+ "$ref": "#/$defs/evidencePath"
434
+ }
435
+ },
436
+ "totalCount": {
437
+ "type": "integer",
438
+ "minimum": 0
439
+ },
440
+ "truncated": {
441
+ "type": "boolean"
442
+ }
443
+ }
444
+ },
445
+ {
446
+ "type": "object",
447
+ "additionalProperties": false,
448
+ "required": [
449
+ "kind",
450
+ "coverage",
451
+ "reasonCodes",
452
+ "unresolvedImports",
453
+ "totalCount",
454
+ "truncated"
455
+ ],
456
+ "properties": {
457
+ "kind": {
458
+ "const": "evidence-gap"
459
+ },
460
+ "coverage": {
461
+ "enum": [
462
+ "complete",
463
+ "partial",
464
+ "unknown"
465
+ ]
466
+ },
467
+ "reasonCodes": {
468
+ "type": "array",
469
+ "uniqueItems": true,
470
+ "items": {
471
+ "enum": [
472
+ "caller-coverage-unknown",
473
+ "code-facts-import-limit",
474
+ "code-facts-missing",
475
+ "code-facts-truncated",
476
+ "major-change-detected",
477
+ "multi-node-scope",
478
+ "node-footprint-undeclared",
479
+ "ownership-ambiguous",
480
+ "single-node-scope",
481
+ "target-unresolved",
482
+ "unowned-paths"
483
+ ]
484
+ }
485
+ },
486
+ "unresolvedImports": {
487
+ "type": "array",
488
+ "maxItems": 20,
489
+ "items": {
490
+ "$ref": "#/$defs/evidenceUnresolvedImport"
491
+ }
492
+ },
493
+ "totalCount": {
494
+ "type": "integer",
495
+ "minimum": 0
496
+ },
497
+ "truncated": {
498
+ "type": "boolean"
499
+ }
500
+ }
501
+ }
502
+ ]
503
+ },
504
+ "targetOutcome": {
505
+ "type": "object",
506
+ "additionalProperties": false,
507
+ "required": [
508
+ "outcomeId",
509
+ "metric",
510
+ "subjectSelectorId",
511
+ "nodeId",
512
+ "operator",
513
+ "value",
514
+ "required"
515
+ ],
516
+ "properties": {
517
+ "outcomeId": {
518
+ "type": "string"
519
+ },
520
+ "metric": {
521
+ "type": "string",
522
+ "minLength": 1,
523
+ "pattern": "\\S"
524
+ },
525
+ "subjectSelectorId": {
526
+ "type": "string"
527
+ },
528
+ "nodeId": {
529
+ "type": [
530
+ "string",
531
+ "null"
532
+ ]
533
+ },
534
+ "operator": {
535
+ "enum": [
536
+ "absent",
537
+ "equals",
538
+ "greater_than",
539
+ "less_than",
540
+ "present"
541
+ ]
542
+ },
543
+ "value": {
544
+ "type": [
545
+ "number",
546
+ "null"
547
+ ]
548
+ },
549
+ "required": {
550
+ "type": "boolean"
551
+ }
552
+ },
553
+ "if": {
554
+ "properties": {
555
+ "operator": {
556
+ "enum": [
557
+ "absent",
558
+ "present"
559
+ ]
560
+ }
561
+ }
562
+ },
563
+ "then": {
564
+ "properties": {
565
+ "value": {
566
+ "type": "null"
567
+ }
568
+ }
569
+ },
570
+ "else": {
571
+ "properties": {
572
+ "value": {
573
+ "type": "number"
574
+ }
575
+ }
576
+ }
577
+ },
578
+ "killListEntry": {
579
+ "type": "object",
580
+ "additionalProperties": false,
581
+ "required": [
582
+ "kind",
583
+ "selectorId",
584
+ "required"
585
+ ],
586
+ "properties": {
587
+ "kind": {
588
+ "enum": [
589
+ "path",
590
+ "relation",
591
+ "symbol"
592
+ ]
593
+ },
594
+ "selectorId": {
595
+ "type": "string"
596
+ },
597
+ "required": {
598
+ "type": "boolean"
599
+ }
600
+ }
601
+ },
602
+ "architectureTargetDelta": {
603
+ "type": "object",
604
+ "additionalProperties": false,
605
+ "required": [
606
+ "interventionId",
607
+ "trigger",
608
+ "thesis",
609
+ "targetState",
610
+ "migrationState",
611
+ "completionCriteria",
612
+ "falsifiers",
613
+ "benefitLedger",
614
+ "unresolvedTargets"
615
+ ],
616
+ "properties": {
617
+ "interventionId": {
618
+ "type": "string"
619
+ },
620
+ "trigger": {
621
+ "type": "array",
622
+ "items": {
623
+ "type": "string"
624
+ },
625
+ "minItems": 1
626
+ },
627
+ "thesis": {
628
+ "type": "string",
629
+ "minLength": 1,
630
+ "pattern": "\\S"
631
+ },
632
+ "targetState": {
633
+ "type": "object",
634
+ "additionalProperties": false,
635
+ "required": [
636
+ "owners",
637
+ "requiredRelations",
638
+ "removedConcepts"
639
+ ],
640
+ "properties": {
641
+ "owners": {
642
+ "type": "object",
643
+ "additionalProperties": {
644
+ "type": "string"
645
+ }
646
+ },
647
+ "requiredRelations": {
648
+ "type": "array",
649
+ "items": {
650
+ "type": "string"
651
+ }
652
+ },
653
+ "removedConcepts": {
654
+ "type": "array",
655
+ "items": {
656
+ "type": "string"
657
+ }
658
+ }
659
+ }
660
+ },
661
+ "migrationState": {
662
+ "type": "object",
663
+ "additionalProperties": false,
664
+ "required": [
665
+ "active",
666
+ "compatibilityContracts",
667
+ "temporaryRelations"
668
+ ],
669
+ "properties": {
670
+ "active": {
671
+ "type": "boolean"
672
+ },
673
+ "compatibilityContracts": {
674
+ "type": "array",
675
+ "items": {
676
+ "type": "string"
677
+ }
678
+ },
679
+ "cleanupBy": {
680
+ "type": "string"
681
+ },
682
+ "temporaryRelations": {
683
+ "type": "array",
684
+ "items": {
685
+ "type": "string"
686
+ }
687
+ }
688
+ }
689
+ },
690
+ "completionCriteria": {
691
+ "type": "array",
692
+ "minItems": 1,
693
+ "items": {
694
+ "$ref": "#/$defs/targetOutcome"
695
+ }
696
+ },
697
+ "falsifiers": {
698
+ "type": "array",
699
+ "items": {
700
+ "type": "string"
701
+ },
702
+ "minItems": 1
703
+ },
704
+ "benefitLedger": {
705
+ "type": "object",
706
+ "additionalProperties": false,
707
+ "required": [
708
+ "benefits",
709
+ "costs",
710
+ "rollbackPoint"
711
+ ],
712
+ "properties": {
713
+ "benefits": {
714
+ "type": "array",
715
+ "items": {
716
+ "type": "string"
717
+ }
718
+ },
719
+ "costs": {
720
+ "type": "array",
721
+ "items": {
722
+ "type": "string"
723
+ }
724
+ },
725
+ "rollbackPoint": {
726
+ "type": "string",
727
+ "minLength": 1,
728
+ "pattern": "\\S"
729
+ }
730
+ }
731
+ },
732
+ "unresolvedTargets": {
733
+ "type": "array",
734
+ "uniqueItems": true,
735
+ "items": {
736
+ "type": "string"
737
+ }
738
+ },
739
+ "extensions": {
740
+ "type": "object",
741
+ "additionalProperties": true
742
+ }
743
+ }
744
+ },
745
+ "recommendationAuthor": {
746
+ "type": "object",
747
+ "additionalProperties": false,
748
+ "required": [
749
+ "kind",
750
+ "id",
751
+ "source"
752
+ ],
753
+ "properties": {
754
+ "kind": {
755
+ "enum": [
756
+ "developer",
757
+ "daemon",
758
+ "hook",
759
+ "cli",
760
+ "mcp",
761
+ "subagent",
762
+ "migration",
763
+ "system"
764
+ ]
765
+ },
766
+ "id": {
767
+ "type": "string",
768
+ "minLength": 1,
769
+ "pattern": "\\S"
770
+ },
771
+ "source": {
772
+ "enum": [
773
+ "cli",
774
+ "mcp",
775
+ "manual",
776
+ "daemon",
777
+ "system",
778
+ "subagent"
779
+ ]
780
+ }
781
+ }
782
+ },
783
+ "practiceRecommendationPayload": {
784
+ "type": "object",
785
+ "additionalProperties": false,
786
+ "required": [
787
+ "practiceId",
788
+ "baselineDigest"
789
+ ],
790
+ "properties": {
791
+ "practiceId": {
792
+ "type": "string"
793
+ },
794
+ "baselineDigest": {
795
+ "type": [
796
+ "string",
797
+ "null"
798
+ ]
799
+ }
800
+ }
801
+ },
802
+ "structuralObservationPayload": {
803
+ "type": "object",
804
+ "additionalProperties": false,
805
+ "required": [
806
+ "assessmentDigest",
807
+ "kind",
808
+ "affectedNodeIds",
809
+ "baselineSnapshotDigest",
810
+ "derivedOutcomes",
811
+ "metrics",
812
+ "signalIds",
813
+ "evidence"
814
+ ],
815
+ "properties": {
816
+ "assessmentDigest": {
817
+ "$ref": "#/$defs/sha256"
818
+ },
819
+ "kind": {
820
+ "enum": [
821
+ "cycle",
822
+ "direction-violation",
823
+ "evidence-gap",
824
+ "ownership-ambiguous",
825
+ "undeclared-footprint",
826
+ "unowned-paths"
827
+ ]
828
+ },
829
+ "affectedNodeIds": {
830
+ "type": "array",
831
+ "items": {
832
+ "type": "string"
833
+ }
834
+ },
835
+ "baselineSnapshotDigest": {
836
+ "$ref": "#/$defs/sha256"
837
+ },
838
+ "derivedOutcomes": {
839
+ "type": "array",
840
+ "items": {
841
+ "$ref": "#/$defs/targetOutcome"
842
+ }
843
+ },
844
+ "metrics": {
845
+ "$ref": "#/$defs/observationMetrics"
846
+ },
847
+ "signalIds": {
848
+ "type": "array",
849
+ "uniqueItems": true,
850
+ "items": {
851
+ "type": "string"
852
+ }
853
+ },
854
+ "evidence": {
855
+ "$ref": "#/$defs/observationEvidence"
856
+ }
857
+ },
858
+ "allOf": [
859
+ {
860
+ "if": {
861
+ "properties": {
862
+ "kind": {
863
+ "const": "cycle"
864
+ }
865
+ }
866
+ },
867
+ "then": {
868
+ "properties": {
869
+ "evidence": {
870
+ "properties": {
871
+ "kind": {
872
+ "const": "cycle"
873
+ }
874
+ }
875
+ }
876
+ }
877
+ }
878
+ },
879
+ {
880
+ "if": {
881
+ "properties": {
882
+ "kind": {
883
+ "const": "direction-violation"
884
+ }
885
+ }
886
+ },
887
+ "then": {
888
+ "properties": {
889
+ "evidence": {
890
+ "properties": {
891
+ "kind": {
892
+ "const": "direction-violation"
893
+ }
894
+ }
895
+ }
896
+ }
897
+ }
898
+ },
899
+ {
900
+ "if": {
901
+ "properties": {
902
+ "kind": {
903
+ "const": "evidence-gap"
904
+ }
905
+ }
906
+ },
907
+ "then": {
908
+ "properties": {
909
+ "evidence": {
910
+ "properties": {
911
+ "kind": {
912
+ "const": "evidence-gap"
913
+ }
914
+ }
915
+ }
916
+ }
917
+ }
918
+ },
919
+ {
920
+ "if": {
921
+ "properties": {
922
+ "kind": {
923
+ "const": "ownership-ambiguous"
924
+ }
925
+ }
926
+ },
927
+ "then": {
928
+ "properties": {
929
+ "evidence": {
930
+ "properties": {
931
+ "kind": {
932
+ "const": "ownership-ambiguous"
933
+ }
934
+ }
935
+ }
936
+ }
937
+ }
938
+ },
939
+ {
940
+ "if": {
941
+ "properties": {
942
+ "kind": {
943
+ "const": "undeclared-footprint"
944
+ }
945
+ }
946
+ },
947
+ "then": {
948
+ "properties": {
949
+ "evidence": {
950
+ "properties": {
951
+ "kind": {
952
+ "const": "undeclared-footprint"
953
+ }
954
+ }
955
+ }
956
+ }
957
+ }
958
+ },
959
+ {
960
+ "if": {
961
+ "properties": {
962
+ "kind": {
963
+ "const": "unowned-paths"
964
+ }
965
+ }
966
+ },
967
+ "then": {
968
+ "properties": {
969
+ "evidence": {
970
+ "properties": {
971
+ "kind": {
972
+ "const": "unowned-paths"
973
+ }
974
+ }
975
+ }
976
+ }
977
+ }
978
+ }
979
+ ]
980
+ },
981
+ "refactorProposalPayload": {
982
+ "type": "object",
983
+ "additionalProperties": false,
984
+ "required": [
985
+ "assessmentDigest",
986
+ "proposalDigest",
987
+ "scale",
988
+ "affectedNodeIds",
989
+ "majorChangeReasons",
990
+ "baselineSnapshotDigest",
991
+ "targetOutcomes",
992
+ "killList"
993
+ ],
994
+ "properties": {
995
+ "assessmentDigest": {
996
+ "$ref": "#/$defs/sha256"
997
+ },
998
+ "proposalDigest": {
999
+ "$ref": "#/$defs/sha256"
1000
+ },
1001
+ "scale": {
1002
+ "enum": [
1003
+ "architecture",
1004
+ "cross_module",
1005
+ "insufficient_evidence",
1006
+ "model_adoption_required",
1007
+ "module"
1008
+ ]
1009
+ },
1010
+ "affectedNodeIds": {
1011
+ "type": "array",
1012
+ "uniqueItems": true,
1013
+ "items": {
1014
+ "type": "string"
1015
+ }
1016
+ },
1017
+ "majorChangeReasons": {
1018
+ "type": "array",
1019
+ "uniqueItems": true,
1020
+ "items": {
1021
+ "enum": [
1022
+ "constraint-changed",
1023
+ "entrypoint-changed",
1024
+ "interface-changed",
1025
+ "lifecycle-changed",
1026
+ "node-added",
1027
+ "node-moved",
1028
+ "node-removed",
1029
+ "node-renamed",
1030
+ "ownership-changed",
1031
+ "relation-changed",
1032
+ "responsibility-changed",
1033
+ "risk-boundary-changed",
1034
+ "verified-flow-proof-changed"
1035
+ ]
1036
+ }
1037
+ },
1038
+ "baselineSnapshotDigest": {
1039
+ "$ref": "#/$defs/sha256"
1040
+ },
1041
+ "targetDelta": {
1042
+ "$ref": "#/$defs/architectureTargetDelta"
1043
+ },
1044
+ "targetOutcomes": {
1045
+ "type": "array",
1046
+ "items": {
1047
+ "$ref": "#/$defs/targetOutcome"
1048
+ }
1049
+ },
1050
+ "killList": {
1051
+ "type": "array",
1052
+ "items": {
1053
+ "$ref": "#/$defs/killListEntry"
1054
+ }
1055
+ }
1056
+ }
1057
+ },
1058
+ "recommendationV3": {
1059
+ "type": "object",
1060
+ "additionalProperties": false,
1061
+ "required": [
1062
+ "schemaVersion",
1063
+ "recommendationId",
1064
+ "runId",
1065
+ "fingerprint",
1066
+ "subject",
1067
+ "status",
1068
+ "confidence",
1069
+ "enforcement",
1070
+ "risk",
1071
+ "uncertainty",
1072
+ "evidenceBindingIds",
1073
+ "explanation",
1074
+ "authoredBy",
1075
+ "subjectSelectorId",
1076
+ "relations",
1077
+ "createdAt",
1078
+ "updatedAt",
1079
+ "category",
1080
+ "payload"
1081
+ ],
1082
+ "properties": {
1083
+ "schemaVersion": {
1084
+ "const": "archcontext.recommendation/v3"
1085
+ },
1086
+ "recommendationId": {
1087
+ "type": "string",
1088
+ "minLength": 1,
1089
+ "pattern": "\\S"
1090
+ },
1091
+ "runId": {
1092
+ "type": "string",
1093
+ "minLength": 1,
1094
+ "pattern": "\\S"
1095
+ },
1096
+ "fingerprint": {
1097
+ "$ref": "#/$defs/sha256"
1098
+ },
1099
+ "subject": {
1100
+ "type": "string"
1101
+ },
1102
+ "practiceId": {
1103
+ "type": "string"
1104
+ },
1105
+ "status": {
1106
+ "enum": [
1107
+ "open",
1108
+ "acknowledged",
1109
+ "accepted",
1110
+ "rejected",
1111
+ "deferred",
1112
+ "waived",
1113
+ "resolved",
1114
+ "superseded",
1115
+ "expired"
1116
+ ]
1117
+ },
1118
+ "confidence": {
1119
+ "enum": [
1120
+ "low",
1121
+ "medium",
1122
+ "high"
1123
+ ]
1124
+ },
1125
+ "enforcement": {
1126
+ "enum": [
1127
+ "advisory",
1128
+ "checkpoint",
1129
+ "complete"
1130
+ ]
1131
+ },
1132
+ "risk": {
1133
+ "enum": [
1134
+ "low",
1135
+ "medium",
1136
+ "high"
1137
+ ]
1138
+ },
1139
+ "uncertainty": {
1140
+ "enum": [
1141
+ "low",
1142
+ "medium",
1143
+ "high"
1144
+ ]
1145
+ },
1146
+ "evidenceBindingIds": {
1147
+ "type": "array",
1148
+ "uniqueItems": true,
1149
+ "items": {
1150
+ "type": "string"
1151
+ }
1152
+ },
1153
+ "explanation": {
1154
+ "type": "array",
1155
+ "items": {
1156
+ "type": "string"
1157
+ }
1158
+ },
1159
+ "authoredBy": {
1160
+ "$ref": "#/$defs/recommendationAuthor"
1161
+ },
1162
+ "subjectSelectorId": {
1163
+ "type": "string",
1164
+ "minLength": 1,
1165
+ "pattern": "\\S"
1166
+ },
1167
+ "relations": {
1168
+ "type": "object",
1169
+ "additionalProperties": false,
1170
+ "required": [],
1171
+ "properties": {
1172
+ "supersedes": {
1173
+ "type": "string"
1174
+ },
1175
+ "regressesFrom": {
1176
+ "type": "string"
1177
+ }
1178
+ }
1179
+ },
1180
+ "createdAt": {
1181
+ "type": "string"
1182
+ },
1183
+ "updatedAt": {
1184
+ "type": "string"
1185
+ },
1186
+ "extensions": {
1187
+ "type": "object",
1188
+ "additionalProperties": true
1189
+ },
1190
+ "category": {
1191
+ "enum": [
1192
+ "practice",
1193
+ "refactor_proposal",
1194
+ "structural_observation"
1195
+ ]
1196
+ },
1197
+ "payload": {
1198
+ "type": "object"
1199
+ }
1200
+ },
1201
+ "allOf": [
1202
+ {
1203
+ "if": {
1204
+ "properties": {
1205
+ "category": {
1206
+ "const": "practice"
1207
+ }
1208
+ }
1209
+ },
1210
+ "then": {
1211
+ "required": [
1212
+ "practiceId"
1213
+ ],
1214
+ "properties": {
1215
+ "payload": {
1216
+ "$ref": "#/$defs/practiceRecommendationPayload"
1217
+ }
1218
+ }
1219
+ }
1220
+ },
1221
+ {
1222
+ "if": {
1223
+ "properties": {
1224
+ "category": {
1225
+ "const": "structural_observation"
1226
+ }
1227
+ }
1228
+ },
1229
+ "then": {
1230
+ "properties": {
1231
+ "payload": {
1232
+ "$ref": "#/$defs/structuralObservationPayload"
1233
+ },
1234
+ "enforcement": {
1235
+ "const": "advisory"
1236
+ },
1237
+ "authoredBy": {
1238
+ "properties": {
1239
+ "kind": {
1240
+ "const": "daemon"
1241
+ },
1242
+ "source": {
1243
+ "const": "daemon"
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1248
+ }
1249
+ },
1250
+ {
1251
+ "if": {
1252
+ "properties": {
1253
+ "category": {
1254
+ "const": "refactor_proposal"
1255
+ }
1256
+ }
1257
+ },
1258
+ "then": {
1259
+ "properties": {
1260
+ "payload": {
1261
+ "$ref": "#/$defs/refactorProposalPayload"
1262
+ },
1263
+ "authoredBy": {
1264
+ "oneOf": [
1265
+ {
1266
+ "properties": {
1267
+ "kind": {
1268
+ "const": "cli"
1269
+ },
1270
+ "source": {
1271
+ "enum": [
1272
+ "cli"
1273
+ ]
1274
+ }
1275
+ }
1276
+ },
1277
+ {
1278
+ "properties": {
1279
+ "kind": {
1280
+ "const": "developer"
1281
+ },
1282
+ "source": {
1283
+ "enum": [
1284
+ "manual"
1285
+ ]
1286
+ }
1287
+ }
1288
+ },
1289
+ {
1290
+ "properties": {
1291
+ "kind": {
1292
+ "const": "mcp"
1293
+ },
1294
+ "source": {
1295
+ "enum": [
1296
+ "mcp"
1297
+ ]
1298
+ }
1299
+ }
1300
+ },
1301
+ {
1302
+ "properties": {
1303
+ "kind": {
1304
+ "const": "subagent"
1305
+ },
1306
+ "source": {
1307
+ "enum": [
1308
+ "subagent"
1309
+ ]
1310
+ }
1311
+ }
1312
+ }
1313
+ ]
1314
+ }
1315
+ },
1316
+ "if": {
1317
+ "properties": {
1318
+ "payload": {
1319
+ "properties": {
1320
+ "scale": {
1321
+ "const": "architecture"
1322
+ }
1323
+ }
1324
+ }
1325
+ }
1326
+ },
1327
+ "then": {
1328
+ "properties": {
1329
+ "enforcement": {
1330
+ "const": "complete"
1331
+ }
1332
+ }
1333
+ },
1334
+ "else": {
1335
+ "properties": {
1336
+ "enforcement": {
1337
+ "const": "checkpoint"
1338
+ }
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+ ]
1344
+ },
1345
+ "repositoryIdentity": {
1346
+ "type": "object",
1347
+ "additionalProperties": false,
1348
+ "required": [
1349
+ "repositoryId",
1350
+ "storageRepositoryId"
1351
+ ],
1352
+ "properties": {
1353
+ "repositoryId": {
1354
+ "type": "string"
1355
+ },
1356
+ "storageRepositoryId": {
1357
+ "type": "string"
1358
+ }
1359
+ }
1360
+ },
1361
+ "worktreeIdentity": {
1362
+ "type": "object",
1363
+ "additionalProperties": false,
1364
+ "required": [
1365
+ "workspaceId",
1366
+ "storageWorkspaceId",
1367
+ "branch",
1368
+ "headSha",
1369
+ "worktreeDigest"
1370
+ ],
1371
+ "properties": {
1372
+ "workspaceId": {
1373
+ "type": "string"
1374
+ },
1375
+ "storageWorkspaceId": {
1376
+ "type": "string"
1377
+ },
1378
+ "branch": {
1379
+ "type": "string"
1380
+ },
1381
+ "headSha": {
1382
+ "type": "string"
1383
+ },
1384
+ "worktreeDigest": {
1385
+ "$ref": "#/$defs/sha256"
1386
+ }
1387
+ }
1388
+ },
1389
+ "moduleStatistics": {
1390
+ "type": "object",
1391
+ "additionalProperties": false,
1392
+ "required": [
1393
+ "nodeId",
1394
+ "nodeDigest",
1395
+ "parentNodeId",
1396
+ "footprintDeclared",
1397
+ "footprint",
1398
+ "surfaces",
1399
+ "dependencyGraph",
1400
+ "tests",
1401
+ "uncertainty",
1402
+ "moduleDigest"
1403
+ ],
1404
+ "properties": {
1405
+ "nodeId": {
1406
+ "type": "string",
1407
+ "minLength": 1,
1408
+ "pattern": "\\S"
1409
+ },
1410
+ "nodeDigest": {
1411
+ "$ref": "#/$defs/sha256"
1412
+ },
1413
+ "parentNodeId": {
1414
+ "type": [
1415
+ "string",
1416
+ "null"
1417
+ ]
1418
+ },
1419
+ "footprintDeclared": {
1420
+ "type": "boolean"
1421
+ },
1422
+ "footprint": {
1423
+ "oneOf": [
1424
+ {
1425
+ "type": "null"
1426
+ },
1427
+ {
1428
+ "type": "object",
1429
+ "additionalProperties": false,
1430
+ "required": [
1431
+ "fileCount",
1432
+ "lineCount",
1433
+ "sourceFilesDigest",
1434
+ "includePatterns",
1435
+ "excludePatterns"
1436
+ ],
1437
+ "properties": {
1438
+ "fileCount": {
1439
+ "type": "integer",
1440
+ "minimum": 0
1441
+ },
1442
+ "lineCount": {
1443
+ "type": "integer",
1444
+ "minimum": 0
1445
+ },
1446
+ "sourceFilesDigest": {
1447
+ "$ref": "#/$defs/sha256"
1448
+ },
1449
+ "includePatterns": {
1450
+ "type": "array",
1451
+ "items": {
1452
+ "type": "string"
1453
+ }
1454
+ },
1455
+ "excludePatterns": {
1456
+ "type": "array",
1457
+ "items": {
1458
+ "type": "string"
1459
+ }
1460
+ }
1461
+ }
1462
+ }
1463
+ ]
1464
+ },
1465
+ "surfaces": {
1466
+ "type": "object",
1467
+ "additionalProperties": false,
1468
+ "required": [
1469
+ "declaredEntrypoints",
1470
+ "observedEntrypoints",
1471
+ "lifecycleOwners",
1472
+ "datastoreSubjects"
1473
+ ],
1474
+ "properties": {
1475
+ "declaredEntrypoints": {
1476
+ "type": "array",
1477
+ "items": {
1478
+ "type": "string"
1479
+ }
1480
+ },
1481
+ "observedEntrypoints": {
1482
+ "type": "array",
1483
+ "items": {
1484
+ "type": "string"
1485
+ }
1486
+ },
1487
+ "lifecycleOwners": {
1488
+ "type": "array",
1489
+ "items": {
1490
+ "type": "string"
1491
+ }
1492
+ },
1493
+ "datastoreSubjects": {
1494
+ "type": "array",
1495
+ "items": {
1496
+ "type": "string"
1497
+ }
1498
+ }
1499
+ }
1500
+ },
1501
+ "dependencyGraph": {
1502
+ "oneOf": [
1503
+ {
1504
+ "type": "null"
1505
+ },
1506
+ {
1507
+ "type": "object",
1508
+ "additionalProperties": false,
1509
+ "required": [
1510
+ "internalEdgeCount",
1511
+ "inboundModuleEdges",
1512
+ "outboundModuleEdges",
1513
+ "fanIn",
1514
+ "fanOut",
1515
+ "stronglyConnectedComponentId",
1516
+ "cycleCount",
1517
+ "instability",
1518
+ "directionViolationCount"
1519
+ ],
1520
+ "properties": {
1521
+ "internalEdgeCount": {
1522
+ "type": "integer",
1523
+ "minimum": 0
1524
+ },
1525
+ "inboundModuleEdges": {
1526
+ "type": "integer",
1527
+ "minimum": 0
1528
+ },
1529
+ "outboundModuleEdges": {
1530
+ "type": "integer",
1531
+ "minimum": 0
1532
+ },
1533
+ "fanIn": {
1534
+ "type": "integer",
1535
+ "minimum": 0
1536
+ },
1537
+ "fanOut": {
1538
+ "type": "integer",
1539
+ "minimum": 0
1540
+ },
1541
+ "stronglyConnectedComponentId": {
1542
+ "type": [
1543
+ "string",
1544
+ "null"
1545
+ ]
1546
+ },
1547
+ "cycleCount": {
1548
+ "type": "integer",
1549
+ "minimum": 0
1550
+ },
1551
+ "instability": {
1552
+ "type": [
1553
+ "number",
1554
+ "null"
1555
+ ],
1556
+ "minimum": 0,
1557
+ "maximum": 1
1558
+ },
1559
+ "directionViolationCount": {
1560
+ "type": [
1561
+ "integer",
1562
+ "null"
1563
+ ],
1564
+ "minimum": 0
1565
+ }
1566
+ }
1567
+ }
1568
+ ]
1569
+ },
1570
+ "tests": {
1571
+ "type": "object",
1572
+ "additionalProperties": false,
1573
+ "required": [
1574
+ "testFileCount",
1575
+ "observedTestEdges",
1576
+ "callerCoverage",
1577
+ "coverageStatus"
1578
+ ],
1579
+ "properties": {
1580
+ "testFileCount": {
1581
+ "type": [
1582
+ "integer",
1583
+ "null"
1584
+ ],
1585
+ "minimum": 0
1586
+ },
1587
+ "observedTestEdges": {
1588
+ "type": [
1589
+ "integer",
1590
+ "null"
1591
+ ],
1592
+ "minimum": 0
1593
+ },
1594
+ "callerCoverage": {
1595
+ "type": [
1596
+ "number",
1597
+ "null"
1598
+ ],
1599
+ "minimum": 0,
1600
+ "maximum": 1
1601
+ },
1602
+ "coverageStatus": {
1603
+ "enum": [
1604
+ "measured",
1605
+ "partial",
1606
+ "unknown"
1607
+ ]
1608
+ }
1609
+ }
1610
+ },
1611
+ "uncertainty": {
1612
+ "type": "object",
1613
+ "additionalProperties": false,
1614
+ "required": [
1615
+ "unresolvedImports",
1616
+ "dynamicInvocation",
1617
+ "ambiguousOwnership"
1618
+ ],
1619
+ "properties": {
1620
+ "unresolvedImports": {
1621
+ "type": "integer",
1622
+ "minimum": 0
1623
+ },
1624
+ "dynamicInvocation": {
1625
+ "enum": [
1626
+ "known",
1627
+ "none_observed",
1628
+ "possible",
1629
+ "unknown"
1630
+ ]
1631
+ },
1632
+ "ambiguousOwnership": {
1633
+ "type": "boolean"
1634
+ }
1635
+ }
1636
+ },
1637
+ "moduleDigest": {
1638
+ "$ref": "#/$defs/sha256"
1639
+ },
1640
+ "extensions": {
1641
+ "type": "object",
1642
+ "additionalProperties": true
1643
+ }
1644
+ },
1645
+ "if": {
1646
+ "properties": {
1647
+ "footprintDeclared": {
1648
+ "const": true
1649
+ }
1650
+ }
1651
+ },
1652
+ "then": {
1653
+ "properties": {
1654
+ "footprint": {
1655
+ "type": "object"
1656
+ }
1657
+ }
1658
+ },
1659
+ "else": {
1660
+ "properties": {
1661
+ "footprint": {
1662
+ "type": "null"
1663
+ }
1664
+ }
1665
+ }
1666
+ },
1667
+ "moduleStatisticsSnapshot": {
1668
+ "type": "object",
1669
+ "additionalProperties": false,
1670
+ "required": [
1671
+ "schemaVersion",
1672
+ "repository",
1673
+ "worktree",
1674
+ "modelDigest",
1675
+ "codeFacts",
1676
+ "modules",
1677
+ "repositorySummary",
1678
+ "createdAt",
1679
+ "snapshotDigest"
1680
+ ],
1681
+ "properties": {
1682
+ "schemaVersion": {
1683
+ "const": "archcontext.module-statistics/v1"
1684
+ },
1685
+ "repository": {
1686
+ "$ref": "#/$defs/repositoryIdentity"
1687
+ },
1688
+ "worktree": {
1689
+ "$ref": "#/$defs/worktreeIdentity"
1690
+ },
1691
+ "modelDigest": {
1692
+ "$ref": "#/$defs/sha256"
1693
+ },
1694
+ "codeFacts": {
1695
+ "type": "object",
1696
+ "additionalProperties": false,
1697
+ "required": [
1698
+ "provider",
1699
+ "version",
1700
+ "binaryDigest",
1701
+ "indexedWorktreeDigest",
1702
+ "coverage",
1703
+ "truncated",
1704
+ "edgeLimit",
1705
+ "reasonCodes"
1706
+ ],
1707
+ "properties": {
1708
+ "provider": {
1709
+ "const": "codegraph"
1710
+ },
1711
+ "version": {
1712
+ "type": "string"
1713
+ },
1714
+ "binaryDigest": {
1715
+ "type": "string"
1716
+ },
1717
+ "indexedWorktreeDigest": {
1718
+ "oneOf": [
1719
+ {
1720
+ "type": "null"
1721
+ },
1722
+ {
1723
+ "$ref": "#/$defs/sha256"
1724
+ }
1725
+ ]
1726
+ },
1727
+ "coverage": {
1728
+ "enum": [
1729
+ "complete",
1730
+ "partial",
1731
+ "unknown"
1732
+ ]
1733
+ },
1734
+ "truncated": {
1735
+ "type": "boolean"
1736
+ },
1737
+ "edgeLimit": {
1738
+ "type": [
1739
+ "integer",
1740
+ "null"
1741
+ ],
1742
+ "minimum": 0
1743
+ },
1744
+ "importNodeCount": {
1745
+ "type": [
1746
+ "integer",
1747
+ "null"
1748
+ ],
1749
+ "minimum": 0
1750
+ },
1751
+ "reasonCodes": {
1752
+ "type": "array",
1753
+ "uniqueItems": true,
1754
+ "items": {
1755
+ "enum": [
1756
+ "caller-coverage-unknown",
1757
+ "code-facts-import-limit",
1758
+ "code-facts-missing",
1759
+ "code-facts-truncated",
1760
+ "major-change-detected",
1761
+ "multi-node-scope",
1762
+ "node-footprint-undeclared",
1763
+ "ownership-ambiguous",
1764
+ "single-node-scope",
1765
+ "target-unresolved",
1766
+ "unowned-paths"
1767
+ ]
1768
+ }
1769
+ }
1770
+ }
1771
+ },
1772
+ "modules": {
1773
+ "type": "array",
1774
+ "items": {
1775
+ "$ref": "#/$defs/moduleStatistics"
1776
+ }
1777
+ },
1778
+ "repositorySummary": {
1779
+ "type": "object",
1780
+ "additionalProperties": false,
1781
+ "required": [
1782
+ "moduleCount",
1783
+ "undeclaredFootprintNodeCount",
1784
+ "ownedFileCount",
1785
+ "unownedFileCount",
1786
+ "multiplyOwnedFileCount",
1787
+ "crossModuleEdgeCount",
1788
+ "crossModuleCycleCount",
1789
+ "stronglyConnectedComponentCount",
1790
+ "unresolvedImportCount",
1791
+ "dynamicInvocationRiskCount"
1792
+ ],
1793
+ "properties": {
1794
+ "moduleCount": {
1795
+ "type": "integer",
1796
+ "minimum": 0
1797
+ },
1798
+ "undeclaredFootprintNodeCount": {
1799
+ "type": "integer",
1800
+ "minimum": 0
1801
+ },
1802
+ "ownedFileCount": {
1803
+ "type": "integer",
1804
+ "minimum": 0
1805
+ },
1806
+ "unownedFileCount": {
1807
+ "type": "integer",
1808
+ "minimum": 0
1809
+ },
1810
+ "multiplyOwnedFileCount": {
1811
+ "type": "integer",
1812
+ "minimum": 0
1813
+ },
1814
+ "crossModuleEdgeCount": {
1815
+ "type": "integer",
1816
+ "minimum": 0
1817
+ },
1818
+ "crossModuleCycleCount": {
1819
+ "type": "integer",
1820
+ "minimum": 0
1821
+ },
1822
+ "stronglyConnectedComponentCount": {
1823
+ "type": "integer",
1824
+ "minimum": 0
1825
+ },
1826
+ "unresolvedImportCount": {
1827
+ "type": "integer",
1828
+ "minimum": 0
1829
+ },
1830
+ "dynamicInvocationRiskCount": {
1831
+ "type": "integer",
1832
+ "minimum": 0
1833
+ }
1834
+ }
1835
+ },
1836
+ "createdAt": {
1837
+ "type": "string"
1838
+ },
1839
+ "snapshotDigest": {
1840
+ "$ref": "#/$defs/sha256"
1841
+ },
1842
+ "extensions": {
1843
+ "type": "object",
1844
+ "additionalProperties": true
1845
+ }
1846
+ }
1847
+ },
1848
+ "refactorScope": {
1849
+ "oneOf": [
1850
+ {
1851
+ "type": "object",
1852
+ "additionalProperties": false,
1853
+ "required": [
1854
+ "kind"
1855
+ ],
1856
+ "properties": {
1857
+ "kind": {
1858
+ "const": "repository"
1859
+ }
1860
+ }
1861
+ },
1862
+ {
1863
+ "type": "object",
1864
+ "additionalProperties": false,
1865
+ "required": [
1866
+ "kind",
1867
+ "nodeId"
1868
+ ],
1869
+ "properties": {
1870
+ "kind": {
1871
+ "const": "node"
1872
+ },
1873
+ "nodeId": {
1874
+ "type": "string",
1875
+ "minLength": 1,
1876
+ "pattern": "\\S"
1877
+ }
1878
+ }
1879
+ },
1880
+ {
1881
+ "type": "object",
1882
+ "additionalProperties": false,
1883
+ "required": [
1884
+ "kind",
1885
+ "paths"
1886
+ ],
1887
+ "properties": {
1888
+ "kind": {
1889
+ "const": "paths"
1890
+ },
1891
+ "paths": {
1892
+ "type": "array",
1893
+ "minItems": 1,
1894
+ "uniqueItems": true,
1895
+ "items": {
1896
+ "$ref": "#/$defs/repoRelativePath"
1897
+ }
1898
+ }
1899
+ }
1900
+ }
1901
+ ]
1902
+ },
1903
+ "refactorProposal": {
1904
+ "type": "object",
1905
+ "additionalProperties": false,
1906
+ "required": [
1907
+ "schemaVersion",
1908
+ "authoredBy",
1909
+ "intent",
1910
+ "scopePaths",
1911
+ "targetOutcomes",
1912
+ "killList",
1913
+ "proposalDigest"
1914
+ ],
1915
+ "properties": {
1916
+ "schemaVersion": {
1917
+ "const": "archcontext.refactor-proposal/v1"
1918
+ },
1919
+ "authoredBy": {
1920
+ "allOf": [
1921
+ {
1922
+ "$ref": "#/$defs/recommendationAuthor"
1923
+ },
1924
+ {
1925
+ "oneOf": [
1926
+ {
1927
+ "properties": {
1928
+ "kind": {
1929
+ "const": "cli"
1930
+ },
1931
+ "source": {
1932
+ "enum": [
1933
+ "cli"
1934
+ ]
1935
+ }
1936
+ }
1937
+ },
1938
+ {
1939
+ "properties": {
1940
+ "kind": {
1941
+ "const": "developer"
1942
+ },
1943
+ "source": {
1944
+ "enum": [
1945
+ "manual"
1946
+ ]
1947
+ }
1948
+ }
1949
+ },
1950
+ {
1951
+ "properties": {
1952
+ "kind": {
1953
+ "const": "mcp"
1954
+ },
1955
+ "source": {
1956
+ "enum": [
1957
+ "mcp"
1958
+ ]
1959
+ }
1960
+ }
1961
+ },
1962
+ {
1963
+ "properties": {
1964
+ "kind": {
1965
+ "const": "subagent"
1966
+ },
1967
+ "source": {
1968
+ "enum": [
1969
+ "subagent"
1970
+ ]
1971
+ }
1972
+ }
1973
+ }
1974
+ ]
1975
+ }
1976
+ ]
1977
+ },
1978
+ "intent": {
1979
+ "type": "string",
1980
+ "minLength": 1,
1981
+ "pattern": "\\S"
1982
+ },
1983
+ "scopePaths": {
1984
+ "type": "array",
1985
+ "minItems": 1,
1986
+ "uniqueItems": true,
1987
+ "items": {
1988
+ "$ref": "#/$defs/repoRelativePath"
1989
+ }
1990
+ },
1991
+ "targetDelta": {
1992
+ "$ref": "#/$defs/architectureTargetDelta"
1993
+ },
1994
+ "targetOutcomes": {
1995
+ "type": "array",
1996
+ "items": {
1997
+ "$ref": "#/$defs/targetOutcome"
1998
+ }
1999
+ },
2000
+ "killList": {
2001
+ "type": "array",
2002
+ "items": {
2003
+ "$ref": "#/$defs/killListEntry"
2004
+ }
2005
+ },
2006
+ "proposalDigest": {
2007
+ "$ref": "#/$defs/sha256"
2008
+ },
2009
+ "extensions": {
2010
+ "type": "object",
2011
+ "additionalProperties": true
2012
+ }
2013
+ }
2014
+ },
2015
+ "refactorRequest": {
2016
+ "type": "object",
2017
+ "additionalProperties": false,
2018
+ "required": [
2019
+ "schemaVersion",
2020
+ "scope"
2021
+ ],
2022
+ "properties": {
2023
+ "schemaVersion": {
2024
+ "const": "archcontext.refactor-request/v1"
2025
+ },
2026
+ "scope": {
2027
+ "$ref": "#/$defs/refactorScope"
2028
+ },
2029
+ "proposal": {
2030
+ "$ref": "#/$defs/refactorProposal"
2031
+ },
2032
+ "expectedHeadSha": {
2033
+ "type": "string"
2034
+ },
2035
+ "expectedWorktreeDigest": {
2036
+ "type": "string"
2037
+ },
2038
+ "task": {
2039
+ "type": "string"
2040
+ },
2041
+ "importNodeLimit": {
2042
+ "type": "integer",
2043
+ "minimum": 1
2044
+ }
2045
+ }
2046
+ },
2047
+ "refactorObservation": {
2048
+ "type": "object",
2049
+ "additionalProperties": false,
2050
+ "required": [
2051
+ "kind",
2052
+ "subjectSelectorId",
2053
+ "signalIds",
2054
+ "metrics",
2055
+ "evidence"
2056
+ ],
2057
+ "properties": {
2058
+ "kind": {
2059
+ "enum": [
2060
+ "cycle",
2061
+ "direction-violation",
2062
+ "evidence-gap",
2063
+ "ownership-ambiguous",
2064
+ "undeclared-footprint",
2065
+ "unowned-paths"
2066
+ ]
2067
+ },
2068
+ "subjectSelectorId": {
2069
+ "type": "string",
2070
+ "minLength": 1,
2071
+ "pattern": "\\S"
2072
+ },
2073
+ "signalIds": {
2074
+ "type": "array",
2075
+ "uniqueItems": true,
2076
+ "items": {
2077
+ "type": "string"
2078
+ }
2079
+ },
2080
+ "metrics": {
2081
+ "$ref": "#/$defs/observationMetrics"
2082
+ },
2083
+ "evidence": {
2084
+ "$ref": "#/$defs/observationEvidence"
2085
+ }
2086
+ },
2087
+ "allOf": [
2088
+ {
2089
+ "if": {
2090
+ "properties": {
2091
+ "kind": {
2092
+ "const": "cycle"
2093
+ }
2094
+ }
2095
+ },
2096
+ "then": {
2097
+ "properties": {
2098
+ "evidence": {
2099
+ "properties": {
2100
+ "kind": {
2101
+ "const": "cycle"
2102
+ }
2103
+ }
2104
+ }
2105
+ }
2106
+ }
2107
+ },
2108
+ {
2109
+ "if": {
2110
+ "properties": {
2111
+ "kind": {
2112
+ "const": "direction-violation"
2113
+ }
2114
+ }
2115
+ },
2116
+ "then": {
2117
+ "properties": {
2118
+ "evidence": {
2119
+ "properties": {
2120
+ "kind": {
2121
+ "const": "direction-violation"
2122
+ }
2123
+ }
2124
+ }
2125
+ }
2126
+ }
2127
+ },
2128
+ {
2129
+ "if": {
2130
+ "properties": {
2131
+ "kind": {
2132
+ "const": "evidence-gap"
2133
+ }
2134
+ }
2135
+ },
2136
+ "then": {
2137
+ "properties": {
2138
+ "evidence": {
2139
+ "properties": {
2140
+ "kind": {
2141
+ "const": "evidence-gap"
2142
+ }
2143
+ }
2144
+ }
2145
+ }
2146
+ }
2147
+ },
2148
+ {
2149
+ "if": {
2150
+ "properties": {
2151
+ "kind": {
2152
+ "const": "ownership-ambiguous"
2153
+ }
2154
+ }
2155
+ },
2156
+ "then": {
2157
+ "properties": {
2158
+ "evidence": {
2159
+ "properties": {
2160
+ "kind": {
2161
+ "const": "ownership-ambiguous"
2162
+ }
2163
+ }
2164
+ }
2165
+ }
2166
+ }
2167
+ },
2168
+ {
2169
+ "if": {
2170
+ "properties": {
2171
+ "kind": {
2172
+ "const": "undeclared-footprint"
2173
+ }
2174
+ }
2175
+ },
2176
+ "then": {
2177
+ "properties": {
2178
+ "evidence": {
2179
+ "properties": {
2180
+ "kind": {
2181
+ "const": "undeclared-footprint"
2182
+ }
2183
+ }
2184
+ }
2185
+ }
2186
+ }
2187
+ },
2188
+ {
2189
+ "if": {
2190
+ "properties": {
2191
+ "kind": {
2192
+ "const": "unowned-paths"
2193
+ }
2194
+ }
2195
+ },
2196
+ "then": {
2197
+ "properties": {
2198
+ "evidence": {
2199
+ "properties": {
2200
+ "kind": {
2201
+ "const": "unowned-paths"
2202
+ }
2203
+ }
2204
+ }
2205
+ }
2206
+ }
2207
+ }
2208
+ ]
2209
+ },
2210
+ "refactorAssessment": {
2211
+ "type": "object",
2212
+ "additionalProperties": false,
2213
+ "required": [
2214
+ "schemaVersion",
2215
+ "requestId",
2216
+ "statisticsSnapshotDigest",
2217
+ "modelDigest",
2218
+ "codeFactsDigest",
2219
+ "requestedScope",
2220
+ "proposalDigest",
2221
+ "observations",
2222
+ "scale",
2223
+ "scaleReasonCodes",
2224
+ "affectedNodeIds",
2225
+ "majorChangeReasons",
2226
+ "pressure",
2227
+ "confidence",
2228
+ "createdAt",
2229
+ "assessmentDigest"
2230
+ ],
2231
+ "properties": {
2232
+ "schemaVersion": {
2233
+ "const": "archcontext.refactor-assessment/v1"
2234
+ },
2235
+ "requestId": {
2236
+ "type": "string"
2237
+ },
2238
+ "statisticsSnapshotDigest": {
2239
+ "$ref": "#/$defs/sha256"
2240
+ },
2241
+ "modelDigest": {
2242
+ "$ref": "#/$defs/sha256"
2243
+ },
2244
+ "codeFactsDigest": {
2245
+ "$ref": "#/$defs/sha256"
2246
+ },
2247
+ "requestedScope": {
2248
+ "$ref": "#/$defs/refactorScope"
2249
+ },
2250
+ "proposalDigest": {
2251
+ "oneOf": [
2252
+ {
2253
+ "type": "null"
2254
+ },
2255
+ {
2256
+ "$ref": "#/$defs/sha256"
2257
+ }
2258
+ ]
2259
+ },
2260
+ "observations": {
2261
+ "type": "array",
2262
+ "items": {
2263
+ "$ref": "#/$defs/refactorObservation"
2264
+ }
2265
+ },
2266
+ "scale": {
2267
+ "oneOf": [
2268
+ {
2269
+ "type": "null"
2270
+ },
2271
+ {
2272
+ "enum": [
2273
+ "architecture",
2274
+ "cross_module",
2275
+ "insufficient_evidence",
2276
+ "model_adoption_required",
2277
+ "module"
2278
+ ]
2279
+ }
2280
+ ]
2281
+ },
2282
+ "scaleReasonCodes": {
2283
+ "type": "array",
2284
+ "uniqueItems": true,
2285
+ "items": {
2286
+ "enum": [
2287
+ "caller-coverage-unknown",
2288
+ "code-facts-import-limit",
2289
+ "code-facts-missing",
2290
+ "code-facts-truncated",
2291
+ "major-change-detected",
2292
+ "multi-node-scope",
2293
+ "node-footprint-undeclared",
2294
+ "ownership-ambiguous",
2295
+ "single-node-scope",
2296
+ "target-unresolved",
2297
+ "unowned-paths"
2298
+ ]
2299
+ }
2300
+ },
2301
+ "affectedNodeIds": {
2302
+ "type": "array",
2303
+ "uniqueItems": true,
2304
+ "items": {
2305
+ "type": "string"
2306
+ }
2307
+ },
2308
+ "majorChangeReasons": {
2309
+ "type": "array",
2310
+ "uniqueItems": true,
2311
+ "items": {
2312
+ "enum": [
2313
+ "constraint-changed",
2314
+ "entrypoint-changed",
2315
+ "interface-changed",
2316
+ "lifecycle-changed",
2317
+ "node-added",
2318
+ "node-moved",
2319
+ "node-removed",
2320
+ "node-renamed",
2321
+ "ownership-changed",
2322
+ "relation-changed",
2323
+ "responsibility-changed",
2324
+ "risk-boundary-changed",
2325
+ "verified-flow-proof-changed"
2326
+ ]
2327
+ }
2328
+ },
2329
+ "pressure": {
2330
+ "type": "object",
2331
+ "additionalProperties": false,
2332
+ "required": [
2333
+ "level",
2334
+ "score",
2335
+ "signalIds"
2336
+ ],
2337
+ "properties": {
2338
+ "level": {
2339
+ "enum": [
2340
+ "low",
2341
+ "medium",
2342
+ "high"
2343
+ ]
2344
+ },
2345
+ "score": {
2346
+ "type": "integer",
2347
+ "minimum": 0,
2348
+ "maximum": 100
2349
+ },
2350
+ "signalIds": {
2351
+ "type": "array",
2352
+ "uniqueItems": true,
2353
+ "items": {
2354
+ "type": "string"
2355
+ }
2356
+ }
2357
+ }
2358
+ },
2359
+ "confidence": {
2360
+ "type": "object",
2361
+ "additionalProperties": false,
2362
+ "required": [
2363
+ "level",
2364
+ "callerCoverage",
2365
+ "testsObserved",
2366
+ "rollbackObserved",
2367
+ "unresolvedEvidence"
2368
+ ],
2369
+ "properties": {
2370
+ "level": {
2371
+ "enum": [
2372
+ "low",
2373
+ "medium",
2374
+ "high"
2375
+ ]
2376
+ },
2377
+ "callerCoverage": {
2378
+ "type": [
2379
+ "number",
2380
+ "null"
2381
+ ],
2382
+ "minimum": 0,
2383
+ "maximum": 1
2384
+ },
2385
+ "testsObserved": {
2386
+ "type": [
2387
+ "boolean",
2388
+ "null"
2389
+ ]
2390
+ },
2391
+ "rollbackObserved": {
2392
+ "type": [
2393
+ "boolean",
2394
+ "null"
2395
+ ]
2396
+ },
2397
+ "unresolvedEvidence": {
2398
+ "type": "array",
2399
+ "items": {
2400
+ "type": "string"
2401
+ }
2402
+ }
2403
+ }
2404
+ },
2405
+ "createdAt": {
2406
+ "type": "string"
2407
+ },
2408
+ "assessmentDigest": {
2409
+ "$ref": "#/$defs/sha256"
2410
+ },
2411
+ "extensions": {
2412
+ "type": "object",
2413
+ "additionalProperties": true
2414
+ }
2415
+ },
2416
+ "if": {
2417
+ "properties": {
2418
+ "proposalDigest": {
2419
+ "type": "null"
2420
+ }
2421
+ }
2422
+ },
2423
+ "then": {
2424
+ "properties": {
2425
+ "scale": {
2426
+ "type": "null"
2427
+ }
2428
+ }
2429
+ },
2430
+ "else": {
2431
+ "properties": {
2432
+ "scale": {
2433
+ "type": "string"
2434
+ }
2435
+ }
2436
+ }
2437
+ },
2438
+ "privacy": {
2439
+ "type": "object",
2440
+ "additionalProperties": false,
2441
+ "required": [
2442
+ "writes",
2443
+ "rawSourcePersisted",
2444
+ "rawDiffPersisted",
2445
+ "promptPersisted"
2446
+ ],
2447
+ "properties": {
2448
+ "writes": {
2449
+ "const": "none"
2450
+ },
2451
+ "rawSourcePersisted": {
2452
+ "const": false
2453
+ },
2454
+ "rawDiffPersisted": {
2455
+ "const": false
2456
+ },
2457
+ "promptPersisted": {
2458
+ "const": false
2459
+ }
2460
+ }
2461
+ }
2462
+ }
2463
+ }