rungate 0.2.0 → 0.3.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/bin/rungate.ts +70 -0
- package/lib/aes-calculator.ts +66 -0
- package/lib/agent-audit.ts +139 -0
- package/lib/agent-brief-validation.ts +359 -0
- package/lib/agents-md-refs.ts +90 -0
- package/lib/bash-file-read.ts +197 -0
- package/lib/behavioral-cache.ts +78 -0
- package/lib/branch-cleanup.ts +234 -0
- package/lib/brief-context-parser.ts +35 -0
- package/lib/canary.ts +117 -0
- package/lib/check-registry.ts +226 -0
- package/lib/ci-checkout.ts +400 -0
- package/lib/cli-commands.ts +137 -0
- package/lib/compliance-backfill.ts +220 -0
- package/lib/compliance-report.ts +504 -0
- package/lib/compliance.ts +361 -0
- package/lib/config-loader.ts +255 -0
- package/lib/conformity.ts +1818 -131
- package/lib/container-provenance.ts +230 -0
- package/lib/create-brief.ts +150 -0
- package/lib/create-sc.ts +272 -0
- package/lib/deep-merge.ts +69 -0
- package/lib/dev-liveness.ts +214 -0
- package/lib/directive-extractor.ts +210 -0
- package/lib/distribution-standing.ts +113 -0
- package/lib/doc-hygiene.ts +238 -0
- package/lib/eval-criteria.ts +6 -0
- package/lib/evidence-portability.ts +123 -0
- package/lib/evidence-prevalidator.ts +390 -0
- package/lib/evidence-required.ts +150 -0
- package/lib/evidence-satisfiability.ts +288 -0
- package/lib/frontmatter.ts +163 -0
- package/lib/gap-scanner.ts +348 -0
- package/lib/gate-enforcement.ts +366 -0
- package/lib/generators/agent-briefs.ts +136 -0
- package/lib/generators/agents-md.ts +506 -0
- package/lib/generators/code-map.ts +60 -0
- package/lib/generators/types.ts +184 -0
- package/lib/git-ref-normalizer.ts +107 -0
- package/lib/github.ts +539 -0
- package/lib/harness-identity.ts +63 -0
- package/lib/hill-climb.ts +164 -0
- package/lib/instruction-effectiveness.ts +131 -0
- package/lib/issue-closure-audit.ts +225 -0
- package/lib/issue-create-override.ts +343 -0
- package/lib/js-top-level-code.ts +250 -0
- package/lib/liveness-contradiction.ts +149 -0
- package/lib/organize.ts +505 -0
- package/lib/paths.ts +197 -6
- package/lib/post-fix-verify.ts +157 -0
- package/lib/prior-branch.ts +489 -0
- package/lib/project-state-shape.ts +166 -0
- package/lib/promote-outputs.ts +156 -0
- package/lib/prove-label-gate.ts +35 -0
- package/lib/reachability.ts +302 -0
- package/lib/release-preflight.ts +186 -0
- package/lib/rule-health-pipeline.ts +264 -0
- package/lib/rule-health-trend.ts +161 -0
- package/lib/rule-provenance.ts +149 -0
- package/lib/rule-registry.ts +128 -0
- package/lib/rungate-schema.ts +114 -4
- package/lib/sc-claim-forms.ts +179 -0
- package/lib/sc-cover.ts +150 -0
- package/lib/sc-guard.ts +157 -0
- package/lib/sc-ids.ts +344 -0
- package/lib/scaffold/defaults.ts +165 -0
- package/lib/scaffold/managed-workflow.ts +370 -0
- package/lib/scaffold/owned-files.ts +265 -0
- package/lib/scaffold/steps.ts +2680 -0
- package/lib/scanner.ts +701 -0
- package/lib/screenshot-upload.ts +73 -0
- package/lib/secret-patterns.ts +112 -0
- package/lib/security-verdict.ts +616 -0
- package/lib/signal-phrases.ts +1 -0
- package/lib/spec-change-conformity.ts +80 -0
- package/lib/spec-files.ts +62 -0
- package/lib/spec-registry.ts +133 -0
- package/lib/spec-updater.ts +96 -0
- package/lib/stale-cleanup.ts +224 -0
- package/lib/stale-issue-scanner.ts +36 -0
- package/lib/strip-js-comments.ts +269 -0
- package/lib/suite-measurement.ts +228 -0
- package/lib/task-completion-checks.ts +177 -0
- package/lib/test-suite-lock.ts +1136 -0
- package/lib/transcript-checker.ts +1140 -0
- package/lib/validators/spec-validators.ts +171 -0
- package/lib/verdict-capture.ts +73 -0
- package/lib/verified-push.ts +358 -0
- package/lib/workflow-security.ts +174 -0
- package/lib/worktree-cleanup.ts +250 -0
- package/lib/worktree-collect.ts +283 -0
- package/lib/worktree-isolation.ts +82 -0
- package/package.json +36 -3
- package/prompts/ac-adversary.md +14 -2
- package/prompts/aditi.md +5 -0
- package/prompts/blast-radius.md +5 -0
- package/prompts/container-verify.md +5 -0
- package/prompts/discovery.md +4 -0
- package/prompts/environment.md +5 -0
- package/prompts/evidence-hierarchy.md +5 -0
- package/prompts/evidence-validator.md +11 -0
- package/prompts/marcus.md +5 -0
- package/prompts/prevention.md +5 -0
- package/prompts/prove-reproducer.md +12 -0
- package/prompts/quinn-decision-tree.md +5 -0
- package/prompts/quinn-ui-brief.md +5 -0
- package/prompts/quinn.md +5 -0
- package/prompts/rca.md +5 -0
- package/prompts/read-before-write.md +4 -0
- package/prompts/regression.md +5 -0
- package/prompts/serena.md +5 -0
- package/scripts/audit-specs.ts +464 -0
- package/scripts/convert-spec.ts +293 -0
- package/scripts/create-sc.ts +92 -0
- package/scripts/create-spec.ts +166 -0
- package/scripts/extract-constraints.ts +4 -3
- package/scripts/generate-code-map.ts +1 -1
- package/scripts/scaffold-project.ts +138 -1426
- package/scripts/sync-spec-tests.ts +211 -126
- 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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
PROJECT_ROOT="${1:-.}"
|
|
5
|
-
SRC_DIR="$PROJECT_ROOT/src"
|
|
6
|
-
|
|
7
|
-
if [[ ! -d "$SRC_DIR" ]]; then
|
|
8
|
-
echo "No src/ directory found at $PROJECT_ROOT"
|
|
9
|
-
exit 0
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
dead_count=0
|
|
13
|
-
dead_list=()
|
|
14
|
-
|
|
15
|
-
ts_files=$(find "$SRC_DIR" \( -name '*.ts' -o -name '*.tsx' \) \
|
|
16
|
-
! -name '*.d.ts' ! -name '*.test.*' ! -name '*.spec.*' | sort)
|
|
17
|
-
|
|
18
|
-
while IFS= read -r file; do
|
|
19
|
-
[[ -z "$file" ]] && continue
|
|
20
|
-
|
|
21
|
-
basename_file=$(basename "$file")
|
|
22
|
-
# Skip barrel files — they re-export, not consume
|
|
23
|
-
[[ "$basename_file" == "index.ts" || "$basename_file" == "index.tsx" ]] && continue
|
|
24
|
-
|
|
25
|
-
rel_file="${file#$PROJECT_ROOT/}"
|
|
26
|
-
|
|
27
|
-
while IFS= read -r name; do
|
|
28
|
-
[[ -z "$name" ]] && continue
|
|
29
|
-
# Skip short names (single char) — too many false positives from grep
|
|
30
|
-
[[ ${#name} -lt 2 ]] && continue
|
|
31
|
-
|
|
32
|
-
import_count=$(grep -rl --include='*.ts' --include='*.tsx' \
|
|
33
|
-
-e "import.*[{ ,]${name}[} ,]" \
|
|
34
|
-
-e "import ${name} " \
|
|
35
|
-
-e "import ${name}," \
|
|
36
|
-
"$SRC_DIR" 2>/dev/null \
|
|
37
|
-
| grep -v "$file" \
|
|
38
|
-
| grep -v '\.d\.ts' \
|
|
39
|
-
| wc -l | tr -d ' ')
|
|
40
|
-
|
|
41
|
-
if [[ "$import_count" -eq 0 ]]; then
|
|
42
|
-
dead_count=$((dead_count + 1))
|
|
43
|
-
dead_list+=("$rel_file: $name")
|
|
44
|
-
fi
|
|
45
|
-
done < <(
|
|
46
|
-
grep -oE 'export (function|const|class|interface|type|enum) ([A-Za-z_][A-Za-z0-9_]*)' "$file" 2>/dev/null \
|
|
47
|
-
| sed 's/export [a-z]* //'
|
|
48
|
-
grep -oE 'export \{ *([A-Za-z_][A-Za-z0-9_]*)' "$file" 2>/dev/null \
|
|
49
|
-
| sed 's/export { *//'
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
done <<< "$ts_files"
|
|
53
|
-
|
|
54
|
-
if [[ $dead_count -gt 0 ]]; then
|
|
55
|
-
echo "DEAD EXPORTS: $dead_count found"
|
|
56
|
-
printf '%s\n' "${dead_list[@]}"
|
|
57
|
-
exit 1
|
|
58
|
-
else
|
|
59
|
-
echo "No dead exports found"
|
|
60
|
-
exit 0
|
|
61
|
-
fi
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# generate-qc-tables.sh — Generate QC spec tables from skill-qc-checks.json
|
|
3
|
-
# Usage: bash scripts/generate-qc-tables.sh [--skill SKILL]
|
|
4
|
-
# Output goes to stdout. Redirect to update spec:
|
|
5
|
-
# bash scripts/generate-qc-tables.sh --skill prove > /tmp/prove-table.md
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
CONFIG="$(cd "$(dirname "$0")/.." && pwd)/schemas/skill-qc-checks.json"
|
|
9
|
-
[[ -f "$CONFIG" ]] || { echo "ERROR: $CONFIG not found" >&2; exit 1; }
|
|
10
|
-
|
|
11
|
-
SKILL_FILTER=""
|
|
12
|
-
while [[ $# -gt 0 ]]; do
|
|
13
|
-
case "$1" in
|
|
14
|
-
--skill) SKILL_FILTER="$2"; shift 2 ;;
|
|
15
|
-
*) echo "Usage: $0 [--skill SKILL]" >&2; exit 1 ;;
|
|
16
|
-
esac
|
|
17
|
-
done
|
|
18
|
-
|
|
19
|
-
# Validate skill filter if provided
|
|
20
|
-
if [[ -n "$SKILL_FILTER" ]]; then
|
|
21
|
-
if ! jq -e --arg s "$SKILL_FILTER" '[.checks[].skill] | unique | index($s)' "$CONFIG" > /dev/null 2>&1; then
|
|
22
|
-
echo "ERROR: Unknown skill '$SKILL_FILTER'. Available: $(jq -r '[.checks[].skill] | unique | join(", ")' "$CONFIG")" >&2
|
|
23
|
-
exit 1
|
|
24
|
-
fi
|
|
25
|
-
SKILLS="$SKILL_FILTER"
|
|
26
|
-
else
|
|
27
|
-
SKILLS=$(jq -r '[.checks[].skill] | unique | .[]' "$CONFIG")
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# jq program in temp file — avoids shell quoting issues with single quotes
|
|
31
|
-
JQ_PROG=$(mktemp)
|
|
32
|
-
trap 'rm -f "$JQ_PROG"' EXIT
|
|
33
|
-
|
|
34
|
-
cat > "$JQ_PROG" << 'JQEOF'
|
|
35
|
-
def expect_text:
|
|
36
|
-
if .expect == null then ""
|
|
37
|
-
elif .expect.op == ">=" then " >= \(.expect.value)"
|
|
38
|
-
elif .expect.op == "==" then " == \(.expect.value)"
|
|
39
|
-
elif .expect.op == "exit-0" then " exits 0"
|
|
40
|
-
elif .expect.op == "non-empty" then " returns non-empty"
|
|
41
|
-
elif .expect.op == "contains" then " contains \(.expect.value)"
|
|
42
|
-
elif .expect.op == "not-null" then " returns non-null"
|
|
43
|
-
elif .expect.op == "length-gte" then " length >= \(.expect.value)"
|
|
44
|
-
else ""
|
|
45
|
-
end;
|
|
46
|
-
|
|
47
|
-
def verify_col:
|
|
48
|
-
if .type == "command" then
|
|
49
|
-
("`" + .command + "`" + expect_text)
|
|
50
|
-
elif .type == "jq" then
|
|
51
|
-
("`jq '" + .query + "' " + .source + "`" + expect_text)
|
|
52
|
-
elif .type == "jq-count" then
|
|
53
|
-
("`jq '" + .query + " | length' " + .source + "`" + expect_text)
|
|
54
|
-
elif .type == "jq-each" then
|
|
55
|
-
("Each `" + .query + "` " + (.test // "validates")
|
|
56
|
-
+ if .enum then " [" + (.enum | join(", ")) + "]" else "" end)
|
|
57
|
-
elif .type == "computed" then
|
|
58
|
-
("`" + .jq_test + "`")
|
|
59
|
-
else
|
|
60
|
-
"see check definition"
|
|
61
|
-
end;
|
|
62
|
-
|
|
63
|
-
.checks[] | select(.skill == $skill) |
|
|
64
|
-
[.id, .description, verify_col, (.severity // "FAIL")] | @tsv
|
|
65
|
-
JQEOF
|
|
66
|
-
|
|
67
|
-
for skill in $SKILLS; do
|
|
68
|
-
echo ""
|
|
69
|
-
echo "## /$skill"
|
|
70
|
-
echo ""
|
|
71
|
-
|
|
72
|
-
if [[ "$skill" == "prove" ]]; then
|
|
73
|
-
echo "| # | Criterion | Verify | Severity |"
|
|
74
|
-
echo "|---|---|---|---|"
|
|
75
|
-
else
|
|
76
|
-
echo "| # | Criterion | Verify |"
|
|
77
|
-
echo "|---|---|---|"
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
# Generate rows: jq outputs TSV, bash formats as markdown
|
|
81
|
-
jq -r --arg skill "$skill" -f "$JQ_PROG" "$CONFIG" | while IFS=$'\t' read -r id desc verify severity; do
|
|
82
|
-
# Escape pipes in verify column for markdown table compatibility
|
|
83
|
-
verify="${verify//|/\\|}"
|
|
84
|
-
if [[ "$skill" == "prove" ]]; then
|
|
85
|
-
printf '| %s | %s | %s | %s |\n' "$id" "$desc" "$verify" "$severity"
|
|
86
|
-
else
|
|
87
|
-
printf '| %s | %s | %s |\n' "$id" "$desc" "$verify"
|
|
88
|
-
fi
|
|
89
|
-
done
|
|
90
|
-
|
|
91
|
-
echo ""
|
|
92
|
-
done
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# harness-init.sh — Scaffold Bun gate harness into any project
|
|
3
|
-
# Usage: bash ~/.claude/scripts/harness-init.sh [project-root]
|
|
4
|
-
#
|
|
5
|
-
# Creates: gates/, .claude/agents/, wires SubagentStop hook
|
|
6
|
-
# Idempotent — safe to re-run (skips existing files)
|
|
7
|
-
|
|
8
|
-
set -euo pipefail
|
|
9
|
-
|
|
10
|
-
PROJECT_ROOT="${1:-.}"
|
|
11
|
-
PROJECT_ROOT="$(cd "$PROJECT_ROOT" && pwd)"
|
|
12
|
-
TEMPLATE_DIR="$HOME/.claude/gates"
|
|
13
|
-
|
|
14
|
-
echo "═══ Harness v3 Init ═══"
|
|
15
|
-
echo "Project: $PROJECT_ROOT"
|
|
16
|
-
echo ""
|
|
17
|
-
|
|
18
|
-
# ── gates/ ──────────────────────────────────────────────────
|
|
19
|
-
mkdir -p "$PROJECT_ROOT/gates"
|
|
20
|
-
|
|
21
|
-
for f in schema.ts workflow.test.ts e2e-smoke.test.ts chain.test.ts prove.test.ts preload.ts bunfig.toml; do
|
|
22
|
-
src="$TEMPLATE_DIR/$f"
|
|
23
|
-
dst="$PROJECT_ROOT/gates/$f"
|
|
24
|
-
if [[ -f "$dst" ]]; then
|
|
25
|
-
echo " SKIP gates/$f (exists)"
|
|
26
|
-
elif [[ -f "$src" ]]; then
|
|
27
|
-
cp "$src" "$dst"
|
|
28
|
-
echo " CREATE gates/$f"
|
|
29
|
-
else
|
|
30
|
-
echo " MISS gates/$f (template not found at $src)"
|
|
31
|
-
fi
|
|
32
|
-
done
|
|
33
|
-
|
|
34
|
-
# No executables to chmod — all Bun files
|
|
35
|
-
|
|
36
|
-
# ── .claude/agents/ ─────────────────────────────────────────
|
|
37
|
-
mkdir -p "$PROJECT_ROOT/.claude/agents"
|
|
38
|
-
|
|
39
|
-
for agent in marcus quinn rook aditi serena; do
|
|
40
|
-
dst="$PROJECT_ROOT/.claude/agents/$agent.md"
|
|
41
|
-
src="$HOME/.claude/templates/harness-v3/agents/$agent.md"
|
|
42
|
-
if [[ -f "$dst" ]]; then
|
|
43
|
-
echo " SKIP .claude/agents/$agent.md (exists)"
|
|
44
|
-
elif [[ -f "$src" ]]; then
|
|
45
|
-
cp "$src" "$dst"
|
|
46
|
-
echo " CREATE .claude/agents/$agent.md"
|
|
47
|
-
else
|
|
48
|
-
echo " STUB .claude/agents/$agent.md"
|
|
49
|
-
printf -- "---\nname: %s\nmode: bypassPermissions\n---\n\nRead project docs before starting work.\n" "$agent" > "$dst"
|
|
50
|
-
fi
|
|
51
|
-
done
|
|
52
|
-
|
|
53
|
-
# ── .claude/settings.json (SubagentStop hook) ───────────────
|
|
54
|
-
SETTINGS="$PROJECT_ROOT/.claude/settings.json"
|
|
55
|
-
if [[ -f "$SETTINGS" ]]; then
|
|
56
|
-
if grep -q 'SubagentStop' "$SETTINGS"; then
|
|
57
|
-
echo " SKIP SubagentStop hook (already wired)"
|
|
58
|
-
else
|
|
59
|
-
echo " NOTE: .claude/settings.json exists but no SubagentStop hook."
|
|
60
|
-
echo " Add manually:"
|
|
61
|
-
echo ' "SubagentStop": [{"type":"command","command":"cd \"$CLAUDE_PROJECT_DIR\" && bun test --bail --config gates/bunfig.toml gates/ 2>&1 || true"}]'
|
|
62
|
-
fi
|
|
63
|
-
else
|
|
64
|
-
echo " CREATE .claude/settings.json"
|
|
65
|
-
cat > "$SETTINGS" << 'SETTINGSEOF'
|
|
66
|
-
{
|
|
67
|
-
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
68
|
-
"hooks": {
|
|
69
|
-
"SubagentStop": [
|
|
70
|
-
{
|
|
71
|
-
"type": "command",
|
|
72
|
-
"command": "cd \"$CLAUDE_PROJECT_DIR\" && bun test --bail --config gates/bunfig.toml gates/workflow.test.ts gates/e2e-smoke.test.ts 2>&1 || true"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"permissions": {
|
|
77
|
-
"allow": [
|
|
78
|
-
"Bash", "Read", "Write", "Edit", "Agent", "Skill",
|
|
79
|
-
"TaskCreate", "TaskUpdate", "TaskList", "SendMessage",
|
|
80
|
-
"WebFetch", "WebSearch", "mcp__*"
|
|
81
|
-
],
|
|
82
|
-
"deny": [],
|
|
83
|
-
"defaultMode": "bypassPermissions"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
SETTINGSEOF
|
|
87
|
-
fi
|
|
88
|
-
|
|
89
|
-
# ── Verify zod dependency ──────────────────────────────────
|
|
90
|
-
if [[ -f "$PROJECT_ROOT/package.json" ]]; then
|
|
91
|
-
if ! grep -q '"zod"' "$PROJECT_ROOT/package.json"; then
|
|
92
|
-
echo ""
|
|
93
|
-
echo " ⚠ zod not in package.json — run: cd $PROJECT_ROOT && bun add -d zod"
|
|
94
|
-
fi
|
|
95
|
-
else
|
|
96
|
-
echo ""
|
|
97
|
-
echo " ⚠ No package.json — run: cd $PROJECT_ROOT && bun init -y && bun add -d zod"
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
# ── Summary ────────────────────────────────────────────────
|
|
101
|
-
echo ""
|
|
102
|
-
echo "═══ Done ═══"
|
|
103
|
-
echo ""
|
|
104
|
-
echo "Files:"
|
|
105
|
-
find "$PROJECT_ROOT/gates" -type f | sort | while read f; do echo " ${f#$PROJECT_ROOT/}"; done
|
|
106
|
-
find "$PROJECT_ROOT/.claude/agents" -type f | sort | while read f; do echo " ${f#$PROJECT_ROOT/}"; done
|
|
107
|
-
echo " .claude/settings.json"
|
|
108
|
-
echo ""
|
|
109
|
-
echo "Verify: cd $PROJECT_ROOT && bun test gates/workflow.test.ts"
|
|
110
|
-
echo ""
|
|
111
|
-
echo "Next: create a workflow-state.json in ~/.rungate/{slug}/ and run gates."
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# PAI-054 Baseline Review — runs 2026-04-29
|
|
3
|
-
# Checks sessions.jsonl for sufficient baseline data before PAI-060 ships
|
|
4
|
-
# Scheduled by: PAI sprint 2026-04-23
|
|
5
|
-
|
|
6
|
-
SESSIONS_FILE="$HOME/.claude/MEMORY/LEARNING/SIGNALS/sessions.jsonl"
|
|
7
|
-
PENDING_FILE="$HOME/.claude/MEMORY/LEARNING/PENDING-RULES.md"
|
|
8
|
-
|
|
9
|
-
if [ ! -f "$SESSIONS_FILE" ]; then
|
|
10
|
-
echo "[PAI-054-check] sessions.jsonl not found — hook may not have fired yet" >> "$HOME/.claude/scripts/baseline-check.log"
|
|
11
|
-
# Write notification to pending file
|
|
12
|
-
cat >> "$PENDING_FILE" << 'EOF'
|
|
13
|
-
|
|
14
|
-
## PAI-054 Baseline Review — 2026-04-29
|
|
15
|
-
**Status:** FAIL — sessions.jsonl missing. SentimentScorer hook may not have fired.
|
|
16
|
-
**Action:** Check if SentimentScorer.hook.ts is wired in settings.json. Run a test session and verify sessions.jsonl appears.
|
|
17
|
-
EOF
|
|
18
|
-
exit 0
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
ROW_COUNT=$(wc -l < "$SESSIONS_FILE" | tr -d ' ')
|
|
22
|
-
FIRST_DATE=$(head -1 "$SESSIONS_FILE" | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('timestamp','?')[:10])" 2>/dev/null)
|
|
23
|
-
LAST_DATE=$(tail -1 "$SESSIONS_FILE" | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('timestamp','?')[:10])" 2>/dev/null)
|
|
24
|
-
|
|
25
|
-
echo "[PAI-054-check] rows=$ROW_COUNT first=$FIRST_DATE last=$LAST_DATE" >> "$HOME/.claude/scripts/baseline-check.log"
|
|
26
|
-
|
|
27
|
-
# Write review summary to PENDING-RULES.md for next session pickup
|
|
28
|
-
cat >> "$PENDING_FILE" << EOF
|
|
29
|
-
|
|
30
|
-
## PAI-054 Baseline Review — $(date +%Y-%m-%d)
|
|
31
|
-
**Status:** $ROW_COUNT sessions collected | $FIRST_DATE → $LAST_DATE
|
|
32
|
-
**Threshold:** 5+ days, 10+ sessions for migration review gate
|
|
33
|
-
**Action needed:** If threshold met — run schema migration review, then clear PAI-060 to ship.
|
|
34
|
-
Run: \`tail -5 ~/.claude/MEMORY/LEARNING/SIGNALS/sessions.jsonl\` to inspect recent records.
|
|
35
|
-
EOF
|
|
36
|
-
|
|
37
|
-
# macOS notification
|
|
38
|
-
osascript -e "display notification \"PAI-054 baseline: $ROW_COUNT sessions ($FIRST_DATE → $LAST_DATE). Check PENDING-RULES.md.\" with title \"PAI Sprint Review\"" 2>/dev/null || true
|
|
39
|
-
|
|
40
|
-
exit 0
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# prove-smoke-test.sh — Smoke tests for /prove skill artifacts
|
|
3
|
-
set -euo pipefail
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
6
|
-
SCHEMA="$SCRIPT_DIR/prove-evidence.schema.json"
|
|
7
|
-
TESTS=0 PASSED=0
|
|
8
|
-
|
|
9
|
-
pass() { PASSED=$((PASSED + 1)); TESTS=$((TESTS + 1)); echo " ✓ $1"; }
|
|
10
|
-
fail() { TESTS=$((TESTS + 1)); echo " ✗ $1"; }
|
|
11
|
-
|
|
12
|
-
echo "=== Prove Skill Smoke Tests ==="
|
|
13
|
-
echo ""
|
|
14
|
-
|
|
15
|
-
# 1. Schema file exists and is valid JSON
|
|
16
|
-
echo "1. Schema file exists and is valid JSON"
|
|
17
|
-
if [[ -f "$SCHEMA" ]] && jq empty "$SCHEMA" 2>/dev/null; then
|
|
18
|
-
pass "prove-evidence.schema.json is valid JSON"
|
|
19
|
-
else
|
|
20
|
-
fail "prove-evidence.schema.json missing or invalid"
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# 2. Schema has required fields
|
|
24
|
-
echo "2. Schema has required fields"
|
|
25
|
-
REQUIRED=$(jq -r '.required | length' "$SCHEMA" 2>/dev/null || echo 0)
|
|
26
|
-
if [[ "$REQUIRED" -ge 4 ]]; then
|
|
27
|
-
pass "schema has $REQUIRED required fields (>=4)"
|
|
28
|
-
else
|
|
29
|
-
fail "schema has $REQUIRED required fields (need >=4)"
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
# 3. Valid prove-evidence.json passes schema structure check
|
|
33
|
-
echo "3. Valid prove-evidence.json structure"
|
|
34
|
-
VALID='{"issueNumber":1229,"verdict":"PROVEN","commitSHA":"abc123","capturedAt":"2026-09-03T00:00:00Z","reproduced":true}'
|
|
35
|
-
VERDICT=$(echo "$VALID" | jq -r '.verdict' 2>/dev/null)
|
|
36
|
-
if [[ "$VERDICT" == "PROVEN" ]]; then
|
|
37
|
-
pass "valid evidence has correct verdict"
|
|
38
|
-
else
|
|
39
|
-
fail "valid evidence verdict check failed"
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# 4. Verdict enum validation
|
|
43
|
-
echo "4. Verdict enum validation"
|
|
44
|
-
for v in PROVEN UNPROVEN INCONCLUSIVE; do
|
|
45
|
-
ALLOWED=$(jq -r --arg v "$v" '.properties.verdict.enum | index($v) != null' "$SCHEMA" 2>/dev/null)
|
|
46
|
-
if [[ "$ALLOWED" == "true" ]]; then
|
|
47
|
-
pass "verdict '$v' is allowed"
|
|
48
|
-
else
|
|
49
|
-
fail "verdict '$v' not in schema enum"
|
|
50
|
-
fi
|
|
51
|
-
done
|
|
52
|
-
|
|
53
|
-
# 5. Evidence types in schema
|
|
54
|
-
echo "5. Evidence type enums"
|
|
55
|
-
BEFORE_TYPES=$(jq -r '.properties.beforeEvidence.properties.type.enum | length' "$SCHEMA" 2>/dev/null || echo 0)
|
|
56
|
-
AFTER_TYPES=$(jq -r '.properties.afterEvidence.properties.type.enum | length' "$SCHEMA" 2>/dev/null || echo 0)
|
|
57
|
-
if [[ "$BEFORE_TYPES" -ge 3 && "$AFTER_TYPES" -ge 2 ]]; then
|
|
58
|
-
pass "before has $BEFORE_TYPES types, after has $AFTER_TYPES types"
|
|
59
|
-
else
|
|
60
|
-
fail "evidence type enums incomplete (before:$BEFORE_TYPES, after:$AFTER_TYPES)"
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
# 6. Skill contract passes validator
|
|
64
|
-
echo "6. Skill contract validation"
|
|
65
|
-
CHECKER="${SCRIPT_DIR}/../../scripts/harness-skill-check.sh"
|
|
66
|
-
if [[ -f "$CHECKER" ]]; then
|
|
67
|
-
SKILL_MD="$SCRIPT_DIR/SKILL.md"
|
|
68
|
-
if bash "$CHECKER" "$SKILL_MD" > /dev/null 2>&1; then
|
|
69
|
-
pass "/prove SKILL.md passes contract check"
|
|
70
|
-
else
|
|
71
|
-
fail "/prove SKILL.md fails contract check"
|
|
72
|
-
fi
|
|
73
|
-
else
|
|
74
|
-
fail "harness-skill-check.sh not found"
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
# 7. STANDARD tier + local-only evidence → gate FAIL
|
|
78
|
-
echo "7. STANDARD tier requires prod evidence"
|
|
79
|
-
TMPDIR_T7=$(mktemp -d)
|
|
80
|
-
mkdir -p "$TMPDIR_T7"
|
|
81
|
-
echo '{"schemaVersion":2,"issue":999,"slug":"test","phase":"PROVE","issueGoal":"test","acs":[],"gates":{},"changelog":[],"sizing":{"ceremonyTier":"STANDARD"}}' > "$TMPDIR_T7/workflow-state.json"
|
|
82
|
-
HEAD_SHA=$(git rev-parse HEAD 2>/dev/null || echo "abc123")
|
|
83
|
-
echo "{\"contractVersion\":\"1.0\",\"issueNumber\":999,\"verdict\":\"PROVEN\",\"commitSHA\":\"$HEAD_SHA\",\"capturedAt\":\"2026-01-01T00:00:00Z\",\"criteriaResults\":[{\"scId\":\"SC-1\",\"verdict\":\"PASS\",\"evidence\":\"ok\"}],\"afterEvidence\":{\"environment\":\"local\"}}" > "$TMPDIR_T7/prove-evidence.json"
|
|
84
|
-
if RUNGATE_WORK_DIR="$TMPDIR_T7" bash "$SCRIPT_DIR/../ship/gate-runner.sh" --gate prove --issue 999 --slug . 2>/dev/null; then
|
|
85
|
-
fail "gate accepted local evidence at STANDARD tier"
|
|
86
|
-
else
|
|
87
|
-
pass "gate rejected local evidence at STANDARD tier"
|
|
88
|
-
fi
|
|
89
|
-
|
|
90
|
-
# 7b. Missing afterEvidence entirely → defaults to local → FAIL
|
|
91
|
-
echo "7b. Missing afterEvidence → defaults to local → FAIL"
|
|
92
|
-
echo "{\"contractVersion\":\"1.0\",\"issueNumber\":999,\"verdict\":\"PROVEN\",\"commitSHA\":\"$HEAD_SHA\",\"capturedAt\":\"2026-01-01T00:00:00Z\",\"criteriaResults\":[{\"scId\":\"SC-1\",\"verdict\":\"PASS\",\"evidence\":\"ok\"}]}" > "$TMPDIR_T7/prove-evidence.json"
|
|
93
|
-
if RUNGATE_WORK_DIR="$TMPDIR_T7" bash "$SCRIPT_DIR/../ship/gate-runner.sh" --gate prove --issue 999 --slug . 2>/dev/null; then
|
|
94
|
-
fail "gate accepted missing afterEvidence at STANDARD tier"
|
|
95
|
-
else
|
|
96
|
-
pass "gate rejected missing afterEvidence at STANDARD tier"
|
|
97
|
-
fi
|
|
98
|
-
|
|
99
|
-
# 7c. LIGHT tier + local evidence → PASS (exempted)
|
|
100
|
-
echo "7c. LIGHT tier + local evidence → PASS (exempted)"
|
|
101
|
-
echo '{"schemaVersion":2,"issue":999,"slug":"test","phase":"PROVE","issueGoal":"test","acs":[],"gates":{},"changelog":[],"sizing":{"ceremonyTier":"LIGHT"}}' > "$TMPDIR_T7/workflow-state.json"
|
|
102
|
-
echo "{\"contractVersion\":\"1.0\",\"issueNumber\":999,\"verdict\":\"PROVEN\",\"commitSHA\":\"$HEAD_SHA\",\"capturedAt\":\"2026-01-01T00:00:00Z\",\"criteriaResults\":[{\"scId\":\"SC-1\",\"verdict\":\"PASS\",\"evidence\":\"ok\"}],\"afterEvidence\":{\"environment\":\"local\"}}" > "$TMPDIR_T7/prove-evidence.json"
|
|
103
|
-
if RUNGATE_WORK_DIR="$TMPDIR_T7" bash "$SCRIPT_DIR/../ship/gate-runner.sh" --gate prove --issue 999 --slug . 2>/dev/null; then
|
|
104
|
-
pass "gate accepts local evidence at LIGHT tier"
|
|
105
|
-
else
|
|
106
|
-
fail "gate rejected local evidence at LIGHT tier"
|
|
107
|
-
fi
|
|
108
|
-
rm -rf "$TMPDIR_T7"
|
|
109
|
-
|
|
110
|
-
echo ""
|
|
111
|
-
echo "=== Results: $PASSED/$TESTS passed ==="
|
|
112
|
-
[[ $PASSED -eq $TESTS ]] && exit 0 || exit 1
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
SALT_FILE="$HOME/.claude/hooks/lib/.gate-salt"
|
|
3
|
-
if [ ! -f "$SALT_FILE" ]; then
|
|
4
|
-
echo "No salt file found. Generating new salt."
|
|
5
|
-
SALT=$(openssl rand -hex 32)
|
|
6
|
-
else
|
|
7
|
-
SALT=$(cat "$SALT_FILE")
|
|
8
|
-
fi
|
|
9
|
-
security add-generic-password -s "pai-gate-salt" -a "pai" -w "$SALT" -U 2>/dev/null || \
|
|
10
|
-
security add-generic-password -s "pai-gate-salt" -a "pai" -w "$SALT"
|
|
11
|
-
echo "Salt stored in macOS Keychain as 'pai-gate-salt'"
|
|
12
|
-
echo "You can now delete $SALT_FILE"
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# PAI Skill Optimizer — Friday run
|
|
3
|
-
# Auto-discovers all promoted skills (excluding _PROPOSED, _RATE, _DEBRIEF),
|
|
4
|
-
# builds benchmarks if missing, then optimizes each skill (5 rounds).
|
|
5
|
-
# Crontab: 15 21 * * 5 (Fridays 9:15pm)
|
|
6
|
-
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
# Cron runs with a minimal PATH — add user bin dirs so claude + bun are findable
|
|
10
|
-
export PATH="/Users/jhorn/.local/bin:/Users/jhorn/.bun/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
11
|
-
|
|
12
|
-
BUN="/Users/jhorn/.bun/bin/bun"
|
|
13
|
-
BASE="/Users/jhorn/.claude"
|
|
14
|
-
LOG="$BASE/MEMORY/LEARNING/SIGNALS/skill-optimizer.log"
|
|
15
|
-
|
|
16
|
-
echo "[$(date)] Skill optimizer starting" >> "$LOG"
|
|
17
|
-
|
|
18
|
-
cd "$BASE"
|
|
19
|
-
|
|
20
|
-
# Benchmark filename lookup — backward-compat for original skills, slug-based for new ones
|
|
21
|
-
benchmark_for_skill() {
|
|
22
|
-
local skill_name="$1"
|
|
23
|
-
case "$skill_name" in
|
|
24
|
-
debugging-and-bug-fixes) echo "skill-benchmark.json" ;;
|
|
25
|
-
dev-loop) echo "skill-benchmark-devloop.json" ;;
|
|
26
|
-
testing-and-qa-validation) echo "skill-benchmark-qa.json" ;;
|
|
27
|
-
Developer) echo "skill-benchmark-developer.json" ;;
|
|
28
|
-
*) echo "skill-benchmark-${skill_name}.json" ;;
|
|
29
|
-
esac
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
# Discover all promoted skills (directories under skills/ with a SKILL.md,
|
|
33
|
-
# excluding _PROPOSED, _RATE, _DEBRIEF, and hidden dirs)
|
|
34
|
-
SKILLS_FOUND=()
|
|
35
|
-
for skill_dir in "$BASE/skills"/*/; do
|
|
36
|
-
skill_name="$(basename "$skill_dir")"
|
|
37
|
-
# Skip excluded dirs
|
|
38
|
-
case "$skill_name" in
|
|
39
|
-
_PROPOSED|_RATE|_DEBRIEF) continue ;;
|
|
40
|
-
_*) continue ;;
|
|
41
|
-
esac
|
|
42
|
-
# Must have a SKILL.md
|
|
43
|
-
if [ ! -f "$skill_dir/SKILL.md" ]; then
|
|
44
|
-
continue
|
|
45
|
-
fi
|
|
46
|
-
SKILLS_FOUND+=("$skill_name")
|
|
47
|
-
done
|
|
48
|
-
|
|
49
|
-
echo "[$(date)] Discovered ${#SKILLS_FOUND[@]} skills: ${SKILLS_FOUND[*]}" >> "$LOG"
|
|
50
|
-
|
|
51
|
-
# Build benchmarks for any skill that lacks one
|
|
52
|
-
for skill_name in "${SKILLS_FOUND[@]}"; do
|
|
53
|
-
bench_file="$(benchmark_for_skill "$skill_name")"
|
|
54
|
-
bench_path="$BASE/MEMORY/LEARNING/STATE/$bench_file"
|
|
55
|
-
|
|
56
|
-
if [ ! -f "$bench_path" ]; then
|
|
57
|
-
echo "[$(date)] Building benchmark: $skill_name -> $bench_file" >> "$LOG"
|
|
58
|
-
"$BUN" "$BASE/PAI/Tools/SkillBenchmark.ts" \
|
|
59
|
-
--skill "$skill_name" \
|
|
60
|
-
--output "$bench_path" >> "$LOG" 2>&1 || \
|
|
61
|
-
echo "[$(date)] WARN: benchmark failed for $skill_name" >> "$LOG"
|
|
62
|
-
fi
|
|
63
|
-
done
|
|
64
|
-
|
|
65
|
-
# Optimize each skill — 5 rounds each
|
|
66
|
-
for skill_name in "${SKILLS_FOUND[@]}"; do
|
|
67
|
-
skill_path="skills/$skill_name/SKILL.md"
|
|
68
|
-
bench_file="$(benchmark_for_skill "$skill_name")"
|
|
69
|
-
benchmark_path="MEMORY/LEARNING/STATE/$bench_file"
|
|
70
|
-
|
|
71
|
-
if [ -f "$BASE/$skill_path" ] && [ -f "$BASE/$benchmark_path" ]; then
|
|
72
|
-
echo "[$(date)] Optimizing $skill_name..." >> "$LOG"
|
|
73
|
-
"$BUN" "$BASE/PAI/Tools/SkillOptimizer.ts" \
|
|
74
|
-
--skill "$skill_path" \
|
|
75
|
-
--benchmark "$benchmark_path" \
|
|
76
|
-
--rounds 5 >> "$LOG" 2>&1 || echo "[$(date)] WARN: $skill_name optimization failed" >> "$LOG"
|
|
77
|
-
else
|
|
78
|
-
echo "[$(date)] SKIP: $skill_name — missing skill or benchmark" >> "$LOG"
|
|
79
|
-
[ ! -f "$BASE/$skill_path" ] && echo "[$(date)] Missing: $BASE/$skill_path" >> "$LOG"
|
|
80
|
-
[ ! -f "$BASE/$benchmark_path" ] && echo "[$(date)] Missing: $BASE/$benchmark_path" >> "$LOG"
|
|
81
|
-
fi
|
|
82
|
-
done
|
|
83
|
-
|
|
84
|
-
# Run impact analyzer for before/after comparison
|
|
85
|
-
echo "[$(date)] Running ImpactAnalyzer..." >> "$LOG"
|
|
86
|
-
"$BUN" "$BASE/PAI/Tools/ImpactAnalyzer.ts" >> "$LOG" 2>&1 || true
|
|
87
|
-
|
|
88
|
-
echo "[$(date)] Skill optimizer complete" >> "$LOG"
|