rungate 0.2.0 → 0.2.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.
- package/package.json +14 -3
- package/.claude/agents/aditi.md +0 -47
- package/.claude/agents/marcus.md +0 -50
- package/.claude/agents/quinn.md +0 -58
- package/.claude/agents/rook.md +0 -47
- package/.claude/agents/serena.md +0 -46
- package/.claude/rungate.json +0 -11
- package/.fallowrc.json +0 -28
- package/.github/copilot-instructions.md +0 -20
- package/.rungate/conformity-findings.json +0 -648
- package/AGENTS.md +0 -106
- package/CODE-MAP.md +0 -50
- package/HARNESS.md +0 -88
- package/bun.lock +0 -26
- package/bunfig.toml +0 -2
- package/config/brief-policies.json +0 -28
- package/config/ceremony-profiles.json +0 -212
- package/config/consumer-cascade-map.json +0 -24
- package/config/doc-cascade-map.json +0 -24
- package/config/eval.json +0 -84
- package/config/profiles/account-plan.yaml +0 -36
- package/config/profiles/campaign.yaml +0 -94
- package/config/prove-evidence.schema.json +0 -65
- package/config/spec-policies.json +0 -36
- package/config/workflow-schema.json +0 -281
- package/gates/SCHEMA-GUIDE.md +0 -121
- package/gates/ac-quality.test.ts +0 -106
- package/gates/adversarial.test.ts +0 -274
- package/gates/brief-assembler.test.ts +0 -429
- package/gates/brief-assembler.ts +0 -334
- package/gates/bunfig.toml +0 -2
- package/gates/chain.test.ts +0 -91
- package/gates/e2e-smoke.test.ts +0 -234
- package/gates/error-classifier.test.ts +0 -249
- package/gates/error-classifier.ts +0 -89
- package/gates/orchestrator.test.ts +0 -950
- package/gates/orchestrator.ts +0 -569
- package/gates/preload.ts +0 -77
- package/gates/prompts/ac-adversary.md +0 -20
- package/gates/prompts/evidence-validator.md +0 -22
- package/gates/prompts/prove-reproducer.md +0 -53
- package/gates/prove.test.ts +0 -164
- package/gates/run-gate.ts +0 -936
- package/gates/schema-parity.test.ts +0 -197
- package/gates/schema.ts +0 -362
- package/gates/self-heal.test.ts +0 -511
- package/gates/self-heal.ts +0 -121
- package/gates/ship-orchestrator.test.ts +0 -379
- package/gates/ship-orchestrator.ts +0 -363
- package/gates/test-fixtures/broken-no-environments.json +0 -60
- package/gates/test-fixtures/valid-standard.json +0 -54
- package/gates/test-utils.ts +0 -43
- package/gates/witness.ts +0 -220
- package/gates/workflow.test.ts +0 -1053
- package/hooks/AgentBriefGuard.hook.ts +0 -586
- package/hooks/AgentVerdictCapture.hook.ts +0 -134
- package/hooks/AutoVerifyGate.hook.ts +0 -76
- package/hooks/GateEnforcement.hook.ts +0 -273
- package/hooks/IssueCloseGuard.hook.ts +0 -116
- package/hooks/MergeGuard.hook.ts +0 -55
- package/hooks/StaleTTLCleanup.hook.ts +0 -133
- package/hooks/VerifyPhaseLock.hook.ts +0 -81
- package/hooks/WorkflowStateGuard.hook.ts +0 -37
- package/hooks/lib/agentDetection.ts +0 -70
- package/hooks/lib/findWorkflow.ts +0 -101
- package/hooks/lib/parseStdin.ts +0 -37
- package/hooks/lib/paths.ts +0 -111
- package/hooks/lib/utils.ts +0 -81
- package/reference/migration-manifest.json +0 -554
- package/reference/prompts/agent-aditi.md +0 -38
- package/reference/prompts/agent-marcus.md +0 -38
- package/reference/prompts/agent-quinn.md +0 -38
- package/reference/prompts/agent-rook.md +0 -37
- package/reference/prompts/agent-serena.md +0 -37
- package/reference/prompts/council-skill.md +0 -170
- package/reference/prompts/goal-skill.md +0 -235
- package/reference/prompts/prove-skill.md +0 -283
- package/reference/prompts/quinn-standard.md +0 -246
- package/reference/prompts/ship-convergence.md +0 -65
- package/reference/prompts/ship-escalation.md +0 -43
- package/reference/prompts/ship-iteration.md +0 -382
- package/reference/prompts/ship-pending-patches.md +0 -246
- package/reference/prompts/ship-reference.md +0 -250
- package/reference/prompts/ship-skill.md +0 -347
- package/reference/prompts/ship-templates.md +0 -215
- package/reference/scripts/batch-status.sh +0 -68
- package/reference/scripts/chain-compat-check.sh +0 -67
- package/reference/scripts/context-audit.sh +0 -314
- package/reference/scripts/dead-export-check.sh +0 -61
- package/reference/scripts/generate-qc-tables.sh +0 -92
- package/reference/scripts/harness-init.sh +0 -111
- package/reference/scripts/pai-054-baseline-check.sh +0 -40
- package/reference/scripts/prove-smoke-test.sh +0 -112
- package/reference/scripts/setup-keychain-salt.sh +0 -12
- package/reference/scripts/skill-optimizer-friday.sh +0 -88
- package/reference/scripts/skill-qc-test.sh +0 -351
- package/reference/scripts/skill-synthesize-tonight.sh +0 -66
- package/reference/specs/HARNESS-EXTRACTION-SPEC.md +0 -263
- package/reference/specs/harness-v3-bash-deletion-plan.md +0 -65
- package/reference/specs/harness-v3-migration-plan.md +0 -188
- package/scripts/decision-reconcile.sh +0 -74
- package/scripts/decision-reconcile.ts +0 -152
- package/scripts/git-hooks/pre-commit +0 -76
- package/scripts/git-hooks/pre-push +0 -271
- package/scripts/harness-skill-check.sh +0 -52
- package/scripts/lib/gap-emit.sh +0 -65
- package/scripts/lib/jq-update.sh +0 -30
- package/scripts/lib/resolve-slug.sh +0 -30
- package/scripts/lib/verify-spec-compliance.sh +0 -102
- package/scripts/prove-backfill.sh +0 -87
- package/scripts/scaffold-rungate-config.ts +0 -91
- package/scripts/self-containment-check.sh +0 -109
- package/scripts/skill-qc-validator.sh +0 -402
- package/scripts/slug-resolver.sh +0 -14
- package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +0 -2493
- package/specs/BOOTSTRAP-TEST-PLAN.md +0 -571
- package/specs/HARNESS-GATES.md +0 -256
- package/specs/HARNESS-SKILL-CHAIN.md +0 -286
- package/specs/HARNESS-SKILL-CONTRACT.md +0 -93
- package/specs/HARNESS-STANDARD.md +0 -488
- package/specs/SPEC-TEMPLATE.md +0 -53
- package/specs/bootstrap-data-flow.png +0 -0
- package/specs/harness-automation-matrix.md +0 -314
- package/specs/harness-automation-matrix.rules.json +0 -64
- package/test/anti.test.ts +0 -80
- package/test/contract-negative.test.ts +0 -86
- package/test/contract.test.ts +0 -158
- package/test/external-deps.test.ts +0 -48
- package/test/fixtures/golden-project/.env.example +0 -3
- package/test/fixtures/golden-project/Makefile +0 -7
- package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +0 -23
- package/test/fixtures/golden-project/docs/setup-guide.md +0 -10
- package/test/fixtures/golden-project/package.json +0 -10
- package/test/fixtures/golden-project/specs/api-spec.md +0 -20
- package/test/fixtures/golden-project/src/auth.ts +0 -8
- package/test/fixtures/golden-project/src/db.ts +0 -11
- package/test/fixtures/golden-project/src/index.ts +0 -19
- package/test/fixtures/golden-project/src/utils/format.ts +0 -3
- package/test/fixtures/golden-project/test/auth.test.ts +0 -15
- package/test/fixtures/golden-project/tsconfig.json +0 -12
- package/test/meta-sc-coverage.test.ts +0 -159
- package/test/phase-0.test.ts +0 -846
- package/test/phase-1.test.ts +0 -617
- package/test/phase-2.test.ts +0 -620
- package/test/phase-3.test.ts +0 -99
- package/test/scaffold-conformity.test.ts +0 -8
- package/test/schema-canary.test.ts +0 -51
- package/test/spec-compliance-auto.test.ts +0 -64
- package/test/spec-compliance.test.ts +0 -295
- package/test/spec-discovery.test.ts +0 -68
- package/test/spec-drift.test.ts +0 -5
- package/test/structure.test.ts +0 -165
- package/test/unit/agent-brief-guard-ship.test.ts +0 -293
- package/test/unit/extract-constraints.test.ts +0 -145
- package/test/unit/issue-close-guard.test.ts +0 -204
- package/test/unit/scaffold-project.test.ts +0 -417
- package/test/unit/skill-cooccurrence.test.ts +0 -177
- package/test/unit/skill-sequence-logger.test.ts +0 -244
- package/test/unit/workflow-state-guard.test.ts +0 -95
- package/workflows/batch-ship.js +0 -295
- package/workflows/council.js +0 -481
- package/workflows/prove.js +0 -560
- package/workflows/ship.js +0 -789
- package/workflows/verify.js +0 -236
package/workflows/prove.js
DELETED
|
@@ -1,560 +0,0 @@
|
|
|
1
|
-
export const meta = {
|
|
2
|
-
name: 'prove',
|
|
3
|
-
description: 'Standalone verification: prove a fix solves the user problem. GOAL → VERIFY-DEPLOYED → VALIDATE → VERDICT → OUTPUT',
|
|
4
|
-
whenToUse: 'After /ship to prove the fix works. Standalone on any issue. Replaces reading prove SKILL.md manually.',
|
|
5
|
-
phases: [
|
|
6
|
-
{ title: 'Goal', detail: 'Read issue, extract what was fixed, load chain context' },
|
|
7
|
-
{ title: 'Verify-Deployed', detail: 'Confirm fix commit is on main' },
|
|
8
|
-
{ title: 'Validate', detail: 'Spawn B3 reproducer + optional Quinn for UI' },
|
|
9
|
-
{ title: 'Verdict', detail: 'Mechanical verdict from criteriaResults' },
|
|
10
|
-
{ title: 'Output', detail: 'Write prove-evidence.json, post proof comment, add label, telemetry' },
|
|
11
|
-
],
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// ── Structured output schemas ────────────────────────────────
|
|
15
|
-
|
|
16
|
-
const PROVE_EVIDENCE_SCHEMA = {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
issueNumber: { type: 'number' },
|
|
20
|
-
verdict: { type: 'string', enum: ['PROVEN', 'UNPROVEN', 'INCONCLUSIVE'] },
|
|
21
|
-
commitSHA: { type: 'string' },
|
|
22
|
-
capturedAt: { type: 'string' },
|
|
23
|
-
criteriaResults: {
|
|
24
|
-
type: 'array',
|
|
25
|
-
items: {
|
|
26
|
-
type: 'object',
|
|
27
|
-
properties: {
|
|
28
|
-
scId: { type: 'string' },
|
|
29
|
-
verdict: { type: 'string', enum: ['PASS', 'FAIL', 'SKIP'] },
|
|
30
|
-
evidence: { type: 'string' },
|
|
31
|
-
},
|
|
32
|
-
required: ['scId', 'verdict'],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
reproduced: { type: 'boolean' },
|
|
36
|
-
},
|
|
37
|
-
required: ['issueNumber', 'verdict', 'commitSHA', 'criteriaResults'],
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const ISSUE_SCHEMA = {
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties: {
|
|
43
|
-
issueGoal: { type: 'string' },
|
|
44
|
-
issueTitle: { type: 'string' },
|
|
45
|
-
issueBody: { type: 'string' },
|
|
46
|
-
labels: { type: 'array', items: { type: 'string' } },
|
|
47
|
-
successCriteria: { type: 'array', items: { type: 'string' } },
|
|
48
|
-
hasUIACs: { type: 'boolean' },
|
|
49
|
-
},
|
|
50
|
-
required: ['issueGoal', 'issueTitle', 'issueBody'],
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const DEPLOY_CHECK_SCHEMA = {
|
|
54
|
-
type: 'object',
|
|
55
|
-
properties: {
|
|
56
|
-
deployed: { type: 'boolean' },
|
|
57
|
-
commitSHA: { type: 'string' },
|
|
58
|
-
branch: { type: 'string' },
|
|
59
|
-
reason: { type: 'string' },
|
|
60
|
-
},
|
|
61
|
-
required: ['deployed', 'commitSHA'],
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const REPRODUCER_SCHEMA = {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: {
|
|
67
|
-
verdict: { type: 'string', enum: ['PROVEN', 'UNPROVEN', 'INCONCLUSIVE'] },
|
|
68
|
-
criteriaResults: {
|
|
69
|
-
type: 'array',
|
|
70
|
-
items: {
|
|
71
|
-
type: 'object',
|
|
72
|
-
properties: {
|
|
73
|
-
scId: { type: 'string' },
|
|
74
|
-
verdict: { type: 'string', enum: ['PASS', 'FAIL', 'SKIP'] },
|
|
75
|
-
evidence: { type: 'string' },
|
|
76
|
-
},
|
|
77
|
-
required: ['scId', 'verdict'],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
reproduced: { type: 'boolean' },
|
|
81
|
-
gaps: { type: 'array', items: { type: 'string' } },
|
|
82
|
-
quinnNeeded: { type: 'array', items: { type: 'string' } },
|
|
83
|
-
},
|
|
84
|
-
required: ['verdict', 'criteriaResults', 'reproduced'],
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const QUINN_SCHEMA = {
|
|
88
|
-
type: 'object',
|
|
89
|
-
properties: {
|
|
90
|
-
verdict: { type: 'string', enum: ['PASS', 'FAIL'] },
|
|
91
|
-
findings: { type: 'array', items: { type: 'string' } },
|
|
92
|
-
criteriaResults: {
|
|
93
|
-
type: 'array',
|
|
94
|
-
items: {
|
|
95
|
-
type: 'object',
|
|
96
|
-
properties: {
|
|
97
|
-
scId: { type: 'string' },
|
|
98
|
-
verdict: { type: 'string', enum: ['PASS', 'FAIL', 'SKIP'] },
|
|
99
|
-
evidence: { type: 'string' },
|
|
100
|
-
},
|
|
101
|
-
required: ['scId', 'verdict'],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
required: ['verdict'],
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// ── Args ─────────────────────────────────────────────────────
|
|
109
|
-
|
|
110
|
-
let parsedArgs = args || {}
|
|
111
|
-
if (typeof parsedArgs === 'string') {
|
|
112
|
-
try { parsedArgs = JSON.parse(parsedArgs) } catch { parsedArgs = {} }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (!parsedArgs.issue) {
|
|
116
|
-
return { status: 'ARGS_ERROR', message: 'Usage: Workflow({ name: "prove", args: { issue: N, projectRoot: "/path" } })' }
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const ISSUE = parsedArgs.issue
|
|
120
|
-
const REPO = parsedArgs.repo || 'hornjason/asaCommandCenter'
|
|
121
|
-
const ISSUE_REPO = parsedArgs.issueRepo || REPO
|
|
122
|
-
const PROJECT_ROOT = parsedArgs.projectRoot || ''
|
|
123
|
-
if (!parsedArgs.harnessRoot) return { status: 'ARGS_ERROR', message: 'harnessRoot is required' }
|
|
124
|
-
const HARNESS_ROOT = parsedArgs.harnessRoot
|
|
125
|
-
const HOME = parsedArgs.home || PROJECT_ROOT.split('/Projects/')[0] || process.env.HOME || ''
|
|
126
|
-
const SLUG = parsedArgs.slug || `ddb-${ISSUE}`
|
|
127
|
-
const WORK_DIR = `${process.env.RUNGATE_WORK_DIR || `${HOME}/.rungate`}/${SLUG}`
|
|
128
|
-
const PROVE_PROMPT = `${HARNESS_ROOT}/gates/prompts/prove-reproducer.md`
|
|
129
|
-
|
|
130
|
-
// ── Chain detection ──────────────────────────────────────────
|
|
131
|
-
|
|
132
|
-
const GOAL_RECORD_PATH = `${WORK_DIR}/goal-record.json`
|
|
133
|
-
const SHIP_EVIDENCE_PATH = `${WORK_DIR}/ship-evidence.json`
|
|
134
|
-
|
|
135
|
-
// ════════════════════════════════════════════════════════════
|
|
136
|
-
// PHASE 1: GOAL — Read issue, extract what was fixed
|
|
137
|
-
// ════════════════════════════════════════════════════════════
|
|
138
|
-
|
|
139
|
-
phase('Goal')
|
|
140
|
-
log(`Prove #${ISSUE}: reading issue and chain context`)
|
|
141
|
-
|
|
142
|
-
const issueData = await agent(`
|
|
143
|
-
Read this GitHub issue and extract the goal:
|
|
144
|
-
gh issue view ${ISSUE} --repo ${ISSUE_REPO} --json title,body,labels
|
|
145
|
-
|
|
146
|
-
Also check for chain artifacts:
|
|
147
|
-
1. test -f ${GOAL_RECORD_PATH} && echo "GOAL_RECORD: exists" || echo "GOAL_RECORD: none"
|
|
148
|
-
2. test -f ${SHIP_EVIDENCE_PATH} && echo "SHIP_EVIDENCE: exists" || echo "SHIP_EVIDENCE: none"
|
|
149
|
-
|
|
150
|
-
If goal-record.json exists, read it and extract the structured SCs.
|
|
151
|
-
If ship-evidence.json exists, read it and extract mergeCommitSha.
|
|
152
|
-
|
|
153
|
-
Extract:
|
|
154
|
-
1. issueGoal — main goal statement
|
|
155
|
-
2. issueTitle — the title
|
|
156
|
-
3. issueBody — full body text
|
|
157
|
-
4. labels — label names
|
|
158
|
-
5. successCriteria — each SC/AC (from goal-record.json if chain mode, else from issue body)
|
|
159
|
-
6. hasUIACs — true if any AC mentions UI, screenshot, visual, page, component, render
|
|
160
|
-
`, { label: 'read-issue', phase: 'Goal', schema: ISSUE_SCHEMA })
|
|
161
|
-
|
|
162
|
-
if (!issueData) return { status: 'GOAL_FAILED', message: `Could not read issue #${ISSUE}` }
|
|
163
|
-
log(`Goal: "${issueData.issueTitle}" — UI ACs: ${issueData.hasUIACs ? 'yes' : 'no'}`)
|
|
164
|
-
|
|
165
|
-
// ════════════════════════════════════════════════════════════
|
|
166
|
-
// PHASE 2: VERIFY-DEPLOYED — Confirm fix is on main
|
|
167
|
-
// ════════════════════════════════════════════════════════════
|
|
168
|
-
|
|
169
|
-
phase('Verify-Deployed')
|
|
170
|
-
log('Checking fix is deployed to main')
|
|
171
|
-
|
|
172
|
-
const deployCheck = await agent(`
|
|
173
|
-
Verify the fix for issue #${ISSUE} is on main:
|
|
174
|
-
|
|
175
|
-
1. Check for ship-evidence.json: test -f ${SHIP_EVIDENCE_PATH}
|
|
176
|
-
If it exists, read it and extract mergeCommitSha.
|
|
177
|
-
|
|
178
|
-
2. If mergeCommitSha exists:
|
|
179
|
-
cd ${PROJECT_ROOT || '.'} && git branch --contains <sha> | grep -q main && echo "ON_MAIN" || echo "NOT_ON_MAIN"
|
|
180
|
-
|
|
181
|
-
3. If no mergeCommitSha (standalone mode):
|
|
182
|
-
cd ${PROJECT_ROOT || '.'} && git log --oneline --all --grep="#${ISSUE}" | head -5
|
|
183
|
-
Use the latest commit SHA found.
|
|
184
|
-
Verify it's on main: git branch --contains <sha> | grep -q main
|
|
185
|
-
|
|
186
|
-
4. Get current HEAD:
|
|
187
|
-
cd ${PROJECT_ROOT || '.'} && git rev-parse HEAD
|
|
188
|
-
|
|
189
|
-
Report: deployed (boolean), commitSHA (the fix commit or HEAD), branch, reason.
|
|
190
|
-
`, { label: 'deploy-check', phase: 'Verify-Deployed', schema: DEPLOY_CHECK_SCHEMA })
|
|
191
|
-
|
|
192
|
-
if (!deployCheck || !deployCheck.deployed) {
|
|
193
|
-
log(`VERIFY-DEPLOYED FAILED: ${deployCheck?.reason || 'fix not on main'}`)
|
|
194
|
-
return {
|
|
195
|
-
status: 'DEPLOY_FAILED',
|
|
196
|
-
issue: ISSUE, slug: SLUG,
|
|
197
|
-
reason: deployCheck?.reason || 'Fix commit not found on main',
|
|
198
|
-
workDir: WORK_DIR,
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const COMMIT_SHA = deployCheck.commitSHA || 'unknown'
|
|
203
|
-
log(`Fix deployed: ${COMMIT_SHA.slice(0, 8)} on main`)
|
|
204
|
-
|
|
205
|
-
// ════════════════════════════════════════════════════════════
|
|
206
|
-
// PHASE 3: VALIDATE — Spawn B3 reproducer + optional Quinn
|
|
207
|
-
// ════════════════════════════════════════════════════════════
|
|
208
|
-
|
|
209
|
-
phase('Validate')
|
|
210
|
-
|
|
211
|
-
// Ensure dev server is running for OUTCOME AC evidence collection
|
|
212
|
-
if (PROJECT_ROOT) {
|
|
213
|
-
log('Checking dev server availability')
|
|
214
|
-
await agent(`
|
|
215
|
-
Check if the dev server is running. Read ${PROJECT_ROOT}/.claude/rungate.json to get dev.apiBase and dev.start.
|
|
216
|
-
|
|
217
|
-
1. Try: curl -sf $(dev.apiBase)/api/health -o /dev/null && echo "DEV_UP" || echo "DEV_DOWN"
|
|
218
|
-
2. If DEV_DOWN and dev.start exists:
|
|
219
|
-
- Run: cd ${PROJECT_ROOT} && $(dev.start) &
|
|
220
|
-
- Wait 10 seconds, then retry the health check
|
|
221
|
-
- Report: started (boolean), apiBase, command used
|
|
222
|
-
3. If DEV_UP: report already running
|
|
223
|
-
|
|
224
|
-
Report the dev server status.
|
|
225
|
-
`, { label: 'ensure-dev-server', phase: 'Validate' })
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
log('Spawning B3 Prove Reproducer')
|
|
229
|
-
|
|
230
|
-
// Read before-state context for the reproducer
|
|
231
|
-
const beforeContext = await agent(`
|
|
232
|
-
Check for before-state evidence:
|
|
233
|
-
1. test -f ${WORK_DIR}/workflow-state.json && echo "WF_STATE: exists" || echo "WF_STATE: none"
|
|
234
|
-
2. If workflow-state.json exists, read it and extract beforeState field.
|
|
235
|
-
3. Read the issue body for reproduction steps.
|
|
236
|
-
|
|
237
|
-
Check project harness for API/UI bases:
|
|
238
|
-
4. test -f ${PROJECT_ROOT}/.claude/rungate.json && cat ${PROJECT_ROOT}/.claude/rungate.json || echo "NO_HARNESS"
|
|
239
|
-
|
|
240
|
-
Report the before-state description, reproduction steps, apiBase, and uiBase.
|
|
241
|
-
Return as a string summary.
|
|
242
|
-
`, { label: 'before-context', phase: 'Validate' })
|
|
243
|
-
|
|
244
|
-
// Spawn B3 reproducer agent
|
|
245
|
-
const reproducerResult = await agent(`
|
|
246
|
-
You are a prove reproducer for issue #${ISSUE}.
|
|
247
|
-
Read the prove reproducer prompt at ${PROVE_PROMPT} for your full instructions.
|
|
248
|
-
|
|
249
|
-
## Issue
|
|
250
|
-
Title: ${issueData.issueTitle}
|
|
251
|
-
Body (first 2000 chars): ${(issueData.issueBody || '').slice(0, 2000)}
|
|
252
|
-
|
|
253
|
-
## Success Criteria
|
|
254
|
-
${(issueData.successCriteria || []).map((sc, i) => `${i + 1}. ${sc}`).join('\n') || 'Derive from issue body'}
|
|
255
|
-
|
|
256
|
-
## Before State
|
|
257
|
-
${beforeContext || 'No before-state captured. Derive from issue description.'}
|
|
258
|
-
|
|
259
|
-
## Fix Commit
|
|
260
|
-
${COMMIT_SHA}
|
|
261
|
-
|
|
262
|
-
## Environment
|
|
263
|
-
Project root: ${PROJECT_ROOT || 'not set'}
|
|
264
|
-
|
|
265
|
-
## Instructions
|
|
266
|
-
1. Read ${PROVE_PROMPT} for your full protocol.
|
|
267
|
-
2. For CODE ACs: run evidence commands (grep, bun test, curl) against current code.
|
|
268
|
-
3. For UI/OUTCOME ACs: output SKIP with reason "B3 limitation: no browser tools — requires Quinn".
|
|
269
|
-
4. Compare before-state against current after-state.
|
|
270
|
-
5. Capture real evidence for each criterion.
|
|
271
|
-
|
|
272
|
-
Output your verdict, criteriaResults, reproduced, gaps, and quinnNeeded (list of AC IDs needing Quinn).
|
|
273
|
-
`, { label: 'b3-reproducer', phase: 'Validate', schema: REPRODUCER_SCHEMA })
|
|
274
|
-
|
|
275
|
-
let allCriteriaResults = reproducerResult?.criteriaResults || []
|
|
276
|
-
let quinnResults = null
|
|
277
|
-
|
|
278
|
-
// Spawn Quinn for UI ACs if needed
|
|
279
|
-
const needsQuinn = issueData.hasUIACs ||
|
|
280
|
-
(reproducerResult?.quinnNeeded && reproducerResult.quinnNeeded.length > 0)
|
|
281
|
-
|
|
282
|
-
if (needsQuinn) {
|
|
283
|
-
log('UI ACs detected — starting prove container with prod data, then spawning Quinn')
|
|
284
|
-
|
|
285
|
-
// Start prove container with prod data (make prove-up = build + rsync prod data + start on :7776)
|
|
286
|
-
await agent(`
|
|
287
|
-
You have ONE task: start the prove container with prod data. Run this EXACT command and report the output:
|
|
288
|
-
|
|
289
|
-
cd ${PROJECT_ROOT} && make prove-up 2>&1 | tail -20
|
|
290
|
-
|
|
291
|
-
This rebuilds the container image, rsyncs prod data to data-test/, and starts the container on port 7776.
|
|
292
|
-
After it completes, verify the container is up: curl -s -o /dev/null -w "%{http_code}" http://localhost:7776/api/aes
|
|
293
|
-
Report the output.
|
|
294
|
-
`, { label: 'prove-container-up', phase: 'Validate' })
|
|
295
|
-
|
|
296
|
-
const quinnACs = (reproducerResult?.quinnNeeded || []).join(', ') ||
|
|
297
|
-
(issueData.successCriteria || []).filter(sc =>
|
|
298
|
-
/ui|screenshot|visual|page|component|render|display|show/i.test(sc)
|
|
299
|
-
).join('\n')
|
|
300
|
-
|
|
301
|
-
quinnResults = await agent(`
|
|
302
|
-
You are Quinn Torres, QA specialist. You have Playwright MCP tools available.
|
|
303
|
-
|
|
304
|
-
## Issue #${ISSUE}: ${issueData.issueTitle}
|
|
305
|
-
Fix commit: ${COMMIT_SHA}
|
|
306
|
-
|
|
307
|
-
## Available Playwright MCP Tools (use these, NOT manual browser)
|
|
308
|
-
- browser_navigate(url) — go to URL
|
|
309
|
-
- browser_snapshot() — get accessibility tree (text, fast, preferred over screenshots)
|
|
310
|
-
- browser_click(element) — click by ref from snapshot
|
|
311
|
-
- browser_type(element, text) — type text into element
|
|
312
|
-
- browser_take_screenshot() — capture PNG evidence
|
|
313
|
-
- browser_verify_text_visible(text) — assert text on page
|
|
314
|
-
|
|
315
|
-
## Target URLs
|
|
316
|
-
Read ${PROJECT_ROOT}/.claude/rungate.json for page paths.
|
|
317
|
-
Prove container base: http://localhost:7776
|
|
318
|
-
|
|
319
|
-
## ACs to verify (UI/OUTCOME — skipped by B3)
|
|
320
|
-
${quinnACs}
|
|
321
|
-
|
|
322
|
-
## Test Plan for #${ISSUE} on PROVE CONTAINER
|
|
323
|
-
1. Verify fix deployed: cd ${PROJECT_ROOT} && git rev-parse --short HEAD should match ${COMMIT_SHA.slice(0, 8)}
|
|
324
|
-
2. For each AC:
|
|
325
|
-
a. browser_navigate("http://localhost:7776" + page path from rungate.json)
|
|
326
|
-
b. browser_snapshot() — verify page loaded
|
|
327
|
-
c. Perform action (browser_click, browser_type, etc.)
|
|
328
|
-
d. browser_snapshot() or browser_verify_text_visible() to verify
|
|
329
|
-
e. browser_take_screenshot() for evidence
|
|
330
|
-
3. Test as a brand-new user — use a customer that HAS contacts (prod data on :7776)
|
|
331
|
-
4. Report PASS/FAIL per AC with tool output as evidence
|
|
332
|
-
|
|
333
|
-
IMPORTANT: Test on port 7776 (prove container with prod data), NOT dev server (port 5173/7778).
|
|
334
|
-
Report verdict and criteriaResults.
|
|
335
|
-
`, { label: 'quinn-prove', phase: 'Validate', schema: QUINN_SCHEMA })
|
|
336
|
-
|
|
337
|
-
// Merge Quinn results into allCriteriaResults (replace SKIPs from B3)
|
|
338
|
-
if (quinnResults?.criteriaResults) {
|
|
339
|
-
const quinnMap = new Map(quinnResults.criteriaResults.map(cr => [cr.scId, cr]))
|
|
340
|
-
allCriteriaResults = allCriteriaResults.map(cr => {
|
|
341
|
-
if (cr.verdict === 'SKIP' && quinnMap.has(cr.scId)) {
|
|
342
|
-
return quinnMap.get(cr.scId)
|
|
343
|
-
}
|
|
344
|
-
return cr
|
|
345
|
-
})
|
|
346
|
-
// Add any Quinn results for ACs not in B3 output
|
|
347
|
-
for (const qr of quinnResults.criteriaResults) {
|
|
348
|
-
if (!allCriteriaResults.some(cr => cr.scId === qr.scId)) {
|
|
349
|
-
allCriteriaResults.push(qr)
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
log(`Quinn: ${quinnResults?.verdict || 'no result'}`)
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// ════════════════════════════════════════════════════════════
|
|
357
|
-
// PHASE 4: VERDICT — Mechanical computation + self-heal loop
|
|
358
|
-
// ════════════════════════════════════════════════════════════
|
|
359
|
-
|
|
360
|
-
phase('Verdict')
|
|
361
|
-
|
|
362
|
-
const MAX_SELF_HEAL_ATTEMPTS = 3
|
|
363
|
-
|
|
364
|
-
function computeVerdict(criteriaResults) {
|
|
365
|
-
const fc = criteriaResults.filter(cr => cr.verdict === 'FAIL').length
|
|
366
|
-
const psc = criteriaResults.filter(cr => cr.verdict === 'PASS' || cr.verdict === 'SKIP').length
|
|
367
|
-
let v
|
|
368
|
-
if (criteriaResults.length === 0) {
|
|
369
|
-
v = 'INCONCLUSIVE'
|
|
370
|
-
} else if (fc > 0) {
|
|
371
|
-
v = 'UNPROVEN'
|
|
372
|
-
} else {
|
|
373
|
-
v = 'PROVEN'
|
|
374
|
-
}
|
|
375
|
-
return { verdict: v, failCount: fc, passSkipCount: psc }
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
let { verdict, failCount, passSkipCount } = computeVerdict(allCriteriaResults)
|
|
379
|
-
log(`Verdict: ${verdict} — ${passSkipCount} PASS/SKIP, ${failCount} FAIL, ${allCriteriaResults.length} total`)
|
|
380
|
-
|
|
381
|
-
// ── Self-heal loop: on UNPROVEN, spawn Marcus to fix, re-prove ──
|
|
382
|
-
let selfHealIteration = 0
|
|
383
|
-
|
|
384
|
-
while (verdict === 'UNPROVEN' && selfHealIteration < MAX_SELF_HEAL_ATTEMPTS) {
|
|
385
|
-
selfHealIteration++
|
|
386
|
-
log(`Self-heal iteration ${selfHealIteration}/${MAX_SELF_HEAL_ATTEMPTS} — spawning fix agent`)
|
|
387
|
-
|
|
388
|
-
const failedCriteria = allCriteriaResults.filter(cr => cr.verdict === 'FAIL')
|
|
389
|
-
const failSummary = failedCriteria.map(cr => `${cr.scId}: ${cr.evidence || 'FAIL'}`).join('\n')
|
|
390
|
-
|
|
391
|
-
// Spawn Marcus to fix the failures
|
|
392
|
-
await agent(`
|
|
393
|
-
You are Marcus Webb, senior engineer. Prove found UNPROVEN criteria for issue #${ISSUE}.
|
|
394
|
-
|
|
395
|
-
## Failed Criteria (iteration ${selfHealIteration}/${MAX_SELF_HEAL_ATTEMPTS})
|
|
396
|
-
${failSummary}
|
|
397
|
-
|
|
398
|
-
## Issue
|
|
399
|
-
Title: ${issueData.issueTitle}
|
|
400
|
-
Body (first 2000 chars): ${(issueData.issueBody || '').slice(0, 2000)}
|
|
401
|
-
|
|
402
|
-
## Instructions
|
|
403
|
-
1. Read the failed criteria above.
|
|
404
|
-
2. cd ${PROJECT_ROOT || '.'} and investigate why each criterion failed.
|
|
405
|
-
3. Fix the code to address each failure.
|
|
406
|
-
4. Run tests: bun test, tsc --noEmit.
|
|
407
|
-
5. Commit and push the fix: git add -A && git commit -m "fix(#${ISSUE}): prove self-heal iteration ${selfHealIteration}" && git push
|
|
408
|
-
|
|
409
|
-
Report what you fixed and evidence that each failed criterion is now addressed.
|
|
410
|
-
`, { label: `self-heal-fix-${selfHealIteration}`, phase: 'Verdict', agentType: 'Engineer' })
|
|
411
|
-
|
|
412
|
-
log(`Self-heal fix ${selfHealIteration} complete — re-validating`)
|
|
413
|
-
|
|
414
|
-
// Re-run B3 reproducer to check if fixes resolved the failures
|
|
415
|
-
const revalidateResult = await agent(`
|
|
416
|
-
You are a prove reproducer for issue #${ISSUE} (self-heal re-validation, iteration ${selfHealIteration}).
|
|
417
|
-
|
|
418
|
-
## Issue
|
|
419
|
-
Title: ${issueData.issueTitle}
|
|
420
|
-
Body (first 2000 chars): ${(issueData.issueBody || '').slice(0, 2000)}
|
|
421
|
-
|
|
422
|
-
## Success Criteria
|
|
423
|
-
${(issueData.successCriteria || []).map((sc, i) => `${i + 1}. ${sc}`).join('\n') || 'Derive from issue body'}
|
|
424
|
-
|
|
425
|
-
## Previously Failed Criteria
|
|
426
|
-
${failSummary}
|
|
427
|
-
|
|
428
|
-
## Fix Commit
|
|
429
|
-
Run: cd ${PROJECT_ROOT || '.'} && git rev-parse --short HEAD
|
|
430
|
-
|
|
431
|
-
## Instructions
|
|
432
|
-
1. For CODE ACs: run evidence commands (grep, bun test, curl) against current code.
|
|
433
|
-
2. For UI/OUTCOME ACs: output SKIP with reason "B3 limitation: no browser tools — requires Quinn".
|
|
434
|
-
3. Focus on the previously failed criteria — verify the fix resolved them.
|
|
435
|
-
|
|
436
|
-
Output your verdict, criteriaResults, reproduced, gaps.
|
|
437
|
-
`, { label: `self-heal-validate-${selfHealIteration}`, phase: 'Verdict', schema: REPRODUCER_SCHEMA })
|
|
438
|
-
|
|
439
|
-
if (revalidateResult?.criteriaResults) {
|
|
440
|
-
allCriteriaResults = revalidateResult.criteriaResults
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
const recomputed = computeVerdict(allCriteriaResults)
|
|
444
|
-
verdict = recomputed.verdict
|
|
445
|
-
failCount = recomputed.failCount
|
|
446
|
-
passSkipCount = recomputed.passSkipCount
|
|
447
|
-
|
|
448
|
-
log(`Self-heal iteration ${selfHealIteration} verdict: ${verdict} — ${passSkipCount} PASS/SKIP, ${failCount} FAIL`)
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (selfHealIteration >= MAX_SELF_HEAL_ATTEMPTS && verdict === 'UNPROVEN') {
|
|
452
|
-
log(`CIRCUIT BREAKER: prove self-heal exhausted ${MAX_SELF_HEAL_ATTEMPTS} iterations — still UNPROVEN`)
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// ════════════════════════════════════════════════════════════
|
|
456
|
-
// PHASE 5: OUTPUT — Write evidence, post comment, label, telemetry
|
|
457
|
-
// ════════════════════════════════════════════════════════════
|
|
458
|
-
|
|
459
|
-
phase('Output')
|
|
460
|
-
|
|
461
|
-
const proveEvidence = {
|
|
462
|
-
contractVersion: '1.0',
|
|
463
|
-
issueNumber: ISSUE,
|
|
464
|
-
verdict,
|
|
465
|
-
commitSHA: COMMIT_SHA,
|
|
466
|
-
capturedAt: 'AGENT_FILL_TIMESTAMP',
|
|
467
|
-
criteriaResults: allCriteriaResults,
|
|
468
|
-
reproduced: reproducerResult?.reproduced ?? false,
|
|
469
|
-
source: 'prove-workflow',
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Write prove-evidence.json
|
|
473
|
-
await agent(`
|
|
474
|
-
mkdir -p ${WORK_DIR}
|
|
475
|
-
Write this JSON to ${WORK_DIR}/prove-evidence.json using the Write tool.
|
|
476
|
-
Replace the capturedAt value "AGENT_FILL_TIMESTAMP" with the current ISO timestamp (run: date -u +%Y-%m-%dT%H:%M:%SZ).
|
|
477
|
-
|
|
478
|
-
${JSON.stringify(proveEvidence, null, 2)}
|
|
479
|
-
`, { label: 'write-evidence', phase: 'Output' })
|
|
480
|
-
|
|
481
|
-
log('prove-evidence.json written')
|
|
482
|
-
|
|
483
|
-
// Post proof comment to issue
|
|
484
|
-
const proofComment = [
|
|
485
|
-
'## Proof',
|
|
486
|
-
'',
|
|
487
|
-
`- **Fix:** commit ${COMMIT_SHA.slice(0, 8)}`,
|
|
488
|
-
`- **Reproduced:** ${proveEvidence.reproduced ? 'yes' : 'no'}`,
|
|
489
|
-
...allCriteriaResults.map(cr => `- **${cr.scId}:** ${cr.verdict}${cr.evidence ? ' — ' + cr.evidence.slice(0, 100) : ''}`),
|
|
490
|
-
quinnResults ? `- **Quinn:** ${quinnResults.verdict}` : '',
|
|
491
|
-
`- **Verdict:** ${verdict}`,
|
|
492
|
-
].filter(Boolean).join('\n')
|
|
493
|
-
|
|
494
|
-
await agent(`
|
|
495
|
-
Post this comment to issue #${ISSUE}:
|
|
496
|
-
gh issue comment ${ISSUE} --repo ${ISSUE_REPO} --body ${JSON.stringify(proofComment)}
|
|
497
|
-
`, { label: 'post-comment', phase: 'Output' })
|
|
498
|
-
|
|
499
|
-
log('Proof comment posted')
|
|
500
|
-
|
|
501
|
-
// Add proven label + close issue (chain mode only) if PROVEN
|
|
502
|
-
if (verdict === 'PROVEN') {
|
|
503
|
-
const chainMode = await agent(`
|
|
504
|
-
test -f ${GOAL_RECORD_PATH} && echo "CHAIN" || echo "STANDALONE"
|
|
505
|
-
`, { label: 'chain-check', phase: 'Output' })
|
|
506
|
-
|
|
507
|
-
await agent(`
|
|
508
|
-
Add the "proven" label to issue #${ISSUE}:
|
|
509
|
-
gh issue edit ${ISSUE} --repo ${ISSUE_REPO} --add-label "proven" 2>&1 || echo "label add failed"
|
|
510
|
-
|
|
511
|
-
${String(chainMode).includes('CHAIN') ? `
|
|
512
|
-
Also close the issue (chain mode — goal-record.json exists):
|
|
513
|
-
gh issue close ${ISSUE} --repo ${ISSUE_REPO} 2>&1 || echo "close failed"
|
|
514
|
-
gh issue comment ${ISSUE} --repo ${ISSUE_REPO} --body "Issue closed by /prove — verdict: PROVEN"
|
|
515
|
-
` : '# Standalone mode — do NOT close the issue'}
|
|
516
|
-
`, { label: 'label-close', phase: 'Output' })
|
|
517
|
-
|
|
518
|
-
log(String(chainMode).includes('CHAIN') ? 'Issue labeled + closed (chain mode)' : 'Issue labeled proven (standalone)')
|
|
519
|
-
} else if (verdict === 'UNPROVEN') {
|
|
520
|
-
await agent(`
|
|
521
|
-
Post a re-investigation comment:
|
|
522
|
-
gh issue comment ${ISSUE} --repo ${ISSUE_REPO} --body "Prove verdict: UNPROVEN — issue remains open for re-investigation"
|
|
523
|
-
`, { label: 'unproven-comment', phase: 'Output' })
|
|
524
|
-
log('UNPROVEN — issue remains open')
|
|
525
|
-
} else {
|
|
526
|
-
await agent(`
|
|
527
|
-
Post an inconclusive comment:
|
|
528
|
-
gh issue comment ${ISSUE} --repo ${ISSUE_REPO} --body "Prove verdict: INCONCLUSIVE — could not reproduce. Manual investigation needed."
|
|
529
|
-
`, { label: 'inconclusive-comment', phase: 'Output' })
|
|
530
|
-
log('INCONCLUSIVE — manual investigation needed')
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// Telemetry — agent handles timestamps since workflow sandbox bans Date.now()
|
|
534
|
-
await agent(`
|
|
535
|
-
Append a telemetry entry to ${HOME}/.claude/MEMORY/LEARNING/SIGNALS/harness-telemetry.jsonl.
|
|
536
|
-
Use Bash to echo a single JSON line with: ts (current ISO timestamp), skill: "prove", issue: ${ISSUE}, check: "verdict", result: "${verdict}".
|
|
537
|
-
Create the directory if it doesn't exist: mkdir -p ${HOME}/.claude/MEMORY/LEARNING/SIGNALS
|
|
538
|
-
`, { label: 'telemetry', phase: 'Output' })
|
|
539
|
-
|
|
540
|
-
log(`Telemetry logged — prove #${ISSUE}: ${verdict}`)
|
|
541
|
-
|
|
542
|
-
// Cleanup: stop prove container
|
|
543
|
-
await agent(`
|
|
544
|
-
Run: cd ${PROJECT_ROOT} && make prove-down 2>&1 || true
|
|
545
|
-
Report output.
|
|
546
|
-
`, { label: 'prove-container-down', phase: 'Output' })
|
|
547
|
-
|
|
548
|
-
return {
|
|
549
|
-
status: verdict,
|
|
550
|
-
issue: ISSUE,
|
|
551
|
-
slug: SLUG,
|
|
552
|
-
verdict,
|
|
553
|
-
commitSHA: COMMIT_SHA,
|
|
554
|
-
criteriaResults: allCriteriaResults,
|
|
555
|
-
reproduced: proveEvidence.reproduced,
|
|
556
|
-
quinnVerdict: quinnResults?.verdict || null,
|
|
557
|
-
selfHealIterations: selfHealIteration,
|
|
558
|
-
circuitBroken: selfHealIteration >= MAX_SELF_HEAL_ATTEMPTS && verdict === 'UNPROVEN',
|
|
559
|
-
workDir: WORK_DIR,
|
|
560
|
-
}
|