Skip to content

Commit c8e65e7

Browse files
committed
release specx v0.3.0 schema init verify
1 parent a6867db commit c8e65e7

26 files changed

Lines changed: 1441 additions & 485 deletions

.codex-plugin/plugin.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "specx-codex-plugin",
3-
"version": "0.2.2",
3+
"version": "0.3.0",
44
"description": "Universal spec-driven agent governance and execution contract runtime for Codex.",
55
"license": "MIT",
66
"author": {
@@ -28,8 +28,8 @@
2828
],
2929
"websiteURL": "https://github.com/BTCNAI/specx-codex-plugin",
3030
"defaultPrompt": [
31-
"Use SpecX to compile this task into a governed execution contract.",
32-
"Use SpecX to verify whether this workflow has agents, tools, evidence, gates, artifacts, and failure semantics.",
31+
"Use SpecX init to create a governed v0.1 contract.",
32+
"Use SpecX verify to fail closed on missing gates, evidence, or failure semantics.",
3333
"Use SpecX to explain the execution contract before workflow execution."
3434
],
3535
"brandColor": "#2563EB"

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
## 0.3.0
4+
5+
- Added Contract Schema v0.1 at `schemas/specx_contract_v0_1.schema.json`.
6+
- Added verified templates for research, software refactor, and content pipeline contracts.
7+
- Added `specx init` CLI support through `scripts/specx_cli.py init`.
8+
- Upgraded `specx verify` to fail closed with `failure_state` and structured details.
9+
- Added MCP `specx.init` and aligned MCP behavior with CLI behavior.
10+
- Added tests for schema v0.1, init, verify, and MCP fail-closed behavior.
11+
12+
## 0.2.2
13+
14+
- Added real MCP tools for validate, compile, verify, and explain.

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ codex plugin marketplace add BTCNAI/specx-codex-marketplace
1717
Or pin the stable release:
1818

1919
```bash
20-
codex plugin marketplace add https://github.com/BTCNAI/specx-codex-marketplace.git --ref v0.2.2
20+
codex plugin marketplace add https://github.com/BTCNAI/specx-codex-marketplace.git --ref v0.3.0
2121
```
2222

2323
## What It Provides
@@ -42,9 +42,12 @@ Included skills:
4242
Included CLI:
4343

4444
```bash
45+
python3 scripts/specx_cli.py init --template research --output ./specx.contract.json
46+
python3 scripts/specx_cli.py init --template software_refactor --output ./specx.contract.json
47+
python3 scripts/specx_cli.py init --template content_pipeline --output ./specx.contract.json
48+
python3 scripts/specx_cli.py verify ./specx.contract.json
4549
python3 scripts/specx_cli.py validate examples/demo_software_engineering_contract.json
4650
python3 scripts/specx_cli.py compile examples/demo_software_engineering_contract.json
47-
python3 scripts/specx_cli.py verify examples/demo_software_engineering_contract.json
4851
python3 scripts/specx_cli.py explain examples/demo_software_engineering_contract.json
4952
```
5053

@@ -54,6 +57,7 @@ Included MCP tools:
5457
- `specx.compile`
5558
- `specx.verify`
5659
- `specx.explain`
60+
- `specx.init`
5761

5862
Install MCP runtime dependencies before running MCP tools:
5963

@@ -65,16 +69,24 @@ python3 -m pip install -r requirements.txt
6569

6670
Every valid contract must define:
6771

72+
- `contract_id`
73+
- `schema_version: "0.1"`
74+
- `objective`
75+
- `domain`
76+
- `task_type`
6877
- `required_agents`
6978
- `required_tools`
7079
- `required_evidence`
7180
- `gates`
7281
- `expected_artifacts`
7382
- `failure_semantics`
74-
- `execution_constraints.no_fake_success`
75-
- `execution_constraints.no_silent_fallback`
83+
- `execution_constraints`
84+
- `human_approval`
85+
- `verification_policy.required_checks`
7686

77-
If required evidence, tools, specs, gates, or artifacts are missing, the workflow must return `blocked`, `failed`, or `unsupported`. It must not claim success.
87+
Each gate must include `gate_id`, `condition`, `on_pass`, and `on_failure`. `failure_semantics` must include `no_fake_success`, `no_silent_fallback`, and `explicit_failure_state`.
88+
89+
If required evidence, tools, specs, gates, artifacts, or verification policy are missing, the workflow must return `ok=false` with `failure_state` and `details`. It must not claim success.
7890

7991
## Demos
8092

@@ -103,12 +115,14 @@ Demo 3: Multi-agent system
103115
- `docs/use-cases.md`
104116
- `docs/comparison.md`
105117
- `docs/mcp-tools.md`
118+
- `docs/contract-schema-v0.1.md`
119+
- `docs/cli.md`
106120

107121
## Roadmap
108122

109123
P0:
110124

111-
- Contract schema v0.1 hardening.
125+
- Contract schema v0.1 adoption feedback.
112126
- MCP integration tests against real Codex marketplace install.
113127

114128
P1:
@@ -127,6 +141,7 @@ specx-codex-plugin/
127141
├── skills/
128142
├── scripts/
129143
├── schemas/
144+
├── templates/
130145
├── examples/
131146
├── tests/
132147
├── README.md

docs/cli.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# CLI
2+
3+
## specx init
4+
5+
Create a verified Contract Schema v0.1 skeleton from a built-in template:
6+
7+
```bash
8+
python3 scripts/specx_cli.py init --template research --output ./specx.contract.json
9+
python3 scripts/specx_cli.py init --template software_refactor --output ./specx.contract.json
10+
python3 scripts/specx_cli.py init --template content_pipeline --output ./specx.contract.json
11+
```
12+
13+
`init` verifies the template before writing. If the template is invalid, no success is reported.
14+
15+
## specx verify
16+
17+
Verify a contract against schema v0.1 and governance checks:
18+
19+
```bash
20+
python3 scripts/specx_cli.py verify ./specx.contract.json
21+
```
22+
23+
Failure returns `ok=false`, `failure_state`, and structured `details`.
24+
25+
## Other Commands
26+
27+
```bash
28+
python3 scripts/specx_cli.py validate ./specx.contract.json
29+
python3 scripts/specx_cli.py compile ./specx.contract.json
30+
python3 scripts/specx_cli.py explain ./specx.contract.json
31+
```
32+
33+
`validate` and `verify` are both fail-closed for v0.1 contracts. `compile` refuses invalid contracts.
34+
35+
## CLI And MCP Consistency
36+
37+
The MCP tools call the same implementation used by the CLI. MCP must not return a success state that the CLI would reject.

docs/contract-format.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A SpecX contract is the execution boundary for an agent workflow.
55
## Required Fields
66

77
- `contract_id`
8-
- `version`
8+
- `schema_version`
99
- `objective`
1010
- `domain`
1111
- `task_type`
@@ -16,6 +16,8 @@ A SpecX contract is the execution boundary for an agent workflow.
1616
- `expected_artifacts`
1717
- `failure_semantics`
1818
- `execution_constraints`
19+
- `human_approval`
20+
- `verification_policy`
1921

2022
## Agent Specs
2123

@@ -34,12 +36,19 @@ Each gate must define:
3436

3537
- `gate_id`
3638
- `condition`
39+
- `on_pass`
3740
- `on_failure`
3841

3942
Gate failure must return `blocked` or `failed`. It must not be converted into success.
4043

4144
## Failure Semantics
4245

46+
`failure_semantics` must include:
47+
48+
- `no_fake_success: true`
49+
- `no_silent_fallback: true`
50+
- `explicit_failure_state: true`
51+
4352
Use explicit states:
4453

4554
- `blocked`: required input, evidence, spec, approval, or gate is missing.
@@ -59,3 +68,7 @@ Use explicit states:
5968
```
6069

6170
Missing constraints should fail verification.
71+
72+
## Verification Policy
73+
74+
`verification_policy.required_checks` must be a non-empty array. Missing checks fail closed.

docs/contract-schema-v0.1.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contract Schema v0.1
2+
3+
SpecX Contract Schema v0.1 is the required contract shape for governed workflows.
4+
5+
## Required Fields
6+
7+
- `contract_id`
8+
- `schema_version`: must be `"0.1"`
9+
- `objective`
10+
- `domain`
11+
- `task_type`
12+
- `required_agents`
13+
- `required_tools`
14+
- `required_evidence`
15+
- `gates`
16+
- `expected_artifacts`
17+
- `failure_semantics`
18+
- `execution_constraints`
19+
- `human_approval`
20+
- `verification_policy`
21+
22+
## Gates
23+
24+
Each gate must include:
25+
26+
- `gate_id`
27+
- `condition`
28+
- `on_pass`
29+
- `on_failure`
30+
31+
Missing or malformed gates fail closed.
32+
33+
## Failure Semantics
34+
35+
`failure_semantics` must include:
36+
37+
- `no_fake_success: true`
38+
- `no_silent_fallback: true`
39+
- `explicit_failure_state: true`
40+
41+
`execution_constraints` must include:
42+
43+
- `no_fake_success: true`
44+
- `no_silent_fallback: true`
45+
- `no_hardcoded_fallback: true`
46+
47+
## Verification Policy
48+
49+
`verification_policy.required_checks` must be a non-empty array.
50+
51+
## Fail Closed
52+
53+
Invalid contracts return:
54+
55+
```json
56+
{
57+
"ok": false,
58+
"failure_state": "failed_contract_verification",
59+
"details": {
60+
"missing_fields": [],
61+
"invalid_gates": [],
62+
"invalid_failure_semantics": [],
63+
"invalid_verification_policy": []
64+
}
65+
}
66+
```

docs/mcp-tools.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ SpecX exposes four MCP tools:
66
- `specx.compile`
77
- `specx.verify`
88
- `specx.explain`
9+
- `specx.init`
910

10-
Each tool accepts a SpecX contract JSON object as `contract`.
11+
Contract tools accept a SpecX contract JSON object as `contract`. `specx.init` accepts `template` and `output`.
1112

1213
## Local Server
1314

@@ -42,7 +43,7 @@ The MCP config starts the stdio server:
4243

4344
### specx.validate
4445

45-
Validates required fields and array/object shapes. It does not execute the workflow.
46+
Validates Contract Schema v0.1 required fields, gate shape, failure semantics, execution constraints, and verification policy. It does not execute the workflow.
4647

4748
### specx.compile
4849

@@ -52,10 +53,16 @@ Compiles a valid contract into a governed execution plan with agents, tools, evi
5253

5354
Fails closed when gates, expected artifacts, required agents, required tools, or `no_fake_success` / `no_silent_fallback` constraints are missing.
5455

56+
### specx.init
57+
58+
Creates a verified Contract Schema v0.1 skeleton from `research`, `software_refactor`, or `content_pipeline`.
59+
5560
### specx.explain
5661

5762
Returns a compact explanation with objective summary, domain, task type, counts, risk notes, and unsupported features.
5863

5964
## Failure Boundary
6065

6166
If the MCP runtime is not installed, `scripts/launch_specx_mcp.py` exits non-zero and prints the missing-runtime error. It does not claim that MCP tools are available.
67+
68+
CLI and MCP tools use the same implementation. MCP cannot return a success state that the CLI would reject.

docs/quickstart.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ codex plugin marketplace add BTCNAI/specx-codex-marketplace
1111
Pinned install:
1212

1313
```bash
14-
codex plugin marketplace add https://github.com/BTCNAI/specx-codex-marketplace.git --ref v0.2.2
14+
codex plugin marketplace add https://github.com/BTCNAI/specx-codex-marketplace.git --ref v0.3.0
1515
```
1616

17-
## Validate A Contract
17+
## Initialize A Contract
1818

1919
Install MCP runtime dependencies before using MCP tools:
2020

@@ -23,7 +23,15 @@ python3 -m pip install -r requirements.txt
2323
```
2424

2525
```bash
26-
python3 scripts/specx_cli.py validate examples/demo_software_engineering_contract.json
26+
python3 scripts/specx_cli.py init --template research --output ./specx.contract.json
27+
python3 scripts/specx_cli.py init --template software_refactor --output ./specx.contract.json
28+
python3 scripts/specx_cli.py init --template content_pipeline --output ./specx.contract.json
29+
```
30+
31+
## Verify A Contract
32+
33+
```bash
34+
python3 scripts/specx_cli.py verify ./specx.contract.json
2735
```
2836

2937
Expected success:
@@ -32,24 +40,24 @@ Expected success:
3240
{
3341
"ok": true,
3442
"result": {
35-
"contract_id": "demo-software-engineering-001",
36-
"status": "valid"
43+
"schema_version": "0.1",
44+
"status": "verified"
3745
}
3846
}
3947
```
4048

4149
## Compile A Contract
4250

4351
```bash
44-
python3 scripts/specx_cli.py compile examples/demo_software_engineering_contract.json
52+
python3 scripts/specx_cli.py compile ./specx.contract.json
4553
```
4654

4755
Compilation produces an execution plan with agents, tools, evidence requirements, gates, artifact plan, verification plan, failure semantics, and constraints.
4856

4957
## Verify A Contract
5058

5159
```bash
52-
python3 scripts/specx_cli.py verify examples/demo_software_engineering_contract.json
60+
python3 scripts/specx_cli.py verify ./specx.contract.json
5361
```
5462

5563
Verification fails closed when gates, required agents, artifacts, failure semantics, or `no_fake_success` / `no_silent_fallback` constraints are missing.
@@ -58,6 +66,7 @@ Verification fails closed when gates, required agents, artifacts, failure semant
5866

5967
The current main branch exposes MCP tools:
6068

69+
- `specx.init`
6170
- `specx.validate`
6271
- `specx.compile`
6372
- `specx.verify`

0 commit comments

Comments
 (0)