codex-workflow-v2 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +71 -0
  2. package/dist/src/artifacts.d.ts +4 -0
  3. package/dist/src/artifacts.js +106 -0
  4. package/dist/src/artifacts.js.map +1 -0
  5. package/dist/src/cli.d.ts +2 -0
  6. package/dist/src/cli.js +356 -0
  7. package/dist/src/cli.js.map +1 -0
  8. package/dist/src/contracts.d.ts +313 -0
  9. package/dist/src/contracts.js +3 -0
  10. package/dist/src/contracts.js.map +1 -0
  11. package/dist/src/diagnostics.d.ts +19 -0
  12. package/dist/src/diagnostics.js +25 -0
  13. package/dist/src/diagnostics.js.map +1 -0
  14. package/dist/src/domain/discovery.d.ts +8 -0
  15. package/dist/src/domain/discovery.js +25 -0
  16. package/dist/src/domain/discovery.js.map +1 -0
  17. package/dist/src/domain/validation.d.ts +3 -0
  18. package/dist/src/domain/validation.js +96 -0
  19. package/dist/src/domain/validation.js.map +1 -0
  20. package/dist/src/errors.d.ts +6 -0
  21. package/dist/src/errors.js +11 -0
  22. package/dist/src/errors.js.map +1 -0
  23. package/dist/src/fs-utils.d.ts +4 -0
  24. package/dist/src/fs-utils.js +52 -0
  25. package/dist/src/fs-utils.js.map +1 -0
  26. package/dist/src/git.d.ts +19 -0
  27. package/dist/src/git.js +115 -0
  28. package/dist/src/git.js.map +1 -0
  29. package/dist/src/graph.d.ts +28 -0
  30. package/dist/src/graph.js +263 -0
  31. package/dist/src/graph.js.map +1 -0
  32. package/dist/src/index.d.ts +12 -0
  33. package/dist/src/index.js +13 -0
  34. package/dist/src/index.js.map +1 -0
  35. package/dist/src/memory.d.ts +9 -0
  36. package/dist/src/memory.js +242 -0
  37. package/dist/src/memory.js.map +1 -0
  38. package/dist/src/migration.d.ts +46 -0
  39. package/dist/src/migration.js +112 -0
  40. package/dist/src/migration.js.map +1 -0
  41. package/dist/src/repository.d.ts +12 -0
  42. package/dist/src/repository.js +69 -0
  43. package/dist/src/repository.js.map +1 -0
  44. package/dist/src/reviewer.d.ts +82 -0
  45. package/dist/src/reviewer.js +184 -0
  46. package/dist/src/reviewer.js.map +1 -0
  47. package/dist/src/state/lock.d.ts +13 -0
  48. package/dist/src/state/lock.js +100 -0
  49. package/dist/src/state/lock.js.map +1 -0
  50. package/dist/src/state/store.d.ts +45 -0
  51. package/dist/src/state/store.js +185 -0
  52. package/dist/src/state/store.js.map +1 -0
  53. package/dist/src/ulid.d.ts +2 -0
  54. package/dist/src/ulid.js +22 -0
  55. package/dist/src/ulid.js.map +1 -0
  56. package/dist/src/version.d.ts +2 -0
  57. package/dist/src/version.js +3 -0
  58. package/dist/src/version.js.map +1 -0
  59. package/dist/src/workflow.d.ts +93 -0
  60. package/dist/src/workflow.js +1276 -0
  61. package/dist/src/workflow.js.map +1 -0
  62. package/docs/decisions.md +38 -0
  63. package/docs/development-flow.md +69 -0
  64. package/docs/project-memory.md +38 -0
  65. package/docs/release.md +26 -0
  66. package/docs/validation-report.md +19 -0
  67. package/package.json +56 -0
  68. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +25 -0
  69. package/plugins/codex-workflow-gateway/references/protocol.md +66 -0
  70. package/plugins/codex-workflow-gateway/scripts/install-or-update.sh +26 -0
  71. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +72 -0
  72. package/references/discovery.md +12 -0
  73. package/references/git-policy.md +7 -0
  74. package/references/state-machine.md +11 -0
  75. package/references/validation-and-review.md +13 -0
  76. package/roles/delivery-coordinator.md +10 -0
  77. package/roles/independent-reviewer.md +10 -0
  78. package/roles/scope-lead.md +11 -0
  79. package/roles/technical-planner.md +10 -0
  80. package/roles/worker.md +10 -0
  81. package/schemas/context-envelope.schema.json +58 -0
  82. package/schemas/discovery.schema.json +19 -0
  83. package/schemas/graph-binding.schema.json +30 -0
  84. package/schemas/milestone.schema.json +58 -0
  85. package/schemas/project-knowledge-map.schema.json +37 -0
  86. package/schemas/review-result.schema.json +30 -0
  87. package/schemas/task.schema.json +39 -0
  88. package/templates/brief.md +21 -0
  89. package/templates/plan.md +17 -0
  90. package/templates/result.md +13 -0
@@ -0,0 +1,10 @@
1
+ # Delivery Coordinator
2
+
3
+ Own state transitions, dispatch envelopes, evidence collection, and recovery guidance.
4
+
5
+ - Verify Project Knowledge Map freshness before Plan authorization and role dispatch.
6
+ - Own derived map revisions and context selection, but never edit the meaning of canonical project files.
7
+ - Treat CLI `status`, `next`, revision, and lock state as authoritative machine state.
8
+ - Never bypass authorization, scope checks, failed validation, or stale review.
9
+ - Dispatch one Worker at a time for a concrete Step.
10
+ - Do not make product-scope decisions or implement production changes.
@@ -0,0 +1,10 @@
1
+ # Independent Reviewer
2
+
3
+ Compare requirements, acceptance, Plan, task-branch diff, checks, and generated evidence.
4
+
5
+ - Verify that declared knowledge impact matches the diff and that canonical project files agree with implemented behavior.
6
+ - Treat MCP and the local map as navigation/evidence metadata; confirm critical claims against repository files and Git.
7
+ - Operate read-only and do not fix findings.
8
+ - Mark the review `unverified` when read-only isolation or required evidence is unavailable.
9
+ - A failed review must contain actionable findings; a passed review contains none.
10
+ - Do not grant final acceptance on behalf of the user.
@@ -0,0 +1,11 @@
1
+ # Scope Lead
2
+
3
+ Own requirements discovery before any Task, branch, or execution artifact exists.
4
+
5
+ - Scan existing repository files and propose a Project Knowledge Map before code-aware discovery.
6
+ - Classify candidate sources and explicit gaps; never appoint a canonical source without user approval.
7
+ - Read broad approved project knowledge, treating the local map as derived metadata rather than content.
8
+ - Separate facts, decisions, assumptions, and unknowns.
9
+ - Ask only for missing information that changes scope, outcome, constraints, or acceptance.
10
+ - Do not implement, create branches, or treat an assumption as an approved requirement.
11
+ - Recommend Task materialization only when the readiness gate reports no blocking gaps.
@@ -0,0 +1,10 @@
1
+ # Technical Planner
2
+
3
+ Translate an approved Brief into an execution-ready Plan.
4
+
5
+ - Read the approved knowledge sources relevant to the Task and bind the Plan to the active map revision/hash.
6
+ - Declare `knowledgeImpact`, its reason, targets, and `graphUse`; do not hide missing knowledge as an implementation choice.
7
+ - Every requirement must be covered by at least one `STEP-*`.
8
+ - Each Step declares dependencies, outputs, allowed writes, forbidden scope, and checks.
9
+ - Do not edit production files or silently expand the Brief.
10
+ - Return unresolved semantic choices to the user through the Delivery Coordinator.
@@ -0,0 +1,10 @@
1
+ # Worker
2
+
3
+ Implement exactly one dispatched Step under its context envelope.
4
+
5
+ - Read only the mapped sources selected for the Step plus explicitly targeted knowledge files.
6
+ - Update canonical project files only when they appear in the authorized knowledge targets and `allowedWrites`.
7
+ - Read only declared inputs and repository context needed for the Step.
8
+ - Write only `allowedWrites`; stop on required scope expansion.
9
+ - Run the declared checks and report limitations honestly.
10
+ - Do not edit the Brief, Plan, acceptance, other Steps, workflow state, or Git history manually.
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/context-envelope.schema.json",
4
+ "title": "Codex Workflow V2 Context Envelope",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "protocolVersion",
9
+ "packageVersion",
10
+ "role",
11
+ "objective",
12
+ "inputs",
13
+ "allowedReads",
14
+ "allowedWrites",
15
+ "commands",
16
+ "forbiddenScope",
17
+ "resultSchema",
18
+ "stopConditions",
19
+ "contextBudget",
20
+ "taskId",
21
+ "stepId",
22
+ "expectedRevision",
23
+ "writerToken",
24
+ "knowledgeMap",
25
+ "knowledgeSources"
26
+ ],
27
+ "properties": {
28
+ "protocolVersion": { "const": 1 },
29
+ "packageVersion": { "type": "string" },
30
+ "role": {
31
+ "enum": ["scope-lead", "technical-planner", "delivery-coordinator", "worker", "independent-reviewer"]
32
+ },
33
+ "objective": { "type": "string", "minLength": 1 },
34
+ "inputs": { "type": "array", "items": { "type": "string" } },
35
+ "allowedReads": { "type": "array", "items": { "type": "string" } },
36
+ "allowedWrites": { "type": "array", "items": { "type": "string" } },
37
+ "commands": { "type": "array", "items": { "type": "string" } },
38
+ "forbiddenScope": { "type": "array", "items": { "type": "string" } },
39
+ "resultSchema": { "type": "object" },
40
+ "stopConditions": { "type": "array", "items": { "type": "string" } },
41
+ "contextBudget": { "enum": ["small", "medium", "large"] },
42
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
43
+ "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
44
+ "expectedRevision": { "type": "integer", "minimum": 1 },
45
+ "writerToken": { "type": ["string", "null"] },
46
+ "knowledgeMap": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "required": ["revision", "hash", "status"],
50
+ "properties": {
51
+ "revision": { "type": "integer", "minimum": 1 },
52
+ "hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
53
+ "status": { "enum": ["draft", "awaiting_approval", "active", "stale", "conflicted"] }
54
+ }
55
+ },
56
+ "knowledgeSources": { "type": "array", "items": { "type": "string" } }
57
+ }
58
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/discovery.schema.json",
4
+ "title": "Codex Workflow V2 Discovery State",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "revision", "id", "projectId", "kind", "status", "goal", "acceptance"],
7
+ "properties": {
8
+ "schemaVersion": { "const": 1 },
9
+ "revision": { "type": "integer", "minimum": 1 },
10
+ "id": { "type": "string", "pattern": "^DISC-[0-9A-HJKMNP-TV-Z]{26}$" },
11
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
12
+ "kind": { "const": "discovery" },
13
+ "status": {
14
+ "enum": ["needs_discovery", "needs_clarification", "ready_to_materialize", "materialized", "abandoned"]
15
+ },
16
+ "goal": { "type": "string", "minLength": 1 },
17
+ "acceptance": { "type": "array", "items": { "type": "string" } }
18
+ }
19
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/graph-binding.schema.json",
4
+ "title": "Codex Workflow V2 Graph Binding",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "revision", "id", "projectId", "kind", "graphKind", "provider", "rootFingerprint", "mode", "status", "observedAt", "evidenceHash", "previous"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "revision": { "type": "integer", "minimum": 1 },
11
+ "id": { "enum": ["GRAPH-product", "GRAPH-workflow"] },
12
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
13
+ "kind": { "const": "graph-binding" },
14
+ "graphKind": { "enum": ["product", "workflow"] },
15
+ "provider": { "const": "codebase-memory-mcp" },
16
+ "projectKey": { "type": ["string", "null"] },
17
+ "rootFingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
18
+ "indexedHead": { "type": ["string", "null"] },
19
+ "packageVersion": { "type": ["string", "null"] },
20
+ "manifestHash": { "type": ["string", "null"] },
21
+ "mode": { "enum": ["moderate", "full"] },
22
+ "status": { "enum": ["ready", "stale", "unavailable", "fallback"] },
23
+ "nodeCount": { "type": ["integer", "null"], "minimum": 0 },
24
+ "edgeCount": { "type": ["integer", "null"], "minimum": 0 },
25
+ "observedAt": { "type": "string", "format": "date-time" },
26
+ "evidenceHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
27
+ "fallbackReason": { "type": ["string", "null"] },
28
+ "previous": { "type": ["object", "null"] }
29
+ }
30
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/milestone.schema.json",
4
+ "title": "Codex Workflow V2 Milestone State",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion", "revision", "id", "projectId", "createdAt", "updatedAt", "kind", "status",
9
+ "title", "discoveryId", "outcome", "successSignal", "acceptance", "baseBranch", "taskIds",
10
+ "memberships", "checks", "membershipRevision", "authorizations", "planHash", "resultHash",
11
+ "evidenceHash", "acceptedHead", "cancellationReason"
12
+ ],
13
+ "properties": {
14
+ "schemaVersion": { "const": 1 },
15
+ "revision": { "type": "integer", "minimum": 1 },
16
+ "id": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
17
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
18
+ "createdAt": { "type": "string", "format": "date-time" },
19
+ "updatedAt": { "type": "string", "format": "date-time" },
20
+ "kind": { "const": "milestone" },
21
+ "status": {
22
+ "enum": [
23
+ "planning", "awaiting_execution_authorization", "active", "validating",
24
+ "awaiting_final_acceptance", "accepted", "blocked", "cancelled"
25
+ ]
26
+ },
27
+ "title": { "type": "string", "minLength": 1 },
28
+ "discoveryId": { "type": "string", "pattern": "^DISC-[0-9A-HJKMNP-TV-Z]{26}$" },
29
+ "outcome": { "type": "string" },
30
+ "successSignal": { "type": "string" },
31
+ "acceptance": { "type": "array", "items": { "type": "string", "minLength": 1 } },
32
+ "baseBranch": { "type": "string", "minLength": 1 },
33
+ "taskIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/taskId" } },
34
+ "memberships": { "type": "array", "items": { "$ref": "#/$defs/membership" } },
35
+ "checks": { "type": "array", "items": { "type": "string", "minLength": 1 } },
36
+ "membershipRevision": { "type": "integer", "minimum": 0 },
37
+ "authorizations": { "type": "array", "items": { "type": "object" } },
38
+ "planHash": { "$ref": "#/$defs/nullableHash" },
39
+ "resultHash": { "$ref": "#/$defs/nullableHash" },
40
+ "evidenceHash": { "$ref": "#/$defs/nullableHash" },
41
+ "acceptedHead": { "$ref": "#/$defs/nullableHash" },
42
+ "cancellationReason": { "type": ["string", "null"] }
43
+ },
44
+ "$defs": {
45
+ "taskId": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
46
+ "nullableHash": { "type": ["string", "null"], "pattern": "^[a-f0-9]{40,64}$" },
47
+ "membership": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": ["taskId", "disposition", "reason"],
51
+ "properties": {
52
+ "taskId": { "$ref": "#/$defs/taskId" },
53
+ "disposition": { "enum": ["required", "waived", "cancelled"] },
54
+ "reason": { "type": "string" }
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/project-knowledge-map.schema.json",
4
+ "title": "Codex Workflow V2 Project Knowledge Map",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "revision", "id", "projectId", "kind", "status", "entries", "gaps", "conflicts", "approval"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "revision": { "type": "integer", "minimum": 1 },
11
+ "id": { "const": "PROJECT-KNOWLEDGE-MAP" },
12
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
13
+ "kind": { "const": "knowledge-map" },
14
+ "status": { "enum": ["draft", "awaiting_approval", "active", "stale", "conflicted"] },
15
+ "entries": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": ["id", "category", "path", "scope", "authority", "contentHash", "discoveredBy", "lastVerifiedAt"],
21
+ "properties": {
22
+ "id": { "type": "string", "pattern": "^KS-[a-f0-9]{16}$" },
23
+ "category": { "enum": ["agent-guidance", "onboarding", "architecture", "decisions", "commands", "ownership", "testing", "operations", "domain"] },
24
+ "path": { "type": "string", "minLength": 1 },
25
+ "scope": { "type": "string", "minLength": 1 },
26
+ "authority": { "enum": ["canonical", "supporting"] },
27
+ "contentHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
28
+ "discoveredBy": { "type": "string", "minLength": 1 },
29
+ "lastVerifiedAt": { "type": "string", "format": "date-time" }
30
+ }
31
+ }
32
+ },
33
+ "gaps": { "type": "array" },
34
+ "conflicts": { "type": "array" },
35
+ "approval": { "type": ["object", "null"] }
36
+ }
37
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/review-result.schema.json",
4
+ "title": "Codex Workflow V2 Strict Review Result",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["status", "reviewer", "summary", "findings", "isolationProbe"],
8
+ "properties": {
9
+ "status": { "enum": ["passed", "failed", "unverified"] },
10
+ "reviewer": { "type": "string", "minLength": 1 },
11
+ "summary": { "type": "string", "minLength": 1 },
12
+ "isolationProbe": { "enum": ["denied", "written", "not-attempted"] },
13
+ "findings": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["id", "severity", "requirement", "summary", "evidence", "requiredAction"],
19
+ "properties": {
20
+ "id": { "type": "string", "minLength": 1 },
21
+ "severity": { "enum": ["critical", "major", "minor"] },
22
+ "requirement": { "type": ["string", "null"] },
23
+ "summary": { "type": "string", "minLength": 1 },
24
+ "evidence": { "type": "string", "minLength": 1 },
25
+ "requiredAction": { "type": "string", "minLength": 1 }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/task.schema.json",
4
+ "title": "Codex Workflow V2 Task State",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "revision", "id", "projectId", "kind", "status", "title", "knowledgeImpact", "knowledgeTargets", "knowledgeMapRevision", "knowledgeMapHash", "graphUse", "steps", "authorizations"],
7
+ "properties": {
8
+ "schemaVersion": { "const": 1 },
9
+ "revision": { "type": "integer", "minimum": 1 },
10
+ "id": { "type": "string", "pattern": "^TASK-[0-9A-HJKMNP-TV-Z]{26}$" },
11
+ "projectId": { "type": "string", "pattern": "^[a-f0-9]{24}$" },
12
+ "kind": { "const": "task" },
13
+ "status": {
14
+ "enum": [
15
+ "planning",
16
+ "awaiting_execution_authorization",
17
+ "ready",
18
+ "in_progress",
19
+ "validating",
20
+ "needs_fix",
21
+ "awaiting_final_acceptance",
22
+ "merging",
23
+ "ready_to_merge",
24
+ "merged",
25
+ "blocked",
26
+ "cancelled"
27
+ ]
28
+ },
29
+ "title": { "type": "string", "minLength": 1 },
30
+ "knowledgeImpact": { "enum": ["none", "update", "create", "retire", null] },
31
+ "knowledgeImpactReason": { "type": ["string", "null"] },
32
+ "knowledgeTargets": { "type": "array" },
33
+ "knowledgeMapRevision": { "type": ["integer", "null"], "minimum": 1 },
34
+ "knowledgeMapHash": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
35
+ "graphUse": { "enum": ["code-aware", "not-applicable", null] },
36
+ "steps": { "type": "array" },
37
+ "authorizations": { "type": "array" }
38
+ }
39
+ }
@@ -0,0 +1,21 @@
1
+ # {{title}} Brief
2
+
3
+ ## Goal
4
+
5
+ {{goal}}
6
+
7
+ ## Observable Outcome
8
+
9
+ {{outcome}}
10
+
11
+ ## Requirements
12
+
13
+ {{requirements}}
14
+
15
+ ## Scope
16
+
17
+ {{scope}}
18
+
19
+ ## Acceptance Scenarios
20
+
21
+ {{acceptance}}
@@ -0,0 +1,17 @@
1
+ # {{taskId}} Plan
2
+
3
+ ## Objective
4
+
5
+ {{objective}}
6
+
7
+ ## Requirements and Acceptance
8
+
9
+ {{requirementsAndAcceptance}}
10
+
11
+ ## Risks
12
+
13
+ {{risks}}
14
+
15
+ ## Steps
16
+
17
+ {{steps}}
@@ -0,0 +1,13 @@
1
+ # {{taskId}} Result
2
+
3
+ ## Summary
4
+
5
+ {{summary}}
6
+
7
+ ## Completed Steps and Commits
8
+
9
+ {{completedSteps}}
10
+
11
+ ## Limitations
12
+
13
+ {{limitations}}