@gitgov/core 2.7.1 → 2.8.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.
package/dist/src/index.js CHANGED
@@ -20,7 +20,6 @@ var adapters_exports = {};
20
20
  __export(adapters_exports, {
21
21
  AgentAdapter: () => AgentAdapter,
22
22
  BacklogAdapter: () => BacklogAdapter,
23
- ChangelogAdapter: () => ChangelogAdapter,
24
23
  ExecutionAdapter: () => ExecutionAdapter,
25
24
  FeedbackAdapter: () => FeedbackAdapter,
26
25
  IdentityAdapter: () => IdentityAdapter,
@@ -74,7 +73,7 @@ var actor_record_schema_default = {
74
73
  $schema: "http://json-schema.org/draft-07/schema#",
75
74
  $id: "actor_record_schema.json",
76
75
  title: "ActorRecord",
77
- description: "Canonical schema for actor records as defined in actor_protocol.md",
76
+ description: "Canonical schema for actor records as defined in 02_actor.md",
78
77
  additionalProperties: false,
79
78
  type: "object",
80
79
  required: [
@@ -169,8 +168,9 @@ var agent_record_schema_default = {
169
168
  $schema: "http://json-schema.org/draft-07/schema#",
170
169
  $id: "agent_record_schema.json",
171
170
  title: "AgentRecord",
172
- description: "Canonical schema for agent operational manifests.",
171
+ description: "Canonical schema for agent operational manifests \u2014 the work contract that defines how an agent is invoked.",
173
172
  type: "object",
173
+ additionalProperties: false,
174
174
  required: [
175
175
  "id",
176
176
  "engine"
@@ -178,8 +178,13 @@ var agent_record_schema_default = {
178
178
  properties: {
179
179
  id: {
180
180
  type: "string",
181
- pattern: "^agent:[a-z0-9:-]+$",
182
- description: "Unique identifier for the agent, linking to an ActorRecord."
181
+ pattern: "^agent(:[a-z0-9-]+)+$",
182
+ description: "Unique identifier for the agent, linking 1:1 to an ActorRecord of type agent.",
183
+ examples: [
184
+ "agent:scribe",
185
+ "agent:aion",
186
+ "agent:camilo:cursor"
187
+ ]
183
188
  },
184
189
  status: {
185
190
  type: "string",
@@ -187,63 +192,12 @@ var agent_record_schema_default = {
187
192
  "active",
188
193
  "archived"
189
194
  ],
190
- default: "active"
191
- },
192
- triggers: {
193
- type: "array",
194
- default: [],
195
- description: "Optional list of triggers that activate the agent.\nAdditional fields are allowed and depend on trigger type:\n- webhook triggers: 'event' (event identifier), 'filter' (condition)\n- scheduled triggers: 'cron' (cron expression)\n- manual triggers: 'command' (example CLI command)\n",
196
- items: {
197
- type: "object",
198
- properties: {
199
- type: {
200
- type: "string",
201
- enum: [
202
- "manual",
203
- "webhook",
204
- "scheduled"
205
- ],
206
- description: "Type of trigger that activates the agent"
207
- }
208
- },
209
- required: [
210
- "type"
211
- ],
212
- additionalProperties: true
213
- }
214
- },
215
- knowledge_dependencies: {
216
- type: "array",
217
- default: [],
218
- items: {
219
- type: "string",
220
- description: "Glob patterns for blueprint files this agent needs access to"
221
- }
222
- },
223
- prompt_engine_requirements: {
224
- type: "object",
225
- properties: {
226
- roles: {
227
- type: "array",
228
- items: {
229
- type: "string"
230
- }
231
- },
232
- skills: {
233
- type: "array",
234
- items: {
235
- type: "string"
236
- }
237
- }
238
- }
239
- },
240
- metadata: {
241
- type: "object",
242
- description: "Optional framework-specific or deployment-specific metadata for agent extensions.\nCommon use cases: framework identification (langchain, google-adk), deployment info (provider, image, region),\ncost tracking (cost_per_invocation, currency), tool capabilities, maintainer info.\nThis field does NOT affect agent execution - it is purely informational.\n",
243
- additionalProperties: true
195
+ default: "active",
196
+ description: "Operational status. An archived agent cannot be invoked."
244
197
  },
245
198
  engine: {
246
199
  type: "object",
200
+ description: "Invocation specification \u2014 defines how the agent is executed. Uses oneOf with 4 variants: local, api, mcp, custom.",
247
201
  oneOf: [
248
202
  {
249
203
  required: [
@@ -290,7 +244,8 @@ var agent_record_schema_default = {
290
244
  "GET",
291
245
  "PUT"
292
246
  ],
293
- default: "POST"
247
+ default: "POST",
248
+ description: "HTTP method"
294
249
  },
295
250
  auth: {
296
251
  type: "object",
@@ -336,7 +291,7 @@ var agent_record_schema_default = {
336
291
  },
337
292
  tool: {
338
293
  type: "string",
339
- description: "Name of the MCP tool to invoke. If not specified, defaults to agentId without 'agent:' prefix."
294
+ description: "Name of the MCP tool to invoke. If omitted, the agent has access to all tools on the server."
340
295
  },
341
296
  auth: {
342
297
  type: "object",
@@ -385,6 +340,60 @@ var agent_record_schema_default = {
385
340
  }
386
341
  }
387
342
  ]
343
+ },
344
+ triggers: {
345
+ type: "array",
346
+ default: [],
347
+ description: "Optional list of triggers that activate the agent.\nAdditional fields are allowed and depend on trigger type:\n- manual: 'command' (example CLI command)\n- webhook: 'event' (event identifier), 'filter' (condition)\n- scheduled: 'cron' (cron expression)\n",
348
+ items: {
349
+ type: "object",
350
+ properties: {
351
+ type: {
352
+ type: "string",
353
+ enum: [
354
+ "manual",
355
+ "webhook",
356
+ "scheduled"
357
+ ],
358
+ description: "Type of trigger that activates the agent"
359
+ }
360
+ },
361
+ required: [
362
+ "type"
363
+ ],
364
+ additionalProperties: true
365
+ }
366
+ },
367
+ knowledge_dependencies: {
368
+ type: "array",
369
+ default: [],
370
+ items: {
371
+ type: "string",
372
+ description: "Glob patterns for files this agent needs access to"
373
+ }
374
+ },
375
+ prompt_engine_requirements: {
376
+ type: "object",
377
+ description: "Requirements for prompt composition \u2014 roles and skills the agent needs.",
378
+ properties: {
379
+ roles: {
380
+ type: "array",
381
+ items: {
382
+ type: "string"
383
+ }
384
+ },
385
+ skills: {
386
+ type: "array",
387
+ items: {
388
+ type: "string"
389
+ }
390
+ }
391
+ }
392
+ },
393
+ metadata: {
394
+ type: "object",
395
+ description: "Optional framework-specific or deployment-specific metadata.\nCommon use cases: framework identification (langchain, google-adk), deployment info,\ncost tracking, tool capabilities, maintainer info.\nThis field does NOT affect agent execution \u2014 it is purely informational.\n",
396
+ additionalProperties: true
388
397
  }
389
398
  },
390
399
  examples: [
@@ -615,193 +624,12 @@ var agent_record_schema_default = {
615
624
  ]
616
625
  };
617
626
 
618
- // src/record_schemas/generated/changelog_record_schema.json
619
- var changelog_record_schema_default = {
620
- $schema: "http://json-schema.org/draft-07/schema#",
621
- $id: "changelog_record_schema.json",
622
- title: "ChangelogRecord",
623
- description: "Canonical schema for changelog records - aggregates N tasks into 1 release note",
624
- additionalProperties: false,
625
- type: "object",
626
- required: [
627
- "id",
628
- "title",
629
- "description",
630
- "relatedTasks",
631
- "completedAt"
632
- ],
633
- properties: {
634
- id: {
635
- type: "string",
636
- pattern: "^\\d{10}-changelog-[a-z0-9-]{1,50}$",
637
- maxLength: 71,
638
- description: "Unique identifier for the changelog entry",
639
- examples: [
640
- "1752707800-changelog-sistema-autenticacion-v1",
641
- "1752707800-changelog-sprint-24-api-performance"
642
- ]
643
- },
644
- title: {
645
- type: "string",
646
- minLength: 10,
647
- maxLength: 150,
648
- description: "Executive title of the deliverable",
649
- examples: [
650
- "Sistema de Autenticaci\xF3n Completo v1.0",
651
- "Sprint 24 - Performance Optimizations"
652
- ]
653
- },
654
- description: {
655
- type: "string",
656
- minLength: 20,
657
- maxLength: 5e3,
658
- description: "Detailed description of the value delivered, including key decisions and impact"
659
- },
660
- relatedTasks: {
661
- type: "array",
662
- items: {
663
- type: "string",
664
- pattern: "^\\d{10}-task-[a-z0-9-]{1,50}$"
665
- },
666
- minItems: 1,
667
- description: "IDs of tasks that compose this deliverable (minimum 1 required)"
668
- },
669
- completedAt: {
670
- type: "number",
671
- minimum: 0,
672
- description: "Unix timestamp in seconds when the deliverable was completed"
673
- },
674
- relatedCycles: {
675
- type: "array",
676
- items: {
677
- type: "string",
678
- pattern: "^\\d{10}-cycle-[a-z0-9-]{1,50}$"
679
- },
680
- default: [],
681
- description: "Optional IDs of cycles related to this deliverable"
682
- },
683
- relatedExecutions: {
684
- type: "array",
685
- items: {
686
- type: "string",
687
- pattern: "^\\d{10}-exec-[a-z0-9-]{1,50}$"
688
- },
689
- default: [],
690
- description: "Optional IDs of key execution records related to this work"
691
- },
692
- version: {
693
- type: "string",
694
- minLength: 1,
695
- maxLength: 50,
696
- description: "Optional version or release identifier (e.g., 'v1.0.0', 'sprint-24')",
697
- examples: [
698
- "v1.0.0",
699
- "v2.1.3",
700
- "sprint-24"
701
- ]
702
- },
703
- tags: {
704
- type: "array",
705
- items: {
706
- type: "string",
707
- pattern: "^[a-z0-9-]+(:[a-z0-9-]+)*$"
708
- },
709
- default: [],
710
- description: "Optional tags for categorization (e.g., 'feature:auth', 'bugfix', 'security')"
711
- },
712
- commits: {
713
- type: "array",
714
- items: {
715
- type: "string",
716
- maxLength: 100
717
- },
718
- default: [],
719
- description: "Optional list of git commit hashes related to this deliverable"
720
- },
721
- files: {
722
- type: "array",
723
- items: {
724
- type: "string",
725
- maxLength: 500
726
- },
727
- default: [],
728
- description: "Optional list of main files that were created or modified"
729
- },
730
- notes: {
731
- type: "string",
732
- maxLength: 3e3,
733
- description: "Optional additional context, decisions, or learnings"
734
- }
735
- },
736
- examples: [
737
- {
738
- id: "1752707800-changelog-sistema-autenticacion-v1",
739
- title: "Sistema de Autenticaci\xF3n Completo v1.0",
740
- description: "Implementaci\xF3n completa del sistema de autenticaci\xF3n con OAuth2, 2FA via TOTP, recuperaci\xF3n de contrase\xF1a, y UI responsive. Incluye tests E2E completos (95% coverage) y documentaci\xF3n t\xE9cnica actualizada.",
741
- relatedTasks: [
742
- "1752274500-task-crear-ui-login",
743
- "1752274600-task-integrar-oauth2-backend",
744
- "1752274700-task-implementar-2fa-totp",
745
- "1752274800-task-tests-e2e-auth",
746
- "1752274900-task-documentar-flujo-auth"
747
- ],
748
- completedAt: 1752707800,
749
- relatedCycles: [
750
- "1752200000-cycle-q1-auth-milestone"
751
- ],
752
- relatedExecutions: [
753
- "1752274550-exec-analisis-auth-providers",
754
- "1752707750-exec-final-integration-test"
755
- ],
756
- version: "v1.0.0",
757
- tags: [
758
- "feature:auth",
759
- "security",
760
- "frontend",
761
- "backend"
762
- ],
763
- commits: [
764
- "abc123def",
765
- "456ghi789",
766
- "jkl012mno"
767
- ],
768
- files: [
769
- "src/pages/Login.tsx",
770
- "src/services/auth.ts",
771
- "src/components/TwoFactorSetup.tsx",
772
- "e2e/auth.spec.ts"
773
- ],
774
- notes: "Decisi\xF3n t\xE9cnica: Usamos NextAuth.js despu\xE9s de evaluar Passport.js. El 2FA se implement\xF3 con TOTP (Google Authenticator compatible) en lugar de SMS por seguridad y costo."
775
- },
776
- {
777
- id: "1752707900-changelog-hotfix-payment-timeout",
778
- title: "Hotfix: Critical Payment Timeout Fix",
779
- description: "Fixed critical payment timeout issue affecting 15% of transactions. Increased timeout from 5s to 30s and added circuit breaker pattern for third-party API calls.",
780
- relatedTasks: [
781
- "1752707850-task-fix-payment-timeout",
782
- "1752707870-task-add-circuit-breaker"
783
- ],
784
- completedAt: 1752707900,
785
- version: "v1.2.1",
786
- tags: [
787
- "hotfix",
788
- "critical",
789
- "payment"
790
- ],
791
- commits: [
792
- "xyz789abc"
793
- ],
794
- notes: "Emergency response to production incident. Deployed to production within 2 hours."
795
- }
796
- ]
797
- };
798
-
799
627
  // src/record_schemas/generated/cycle_record_schema.json
800
628
  var cycle_record_schema_default = {
801
629
  $schema: "http://json-schema.org/draft-07/schema#",
802
630
  $id: "cycle_record_schema.json",
803
631
  title: "CycleRecord",
804
- description: "Canonical schema for cycle records - strategic grouping of work",
632
+ description: "Canonical schema for cycle records \u2014 strategic grouping of work into sprints, milestones, or roadmaps.",
805
633
  additionalProperties: false,
806
634
  type: "object",
807
635
  required: [
@@ -814,7 +642,7 @@ var cycle_record_schema_default = {
814
642
  type: "string",
815
643
  pattern: "^\\d{10}-cycle-[a-z0-9-]{1,50}$",
816
644
  maxLength: 67,
817
- description: "Unique identifier for the cycle (10 timestamp + 1 dash + 5 'cycle' + 1 dash + max 50 slug = 67 max)",
645
+ description: "Unique identifier for the cycle (10 timestamp + 1 dash + 5 'cycle' + 1 dash + max 50 slug = 67 max).",
818
646
  examples: [
819
647
  "1754400000-cycle-sprint-24-api-performance",
820
648
  "1754500000-cycle-auth-system-v2",
@@ -825,7 +653,7 @@ var cycle_record_schema_default = {
825
653
  type: "string",
826
654
  minLength: 1,
827
655
  maxLength: 256,
828
- description: "Human-readable title for the cycle (e.g., 'Sprint 24', 'Auth v2.0', 'Q4 2025')",
656
+ description: "Human-readable title for the cycle (e.g., 'Sprint 24', 'Auth v2.0', 'Q4 2025').",
829
657
  examples: [
830
658
  "Sprint 24 - API Performance",
831
659
  "Authentication System v2.0",
@@ -840,7 +668,7 @@ var cycle_record_schema_default = {
840
668
  "completed",
841
669
  "archived"
842
670
  ],
843
- description: "The lifecycle status of the cycle"
671
+ description: "The lifecycle status of the cycle."
844
672
  },
845
673
  taskIds: {
846
674
  type: "array",
@@ -850,7 +678,7 @@ var cycle_record_schema_default = {
850
678
  maxLength: 66
851
679
  },
852
680
  default: [],
853
- description: "Optional array of Task IDs that belong to this cycle. Can be empty for cycles that only contain child cycles. (10 timestamp + 1 dash + 4 'task' + 1 dash + max 50 slug = 66 max)",
681
+ description: "Optional array of Task IDs that belong to this cycle. Bidirectional with TaskRecord.cycleIds. Can be empty for container cycles.",
854
682
  examples: [
855
683
  [
856
684
  "1752274500-task-optimizar-endpoint-search",
@@ -866,7 +694,7 @@ var cycle_record_schema_default = {
866
694
  maxLength: 67
867
695
  },
868
696
  default: [],
869
- description: "Optional array of Cycle IDs that are children of this cycle, allowing for hierarchies (e.g., Q1 containing Sprint 1, Sprint 2, Sprint 3). (10 timestamp + 1 dash + 5 'cycle' + 1 dash + max 50 slug = 67 max)",
697
+ description: "Optional array of child Cycle IDs for hierarchical composition (e.g., Q1 containing Sprint 1, Sprint 2, Sprint 3).",
870
698
  examples: [
871
699
  [
872
700
  "1754400000-cycle-sprint-24",
@@ -900,9 +728,29 @@ var cycle_record_schema_default = {
900
728
  },
901
729
  notes: {
902
730
  type: "string",
903
- minLength: 0,
904
- maxLength: 1e4,
905
- description: "Optional description of the cycle's goals, objectives, and context"
731
+ minLength: 1,
732
+ description: "Optional description of the cycle's goals, objectives, and context."
733
+ },
734
+ metadata: {
735
+ type: "object",
736
+ additionalProperties: true,
737
+ description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nExtends the strategic grouping with structured, queryable attributes.\nCommon use cases: epic lifecycle, sprint configuration, OKR tracking, budget allocation.\n",
738
+ examples: [
739
+ {
740
+ epic: true,
741
+ phase: "active",
742
+ files: {
743
+ overview: "overview.md",
744
+ roadmap: "roadmap.md",
745
+ plan: "implementation_plan.md"
746
+ }
747
+ },
748
+ {
749
+ sprint: 24,
750
+ velocity: 42,
751
+ team: "backend"
752
+ }
753
+ ]
906
754
  }
907
755
  },
908
756
  examples: [
@@ -920,7 +768,7 @@ var cycle_record_schema_default = {
920
768
  "team:backend",
921
769
  "focus:performance"
922
770
  ],
923
- notes: "Objetivo: Reducir la latencia p95 de la API por debajo de 200ms y preparar infraestructura para Black Friday."
771
+ notes: "Objective: Reduce API p95 latency below 200ms and prepare infrastructure for Black Friday."
924
772
  },
925
773
  {
926
774
  id: "1754500000-cycle-auth-system-v2",
@@ -937,7 +785,7 @@ var cycle_record_schema_default = {
937
785
  "security",
938
786
  "feature:auth"
939
787
  ],
940
- notes: "Milestone mayor: Sistema completo de autenticaci\xF3n con OAuth2, 2FA, y gesti\xF3n avanzada de sesiones. Cr\xEDtico para lanzamiento Q4."
788
+ notes: "Major milestone: Complete authentication system with OAuth2, 2FA, and advanced session management. Critical for Q4 launch."
941
789
  },
942
790
  {
943
791
  id: "1754600000-cycle-q4-2025-growth",
@@ -953,7 +801,7 @@ var cycle_record_schema_default = {
953
801
  "strategy:growth",
954
802
  "okr:scale-to-1m-users"
955
803
  ],
956
- notes: "Objetivo trimestral: Escalar a 1M usuarios activos. Incluye mejoras de performance, nuevo sistema de auth, y lanzamiento de app m\xF3vil."
804
+ notes: "Quarterly objective: Scale to 1M active users. Includes performance improvements, new auth system, and mobile app launch."
957
805
  }
958
806
  ]
959
807
  };
@@ -971,10 +819,8 @@ var embedded_metadata_schema_default = {
971
819
  properties: {
972
820
  version: {
973
821
  type: "string",
974
- enum: [
975
- "1.0"
976
- ],
977
- description: "Version of the embedded metadata format."
822
+ pattern: "^\\d+\\.\\d+$",
823
+ description: 'Protocol version in MAJOR.MINOR format (e.g. "1.1", "2.0").'
978
824
  },
979
825
  type: {
980
826
  type: "string",
@@ -983,12 +829,23 @@ var embedded_metadata_schema_default = {
983
829
  "agent",
984
830
  "task",
985
831
  "execution",
986
- "changelog",
987
832
  "feedback",
988
- "cycle"
833
+ "cycle",
834
+ "workflow",
835
+ "custom"
989
836
  ],
990
837
  description: "The type of the record contained in the payload."
991
838
  },
839
+ schemaUrl: {
840
+ type: "string",
841
+ format: "uri",
842
+ description: "URL to a custom schema for the payload. Required when type is 'custom'."
843
+ },
844
+ schemaChecksum: {
845
+ type: "string",
846
+ pattern: "^[a-fA-F0-9]{64}$",
847
+ description: "SHA-256 checksum of the custom schema. Required when type is 'custom'."
848
+ },
992
849
  payloadChecksum: {
993
850
  type: "string",
994
851
  pattern: "^[a-fA-F0-9]{64}$",
@@ -1003,14 +860,14 @@ var embedded_metadata_schema_default = {
1003
860
  keyId: {
1004
861
  type: "string",
1005
862
  pattern: "^(human|agent)(:[a-z0-9-]+)+$",
1006
- description: "The Actor ID of the signer (must match ActorRecord.id pattern)."
863
+ description: "The Actor ID of the signer. Supports scoped identifiers (e.g. agent:camilo:cursor)."
1007
864
  },
1008
865
  role: {
1009
866
  type: "string",
1010
867
  pattern: "^([a-z-]+|custom:[a-z0-9-]+)$",
1011
868
  minLength: 1,
1012
869
  maxLength: 50,
1013
- description: "The context role of the signature (e.g., 'author', 'reviewer', 'auditor', or 'custom:*')."
870
+ description: "The context role of the signature (e.g., 'author', 'reviewer', or 'custom:*')."
1014
871
  },
1015
872
  notes: {
1016
873
  type: "string",
@@ -1025,6 +882,7 @@ var embedded_metadata_schema_default = {
1025
882
  },
1026
883
  timestamp: {
1027
884
  type: "integer",
885
+ minimum: 16e8,
1028
886
  description: "Unix timestamp of the signature."
1029
887
  }
1030
888
  },
@@ -1058,15 +916,14 @@ var embedded_metadata_schema_default = {
1058
916
  "payload"
1059
917
  ],
1060
918
  additionalProperties: false,
1061
- oneOf: [
919
+ allOf: [
1062
920
  {
1063
921
  if: {
1064
922
  properties: {
1065
923
  header: {
1066
- type: "object",
1067
924
  properties: {
1068
925
  type: {
1069
- const: "actor"
926
+ const: "custom"
1070
927
  }
1071
928
  }
1072
929
  }
@@ -1074,21 +931,23 @@ var embedded_metadata_schema_default = {
1074
931
  },
1075
932
  then: {
1076
933
  properties: {
1077
- payload: {
1078
- $ref: "ref:actor_record_schema"
934
+ header: {
935
+ type: "object",
936
+ required: [
937
+ "schemaUrl",
938
+ "schemaChecksum"
939
+ ]
1079
940
  }
1080
941
  }
1081
- },
1082
- else: false
942
+ }
1083
943
  },
1084
944
  {
1085
945
  if: {
1086
946
  properties: {
1087
947
  header: {
1088
- type: "object",
1089
948
  properties: {
1090
949
  type: {
1091
- const: "agent"
950
+ const: "actor"
1092
951
  }
1093
952
  }
1094
953
  }
@@ -1097,20 +956,18 @@ var embedded_metadata_schema_default = {
1097
956
  then: {
1098
957
  properties: {
1099
958
  payload: {
1100
- $ref: "ref:agent_record_schema"
959
+ $ref: "ref:actor_record_schema"
1101
960
  }
1102
961
  }
1103
- },
1104
- else: false
962
+ }
1105
963
  },
1106
964
  {
1107
965
  if: {
1108
966
  properties: {
1109
967
  header: {
1110
- type: "object",
1111
968
  properties: {
1112
969
  type: {
1113
- const: "task"
970
+ const: "agent"
1114
971
  }
1115
972
  }
1116
973
  }
@@ -1119,20 +976,18 @@ var embedded_metadata_schema_default = {
1119
976
  then: {
1120
977
  properties: {
1121
978
  payload: {
1122
- $ref: "ref:task_record_schema"
979
+ $ref: "ref:agent_record_schema"
1123
980
  }
1124
981
  }
1125
- },
1126
- else: false
982
+ }
1127
983
  },
1128
984
  {
1129
985
  if: {
1130
986
  properties: {
1131
987
  header: {
1132
- type: "object",
1133
988
  properties: {
1134
989
  type: {
1135
- const: "execution"
990
+ const: "task"
1136
991
  }
1137
992
  }
1138
993
  }
@@ -1141,20 +996,18 @@ var embedded_metadata_schema_default = {
1141
996
  then: {
1142
997
  properties: {
1143
998
  payload: {
1144
- $ref: "ref:execution_record_schema"
999
+ $ref: "ref:task_record_schema"
1145
1000
  }
1146
1001
  }
1147
- },
1148
- else: false
1002
+ }
1149
1003
  },
1150
1004
  {
1151
1005
  if: {
1152
1006
  properties: {
1153
1007
  header: {
1154
- type: "object",
1155
1008
  properties: {
1156
1009
  type: {
1157
- const: "changelog"
1010
+ const: "execution"
1158
1011
  }
1159
1012
  }
1160
1013
  }
@@ -1163,17 +1016,15 @@ var embedded_metadata_schema_default = {
1163
1016
  then: {
1164
1017
  properties: {
1165
1018
  payload: {
1166
- $ref: "ref:changelog_record_schema"
1019
+ $ref: "ref:execution_record_schema"
1167
1020
  }
1168
1021
  }
1169
- },
1170
- else: false
1022
+ }
1171
1023
  },
1172
1024
  {
1173
1025
  if: {
1174
1026
  properties: {
1175
1027
  header: {
1176
- type: "object",
1177
1028
  properties: {
1178
1029
  type: {
1179
1030
  const: "feedback"
@@ -1188,14 +1039,12 @@ var embedded_metadata_schema_default = {
1188
1039
  $ref: "ref:feedback_record_schema"
1189
1040
  }
1190
1041
  }
1191
- },
1192
- else: false
1042
+ }
1193
1043
  },
1194
1044
  {
1195
1045
  if: {
1196
1046
  properties: {
1197
1047
  header: {
1198
- type: "object",
1199
1048
  properties: {
1200
1049
  type: {
1201
1050
  const: "cycle"
@@ -1210,55 +1059,75 @@ var embedded_metadata_schema_default = {
1210
1059
  $ref: "ref:cycle_record_schema"
1211
1060
  }
1212
1061
  }
1062
+ }
1063
+ },
1064
+ {
1065
+ if: {
1066
+ properties: {
1067
+ header: {
1068
+ properties: {
1069
+ type: {
1070
+ const: "workflow"
1071
+ }
1072
+ }
1073
+ }
1074
+ }
1213
1075
  },
1214
- else: false
1076
+ then: {
1077
+ properties: {
1078
+ payload: {
1079
+ $ref: "ref:workflow_record_schema"
1080
+ }
1081
+ }
1082
+ }
1215
1083
  }
1216
1084
  ],
1217
1085
  examples: [
1218
1086
  {
1219
1087
  header: {
1220
- version: "1.0",
1221
- type: "task",
1222
- payloadChecksum: "a1b2c3d4e5f6...",
1088
+ version: "1.1",
1089
+ type: "actor",
1090
+ payloadChecksum: "063d4ba3505e4d2d3852f6063cbd0b98a8728b2afb4a26a323c5c5c512137398",
1223
1091
  signatures: [
1224
1092
  {
1225
1093
  keyId: "human:lead-dev",
1226
1094
  role: "author",
1227
- notes: "Initial task creation for OAuth 2.0 implementation",
1228
- signature: "...",
1095
+ notes: "Self-registration of lead developer account",
1096
+ signature: "yEtlWOGAek8ukP8fycqYZOyogQBudO5XUf4v4BUGaOTogDH4wraanhLvutaJBM7rdilFUS2VvmxZmIy0KjTZAg==",
1229
1097
  timestamp: 1752274500
1230
1098
  }
1231
1099
  ]
1232
1100
  },
1233
1101
  payload: {
1234
- id: "1752274500-task-implementar-auth",
1235
- status: "pending",
1236
- priority: "high",
1237
- description: "Implementar autenticaci\xF3n OAuth 2.0.",
1238
- tags: [
1239
- "skill:go",
1240
- "area:backend"
1241
- ]
1102
+ id: "human:lead-dev",
1103
+ type: "human",
1104
+ displayName: "Lead Developer",
1105
+ publicKey: "0yyrCETtVql51Id+nRKGmpbfsxNxOz+eCYLpWDoutV0=",
1106
+ roles: [
1107
+ "developer",
1108
+ "reviewer"
1109
+ ],
1110
+ status: "active"
1242
1111
  }
1243
1112
  },
1244
1113
  {
1245
1114
  header: {
1246
- version: "1.0",
1115
+ version: "1.1",
1247
1116
  type: "execution",
1248
- payloadChecksum: "b2c3d4e5f6a1...",
1117
+ payloadChecksum: "bd667ddc8698a50594592ac15d0761e62a9f05cc3ba10a9a853ef0819e5fb2ad",
1249
1118
  signatures: [
1250
1119
  {
1251
- keyId: "agent:cursor",
1120
+ keyId: "agent:camilo:cursor",
1252
1121
  role: "author",
1253
1122
  notes: "OAuth 2.0 flow completed with GitHub provider integration",
1254
- signature: "...",
1123
+ signature: "8d9LWTtMlK/Ct4+QWGFpH4iFdZb9T/hlFThAAGKqz8UOPe9qDwPFcv3b4qz9G+NQXh1/PgB1pl8YiQCe6fnjAQ==",
1255
1124
  timestamp: 1752274600
1256
1125
  },
1257
1126
  {
1258
1127
  keyId: "human:camilo",
1259
1128
  role: "reviewer",
1260
1129
  notes: "Reviewed and tested locally. LGTM.",
1261
- signature: "...",
1130
+ signature: "17xsA75W0zzNZI3DXa8iHmxS5NwedfCwu9DoXwk/vArk9yaHcFsY6EgJHNPUtIX+XeKSVF/lOg6CvVIkcXjjAA==",
1262
1131
  timestamp: 1752274650
1263
1132
  }
1264
1133
  ]
@@ -1268,39 +1137,30 @@ var embedded_metadata_schema_default = {
1268
1137
  taskId: "1752274500-task-implement-oauth",
1269
1138
  type: "progress",
1270
1139
  title: "OAuth 2.0 flow implemented",
1271
- result: "Completed the OAuth 2.0 authentication flow..."
1140
+ result: "Completed the OAuth 2.0 authentication flow with GitHub provider. Token refresh and session management included."
1272
1141
  }
1273
1142
  },
1274
1143
  {
1275
1144
  header: {
1276
- version: "1.0",
1277
- type: "actor",
1278
- payloadChecksum: "c3d4e5f6a1b2...",
1145
+ version: "1.1",
1146
+ type: "custom",
1147
+ schemaUrl: "https://example.com/schemas/deployment-record-v1.json",
1148
+ schemaChecksum: "d4e5f6a1b2c3789012345678901234567890123456789012345678901234abcd",
1149
+ payloadChecksum: "1f9598081fcfcf34732de647de25c8445e68e9320e0c10d3a4bd911c7274a1b3",
1279
1150
  signatures: [
1280
1151
  {
1281
- keyId: "human:admin",
1152
+ keyId: "agent:deploy-bot",
1282
1153
  role: "author",
1283
- notes: "New developer onboarded to team",
1284
- signature: "...",
1154
+ notes: "Production deployment of v2.1.0",
1155
+ signature: "W3cSLJnEp+OmKVOwFqjuLTL1S55/OlQyFDzmmxg+vUfETIiQWNr7aDH06/rHUM11g2BLEGRfXZPQPFry6FJeAw==",
1285
1156
  timestamp: 1752274700
1286
- },
1287
- {
1288
- keyId: "agent:aion",
1289
- role: "auditor",
1290
- notes: "Actor verification: 10/10. Credentials validated.",
1291
- signature: "...",
1292
- timestamp: 1752274705
1293
1157
  }
1294
1158
  ]
1295
1159
  },
1296
1160
  payload: {
1297
- id: "human:new-developer",
1298
- type: "human",
1299
- displayName: "New Developer",
1300
- publicKey: "...",
1301
- roles: [
1302
- "developer"
1303
- ]
1161
+ deploymentId: "deploy-2025-07-12-v2.1.0",
1162
+ environment: "production",
1163
+ status: "success"
1304
1164
  }
1305
1165
  }
1306
1166
  ]
@@ -1311,7 +1171,7 @@ var execution_record_schema_default = {
1311
1171
  $schema: "http://json-schema.org/draft-07/schema#",
1312
1172
  $id: "execution_record_schema.json",
1313
1173
  title: "ExecutionRecord",
1314
- description: "Canonical schema for execution log records - the universal event stream",
1174
+ description: "Canonical schema for execution log records - the universal event stream.",
1315
1175
  additionalProperties: false,
1316
1176
  type: "object",
1317
1177
  required: [
@@ -1326,209 +1186,50 @@ var execution_record_schema_default = {
1326
1186
  type: "string",
1327
1187
  pattern: "^\\d{10}-exec-[a-z0-9-]{1,50}$",
1328
1188
  maxLength: 66,
1329
- description: "Unique identifier for the execution log entry (10 timestamp + 1 dash + 4 'exec' + 1 dash + max 50 slug = 66 max)",
1330
- examples: [
1331
- "1752275000-exec-refactor-queries",
1332
- "1752361200-exec-api-externa-caida"
1333
- ]
1189
+ description: "Unique identifier for the execution log entry."
1334
1190
  },
1335
1191
  taskId: {
1336
1192
  type: "string",
1337
1193
  pattern: "^\\d{10}-task-[a-z0-9-]{1,50}$",
1338
1194
  maxLength: 66,
1339
- description: "ID of the parent task this execution belongs to (10 timestamp + 1 dash + 4 'task' + 1 dash + max 50 slug = 66 max)"
1195
+ description: "ID of the parent task this execution belongs to."
1340
1196
  },
1341
1197
  type: {
1342
1198
  type: "string",
1343
- enum: [
1344
- "analysis",
1345
- "progress",
1346
- "blocker",
1347
- "completion",
1348
- "info",
1349
- "correction"
1350
- ],
1351
- description: "Semantic classification of the execution event",
1352
- examples: [
1353
- "progress",
1354
- "analysis",
1355
- "blocker",
1356
- "completion"
1357
- ]
1199
+ pattern: "^(analysis|decision|progress|blocker|completion|correction|info|custom:[a-z0-9-]+(:[a-z0-9-]+)*)$",
1200
+ description: "Classifies what happened in this execution event. Primitive types cover the fundamental kinds of events that occur during any collaborative work. Extend with 'custom:' for your domain.\nPrimitive types:\n - analysis: Investigation, research, or evaluation before acting.\n - decision: A choice that changes the direction of work.\n - progress: Incremental advancement of work.\n - blocker: An impediment preventing further progress.\n - completion: Work on the task is finished.\n - correction: A fix to something previously done incorrectly.\n - info: Informational note or status update.\n\nCustom types use the 'custom:' prefix for industry-specific extensions. Software development examples:\n - custom:review (code review, design review, QA)\n - custom:deployment (deploy to staging/production)\n - custom:rollback (revert a deployment or change)\n - custom:release (version release, PR merge to main)\n - custom:hotfix (emergency fix in production)\nImplementations that encounter an unrecognized custom type MUST treat it as 'info' for display purposes.\n"
1358
1201
  },
1359
1202
  title: {
1360
1203
  type: "string",
1361
1204
  minLength: 1,
1362
1205
  maxLength: 256,
1363
- description: "Human-readable title for the execution (used to generate ID)",
1364
- examples: [
1365
- "Refactor de queries N+1",
1366
- "API Externa Ca\xEDda",
1367
- "Plan de implementaci\xF3n OAuth2"
1368
- ]
1206
+ description: "Human-readable title for the execution (used to generate ID slug)."
1369
1207
  },
1370
1208
  result: {
1371
1209
  type: "string",
1372
1210
  minLength: 10,
1373
- maxLength: 22e3,
1374
- description: 'The tangible, verifiable output or result of the execution. \nThis is the "WHAT" - evidence of work or event summary.\n'
1211
+ description: 'The tangible, verifiable output or result of the execution. This is the "WHAT" - evidence of work or event summary.\n'
1375
1212
  },
1376
1213
  notes: {
1377
1214
  type: "string",
1378
- maxLength: 6500,
1379
- description: 'Optional narrative, context and decisions behind the execution.\nThis is the "HOW" and "WHY" - the story behind the result.\n'
1215
+ description: 'Optional narrative, context and decisions behind the execution. This is the "HOW" and "WHY" - the story behind the result.\n'
1380
1216
  },
1381
1217
  references: {
1382
1218
  type: "array",
1383
1219
  items: {
1384
1220
  type: "string",
1221
+ minLength: 1,
1385
1222
  maxLength: 500
1386
1223
  },
1387
1224
  default: [],
1388
- description: "Optional list of typed references to relevant commits, files, PRs, or external documents.\nShould use typed prefixes for clarity and trazabilidad (see execution_protocol_appendix.md):\n- commit: Git commit SHA\n- pr: Pull Request number\n- file: File path (relative to repo root)\n- url: External URL\n- issue: GitHub Issue number\n- task: TaskRecord ID\n- exec: ExecutionRecord ID (for corrections or dependencies)\n- changelog: ChangelogRecord ID\n"
1225
+ description: "Optional list of typed references to relevant commits, files, PRs, or external documents. Standard prefixes: commit:, pr:, issue:, file:, url:, task:, exec:.\n"
1389
1226
  },
1390
1227
  metadata: {
1391
1228
  type: "object",
1392
1229
  additionalProperties: true,
1393
- description: "Optional structured data for machine consumption.\nUse this field for data that needs to be programmatically processed (e.g., audit findings,\nperformance metrics, scan results). This complements result (human-readable WHAT) and\nnotes (narrative HOW/WHY) by providing structured, queryable data.\nCommon use cases: audit findings arrays, performance metrics, tool outputs, scan summaries.\n",
1394
- examples: [
1395
- {
1396
- findings: [
1397
- {
1398
- type: "PII",
1399
- file: "src/user.ts",
1400
- line: 42
1401
- }
1402
- ],
1403
- scannedFiles: 245
1404
- },
1405
- {
1406
- metrics: {
1407
- duration_ms: 1250,
1408
- memory_mb: 512
1409
- }
1410
- }
1411
- ]
1230
+ description: "Optional structured data for machine consumption. Use this field for data that needs to be programmatically processed (e.g., audit findings, performance metrics, scan results). Complements result (WHAT) and notes (HOW/WHY) with structured, queryable data.\n"
1412
1231
  }
1413
- },
1414
- examples: [
1415
- {
1416
- id: "1752275500-exec-refactor-queries",
1417
- taskId: "1752274500-task-optimizar-api",
1418
- type: "progress",
1419
- title: "Refactor de queries N+1",
1420
- result: "Refactorizados 3 queries N+1 a un solo JOIN optimizado. Performance mejor\xF3 de 2.5s a 200ms.",
1421
- notes: "Identificados 3 N+1 queries en el endpoint /api/search. Aplicado eager loading y caching de relaciones.",
1422
- references: [
1423
- "commit:b2c3d4e",
1424
- "file:src/api/search.ts"
1425
- ]
1426
- },
1427
- {
1428
- id: "1752361200-exec-api-externa-caida",
1429
- taskId: "1752274500-task-optimizar-api",
1430
- type: "blocker",
1431
- title: "API Externa Ca\xEDda",
1432
- result: "No se puede continuar con testing de integraci\xF3n. API de pagos devuelve 503.",
1433
- notes: "La API de pagos de terceros (api.payments.com) est\xE1 devolviendo errores 503. Contactado soporte del proveedor. ETA de resoluci\xF3n: 2-3 horas.",
1434
- references: [
1435
- "url:https://status.payments.com"
1436
- ]
1437
- },
1438
- {
1439
- id: "1752188000-exec-plan-oauth-implementation",
1440
- taskId: "1752274500-task-oauth-implementation",
1441
- type: "analysis",
1442
- title: "Plan de implementaci\xF3n OAuth2",
1443
- result: "Documento de dise\xF1o t\xE9cnico completado. 5 sub-tareas identificadas con estimaciones de complejidad.",
1444
- notes: "Evaluadas 3 opciones: NextAuth.js (elegida), Passport.js, custom implementation. NextAuth.js por madurez y soporte de m\xFAltiples providers.",
1445
- references: [
1446
- "file:docs/oauth-design.md"
1447
- ]
1448
- },
1449
- {
1450
- id: "1752707800-exec-oauth-completed",
1451
- taskId: "1752274500-task-oauth-implementation",
1452
- type: "completion",
1453
- title: "OAuth Implementation Completed",
1454
- result: "Sistema OAuth2 completamente implementado, testeado y deployado a staging. 95% test coverage. Todos los acceptance criteria cumplidos.",
1455
- notes: "Implementaci\xF3n finalizada. Code review aprobado. Tests E2E passing. Ready para changelog y deploy a producci\xF3n.",
1456
- references: [
1457
- "pr:456",
1458
- "commit:def789abc",
1459
- "url:https://staging.app.com/login"
1460
- ]
1461
- },
1462
- {
1463
- id: "1752275600-exec-cambio-estrategia-redis",
1464
- taskId: "1752274500-task-oauth-implementation",
1465
- type: "info",
1466
- title: "Cambio de estrategia: Usar Redis para sessions",
1467
- result: "Decisi\xF3n: Migrar de JWT stateless a sessions en Redis por requisito de revocaci\xF3n inmediata.",
1468
- notes: "Durante code review se identific\xF3 requisito cr\xEDtico: revocar sesiones inmediatamente (ej: compromiso de cuenta). JWT stateless no permite esto sin lista negra compleja. Redis sessions permite revocaci\xF3n instant\xE1nea.",
1469
- references: [
1470
- "issue:567",
1471
- "url:https://redis.io/docs/manual/keyspace-notifications/"
1472
- ]
1473
- },
1474
- {
1475
- id: "1752275700-exec-correccion-metricas",
1476
- taskId: "1752274500-task-optimizar-api",
1477
- type: "correction",
1478
- title: "Correcci\xF3n: M\xE9tricas de performance",
1479
- result: "Correcci\xF3n de execution 1752275500-exec-refactor-queries: El performance fue 200ms, no 50ms como se report\xF3.",
1480
- notes: "Error de tipeo en execution original. La mejora real fue de 2.5s a 200ms (no 50ms). Sigue siendo significativa (92% mejora) pero n\xFAmeros correctos son importantes para m\xE9tricas.",
1481
- references: [
1482
- "exec:1752275500-exec-refactor-queries"
1483
- ]
1484
- },
1485
- {
1486
- id: "1752276000-exec-source-audit-scan",
1487
- taskId: "1752274500-task-audit-compliance",
1488
- type: "analysis",
1489
- title: "Source Audit Scan - 2025-01-15",
1490
- result: "Escaneados 245 archivos. Encontrados 10 findings (3 critical, 4 high, 3 medium). Ver metadata para detalles estructurados.",
1491
- notes: "Scan ejecutado con RegexDetector + HeuristicDetector. LLM calls: 0 (tier free).",
1492
- references: [
1493
- "file:src/config/db.ts",
1494
- "file:src/auth/keys.ts"
1495
- ],
1496
- metadata: {
1497
- scannedFiles: 245,
1498
- scannedLines: 18420,
1499
- duration_ms: 1250,
1500
- findings: [
1501
- {
1502
- id: "SEC-001",
1503
- severity: "critical",
1504
- file: "src/config/db.ts",
1505
- line: 5,
1506
- type: "api_key"
1507
- },
1508
- {
1509
- id: "SEC-003",
1510
- severity: "critical",
1511
- file: "src/auth/keys.ts",
1512
- line: 2,
1513
- type: "private_key"
1514
- },
1515
- {
1516
- id: "PII-003",
1517
- severity: "critical",
1518
- file: "src/payments/stripe.ts",
1519
- line: 8,
1520
- type: "credit_card"
1521
- }
1522
- ],
1523
- summary: {
1524
- critical: 3,
1525
- high: 4,
1526
- medium: 3,
1527
- low: 0
1528
- }
1529
- }
1530
- }
1531
- ]
1232
+ }
1532
1233
  };
1533
1234
 
1534
1235
  // src/record_schemas/generated/feedback_record_schema.json
@@ -1536,7 +1237,7 @@ var feedback_record_schema_default = {
1536
1237
  $schema: "http://json-schema.org/draft-07/schema#",
1537
1238
  $id: "feedback_record_schema.json",
1538
1239
  title: "FeedbackRecord",
1539
- description: "Canonical schema for feedback records - structured conversation about work",
1240
+ description: "Canonical schema for feedback records \u2014 the structured conversation about work.",
1540
1241
  additionalProperties: false,
1541
1242
  type: "object",
1542
1243
  required: [
@@ -1552,32 +1253,35 @@ var feedback_record_schema_default = {
1552
1253
  type: "string",
1553
1254
  pattern: "^\\d{10}-feedback-[a-z0-9-]{1,50}$",
1554
1255
  maxLength: 70,
1555
- description: "Unique identifier for the feedback entry",
1256
+ description: "Unique identifier for the feedback entry (10 timestamp + 1 dash + 8 'feedback' + 1 dash + max 50 slug = 70 max)",
1556
1257
  examples: [
1557
1258
  "1752788100-feedback-blocking-rest-api",
1558
- "1752788200-feedback-question-test-coverage"
1259
+ "1752788400-feedback-question-test-coverage"
1559
1260
  ]
1560
1261
  },
1561
1262
  entityType: {
1562
1263
  type: "string",
1563
1264
  enum: [
1265
+ "actor",
1266
+ "agent",
1564
1267
  "task",
1565
1268
  "execution",
1566
- "changelog",
1567
1269
  "feedback",
1568
- "cycle"
1270
+ "cycle",
1271
+ "workflow"
1569
1272
  ],
1570
- description: "The type of entity this feedback refers to"
1273
+ description: "The type of entity this feedback refers to."
1571
1274
  },
1572
1275
  entityId: {
1573
1276
  type: "string",
1574
1277
  minLength: 1,
1575
1278
  maxLength: 256,
1576
- description: "The ID of the entity this feedback refers to.\nMust match the pattern for its entityType:\n- task: ^\\d{10}-task-[a-z0-9-]{1,50}$\n- execution: ^\\d{10}-exec-[a-z0-9-]{1,50}$\n- changelog: ^\\d{10}-changelog-[a-z0-9-]{1,50}$\n- feedback: ^\\d{10}-feedback-[a-z0-9-]{1,50}$\n- cycle: ^\\d{10}-cycle-[a-z0-9-]{1,50}$\n",
1279
+ description: "The ID of the entity this feedback refers to.\nMust match the ID pattern for its entityType:\n- actor: ^(human|agent)(:[a-z0-9-]+)+$\n- agent: ^agent(:[a-z0-9-]+)+$\n- task: ^\\d{10}-task-[a-z0-9-]{1,50}$\n- execution: ^\\d{10}-exec-[a-z0-9-]{1,50}$\n- feedback: ^\\d{10}-feedback-[a-z0-9-]{1,50}$\n- cycle: ^\\d{10}-cycle-[a-z0-9-]{1,50}$\n- workflow: ^\\d{10}-workflow-[a-z0-9-]{1,50}$\n",
1577
1280
  examples: [
1578
1281
  "1752274500-task-implementar-oauth",
1579
1282
  "1752642000-exec-subtarea-9-4",
1580
- "1752788100-feedback-blocking-rest-api"
1283
+ "1752788100-feedback-blocking-rest-api",
1284
+ "human:camilo"
1581
1285
  ]
1582
1286
  },
1583
1287
  type: {
@@ -1590,12 +1294,7 @@ var feedback_record_schema_default = {
1590
1294
  "clarification",
1591
1295
  "assignment"
1592
1296
  ],
1593
- description: "The semantic intent of the feedback",
1594
- examples: [
1595
- "blocking",
1596
- "question",
1597
- "approval"
1598
- ]
1297
+ description: "The semantic intent of the feedback."
1599
1298
  },
1600
1299
  status: {
1601
1300
  type: "string",
@@ -1605,19 +1304,18 @@ var feedback_record_schema_default = {
1605
1304
  "resolved",
1606
1305
  "wontfix"
1607
1306
  ],
1608
- description: 'The lifecycle status of the feedback. \nNote: FeedbackRecords are immutable. To change status, create a new feedback \nthat references this one using entityType: "feedback" and resolvesFeedbackId.\n'
1307
+ description: 'The lifecycle status of the feedback.\nFeedbackRecords are immutable. To change status, create a new FeedbackRecord\nthat references this one using entityType: "feedback" and resolvesFeedbackId.\n'
1609
1308
  },
1610
1309
  content: {
1611
1310
  type: "string",
1612
1311
  minLength: 1,
1613
- maxLength: 5e3,
1614
- description: "The content of the feedback. Reduced from 10000 to 5000 chars for practical use."
1312
+ description: "The content of the feedback."
1615
1313
  },
1616
1314
  assignee: {
1617
1315
  type: "string",
1618
1316
  pattern: "^(human|agent)(:[a-z0-9-]+)+$",
1619
1317
  maxLength: 256,
1620
- description: "Optional. The Actor ID responsible for addressing the feedback (e.g., 'human:maria', 'agent:camilo:cursor')",
1318
+ description: "Optional. The Actor ID responsible for addressing the feedback (e.g., 'human:maria', 'agent:camilo:cursor').",
1621
1319
  examples: [
1622
1320
  "human:maria",
1623
1321
  "agent:code-reviewer",
@@ -1628,7 +1326,7 @@ var feedback_record_schema_default = {
1628
1326
  type: "string",
1629
1327
  pattern: "^\\d{10}-feedback-[a-z0-9-]{1,50}$",
1630
1328
  maxLength: 70,
1631
- description: "Optional. The ID of another feedback record that this one resolves or responds to",
1329
+ description: "Optional. The ID of another FeedbackRecord that this one resolves or responds to.",
1632
1330
  examples: [
1633
1331
  "1752788100-feedback-blocking-rest-api"
1634
1332
  ]
@@ -1636,18 +1334,151 @@ var feedback_record_schema_default = {
1636
1334
  metadata: {
1637
1335
  type: "object",
1638
1336
  additionalProperties: true,
1639
- description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nCommon use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.\n",
1640
- examples: [
1641
- {
1642
- fingerprint: "abc123def456",
1643
- ruleId: "PII-001",
1644
- file: "src/user.ts",
1645
- line: 42,
1646
- expiresAt: "2025-12-31T23:59:59Z"
1647
- }
1648
- ]
1337
+ description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nCommon use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.\n"
1649
1338
  }
1650
1339
  },
1340
+ allOf: [
1341
+ {
1342
+ if: {
1343
+ required: [
1344
+ "entityType"
1345
+ ],
1346
+ properties: {
1347
+ entityType: {
1348
+ const: "actor"
1349
+ }
1350
+ }
1351
+ },
1352
+ then: {
1353
+ properties: {
1354
+ entityId: {
1355
+ type: "string",
1356
+ pattern: "^(human|agent)(:[a-z0-9-]+)+$"
1357
+ }
1358
+ }
1359
+ }
1360
+ },
1361
+ {
1362
+ if: {
1363
+ required: [
1364
+ "entityType"
1365
+ ],
1366
+ properties: {
1367
+ entityType: {
1368
+ const: "agent"
1369
+ }
1370
+ }
1371
+ },
1372
+ then: {
1373
+ properties: {
1374
+ entityId: {
1375
+ type: "string",
1376
+ pattern: "^agent(:[a-z0-9-]+)+$"
1377
+ }
1378
+ }
1379
+ }
1380
+ },
1381
+ {
1382
+ if: {
1383
+ required: [
1384
+ "entityType"
1385
+ ],
1386
+ properties: {
1387
+ entityType: {
1388
+ const: "task"
1389
+ }
1390
+ }
1391
+ },
1392
+ then: {
1393
+ properties: {
1394
+ entityId: {
1395
+ type: "string",
1396
+ pattern: "^\\d{10}-task-[a-z0-9-]{1,50}$"
1397
+ }
1398
+ }
1399
+ }
1400
+ },
1401
+ {
1402
+ if: {
1403
+ required: [
1404
+ "entityType"
1405
+ ],
1406
+ properties: {
1407
+ entityType: {
1408
+ const: "execution"
1409
+ }
1410
+ }
1411
+ },
1412
+ then: {
1413
+ properties: {
1414
+ entityId: {
1415
+ type: "string",
1416
+ pattern: "^\\d{10}-exec-[a-z0-9-]{1,50}$"
1417
+ }
1418
+ }
1419
+ }
1420
+ },
1421
+ {
1422
+ if: {
1423
+ required: [
1424
+ "entityType"
1425
+ ],
1426
+ properties: {
1427
+ entityType: {
1428
+ const: "feedback"
1429
+ }
1430
+ }
1431
+ },
1432
+ then: {
1433
+ properties: {
1434
+ entityId: {
1435
+ type: "string",
1436
+ pattern: "^\\d{10}-feedback-[a-z0-9-]{1,50}$"
1437
+ }
1438
+ }
1439
+ }
1440
+ },
1441
+ {
1442
+ if: {
1443
+ required: [
1444
+ "entityType"
1445
+ ],
1446
+ properties: {
1447
+ entityType: {
1448
+ const: "cycle"
1449
+ }
1450
+ }
1451
+ },
1452
+ then: {
1453
+ properties: {
1454
+ entityId: {
1455
+ type: "string",
1456
+ pattern: "^\\d{10}-cycle-[a-z0-9-]{1,50}$"
1457
+ }
1458
+ }
1459
+ }
1460
+ },
1461
+ {
1462
+ if: {
1463
+ required: [
1464
+ "entityType"
1465
+ ],
1466
+ properties: {
1467
+ entityType: {
1468
+ const: "workflow"
1469
+ }
1470
+ }
1471
+ },
1472
+ then: {
1473
+ properties: {
1474
+ entityId: {
1475
+ type: "string",
1476
+ pattern: "^\\d{10}-workflow-[a-z0-9-]{1,50}$"
1477
+ }
1478
+ }
1479
+ }
1480
+ }
1481
+ ],
1651
1482
  examples: [
1652
1483
  {
1653
1484
  id: "1752788100-feedback-blocking-rest-api",
@@ -1655,7 +1486,7 @@ var feedback_record_schema_default = {
1655
1486
  entityId: "1752642000-exec-subtarea-9-4",
1656
1487
  type: "blocking",
1657
1488
  status: "open",
1658
- content: "Esta implementaci\xF3n no cumple el est\xE1ndar de rutas REST. Los endpoints deben seguir el patr\xF3n /api/v1/{resource}/{id}. Actualmente usa /get-user?id=X que no es RESTful."
1489
+ content: "This implementation does not comply with the REST endpoint standard. Endpoints must follow the /api/v1/{resource}/{id} pattern. Currently uses /get-user?id=X which is not RESTful."
1659
1490
  },
1660
1491
  {
1661
1492
  id: "1752788200-feedback-rest-api-fixed",
@@ -1663,7 +1494,7 @@ var feedback_record_schema_default = {
1663
1494
  entityId: "1752788100-feedback-blocking-rest-api",
1664
1495
  type: "clarification",
1665
1496
  status: "resolved",
1666
- content: "Implementada la correcci\xF3n. Ahora todos los endpoints siguen el est\xE1ndar REST: GET /api/v1/users/:id, POST /api/v1/users, etc. Tests actualizados y passing.",
1497
+ content: "Fix implemented. All endpoints now follow REST standard: GET /api/v1/users/:id, POST /api/v1/users, etc. Tests updated and passing.",
1667
1498
  resolvesFeedbackId: "1752788100-feedback-blocking-rest-api"
1668
1499
  },
1669
1500
  {
@@ -1672,7 +1503,7 @@ var feedback_record_schema_default = {
1672
1503
  entityId: "1752274500-task-implementar-oauth",
1673
1504
  type: "assignment",
1674
1505
  status: "open",
1675
- content: "Asignando esta tarea a Mar\xEDa por su experiencia con OAuth2. Prioridad alta para el sprint actual.",
1506
+ content: "Assigning this task to Maria for her experience with OAuth2. High priority for the current sprint.",
1676
1507
  assignee: "human:maria"
1677
1508
  },
1678
1509
  {
@@ -1681,7 +1512,7 @@ var feedback_record_schema_default = {
1681
1512
  entityId: "1752274500-task-implementar-oauth",
1682
1513
  type: "question",
1683
1514
  status: "open",
1684
- content: "\xBFCu\xE1l es el nivel de test coverage esperado para esta feature? El spec no lo menciona expl\xEDcitamente. \xBFDebemos apuntar a 80% como el resto del proyecto?"
1515
+ content: "What level of test coverage is expected for this feature? The spec does not mention it explicitly. Should we aim for 80% like the rest of the project?"
1685
1516
  }
1686
1517
  ]
1687
1518
  };
@@ -1691,7 +1522,7 @@ var task_record_schema_default = {
1691
1522
  $schema: "http://json-schema.org/draft-07/schema#",
1692
1523
  $id: "task_record_schema.json",
1693
1524
  title: "TaskRecord",
1694
- description: "Canonical schema for task records as defined in task_protocol.md",
1525
+ description: "Canonical schema for task records as defined in 04_task.md",
1695
1526
  additionalProperties: false,
1696
1527
  type: "object",
1697
1528
  required: [
@@ -1741,7 +1572,6 @@ var task_record_schema_default = {
1741
1572
  "paused",
1742
1573
  "discarded"
1743
1574
  ],
1744
- maxLength: 40,
1745
1575
  description: "Current state of the task in the institutional flow"
1746
1576
  },
1747
1577
  priority: {
@@ -1752,13 +1582,11 @@ var task_record_schema_default = {
1752
1582
  "high",
1753
1583
  "critical"
1754
1584
  ],
1755
- maxLength: 40,
1756
1585
  description: "Strategic or tactical priority level"
1757
1586
  },
1758
1587
  description: {
1759
1588
  type: "string",
1760
1589
  minLength: 10,
1761
- maxLength: 22e3,
1762
1590
  description: "Functional, technical or strategic summary of the objective"
1763
1591
  },
1764
1592
  tags: {
@@ -1766,7 +1594,7 @@ var task_record_schema_default = {
1766
1594
  items: {
1767
1595
  type: "string",
1768
1596
  minLength: 1,
1769
- pattern: "^[a-z0-9-]+(:[a-z0-9-:]+)*$"
1597
+ pattern: "^[a-z0-9-]+(:[a-z0-9-]+)*$"
1770
1598
  },
1771
1599
  default: [],
1772
1600
  description: "Optional. List of key:value tags for categorization and role suggestion (e.g., 'skill:react', 'role:agent:developer')."
@@ -1783,9 +1611,26 @@ var task_record_schema_default = {
1783
1611
  },
1784
1612
  notes: {
1785
1613
  type: "string",
1786
- minLength: 0,
1787
- maxLength: 3e3,
1614
+ minLength: 1,
1788
1615
  description: "Additional comments, decisions made or added context"
1616
+ },
1617
+ metadata: {
1618
+ type: "object",
1619
+ additionalProperties: true,
1620
+ description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nComplements tags (classification) and notes (free text) with structured, queryable data.\nCommon use cases: epic metadata, external tool references, agent metrics, compliance tags.\n",
1621
+ examples: [
1622
+ {
1623
+ epic: true,
1624
+ phase: "implementation",
1625
+ files: {
1626
+ overview: "overview.md"
1627
+ }
1628
+ },
1629
+ {
1630
+ jira: "AUTH-42",
1631
+ storyPoints: 5
1632
+ }
1633
+ ]
1789
1634
  }
1790
1635
  },
1791
1636
  examples: [
@@ -1868,25 +1713,22 @@ var task_record_schema_default = {
1868
1713
  // src/record_schemas/generated/workflow_record_schema.json
1869
1714
  var workflow_record_schema_default = {
1870
1715
  $schema: "http://json-schema.org/draft-07/schema#",
1871
- $id: "workflow_schema.json",
1716
+ $id: "workflow_record_schema.json",
1872
1717
  title: "WorkflowRecord",
1873
- description: "Complete schema for workflow methodology configuration files that define state transitions, signatures, and custom rules",
1718
+ description: "Schema for workflow methodology configuration that defines named state transitions, signatures, and custom rules.",
1874
1719
  type: "object",
1875
1720
  required: [
1876
- "version",
1721
+ "id",
1877
1722
  "name",
1878
1723
  "state_transitions"
1879
1724
  ],
1880
1725
  additionalProperties: false,
1881
1726
  properties: {
1882
- $schema: {
1883
- type: "string",
1884
- description: "JSON Schema reference"
1885
- },
1886
- version: {
1727
+ id: {
1887
1728
  type: "string",
1888
- pattern: "^\\d+\\.\\d+\\.\\d+$",
1889
- description: "Semantic version of the methodology configuration"
1729
+ pattern: "^\\d{10}-workflow-[a-z0-9-]{1,50}$",
1730
+ maxLength: 70,
1731
+ description: "Unique identifier for the workflow record (10 timestamp + 1 dash + 8 'workflow' + 1 dash + max 50 slug = 70 max)"
1890
1732
  },
1891
1733
  name: {
1892
1734
  type: "string",
@@ -1901,11 +1743,15 @@ var workflow_record_schema_default = {
1901
1743
  },
1902
1744
  state_transitions: {
1903
1745
  type: "object",
1904
- description: "Defines valid state transitions and their requirements",
1746
+ description: "Map of named transitions to their rules. Keys are transition names (e.g., submit, approve, activate, resume), not target states.",
1747
+ propertyNames: {
1748
+ pattern: "^[a-z][a-z0-9_]{0,49}$"
1749
+ },
1905
1750
  additionalProperties: {
1906
1751
  type: "object",
1907
1752
  required: [
1908
1753
  "from",
1754
+ "to",
1909
1755
  "requires"
1910
1756
  ],
1911
1757
  additionalProperties: false,
@@ -1919,21 +1765,26 @@ var workflow_record_schema_default = {
1919
1765
  minItems: 1,
1920
1766
  description: "Valid source states for this transition"
1921
1767
  },
1768
+ to: {
1769
+ type: "string",
1770
+ pattern: "^[a-z][a-z0-9_]{0,49}$",
1771
+ description: "Target state for this transition"
1772
+ },
1922
1773
  requires: {
1923
1774
  type: "object",
1924
1775
  additionalProperties: false,
1925
1776
  properties: {
1926
1777
  command: {
1927
1778
  type: "string",
1928
- description: "CLI command that triggers this transition"
1779
+ description: "CLI command that triggers this transition (Command Gate)"
1929
1780
  },
1930
1781
  event: {
1931
1782
  type: "string",
1932
- description: "System event that triggers this transition"
1783
+ description: "System event that triggers this transition (Event Gate)"
1933
1784
  },
1934
1785
  signatures: {
1935
1786
  type: "object",
1936
- description: "Signature requirements keyed by role (e.g., 'approver:quality', 'developer:backend')",
1787
+ description: "Signature group requirements (Signature Gate)",
1937
1788
  additionalProperties: {
1938
1789
  type: "object",
1939
1790
  required: [
@@ -1973,7 +1824,7 @@ var workflow_record_schema_default = {
1973
1824
  items: {
1974
1825
  type: "string"
1975
1826
  },
1976
- description: "Optional: specific actors that can sign"
1827
+ description: "Optional: restrict to specific actor IDs"
1977
1828
  }
1978
1829
  }
1979
1830
  }
@@ -2022,7 +1873,7 @@ var workflow_record_schema_default = {
2022
1873
  },
2023
1874
  expression: {
2024
1875
  type: "string",
2025
- description: "Inline validation expression for 'custom' validation type. Implementation determines the runtime and language. Must return boolean or Promise<boolean>."
1876
+ description: "Inline validation expression for 'custom' type. Must return boolean."
2026
1877
  },
2027
1878
  module_path: {
2028
1879
  type: "string",
@@ -2033,7 +1884,7 @@ var workflow_record_schema_default = {
2033
1884
  },
2034
1885
  agent_integration: {
2035
1886
  type: "object",
2036
- description: "Optional agent automation configuration for methodology",
1887
+ description: "Optional agent automation configuration",
2037
1888
  additionalProperties: false,
2038
1889
  properties: {
2039
1890
  description: {
@@ -2043,7 +1894,7 @@ var workflow_record_schema_default = {
2043
1894
  },
2044
1895
  required_agents: {
2045
1896
  type: "array",
2046
- description: "References to agents required for this methodology. Agent details (engine, knowledge, etc.) live in their AgentRecord.",
1897
+ description: "Agents required for this methodology",
2047
1898
  items: {
2048
1899
  type: "object",
2049
1900
  required: [
@@ -2065,8 +1916,8 @@ var workflow_record_schema_default = {
2065
1916
  properties: {
2066
1917
  id: {
2067
1918
  type: "string",
2068
- pattern: "^agent:[a-z0-9:-]+$",
2069
- description: "Specific agent ID. References an existing AgentRecord."
1919
+ pattern: "^agent(:[a-z0-9-]+)+$",
1920
+ description: "Specific agent ID (references an AgentRecord)"
2070
1921
  },
2071
1922
  required_roles: {
2072
1923
  type: "array",
@@ -2075,223 +1926,46 @@ var workflow_record_schema_default = {
2075
1926
  pattern: "^[a-z0-9-]+(:[a-z0-9-]+)*$"
2076
1927
  },
2077
1928
  minItems: 1,
2078
- description: "Required capability roles. Matches any agent with these roles (from ActorRecord)."
2079
- },
2080
- triggers: {
2081
- type: "array",
2082
- description: "When this agent activates within this methodology",
2083
- items: {
2084
- type: "object",
2085
- required: [
2086
- "event",
2087
- "action"
2088
- ],
2089
- additionalProperties: false,
2090
- properties: {
2091
- event: {
2092
- type: "string",
2093
- description: "Event that triggers the agent"
2094
- },
2095
- action: {
2096
- type: "string",
2097
- description: "Action the agent should perform"
2098
- },
2099
- cron: {
2100
- type: "string",
2101
- description: "Cron expression for scheduled triggers"
2102
- }
2103
- }
2104
- }
2105
- }
2106
- }
2107
- }
2108
- }
2109
- }
2110
- }
2111
- },
2112
- examples: [
2113
- {
2114
- version: "1.0.0",
2115
- name: "Simple Kanban",
2116
- description: "Basic workflow for small teams",
2117
- state_transitions: {
2118
- review: {
2119
- from: [
2120
- "draft"
2121
- ],
2122
- requires: {
2123
- command: "gitgov task submit"
2124
- }
2125
- },
2126
- ready: {
2127
- from: [
2128
- "review"
2129
- ],
2130
- requires: {
2131
- command: "gitgov task approve",
2132
- signatures: {
2133
- __default__: {
2134
- role: "approver",
2135
- capability_roles: [
2136
- "approver:product"
2137
- ],
2138
- min_approvals: 1
2139
- }
2140
- }
2141
- }
2142
- },
2143
- active: {
2144
- from: [
2145
- "ready"
2146
- ],
2147
- requires: {
2148
- event: "first_execution_record_created"
2149
- }
2150
- },
2151
- done: {
2152
- from: [
2153
- "active"
2154
- ],
2155
- requires: {
2156
- command: "gitgov task complete"
2157
- }
2158
- }
2159
- }
2160
- },
2161
- {
2162
- version: "1.0.0",
2163
- name: "GitGovernance Default Methodology",
2164
- description: "Standard GitGovernance workflow with quality gates and agent collaboration",
2165
- state_transitions: {
2166
- review: {
2167
- from: [
2168
- "draft"
2169
- ],
2170
- requires: {
2171
- command: "gitgov task submit",
2172
- signatures: {
2173
- __default__: {
2174
- role: "submitter",
2175
- capability_roles: [
2176
- "author"
2177
- ],
2178
- min_approvals: 1
2179
- }
2180
- }
2181
- }
2182
- },
2183
- ready: {
2184
- from: [
2185
- "review"
2186
- ],
2187
- requires: {
2188
- command: "gitgov task approve",
2189
- signatures: {
2190
- __default__: {
2191
- role: "approver",
2192
- capability_roles: [
2193
- "approver:product"
2194
- ],
2195
- min_approvals: 1
2196
- },
2197
- design: {
2198
- role: "approver",
2199
- capability_roles: [
2200
- "approver:design"
2201
- ],
2202
- min_approvals: 1
1929
+ description: "Required capability roles (matches any agent with these roles)"
2203
1930
  },
2204
- quality: {
2205
- role: "approver",
2206
- capability_roles: [
2207
- "approver:quality"
2208
- ],
2209
- min_approvals: 1
2210
- }
2211
- }
2212
- }
2213
- },
2214
- active: {
2215
- from: [
2216
- "ready",
2217
- "paused"
2218
- ],
2219
- requires: {
2220
- event: "first_execution_record_created",
2221
- custom_rules: [
2222
- "task_must_have_valid_assignment_for_executor"
2223
- ]
2224
- }
2225
- },
2226
- done: {
2227
- from: [
2228
- "active"
2229
- ],
2230
- requires: {
2231
- command: "gitgov task complete",
2232
- signatures: {
2233
- __default__: {
2234
- role: "approver",
2235
- capability_roles: [
2236
- "approver:quality"
2237
- ],
2238
- min_approvals: 1
2239
- }
2240
- }
2241
- }
2242
- },
2243
- archived: {
2244
- from: [
2245
- "done"
2246
- ],
2247
- requires: {
2248
- event: "changelog_record_created"
2249
- }
2250
- },
2251
- paused: {
2252
- from: [
2253
- "active",
2254
- "review"
2255
- ],
2256
- requires: {
2257
- event: "feedback_blocking_created"
2258
- }
2259
- },
2260
- discarded: {
2261
- from: [
2262
- "ready",
2263
- "active"
2264
- ],
2265
- requires: {
2266
- command: "gitgov task cancel",
2267
- signatures: {
2268
- __default__: {
2269
- role: "canceller",
2270
- capability_roles: [
2271
- "approver:product",
2272
- "approver:quality"
2273
- ],
2274
- min_approvals: 1
1931
+ triggers: {
1932
+ type: "array",
1933
+ description: "Events that activate this agent",
1934
+ items: {
1935
+ type: "object",
1936
+ required: [
1937
+ "event",
1938
+ "action"
1939
+ ],
1940
+ additionalProperties: false,
1941
+ properties: {
1942
+ event: {
1943
+ type: "string",
1944
+ description: "Event that triggers the agent"
1945
+ },
1946
+ action: {
1947
+ type: "string",
1948
+ description: "Action the agent should perform"
1949
+ },
1950
+ cron: {
1951
+ type: "string",
1952
+ description: "Cron expression for scheduled triggers"
1953
+ }
1954
+ }
1955
+ }
2275
1956
  }
2276
1957
  }
2277
1958
  }
2278
1959
  }
2279
- },
2280
- custom_rules: {
2281
- task_must_have_valid_assignment_for_executor: {
2282
- description: "Task must have a valid assignment before execution can begin",
2283
- validation: "assignment_required"
2284
- }
2285
1960
  }
2286
1961
  }
2287
- ]
1962
+ }
2288
1963
  };
2289
1964
 
2290
1965
  // src/record_schemas/generated/index.ts
2291
1966
  var Schemas = {
2292
1967
  ActorRecord: actor_record_schema_default,
2293
1968
  AgentRecord: agent_record_schema_default,
2294
- ChangelogRecord: changelog_record_schema_default,
2295
1969
  CycleRecord: cycle_record_schema_default,
2296
1970
  EmbeddedMetadata: embedded_metadata_schema_default,
2297
1971
  ExecutionRecord: execution_record_schema_default,
@@ -2342,7 +2016,6 @@ var SchemaValidationCache = class {
2342
2016
  const schemaRefMap = {
2343
2017
  "ActorRecord": "ref:actor_record_schema",
2344
2018
  "AgentRecord": "ref:agent_record_schema",
2345
- "ChangelogRecord": "ref:changelog_record_schema",
2346
2019
  "CycleRecord": "ref:cycle_record_schema",
2347
2020
  "ExecutionRecord": "ref:execution_record_schema",
2348
2021
  "FeedbackRecord": "ref:feedback_record_schema",
@@ -2890,10 +2563,6 @@ function generateExecutionId(title, timestamp) {
2890
2563
  const slug = sanitizeForId(title);
2891
2564
  return `${timestamp}-exec-${slug}`;
2892
2565
  }
2893
- function generateChangelogId(title, timestamp) {
2894
- const slug = sanitizeForId(title);
2895
- return `${timestamp}-changelog-${slug}`;
2896
- }
2897
2566
  function generateFeedbackId(title, timestamp) {
2898
2567
  const slug = sanitizeForId(title);
2899
2568
  return `${timestamp}-feedback-${slug}`;
@@ -2912,7 +2581,7 @@ function createTaskRecord(payload) {
2912
2581
  cycleIds: payload.cycleIds,
2913
2582
  references: payload.references,
2914
2583
  notes: payload.notes,
2915
- ...payload
2584
+ metadata: payload.metadata
2916
2585
  };
2917
2586
  const validation = validateTaskRecordDetailed(task);
2918
2587
  if (!validation.isValid) {
@@ -2981,7 +2650,7 @@ function createCycleRecord(payload) {
2981
2650
  childCycleIds: payload.childCycleIds,
2982
2651
  tags: payload.tags,
2983
2652
  notes: payload.notes,
2984
- ...payload
2653
+ metadata: payload.metadata
2985
2654
  };
2986
2655
  const validation = validateCycleRecordDetailed(cycle);
2987
2656
  if (!validation.isValid) {
@@ -3486,8 +3155,8 @@ var FeedbackAdapter = class {
3486
3155
  if (!payloadWithEntityId.entityId) {
3487
3156
  throw new Error("RecordNotFoundError: entityId is required");
3488
3157
  }
3489
- if (payloadWithEntityId.entityType && !["task", "execution", "changelog", "feedback", "cycle"].includes(payloadWithEntityId.entityType)) {
3490
- throw new Error("InvalidEntityTypeError: entityType must be task, execution, changelog, feedback, or cycle");
3158
+ if (payloadWithEntityId.entityType && !["task", "execution", "feedback", "cycle"].includes(payloadWithEntityId.entityType)) {
3159
+ throw new Error("InvalidEntityTypeError: entityType must be task, execution, feedback, or cycle");
3491
3160
  }
3492
3161
  if (payload.type === "assignment" && payload.assignee) {
3493
3162
  const existingFeedbacks = await this.getFeedbackByEntity(payloadWithEntityId.entityId);
@@ -4314,10 +3983,6 @@ var BacklogAdapter = class {
4314
3983
  "execution.created",
4315
3984
  (event) => this.handleExecutionCreated(event)
4316
3985
  );
4317
- this.eventBus.subscribe(
4318
- "changelog.created",
4319
- (event) => this.handleChangelogCreated(event)
4320
- );
4321
3986
  this.eventBus.subscribe(
4322
3987
  "cycle.status.changed",
4323
3988
  (event) => this.handleCycleStatusChanged(event)
@@ -4924,46 +4589,6 @@ ${task.status === "review" ? "[REJECTED]" : "[CANCELLED]"} ${reason} (${(/* @__P
4924
4589
  console.error("Error in handleExecutionCreated:", error);
4925
4590
  }
4926
4591
  }
4927
- /**
4928
- * [EARS-37] Handles changelog created events - transitions done→archived
4929
- */
4930
- async handleChangelogCreated(event) {
4931
- try {
4932
- const changelogRecord = await this.stores.changelogs.get(event.payload.changelogId);
4933
- if (!changelogRecord) {
4934
- console.warn(`Changelog not found: ${event.payload.changelogId}`);
4935
- return;
4936
- }
4937
- if (!changelogRecord.payload.relatedTasks || changelogRecord.payload.relatedTasks.length === 0) {
4938
- return;
4939
- }
4940
- for (const taskId of changelogRecord.payload.relatedTasks) {
4941
- const task = await this.getTask(taskId);
4942
- if (!task || task.status !== "done") {
4943
- continue;
4944
- }
4945
- const updatedTask = { ...task, status: "archived" };
4946
- const taskRecord = await this.stores.tasks.get(task.id);
4947
- if (taskRecord) {
4948
- const updatedRecord = { ...taskRecord, payload: updatedTask };
4949
- await this.stores.tasks.put(updatedRecord.payload.id, updatedRecord);
4950
- this.eventBus.publish({
4951
- type: "task.status.changed",
4952
- timestamp: Date.now(),
4953
- source: "backlog_adapter",
4954
- payload: {
4955
- taskId: task.id,
4956
- oldStatus: "done",
4957
- newStatus: "archived",
4958
- actorId: "system"
4959
- }
4960
- });
4961
- }
4962
- }
4963
- } catch (error) {
4964
- console.error("Error in handleChangelogCreated:", error);
4965
- }
4966
- }
4967
4592
  /**
4968
4593
  * [EARS-38] Handles daily tick events - proactive health auditing
4969
4594
  */
@@ -5365,252 +4990,6 @@ ${task.status === "review" ? "[REJECTED]" : "[CANCELLED]"} ${reason} (${(/* @__P
5365
4990
  }
5366
4991
  };
5367
4992
 
5368
- // src/adapters/changelog_adapter/index.ts
5369
- var changelog_adapter_exports = {};
5370
- __export(changelog_adapter_exports, {
5371
- ChangelogAdapter: () => ChangelogAdapter
5372
- });
5373
-
5374
- // src/record_validations/changelog_validator.ts
5375
- function validateChangelogRecordSchema(data) {
5376
- const validator = SchemaValidationCache.getValidatorFromSchema(Schemas.ChangelogRecord);
5377
- const isValid = validator(data);
5378
- return [isValid, validator.errors];
5379
- }
5380
- function isChangelogRecord(data) {
5381
- const [isValid] = validateChangelogRecordSchema(data);
5382
- return isValid;
5383
- }
5384
- function validateChangelogRecordDetailed(data) {
5385
- const [isValid, errors] = validateChangelogRecordSchema(data);
5386
- if (!isValid && errors) {
5387
- const formattedErrors = errors.map((error) => ({
5388
- field: error.instancePath?.replace("/", "") || error.params?.["missingProperty"] || "root",
5389
- message: error.message || "Unknown validation error",
5390
- value: error.data
5391
- }));
5392
- return {
5393
- isValid: false,
5394
- errors: formattedErrors
5395
- };
5396
- }
5397
- return {
5398
- isValid: true,
5399
- errors: []
5400
- };
5401
- }
5402
- async function validateFullChangelogRecord(record, getPublicKey) {
5403
- const [isValid, errors] = validateChangelogRecordSchema(record.payload);
5404
- if (!isValid) {
5405
- const formattedErrors = (errors || []).map((error) => ({
5406
- field: error.instancePath?.replace("/", "") || error.params?.["missingProperty"] || "root",
5407
- message: error.message || "Unknown validation error",
5408
- value: error.data
5409
- }));
5410
- throw new DetailedValidationError("ChangelogRecord", formattedErrors);
5411
- }
5412
- await validateFullEmbeddedMetadataRecord(record, getPublicKey);
5413
- }
5414
-
5415
- // src/record_factories/changelog_factory.ts
5416
- function createChangelogRecord(payload) {
5417
- const timestamp = Math.floor(Date.now() / 1e3);
5418
- const changelog = {
5419
- // Required fields
5420
- id: payload.id || "",
5421
- title: payload.title || "",
5422
- description: payload.description || "",
5423
- relatedTasks: payload.relatedTasks || [],
5424
- completedAt: payload.completedAt || timestamp,
5425
- // Optional fields (only include if provided)
5426
- ...payload.relatedCycles && { relatedCycles: payload.relatedCycles },
5427
- ...payload.relatedExecutions && { relatedExecutions: payload.relatedExecutions },
5428
- ...payload.version && { version: payload.version },
5429
- ...payload.tags && { tags: payload.tags },
5430
- ...payload.commits && { commits: payload.commits },
5431
- ...payload.files && { files: payload.files },
5432
- ...payload.notes && { notes: payload.notes }
5433
- };
5434
- const validation = validateChangelogRecordDetailed(changelog);
5435
- if (!validation.isValid) {
5436
- throw new DetailedValidationError("ChangelogRecord", validation.errors);
5437
- }
5438
- return changelog;
5439
- }
5440
- function loadChangelogRecord(data) {
5441
- const embeddedValidation = validateEmbeddedMetadataDetailed(data);
5442
- if (!embeddedValidation.isValid) {
5443
- throw new DetailedValidationError("GitGovRecord (ChangelogRecord)", embeddedValidation.errors);
5444
- }
5445
- const record = data;
5446
- const payloadValidation = validateChangelogRecordDetailed(record.payload);
5447
- if (!payloadValidation.isValid) {
5448
- throw new DetailedValidationError("ChangelogRecord payload", payloadValidation.errors);
5449
- }
5450
- return record;
5451
- }
5452
-
5453
- // src/adapters/changelog_adapter/changelog_adapter.ts
5454
- var ChangelogAdapter = class {
5455
- stores;
5456
- identity;
5457
- eventBus;
5458
- constructor(dependencies) {
5459
- this.stores = dependencies.stores;
5460
- this.identity = dependencies.identity;
5461
- this.eventBus = dependencies.eventBus;
5462
- }
5463
- /**
5464
- * [EARS-A1] Records a deliverable/release note.
5465
- *
5466
- * Description: Aggregates multiple tasks into a single deliverable/release note.
5467
- * Implementation: Validates required fields, builds record with factory, signs, persists and emits event.
5468
- * Usage: Invoked by `gitgov changelog add` to document deliverables.
5469
- * Returns: Complete and signed ChangelogRecord.
5470
- */
5471
- async create(payload, actorId) {
5472
- if (!payload.title || payload.title.length < 10) {
5473
- throw new Error("DetailedValidationError: title is required and must be at least 10 characters");
5474
- }
5475
- if (!payload.description || payload.description.length < 20) {
5476
- throw new Error("DetailedValidationError: description is required and must be at least 20 characters");
5477
- }
5478
- if (!payload.relatedTasks || payload.relatedTasks.length === 0) {
5479
- throw new Error("DetailedValidationError: relatedTasks is required and must contain at least one task ID");
5480
- }
5481
- if (payload.relatedTasks) {
5482
- for (const taskId of payload.relatedTasks) {
5483
- const taskExists = await this.stores.tasks.get(taskId);
5484
- if (!taskExists) {
5485
- throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
5486
- }
5487
- }
5488
- }
5489
- if (payload.relatedCycles) {
5490
- for (const cycleId of payload.relatedCycles) {
5491
- const cycleExists = await this.stores.cycles.get(cycleId);
5492
- if (!cycleExists) {
5493
- throw new Error(`RecordNotFoundError: Cycle not found: ${cycleId}`);
5494
- }
5495
- }
5496
- }
5497
- try {
5498
- const timestamp = payload.completedAt || Math.floor(Date.now() / 1e3);
5499
- if (!payload.id) {
5500
- payload.id = generateChangelogId(payload.title, timestamp);
5501
- }
5502
- const validatedPayload = createChangelogRecord(payload);
5503
- const unsignedRecord = {
5504
- header: {
5505
- version: "1.0",
5506
- type: "changelog",
5507
- payloadChecksum: "will-be-calculated-by-signRecord",
5508
- signatures: [{
5509
- keyId: actorId,
5510
- role: "author",
5511
- notes: "Changelog entry created",
5512
- signature: "placeholder",
5513
- timestamp: Date.now()
5514
- }]
5515
- },
5516
- payload: validatedPayload
5517
- };
5518
- const signedRecord = await this.identity.signRecord(unsignedRecord, actorId, "author", "Changelog record created");
5519
- await this.stores.changelogs.put(validatedPayload.id, signedRecord);
5520
- this.eventBus.publish({
5521
- type: "changelog.created",
5522
- timestamp: Date.now(),
5523
- source: "changelog_adapter",
5524
- payload: {
5525
- changelogId: validatedPayload.id,
5526
- relatedTasks: validatedPayload.relatedTasks,
5527
- title: validatedPayload.title,
5528
- version: validatedPayload.version
5529
- }
5530
- });
5531
- return validatedPayload;
5532
- } catch (error) {
5533
- if (error instanceof Error && error.message.includes("DetailedValidationError")) {
5534
- throw error;
5535
- }
5536
- throw error;
5537
- }
5538
- }
5539
- /**
5540
- * [EARS-B1] Gets a specific ChangelogRecord by its ID.
5541
- */
5542
- async getChangelog(changelogId) {
5543
- const record = await this.stores.changelogs.get(changelogId);
5544
- return record ? record.payload : null;
5545
- }
5546
- /**
5547
- * [EARS-C1] Gets all ChangelogRecords that include a specific task.
5548
- */
5549
- async getChangelogsByTask(taskId) {
5550
- const ids = await this.stores.changelogs.list();
5551
- const changelogs = [];
5552
- for (const id of ids) {
5553
- const record = await this.stores.changelogs.get(id);
5554
- if (record && record.payload.relatedTasks.includes(taskId)) {
5555
- changelogs.push(record.payload);
5556
- }
5557
- }
5558
- return changelogs;
5559
- }
5560
- /**
5561
- * [EARS-D1] Gets all ChangelogRecords with optional filtering and sorting.
5562
- */
5563
- async getAllChangelogs(options) {
5564
- const ids = await this.stores.changelogs.list();
5565
- let changelogs = [];
5566
- for (const id of ids) {
5567
- const record = await this.stores.changelogs.get(id);
5568
- if (record) {
5569
- changelogs.push(record.payload);
5570
- }
5571
- }
5572
- if (options?.tags && options.tags.length > 0) {
5573
- changelogs = changelogs.filter((changelog) => {
5574
- if (!changelog.tags) return false;
5575
- return options.tags.some((tag) => changelog.tags.includes(tag));
5576
- });
5577
- }
5578
- if (options?.version) {
5579
- changelogs = changelogs.filter((changelog) => changelog.version === options.version);
5580
- }
5581
- const sortBy = options?.sortBy || "completedAt";
5582
- const sortOrder = options?.sortOrder || "desc";
5583
- changelogs.sort((a, b) => {
5584
- let compareValue = 0;
5585
- if (sortBy === "completedAt") {
5586
- compareValue = a.completedAt - b.completedAt;
5587
- } else if (sortBy === "title") {
5588
- compareValue = a.title.localeCompare(b.title);
5589
- }
5590
- return sortOrder === "asc" ? compareValue : -compareValue;
5591
- });
5592
- if (options?.limit && options.limit > 0) {
5593
- changelogs = changelogs.slice(0, options.limit);
5594
- }
5595
- return changelogs;
5596
- }
5597
- /**
5598
- * [EARS-E1] Gets recent ChangelogRecords ordered by completedAt.
5599
- */
5600
- async getRecentChangelogs(limit) {
5601
- const allChangelogs = await this.getAllChangelogs();
5602
- const sortedChangelogs = allChangelogs.sort((a, b) => b.completedAt - a.completedAt);
5603
- return sortedChangelogs.slice(0, limit);
5604
- }
5605
- /**
5606
- * Legacy method for backwards compatibility - maps to getChangelogsByTask
5607
- * @deprecated Use getChangelogsByTask instead
5608
- */
5609
- async getChangelogsByEntity(entityId, _entityType) {
5610
- return this.getChangelogsByTask(entityId);
5611
- }
5612
- };
5613
-
5614
4993
  // src/adapters/execution_adapter/index.ts
5615
4994
  var execution_adapter_exports = {};
5616
4995
  __export(execution_adapter_exports, {
@@ -6075,14 +5454,15 @@ __export(workflow_adapter_exports, {
6075
5454
 
6076
5455
  // src/adapters/workflow_adapter/generated/kanban_workflow.json
6077
5456
  var kanban_workflow_default = {
6078
- version: "1.0.0",
5457
+ id: "1700000000-workflow-default-methodology",
6079
5458
  name: "GitGovernance Default Methodology",
6080
5459
  description: "Standard GitGovernance workflow with quality gates and agent collaboration",
6081
5460
  state_transitions: {
6082
- review: {
5461
+ submit: {
6083
5462
  from: [
6084
5463
  "draft"
6085
5464
  ],
5465
+ to: "review",
6086
5466
  requires: {
6087
5467
  command: "gitgov task submit",
6088
5468
  signatures: {
@@ -6096,10 +5476,11 @@ var kanban_workflow_default = {
6096
5476
  }
6097
5477
  }
6098
5478
  },
6099
- ready: {
5479
+ approve: {
6100
5480
  from: [
6101
5481
  "review"
6102
5482
  ],
5483
+ to: "ready",
6103
5484
  requires: {
6104
5485
  command: "gitgov task approve",
6105
5486
  signatures: {
@@ -6127,11 +5508,12 @@ var kanban_workflow_default = {
6127
5508
  }
6128
5509
  }
6129
5510
  },
6130
- active: {
5511
+ activate: {
6131
5512
  from: [
6132
5513
  "ready",
6133
5514
  "paused"
6134
5515
  ],
5516
+ to: "active",
6135
5517
  requires: {
6136
5518
  event: "first_execution_record_created",
6137
5519
  custom_rules: [
@@ -6139,10 +5521,11 @@ var kanban_workflow_default = {
6139
5521
  ]
6140
5522
  }
6141
5523
  },
6142
- done: {
5524
+ complete: {
6143
5525
  from: [
6144
5526
  "active"
6145
5527
  ],
5528
+ to: "done",
6146
5529
  requires: {
6147
5530
  command: "gitgov task complete",
6148
5531
  signatures: {
@@ -6156,28 +5539,31 @@ var kanban_workflow_default = {
6156
5539
  }
6157
5540
  }
6158
5541
  },
6159
- archived: {
5542
+ archive: {
6160
5543
  from: [
6161
5544
  "done"
6162
5545
  ],
5546
+ to: "archived",
6163
5547
  requires: {
6164
- event: "changelog_record_created"
5548
+ command: "gitgov task archive"
6165
5549
  }
6166
5550
  },
6167
- paused: {
5551
+ pause: {
6168
5552
  from: [
6169
5553
  "active",
6170
5554
  "review"
6171
5555
  ],
5556
+ to: "paused",
6172
5557
  requires: {
6173
5558
  event: "feedback_blocking_created"
6174
5559
  }
6175
5560
  },
6176
- discarded: {
5561
+ cancel: {
6177
5562
  from: [
6178
5563
  "ready",
6179
5564
  "active"
6180
5565
  ],
5566
+ to: "discarded",
6181
5567
  requires: {
6182
5568
  command: "gitgov task cancel",
6183
5569
  signatures: {
@@ -6211,14 +5597,15 @@ var kanban_workflow_default = {
6211
5597
 
6212
5598
  // src/adapters/workflow_adapter/generated/scrum_workflow.json
6213
5599
  var scrum_workflow_default = {
6214
- version: "1.0.0",
5600
+ id: "1700000000-workflow-scrum-framework",
6215
5601
  name: "Scrum Framework",
6216
5602
  description: "Agile Scrum methodology with sprint-based workflow and defined roles",
6217
5603
  state_transitions: {
6218
- review: {
5604
+ submit: {
6219
5605
  from: [
6220
5606
  "draft"
6221
5607
  ],
5608
+ to: "review",
6222
5609
  requires: {
6223
5610
  command: "gitgov task submit",
6224
5611
  signatures: {
@@ -6232,10 +5619,11 @@ var scrum_workflow_default = {
6232
5619
  }
6233
5620
  }
6234
5621
  },
6235
- ready: {
5622
+ approve: {
6236
5623
  from: [
6237
5624
  "review"
6238
5625
  ],
5626
+ to: "ready",
6239
5627
  requires: {
6240
5628
  command: "gitgov task approve",
6241
5629
  custom_rules: [
@@ -6243,11 +5631,12 @@ var scrum_workflow_default = {
6243
5631
  ]
6244
5632
  }
6245
5633
  },
6246
- active: {
5634
+ activate: {
6247
5635
  from: [
6248
5636
  "ready",
6249
5637
  "paused"
6250
5638
  ],
5639
+ to: "active",
6251
5640
  requires: {
6252
5641
  event: "sprint_started",
6253
5642
  custom_rules: [
@@ -6255,10 +5644,11 @@ var scrum_workflow_default = {
6255
5644
  ]
6256
5645
  }
6257
5646
  },
6258
- done: {
5647
+ complete: {
6259
5648
  from: [
6260
5649
  "active"
6261
5650
  ],
5651
+ to: "done",
6262
5652
  requires: {
6263
5653
  command: "gitgov task complete",
6264
5654
  signatures: {
@@ -6272,19 +5662,21 @@ var scrum_workflow_default = {
6272
5662
  }
6273
5663
  }
6274
5664
  },
6275
- archived: {
5665
+ archive: {
6276
5666
  from: [
6277
5667
  "done"
6278
5668
  ],
5669
+ to: "archived",
6279
5670
  requires: {
6280
- event: "changelog_record_created"
5671
+ command: "gitgov task archive"
6281
5672
  }
6282
5673
  },
6283
- paused: {
5674
+ pause: {
6284
5675
  from: [
6285
5676
  "active",
6286
5677
  "review"
6287
5678
  ],
5679
+ to: "paused",
6288
5680
  requires: {
6289
5681
  event: "feedback_blocking_created"
6290
5682
  }
@@ -6387,20 +5779,29 @@ var WorkflowAdapter = class _WorkflowAdapter {
6387
5779
  }
6388
5780
  return "__default__";
6389
5781
  }
5782
+ /**
5783
+ * Finds a transition config by matching from and to states.
5784
+ * Keys are transition names (e.g. submit, approve), target state is in transition.to.
5785
+ */
5786
+ findTransitionByStates(from, to) {
5787
+ const config = this.getConfig();
5788
+ for (const transitionConfig of Object.values(config.state_transitions ?? {})) {
5789
+ if (transitionConfig && transitionConfig.to === to && transitionConfig.from.includes(from)) {
5790
+ return transitionConfig;
5791
+ }
5792
+ }
5793
+ return null;
5794
+ }
6390
5795
  /**
6391
5796
  * Determines if a state transition is legal according to the methodology
6392
5797
  */
6393
5798
  async getTransitionRule(from, to, _context) {
6394
- const config = this.getConfig();
6395
- const transitionConfig = config.state_transitions?.[to];
5799
+ const transitionConfig = this.findTransitionByStates(from, to);
6396
5800
  if (!transitionConfig) {
6397
5801
  return null;
6398
5802
  }
6399
- if (!transitionConfig.from.includes(from)) {
6400
- return null;
6401
- }
6402
5803
  return {
6403
- to,
5804
+ to: transitionConfig.to,
6404
5805
  conditions: transitionConfig.requires
6405
5806
  };
6406
5807
  }
@@ -6408,7 +5809,6 @@ var WorkflowAdapter = class _WorkflowAdapter {
6408
5809
  * Validates if an actor's signature meets the requirements for a transition
6409
5810
  */
6410
5811
  async validateSignature(signature, context) {
6411
- const config = this.getConfig();
6412
5812
  if (!context.transitionTo) {
6413
5813
  throw new Error('ValidationContext must include "transitionTo" for signature validation.');
6414
5814
  }
@@ -6417,11 +5817,8 @@ var WorkflowAdapter = class _WorkflowAdapter {
6417
5817
  if (!actor) {
6418
5818
  return false;
6419
5819
  }
6420
- const transitionConfig = config.state_transitions?.[targetState];
5820
+ const transitionConfig = this.findTransitionByStates(context.task.status, targetState);
6421
5821
  if (!transitionConfig) return false;
6422
- if (!transitionConfig.from.includes(context.task.status)) {
6423
- return false;
6424
- }
6425
5822
  const signatureRules = transitionConfig.requires.signatures;
6426
5823
  if (!signatureRules) return true;
6427
5824
  const signatureGroup = this.getApplicableSignatureGroup(signatureRules, actor);
@@ -6503,11 +5900,10 @@ var WorkflowAdapter = class _WorkflowAdapter {
6503
5900
  return [];
6504
5901
  }
6505
5902
  const available = [];
6506
- for (const toState in config.state_transitions) {
6507
- const transitionConfig = config.state_transitions[toState];
5903
+ for (const transitionConfig of Object.values(config.state_transitions)) {
6508
5904
  if (transitionConfig && transitionConfig.from.includes(from)) {
6509
5905
  available.push({
6510
- to: toState,
5906
+ to: transitionConfig.to,
6511
5907
  conditions: transitionConfig.requires
6512
5908
  });
6513
5909
  }
@@ -6641,7 +6037,6 @@ var record_factories_exports = {};
6641
6037
  __export(record_factories_exports, {
6642
6038
  createActorRecord: () => createActorRecord,
6643
6039
  createAgentRecord: () => createAgentRecord,
6644
- createChangelogRecord: () => createChangelogRecord,
6645
6040
  createCycleRecord: () => createCycleRecord,
6646
6041
  createDefaultWorkflowConfig: () => createDefaultWorkflowConfig,
6647
6042
  createEmbeddedMetadataRecord: () => createEmbeddedMetadataRecord,
@@ -6652,7 +6047,6 @@ __export(record_factories_exports, {
6652
6047
  createWorkflowConfig: () => createWorkflowConfig,
6653
6048
  loadActorRecord: () => loadActorRecord,
6654
6049
  loadAgentRecord: () => loadAgentRecord,
6655
- loadChangelogRecord: () => loadChangelogRecord,
6656
6050
  loadCycleRecord: () => loadCycleRecord,
6657
6051
  loadExecutionRecord: () => loadExecutionRecord,
6658
6052
  loadFeedbackRecord: () => loadFeedbackRecord,
@@ -6684,19 +6078,19 @@ function validateWorkflowConfigDetailed(data) {
6684
6078
  function validateWorkflowConfigBusinessRules(config) {
6685
6079
  const errors = [];
6686
6080
  const validStates = ["draft", "review", "ready", "active", "done", "archived", "paused", "discarded"];
6687
- for (const [targetState, transition] of Object.entries(config.state_transitions)) {
6688
- if (!validStates.includes(targetState)) {
6081
+ for (const [transitionName, transition] of Object.entries(config.state_transitions)) {
6082
+ if (transition?.to && !validStates.includes(transition.to)) {
6689
6083
  errors.push({
6690
- field: `state_transitions.${targetState}`,
6691
- message: `Invalid target state: ${targetState}`,
6692
- value: targetState
6084
+ field: `state_transitions.${transitionName}.to`,
6085
+ message: `Invalid target state: ${transition.to}`,
6086
+ value: transition.to
6693
6087
  });
6694
6088
  }
6695
6089
  if (transition?.from) {
6696
6090
  for (const fromState of transition.from) {
6697
6091
  if (!validStates.includes(fromState)) {
6698
6092
  errors.push({
6699
- field: `state_transitions.${targetState}.from`,
6093
+ field: `state_transitions.${transitionName}.from`,
6700
6094
  message: `Invalid source state: ${fromState}`,
6701
6095
  value: fromState
6702
6096
  });
@@ -6707,7 +6101,7 @@ function validateWorkflowConfigBusinessRules(config) {
6707
6101
  for (const ruleId of transition.requires.custom_rules) {
6708
6102
  if (!config.custom_rules[ruleId]) {
6709
6103
  errors.push({
6710
- field: `state_transitions.${targetState}.requires.custom_rules`,
6104
+ field: `state_transitions.${transitionName}.requires.custom_rules`,
6711
6105
  message: `Custom rule '${ruleId}' not defined in custom_rules section`,
6712
6106
  value: ruleId
6713
6107
  });
@@ -6736,12 +6130,13 @@ function validateWorkflowConfigBusinessRules(config) {
6736
6130
  // src/record_factories/workflow_factory.ts
6737
6131
  function createWorkflowConfig(payload) {
6738
6132
  const config = {
6739
- version: payload.version || "1.0.0",
6133
+ id: payload.id || `${Math.floor(Date.now() / 1e3)}-workflow-custom`,
6740
6134
  name: payload.name || "Custom Methodology",
6741
6135
  description: payload.description,
6742
6136
  state_transitions: payload.state_transitions || {
6743
- review: {
6137
+ submit: {
6744
6138
  from: ["draft"],
6139
+ to: "review",
6745
6140
  requires: {
6746
6141
  command: "gitgov task submit",
6747
6142
  signatures: {
@@ -6769,12 +6164,13 @@ function createWorkflowConfig(payload) {
6769
6164
  }
6770
6165
  async function createDefaultWorkflowConfig() {
6771
6166
  return createWorkflowConfig({
6772
- version: "1.0.0",
6167
+ id: "1700000000-workflow-default-methodology",
6773
6168
  name: "GitGovernance Default Methodology",
6774
6169
  description: "Standard GitGovernance workflow with quality gates and agent collaboration",
6775
6170
  state_transitions: {
6776
- review: {
6171
+ submit: {
6777
6172
  from: ["draft"],
6173
+ to: "review",
6778
6174
  requires: {
6779
6175
  command: "gitgov task submit",
6780
6176
  signatures: {
@@ -6786,8 +6182,9 @@ async function createDefaultWorkflowConfig() {
6786
6182
  }
6787
6183
  }
6788
6184
  },
6789
- ready: {
6185
+ approve: {
6790
6186
  from: ["review"],
6187
+ to: "ready",
6791
6188
  requires: {
6792
6189
  command: "gitgov task approve",
6793
6190
  signatures: {
@@ -6809,15 +6206,17 @@ async function createDefaultWorkflowConfig() {
6809
6206
  }
6810
6207
  }
6811
6208
  },
6812
- active: {
6813
- from: ["ready"],
6209
+ activate: {
6210
+ from: ["ready", "paused"],
6211
+ to: "active",
6814
6212
  requires: {
6815
6213
  event: "first_execution_record_created",
6816
6214
  custom_rules: ["task_must_have_valid_assignment_for_executor"]
6817
6215
  }
6818
6216
  },
6819
- done: {
6217
+ complete: {
6820
6218
  from: ["active"],
6219
+ to: "done",
6821
6220
  requires: {
6822
6221
  command: "gitgov task complete",
6823
6222
  signatures: {
@@ -6829,17 +6228,33 @@ async function createDefaultWorkflowConfig() {
6829
6228
  }
6830
6229
  }
6831
6230
  },
6832
- archived: {
6231
+ archive: {
6833
6232
  from: ["done"],
6233
+ to: "archived",
6834
6234
  requires: {
6835
- event: "changelog_record_created"
6235
+ command: "gitgov task archive"
6836
6236
  }
6837
6237
  },
6838
- paused: {
6238
+ pause: {
6839
6239
  from: ["active", "review"],
6240
+ to: "paused",
6840
6241
  requires: {
6841
6242
  event: "feedback_blocking_created"
6842
6243
  }
6244
+ },
6245
+ cancel: {
6246
+ from: ["ready", "active"],
6247
+ to: "discarded",
6248
+ requires: {
6249
+ command: "gitgov task cancel",
6250
+ signatures: {
6251
+ "__default__": {
6252
+ role: "canceller",
6253
+ capability_roles: ["approver:product", "approver:quality"],
6254
+ min_approvals: 1
6255
+ }
6256
+ }
6257
+ }
6843
6258
  }
6844
6259
  },
6845
6260
  custom_rules: {
@@ -6874,7 +6289,6 @@ function createTestSignature(keyId = "human:test-user", role = "author", notes =
6874
6289
  function inferTypeFromPayload(payload) {
6875
6290
  if ("engine" in payload) return "agent";
6876
6291
  if ("taskId" in payload && "result" in payload) return "execution";
6877
- if ("relatedTasks" in payload && "completedAt" in payload) return "changelog";
6878
6292
  if ("entityType" in payload && "entityId" in payload) return "feedback";
6879
6293
  if ("status" in payload && "taskIds" in payload) return "cycle";
6880
6294
  if ("priority" in payload && "description" in payload) return "task";
@@ -7578,7 +6992,6 @@ var ENTITY_TO_SCHEMA = {
7578
6992
  agent: "AgentRecord",
7579
6993
  cycle: "CycleRecord",
7580
6994
  execution: "ExecutionRecord",
7581
- changelog: "ChangelogRecord",
7582
6995
  feedback: "FeedbackRecord"
7583
6996
  };
7584
6997
  var LintModule = class {
@@ -7695,8 +7108,7 @@ var LintModule = class {
7695
7108
  ["actor", this.stores.actors],
7696
7109
  ["agent", this.stores.agents],
7697
7110
  ["execution", this.stores.executions],
7698
- ["feedback", this.stores.feedbacks],
7699
- ["changelog", this.stores.changelogs]
7111
+ ["feedback", this.stores.feedbacks]
7700
7112
  ];
7701
7113
  const recordEntries = [];
7702
7114
  for (const [type, store] of storeMap) {
@@ -7822,9 +7234,6 @@ var LintModule = class {
7822
7234
  case "execution":
7823
7235
  loadExecutionRecord(rawRecord);
7824
7236
  break;
7825
- case "changelog":
7826
- loadChangelogRecord(rawRecord);
7827
- break;
7828
7237
  case "feedback":
7829
7238
  loadFeedbackRecord(rawRecord);
7830
7239
  break;
@@ -8652,7 +8061,6 @@ var record_validations_exports = {};
8652
8061
  __export(record_validations_exports, {
8653
8062
  isActorRecord: () => isActorRecord,
8654
8063
  isAgentRecord: () => isAgentRecord,
8655
- isChangelogRecord: () => isChangelogRecord,
8656
8064
  isCycleRecord: () => isCycleRecord,
8657
8065
  isEmbeddedMetadataRecord: () => isEmbeddedMetadataRecord,
8658
8066
  isExecutionRecord: () => isExecutionRecord,
@@ -8664,8 +8072,6 @@ __export(record_validations_exports, {
8664
8072
  validateAgentActorRelationship: () => validateAgentActorRelationship,
8665
8073
  validateAgentRecordDetailed: () => validateAgentRecordDetailed,
8666
8074
  validateAgentRecordSchema: () => validateAgentRecordSchema,
8667
- validateChangelogRecordDetailed: () => validateChangelogRecordDetailed,
8668
- validateChangelogRecordSchema: () => validateChangelogRecordSchema,
8669
8075
  validateCycleRecordDetailed: () => validateCycleRecordDetailed,
8670
8076
  validateCycleRecordSchema: () => validateCycleRecordSchema,
8671
8077
  validateEmbeddedMetadataDetailed: () => validateEmbeddedMetadataDetailed,
@@ -8676,7 +8082,6 @@ __export(record_validations_exports, {
8676
8082
  validateFeedbackRecordSchema: () => validateFeedbackRecordSchema,
8677
8083
  validateFullActorRecord: () => validateFullActorRecord,
8678
8084
  validateFullAgentRecord: () => validateFullAgentRecord,
8679
- validateFullChangelogRecord: () => validateFullChangelogRecord,
8680
8085
  validateFullCycleRecord: () => validateFullCycleRecord,
8681
8086
  validateFullEmbeddedMetadataRecord: () => validateFullEmbeddedMetadataRecord,
8682
8087
  validateFullExecutionRecord: () => validateFullExecutionRecord,
@@ -10894,7 +10299,6 @@ var RecordProjector = class {
10894
10299
  cycles,
10895
10300
  feedback: await this.readAllFeedback(),
10896
10301
  executions: await this.readAllExecutions(),
10897
- changelogs: await this.readAllChangelogs(),
10898
10302
  actors
10899
10303
  };
10900
10304
  const activityHistory = await this.calculateActivityHistory(allRecords);
@@ -10920,8 +10324,7 @@ var RecordProjector = class {
10920
10324
  cycles: cycles.length,
10921
10325
  actors: actors.length,
10922
10326
  feedback: allRecords.feedback.length,
10923
- executions: allRecords.executions.length,
10924
- changelogs: allRecords.changelogs.length
10327
+ executions: allRecords.executions.length
10925
10328
  },
10926
10329
  generationTime: 0
10927
10330
  // Will be set by caller if needed
@@ -11244,20 +10647,6 @@ var RecordProjector = class {
11244
10647
  }
11245
10648
  return executions;
11246
10649
  }
11247
- /**
11248
- * Reads all changelogs from stores.changelogs with full metadata.
11249
- */
11250
- async readAllChangelogs() {
11251
- const changelogIds = await this.stores.changelogs.list();
11252
- const changelogs = [];
11253
- for (const id of changelogIds) {
11254
- const record = await this.stores.changelogs.get(id);
11255
- if (record) {
11256
- changelogs.push(record);
11257
- }
11258
- }
11259
- return changelogs;
11260
- }
11261
10650
  /**
11262
10651
  * Persists IndexData to sink if available.
11263
10652
  * [EARS-U4] No-op when sink is undefined (writeTime=0).
@@ -11407,22 +10796,6 @@ var RecordProjector = class {
11407
10796
  events.push(event);
11408
10797
  }
11409
10798
  });
11410
- allRecords.changelogs.forEach((changelog) => {
11411
- const timestampPart = changelog.payload.id.split("-")[0];
11412
- if (timestampPart) {
11413
- const event = {
11414
- timestamp: parseInt(timestampPart),
11415
- type: "changelog_created",
11416
- entityId: changelog.payload.id,
11417
- entityTitle: changelog.payload.title || "Release notes",
11418
- actorId: changelog.header.signatures[0]?.keyId || "unknown"
11419
- };
11420
- if (changelog.payload.version) {
11421
- event.metadata = { version: changelog.payload.version };
11422
- }
11423
- events.push(event);
11424
- }
11425
- });
11426
10799
  allRecords.executions.forEach((execution) => {
11427
10800
  const timestampPart = execution.payload.id.split("-")[0];
11428
10801
  if (timestampPart) {
@@ -11500,15 +10873,15 @@ var RecordProjector = class {
11500
10873
  recentActivity = `Execution: ${execution.payload.title || "Work logged"}`;
11501
10874
  }
11502
10875
  }
11503
- const relatedChangelogs = relatedRecords.changelogs.filter(
11504
- (c) => c.payload.relatedTasks && c.payload.relatedTasks.includes(taskPayload.id) || c.payload.description?.includes(taskPayload.id)
10876
+ const relatedReleases = relatedRecords.executions.filter(
10877
+ (e) => e.payload.taskId === taskPayload.id && e.payload.type === "custom:release"
11505
10878
  );
11506
- for (const changelog of relatedChangelogs) {
11507
- const changelogTime = this.getTimestampFromId(changelog.payload.id) * 1e3;
11508
- if (changelogTime > lastUpdated) {
11509
- lastUpdated = changelogTime;
11510
- lastActivityType = "changelog_created";
11511
- recentActivity = `Changelog: ${changelog.payload.title}`;
10879
+ for (const release of relatedReleases) {
10880
+ const releaseTime = this.getTimestampFromId(release.payload.id) * 1e3;
10881
+ if (releaseTime > lastUpdated) {
10882
+ lastUpdated = releaseTime;
10883
+ lastActivityType = "execution_added";
10884
+ recentActivity = `Release: ${release.payload.title}`;
11512
10885
  }
11513
10886
  }
11514
10887
  return { lastUpdated, lastActivityType, recentActivity };
@@ -11537,7 +10910,7 @@ var RecordProjector = class {
11537
10910
  * 5. Cycles (all cycles as array with id+title)
11538
10911
  * 6. Metrics (executionCount, blockingFeedbackCount, openQuestionCount)
11539
10912
  * 7. Time to resolution (for done tasks)
11540
- * 8. Release info (isReleased, lastReleaseVersion from changelogs)
10913
+ * 8. Release info
11541
10914
  * 9. Derived states (EARS-43: REUTILIZA pre-calculated derivedStates con O(1) lookup)
11542
10915
  * 10. Health score (0-100 using multi-factor algorithm)
11543
10916
  * 11. Time in current stage (days)
@@ -11580,11 +10953,12 @@ var RecordProjector = class {
11580
10953
  (f) => f.payload.entityId === task.payload.id && f.payload.type === "question" && f.payload.status === "open"
11581
10954
  ).length;
11582
10955
  const timeToResolution = task.payload.status === "done" ? (lastUpdated - this.getTimestampFromId(task.payload.id) * 1e3) / (1e3 * 60 * 60) : void 0;
11583
- const releaseChangelogs = relatedRecords.changelogs.filter(
11584
- (cl) => cl.payload.relatedTasks.includes(task.payload.id)
10956
+ const releaseExecutions = relatedRecords.executions.filter(
10957
+ (e) => e.payload.taskId === task.payload.id && e.payload.type === "custom:release"
11585
10958
  );
11586
- const isReleased = releaseChangelogs.length > 0;
11587
- const lastReleaseVersion = isReleased ? releaseChangelogs[releaseChangelogs.length - 1]?.payload.version || void 0 : void 0;
10959
+ const isReleased = releaseExecutions.length > 0;
10960
+ const lastReleaseExec = releaseExecutions[releaseExecutions.length - 1];
10961
+ const lastReleaseVersion = isReleased ? lastReleaseExec?.payload.metadata?.["version"] : void 0;
11588
10962
  const taskId = task.payload.id;
11589
10963
  const isStalled = derivedStateSets.stalledTasks.has(taskId);
11590
10964
  const isAtRisk = derivedStateSets.atRiskTasks.has(taskId);
@@ -11670,6 +11044,6 @@ var RecordProjector = class {
11670
11044
  }
11671
11045
  };
11672
11046
 
11673
- export { adapters_exports as Adapters, backlog_adapter_exports as BacklogAdapter, changelog_adapter_exports as ChangelogAdapter, config_manager_exports as Config, crypto_exports as Crypto, diagram_generator_exports as DiagramGenerator, event_bus_exports as EventBus, execution_adapter_exports as ExecutionAdapter, record_factories_exports as Factories, feedback_adapter_exports as FeedbackAdapter, file_lister_exports as FileLister, finding_detector_exports as FindingDetector, git_exports as Git, identity_adapter_exports as IdentityAdapter, key_provider_exports as KeyProvider, lint_exports as Lint, logger_exports as Logger, project_adapter_exports as ProjectAdapter, project_initializer_exports as ProjectInitializer, record_metrics_exports as RecordMetrics, record_projection_exports as RecordProjection, record_types_exports as Records, agent_runner_exports as Runner, record_schemas_exports as Schemas, session_manager_exports as Session, source_auditor_exports as SourceAuditor, record_store_exports as Store, sync_state_exports as SyncState, record_validations_exports as Validation, workflow_adapter_exports as WorkflowAdapter };
11047
+ export { adapters_exports as Adapters, backlog_adapter_exports as BacklogAdapter, config_manager_exports as Config, crypto_exports as Crypto, diagram_generator_exports as DiagramGenerator, event_bus_exports as EventBus, execution_adapter_exports as ExecutionAdapter, record_factories_exports as Factories, feedback_adapter_exports as FeedbackAdapter, file_lister_exports as FileLister, finding_detector_exports as FindingDetector, git_exports as Git, identity_adapter_exports as IdentityAdapter, key_provider_exports as KeyProvider, lint_exports as Lint, logger_exports as Logger, project_adapter_exports as ProjectAdapter, project_initializer_exports as ProjectInitializer, record_metrics_exports as RecordMetrics, record_projection_exports as RecordProjection, record_types_exports as Records, agent_runner_exports as Runner, record_schemas_exports as Schemas, session_manager_exports as Session, source_auditor_exports as SourceAuditor, record_store_exports as Store, sync_state_exports as SyncState, record_validations_exports as Validation, workflow_adapter_exports as WorkflowAdapter };
11674
11048
  //# sourceMappingURL=index.js.map
11675
11049
  //# sourceMappingURL=index.js.map