archctx 0.6.1 → 0.7.0

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