@cr1992/agentkit 1.0.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +107 -0
  4. package/README.md +103 -0
  5. package/bin/agentkit.mjs +4 -0
  6. package/bin/cli.mjs +273 -0
  7. package/core/atomic-fs.mjs +23 -0
  8. package/core/cli-help.mjs +54 -0
  9. package/core/content-digest.mjs +66 -0
  10. package/core/digest.mjs +67 -0
  11. package/core/json-schema-lite.mjs +60 -0
  12. package/core/legacy-entry.mjs +37 -0
  13. package/core/reflection.mjs +142 -0
  14. package/core/runtime-bundle.mjs +101 -0
  15. package/docs/loop/embedded-review-adapter.md +41 -0
  16. package/docs/loop/loop-state-machine.md +43 -0
  17. package/docs/loop/recovery-and-fuses.md +34 -0
  18. package/docs/orchestrate/dispatch-contract.md +92 -0
  19. package/docs/orchestrate/failure-routing-and-recovery.md +46 -0
  20. package/docs/orchestrate/host-capability-cache.md +170 -0
  21. package/docs/orchestrate/isolation-fallback.md +18 -0
  22. package/docs/orchestrate/model-routing-config.md +186 -0
  23. package/docs/orchestrate/orchestration-runtime.md +261 -0
  24. package/docs/orchestrate/review-budget.md +90 -0
  25. package/docs/orchestrate/task-playbooks.md +85 -0
  26. package/docs/orchestrate/user-facing-reporting.md +14 -0
  27. package/docs/verify/evidence-schema.md +167 -0
  28. package/docs/verify/input-preparation.md +44 -0
  29. package/docs/verify/verification-protocol.md +76 -0
  30. package/docs/worktree/batch-integration.md +176 -0
  31. package/docs/worktree/delivery-identity.md +41 -0
  32. package/docs/worktree/profile.md +107 -0
  33. package/docs/worktree/reclaim-and-watch.md +96 -0
  34. package/docs/worktree/review-lifecycle.md +92 -0
  35. package/docs/worktree/spawn-and-stack.md +74 -0
  36. package/domains/loop/loop-runtime.mjs +1056 -0
  37. package/domains/orchestrate/contract-tool.mjs +169 -0
  38. package/domains/orchestrate/host_capability_cache.mjs +437 -0
  39. package/domains/orchestrate/orchestration-ledger.mjs +332 -0
  40. package/domains/orchestrate/orchestration-metadata.mjs +4 -0
  41. package/domains/orchestrate/orchestration-reflection.mjs +119 -0
  42. package/domains/orchestrate/resolve_model_policy.mjs +311 -0
  43. package/domains/orchestrate/review-budget.mjs +162 -0
  44. package/domains/orchestrate/worker-capability-preflight.mjs +227 -0
  45. package/domains/verify/verification-runtime.mjs +1638 -0
  46. package/domains/worktree/worktree-archive.mjs +135 -0
  47. package/domains/worktree/worktree-artifact.mjs +123 -0
  48. package/domains/worktree/worktree-batch-integrate.mjs +713 -0
  49. package/domains/worktree/worktree-batch-plan.mjs +198 -0
  50. package/domains/worktree/worktree-batch-result.mjs +241 -0
  51. package/domains/worktree/worktree-core.mjs +908 -0
  52. package/domains/worktree/worktree-doctor.mjs +493 -0
  53. package/domains/worktree/worktree-history.mjs +377 -0
  54. package/domains/worktree/worktree-learning.mjs +110 -0
  55. package/domains/worktree/worktree-lifecycle.mjs +786 -0
  56. package/domains/worktree/worktree-merge-preview.mjs +409 -0
  57. package/domains/worktree/worktree-mgr.mjs +261 -0
  58. package/domains/worktree/worktree-process.mjs +55 -0
  59. package/domains/worktree/worktree-profile.mjs +800 -0
  60. package/domains/worktree/worktree-provider-gitlab.mjs +59 -0
  61. package/domains/worktree/worktree-reclaim.mjs +683 -0
  62. package/domains/worktree/worktree-review-refresh.mjs +574 -0
  63. package/domains/worktree/worktree-review-watch.mjs +661 -0
  64. package/domains/worktree/worktree-scan.mjs +510 -0
  65. package/domains/worktree/worktree-trace-test-worker.mjs +23 -0
  66. package/domains/worktree/worktree-trace.mjs +478 -0
  67. package/manage-worktrees/SKILL.md +87 -0
  68. package/manage-worktrees/agents/openai.yaml +4 -0
  69. package/manage-worktrees/scripts/worktree-mgr.mjs +10 -0
  70. package/manage-worktrees/scripts/worktree-scan.mjs +10 -0
  71. package/orchestrate-subagents/SKILL.md +173 -0
  72. package/orchestrate-subagents/agents/openai.yaml +4 -0
  73. package/orchestrate-subagents/scripts/contract-tool.mjs +10 -0
  74. package/orchestrate-subagents/scripts/host_capability_cache.mjs +10 -0
  75. package/orchestrate-subagents/scripts/orchestration-ledger.mjs +10 -0
  76. package/orchestrate-subagents/scripts/orchestration-reflection.mjs +10 -0
  77. package/orchestrate-subagents/scripts/resolve_model_policy.mjs +10 -0
  78. package/orchestrate-subagents/scripts/review-budget.mjs +10 -0
  79. package/orchestrate-subagents/scripts/worker-capability-preflight.mjs +10 -0
  80. package/package.json +48 -0
  81. package/run-agent-verify-loop/SKILL.md +127 -0
  82. package/run-agent-verify-loop/agents/openai.yaml +4 -0
  83. package/run-agent-verify-loop/scripts/loop-runtime.mjs +10 -0
  84. package/schemas/artifact-ref-v1.schema.json +23 -0
  85. package/schemas/batch-result-v1.schema.json +138 -0
  86. package/schemas/controller-recheck-record-v1.schema.json +22 -0
  87. package/schemas/convergence-report-v1.schema.json +9 -0
  88. package/schemas/effective-worker-capability-v1.schema.json +36 -0
  89. package/schemas/embedded-verification-record-v1.schema.json +32 -0
  90. package/schemas/evidence-package-v1.schema.json +41 -0
  91. package/schemas/improvement-proposal-v1.schema.json +18 -0
  92. package/schemas/loop-state-v1.schema.json +34 -0
  93. package/schemas/model-policy-resolution-v1.schema.json +41 -0
  94. package/schemas/orchestration-ledger-v1.schema.json +110 -0
  95. package/schemas/reflection-record-v1.schema.json +24 -0
  96. package/schemas/review-result-v1.schema.json +37 -0
  97. package/schemas/task-contract-v1.schema.json +83 -0
  98. package/schemas/verification-profile-v1.schema.json +60 -0
  99. package/schemas/worker-capability-requirements-v1.schema.json +21 -0
  100. package/schemas/worktree-binding-v1.schema.json +14 -0
  101. package/shell-manifest.json +79 -0
  102. package/verify-agent-output/SKILL.md +119 -0
  103. package/verify-agent-output/agents/openai.yaml +4 -0
  104. package/verify-agent-output/scripts/verification-runtime.mjs +10 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/controller-recheck-record-v1.schema.json",
4
+ "title": "Controller Recheck Record v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "report_type", "contract_digest", "stable_output_digests", "outcome", "checked_at"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "report_type": { "const": "controller_recheck" },
10
+ "contract_digest": { "$ref": "#/$defs/digest" },
11
+ "stable_output_digests": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "uniqueItems": true,
15
+ "items": { "$ref": "#/$defs/digest" }
16
+ },
17
+ "outcome": { "const": "pass" },
18
+ "checked_at": { "type": "string", "format": "date-time" }
19
+ },
20
+ "additionalProperties": false,
21
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
22
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/convergence-report-v1.schema.json",
4
+ "title": "Convergence Report v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "report_id", "loop_id", "contract_digest", "skill_set", "outcome", "iterations", "failure_signatures", "strategy_changes", "verification_aborts", "verification_gaps", "reflection_refs", "improvement_proposal_refs", "generated_at", "report_digest"],
8
+ "properties": { "schema_version": { "const": 1 }, "report_id": { "type": "string" }, "loop_id": { "type": "string" }, "contract_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }, "skill_set": { "type": "array" }, "outcome": { "enum": ["completed", "stopped"] }, "iterations": { "type": "integer", "minimum": 0 }, "failure_signatures": { "type": "array" }, "strategy_changes": { "type": "array" }, "verification_aborts": { "type": "array" }, "verification_gaps": { "type": "array" }, "reflection_refs": { "type": "array" }, "improvement_proposal_refs": { "type": "array" }, "generated_at": { "type": "string", "format": "date-time" }, "report_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
9
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/effective-worker-capability-v1.schema.json",
4
+ "title": "Effective Worker Capability v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "host", "worker_profile", "capability_fingerprint", "binding", "observed_at", "expires_at", "outcomes", "evidence_refs"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "host": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$" },
11
+ "worker_profile": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" },
12
+ "capability_fingerprint": { "$ref": "#/$defs/digest" },
13
+ "binding": { "type": "string", "pattern": "^(session:[A-Za-z0-9._-]{1,128}|config:sha256:[0-9a-f]{64})$" },
14
+ "observed_at": { "type": "string", "format": "date-time" },
15
+ "expires_at": { "type": "string", "format": "date-time" },
16
+ "outcomes": {
17
+ "type": "object",
18
+ "propertyNames": { "pattern": "^worker\\.[a-z][a-z0-9_.-]{0,63}$" },
19
+ "additionalProperties": { "enum": ["allowed", "denied_by_policy", "unavailable_or_unproven", "approval_channel_fault", "execution_fault"] }
20
+ },
21
+ "evidence_refs": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["type", "id", "digest"],
27
+ "properties": {
28
+ "type": { "enum": ["probe", "schema", "observation"] },
29
+ "id": { "type": "string", "minLength": 1 },
30
+ "digest": { "$ref": "#/$defs/digest" }
31
+ }
32
+ }
33
+ }
34
+ },
35
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
36
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/embedded-verification-record-v1.schema.json",
4
+ "title": "Embedded Verification Record v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "record_type", "record_id", "loop_id", "iteration", "contract_digest", "verification_profile_digest", "artifact_ref", "l0_result", "l1_result", "independent_context", "outcome", "record_digest"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "record_type": { "const": "embedded_verification_record" },
10
+ "record_id": { "type": "string", "minLength": 1 },
11
+ "loop_id": { "type": "string", "minLength": 1 },
12
+ "iteration": { "type": "integer", "minimum": 1 },
13
+ "contract_digest": { "$ref": "#/$defs/digest" },
14
+ "verification_profile_digest": { "$ref": "#/$defs/digest" },
15
+ "artifact_ref": { "type": "object" },
16
+ "l0_result": { "type": "object" },
17
+ "l1_result": { "$ref": "review-result-v1.schema.json" },
18
+ "independent_context": {
19
+ "type": "object",
20
+ "required": ["assurance", "reviewer_run_id"],
21
+ "properties": {
22
+ "assurance": { "enum": ["host_reported", "user_relayed"] },
23
+ "reviewer_run_id": { "type": "string", "minLength": 1 }
24
+ },
25
+ "additionalProperties": false
26
+ },
27
+ "outcome": { "enum": ["pass", "fail", "undecidable", "blocked_safety"] },
28
+ "record_digest": { "$ref": "#/$defs/digest" }
29
+ },
30
+ "additionalProperties": false,
31
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
32
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/evidence-package-v1.schema.json",
4
+ "title": "Evidence Package v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "run_id", "protocol_version", "runtime_version", "contract_digest", "verification_profile_digest", "artifact_ref", "stages", "terminal_outcome", "completion_scope", "human_gate_required", "provenance", "evidence_digest"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "run_id": { "type": "string", "minLength": 1 },
10
+ "protocol_version": { "const": 1 },
11
+ "runtime_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$" },
12
+ "contract_digest": { "$ref": "#/$defs/digest" },
13
+ "verification_profile_digest": { "$ref": "#/$defs/digest" },
14
+ "artifact_ref": { "type": "object" },
15
+ "stages": {
16
+ "type": "object",
17
+ "required": ["smoke_l0", "l1_review", "final_l0"],
18
+ "properties": {
19
+ "smoke_l0": { "type": "object" },
20
+ "l1_review": { "type": "object" },
21
+ "final_l0": { "type": "object" }
22
+ }
23
+ },
24
+ "terminal_outcome": { "enum": ["pass", "fail", "undecidable", "blocked_safety"] },
25
+ "completion_scope": { "const": "verification_only" },
26
+ "human_gate_required": { "type": "boolean" },
27
+ "provenance": {
28
+ "type": "object",
29
+ "required": ["provider", "verified_at", "verifier_run_id", "isolation_assurance", "limitations"],
30
+ "properties": {
31
+ "provider": { "const": "verify-agent-output" },
32
+ "verified_at": { "type": "string" },
33
+ "verifier_run_id": { "type": "string" },
34
+ "isolation_assurance": { "enum": ["host_reported", "user_relayed"] },
35
+ "limitations": { "type": "array", "items": { "type": "string" } }
36
+ }
37
+ },
38
+ "evidence_digest": { "$ref": "#/$defs/digest" }
39
+ },
40
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
41
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/improvement-proposal-v1.schema.json",
4
+ "title": "Skill Improvement Proposal v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "proposal_id", "target_skill", "source_reflections", "problem", "proposed_change", "affected_scope", "counterexamples", "validation_plan", "lifecycle", "proposal_digest"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 }, "proposal_id": { "type": "string" },
10
+ "target_skill": { "type": "object", "required": ["name", "based_on_version", "based_on_digest"], "properties": { "name": { "type": "string" }, "based_on_version": { "type": "string" }, "based_on_digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
11
+ "source_reflections": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["reflection_id", "reflection_digest"], "properties": { "reflection_id": { "type": "string" }, "reflection_digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false } },
12
+ "problem": { "type": "object", "required": ["type", "evidence_refs"], "properties": { "type": { "enum": ["skill_gap", "false_positive", "false_negative", "inefficiency"] }, "evidence_refs": { "type": "array", "minItems": 1 } }, "additionalProperties": false },
13
+ "proposed_change": { "type": "string", "minLength": 1 }, "affected_scope": { "type": "array", "items": { "type": "string" } }, "counterexamples": { "type": "array", "items": { "type": "string" } },
14
+ "validation_plan": { "type": "object", "required": ["replay_cases", "regression_suites", "independent_review"], "properties": { "replay_cases": { "type": "array" }, "regression_suites": { "type": "array" }, "independent_review": { "const": "required" }, "canary": { "type": "string" } }, "additionalProperties": false },
15
+ "lifecycle": { "const": "proposed" }, "proposal_digest": { "$ref": "#/$defs/digest" }
16
+ },
17
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
18
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/loop-state-v1.schema.json",
4
+ "title": "Loop State v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "runtime_version", "loop_id", "revision", "state", "contract_digest", "verification_profile_digest", "provider", "limits", "policy", "current_iteration", "iterations", "consumed_verification_run_ids", "human_gate", "skill_provenance", "terminal"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "runtime_version": { "type": "string" },
10
+ "loop_id": { "type": "string", "minLength": 1 },
11
+ "goal_ref": { "type": ["string", "null"] },
12
+ "revision": { "type": "integer", "minimum": 0 },
13
+ "state": { "enum": ["active", "waiting_human", "completed", "stopped"] },
14
+ "contract_digest": { "$ref": "#/$defs/digest" },
15
+ "verification_profile_digest": { "$ref": "#/$defs/digest" },
16
+ "provider": { "enum": ["verify-agent-output", "embedded"] },
17
+ "limits": {
18
+ "type": "object",
19
+ "required": ["max_iterations", "consecutive_identical_signature"],
20
+ "properties": {
21
+ "max_iterations": { "type": "integer", "minimum": 1 },
22
+ "consecutive_identical_signature": { "type": "integer", "minimum": 1 }
23
+ }
24
+ },
25
+ "policy": { "type": "object" },
26
+ "current_iteration": { "type": ["object", "null"] },
27
+ "iterations": { "type": "array" },
28
+ "consumed_verification_run_ids": { "type": "array", "items": { "type": "string" } },
29
+ "human_gate": { "type": "object" },
30
+ "skill_provenance": { "type": "object" },
31
+ "terminal": { "type": ["object", "null"] }
32
+ },
33
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
34
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/model-policy-resolution-v1.schema.json",
4
+ "title": "Model Policy Resolution v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "record_type", "host", "tier_rank", "channel", "selection_source", "dispatch_record_patch"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "record_type": { "const": "model-policy-resolution" },
10
+ "host": { "type": "string", "minLength": 1 },
11
+ "tier_rank": { "type": "integer", "minimum": 0 },
12
+ "channel": { "type": "string", "minLength": 1 },
13
+ "selection_source": { "enum": ["user-explicit", "local-config"] },
14
+ "dispatch_record_patch": { "$ref": "#/$defs/dispatchRecordPatch" }
15
+ },
16
+ "additionalProperties": false,
17
+ "$defs": {
18
+ "dispatchRecordPatch": {
19
+ "type": "object",
20
+ "required": ["attempt_id", "attempt", "previous_attempt_id", "tier", "model", "reasoning_effort", "adjustment_action", "failure_kind", "failure_ref", "selection_reason", "config_source", "configuration_state", "model_resolution_state", "dispatch_provenance", "max_attempts"],
21
+ "properties": {
22
+ "attempt_id": { "type": "string", "minLength": 1 },
23
+ "attempt": { "type": "integer", "minimum": 1 },
24
+ "previous_attempt_id": { "type": ["string", "null"] },
25
+ "tier": { "type": "string", "minLength": 1 },
26
+ "model": { "type": "string", "minLength": 1 },
27
+ "reasoning_effort": { "type": "string", "minLength": 1 },
28
+ "adjustment_action": { "enum": ["initial", "retry_same", "raise_effort", "switch_model", "promote_tier", "fresh_context", "change_strategy"] },
29
+ "failure_kind": { "type": ["string", "null"] },
30
+ "failure_ref": { "type": ["string", "null"] },
31
+ "selection_reason": { "type": "string", "minLength": 1 },
32
+ "config_source": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
33
+ "configuration_state": { "enum": ["user-explicit", "persisted-config"] },
34
+ "model_resolution_state": { "enum": ["discovered-and-validated", "user-explicit-unverifiable"] },
35
+ "dispatch_provenance": { "enum": ["explicit", "inherited-controller", "host-default"] },
36
+ "max_attempts": { "type": "integer", "minimum": 1 }
37
+ },
38
+ "additionalProperties": false
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://agent-skills.local/schemas/orchestration-ledger-v1.schema.json", "title": "Orchestration Ledger v1", "type": "object", "required": ["schema_version", "runtime_version", "ledger_id", "revision", "contract_digest", "nodes", "edges", "attachments", "batches", "reflection_refs", "improvement_proposal_refs", "skill_provenance", "created_at", "updated_at"], "properties": { "schema_version": { "const": 1 }, "runtime_version": { "type": "string" }, "ledger_id": { "type": "string" }, "revision": { "type": "integer" }, "contract_digest": { "type": "string" }, "nodes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/node" } }, "edges": { "type": "array" }, "attachments": { "type": "array", "items": { "$ref": "#/$defs/attachment" } }, "batches": { "type": "object" }, "reflection_refs": { "type": "array" }, "improvement_proposal_refs": { "type": "array" }, "skill_provenance": { "type": "object" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "additionalProperties": false,
3
+ "$defs": {
4
+ "attachment": {
5
+ "type": "object",
6
+ "required": ["attachment_id", "node_id", "type", "digest", "ref"],
7
+ "properties": {
8
+ "attachment_id": { "type": "string" },
9
+ "node_id": { "type": "string" },
10
+ "type": { "enum": ["worktree", "artifact", "evidence", "loop", "report", "contract"] },
11
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
12
+ "ref": { "type": "string" }
13
+ }
14
+ },
15
+ "dispatch": {
16
+ "type": "object",
17
+ "required": ["schema_version", "worker_id", "orchestration_mode", "attempt_id", "attempt", "previous_attempt_id", "tier", "model", "reasoning_effort", "adjustment_action", "failure_kind", "failure_ref", "selection_reason", "config_source", "configuration_state", "model_resolution_state", "capability_source", "capability_fingerprint", "dispatch_provenance", "token_budget", "max_attempts"],
18
+ "properties": {
19
+ "schema_version": { "const": 2 },
20
+ "worker_id": { "type": "string", "minLength": 1 },
21
+ "orchestration_mode": { "enum": ["lightweight", "full"] },
22
+ "attempt_id": { "type": "string", "minLength": 1 },
23
+ "attempt": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
24
+ "previous_attempt_id": { "type": ["string", "null"] },
25
+ "tier": { "type": "string", "minLength": 1 },
26
+ "model": { "type": "string", "minLength": 1 },
27
+ "reasoning_effort": { "type": "string", "minLength": 1 },
28
+ "adjustment_action": { "enum": ["initial", "retry_same", "raise_effort", "switch_model", "promote_tier", "fresh_context", "change_strategy"] },
29
+ "failure_kind": { "type": ["string", "null"], "enum": [null, "implementation_defect", "reasoning_gap", "context_gap", "strategy_gap"] },
30
+ "failure_ref": { "type": ["string", "null"], "pattern": "^sha256:[0-9a-f]{64}$" },
31
+ "selection_reason": { "type": "string", "minLength": 1 },
32
+ "config_source": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
33
+ "configuration_state": { "enum": ["user-explicit", "session-inferred", "session-confirmed", "persisted-config", "host-default"] },
34
+ "model_resolution_state": { "enum": ["discovered-and-validated", "user-explicit-unverifiable", "host-default-unexposed"] },
35
+ "capability_source": { "type": "string", "minLength": 1 },
36
+ "capability_fingerprint": { "type": ["string", "null"], "pattern": "^sha256:[0-9a-f]{64}$" },
37
+ "dispatch_provenance": { "enum": ["explicit", "inherited-controller", "host-default"] },
38
+ "token_budget": { "oneOf": [{ "const": "unsupported" }, { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }] },
39
+ "max_attempts": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }
40
+ },
41
+ "additionalProperties": false,
42
+ "allOf": [
43
+ {
44
+ "if": { "properties": { "orchestration_mode": { "const": "full" } }, "required": ["orchestration_mode"] },
45
+ "then": { "properties": { "capability_fingerprint": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }
46
+ },
47
+ {
48
+ "if": { "properties": { "model_resolution_state": { "const": "user-explicit-unverifiable" } }, "required": ["model_resolution_state"] },
49
+ "then": { "properties": { "configuration_state": { "const": "user-explicit" } } }
50
+ },
51
+ {
52
+ "if": { "properties": { "model_resolution_state": { "const": "host-default-unexposed" } }, "required": ["model_resolution_state"] },
53
+ "then": { "properties": { "model": { "const": "host-default" }, "configuration_state": { "const": "host-default" }, "dispatch_provenance": { "const": "host-default" } } }
54
+ },
55
+ {
56
+ "if": { "properties": { "attempt": { "const": 1 } }, "required": ["attempt"] },
57
+ "then": { "properties": { "adjustment_action": { "const": "initial" }, "previous_attempt_id": { "type": "null" }, "failure_kind": { "type": "null" }, "failure_ref": { "type": "null" } } },
58
+ "else": { "properties": { "adjustment_action": { "not": { "const": "initial" } }, "previous_attempt_id": { "type": "string", "minLength": 1 }, "failure_kind": { "type": "string" }, "failure_ref": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }
59
+ }
60
+ ]
61
+ },
62
+ "node": {
63
+ "type": "object",
64
+ "required": ["node_id", "objective", "role", "required", "state", "permissions", "dependencies", "dispatch", "stable_outputs", "evidence", "created_at", "updated_at"],
65
+ "properties": {
66
+ "node_id": { "type": "string" },
67
+ "objective": { "type": "string" },
68
+ "role": { "enum": ["scout", "worker", "critic", "judge"] },
69
+ "required": { "type": "boolean" },
70
+ "state": { "enum": ["pending", "running", "blocked", "awaiting_verification", "passed", "failed", "cancelled"] },
71
+ "permissions": { "type": "object" },
72
+ "dependencies": { "type": "array" },
73
+ "dispatch": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/dispatch" }] },
74
+ "stable_outputs": { "type": "array" },
75
+ "evidence": { "type": "array" },
76
+ "verification": {
77
+ "type": "object",
78
+ "required": ["requirement", "provider", "artifact_scope"],
79
+ "properties": {
80
+ "requirement": { "description": "not_applicable 只允许 role 为 critic / scout 的只读评审节点,且必须搭配 provider none 与 artifact_scope not_applicable。", "enum": ["worker_self_check", "controller_recheck", "independent_evidence", "not_applicable"] },
81
+ "provider": { "enum": ["none", "verify-agent-output"] },
82
+ "artifact_scope": { "enum": ["node_output", "integration_candidate", "not_applicable"] }
83
+ },
84
+ "additionalProperties": false
85
+ },
86
+ "verification_assurance": { "enum": ["none", "worker_self_check", "controller_recheck", "independent_evidence", "not_applicable"] },
87
+ "verification_ref": { "type": ["string", "null"], "pattern": "^sha256:[0-9a-f]{64}$" },
88
+ "tokens": {
89
+ "oneOf": [
90
+ { "type": "null" },
91
+ { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
92
+ {
93
+ "type": "object",
94
+ "required": ["input_tokens", "output_tokens", "total_tokens"],
95
+ "properties": {
96
+ "input_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
97
+ "output_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
98
+ "total_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
99
+ },
100
+ "additionalProperties": false
101
+ }
102
+ ]
103
+ },
104
+ "duration_ms": { "type": ["integer", "null"], "minimum": 0, "maximum": 9007199254740991 },
105
+ "created_at": { "type": "string" },
106
+ "updated_at": { "type": "string" }
107
+ }
108
+ }
109
+ }
110
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/reflection-record-v1.schema.json",
4
+ "title": "Reflection Record v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "reflection_id", "trigger", "scope", "affected_skill", "classification", "observation", "evidence_refs", "impact", "confidence", "recommended_disposition", "recorded_at", "reflection_digest"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "reflection_id": { "type": "string", "minLength": 1 },
11
+ "trigger": { "enum": ["repeated_failure", "undecidable", "user_correction", "runtime_abort", "workaround", "protocol_conflict", "unexpected_outcome", "terminal_retrospective"] },
12
+ "scope": { "type": "object", "required": ["contract_digest"], "properties": { "contract_digest": { "$ref": "#/$defs/digest" }, "loop_id": { "type": ["string", "null"] }, "iteration": { "type": ["integer", "null"] }, "run_id": { "type": ["string", "null"] } }, "additionalProperties": false },
13
+ "affected_skill": { "type": "object", "required": ["name", "version", "content_digest"], "properties": { "name": { "type": "string" }, "version": { "type": "string" }, "content_digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false },
14
+ "classification": { "enum": ["contract_gap", "skill_gap", "verification_gap", "tool_gap", "environment_gap", "false_positive", "false_negative", "inefficiency"] },
15
+ "observation": { "type": "string", "minLength": 1 },
16
+ "evidence_refs": { "type": "array", "items": { "type": "object", "required": ["type", "id", "digest"], "properties": { "type": { "enum": ["artifact", "evidence", "event", "diagnostic"] }, "id": { "type": "string" }, "digest": { "$ref": "#/$defs/digest" } }, "additionalProperties": false } },
17
+ "impact": { "enum": ["low", "medium", "high", "safety"] },
18
+ "confidence": { "enum": ["low", "medium", "high"] },
19
+ "recommended_disposition": { "enum": ["continue", "undecidable", "abort", "re_contract", "human_gate"] },
20
+ "recorded_at": { "type": "string", "format": "date-time" },
21
+ "reflection_digest": { "$ref": "#/$defs/digest" }
22
+ },
23
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
24
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/review-result-v1.schema.json",
4
+ "title": "Review Result v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "review_result_id", "contract_digest", "verification_profile_digest", "artifact_ref", "challenge_nonce", "verdict", "findings", "forensics", "review_result_digest"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "review_result_id": { "type": "string", "minLength": 1 },
10
+ "contract_digest": { "$ref": "#/$defs/digest" },
11
+ "verification_profile_digest": { "$ref": "#/$defs/digest" },
12
+ "artifact_ref": { "type": "object" },
13
+ "challenge_nonce": { "type": "string", "minLength": 1 },
14
+ "verdict": { "enum": ["fail", "no_defect_found", "undecidable"] },
15
+ "findings": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "required": ["contract_item_id", "class", "evidence", "expected", "actual"],
20
+ "properties": {
21
+ "contract_item_id": { "type": "string", "minLength": 1 },
22
+ "class": { "enum": ["functional", "scope", "verification_definition", "safety"] },
23
+ "evidence": { "type": "string", "minLength": 1 },
24
+ "expected": { "type": "string", "minLength": 1 },
25
+ "actual": { "type": "string", "minLength": 1 }
26
+ },
27
+ "additionalProperties": false
28
+ }
29
+ },
30
+ "forensics": { "type": "array", "items": { "type": "string", "minLength": 1 } },
31
+ "review_result_digest": { "$ref": "#/$defs/digest" }
32
+ },
33
+ "additionalProperties": false,
34
+ "$defs": {
35
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
36
+ }
37
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/task-contract-v1.schema.json",
4
+ "title": "Task Contract v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "contract_id", "objective", "scope", "acceptance", "permissions", "environment", "skill_set", "stop_conditions", "extensions", "contract_digest"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "contract_id": { "type": "string", "minLength": 1 },
10
+ "objective": { "type": "string", "minLength": 1 },
11
+ "scope": {
12
+ "type": "object",
13
+ "required": ["include", "exclude"],
14
+ "properties": {
15
+ "include": { "type": "array" },
16
+ "exclude": { "type": "array" }
17
+ }
18
+ },
19
+ "acceptance": {
20
+ "type": "array",
21
+ "minItems": 1,
22
+ "items": {
23
+ "type": "object",
24
+ "required": ["contract_item_id", "requirement"],
25
+ "properties": {
26
+ "contract_item_id": { "type": "string", "minLength": 1 },
27
+ "requirement": { "type": "string", "minLength": 1 }
28
+ }
29
+ }
30
+ },
31
+ "permissions": { "type": "object" },
32
+ "environment": { "type": "object" },
33
+ "skill_set": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "object",
37
+ "required": ["name", "version", "content_digest", "provider_mode"],
38
+ "properties": {
39
+ "name": { "type": "string", "minLength": 1 },
40
+ "version": { "type": "string", "minLength": 1 },
41
+ "content_digest": { "$ref": "#/$defs/digest" },
42
+ "provider_mode": { "enum": ["primary", "optional"] }
43
+ }
44
+ }
45
+ },
46
+ "stop_conditions": { "type": "array" },
47
+ "extensions": {
48
+ "type": "object",
49
+ "properties": {
50
+ "verification": {
51
+ "type": "object",
52
+ "required": ["provider"],
53
+ "properties": {
54
+ "provider": { "enum": ["none", "verify-agent-output", "run-agent-verify-loop"] }
55
+ }
56
+ },
57
+ "review_policy": {
58
+ "type": "object",
59
+ "required": ["schema_version", "max_primary_reviews_per_artifact", "max_escalation_reviews_per_artifact", "require_distinct_lens", "review_only_after_smoke_pass", "max_review_input_tokens"],
60
+ "properties": {
61
+ "schema_version": { "const": 1 },
62
+ "max_primary_reviews_per_artifact": { "type": "integer", "minimum": 0 },
63
+ "max_escalation_reviews_per_artifact": { "type": "integer", "minimum": 0 },
64
+ "require_distinct_lens": { "type": "boolean" },
65
+ "review_only_after_smoke_pass": { "type": "boolean" },
66
+ "max_review_input_tokens": { "type": "integer", "minimum": 1 }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "projection": {
71
+ "type": "object",
72
+ "required": ["parent_contract_digest", "projected_item_ids"],
73
+ "properties": {
74
+ "parent_contract_digest": { "$ref": "#/$defs/digest" },
75
+ "projected_item_ids": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
76
+ }
77
+ }
78
+ }
79
+ },
80
+ "contract_digest": { "$ref": "#/$defs/digest" }
81
+ },
82
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
83
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.example/schemas/verification-profile-v1.schema.json",
4
+ "title": "Verification Profile v1",
5
+ "type": "object",
6
+ "required": ["schema_version", "profile_id", "l0_checks", "l1_review", "protected_verifier_paths", "allowed_validation_changes", "runtime", "human_gate", "verification_profile_digest"],
7
+ "properties": {
8
+ "schema_version": { "const": 1 },
9
+ "profile_id": { "type": "string", "minLength": 1 },
10
+ "l0_checks": {
11
+ "type": "array",
12
+ "minItems": 1,
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["check_id", "argv", "cwd_rel", "stage", "timeout_ms", "expected_exit_codes"],
16
+ "properties": {
17
+ "check_id": { "type": "string", "minLength": 1 },
18
+ "argv": { "type": "array", "minItems": 1, "items": { "type": "string" } },
19
+ "cwd_rel": { "type": "string", "minLength": 1 },
20
+ "stage": { "enum": ["smoke", "final", "both"] },
21
+ "timeout_ms": { "type": "integer", "minimum": 1 },
22
+ "expected_exit_codes": { "type": "array", "minItems": 1, "items": { "type": "integer" } }
23
+ },
24
+ "additionalProperties": false
25
+ }
26
+ },
27
+ "l1_review": {
28
+ "type": "array",
29
+ "minItems": 1,
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["contract_item_id", "lenses"],
33
+ "properties": {
34
+ "contract_item_id": { "type": "string", "minLength": 1 },
35
+ "lenses": {
36
+ "type": "array",
37
+ "items": { "enum": ["functional", "scope", "verification_definition", "safety"] }
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ }
42
+ },
43
+ "protected_verifier_paths": { "type": "array", "items": { "type": "string" } },
44
+ "allowed_validation_changes": { "type": "array", "items": { "type": "string" } },
45
+ "runtime": {
46
+ "type": "object",
47
+ "required": ["env_allowlist", "executable_paths", "cache_policy", "network_policy", "max_log_bytes"],
48
+ "properties": {
49
+ "env_allowlist": { "type": "array", "items": { "type": "string" } },
50
+ "executable_paths": { "type": "object", "additionalProperties": { "type": "string" } },
51
+ "cache_policy": { "enum": ["disabled", "isolated", "trusted_identity"] },
52
+ "network_policy": { "enum": ["denied", "contract_authorized"] },
53
+ "max_log_bytes": { "type": "integer", "minimum": 1 }
54
+ }
55
+ },
56
+ "human_gate": { "enum": ["none", "release", "destructive", "external_side_effect"] },
57
+ "verification_profile_digest": { "$ref": "#/$defs/digest" }
58
+ },
59
+ "$defs": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } }
60
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/worker-capability-requirements-v1.schema.json",
4
+ "title": "Worker Capability Requirements v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "host", "worker_profile", "capability_fingerprint", "binding", "required"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 },
10
+ "host": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$" },
11
+ "worker_profile": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" },
12
+ "capability_fingerprint": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
13
+ "binding": { "type": "string", "pattern": "^(session:[A-Za-z0-9._-]{1,128}|config:sha256:[0-9a-f]{64})$" },
14
+ "required": {
15
+ "description": "节点真正需要的 worker 能力键。每一项必须以 worker. 前缀开头(例如 worker.read.cwd、worker.execute_commands);host.*、shell.* 等其他前缀一律拒绝。空数组表示 not_required,此时无需提供 Effective Worker Capability。",
16
+ "type": "array",
17
+ "uniqueItems": true,
18
+ "items": { "type": "string", "description": "worker. 前缀 + 小写点分能力名,例如 worker.read.cwd", "pattern": "^worker\\.[a-z][a-z0-9_.-]{0,63}$" }
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agent-skills.local/schemas/worktree-binding-v1.schema.json",
4
+ "title": "Worktree Binding v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema_version", "provider", "repository_id", "worktree_id", "workdir", "branch", "owner", "base_sha", "head_sha", "task_status", "worktree_state"],
8
+ "properties": {
9
+ "schema_version": { "const": 1 }, "provider": { "const": "manage-worktrees" }, "repository_id": { "type": "string" }, "worktree_id": { "type": "string" }, "workdir": { "type": "string" }, "branch": { "type": ["string", "null"] },
10
+ "owner": { "type": "object", "additionalProperties": false, "required": ["agent", "agent_id", "epoch"], "properties": { "agent": { "type": "string" }, "agent_id": { "type": "string" }, "epoch": { "type": "integer", "minimum": 1 } } },
11
+ "base_sha": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" }, "head_sha": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
12
+ "task_status": { "enum": ["active", "blocked", "ready_for_review", "integrating", "done", "abandoned"] }, "worktree_state": { "enum": ["present", "missing", "reclaim_ready", "reclaimed"] }
13
+ }
14
+ }