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