Repository navigation
Expand file tree
/
Copy pathagent_coding_stack_gate.py
More file actions
executable file
·316 lines (272 loc) · 13 KB
/
Copy pathagent_coding_stack_gate.py
File metadata and controls
executable file
·316 lines (272 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#!/usr/bin/env python3
"""Presence gate for the layered agent coding stack (SSOT).
Verifies docs + scripts for OpenGSD, Spec Kit, Superpowers, BMAD-lite,
Compound Engineering lite, Value Center lite, Workflow Economics lite,
Agent Integrity lite, Maintainability Gap lite, Diff Delta lite, Looped Flows lite,
DAIR Academy Daily lite, LLM Response Cache lite, AgentZip Memory lite, Apple PCC lite,
HydraFusion Routing lite, Trust Reliability Loop lite, GPT-6 Astra Harness lite,
Semantic Search Stack lite, Multi-Teacher Distill lite, and NVIDIA PAIR Local
Router lite. Does NOT require an
active GSD phase to be ship_ready (that is phase-local).
"""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from pathlib import Path
from typing import Any
REQUIRED_DOCS = (
"docs/AGENT_CODING_STACK.md",
"docs/GSD_OPENGSD.md",
"docs/SPEC_KIT.md",
"docs/SUPERPOWERS.md",
"docs/BMAD.md",
"docs/COMPOUND_ENGINEERING.md",
"docs/PSTACK.md",
"docs/VALUE_CENTER.md",
"docs/WORKFLOW_ECONOMICS.md",
"docs/AGENT_INTEGRITY.md",
"docs/MAINTAINABILITY_GAP.md",
"docs/DIFF_DELTA.md",
"docs/LOOPED_FLOWS.md",
"docs/DAIR_ACADEMY_DAILY.md",
"docs/LLM_RESPONSE_CACHE.md",
"docs/AGENTZIP_MEMORY.md",
"docs/APPLE_PRIVATE_CLOUD_COMPUTE.md",
"docs/HYDRAFUSION_ROUTING.md",
"docs/TRUST_RELIABILITY_LOOP.md",
"docs/GPT6_ASTRA_HARNESS.md",
"docs/SEMANTIC_SEARCH_STACK.md",
"docs/MULTI_TEACHER_DISTILL.md",
"docs/NVIDIA_PAIR_LOCAL_ROUTER.md",
"docs/GEMINI_38_LIVE_EXTENDED_THINKING.md",
"docs/GREPTILE_FREE_ONLY.md",
"docs/AI_OPERATING_MODEL.md",
"docs/AGENT_ACCESS_GOVERNANCE.md",
"docs/LLM_OBSERVABILITY.md",
"AGENTS.md",
"CLAUDE.md",
)
REQUIRED_SCRIPTS = (
"scripts/gsd_phase_gate.py",
"scripts/speckit_gate.py",
"scripts/superpowers_gate.py",
"scripts/bmad_readiness_gate.py",
"scripts/compound_gate.py",
"scripts/pstack_gate.py",
"scripts/value_center_gate.py",
"scripts/workflow_economics_gate.py",
"scripts/agent_integrity_gate.py",
"scripts/maintainability_gap_gate.py",
"scripts/diff_delta_gate.py",
"scripts/looped_flows_gate.py",
"scripts/dair_academy_gate.py",
"scripts/llm_response_cache_gate.py",
"scripts/agentzip_memory_gate.py",
"scripts/apple_pcc_gate.py",
"scripts/hydrafusion_routing_gate.py",
"scripts/trust_reliability_loop_gate.py",
"scripts/gpt6_astra_harness_gate.py",
"scripts/semantic_search_stack_gate.py",
"scripts/multi_teacher_distill_gate.py",
"scripts/nvidia_pair_local_router_gate.py",
"scripts/nvidia_pair_workloads.py",
"scripts/gemini_38_live_extended_thinking_gate.py",
"scripts/greptile_free_only_gate.py",
"scripts/ai_operating_model_gate.py",
"scripts/agent_access_governance_gate.py",
"scripts/llm_observability_gate.py",
)
BANNED_MARKERS = (
"gsd-build/get-shit-done",
)
def _run_json(repo: Path, script: str, extra: list[str] | None = None) -> dict[str, Any]:
cmd = [sys.executable, str(repo / script), "--json", *(extra or [])]
proc = subprocess.run(cmd, cwd=repo, capture_output=True, text=True, check=False)
if proc.returncode not in (0, 1):
return {"ok": False, "error": proc.stderr.strip() or proc.stdout.strip() or f"exit_{proc.returncode}"}
try:
return json.loads(proc.stdout)
except json.JSONDecodeError as exc:
return {"ok": False, "error": f"invalid_json:{exc}"}
def evaluate(root: Path) -> dict[str, Any]:
blockers: list[str] = []
for rel in REQUIRED_DOCS + REQUIRED_SCRIPTS:
if not (root / rel).is_file():
blockers.append(f"missing:{rel}")
# Ban archived predecessor references in the SSOT doc body as install target
ssot = root / "docs" / "AGENT_CODING_STACK.md"
if ssot.is_file():
text = ssot.read_text(encoding="utf-8")
if "open-gsd/gsd-core" not in text:
blockers.append("ssot_missing_open-gsd_pointer")
if "Do **not** use archived" not in text and "Do not use archived" not in text:
blockers.append("ssot_missing_archived_ban")
child: dict[str, Any] = {}
# Superpowers / BMAD / Compound should be ready at rest
child["superpowers"] = _run_json(root, "scripts/superpowers_gate.py")
if not child["superpowers"].get("ready"):
blockers.append("superpowers_not_ready")
child["bmad"] = _run_json(root, "scripts/bmad_readiness_gate.py", ["--feature", "002"])
if not child["bmad"].get("ready"):
blockers.append("bmad_fixture_not_ready")
child["compound"] = _run_json(root, "scripts/compound_gate.py", ["--slug", "003"])
if not child["compound"].get("ready"):
blockers.append("compound_fixture_not_ready")
child["pstack"] = _run_json(root, "scripts/pstack_gate.py")
if not child["pstack"].get("ready"):
blockers.append("pstack_not_ready")
child["value_center"] = _run_json(root, "scripts/value_center_gate.py")
if not child["value_center"].get("ready"):
blockers.append("value_center_not_ready")
child["workflow_economics"] = _run_json(root, "scripts/workflow_economics_gate.py")
if not child["workflow_economics"].get("ready"):
blockers.append("workflow_economics_not_ready")
child["agent_integrity"] = _run_json(root, "scripts/agent_integrity_gate.py")
if not child["agent_integrity"].get("ready"):
blockers.append("agent_integrity_not_ready")
child["maintainability_gap"] = _run_json(root, "scripts/maintainability_gap_gate.py")
if not child["maintainability_gap"].get("ready"):
blockers.append("maintainability_gap_not_ready")
child["diff_delta"] = _run_json(root, "scripts/diff_delta_gate.py")
if not child["diff_delta"].get("ready"):
blockers.append("diff_delta_not_ready")
child["looped_flows"] = _run_json(root, "scripts/looped_flows_gate.py")
if not child["looped_flows"].get("ready"):
blockers.append("looped_flows_not_ready")
child["dair_academy"] = _run_json(root, "scripts/dair_academy_gate.py")
if not child["dair_academy"].get("ready"):
blockers.append("dair_academy_not_ready")
child["llm_response_cache"] = _run_json(root, "scripts/llm_response_cache_gate.py")
if not child["llm_response_cache"].get("ready"):
blockers.append("llm_response_cache_not_ready")
child["agentzip_memory"] = _run_json(root, "scripts/agentzip_memory_gate.py")
if not child["agentzip_memory"].get("ready"):
blockers.append("agentzip_memory_not_ready")
child["apple_pcc"] = _run_json(root, "scripts/apple_pcc_gate.py")
if not child["apple_pcc"].get("ready"):
blockers.append("apple_pcc_not_ready")
child["hydrafusion_routing"] = _run_json(root, "scripts/hydrafusion_routing_gate.py")
if not child["hydrafusion_routing"].get("ready"):
blockers.append("hydrafusion_routing_not_ready")
child["trust_reliability_loop"] = _run_json(
root, "scripts/trust_reliability_loop_gate.py"
)
if not child["trust_reliability_loop"].get("ready"):
blockers.append("trust_reliability_loop_not_ready")
child["gpt6_astra_harness"] = _run_json(root, "scripts/gpt6_astra_harness_gate.py")
if not child["gpt6_astra_harness"].get("ready"):
blockers.append("gpt6_astra_harness_not_ready")
child["semantic_search_stack"] = _run_json(
root, "scripts/semantic_search_stack_gate.py"
)
if not child["semantic_search_stack"].get("ready"):
blockers.append("semantic_search_stack_not_ready")
child["multi_teacher_distill"] = _run_json(
root, "scripts/multi_teacher_distill_gate.py"
)
if not child["multi_teacher_distill"].get("ready"):
blockers.append("multi_teacher_distill_not_ready")
child["nvidia_pair_local_router"] = _run_json(
root, "scripts/nvidia_pair_local_router_gate.py"
)
if not child["nvidia_pair_local_router"].get("ready"):
blockers.append("nvidia_pair_local_router_not_ready")
child["gemini_38_live_extended_thinking"] = _run_json(
root, "scripts/gemini_38_live_extended_thinking_gate.py"
)
if not child["gemini_38_live_extended_thinking"].get("ready"):
blockers.append("gemini_38_live_extended_thinking_not_ready")
child["greptile_free_only"] = _run_json(root, "scripts/greptile_free_only_gate.py")
if not child["greptile_free_only"].get("ready"):
blockers.append("greptile_free_only_not_ready")
child["ai_operating_model"] = _run_json(root, "scripts/ai_operating_model_gate.py")
if not child["ai_operating_model"].get("ready"):
blockers.append("ai_operating_model_not_ready")
child["agent_access_governance"] = _run_json(
root, "scripts/agent_access_governance_gate.py"
)
if not child["agent_access_governance"].get("ready"):
blockers.append("agent_access_governance_not_ready")
child["llm_observability"] = _run_json(root, "scripts/llm_observability_gate.py")
if not child["llm_observability"].get("ready"):
blockers.append("llm_observability_not_ready")
child["speckit"] = _run_json(root, "scripts/speckit_gate.py")
if child["speckit"].get("error"):
blockers.append("speckit_gate_error")
elif not child["speckit"].get("constitution", {}).get("ok"):
blockers.append("speckit_constitution_missing")
child["gsd"] = _run_json(root, "scripts/gsd_phase_gate.py")
if child["gsd"].get("error"):
blockers.append("gsd_gate_error")
elif child["gsd"].get("source") != "open-gsd/gsd-core":
blockers.append("gsd_not_open-gsd_source")
# ship_ready may be false between phases — that is OK for stack presence
# Soft check: OpenCode optional
opencode = None
which = subprocess.run(["which", "opencode"], capture_output=True, text=True, check=False)
if which.returncode == 0:
opencode = which.stdout.strip()
ready = len(blockers) == 0
return {
"source": "agent-coding-stack-ssot",
"ready": ready,
"claim_done_allowed": ready,
"blockers": blockers,
"banned": list(BANNED_MARKERS),
"opencode_cli": opencode,
"opencode_required": False,
"children": {
"superpowers_ready": child["superpowers"].get("ready"),
"bmad_ready": child["bmad"].get("ready"),
"compound_ready": child["compound"].get("ready"),
"pstack_ready": child["pstack"].get("ready"),
"value_center_ready": child["value_center"].get("ready"),
"workflow_economics_ready": child["workflow_economics"].get("ready"),
"agent_integrity_ready": child["agent_integrity"].get("ready"),
"maintainability_gap_ready": child["maintainability_gap"].get("ready"),
"diff_delta_ready": child["diff_delta"].get("ready"),
"looped_flows_ready": child["looped_flows"].get("ready"),
"dair_academy_ready": child["dair_academy"].get("ready"),
"llm_response_cache_ready": child["llm_response_cache"].get("ready"),
"agentzip_memory_ready": child["agentzip_memory"].get("ready"),
"apple_pcc_ready": child["apple_pcc"].get("ready"),
"hydrafusion_routing_ready": child["hydrafusion_routing"].get("ready"),
"trust_reliability_loop_ready": child["trust_reliability_loop"].get("ready"),
"gpt6_astra_harness_ready": child["gpt6_astra_harness"].get("ready"),
"semantic_search_stack_ready": child["semantic_search_stack"].get("ready"),
"multi_teacher_distill_ready": child["multi_teacher_distill"].get("ready"),
"nvidia_pair_local_router_ready": child["nvidia_pair_local_router"].get(
"ready"
),
"gemini_38_live_extended_thinking_ready": child[
"gemini_38_live_extended_thinking"
].get("ready"),
"greptile_free_only_ready": child["greptile_free_only"].get("ready"),
"ai_operating_model_ready": child["ai_operating_model"].get("ready"),
"agent_access_governance_ready": child["agent_access_governance"].get(
"ready"
),
"llm_observability_ready": child["llm_observability"].get("ready"),
"speckit_implement_ready": child["speckit"].get("implement_ready"),
"gsd_source": child["gsd"].get("source"),
"gsd_ship_ready": child["gsd"].get("ship_ready"),
"gsd_note": "ship_ready=false is OK when no active phase",
},
"docs": list(REQUIRED_DOCS),
"next_step": "use_layered_stack" if ready else "repair_missing_layers",
}
def main() -> int:
parser = argparse.ArgumentParser(description="Agent coding stack presence gate")
parser.add_argument("--repo-root", default=".")
parser.add_argument("--json", action="store_true")
args = parser.parse_args()
report = evaluate(Path(args.repo_root).resolve())
if args.json:
print(json.dumps(report, indent=2))
else:
print(f"ready={report['ready']} blockers={report['blockers']}")
return 0 if report["ready"] else 1
if __name__ == "__main__":
raise SystemExit(main())