opencode-agent-harness 0.0.0-stage → 0.2.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +590 -2
  4. package/bin/agent-harness.js +3059 -0
  5. package/contrib/global-plugins/README.md +49 -0
  6. package/contrib/global-plugins/harness-freshness.ts +355 -0
  7. package/package.json +48 -4
  8. package/templates/.agents/AGENTS.md +204 -0
  9. package/templates/.agents/features/INDEX.md +10 -0
  10. package/templates/.agents/handoffs/README.md +87 -0
  11. package/templates/.agents/memory/dev-loop.md +59 -0
  12. package/templates/.agents/memory/domain-map.md +29 -0
  13. package/templates/.agents/memory/environments.md +35 -0
  14. package/templates/.agents/memory/flow-map.md +23 -0
  15. package/templates/.agents/memory/history.md +7 -0
  16. package/templates/.agents/memory/locations.md +14 -0
  17. package/templates/.agents/memory/model-routing.md +261 -0
  18. package/templates/.agents/memory/orchestration.md +183 -0
  19. package/templates/.agents/memory/owned-files.md +19 -0
  20. package/templates/.agents/memory/product-principles.md +37 -0
  21. package/templates/.agents/memory/quality-parameters.md +37 -0
  22. package/templates/.agents/memory/stack-versions.md +35 -0
  23. package/templates/.agents/memory/test-design-parameters.md +36 -0
  24. package/templates/.agents/nightly.json +17 -0
  25. package/templates/.agents/qa-plans/README.md +70 -0
  26. package/templates/.agents/qa-runs/README.md +21 -0
  27. package/templates/.agents/reviews/README.md +47 -0
  28. package/templates/.agents/rules/00-operating.md +199 -0
  29. package/templates/.agents/skills/data-engineer/SKILL.md +31 -0
  30. package/templates/.agents/skills/devops-engineer/SKILL.md +50 -0
  31. package/templates/.agents/skills/diagnostics-expert/SKILL.md +44 -0
  32. package/templates/.agents/skills/docs/SKILL.md +140 -0
  33. package/templates/.agents/skills/features/SKILL.md +187 -0
  34. package/templates/.agents/skills/frontend-engineer/SKILL.md +81 -0
  35. package/templates/.agents/skills/handoff/SKILL.md +85 -0
  36. package/templates/.agents/skills/mobile-engineer/SKILL.md +101 -0
  37. package/templates/.agents/skills/planner/SKILL.md +112 -0
  38. package/templates/.agents/skills/product-manager/SKILL.md +115 -0
  39. package/templates/.agents/skills/qa-architect/SKILL.md +224 -0
  40. package/templates/.agents/skills/qa-runner/SKILL.md +64 -0
  41. package/templates/.agents/skills/security-engineer/SKILL.md +53 -0
  42. package/templates/.agents/skills/system-architect/SKILL.md +42 -0
  43. package/templates/.agents/skills/ui-designer/SKILL.md +71 -0
  44. package/templates/.github/workflows/ci.yml +148 -0
  45. package/templates/.github/workflows/deploy-uat.yml +95 -0
  46. package/templates/.github/workflows/nightly.yml +83 -0
  47. package/templates/.github/workflows/uat-health.yml +41 -0
  48. package/templates/.husky/pre-push +23 -0
  49. package/templates/.ignore +28 -0
  50. package/templates/.opencode/agents/data-engineer.md +37 -0
  51. package/templates/.opencode/agents/devops-engineer.md +37 -0
  52. package/templates/.opencode/agents/diagnostics-expert.md +37 -0
  53. package/templates/.opencode/agents/docs.md +37 -0
  54. package/templates/.opencode/agents/features.md +21 -0
  55. package/templates/.opencode/agents/frontend-engineer.md +37 -0
  56. package/templates/.opencode/agents/handoff.md +21 -0
  57. package/templates/.opencode/agents/mobile-engineer.md +37 -0
  58. package/templates/.opencode/agents/planner.md +34 -0
  59. package/templates/.opencode/agents/product-manager.md +29 -0
  60. package/templates/.opencode/agents/qa-architect.md +27 -0
  61. package/templates/.opencode/agents/qa-runner.md +17 -0
  62. package/templates/.opencode/agents/security-engineer.md +37 -0
  63. package/templates/.opencode/agents/system-architect.md +37 -0
  64. package/templates/.opencode/agents/ui-designer.md +37 -0
  65. package/templates/.opencode/commands/board.md +15 -0
  66. package/templates/.opencode/commands/checkpoint.md +25 -0
  67. package/templates/.opencode/commands/feature.md +56 -0
  68. package/templates/.opencode/commands/finish.md +36 -0
  69. package/templates/.opencode/commands/next.md +49 -0
  70. package/templates/.opencode/commands/report.md +55 -0
  71. package/templates/.opencode/commands/resume.md +39 -0
  72. package/templates/.opencode/commands/switch-model.md +34 -0
  73. package/templates/.opencode/commands/tidy.md +49 -0
  74. package/templates/.opencode/plugins/backlog-notify.ts +57 -0
  75. package/templates/.opencode/plugins/backlog.ts +272 -0
  76. package/templates/.opencode/plugins/checkpoint.ts +160 -0
  77. package/templates/.opencode/plugins/context-guard.ts +1164 -0
  78. package/templates/.opencode/plugins/diff.ts +85 -0
  79. package/templates/.opencode/plugins/gates.ts +71 -0
  80. package/templates/.opencode/plugins/job-notify.ts +241 -0
  81. package/templates/.opencode/plugins/orient.ts +67 -0
  82. package/templates/.opencode/plugins/session.ts +89 -0
  83. package/templates/.opencode/plugins/wait.ts +101 -0
  84. package/templates/.opencode/plugins/where.ts +70 -0
  85. package/templates/.opencode/skills/bounded-explore/SKILL.md +38 -0
  86. package/templates/.opencode/skills/dev-loop/SKILL.md +87 -0
  87. package/templates/.vercelignore +16 -0
  88. package/templates/AGENTS.md +27 -0
  89. package/templates/BACKLOG.md +95 -0
  90. package/templates/docs/ci-cd-pipeline.md +81 -0
  91. package/templates/docs/gates.md +128 -0
  92. package/templates/docs/mcp-integrations.md +97 -0
  93. package/templates/docs/mobile-testing.md +555 -0
  94. package/templates/docs/nightly-testing.md +106 -0
  95. package/templates/docs/wsl-optimizations.md +290 -0
  96. package/templates/opencode.json +188 -0
  97. package/templates/scripts/agent-report.js +541 -0
  98. package/templates/scripts/agent-search.sh +117 -0
  99. package/templates/scripts/backlog.js +1864 -0
  100. package/templates/scripts/board-service.sh +207 -0
  101. package/templates/scripts/checkpoint.js +290 -0
  102. package/templates/scripts/finalize.js +277 -0
  103. package/templates/scripts/nightly.js +913 -0
  104. package/templates/scripts/orient.js +514 -0
  105. package/templates/scripts/qa/board-client.js +260 -0
  106. package/templates/scripts/qa/board-lib.js +96 -0
  107. package/templates/scripts/qa/board-sync.js +469 -0
  108. package/templates/scripts/qa/capacity-lib.js +916 -0
  109. package/templates/scripts/qa/check-backlog.js +427 -0
  110. package/templates/scripts/qa/check-capacity.js +85 -0
  111. package/templates/scripts/qa/check-ci-policy.js +164 -0
  112. package/templates/scripts/qa/check-concurrency.js +344 -0
  113. package/templates/scripts/qa/check-dispatch-config.js +296 -0
  114. package/templates/scripts/qa/check-docs.js +284 -0
  115. package/templates/scripts/qa/check-integrate.js +98 -0
  116. package/templates/scripts/qa/check-linger.js +160 -0
  117. package/templates/scripts/qa/check-prefix-stability.js +183 -0
  118. package/templates/scripts/qa/check-product.js +177 -0
  119. package/templates/scripts/qa/check-qa-plan.js +378 -0
  120. package/templates/scripts/qa/check-qa-scripts.js +85 -0
  121. package/templates/scripts/qa/check-quality.js +249 -0
  122. package/templates/scripts/qa/check-test-wiring.js +253 -0
  123. package/templates/scripts/qa/ci-triage.js +346 -0
  124. package/templates/scripts/qa/ci-usage-lib.js +185 -0
  125. package/templates/scripts/qa/ci-wait-lib.js +294 -0
  126. package/templates/scripts/qa/command-classifier.js +552 -0
  127. package/templates/scripts/qa/context-guard-core.js +1618 -0
  128. package/templates/scripts/qa/diff.js +174 -0
  129. package/templates/scripts/qa/feature-scaffold.js +224 -0
  130. package/templates/scripts/qa/fixtures/backlog.md +104 -0
  131. package/templates/scripts/qa/governance.js +174 -0
  132. package/templates/scripts/qa/hash-file.js +32 -0
  133. package/templates/scripts/qa/lease-lib.js +263 -0
  134. package/templates/scripts/qa/merge-backlog.js +324 -0
  135. package/templates/scripts/qa/mobile-e2e/analyze-timings.js +300 -0
  136. package/templates/scripts/qa/mobile-e2e/apk-cache.js +420 -0
  137. package/templates/scripts/qa/mobile-e2e/backend-build-cache.js +203 -0
  138. package/templates/scripts/qa/mobile-e2e/boot-emulator.sh +432 -0
  139. package/templates/scripts/qa/mobile-e2e/build-apk.sh +210 -0
  140. package/templates/scripts/qa/mobile-e2e/check-flows.js +453 -0
  141. package/templates/scripts/qa/mobile-e2e/config.yaml +18 -0
  142. package/templates/scripts/qa/mobile-e2e/device-down.sh +88 -0
  143. package/templates/scripts/qa/mobile-e2e/device-up.sh +258 -0
  144. package/templates/scripts/qa/mobile-e2e/ios-simulator-down.sh +72 -0
  145. package/templates/scripts/qa/mobile-e2e/ios-simulator-up.sh +153 -0
  146. package/templates/scripts/qa/mobile-e2e/job-events.js +181 -0
  147. package/templates/scripts/qa/mobile-e2e/prewarm.sh +56 -0
  148. package/templates/scripts/qa/mobile-e2e/run-detached.sh +222 -0
  149. package/templates/scripts/qa/mobile-e2e/run-maestro.js +1543 -0
  150. package/templates/scripts/qa/mobile-e2e/ui-dump.js +327 -0
  151. package/templates/scripts/qa/models.allowlist.txt +32 -0
  152. package/templates/scripts/qa/provider-stats.js +878 -0
  153. package/templates/scripts/qa/run-clean.js +83 -0
  154. package/templates/scripts/qa/run-gates.js +212 -0
  155. package/templates/scripts/qa/run-loop.js +220 -0
  156. package/templates/scripts/qa/session-recon.js +512 -0
  157. package/templates/scripts/qa/store-lib.js +324 -0
  158. package/templates/scripts/qa/tool-lib.js +134 -0
  159. package/templates/scripts/qa/where.js +214 -0
  160. package/templates/scripts/qa/wslconfig-merge.js +157 -0
  161. package/templates/scripts/serve.js +1328 -0
  162. package/templates/scripts/setup-nightly.sh +185 -0
  163. package/templates/scripts/setup-tmpfs.sh +374 -0
  164. package/templates/scripts/ship.js +586 -0
  165. package/templates/scripts/switch-reasoning-model.ps1 +101 -0
  166. package/templates/scripts/switch-reasoning-model.sh +104 -0
  167. package/templates/scripts/wait-for.js +342 -0
  168. package/templates/scripts/wsl-gpu.sh +180 -0
  169. package/templates/scripts/wsl-tune.sh +261 -0
@@ -0,0 +1,148 @@
1
+ name: CI
2
+
3
+ # The gate on the integration branch: every direct landing on `main` must pass,
4
+ # and the UAT deploy is triggered only when this workflow succeeds on `main`
5
+ # (`workflow_run` in deploy-uat.yml). A pull request also runs it if one is ever
6
+ # opened, but the normal cycle lands straight to main.
7
+ #
8
+ # Scope: project-owned gates. The harness-owned process gates (test:governance,
9
+ # test:qa-plan, test:docs, ...) live in the gitignored harness tree; extend the
10
+ # `static` job with them once the harness is CI-installable (run
11
+ # `npx opencode-agent-harness update` in a setup step, or commit the tree).
12
+ on:
13
+ pull_request:
14
+ branches: [main]
15
+ push:
16
+ branches: [main]
17
+ workflow_dispatch:
18
+
19
+ concurrency:
20
+ # Superseded runs are cancelled (a newer commit on the same ref makes an
21
+ # in-flight run's verdict moot) so a busy push day does not stack billed runs.
22
+ group: ci-${{ github.workflow }}-${{ github.ref }}
23
+ cancel-in-progress: true
24
+
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ static:
30
+ name: Static + unit gates
31
+ runs-on: ubuntu-latest
32
+ timeout-minutes: 30
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 0
37
+ - uses: actions/setup-node@v4
38
+ with:
39
+ node-version: "22"
40
+ cache: npm
41
+ - name: Install
42
+ run: npm ci
43
+ - name: Lint
44
+ run: npm run lint --if-present
45
+ - name: Test
46
+ run: npm test --if-present
47
+
48
+ # External board service (ADR 0001). Runs the harness board service against a
49
+ # throwaway Postgres and executes the board gates in service mode, so process
50
+ # gates no longer depend on the gitignored BACKLOG.md. Enabled by repository
51
+ # variable CI_BOARD_SERVICE=true once the service is deployed for the project.
52
+ board-service:
53
+ name: Board service gates
54
+ if: ${{ vars.CI_BOARD_SERVICE == 'true' }}
55
+ runs-on: ubuntu-latest
56
+ timeout-minutes: 20
57
+ services:
58
+ postgres:
59
+ image: postgres:16
60
+ env:
61
+ POSTGRES_USER: postgres
62
+ POSTGRES_PASSWORD: postgres
63
+ POSTGRES_DB: agent_board
64
+ ports:
65
+ - 5432:5432
66
+ options: >-
67
+ --health-cmd "pg_isready -U postgres"
68
+ --health-interval 5s
69
+ --health-timeout 5s
70
+ --health-retries 20
71
+ env:
72
+ BOARD_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/agent_board?schema=public
73
+ BACKLOG_BACKEND: service
74
+ BACKLOG_API_URL: http://127.0.0.1:3021
75
+ BACKLOG_API_TOKEN: ci-board-token
76
+ BACKLOG_PROJECT: ci
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ - uses: actions/setup-node@v4
80
+ with:
81
+ node-version: "22"
82
+ cache: npm
83
+ # The board service ships in the harness package. A project consumes it by
84
+ # installing the harness (npm) and running services/board from there; CI
85
+ # checks out the harness repo itself when present, else skips.
86
+ - name: Locate the board service
87
+ id: svc
88
+ run: |
89
+ if [ -d services/board ]; then echo "dir=services/board" >> "$GITHUB_OUTPUT"; else echo "dir=" >> "$GITHUB_OUTPUT"; fi
90
+ - name: Board service (build + boot)
91
+ if: steps.svc.outputs.dir != ''
92
+ working-directory: ${{ steps.svc.outputs.dir }}
93
+ run: |
94
+ npm ci
95
+ DATABASE_URL="$BOARD_DATABASE_URL" BOARD_TOKENS="ci-board-token:ci" npx prisma db push --accept-data-loss
96
+ DATABASE_URL="$BOARD_DATABASE_URL" BOARD_TOKENS="ci-board-token:ci" npx next build
97
+ DATABASE_URL="$BOARD_DATABASE_URL" BOARD_TOKENS="ci-board-token:ci" npx next start -p 3021 &
98
+ for i in $(seq 1 30); do curl -sf http://127.0.0.1:3021/api/health >/dev/null && break; sleep 1; done
99
+ curl -sf http://127.0.0.1:3021/api/health
100
+ - name: Board gates (service mode)
101
+ if: steps.svc.outputs.dir != ''
102
+ run: |
103
+ node scripts/qa/check-backlog.js
104
+ node scripts/qa/check-concurrency.js
105
+ - name: Not enabled
106
+ if: steps.svc.outputs.dir == ''
107
+ run: echo "no services/board in this checkout — board-service job is a no-op"
108
+
109
+ # DB-backed/API tiers. Off by default so a project can validate the service
110
+ # container once before it becomes required: set repository variable
111
+ # CI_RUNTIME=true to enable. Adapt the service/database to the project stack.
112
+ runtime:
113
+ name: Runtime gates
114
+ if: ${{ vars.CI_RUNTIME == 'true' }}
115
+ runs-on: ubuntu-latest
116
+ timeout-minutes: 40
117
+ services:
118
+ postgres:
119
+ image: postgres:16
120
+ env:
121
+ POSTGRES_USER: postgres
122
+ POSTGRES_PASSWORD: postgres
123
+ POSTGRES_DB: ci
124
+ ports:
125
+ - 5432:5432
126
+ options: >-
127
+ --health-cmd "pg_isready -U postgres"
128
+ --health-interval 5s
129
+ --health-timeout 5s
130
+ --health-retries 20
131
+ env:
132
+ DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/ci?schema=public
133
+ AUTH_SECRET: ci-runtime-gate-not-a-real-secret-000000000000000000000000000000000000
134
+ NEXT_TELEMETRY_DISABLED: "1"
135
+ steps:
136
+ - uses: actions/checkout@v4
137
+ - uses: actions/setup-node@v4
138
+ with:
139
+ node-version: "22"
140
+ cache: npm
141
+ - run: npm ci
142
+ - name: Apply migrations
143
+ run: |
144
+ if [ -f prisma/schema.prisma ]; then npx prisma migrate deploy; fi
145
+ - name: API / ORM tier
146
+ run: npm run test:api --if-present
147
+ - name: Route tier
148
+ run: npm run test:routes --if-present
@@ -0,0 +1,95 @@
1
+ name: Deploy UAT
2
+
3
+ # The single app-deploy path for UAT. Triggered by the CI workflow completing
4
+ # successfully on `main` (a direct landing pushes straight to main; CI gates the
5
+ # landed SHA; this deploy then runs only once CI is green), and by manual dispatch
6
+ # of an exact ref for rollback. The runner builds once and ships a prebuilt
7
+ # artifact, so the deployed artifact is provably the checked-out commit — never a
8
+ # developer working tree.
9
+ #
10
+ # Onboarding vs. configured (fail-closed):
11
+ # - Before the deploy secrets exist, set repository variable
12
+ # UAT_DEPLOY_CONFIGURED to unset/false: the job skips cleanly (a success with
13
+ # a notice) so a landing never shows red just for being unconfigured.
14
+ # - Once UAT_DEPLOY_CONFIGURED=true, a missing secret is a HARD FAILURE, not a
15
+ # silent skip — otherwise every deploy would show green while UAT stays stale.
16
+ #
17
+ # Required repository secrets once configured:
18
+ # VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID, DATABASE_URL_UAT
19
+ # Optional:
20
+ # DATABASE_URL_UAT_DIRECT (direct/unpooled URL for migrations)
21
+ # Runtime secrets live on the Vercel project and are injected at runtime.
22
+ on:
23
+ workflow_run:
24
+ workflows: [CI]
25
+ types: [completed]
26
+ branches: [main]
27
+ workflow_dispatch:
28
+ inputs:
29
+ ref:
30
+ description: Commit SHA or ref to deploy (defaults to the triggering SHA)
31
+ required: false
32
+ default: ""
33
+
34
+ concurrency:
35
+ group: deploy-uat
36
+ cancel-in-progress: false
37
+
38
+ permissions:
39
+ contents: read
40
+ actions: read
41
+
42
+ jobs:
43
+ deploy:
44
+ name: Artifact deploy to UAT
45
+ if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
46
+ runs-on: ubuntu-latest
47
+ timeout-minutes: 30
48
+ env:
49
+ DEPLOY_CI: "1"
50
+ NEXT_TELEMETRY_DISABLED: "1"
51
+ VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
52
+ VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
53
+ VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
54
+ DATABASE_URL_UAT: ${{ secrets.DATABASE_URL_UAT }}
55
+ DATABASE_URL_UAT_DIRECT: ${{ secrets.DATABASE_URL_UAT_DIRECT }}
56
+ VERCEL_UAT_ALIAS: ${{ vars.UAT_ALIAS }}
57
+ steps:
58
+ - name: Check deploy credentials
59
+ id: guard
60
+ env:
61
+ CONFIGURED: ${{ vars.UAT_DEPLOY_CONFIGURED }}
62
+ VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
63
+ VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
64
+ VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
65
+ DATABASE_URL_UAT: ${{ secrets.DATABASE_URL_UAT }}
66
+ run: |
67
+ if [ -n "$VERCEL_TOKEN" ] && [ -n "$VERCEL_ORG_ID" ] && [ -n "$VERCEL_PROJECT_ID" ] && [ -n "$DATABASE_URL_UAT" ]; then
68
+ echo "enabled=true" >> "$GITHUB_OUTPUT"
69
+ echo "Deploy credentials present — deploying UAT."
70
+ elif [ "$CONFIGURED" = "true" ]; then
71
+ echo "::error title=UAT deploy misconfigured::UAT_DEPLOY_CONFIGURED=true but a required secret is missing (VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID, DATABASE_URL_UAT). Refusing to report a green skip for a configured deploy."
72
+ exit 1
73
+ else
74
+ echo "enabled=false" >> "$GITHUB_OUTPUT"
75
+ echo "::notice title=UAT deploy skipped::Set the 4 required repository secrets and UAT_DEPLOY_CONFIGURED=true — see docs/ci-cd-pipeline.md. Until then this landing is not deployed."
76
+ fi
77
+ - if: steps.guard.outputs.enabled == 'true'
78
+ uses: actions/checkout@v4
79
+ with:
80
+ ref: ${{ inputs.ref || github.event.workflow_run.head_sha || github.sha }}
81
+ fetch-depth: 0
82
+ - if: steps.guard.outputs.enabled == 'true'
83
+ uses: actions/setup-node@v4
84
+ with:
85
+ node-version: "22"
86
+ cache: npm
87
+ - if: steps.guard.outputs.enabled == 'true'
88
+ name: Install (postinstall runs prisma generate)
89
+ run: npm ci
90
+ - if: steps.guard.outputs.enabled == 'true'
91
+ name: Install Vercel CLI
92
+ run: npm i -g vercel@latest
93
+ - if: steps.guard.outputs.enabled == 'true'
94
+ name: Deploy UAT (prebuilt artifact -> migrate -> alias -> verify -> hygiene)
95
+ run: npm run deploy:uat
@@ -0,0 +1,83 @@
1
+ name: Nightly E2E
2
+
3
+ # Off-hours verification of the day's landed code, in the cloud. This covers the
4
+ # host-independent tiers (unit, DB/API, route, browser E2E) so a regression is
5
+ # found before the next working day even if the local WSL box is off. The heavy
6
+ # Android device/Maestro matrix is deliberately NOT here — it needs the local
7
+ # emulator + GPU and runs via the local `agent-harness install-nightly` timer
8
+ # (docs/nightly-testing.md). The two halves are complementary.
9
+ #
10
+ # A failed run notifies the repo watchers by default, which is the alert. Set
11
+ # repository variable CI_RUNTIME=false to skip the DB-backed job while onboarding.
12
+ on:
13
+ schedule:
14
+ # Mon/Wed/Fri 03:00 UTC — not daily. The `static` job was removed because the
15
+ # push `CI` workflow already runs the same lint+unit tier on every landing;
16
+ # repeating it here only doubles the bill on the days it is free to skip.
17
+ - cron: "0 3 * * 1,3,5"
18
+ workflow_dispatch:
19
+
20
+ concurrency:
21
+ group: nightly-${{ github.ref }}
22
+ cancel-in-progress: false
23
+
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ runtime:
29
+ name: DB / API / routes
30
+ if: ${{ vars.CI_RUNTIME != 'false' }}
31
+ runs-on: ubuntu-latest
32
+ timeout-minutes: 45
33
+ services:
34
+ postgres:
35
+ image: postgres:16
36
+ env:
37
+ POSTGRES_USER: postgres
38
+ POSTGRES_PASSWORD: postgres
39
+ POSTGRES_DB: ci
40
+ ports:
41
+ - 5432:5432
42
+ options: >-
43
+ --health-cmd "pg_isready -U postgres"
44
+ --health-interval 5s
45
+ --health-timeout 5s
46
+ --health-retries 20
47
+ env:
48
+ DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/ci?schema=public
49
+ AUTH_SECRET: nightly-runtime-gate-not-a-real-secret-000000000000000000000000000000
50
+ NEXT_TELEMETRY_DISABLED: "1"
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - uses: actions/setup-node@v4
54
+ with:
55
+ node-version: "22"
56
+ cache: npm
57
+ - run: npm ci
58
+ - name: Apply migrations
59
+ run: |
60
+ if [ -f prisma/schema.prisma ]; then npx prisma migrate deploy; fi
61
+ - name: API / ORM tier
62
+ run: npm run test:api --if-present
63
+ - name: Route tier
64
+ run: npm run test:routes --if-present
65
+
66
+ web-e2e:
67
+ name: Browser E2E
68
+ runs-on: ubuntu-latest
69
+ timeout-minutes: 40
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+ - uses: actions/setup-node@v4
73
+ with:
74
+ node-version: "22"
75
+ cache: npm
76
+ - run: npm ci
77
+ - name: Install Playwright browser
78
+ run: npx playwright install --with-deps chromium
79
+ if: ${{ hashFiles('playwright.config.*') != '' }}
80
+ - name: Browser E2E
81
+ run: npm run test:e2e --if-present
82
+ env:
83
+ NEXT_TELEMETRY_DISABLED: "1"
@@ -0,0 +1,41 @@
1
+ name: UAT health
2
+
3
+ # Scheduled runtime probe of UAT. Set repository variable UAT_ALIAS (e.g.
4
+ # `myapp-uat.vercel.app`) and, if the app exposes a DB-probing health endpoint,
5
+ # point the probe at it. A failed run notifies the repo watchers by default,
6
+ # which is the alert.
7
+ on:
8
+ # Every 2 hours, NOT every 30 minutes: a sub-minute probe on a tight cron is
9
+ # still a BILLED job every run (`*/30` ≈ 1,440 jobs/mo — 72% of the Free-plan
10
+ # included minutes, the 2026-10 silent-outage root cause). `npm run
11
+ # test:ci-policy` fails a workflow that reintroduces a sub-hourly cron.
12
+ schedule:
13
+ - cron: "0 */2 * * *"
14
+ workflow_dispatch:
15
+
16
+ concurrency:
17
+ group: uat-health
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ probe:
25
+ runs-on: ubuntu-latest
26
+ timeout-minutes: 5
27
+ steps:
28
+ - name: Probe UAT health endpoint
29
+ run: |
30
+ set -euo pipefail
31
+ alias="${{ vars.UAT_ALIAS }}"
32
+ if [ -z "$alias" ]; then
33
+ echo "::notice title=UAT health skipped::set repository variable UAT_ALIAS to probe it."
34
+ exit 0
35
+ fi
36
+ url="https://${alias}/api/health?live=1"
37
+ code=$(curl -sS -o /tmp/health.json -w "%{http_code}" "$url")
38
+ echo "HTTP $code"
39
+ cat /tmp/health.json
40
+ echo
41
+ test "$code" = "200"
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+ # Harness pre-push battery. Created by opencode-agent-harness if missing;
3
+ # project-owned afterwards — edit freely.
4
+ #
5
+ # Cross-platform npm launcher: on Windows (Git Bash / MSYS / Cygwin) the hook
6
+ # must call `npm.cmd`; plain `npm` there resolves to a bash-shebang shim. On
7
+ # POSIX (WSL/Linux/macOS) it must call `npm`.
8
+ #
9
+ # `set -e` makes EVERY gate fatal: without it a trailing success could mask an
10
+ # earlier failure.
11
+ set -e
12
+
13
+ case "$(uname -s)" in
14
+ MINGW*|MSYS*|CYGWIN*) NPM=npm.cmd ;;
15
+ *) NPM=npm ;;
16
+ esac
17
+
18
+ # One owner for the gate list: `scripts/qa/run-gates.js`. It runs the harness
19
+ # process gates then the project stack gates, stops at the first failure, and
20
+ # skips a gate the project has not wired (`--if-present` semantics). `--phase`
21
+ # here must stay the pre-push battery; edit the list in run-gates.js, not here,
22
+ # so the hook and the `gates` tool can never drift.
23
+ $NPM run --if-present gates -- --phase=pre-push
@@ -0,0 +1,28 @@
1
+ # Canonical agent-search ignore set. This file is read by ripgrep/fd (and the
2
+ # harness `scripts/agent-search.sh` wrapper) so recursive discovery stays cheap
3
+ # and never walks generated, vendored, or cache trees. `.gitignore` is the
4
+ # project's own file and is NEVER written by the harness.
5
+ #
6
+ # Everything between the managed markers is harness-owned and replaced in place
7
+ # on `agent-harness update`; project entries outside the markers are preserved.
8
+ # agent-harness (managed below)
9
+ node_modules/
10
+ .git/
11
+ .venv/
12
+ venv/
13
+ __pycache__/
14
+ .mypy_cache/
15
+ .pytest_cache/
16
+ target/
17
+ dist/
18
+ build/
19
+ .next/
20
+ .nuxt/
21
+ coverage/
22
+ .gradle/
23
+ .cargo/
24
+ vendor/
25
+ .terraform/
26
+ tmp/
27
+ .cache/
28
+ # agent-harness (managed end)
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use for catalog/data ingestion and entity resolution — external-source ingestion, canonical-record dedup, external service telemetry.
3
+ mode: subagent
4
+ steps: 40
5
+ model: opencode-go/deepseek-v4.1-flash#high
6
+ permissions:
7
+ - action: edit
8
+ resource: "*"
9
+ effect: allow
10
+ - action: edit
11
+ resource: "opencode.json"
12
+ effect: deny
13
+ - action: edit
14
+ resource: ".harness.json"
15
+ effect: deny
16
+ - action: edit
17
+ resource: ".opencode/**"
18
+ effect: deny
19
+ - action: edit
20
+ resource: ".agents/**"
21
+ effect: deny
22
+ - action: shell
23
+ resource: "*"
24
+ effect: allow
25
+ ---
26
+
27
+ You are the {{PROJECT_NAME}} Data Engineer. Read and follow the complete persona instructions in `.agents/skills/data-engineer/SKILL.md`, then carry out the task.
28
+
29
+ ## Scope & integrity (non-negotiable)
30
+
31
+ - Edit ONLY files in your assigned area. `opencode.json`, `.agents/memory/*`, `.agents/rules/*`, `.agents/skills/*`, and code outside your scope are READ-ONLY absent an explicit orchestrator grant.
32
+ - **Working tree gate**: before your first edit, run `git rev-parse --show-toplevel` and `git branch --show-current` and confirm both match the `Working tree` named in the dispatch spec. If they don't match the assigned feature worktree (or `main`, when told so), STOP and report the mismatch — never edit a tree you weren't assigned.
33
+ - A size/scope goal means DECOMPOSE into typed modules — never minify JSX, never collapse to single lines, never swap real types for `any`, never add `.d.ts` overrides or inline `require()` to silence tsc, never make out-of-scope edits to hit a metric. Preserve behavior verbatim.
34
+ - Run the gate yourself before reporting done (`tsc --noEmit`, `npm run lint:hooks`, `npm run test:quick`) and cite real output in Evidence — never claim success you did not run.
35
+ - Shared contracts have one owner; dependent subagents consume, never re-emit competing definitions.
36
+
37
+ Return your final message in this exact order: **Result** (what shipped / decided) -> **Evidence** (files changed, commands run, observed output) -> **Deferred & risks** (follow-ups the orchestrator must handle). Keep it under ~15 lines.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use for deployment, CI/CD, cron/scheduling, env & secrets management, hosting config, and mobile build/release setup.
3
+ mode: subagent
4
+ steps: 40
5
+ model: opencode-go/deepseek-v4.1-flash#high
6
+ permissions:
7
+ - action: edit
8
+ resource: "*"
9
+ effect: allow
10
+ - action: edit
11
+ resource: "opencode.json"
12
+ effect: deny
13
+ - action: edit
14
+ resource: ".harness.json"
15
+ effect: deny
16
+ - action: edit
17
+ resource: ".opencode/**"
18
+ effect: deny
19
+ - action: edit
20
+ resource: ".agents/**"
21
+ effect: deny
22
+ - action: shell
23
+ resource: "*"
24
+ effect: allow
25
+ ---
26
+
27
+ You are the {{PROJECT_NAME}} DevOps Engineer. Read and follow the complete persona instructions in `.agents/skills/devops-engineer/SKILL.md`, then carry out the task.
28
+
29
+ ## Scope & integrity (non-negotiable)
30
+
31
+ - Edit ONLY files in your assigned area. `opencode.json`, `.agents/memory/*`, `.agents/rules/*`, `.agents/skills/*`, and code outside your scope are READ-ONLY absent an explicit orchestrator grant.
32
+ - **Working tree gate**: before your first edit, run `git rev-parse --show-toplevel` and `git branch --show-current` and confirm both match the `Working tree` named in the dispatch spec. If they don't match the assigned feature worktree (or `main`, when told so), STOP and report the mismatch — never edit a tree you weren't assigned.
33
+ - A size/scope goal means DECOMPOSE into typed modules — never minify JSX, never collapse to single lines, never swap real types for `any`, never add `.d.ts` overrides or inline `require()` to silence tsc, never make out-of-scope edits to hit a metric. Preserve behavior verbatim.
34
+ - Run the gate yourself before reporting done (`tsc --noEmit`, `npm run lint:hooks`, `npm run test:quick`) and cite real output in Evidence — never claim success you did not run.
35
+ - Shared contracts have one owner; dependent subagents consume, never re-emit competing definitions.
36
+
37
+ Return your final message in this exact order: **Result** (what shipped / decided) -> **Evidence** (files changed, commands run, observed output) -> **Deferred & risks** (follow-ups the orchestrator must handle). Keep it under ~15 lines.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use when debugging errors, performance regressions, or API anomalies — log-first investigation, ExternalServiceLog, cold-start profiling, authentic reproduction.
3
+ mode: subagent
4
+ steps: 40
5
+ model: opencode-go/deepseek-v4.1-flash#high
6
+ permissions:
7
+ - action: edit
8
+ resource: "*"
9
+ effect: allow
10
+ - action: edit
11
+ resource: "opencode.json"
12
+ effect: deny
13
+ - action: edit
14
+ resource: ".harness.json"
15
+ effect: deny
16
+ - action: edit
17
+ resource: ".opencode/**"
18
+ effect: deny
19
+ - action: edit
20
+ resource: ".agents/**"
21
+ effect: deny
22
+ - action: shell
23
+ resource: "*"
24
+ effect: allow
25
+ ---
26
+
27
+ You are the {{PROJECT_NAME}} Diagnostics Expert. Read and follow the complete persona instructions in `.agents/skills/diagnostics-expert/SKILL.md`, then carry out the task.
28
+
29
+ ## Scope & integrity (non-negotiable)
30
+
31
+ - Edit ONLY files in your assigned area. `opencode.json`, `.agents/memory/*`, `.agents/rules/*`, `.agents/skills/*`, and code outside your scope are READ-ONLY absent an explicit orchestrator grant.
32
+ - **Working tree gate**: before your first edit, run `git rev-parse --show-toplevel` and `git branch --show-current` and confirm both match the `Working tree` named in the dispatch spec. If they don't match the assigned feature worktree (or `main`, when told so), STOP and report the mismatch — never edit a tree you weren't assigned.
33
+ - A size/scope goal means DECOMPOSE into typed modules — never minify JSX, never collapse to single lines, never swap real types for `any`, never add `.d.ts` overrides or inline `require()` to silence tsc, never make out-of-scope edits to hit a metric. Preserve behavior verbatim.
34
+ - Run the gate yourself before reporting done (`tsc --noEmit`, `npm run lint:hooks`, `npm run test:quick`) and cite real output in Evidence — never claim success you did not run.
35
+ - Shared contracts have one owner; dependent subagents consume, never re-emit competing definitions.
36
+
37
+ Return your final message in this exact order: **Result** (what shipped / decided) -> **Evidence** (files changed, commands run, observed output) -> **Deferred & risks** (follow-ups the orchestrator must handle). Keep it under ~15 lines.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use when creating, updating, or maintaining project documentation — README.md, CHANGELOG.md, docs/ (architecture, ADRs, runbooks, API), CONTRIBUTING.md — keeping docs in sync with code and never duplicated.
3
+ mode: subagent
4
+ steps: 20
5
+ model: opencode-go/gpt-5.6-luna#low
6
+ permissions:
7
+ - action: edit
8
+ resource: "*"
9
+ effect: allow
10
+ - action: edit
11
+ resource: "opencode.json"
12
+ effect: deny
13
+ - action: edit
14
+ resource: ".harness.json"
15
+ effect: deny
16
+ - action: edit
17
+ resource: ".opencode/**"
18
+ effect: deny
19
+ - action: edit
20
+ resource: ".agents/**"
21
+ effect: deny
22
+ - action: shell
23
+ resource: "*"
24
+ effect: deny
25
+ ---
26
+
27
+ You are the {{PROJECT_NAME}} Documentation Keeper. Read and follow the complete persona instructions in `.agents/skills/docs/SKILL.md`, then carry out the task.
28
+
29
+ ## Scope & integrity (non-negotiable)
30
+
31
+ - Edit ONLY project documentation: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, and `docs/**`. `opencode.json`, `.harness.json`, `.opencode/**`, `.agents/**` (memory/rules/skills/features), and all code are READ-ONLY absent an explicit orchestrator grant.
32
+ - Code is the source of truth — docs point at it (`file:line`), never re-derive or duplicate it. Never document behavior you did not verify against live code.
33
+ - Write back first: when implementation invalidates a doc, update the doc before continuing (mirror `.agents/skills/features/SKILL.md`).
34
+ - Never fabricate a doc, a version entry, or a decision that has no basis in what was actually done.
35
+ - **Reconstruction mode**: when asked to back-fill docs mid-project, the orchestrator supplies an input bundle (git history + opencode/antigravity/vscode session excerpts + memory pointers). Ground every claim in it; never run git yourself.
36
+
37
+ Return your final message in this exact order: **Result** (docs created/updated) -> **Evidence** (files changed, code/schema verified) -> **Deferred & risks** (docs left stale, open questions). Keep it under ~15 lines.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Use only to capture a found item and manage the feature backlog — owns the BACKLOG.md task list and scaffolds the .agents/features/<slug>/ doc tree. Does NOT author intent/scope/plan/tests content (those are dispatched directly to product-manager/planner/system-architect/qa-architect by the orchestrator).
3
+ mode: subagent
4
+ steps: 15
5
+ hidden: true
6
+ model: opencode-go/gpt-5.6-luna#low
7
+ permissions:
8
+ - action: shell
9
+ resource: "*"
10
+ effect: deny
11
+ ---
12
+
13
+ You are the {{PROJECT_NAME}} Feature Registrar. Read and follow the complete persona instructions in `.agents/skills/features/SKILL.md`, then carry out the task.
14
+
15
+ ## Scope & integrity (non-negotiable)
16
+
17
+ - Edit ONLY `BACKLOG.md` (repo root) and the `.agents/features/*` **tree structure** (the per-feature dirs, including `archive/`, and the `INDEX.md` pointer). `opencode.json`, `.agents/memory/*`, `.agents/rules/*`, `.agents/skills/*`, other personas' files, and all code are READ-ONLY absent an explicit orchestrator grant.
18
+ - You are a **registrar only**: record backlog rows and scaffold doc directories. Never author `intent.md`/`scope.md`/`plan.md`/`tests.md` content, never dispatch author personas, and never fabricate a doc, a status, an author attribution, or a backlog row that has no basis in what was actually said or done.
19
+ - Keep the two layers separate: every found item is a light `BACKLOG.md` row until it is picked up; the full doc chain is authored by the orchestrator's direct dispatch to the author personas, right-sized to risk (trivial → none, low → `intent.md` only, high → full chain).
20
+
21
+ Return your final message in this exact order: **Result** (backlog delta + doc tree scaffolded) -> **Evidence** (files changed, observed output) -> **Deferred & risks** (features parked, open questions, next routing). Keep it under ~15 lines.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Use when writing or fixing web React / Next.js / Tailwind / shadcn code (app/, components/, pages/), or resolving web build errors — not Expo/React Native (that's mobile-engineer).
3
+ mode: subagent
4
+ steps: 50
5
+ model: opencode-go/deepseek-v4.1-flash#high
6
+ permissions:
7
+ - action: edit
8
+ resource: "*"
9
+ effect: allow
10
+ - action: edit
11
+ resource: "opencode.json"
12
+ effect: deny
13
+ - action: edit
14
+ resource: ".harness.json"
15
+ effect: deny
16
+ - action: edit
17
+ resource: ".opencode/**"
18
+ effect: deny
19
+ - action: edit
20
+ resource: ".agents/**"
21
+ effect: deny
22
+ - action: shell
23
+ resource: "*"
24
+ effect: allow
25
+ ---
26
+
27
+ You are the {{PROJECT_NAME}} Frontend Engineer. Read and follow the complete persona instructions in `.agents/skills/frontend-engineer/SKILL.md`, then carry out the task.
28
+
29
+ ## Scope & integrity (non-negotiable)
30
+
31
+ - Edit ONLY files in your assigned area. `opencode.json`, `.agents/memory/*`, `.agents/rules/*`, `.agents/skills/*`, and code outside your scope are READ-ONLY absent an explicit orchestrator grant.
32
+ - **Working tree gate**: before your first edit, run `git rev-parse --show-toplevel` and `git branch --show-current` and confirm both match the `Working tree` named in the dispatch spec. If they don't match the assigned feature worktree (or `main`, when told so), STOP and report the mismatch — never edit a tree you weren't assigned.
33
+ - A size/scope goal means DECOMPOSE into typed modules — never minify JSX, never collapse to single lines, never swap real types for `any`, never add `.d.ts` overrides or inline `require()` to silence tsc, never make out-of-scope edits to hit a metric. Preserve behavior verbatim.
34
+ - Run the gate yourself before reporting done (`tsc --noEmit`, `npm run lint:hooks`, `npm run test:quick`) and cite real output in Evidence — never claim success you did not run.
35
+ - Shared contracts have one owner; dependent subagents consume, never re-emit competing definitions.
36
+
37
+ Return your final message in this exact order: **Result** (what shipped / decided) -> **Evidence** (files changed, commands run, observed output) -> **Deferred & risks** (follow-ups the orchestrator must handle). Keep it under ~15 lines.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Use when the user asks to save progress, hand off, wrap up, or "remind me where we stopped" — writes a planned→shipped→deferred delta and updates the session handoff memory.
3
+ mode: subagent
4
+ steps: 10
5
+ hidden: true
6
+ model: opencode-go/glm-5.3-flash#low
7
+ permissions:
8
+ - action: shell
9
+ resource: "*"
10
+ effect: deny
11
+ ---
12
+
13
+ You are the {{PROJECT_NAME}} Handoff Assistant. Read and follow the complete persona instructions in `.agents/skills/handoff/SKILL.md`, then carry out the task.
14
+
15
+ ## Scope & integrity (non-negotiable)
16
+
17
+ - Edit ONLY your handoff memory files (`.agents/handoffs/<feature-id>.md` and the `.agents/memory/locations.md` pointer you refresh). `opencode.json`, `.agents/memory/*` beyond your files, `.agents/rules/*`, and all code are READ-ONLY.
18
+ - Write only your own session's file; never edit or reorder another session's handoff.
19
+ - Record only what actually happened — never fabricate `degraded:`/`waived:` dispatch entries, and never invent subagent results that did not occur.
20
+
21
+ Return your final message in this exact order: **Result** (what shipped / decided) -> **Evidence** (files changed, commands run, observed output) -> **Deferred & risks** (follow-ups the orchestrator must handle). Keep it under ~15 lines.