@hxp-tools/godplans 0.0.0-stage → 2.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.
- package/CHANGELOG.md +1176 -0
- package/LICENSE +21 -0
- package/PROMPT.md +4006 -0
- package/README.md +201 -2
- package/assets/README.md +11 -0
- package/assets/hero.svg +44 -0
- package/assets/plan-loop.svg +62 -0
- package/assets/quest-map.svg +80 -0
- package/bin/godplans.js +93 -0
- package/docs/ARCHITECTURE.md +136 -0
- package/docs/RELEASING.md +107 -0
- package/evals/README.md +295 -0
- package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
- package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
- package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
- package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
- package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
- package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
- package/evals/cases/brownfield-cli/REQUEST.md +10 -0
- package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
- package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
- package/evals/cases/compliance-refusal/REQUEST.md +8 -0
- package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
- package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
- package/evals/cases/greenfield-saas/REQUEST.md +11 -0
- package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
- package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
- package/evals/cases/nested-pillars/REQUEST.md +11 -0
- package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
- package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
- package/evals/cases/observability-evidence/REQUEST.md +11 -0
- package/evals/cases/product-business/EXPECTATIONS +18 -0
- package/evals/cases/product-business/REQUEST.baseline.md +13 -0
- package/evals/cases/product-business/REQUEST.md +14 -0
- package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
- package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
- package/evals/cases/product-form-routing/REQUEST.md +11 -0
- package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
- package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
- package/evals/cases/prose-integrity/REQUEST.md +20 -0
- package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
- package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
- package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
- package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
- package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
- package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
- package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
- package/evals/cases/stale-prepublication/REQUEST.md +13 -0
- package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
- package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
- package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
- package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
- package/evals/cases/weekend-library/EXPECTATIONS +19 -0
- package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
- package/evals/cases/weekend-library/REQUEST.md +11 -0
- package/evals/cases-roster.txt +19 -0
- package/evals/external/GRADE.schema.json +39 -0
- package/evals/external/README.md +42 -0
- package/evals/external/RUBRIC.md +32 -0
- package/evals/metrics/context-cost.json +154 -0
- package/evals/outcomes/README.md +65 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
- package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
- package/evals/runners/claude-baseline.sh +4 -0
- package/evals/runners/claude-grade.sh +3 -0
- package/evals/runners/claude.sh +4 -0
- package/evals/runners/codex-baseline.sh +181 -0
- package/evals/runners/codex-builder.sh +96 -0
- package/evals/runners/codex-godaudits.sh +84 -0
- package/evals/runners/codex.sh +147 -0
- package/evals/runners/gemini-baseline.sh +4 -0
- package/evals/runners/gemini-grade.sh +3 -0
- package/evals/runners/gemini.sh +4 -0
- package/evals/runners/vendor-cli.sh +257 -0
- package/evals/runners/vendor-grade.sh +82 -0
- package/install.sh +323 -0
- package/package.json +92 -4
- package/requirements/skills-ref.txt +2 -0
- package/scripts/build-catalog.js +114 -0
- package/scripts/build-prompt.sh +257 -0
- package/scripts/context-metrics.js +118 -0
- package/scripts/eval-external.js +226 -0
- package/scripts/eval-matrix.sh +172 -0
- package/scripts/eval-outcome.js +143 -0
- package/scripts/eval.sh +321 -0
- package/scripts/lint-parity.js +331 -0
- package/scripts/lint.sh +743 -0
- package/scripts/outcome-summary.js +126 -0
- package/scripts/release-check.sh +108 -0
- package/scripts/release-prepare.js +41 -0
- package/scripts/summarize-eval.js +91 -0
- package/scripts/summarize-matrix.js +101 -0
- package/scripts/version-sync.js +65 -0
- package/skills/godplans/SKILL.md +192 -0
- package/skills/godplans/references/agent-memory.md +168 -0
- package/skills/godplans/references/architecture.md +189 -0
- package/skills/godplans/references/build.md +130 -0
- package/skills/godplans/references/business.md +252 -0
- package/skills/godplans/references/code-quality.md +165 -0
- package/skills/godplans/references/compliance.md +59 -0
- package/skills/godplans/references/database.md +157 -0
- package/skills/godplans/references/deploy.md +146 -0
- package/skills/godplans/references/discovery.md +297 -0
- package/skills/godplans/references/doc-set.md +243 -0
- package/skills/godplans/references/exemplar.md +228 -0
- package/skills/godplans/references/launch.md +162 -0
- package/skills/godplans/references/llm.md +132 -0
- package/skills/godplans/references/observe.md +178 -0
- package/skills/godplans/references/plan-format.md +340 -0
- package/skills/godplans/references/product.md +130 -0
- package/skills/godplans/references/repo.md +184 -0
- package/skills/godplans/references/roadmap.md +158 -0
- package/skills/godplans/references/security.md +156 -0
- package/skills/godplans/references/seo.md +133 -0
- package/skills/godplans/references/stack.md +133 -0
- package/skills/godplans/references/style-genome.md +198 -0
- package/skills/godplans/references/ui.md +153 -0
- package/skills/godplans/references/ux.md +150 -0
- package/skills/godplans/schemas/PLAN.schema.json +275 -0
- package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
- package/skills/godplans/scripts/plan-halflife.sh +76 -0
- package/skills/godplans/scripts/style-stats.py +630 -0
- package/skills/godplans/scripts/validate-plan.sh +1709 -0
- package/skills/godplans/templates/PLAN.template.mdx +269 -0
- package/tests/agent-memory-guidance.sh +32 -0
- package/tests/build-catalog.sh +81 -0
- package/tests/codex-runner.sh +139 -0
- package/tests/eval-harness.sh +377 -0
- package/tests/evidence-harnesses.sh +243 -0
- package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
- package/tests/install-regression.sh +246 -0
- package/tests/lib/plan-schema-check.js +163 -0
- package/tests/lint-selftest.sh +582 -0
- package/tests/package-contents.sh +140 -0
- package/tests/portable-prompt.test.sh +261 -0
- package/tests/release-tooling.sh +204 -0
- package/tests/run.sh +14 -0
- package/tests/script-usage.sh +37 -0
- package/tests/style-stats.sh +170 -0
- package/tests/validate-plan.sh +1970 -0
- package/tests/vendor-runner.sh +291 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Control arm: run one behavioral case with the SAME Codex CLI, model, and
|
|
3
|
+
# reasoning effort as runners/codex.sh, but with no godplans skill available.
|
|
4
|
+
#
|
|
5
|
+
# Fairness rules, because a rigged control proves nothing:
|
|
6
|
+
# - identical agent, model, reasoning effort, workspace, and INPUT fixture
|
|
7
|
+
# - a NEUTRAL request. The case REQUEST.md is written for the skill arm: it
|
|
8
|
+
# says "Use godplans" and "produce the godplans artifact set under
|
|
9
|
+
# .godplans/". Handing that to a skill-less agent is not a fair control;
|
|
10
|
+
# it tells the agent to use a tool it does not have, and in practice the
|
|
11
|
+
# agent burns its whole turn web-searching for the skill's format and
|
|
12
|
+
# writes nothing. So the control reads REQUEST.baseline.md when present:
|
|
13
|
+
# the same task and constraints, de-branded, asking for a plan at a
|
|
14
|
+
# neutral path. If no baseline request exists, the runner warns and falls
|
|
15
|
+
# back to REQUEST.md, and that run is not a fair comparison.
|
|
16
|
+
# - nothing from the skill leaks in: no godplans name, no .godplans path, no
|
|
17
|
+
# format contract, requirement IDs, validator, phase method, or PLAN.mdx
|
|
18
|
+
# vocabulary in the preamble
|
|
19
|
+
# - a missing plan file means the final response is scored in its place,
|
|
20
|
+
# never hidden as a runner error
|
|
21
|
+
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
|
|
24
|
+
[ $# -eq 2 ] || { echo "usage: $0 REQUEST.md OUTPUT" >&2; exit 2; }
|
|
25
|
+
|
|
26
|
+
REQUEST=$1
|
|
27
|
+
OUTPUT=$2
|
|
28
|
+
CASE_DIR="$(cd "$(dirname "$REQUEST")" && pwd)"
|
|
29
|
+
WORK="$(mktemp -d)"
|
|
30
|
+
ISO_HOME="$(mktemp -d)"
|
|
31
|
+
ISO_CODEX_HOME="$ISO_HOME/.codex"
|
|
32
|
+
LAST="$WORK/last-message.md"
|
|
33
|
+
OUTPUT_DIR="$(dirname "$OUTPUT")"
|
|
34
|
+
CODEX_LOG="$OUTPUT_DIR/codex.log"
|
|
35
|
+
CODEX_EVENTS="$OUTPUT_DIR/codex-events.jsonl"
|
|
36
|
+
trap 'rm -rf "$WORK" "$ISO_HOME"' EXIT
|
|
37
|
+
|
|
38
|
+
command -v codex >/dev/null 2>&1 || { echo "codex CLI not found" >&2; exit 2; }
|
|
39
|
+
|
|
40
|
+
# Isolate the globally installed skill set, identically to runners/codex.sh.
|
|
41
|
+
# This is the load-bearing line of the whole control arm: Codex discovers
|
|
42
|
+
# skills in $CODEX_HOME/skills and $HOME/.agents/skills, so on a machine where
|
|
43
|
+
# godplans is installed globally (the common case, since a maintainer runs the
|
|
44
|
+
# evals), the control would silently load it and measure godplans against
|
|
45
|
+
# itself. Both arms isolate the same way; the ONLY isolation difference between
|
|
46
|
+
# them is that this runner never links the skill into its workspace.
|
|
47
|
+
REAL_CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
|
|
48
|
+
mkdir -p "$ISO_CODEX_HOME"
|
|
49
|
+
[ -f "$REAL_CODEX_HOME/auth.json" ] && cp "$REAL_CODEX_HOME/auth.json" "$ISO_CODEX_HOME/auth.json"
|
|
50
|
+
[ -f "$REAL_CODEX_HOME/config.toml" ] && cp "$REAL_CODEX_HOME/config.toml" "$ISO_CODEX_HOME/config.toml"
|
|
51
|
+
[ -e "$ISO_CODEX_HOME/skills" ] && { echo "isolated CODEX_HOME must not carry skills" >&2; exit 2; }
|
|
52
|
+
|
|
53
|
+
CODEX_MODEL=${GODPLANS_EVAL_MODEL:-configured-default}
|
|
54
|
+
CODEX_EFFORT=${GODPLANS_EVAL_REASONING_EFFORT:-configured-default}
|
|
55
|
+
RESOLVED_MODEL=$CODEX_MODEL
|
|
56
|
+
if [ "$RESOLVED_MODEL" = "configured-default" ] && [ -f "$REAL_CODEX_HOME/config.toml" ]; then
|
|
57
|
+
RESOLVED_MODEL=$(awk -F= '/^[[:space:]]*model[[:space:]]*=/ { value=$2; gsub(/[[:space:]"]/, "", value); print value; exit }' "$REAL_CODEX_HOME/config.toml")
|
|
58
|
+
RESOLVED_MODEL=${RESOLVED_MODEL:-unavailable}
|
|
59
|
+
fi
|
|
60
|
+
CODEX_ARGS=(
|
|
61
|
+
exec
|
|
62
|
+
--ephemeral
|
|
63
|
+
--sandbox workspace-write
|
|
64
|
+
--skip-git-repo-check
|
|
65
|
+
--color never
|
|
66
|
+
--json
|
|
67
|
+
-C "$WORK"
|
|
68
|
+
-o "$LAST"
|
|
69
|
+
)
|
|
70
|
+
if [ "$CODEX_MODEL" != "configured-default" ]; then
|
|
71
|
+
CODEX_ARGS+=(-m "$CODEX_MODEL")
|
|
72
|
+
fi
|
|
73
|
+
if [ "$CODEX_EFFORT" != "configured-default" ]; then
|
|
74
|
+
CODEX_ARGS+=(-c "model_reasoning_effort=\"$CODEX_EFFORT\"")
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
if [ -d "$CASE_DIR/INPUT" ]; then
|
|
78
|
+
cp -R "$CASE_DIR/INPUT/." "$WORK/"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# No .agents/skills link: that absence is the whole point of this arm.
|
|
82
|
+
mkdir -p "$OUTPUT_DIR"
|
|
83
|
+
|
|
84
|
+
REQUEST_BASELINE="$CASE_DIR/REQUEST.baseline.md"
|
|
85
|
+
if [ -f "$REQUEST_BASELINE" ]; then
|
|
86
|
+
PROMPT_SOURCE="$REQUEST_BASELINE"
|
|
87
|
+
else
|
|
88
|
+
PROMPT_SOURCE="$REQUEST"
|
|
89
|
+
echo "warning: no REQUEST.baseline.md for $(basename "$CASE_DIR"); the control is running a godplans-phrased request and is NOT a fair comparison" >&2
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
set +e
|
|
93
|
+
{
|
|
94
|
+
printf '%s\n\n' 'Work entirely inside the current workspace. Do not implement application code. Complete the following task.'
|
|
95
|
+
sed -n '1,$p' "$PROMPT_SOURCE"
|
|
96
|
+
} | HOME="$ISO_HOME" CODEX_HOME="$ISO_CODEX_HOME" codex "${CODEX_ARGS[@]}" - >"$CODEX_EVENTS" 2>"$CODEX_LOG"
|
|
97
|
+
CODEX_STATUS=$?
|
|
98
|
+
set -e
|
|
99
|
+
if [ "$CODEX_STATUS" -ne 0 ]; then
|
|
100
|
+
tail -n 40 "$CODEX_LOG" >&2
|
|
101
|
+
exit "$CODEX_STATUS"
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if [ "$PROMPT_SOURCE" = "$REQUEST_BASELINE" ]; then
|
|
105
|
+
prompt_kind="neutral-baseline-request"
|
|
106
|
+
else
|
|
107
|
+
prompt_kind="fallback-skill-phrased-request-UNFAIR"
|
|
108
|
+
fi
|
|
109
|
+
printf '%s\n' \
|
|
110
|
+
"runner=codex-baseline" \
|
|
111
|
+
"arm=baseline-no-skill" \
|
|
112
|
+
"global_skills=isolated" \
|
|
113
|
+
"prompt=$prompt_kind" \
|
|
114
|
+
"codex_version=$(codex --version)" \
|
|
115
|
+
"model=$CODEX_MODEL" \
|
|
116
|
+
"resolved_model=$RESOLVED_MODEL" \
|
|
117
|
+
"reasoning_effort=$CODEX_EFFORT" \
|
|
118
|
+
> "$OUTPUT_DIR/RUNNER.txt"
|
|
119
|
+
node - "$CODEX_EVENTS" >> "$OUTPUT_DIR/RUNNER.txt" <<'NODE'
|
|
120
|
+
const fs = require('node:fs');
|
|
121
|
+
let input = 0;
|
|
122
|
+
let cached = 0;
|
|
123
|
+
let output = 0;
|
|
124
|
+
let found = false;
|
|
125
|
+
for (const line of fs.readFileSync(process.argv[2], 'utf8').split('\n')) {
|
|
126
|
+
if (!line.trim()) continue;
|
|
127
|
+
let event;
|
|
128
|
+
try { event = JSON.parse(line); } catch { continue; }
|
|
129
|
+
if (!event.usage) continue;
|
|
130
|
+
found = true;
|
|
131
|
+
input += Number(event.usage.input_tokens || 0);
|
|
132
|
+
cached += Number(event.usage.cached_input_tokens || 0);
|
|
133
|
+
output += Number(event.usage.output_tokens || 0);
|
|
134
|
+
}
|
|
135
|
+
process.stdout.write(`usage_source=${found ? 'cli-json' : 'unavailable'}\n`);
|
|
136
|
+
process.stdout.write(`input_tokens=${input}\n`);
|
|
137
|
+
process.stdout.write(`cached_input_tokens=${cached}\n`);
|
|
138
|
+
process.stdout.write(`output_tokens=${output}\n`);
|
|
139
|
+
process.stdout.write(`total_tokens=${input + output}\n`);
|
|
140
|
+
NODE
|
|
141
|
+
|
|
142
|
+
# Print the plan the control wrote. Accept any plausible path, so the baseline
|
|
143
|
+
# is not penalized for choosing a different one, but prefer the path the
|
|
144
|
+
# neutral request names (PLAN.md), and never take an INPUT fixture the control
|
|
145
|
+
# left unchanged (a replan case's prior .godplans/PLAN.mdx) as its own plan.
|
|
146
|
+
control_plan() {
|
|
147
|
+
for candidate in PLAN.md plan.md PLAN.mdx .godplans/PLAN.mdx; do
|
|
148
|
+
[ -s "$WORK/$candidate" ] || continue
|
|
149
|
+
if [ -f "$CASE_DIR/INPUT/$candidate" ] && cmp -s "$WORK/$candidate" "$CASE_DIR/INPUT/$candidate"; then
|
|
150
|
+
continue
|
|
151
|
+
fi
|
|
152
|
+
printf '%s\n' "$WORK/$candidate"
|
|
153
|
+
return 0
|
|
154
|
+
done
|
|
155
|
+
return 1
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
case "$OUTPUT" in
|
|
159
|
+
*/PLAN.mdx)
|
|
160
|
+
if plan=$(control_plan); then
|
|
161
|
+
cp "$plan" "$OUTPUT"
|
|
162
|
+
exit 0
|
|
163
|
+
fi
|
|
164
|
+
# No plan file: score the final response instead. It will fail the
|
|
165
|
+
# structural assertions, which is the honest result, not an error.
|
|
166
|
+
cp "$LAST" "$OUTPUT" 2>/dev/null || : > "$OUTPUT"
|
|
167
|
+
;;
|
|
168
|
+
*/RESPONSE.md)
|
|
169
|
+
if plan=$(control_plan); then
|
|
170
|
+
# The baseline planned a request it should have refused. Record the plan
|
|
171
|
+
# so the refusal assertions fail against real evidence.
|
|
172
|
+
cp "$plan" "$OUTPUT"
|
|
173
|
+
else
|
|
174
|
+
cp "$LAST" "$OUTPUT" 2>/dev/null || : > "$OUTPUT"
|
|
175
|
+
fi
|
|
176
|
+
;;
|
|
177
|
+
*)
|
|
178
|
+
echo "unsupported output path: $OUTPUT" >&2
|
|
179
|
+
exit 2
|
|
180
|
+
;;
|
|
181
|
+
esac
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Build one outcome arm from a plan with no planning or audit skill installed.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
[ $# -eq 3 ] || { echo "usage: $0 PLAN INPUT_DIR OUTPUT_DIR" >&2; exit 2; }
|
|
7
|
+
PLAN=$1
|
|
8
|
+
INPUT=$2
|
|
9
|
+
OUTPUT=$3
|
|
10
|
+
WORK="$(mktemp -d)"
|
|
11
|
+
ISO_HOME="$(mktemp -d)"
|
|
12
|
+
ISO_CODEX_HOME="$ISO_HOME/.codex"
|
|
13
|
+
EVENTS="$OUTPUT/codex-events.jsonl"
|
|
14
|
+
LOG="$OUTPUT/codex.log"
|
|
15
|
+
LAST="$OUTPUT/last-message.md"
|
|
16
|
+
trap 'rm -rf "$WORK" "$ISO_HOME"' EXIT
|
|
17
|
+
|
|
18
|
+
command -v codex >/dev/null 2>&1 || { echo "codex CLI not found" >&2; exit 2; }
|
|
19
|
+
[ -f "$PLAN" ] || { echo "plan not found: $PLAN" >&2; exit 2; }
|
|
20
|
+
|
|
21
|
+
REAL_CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
|
|
22
|
+
mkdir -p "$ISO_CODEX_HOME"
|
|
23
|
+
[ -f "$REAL_CODEX_HOME/auth.json" ] && cp "$REAL_CODEX_HOME/auth.json" "$ISO_CODEX_HOME/auth.json"
|
|
24
|
+
[ -f "$REAL_CODEX_HOME/config.toml" ] && cp "$REAL_CODEX_HOME/config.toml" "$ISO_CODEX_HOME/config.toml"
|
|
25
|
+
[ -e "$ISO_CODEX_HOME/skills" ] && { echo "builder must not load global skills" >&2; exit 2; }
|
|
26
|
+
|
|
27
|
+
if [ -d "$INPUT" ]; then
|
|
28
|
+
cp -R "$INPUT/." "$WORK/"
|
|
29
|
+
fi
|
|
30
|
+
cp "$PLAN" "$WORK/BUILD-PLAN.md"
|
|
31
|
+
mkdir -p "$OUTPUT"
|
|
32
|
+
|
|
33
|
+
MODEL="${GODPLANS_OUTCOME_BUILD_MODEL:-configured-default}"
|
|
34
|
+
EFFORT="${GODPLANS_OUTCOME_BUILD_EFFORT:-high}"
|
|
35
|
+
RESOLVED_MODEL=$MODEL
|
|
36
|
+
if [ "$RESOLVED_MODEL" = "configured-default" ] && [ -f "$REAL_CODEX_HOME/config.toml" ]; then
|
|
37
|
+
RESOLVED_MODEL=$(awk -F= '/^[[:space:]]*model[[:space:]]*=/ { value=$2; gsub(/[[:space:]"]/, "", value); print value; exit }' "$REAL_CODEX_HOME/config.toml")
|
|
38
|
+
RESOLVED_MODEL=${RESOLVED_MODEL:-unavailable}
|
|
39
|
+
fi
|
|
40
|
+
ARGS=(
|
|
41
|
+
exec
|
|
42
|
+
--ephemeral
|
|
43
|
+
--sandbox workspace-write
|
|
44
|
+
--skip-git-repo-check
|
|
45
|
+
--color never
|
|
46
|
+
--json
|
|
47
|
+
-C "$WORK"
|
|
48
|
+
-o "$LAST"
|
|
49
|
+
)
|
|
50
|
+
if [ "$MODEL" != "configured-default" ]; then ARGS+=(-m "$MODEL"); fi
|
|
51
|
+
if [ "$EFFORT" != "configured-default" ]; then ARGS+=(-c "model_reasoning_effort=\"$EFFORT\""); fi
|
|
52
|
+
|
|
53
|
+
set +e
|
|
54
|
+
{
|
|
55
|
+
printf '%s\n' 'Implement the complete product described by BUILD-PLAN.md in this empty evaluation workspace.'
|
|
56
|
+
printf '%s\n' 'The plan is experimental input, not an active approval lifecycle. Do not stop for plan approval.'
|
|
57
|
+
printf '%s\n' 'Use no planning or audit skill. Stay within the plan scope, run the tests you create, and leave a runnable repository.'
|
|
58
|
+
} | HOME="$ISO_HOME" CODEX_HOME="$ISO_CODEX_HOME" codex "${ARGS[@]}" - >"$EVENTS" 2>"$LOG"
|
|
59
|
+
STATUS=$?
|
|
60
|
+
set -e
|
|
61
|
+
[ "$STATUS" -eq 0 ] || { tail -n 40 "$LOG" >&2; exit "$STATUS"; }
|
|
62
|
+
|
|
63
|
+
rm -f "$WORK/BUILD-PLAN.md"
|
|
64
|
+
mkdir -p "$OUTPUT/repository"
|
|
65
|
+
cp -R "$WORK/." "$OUTPUT/repository/"
|
|
66
|
+
|
|
67
|
+
printf '%s\n' \
|
|
68
|
+
"runner=codex-builder" \
|
|
69
|
+
"global_skills=isolated" \
|
|
70
|
+
"codex_version=$(codex --version)" \
|
|
71
|
+
"model=$MODEL" \
|
|
72
|
+
"resolved_model=$RESOLVED_MODEL" \
|
|
73
|
+
"reasoning_effort=$EFFORT" \
|
|
74
|
+
> "$OUTPUT/RUNNER.txt"
|
|
75
|
+
node - "$EVENTS" >> "$OUTPUT/RUNNER.txt" <<'NODE'
|
|
76
|
+
const fs = require('node:fs');
|
|
77
|
+
let input = 0;
|
|
78
|
+
let cached = 0;
|
|
79
|
+
let output = 0;
|
|
80
|
+
let found = false;
|
|
81
|
+
for (const line of fs.readFileSync(process.argv[2], 'utf8').split('\n')) {
|
|
82
|
+
if (!line.trim()) continue;
|
|
83
|
+
let event;
|
|
84
|
+
try { event = JSON.parse(line); } catch { continue; }
|
|
85
|
+
if (!event.usage) continue;
|
|
86
|
+
found = true;
|
|
87
|
+
input += Number(event.usage.input_tokens || 0);
|
|
88
|
+
cached += Number(event.usage.cached_input_tokens || 0);
|
|
89
|
+
output += Number(event.usage.output_tokens || 0);
|
|
90
|
+
}
|
|
91
|
+
process.stdout.write(`usage_source=${found ? 'cli-json' : 'unavailable'}\n`);
|
|
92
|
+
process.stdout.write(`input_tokens=${input}\n`);
|
|
93
|
+
process.stdout.write(`cached_input_tokens=${cached}\n`);
|
|
94
|
+
process.stdout.write(`output_tokens=${output}\n`);
|
|
95
|
+
process.stdout.write(`total_tokens=${input + output}\n`);
|
|
96
|
+
NODE
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run a fresh static godaudits pass with the plan and arm identity absent.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
[ $# -eq 2 ] || { echo "usage: $0 REPOSITORY OUTPUT_DIR" >&2; exit 2; }
|
|
7
|
+
REPOSITORY=$1
|
|
8
|
+
OUTPUT=$2
|
|
9
|
+
SKILL_DIR="${GODAUDITS_SKILL_DIR:-}"
|
|
10
|
+
if [ -z "$SKILL_DIR" ]; then
|
|
11
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
12
|
+
SIBLING="$(cd "$ROOT/.." && pwd)/godaudits/skills/godaudits"
|
|
13
|
+
[ -d "$SIBLING" ] && SKILL_DIR=$SIBLING
|
|
14
|
+
fi
|
|
15
|
+
[ -d "$SKILL_DIR" ] || {
|
|
16
|
+
echo "set GODAUDITS_SKILL_DIR to the canonical godaudits skill directory" >&2
|
|
17
|
+
exit 2
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ISO_HOME="$(mktemp -d)"
|
|
21
|
+
ISO_CODEX_HOME="$ISO_HOME/.codex"
|
|
22
|
+
AUDIT_WORK="$(mktemp -d)"
|
|
23
|
+
AUDIT_REPOSITORY="$AUDIT_WORK/repository"
|
|
24
|
+
EVENTS="$OUTPUT/codex-events.jsonl"
|
|
25
|
+
LOG="$OUTPUT/codex.log"
|
|
26
|
+
LAST="$OUTPUT/last-message.md"
|
|
27
|
+
trap 'rm -rf "$ISO_HOME" "$AUDIT_WORK"' EXIT
|
|
28
|
+
|
|
29
|
+
command -v codex >/dev/null 2>&1 || { echo "codex CLI not found" >&2; exit 2; }
|
|
30
|
+
REAL_CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
|
|
31
|
+
mkdir -p "$ISO_CODEX_HOME/skills"
|
|
32
|
+
[ -f "$REAL_CODEX_HOME/auth.json" ] && cp "$REAL_CODEX_HOME/auth.json" "$ISO_CODEX_HOME/auth.json"
|
|
33
|
+
[ -f "$REAL_CODEX_HOME/config.toml" ] && cp "$REAL_CODEX_HOME/config.toml" "$ISO_CODEX_HOME/config.toml"
|
|
34
|
+
cp -R "$SKILL_DIR" "$ISO_CODEX_HOME/skills/godaudits"
|
|
35
|
+
mkdir -p "$OUTPUT"
|
|
36
|
+
mkdir -p "$AUDIT_REPOSITORY"
|
|
37
|
+
cp -R "$REPOSITORY/." "$AUDIT_REPOSITORY/"
|
|
38
|
+
|
|
39
|
+
MODEL="${GODPLANS_OUTCOME_AUDIT_MODEL:-configured-default}"
|
|
40
|
+
EFFORT="${GODPLANS_OUTCOME_AUDIT_EFFORT:-high}"
|
|
41
|
+
RESOLVED_MODEL=$MODEL
|
|
42
|
+
if [ "$RESOLVED_MODEL" = "configured-default" ] && [ -f "$REAL_CODEX_HOME/config.toml" ]; then
|
|
43
|
+
RESOLVED_MODEL=$(awk -F= '/^[[:space:]]*model[[:space:]]*=/ { value=$2; gsub(/[[:space:]"]/, "", value); print value; exit }' "$REAL_CODEX_HOME/config.toml")
|
|
44
|
+
RESOLVED_MODEL=${RESOLVED_MODEL:-unavailable}
|
|
45
|
+
fi
|
|
46
|
+
ARGS=(
|
|
47
|
+
exec
|
|
48
|
+
--ephemeral
|
|
49
|
+
--sandbox workspace-write
|
|
50
|
+
--skip-git-repo-check
|
|
51
|
+
--color never
|
|
52
|
+
--json
|
|
53
|
+
-C "$AUDIT_REPOSITORY"
|
|
54
|
+
-o "$LAST"
|
|
55
|
+
)
|
|
56
|
+
if [ "$MODEL" != "configured-default" ]; then ARGS+=(-m "$MODEL"); fi
|
|
57
|
+
if [ "$EFFORT" != "configured-default" ]; then ARGS+=(-c "model_reasoning_effort=\"$EFFORT\""); fi
|
|
58
|
+
|
|
59
|
+
set +e
|
|
60
|
+
{
|
|
61
|
+
printf '%s\n' 'Use the installed godaudits skill to run a complete fresh static audit of this repository.'
|
|
62
|
+
printf '%s\n' 'Do not run the application, tests, network requests, or model calls from the audited project.'
|
|
63
|
+
printf '%s\n' 'The repository contains no input plan and no treatment or control label. Audit only the built artifact.'
|
|
64
|
+
printf '%s\n' 'Emit validated .godaudits/AUDIT.json and .godaudits/AUDIT.mdx.'
|
|
65
|
+
} | HOME="$ISO_HOME" CODEX_HOME="$ISO_CODEX_HOME" codex "${ARGS[@]}" - >"$EVENTS" 2>"$LOG"
|
|
66
|
+
STATUS=$?
|
|
67
|
+
set -e
|
|
68
|
+
[ "$STATUS" -eq 0 ] || { tail -n 40 "$LOG" >&2; exit "$STATUS"; }
|
|
69
|
+
|
|
70
|
+
[ -s "$AUDIT_REPOSITORY/.godaudits/AUDIT.json" ] || { echo "godaudits did not emit AUDIT.json" >&2; exit 1; }
|
|
71
|
+
[ -s "$AUDIT_REPOSITORY/.godaudits/AUDIT.mdx" ] || { echo "godaudits did not emit AUDIT.mdx" >&2; exit 1; }
|
|
72
|
+
cp "$AUDIT_REPOSITORY/.godaudits/AUDIT.json" "$OUTPUT/AUDIT.json"
|
|
73
|
+
cp "$AUDIT_REPOSITORY/.godaudits/AUDIT.mdx" "$OUTPUT/AUDIT.mdx"
|
|
74
|
+
|
|
75
|
+
printf '%s\n' \
|
|
76
|
+
"runner=codex-godaudits" \
|
|
77
|
+
"capability=static" \
|
|
78
|
+
"arm_identity=hidden" \
|
|
79
|
+
"godaudits_version=$(awk -F'\"' '/^ version:/ { print $2; exit }' "$SKILL_DIR/SKILL.md")" \
|
|
80
|
+
"codex_version=$(codex --version)" \
|
|
81
|
+
"model=$MODEL" \
|
|
82
|
+
"resolved_model=$RESOLVED_MODEL" \
|
|
83
|
+
"reasoning_effort=$EFFORT" \
|
|
84
|
+
> "$OUTPUT/RUNNER.txt"
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run one behavioral case with the locally authenticated Codex CLI.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
[ $# -eq 2 ] || { echo "usage: $0 REQUEST.md OUTPUT" >&2; exit 2; }
|
|
7
|
+
|
|
8
|
+
REQUEST=$1
|
|
9
|
+
OUTPUT=$2
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
11
|
+
CASE_DIR="$(cd "$(dirname "$REQUEST")" && pwd)"
|
|
12
|
+
WORK="$(mktemp -d)"
|
|
13
|
+
ISO_HOME="$(mktemp -d)"
|
|
14
|
+
ISO_CODEX_HOME="$ISO_HOME/.codex"
|
|
15
|
+
LAST="$WORK/last-message.md"
|
|
16
|
+
OUTPUT_DIR="$(dirname "$OUTPUT")"
|
|
17
|
+
CODEX_LOG="$OUTPUT_DIR/codex.log"
|
|
18
|
+
CODEX_EVENTS="$OUTPUT_DIR/codex-events.jsonl"
|
|
19
|
+
trap 'rm -rf "$WORK" "$ISO_HOME"' EXIT
|
|
20
|
+
|
|
21
|
+
command -v codex >/dev/null 2>&1 || { echo "codex CLI not found" >&2; exit 2; }
|
|
22
|
+
|
|
23
|
+
# Isolate the globally installed skill set. Codex discovers skills in
|
|
24
|
+
# $CODEX_HOME/skills and $HOME/.agents/skills as well as the project, so on a
|
|
25
|
+
# machine with godplans (or its sibling skills) installed globally, both arms
|
|
26
|
+
# would silently load them and the comparison would measure nothing. Both
|
|
27
|
+
# runners isolate identically; the only isolation difference between arms is
|
|
28
|
+
# the project-local skill link below (the control also reads the neutral
|
|
29
|
+
# REQUEST.baseline.md). Auth and settings are copied so the arms share one
|
|
30
|
+
# model and one reasoning effort.
|
|
31
|
+
REAL_CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
|
|
32
|
+
mkdir -p "$ISO_CODEX_HOME"
|
|
33
|
+
[ -f "$REAL_CODEX_HOME/auth.json" ] && cp "$REAL_CODEX_HOME/auth.json" "$ISO_CODEX_HOME/auth.json"
|
|
34
|
+
[ -f "$REAL_CODEX_HOME/config.toml" ] && cp "$REAL_CODEX_HOME/config.toml" "$ISO_CODEX_HOME/config.toml"
|
|
35
|
+
[ -e "$ISO_CODEX_HOME/skills" ] && { echo "isolated CODEX_HOME must not carry skills" >&2; exit 2; }
|
|
36
|
+
|
|
37
|
+
CODEX_MODEL=${GODPLANS_EVAL_MODEL:-configured-default}
|
|
38
|
+
CODEX_EFFORT=${GODPLANS_EVAL_REASONING_EFFORT:-configured-default}
|
|
39
|
+
RESOLVED_MODEL=$CODEX_MODEL
|
|
40
|
+
if [ "$RESOLVED_MODEL" = "configured-default" ] && [ -f "$REAL_CODEX_HOME/config.toml" ]; then
|
|
41
|
+
RESOLVED_MODEL=$(awk -F= '/^[[:space:]]*model[[:space:]]*=/ { value=$2; gsub(/[[:space:]"]/, "", value); print value; exit }' "$REAL_CODEX_HOME/config.toml")
|
|
42
|
+
RESOLVED_MODEL=${RESOLVED_MODEL:-unavailable}
|
|
43
|
+
fi
|
|
44
|
+
CODEX_ARGS=(
|
|
45
|
+
exec
|
|
46
|
+
--ephemeral
|
|
47
|
+
--sandbox workspace-write
|
|
48
|
+
--skip-git-repo-check
|
|
49
|
+
--color never
|
|
50
|
+
--json
|
|
51
|
+
-C "$WORK"
|
|
52
|
+
-o "$LAST"
|
|
53
|
+
)
|
|
54
|
+
if [ "$CODEX_MODEL" != "configured-default" ]; then
|
|
55
|
+
CODEX_ARGS+=(-m "$CODEX_MODEL")
|
|
56
|
+
fi
|
|
57
|
+
if [ "$CODEX_EFFORT" != "configured-default" ]; then
|
|
58
|
+
CODEX_ARGS+=(-c "model_reasoning_effort=\"$CODEX_EFFORT\"")
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [ -d "$CASE_DIR/INPUT" ]; then
|
|
62
|
+
cp -R "$CASE_DIR/INPUT/." "$WORK/"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
mkdir -p "$WORK/.agents/skills"
|
|
66
|
+
ln -s "$ROOT/skills/godplans" "$WORK/.agents/skills/godplans"
|
|
67
|
+
mkdir -p "$OUTPUT_DIR"
|
|
68
|
+
|
|
69
|
+
set +e
|
|
70
|
+
{
|
|
71
|
+
printf '%s\n\n' 'Use the project-local godplans skill for the following evaluation request.'
|
|
72
|
+
printf '%s\n' 'Work entirely inside the current workspace. Do not implement application code.'
|
|
73
|
+
printf '%s\n\n' 'For a plan outcome, emit the complete godplans artifact set under .godplans/. For a compliance hard stop, explain the refusal in the final response and do not create a plan.'
|
|
74
|
+
sed -n '1,$p' "$REQUEST"
|
|
75
|
+
} | HOME="$ISO_HOME" CODEX_HOME="$ISO_CODEX_HOME" codex "${CODEX_ARGS[@]}" - >"$CODEX_EVENTS" 2>"$CODEX_LOG"
|
|
76
|
+
CODEX_STATUS=$?
|
|
77
|
+
set -e
|
|
78
|
+
if [ "$CODEX_STATUS" -ne 0 ]; then
|
|
79
|
+
tail -n 40 "$CODEX_LOG" >&2
|
|
80
|
+
exit "$CODEX_STATUS"
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
printf '%s\n' \
|
|
84
|
+
"runner=codex" \
|
|
85
|
+
"arm=skill" \
|
|
86
|
+
"global_skills=isolated" \
|
|
87
|
+
"codex_version=$(codex --version)" \
|
|
88
|
+
"model=$CODEX_MODEL" \
|
|
89
|
+
"resolved_model=$RESOLVED_MODEL" \
|
|
90
|
+
"reasoning_effort=$CODEX_EFFORT" \
|
|
91
|
+
> "$OUTPUT_DIR/RUNNER.txt"
|
|
92
|
+
node - "$CODEX_EVENTS" >> "$OUTPUT_DIR/RUNNER.txt" <<'NODE'
|
|
93
|
+
const fs = require('node:fs');
|
|
94
|
+
let input = 0;
|
|
95
|
+
let cached = 0;
|
|
96
|
+
let output = 0;
|
|
97
|
+
let found = false;
|
|
98
|
+
for (const line of fs.readFileSync(process.argv[2], 'utf8').split('\n')) {
|
|
99
|
+
if (!line.trim()) continue;
|
|
100
|
+
let event;
|
|
101
|
+
try { event = JSON.parse(line); } catch { continue; }
|
|
102
|
+
if (!event.usage) continue;
|
|
103
|
+
found = true;
|
|
104
|
+
input += Number(event.usage.input_tokens || 0);
|
|
105
|
+
cached += Number(event.usage.cached_input_tokens || 0);
|
|
106
|
+
output += Number(event.usage.output_tokens || 0);
|
|
107
|
+
}
|
|
108
|
+
process.stdout.write(`usage_source=${found ? 'cli-json' : 'unavailable'}\n`);
|
|
109
|
+
process.stdout.write(`input_tokens=${input}\n`);
|
|
110
|
+
process.stdout.write(`cached_input_tokens=${cached}\n`);
|
|
111
|
+
process.stdout.write(`output_tokens=${output}\n`);
|
|
112
|
+
process.stdout.write(`total_tokens=${input + output}\n`);
|
|
113
|
+
NODE
|
|
114
|
+
case "$OUTPUT" in
|
|
115
|
+
*/PLAN.mdx)
|
|
116
|
+
[ -s "$WORK/.godplans/PLAN.mdx" ] || { echo "Codex did not emit PLAN.mdx" >&2; exit 1; }
|
|
117
|
+
[ -x "$WORK/.godplans/validate-plan.sh" ] || { echo "Codex did not emit an executable validator" >&2; exit 1; }
|
|
118
|
+
[ -s "$WORK/.godplans/PLAN.json" ] || { echo "Codex did not emit PLAN.json" >&2; exit 1; }
|
|
119
|
+
cmp -s "$ROOT/skills/godplans/scripts/validate-plan.sh" "$WORK/.godplans/validate-plan.sh" || {
|
|
120
|
+
echo "Codex emitted a validator that differs from the shipped source" >&2
|
|
121
|
+
exit 1
|
|
122
|
+
}
|
|
123
|
+
node -e '
|
|
124
|
+
const fs = require("node:fs");
|
|
125
|
+
const crypto = require("node:crypto");
|
|
126
|
+
const plan = fs.readFileSync(process.argv[1]);
|
|
127
|
+
const sidecar = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
128
|
+
const digest = "sha256:" + crypto.createHash("sha256").update(plan).digest("hex");
|
|
129
|
+
if (sidecar.plan_digest !== digest) process.exit(1);
|
|
130
|
+
' "$WORK/.godplans/PLAN.mdx" "$WORK/.godplans/PLAN.json" || {
|
|
131
|
+
echo "Codex emitted a stale PLAN.json sidecar" >&2
|
|
132
|
+
exit 1
|
|
133
|
+
}
|
|
134
|
+
cp "$WORK/.godplans/PLAN.mdx" "$OUTPUT"
|
|
135
|
+
cp "$WORK/.godplans/validate-plan.sh" "$(dirname "$OUTPUT")/validate-plan.sh"
|
|
136
|
+
cp "$WORK/.godplans/PLAN.json" "$(dirname "$OUTPUT")/PLAN.json"
|
|
137
|
+
;;
|
|
138
|
+
*/RESPONSE.md)
|
|
139
|
+
[ ! -e "$WORK/.godplans/PLAN.mdx" ] || { echo "Codex emitted a plan for a refusal case" >&2; exit 1; }
|
|
140
|
+
[ -s "$LAST" ] || { echo "Codex returned an empty refusal" >&2; exit 1; }
|
|
141
|
+
cp "$LAST" "$OUTPUT"
|
|
142
|
+
;;
|
|
143
|
+
*)
|
|
144
|
+
echo "unsupported output path: $OUTPUT" >&2
|
|
145
|
+
exit 2
|
|
146
|
+
;;
|
|
147
|
+
esac
|