Skip to content

Commit 5a8ddb1

Browse files
authored
Merge branch 'main' into add-agents-md
2 parents 31a3c9f + 7730ffc commit 5a8ddb1

16 files changed

Lines changed: 797 additions & 129 deletions

.github/workflows/ci.yml

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,93 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
12+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1313

1414
- name: Set up Python
15-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
15+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
1616
with:
1717
python-version: "3.11"
1818

1919
- name: Run Python validator tests
2020
run: cd validators && python -m unittest test_shadow_score -v
2121

22+
- name: Run conformance suite (Python validator)
23+
run: python3 tests/conformance/run_conformance.py -v
24+
2225
- name: Validate JSON schema syntax
2326
run: python -c "import json; json.load(open('validators/shadow-report-schema.json'))"
2427

28+
- name: Validate schema is a well-formed Draft-07 schema
29+
run: |
30+
pip install --quiet jsonschema
31+
python -c "
32+
import json
33+
from jsonschema import Draft7Validator
34+
Draft7Validator.check_schema(json.load(open('validators/shadow-report-schema.json')))
35+
print('schema ok')
36+
"
37+
38+
- name: Run schema conformance tests
39+
run: python3 validators/test_schema.py
40+
41+
- name: Check spec version is consistent across spec and validators
42+
run: |
43+
python3 - <<'EOF'
44+
import re, sys, pathlib
45+
spec = pathlib.Path('SPEC.md').read_text()
46+
m = re.search(r'\*\*Version:\*\*\s*([0-9]+\.[0-9]+\.[0-9]+)', spec)
47+
if not m:
48+
sys.exit('could not find version header in SPEC.md')
49+
want = m.group(1)
50+
checks = {
51+
'validators/shadow-score.py': r'SPEC_VERSION = "([^"]+)"',
52+
'validators/shadow-score.sh': r'SPEC_VERSION="([^"]+)"',
53+
'validators/shadow-score.go': r'const specVersion = "([^"]+)"',
54+
}
55+
bad = False
56+
for path, pat in checks.items():
57+
got = re.search(pat, pathlib.Path(path).read_text())
58+
got = got.group(1) if got else None
59+
flag = 'ok ' if got == want else 'FAIL'
60+
if got != want:
61+
bad = True
62+
print(f' {flag} {path}: {got} (spec: {want})')
63+
sys.exit(1 if bad else 0)
64+
EOF
65+
66+
- name: Check for stale gap-score naming
67+
run: |
68+
if grep -rn "gap_score\|gap-score\|Gap Report\|Gap Score" \
69+
--include="*.md" --include="*.py" --include="*.json" \
70+
--include="*.go" --include="*.sh" --include="*.yml" . \
71+
| grep -v "minor-gaps\|critical-gaps" \
72+
| grep -v "renamed to" \
73+
| grep -v "^\./\.github/workflows/ci\.yml:" ; then
74+
echo "::error::Stale gap-score naming found (renamed to shadow-score in v2.0.0)"
75+
exit 1
76+
fi
77+
echo "no stale naming"
78+
79+
- name: Check all referenced repo files exist
80+
run: |
81+
python3 - <<'EOF'
82+
import re, pathlib, sys
83+
bad = False
84+
for md in pathlib.Path('.').rglob('*.md'):
85+
if '.git' in md.parts:
86+
continue
87+
for link in re.findall(r'\]\(([^)#][^)]*)\)', md.read_text()):
88+
link = link.split('#')[0].strip()
89+
if not link or link.startswith(('http://', 'https://', 'mailto:')):
90+
continue
91+
target = (md.parent / link).resolve()
92+
if not target.exists():
93+
print(f' FAIL {md}: broken link -> {link}')
94+
bad = True
95+
print('link check done')
96+
sys.exit(1 if bad else 0)
97+
EOF
98+
2599
- name: Validate example JSON files
26100
run: |
27101
python -c "
@@ -38,7 +112,7 @@ jobs:
38112
"
39113
40114
- name: Set up Go
41-
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
115+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
42116
with:
43117
go-version: "1.21"
44118

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
language: [python, go]
1919
steps:
20-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21-
- uses: github/codeql-action/init@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3
20+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21+
- uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
2222
with:
2323
languages: ${{ matrix.language }}
24-
- uses: github/codeql-action/autobuild@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3
25-
- uses: github/codeql-action/analyze@45580472a5bb82c4681c4ac726cfdb60060c2ee1 # v3
24+
- uses: github/codeql-action/autobuild@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
25+
- uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to Gap Score Spec
1+
# Contributing to Shadow Score Spec
22

3-
Thank you for your interest in contributing to the Gap Score Specification! This is an open specification and contributions are welcome.
3+
Thank you for your interest in contributing to the Shadow Score Specification! This is an open specification and contributions are welcome.
44

55
## How to Contribute
66

@@ -19,13 +19,13 @@ Reference validators in additional languages are welcome. PRs for Go, Rust, Type
1919
Requirements for new validators:
2020
- Must conform to the current spec version
2121
- Must handle the same input format as the existing validators (or document differences)
22-
- Must produce output conforming to `validators/gap-report-schema.json`
22+
- Must produce output conforming to `validators/shadow-report-schema.json`
2323
- Must include unit tests
2424
- Must pass against all examples in `examples/`
2525

2626
### Adopter Listings
2727

28-
If you're using Gap Score in your project, add it to the Adopters table in `README.md`:
28+
If you're using Shadow Score in your project, add it to the Adopters table in `README.md`:
2929

3030
1. Fork the repository
3131
2. Add your project to the table with conformance level and description
@@ -41,14 +41,14 @@ Found an inconsistency, typo, or bug in a validator? Open an issue with:
4141
## Development Setup
4242

4343
```bash
44-
git clone https://github.com/DUBSOpenHub/gap-score-spec.git
45-
cd gap-score-spec
44+
git clone https://github.com/DUBSOpenHub/shadow-score-spec.git
45+
cd shadow-score-spec
4646

4747
# Run the validator unit tests
48-
python -m pytest validators/test_gap_score.py -v
48+
python -m pytest validators/test_shadow_score.py -v
4949

5050
# Run a validator against an example
51-
python validators/gap-score.py \
51+
python validators/shadow-score.py \
5252
--sealed examples/02-minor-gaps/sealed-results.json \
5353
--open examples/02-minor-gaps/open-results.json \
5454
--format summary

README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# 📊 Shadow Score Spec
22

3-
[![Spec Version](https://img.shields.io/badge/spec-v1.0.0-blue.svg)](SPEC.md)
3+
[![Spec Version](https://img.shields.io/badge/spec-v2.0.0-blue.svg)](SPEC.md)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5-
[![Conformance Levels](https://img.shields.io/badge/conformance-L1%20%7C%20L2%20%7C%20L3-green.svg)](SPEC.md#6-conformance-levels)
5+
[![Conformance Levels](https://img.shields.io/badge/conformance-L1%20%7C%20L2%20%7C%20L3%20%7C%20L4-green.svg)](SPEC.md#6-conformance-levels)
66

77
**A framework-agnostic metric for measuring AI code generation quality.**
88

@@ -56,11 +56,11 @@ cd validators && go build -o shadow-score-go . && cd ..
5656

5757
### Option B: Compute it yourself
5858

59-
1. **Write sealed tests** from your spec (requirements → test cases, before code exists)
59+
1. **Write sealed tests** from your spec (requirements → test cases, before code exists) — using a *different model family* than the one that will implement
6060
2. **Build the code** — the implementer never sees the sealed tests
61-
3. **Run both suites**sealed tests and the implementer's own tests
61+
3. **Run both suites**in a disposable workspace built from the implementer's commit
6262
4. **Compute**: `failed_sealed / total_sealed × 100`
63-
5. **Report**: Use the [JSON schema](validators/shadow-report-schema.json) or markdown format
63+
5. **Report**: Use the [JSON schema](validators/shadow-report-schema.json) or markdown format, including which families authored each side
6464

6565
That's it. Framework, language, and tooling don't matter — Shadow Score works anywhere.
6666

@@ -71,12 +71,16 @@ Shadow Score is computed using the **Sealed-Envelope Protocol** — a 4-phase te
7171
```
7272
SPEC ──► SEAL GENERATION ──► IMPLEMENTATION ──► VALIDATION ──► HARDENING
7373
(tests from spec, (code + own (run both (fix from
74-
hidden from tests, never suites, failure msgs
75-
implementer) sees sealed) compute gap) only — no
76-
test code)
74+
hidden from tests, never suites in a failure msgs
75+
implementer, sees sealed) disposable only — no
76+
different model workspace) test code)
77+
family)
7778
```
7879

79-
**The critical rule:** The implementer **never sees** the sealed tests. During hardening, they receive only failure messages (test name, expected, actual) — never the test source code. This forces root-cause fixes, not test-targeting hacks.
80+
**The two critical rules:**
81+
82+
1. **Isolation** — the implementer **never sees** the sealed tests. During hardening it receives only failure messages (test name, expected, actual), never test source. This forces root-cause fixes, not test-targeting hacks.
83+
2. **Independence** — the sealed tests are written by a **different model family** than the implementation. Isolation stops the builder seeing the tests; it does not stop it thinking like their author. Same-family agents share blind spots, so the scenario nobody tested is the scenario nobody handled.
8084

8185
Full protocol details: [**SPEC.md §4**](SPEC.md#4-sealed-envelope-protocol)
8286

@@ -87,10 +91,13 @@ Full protocol details: [**SPEC.md §4**](SPEC.md#4-sealed-envelope-protocol)
8791
| **L1** — Shadow Score | Compute + report Shadow Score | Retrofitting onto existing test suites |
8892
| **L2** — Sealed Envelope | L1 + test isolation + tamper hash | AI agent pipelines |
8993
| **L3** — Full Protocol | L2 + hardening loop + velocity tracking | Production autonomous builds |
94+
| **L4** — Adversarial Independence | L3 + cross-family authorship + disposable verify workspace + provenance in report | Published or gate-blocking scores |
95+
96+
**Why L4 exists:** L1–L3 harden *information* isolation — they stop the builder from **seeing** the tests. They are all silently defeated by one configuration choice: pointing the seal author and the implementer at the same model. Same-family agents share blind spots, so the untested defect is also the unhandled defect. The sealed test is never written, the score reads 0%, and the bug ships green. That bias is directional — it always overclaims quality. See [**SPEC.md §3.6**](SPEC.md#36-authorship-independence).
9097

9198
## Reference Implementations
9299

93-
The reference Level 3 implementation is **[Dark Factory](https://github.com/DUBSOpenHub/dark-factory)** — an autonomous agentic build system for the GitHub Copilot CLI with sealed-envelope testing.
100+
The reference Level 4 implementation is **[Dark Factory](https://github.com/DUBSOpenHub/dark-factory)** — an autonomous agentic build system for the GitHub Copilot CLI with sealed-envelope testing, cross-family model independence enforced pre-dispatch, and seal plurality.
94101

95102
The reference Level 2 implementation is **[Terminal Stampede](https://github.com/DUBSOpenHub/terminal-stampede)** — a parallel agent runtime that shadow-scores each agent's work during merge using sealed tests with tamper-hash verification.
96103

@@ -110,10 +117,15 @@ Shadow Reports can be produced in JSON (machine-readable) or Markdown (human-rea
110117

111118
```json
112119
{
113-
"shadow_score_spec_version": "1.0.0",
120+
"shadow_score_spec_version": "2.0.0",
114121
"report": {
115122
"shadow_score": 11.1,
116-
"level": "minor"
123+
"level": "minor",
124+
"conformance_level": 4,
125+
"independence": "strong",
126+
"implementer_family": "anthropic",
127+
"seal_author_families": ["openai", "google"],
128+
"workspace_isolation": "strict"
117129
},
118130
"sealed_tests": { "total": 18, "passed": 16, "failed": 2 },
119131
"failures": [
@@ -128,13 +140,15 @@ Shadow Reports can be produced in JSON (machine-readable) or Markdown (human-rea
128140
}
129141
```
130142

143+
A Shadow Score without provenance cannot be interpreted: 0% under `strong` independence and 0% under `weak` independence are different claims about the world, and only one of them is evidence.
144+
131145
Full schema: [**SPEC.md §5**](SPEC.md#5-reporting-format)
132146

133147
## Adopters
134148

135149
| Project | Conformance | Description |
136150
|---------|-------------|-------------|
137-
| [Dark Factory](https://github.com/DUBSOpenHub/dark-factory) | Level 3 | Reference implementation — autonomous agentic build system |
151+
| [Dark Factory](https://github.com/DUBSOpenHub/dark-factory) | Level 4 | Reference implementation — autonomous agentic build system with cross-family adversarial independence |
138152
| [Terminal Stampede](https://github.com/DUBSOpenHub/terminal-stampede) | Level 2 | Parallel agent runtime — shadow-scores each agent's work during merge via sealed tests |
139153

140154
*Using Shadow Score? [Open a PR](https://github.com/DUBSOpenHub/shadow-score-spec/pulls) to add your project.*

SECURITY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Reporting a Vulnerability
44

5-
If you discover a security vulnerability in the Gap Score reference validators or specification, please report it responsibly.
5+
If you discover a security vulnerability in the Shadow Score reference validators or specification, please report it responsibly.
66

77
### How to Report
88

@@ -23,9 +23,9 @@ If you discover a security vulnerability in the Gap Score reference validators o
2323
### Scope
2424

2525
This security policy covers:
26-
- **Reference validators** (`validators/gap-score.py`, `validators/gap-score.sh`) — e.g., input injection, path traversal
27-
- **JSON Schema** (`validators/gap-report-schema.json`) — e.g., schema bypass enabling malicious payloads
28-
- **Specification** (`SPEC.md`) — e.g., protocol weaknesses that could allow gaming the Gap Score
26+
- **Reference validators** (`validators/shadow-score.py`, `validators/shadow-score.sh`) — e.g., input injection, path traversal
27+
- **JSON Schema** (`validators/shadow-report-schema.json`) — e.g., schema bypass enabling malicious payloads
28+
- **Specification** (`SPEC.md`) — e.g., protocol weaknesses that could allow gaming the Shadow Score
2929

3030
### Out of Scope
3131

0 commit comments

Comments
 (0)