sentinelayer-cli 0.6.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1009 -996
- package/bin/create-sentinelayer.js +5 -5
- package/bin/sentinelayer-cli.js +4 -4
- package/bin/sl.js +5 -5
- package/package.json +64 -63
- package/src/agents/ai-governance/index.js +12 -0
- package/src/agents/ai-governance/tools/base.js +171 -0
- package/src/agents/ai-governance/tools/eval-regression.js +47 -0
- package/src/agents/ai-governance/tools/hitl-audit.js +81 -0
- package/src/agents/ai-governance/tools/index.js +52 -0
- package/src/agents/ai-governance/tools/prompt-drift.js +42 -0
- package/src/agents/ai-governance/tools/provenance-check.js +69 -0
- package/src/agents/backend/index.js +12 -0
- package/src/agents/backend/tools/base.js +189 -0
- package/src/agents/backend/tools/circuit-breaker-check.js +123 -0
- package/src/agents/backend/tools/idempotency-audit.js +105 -0
- package/src/agents/backend/tools/index.js +87 -0
- package/src/agents/backend/tools/retry-audit.js +132 -0
- package/src/agents/backend/tools/timeout-audit.js +144 -0
- package/src/agents/code-quality/index.js +12 -0
- package/src/agents/code-quality/tools/base.js +159 -0
- package/src/agents/code-quality/tools/complexity-measure.js +197 -0
- package/src/agents/code-quality/tools/coupling-analysis.js +81 -0
- package/src/agents/code-quality/tools/cycle-detect.js +49 -0
- package/src/agents/code-quality/tools/dep-graph.js +196 -0
- package/src/agents/code-quality/tools/index.js +89 -0
- package/src/agents/data-layer/index.js +12 -0
- package/src/agents/data-layer/tools/base.js +181 -0
- package/src/agents/data-layer/tools/index-audit.js +165 -0
- package/src/agents/data-layer/tools/index.js +83 -0
- package/src/agents/data-layer/tools/migration-scan.js +135 -0
- package/src/agents/data-layer/tools/query-explain.js +120 -0
- package/src/agents/data-layer/tools/tenancy-scan.js +166 -0
- package/src/agents/documentation/index.js +12 -0
- package/src/agents/documentation/tools/api-diff.js +91 -0
- package/src/agents/documentation/tools/base.js +151 -0
- package/src/agents/documentation/tools/dead-link-check.js +58 -0
- package/src/agents/documentation/tools/docstring-coverage.js +78 -0
- package/src/agents/documentation/tools/index.js +52 -0
- package/src/agents/documentation/tools/readme-freshness.js +61 -0
- package/src/agents/envelope/fix-cycle.js +45 -0
- package/src/agents/envelope/index.js +31 -0
- package/src/agents/envelope/loop.js +150 -0
- package/src/agents/envelope/pulse.js +18 -0
- package/src/agents/envelope/stream.js +40 -0
- package/src/agents/infrastructure/index.js +12 -0
- package/src/agents/infrastructure/tools/base.js +171 -0
- package/src/agents/infrastructure/tools/checkov-run.js +32 -0
- package/src/agents/infrastructure/tools/drift-detect.js +59 -0
- package/src/agents/infrastructure/tools/iam-least-priv-check.js +78 -0
- package/src/agents/infrastructure/tools/index.js +52 -0
- package/src/agents/infrastructure/tools/tflint-run.js +31 -0
- package/src/agents/jules/config/definition.js +160 -160
- package/src/agents/jules/config/system-prompt.js +182 -182
- package/src/agents/jules/error-intake.js +51 -51
- package/src/agents/jules/fix-cycle.js +17 -17
- package/src/agents/jules/loop.js +460 -450
- package/src/agents/jules/pulse.js +10 -10
- package/src/agents/jules/stream.js +187 -186
- package/src/agents/jules/swarm/file-scanner.js +74 -74
- package/src/agents/jules/swarm/index.js +11 -11
- package/src/agents/jules/swarm/orchestrator.js +362 -362
- package/src/agents/jules/swarm/pattern-hunter.js +123 -123
- package/src/agents/jules/swarm/sub-agent.js +315 -309
- package/src/agents/jules/tools/aidenid-email.js +189 -189
- package/src/agents/jules/tools/auth-audit.js +1708 -1691
- package/src/agents/jules/tools/dispatch.js +340 -335
- package/src/agents/jules/tools/file-edit.js +2 -2
- package/src/agents/jules/tools/file-read.js +2 -2
- package/src/agents/jules/tools/frontend-analyze.js +570 -570
- package/src/agents/jules/tools/glob.js +2 -2
- package/src/agents/jules/tools/grep.js +2 -2
- package/src/agents/jules/tools/index.js +29 -29
- package/src/agents/jules/tools/path-guards.js +2 -2
- package/src/agents/jules/tools/runtime-audit.js +507 -507
- package/src/agents/jules/tools/shell.js +2 -2
- package/src/agents/jules/tools/url-policy.js +100 -100
- package/src/agents/mode.js +113 -0
- package/src/agents/observability/index.js +12 -0
- package/src/agents/observability/tools/alert-audit.js +39 -0
- package/src/agents/observability/tools/base.js +181 -0
- package/src/agents/observability/tools/dashboard-gap.js +42 -0
- package/src/agents/observability/tools/index.js +54 -0
- package/src/agents/observability/tools/log-schema-check.js +74 -0
- package/src/agents/observability/tools/span-coverage.js +74 -0
- package/src/agents/persona-visuals.js +102 -61
- package/src/agents/release/index.js +12 -0
- package/src/agents/release/tools/base.js +181 -0
- package/src/agents/release/tools/changelog-diff.js +86 -0
- package/src/agents/release/tools/feature-flag-audit.js +126 -0
- package/src/agents/release/tools/index.js +61 -0
- package/src/agents/release/tools/rollback-verify.js +129 -0
- package/src/agents/release/tools/semver-check.js +109 -0
- package/src/agents/reliability/index.js +12 -0
- package/src/agents/reliability/tools/backpressure-check.js +129 -0
- package/src/agents/reliability/tools/base.js +181 -0
- package/src/agents/reliability/tools/chaos-probe.js +109 -0
- package/src/agents/reliability/tools/graceful-degradation-check.js +114 -0
- package/src/agents/reliability/tools/health-check-audit.js +111 -0
- package/src/agents/reliability/tools/index.js +87 -0
- package/src/agents/run-persona.js +109 -0
- package/src/agents/security/index.js +12 -0
- package/src/agents/security/tools/authz-audit.js +134 -0
- package/src/agents/security/tools/base.js +190 -0
- package/src/agents/security/tools/crypto-review.js +175 -0
- package/src/agents/security/tools/index.js +97 -0
- package/src/agents/security/tools/sast-scan.js +175 -0
- package/src/agents/security/tools/secrets-scan.js +216 -0
- package/src/agents/shared-tools/dispatch-core.js +320 -315
- package/src/agents/shared-tools/file-edit.js +180 -180
- package/src/agents/shared-tools/file-read.js +100 -100
- package/src/agents/shared-tools/glob.js +168 -168
- package/src/agents/shared-tools/grep.js +228 -228
- package/src/agents/shared-tools/index.js +46 -46
- package/src/agents/shared-tools/path-guards.js +161 -161
- package/src/agents/shared-tools/shell.js +383 -383
- package/src/agents/supply-chain/index.js +12 -0
- package/src/agents/supply-chain/tools/attestation-check.js +42 -0
- package/src/agents/supply-chain/tools/base.js +151 -0
- package/src/agents/supply-chain/tools/index.js +52 -0
- package/src/agents/supply-chain/tools/lockfile-integrity.js +73 -0
- package/src/agents/supply-chain/tools/package-verify.js +56 -0
- package/src/agents/supply-chain/tools/sbom-diff.js +34 -0
- package/src/agents/testing/index.js +12 -0
- package/src/agents/testing/tools/base.js +202 -0
- package/src/agents/testing/tools/coverage-gap.js +144 -0
- package/src/agents/testing/tools/flake-detect.js +125 -0
- package/src/agents/testing/tools/index.js +85 -0
- package/src/agents/testing/tools/mutation-test.js +143 -0
- package/src/agents/testing/tools/snapshot-diff.js +103 -0
- package/src/ai/aidenid.js +1021 -1009
- package/src/ai/client.js +553 -553
- package/src/ai/domain-target-store.js +268 -268
- package/src/ai/identity-store.js +270 -270
- package/src/ai/proxy.js +137 -137
- package/src/ai/site-store.js +145 -145
- package/src/audit/agents/architecture.js +180 -180
- package/src/audit/agents/compliance.js +179 -179
- package/src/audit/agents/documentation.js +165 -165
- package/src/audit/agents/performance.js +145 -145
- package/src/audit/agents/security.js +215 -215
- package/src/audit/agents/testing.js +172 -172
- package/src/audit/orchestrator.js +557 -557
- package/src/audit/package.js +204 -204
- package/src/audit/registry.js +284 -284
- package/src/audit/replay.js +103 -103
- package/src/auth/gate.js +428 -371
- package/src/auth/http.js +681 -611
- package/src/auth/service.js +1106 -1106
- package/src/auth/session-store.js +813 -813
- package/src/cli.js +257 -252
- package/src/commands/ai/identity-lifecycle.js +1338 -1338
- package/src/commands/ai/provision-governance.js +1272 -1272
- package/src/commands/ai/shared.js +147 -147
- package/src/commands/ai.js +11 -11
- package/src/commands/apply.js +12 -12
- package/src/commands/audit.js +1171 -1166
- package/src/commands/auth.js +419 -419
- package/src/commands/chat.js +184 -191
- package/src/commands/config.js +184 -184
- package/src/commands/cost.js +311 -311
- package/src/commands/daemon/core.js +850 -850
- package/src/commands/daemon/extended.js +1048 -1048
- package/src/commands/daemon/shared.js +213 -213
- package/src/commands/daemon.js +11 -11
- package/src/commands/guide.js +174 -174
- package/src/commands/ingest.js +58 -58
- package/src/commands/init.js +55 -55
- package/src/commands/legacy-args.js +20 -10
- package/src/commands/mcp.js +461 -461
- package/src/commands/omargate.js +63 -29
- package/src/commands/persona.js +65 -20
- package/src/commands/plugin.js +260 -260
- package/src/commands/policy.js +132 -132
- package/src/commands/prompt.js +238 -238
- package/src/commands/review.js +704 -704
- package/src/commands/scan.js +865 -872
- package/src/commands/session.js +1238 -0
- package/src/commands/spec.js +771 -716
- package/src/commands/swarm.js +651 -651
- package/src/commands/telemetry.js +202 -202
- package/src/commands/watch.js +511 -511
- package/src/config/agent-dictionary.js +182 -182
- package/src/config/io.js +56 -56
- package/src/config/paths.js +18 -18
- package/src/config/schema.js +55 -55
- package/src/config/service.js +184 -184
- package/src/coord/events-log.js +141 -0
- package/src/coord/handshake.js +719 -0
- package/src/coord/index.js +35 -0
- package/src/coord/paths.js +84 -0
- package/src/coord/priority.js +62 -0
- package/src/coord/tarjan.js +157 -0
- package/src/cost/budget.js +235 -235
- package/src/cost/history.js +188 -188
- package/src/cost/tokenizer.js +160 -0
- package/src/cost/tracker.js +232 -171
- package/src/daemon/artifact-lineage.js +896 -534
- package/src/daemon/assignment-ledger.js +1083 -770
- package/src/daemon/ast-drift.js +496 -0
- package/src/daemon/ast-parser-layer.js +258 -258
- package/src/daemon/budget-governor.js +633 -633
- package/src/daemon/callgraph-overlay.js +646 -646
- package/src/daemon/error-worker.js +1209 -626
- package/src/daemon/fix-cycle.js +384 -377
- package/src/daemon/hybrid-mapper.js +929 -929
- package/src/daemon/ingest-refresh.js +79 -11
- package/src/daemon/jira-lifecycle.js +767 -632
- package/src/daemon/operator-control.js +657 -657
- package/src/daemon/pulse.js +327 -327
- package/src/daemon/reliability-lane.js +471 -471
- package/src/daemon/scope-engine.js +1068 -0
- package/src/daemon/watchdog.js +971 -971
- package/src/events/schema.js +190 -0
- package/src/guide/generator.js +316 -316
- package/src/ingest/engine.js +933 -918
- package/src/ingest/ownership.js +380 -0
- package/src/interactive/index.js +97 -97
- package/src/legacy-cli.js +3228 -2994
- package/src/mcp/registry.js +695 -695
- package/src/memory/blackboard.js +301 -301
- package/src/memory/retrieval.js +581 -581
- package/src/orchestrator/kai-chen.js +126 -0
- package/src/plugin/manifest.js +553 -553
- package/src/policy/packs.js +144 -144
- package/src/prompt/generator.js +136 -118
- package/src/review/ai-review.js +672 -679
- package/src/review/compliance-pack.js +389 -0
- package/src/review/investor-dd-config.js +54 -0
- package/src/review/investor-dd-file-loop.js +303 -0
- package/src/review/investor-dd-file-router.js +406 -0
- package/src/review/investor-dd-html-report.js +233 -0
- package/src/review/investor-dd-notification.js +120 -0
- package/src/review/investor-dd-orchestrator.js +405 -0
- package/src/review/investor-dd-persona-runner.js +275 -0
- package/src/review/live-validator.js +253 -0
- package/src/review/local-review.js +1351 -1305
- package/src/review/omargate-interactive.js +68 -68
- package/src/review/omargate-orchestrator.js +492 -300
- package/src/review/persona-prompts.js +484 -296
- package/src/review/reconciliation-rules.js +329 -0
- package/src/review/replay.js +235 -235
- package/src/review/report.js +664 -664
- package/src/review/reproducibility-chain.js +136 -0
- package/src/review/scan-modes.js +147 -42
- package/src/review/spec-binding.js +487 -487
- package/src/scaffold/generator.js +67 -67
- package/src/scaffold/templates.js +150 -150
- package/src/scan/generator.js +418 -418
- package/src/scan/gh-secrets.js +107 -107
- package/src/session/agent-registry.js +359 -0
- package/src/session/analytics.js +479 -0
- package/src/session/daemon.js +1396 -0
- package/src/session/file-locks.js +666 -0
- package/src/session/paths.js +37 -0
- package/src/session/recap.js +567 -0
- package/src/session/redact.js +82 -0
- package/src/session/runtime-bridge.js +762 -0
- package/src/session/scoring.js +406 -0
- package/src/session/setup-guides.js +304 -0
- package/src/session/store.js +704 -0
- package/src/session/stream.js +333 -0
- package/src/session/sync.js +753 -0
- package/src/session/tasks.js +1054 -0
- package/src/session/templates.js +188 -0
- package/src/spec/generator.js +619 -519
- package/src/spec/regenerate.js +237 -237
- package/src/spec/templates.js +91 -91
- package/src/swarm/dashboard.js +247 -247
- package/src/swarm/factory.js +363 -363
- package/src/swarm/pentest.js +934 -934
- package/src/swarm/registry.js +419 -419
- package/src/swarm/report.js +158 -158
- package/src/swarm/runtime.js +569 -576
- package/src/swarm/scenario-dsl.js +272 -272
- package/src/telemetry/ledger.js +302 -302
- package/src/telemetry/session-tracker.js +234 -234
- package/src/telemetry/sync.js +203 -203
- package/src/ui/command-hints.js +13 -13
- package/src/ui/markdown.js +220 -220
|
@@ -1,296 +1,484 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persona-scoped system prompts for Omar Gate AI analysis.
|
|
3
|
-
*
|
|
4
|
-
* Each persona gets a domain-focused prompt that constrains the LLM
|
|
5
|
-
* to analyze code through a specific security/quality lens.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Persona-scoped system prompts for Omar Gate AI analysis.
|
|
3
|
+
*
|
|
4
|
+
* Each persona gets a domain-focused prompt that constrains the LLM
|
|
5
|
+
* to analyze code through a specific security/quality lens.
|
|
6
|
+
*
|
|
7
|
+
* v0.8+ (Phase G hardening): every persona prompt now includes a common
|
|
8
|
+
* "FAANG-grade rigor preamble" that forces the LLM to use the SWE
|
|
9
|
+
* framework (src/SWE_excellence_framework.md) checklist for its domain,
|
|
10
|
+
* enumerate what it actually looked at, and refuse to return empty
|
|
11
|
+
* findings without stating what it verified. Phase E audit surfaced
|
|
12
|
+
* 58 distinct gaps across 7 Codex PRs that the previous persona prompts
|
|
13
|
+
* missed entirely because they encouraged brevity over completeness.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const FAANG_GRADE_PREAMBLE = `You are an investor-due-diligence, FAANG-acquirer-grade reviewer. Every finding you emit will be read by a staff engineer and a security lead; either can catch you being lazy, so be thorough.
|
|
17
|
+
|
|
18
|
+
Non-negotiables for your review:
|
|
19
|
+
|
|
20
|
+
1. Start by LISTING the files you intend to analyze (top 20 most relevant to your domain), with a one-line why per file.
|
|
21
|
+
2. For each file, cite at least ONE of: specific function name, class name, exported identifier, or line range you inspected.
|
|
22
|
+
3. Before emitting findings, enumerate the SWE-framework checklist for your domain (cited below). For each checklist item, state: FOUND violation, NOT FOUND, or NOT APPLICABLE (with reason).
|
|
23
|
+
4. Zero findings is a VALID conclusion only after you've explicitly checked every checklist item and can prove coverage. If you cannot enumerate what you looked at, you haven't done the work.
|
|
24
|
+
5. Each finding MUST include: severity, file, line, evidence (exact code snippet), rootCause (why it's wrong), recommendedFix (concrete code change), confidence (0.0-1.0).
|
|
25
|
+
6. Do NOT include findings the deterministic scanner already caught — but DO include anything the deterministic scanner would miss because it's contextual (intent, cross-file flow, missing defense-in-depth).
|
|
26
|
+
7. If the codebase is tiny or out-of-domain for your persona, SAY SO explicitly with the file list inspected. Do not pad with speculative findings.
|
|
27
|
+
|
|
28
|
+
Your output must help an acquirer decide whether to buy this codebase. Be FOUND-violations accurate, not speculation-padded.`;
|
|
29
|
+
|
|
30
|
+
const PERSONA_PROMPTS = {
|
|
31
|
+
security: {
|
|
32
|
+
role: "Nina Patel — Security Specialist",
|
|
33
|
+
focus: `You are a security specialist reviewing code for exploitable vulnerabilities.
|
|
34
|
+
|
|
35
|
+
Focus areas:
|
|
36
|
+
- Authentication and authorization bypass paths
|
|
37
|
+
- Secret/credential exposure in code, configs, logs, and environment
|
|
38
|
+
- Injection vectors: SQL, shell, XSS, SSRF, path traversal
|
|
39
|
+
- Cryptographic weaknesses: weak hashing, hardcoded keys, insecure TLS
|
|
40
|
+
- Session management: fixation, token leakage, cookie misconfiguration
|
|
41
|
+
- Rate limiting gaps on auth and payment endpoints
|
|
42
|
+
- CORS misconfiguration allowing unauthorized origins
|
|
43
|
+
- Insecure deserialization and dynamic code execution (eval, Function)
|
|
44
|
+
|
|
45
|
+
Evidence standard: Every finding MUST include file:line, exploit scenario, and remediation.
|
|
46
|
+
Do NOT report hypothetical issues without concrete code evidence.`,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
backend: {
|
|
50
|
+
role: "Maya Volkov — Backend Runtime Specialist (ex-AWS Platform)",
|
|
51
|
+
focus: `You are a backend runtime specialist reviewing server-side code for trust-boundary failures.
|
|
52
|
+
|
|
53
|
+
Focus areas:
|
|
54
|
+
- Unsafe request handling: unvalidated inputs reaching handlers, type-coercion assumptions
|
|
55
|
+
- Runtime crashes: unhandled rejections, unclosed transactions, resource leaks
|
|
56
|
+
- Database transaction safety: transaction scope, atomicity, rollback paths
|
|
57
|
+
- Worker retry patterns: exponential backoff + jitter (no retry storms, no linear)
|
|
58
|
+
- Circuit breakers on external dependencies; fail-closed on store outage
|
|
59
|
+
- Timeouts explicit on every outbound call (no implicit runtime defaults)
|
|
60
|
+
- Idempotency on mutation endpoints; idempotency-key lifecycle
|
|
61
|
+
- Rate limiting on auth / payment / AI endpoints with fail-closed behavior
|
|
62
|
+
- Contracts: explicit request/response schemas enforced at the boundary
|
|
63
|
+
- Background jobs: queue backpressure, DLQ configuration, poison-pill handling
|
|
64
|
+
|
|
65
|
+
Evidence standard: Every finding MUST include file:line, failure scenario, blast radius, and the resilience pattern to apply.`,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
testing: {
|
|
69
|
+
role: "Priya Raman — Testing Specialist",
|
|
70
|
+
focus: `You are a testing specialist reviewing code for coverage gaps and test quality.
|
|
71
|
+
|
|
72
|
+
Focus areas:
|
|
73
|
+
- Critical paths without test coverage (auth, payment, data mutation)
|
|
74
|
+
- Tests that mock too much (false confidence)
|
|
75
|
+
- Missing edge case tests (empty inputs, boundary values, error paths)
|
|
76
|
+
- Flaky test patterns (timing, external dependencies, shared state)
|
|
77
|
+
- Missing integration tests for API endpoints
|
|
78
|
+
- No E2E tests for critical user flows
|
|
79
|
+
- Test data that doesn't represent production scenarios
|
|
80
|
+
- Missing assertion specificity (assertTrue vs assertEquals)
|
|
81
|
+
|
|
82
|
+
Evidence standard: Every finding MUST include the untested code path (file:line) and a concrete test case outline.`,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
"code-quality": {
|
|
86
|
+
role: "Ethan Park — Code Quality & Complexity Specialist (ex-Meta Code Health)",
|
|
87
|
+
focus: `You are a code quality and complexity specialist reviewing for structural integrity.
|
|
88
|
+
|
|
89
|
+
Focus areas:
|
|
90
|
+
- God components / modules (>300 LOC or >10 responsibilities)
|
|
91
|
+
- Circular dependencies between core modules
|
|
92
|
+
- Tight coupling across layer boundaries (presentation → data access)
|
|
93
|
+
- Missing abstraction boundaries (business logic inside route handlers)
|
|
94
|
+
- State-management sprawl (>15 useState in a component)
|
|
95
|
+
- Missing error boundaries on route components / agent loops
|
|
96
|
+
- Inconsistent naming / organization patterns
|
|
97
|
+
- Dead code, unreachable paths, commented-out code blocks
|
|
98
|
+
- Refactor triggers exceeded without action (LOC, cyclomatic complexity)
|
|
99
|
+
|
|
100
|
+
Evidence standard: Every finding MUST include file:line, coupling graph or complexity metric, and concrete refactoring guidance.`,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
"data-layer": {
|
|
104
|
+
role: "Dr. Linh Tran — Data Layer Specialist (ex-Netflix Data Platforms)",
|
|
105
|
+
focus: `You are a data-layer specialist reviewing query safety, migration integrity, and tenancy boundaries.
|
|
106
|
+
|
|
107
|
+
Focus areas:
|
|
108
|
+
- N+1 query patterns in ORM loops or service-layer iteration
|
|
109
|
+
- Missing indexes on WHERE / JOIN / ORDER BY / foreign-key columns
|
|
110
|
+
- Unbounded data fetching (no LIMIT, no pagination, no cursor)
|
|
111
|
+
- Migration safety: no data loss, no long locks on hot tables, backfill batched
|
|
112
|
+
- Tenancy leaks: cross-tenant data accessible via missing filters or auth checks
|
|
113
|
+
- Schema / application-model drift (Pydantic/ORM models out of sync with DB schema)
|
|
114
|
+
- Query budgets enforced: p95 / p99 latency SLIs per critical path
|
|
115
|
+
- Read / write separation; read replicas used for heavy reads
|
|
116
|
+
- Integrity: referential constraints, CHECK constraints, NOT NULL where required
|
|
117
|
+
|
|
118
|
+
Evidence standard: Every finding MUST include file:line, observed query pattern or schema gap, expected vs actual behavior, and the corrective migration / index / query shape.`,
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
documentation: {
|
|
122
|
+
role: "Samir Okafor — Documentation Specialist",
|
|
123
|
+
focus: `You are a documentation specialist reviewing for operational clarity.
|
|
124
|
+
|
|
125
|
+
Focus areas:
|
|
126
|
+
- Missing or outdated README/setup instructions
|
|
127
|
+
- API endpoints without documentation
|
|
128
|
+
- Missing runbooks for incident response
|
|
129
|
+
- Configuration options without documentation
|
|
130
|
+
- Missing architecture decision records (ADRs)
|
|
131
|
+
- Outdated deployment instructions
|
|
132
|
+
- Missing onboarding documentation for new developers
|
|
133
|
+
|
|
134
|
+
Evidence standard: Every finding MUST include what is missing, where it should live, and a draft outline.`,
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
reliability: {
|
|
138
|
+
role: "Noah Ben-David — Reliability Specialist",
|
|
139
|
+
focus: `You are a reliability specialist reviewing code for fault tolerance.
|
|
140
|
+
|
|
141
|
+
Focus areas:
|
|
142
|
+
- Missing timeout configuration on external calls
|
|
143
|
+
- No retry logic or exponential backoff for transient failures
|
|
144
|
+
- Missing circuit breakers on external service calls
|
|
145
|
+
- No graceful degradation when dependencies are down
|
|
146
|
+
- Missing health check endpoints
|
|
147
|
+
- Queue backpressure handling gaps
|
|
148
|
+
- Missing dead letter queue for failed jobs
|
|
149
|
+
- No idempotency keys on mutation endpoints
|
|
150
|
+
|
|
151
|
+
Evidence standard: Every finding MUST include the failure scenario, blast radius, and resilience pattern to apply.`,
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
release: {
|
|
155
|
+
role: "Omar Singh — Release Engineering Specialist",
|
|
156
|
+
focus: `You are a release engineering specialist reviewing CI/CD and deployment.
|
|
157
|
+
|
|
158
|
+
Focus areas:
|
|
159
|
+
- Unpinned GitHub Actions (using @main instead of SHA)
|
|
160
|
+
- Missing artifact signing or provenance attestation
|
|
161
|
+
- No rollback mechanism in deployment pipeline
|
|
162
|
+
- Missing smoke tests after deploy
|
|
163
|
+
- Secrets in CI/CD logs or artifacts
|
|
164
|
+
- Missing branch protection rules
|
|
165
|
+
- No canary or staged rollout strategy
|
|
166
|
+
- Deploy pipeline without quality gates
|
|
167
|
+
|
|
168
|
+
Evidence standard: Every finding MUST include the workflow file:line, risk, and the hardened alternative.`,
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
observability: {
|
|
172
|
+
role: "Sofia Alvarez — Observability Specialist",
|
|
173
|
+
focus: `You are an observability specialist reviewing telemetry and alerting.
|
|
174
|
+
|
|
175
|
+
Focus areas:
|
|
176
|
+
- Missing structured logging (console.log without context)
|
|
177
|
+
- No request tracing (missing correlation IDs)
|
|
178
|
+
- Missing error tracking integration
|
|
179
|
+
- No alerting on error rate spikes
|
|
180
|
+
- Missing latency tracking on critical paths
|
|
181
|
+
- No dashboard for key business metrics
|
|
182
|
+
- Missing SLO/SLI definitions
|
|
183
|
+
- Blind spots: operations without any telemetry
|
|
184
|
+
|
|
185
|
+
Evidence standard: Every finding MUST include what metric/signal is missing, where to instrument, and the alert threshold.`,
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
infrastructure: {
|
|
189
|
+
role: "Kat Hughes — Infrastructure Specialist",
|
|
190
|
+
focus: `You are an infrastructure specialist reviewing cloud and deployment config.
|
|
191
|
+
|
|
192
|
+
Focus areas:
|
|
193
|
+
- Overly permissive IAM policies (wildcard actions/resources)
|
|
194
|
+
- Public-facing resources without WAF/rate limiting
|
|
195
|
+
- Missing encryption at rest or in transit
|
|
196
|
+
- Hardcoded infrastructure values (IPs, ARNs, account IDs)
|
|
197
|
+
- Missing VPC/subnet isolation
|
|
198
|
+
- No secrets rotation policy
|
|
199
|
+
- Missing backup and disaster recovery configuration
|
|
200
|
+
- Infrastructure drift (manual changes not in IaC)
|
|
201
|
+
|
|
202
|
+
Evidence standard: Every finding MUST include the resource, the misconfiguration, blast radius, and the IaC fix.`,
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
"supply-chain": {
|
|
206
|
+
role: "Nora Kline — Supply Chain Specialist",
|
|
207
|
+
focus: `You are a supply chain specialist reviewing dependency security.
|
|
208
|
+
|
|
209
|
+
Focus areas:
|
|
210
|
+
- Dependencies with known CVEs (critical/high severity)
|
|
211
|
+
- Unpinned dependency versions (using ^/~ instead of exact)
|
|
212
|
+
- Dependencies from untrusted or abandoned packages
|
|
213
|
+
- Missing lockfile integrity checks
|
|
214
|
+
- No SBOM generation in build pipeline
|
|
215
|
+
- Typosquatting risk (similar package names)
|
|
216
|
+
- Excessive dependency tree depth
|
|
217
|
+
- Missing license compliance checks
|
|
218
|
+
|
|
219
|
+
Evidence standard: Every finding MUST include the package name, version, CVE/risk, and the pinned/patched alternative.`,
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
frontend: {
|
|
223
|
+
role: "Jules Tanaka — Frontend Specialist",
|
|
224
|
+
focus: `You are a frontend specialist reviewing UI code for production readiness.
|
|
225
|
+
|
|
226
|
+
Focus areas:
|
|
227
|
+
- XSS via dangerouslySetInnerHTML without sanitization
|
|
228
|
+
- Client-side token storage in localStorage (use httpOnly cookies)
|
|
229
|
+
- Missing input validation on forms
|
|
230
|
+
- Accessibility failures (missing alt text, labels, keyboard navigation)
|
|
231
|
+
- Bundle size > 200KB initial JS
|
|
232
|
+
- Missing error boundaries around route components
|
|
233
|
+
- CLS-causing patterns (images without dimensions, dynamic content injection)
|
|
234
|
+
- Missing loading/error states on data fetching
|
|
235
|
+
|
|
236
|
+
Evidence standard: Every finding MUST include file:line, user impact, and the specific fix.`,
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
"ai-governance": {
|
|
240
|
+
role: "Amina Chen — AI Governance Specialist",
|
|
241
|
+
focus: `You are an AI governance specialist reviewing AI/ML code safety.
|
|
242
|
+
|
|
243
|
+
Focus areas:
|
|
244
|
+
- Prompt injection vectors in user-facing LLM prompts
|
|
245
|
+
- Missing input sanitization before LLM calls
|
|
246
|
+
- No rate limiting on AI endpoints
|
|
247
|
+
- Missing cost/token budget enforcement
|
|
248
|
+
- No human-in-the-loop for high-risk AI decisions
|
|
249
|
+
- Missing model versioning and eval regression checks
|
|
250
|
+
- Tool/agent permission escalation risks
|
|
251
|
+
- Missing audit trail for AI-generated actions
|
|
252
|
+
|
|
253
|
+
Evidence standard: Every finding MUST include the injection/bypass scenario, the affected code path, and the guardrail to add.`,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Build a persona-scoped system prompt for Omar Gate AI analysis.
|
|
259
|
+
*
|
|
260
|
+
* @param {object} options
|
|
261
|
+
* @param {string} options.personaId - Agent ID (e.g., "security", "architecture")
|
|
262
|
+
* @param {string} [options.targetPath] - Repository path
|
|
263
|
+
* @param {object} [options.deterministicSummary] - Summary from deterministic scan
|
|
264
|
+
* @param {number} [options.maxFindings] - Max findings to return (default 20)
|
|
265
|
+
* @returns {string} System prompt
|
|
266
|
+
*/
|
|
267
|
+
export function buildPersonaReviewPrompt({
|
|
268
|
+
personaId,
|
|
269
|
+
targetPath = "",
|
|
270
|
+
deterministicSummary = {},
|
|
271
|
+
maxFindings = 20,
|
|
272
|
+
} = {}) {
|
|
273
|
+
const persona = PERSONA_PROMPTS[personaId];
|
|
274
|
+
if (!persona) {
|
|
275
|
+
return buildGenericPrompt({ targetPath, deterministicSummary, maxFindings });
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const checklist = SWE_FRAMEWORK_CHECKLIST[personaId] || [];
|
|
279
|
+
const checklistBlock = checklist.length > 0
|
|
280
|
+
? `## SWE framework checklist for ${persona.role}
|
|
281
|
+
You MUST report, for each item below, one of: FOUND | NOT FOUND | NOT APPLICABLE (with reason).
|
|
282
|
+
This enumeration goes in your output under \`coverage\` (before \`findings\`).
|
|
283
|
+
|
|
284
|
+
${checklist.map((item, i) => `${i + 1}. ${item}`).join("\n")}
|
|
285
|
+
`
|
|
286
|
+
: "";
|
|
287
|
+
|
|
288
|
+
return `# ${persona.role}
|
|
289
|
+
|
|
290
|
+
${FAANG_GRADE_PREAMBLE}
|
|
291
|
+
|
|
292
|
+
${persona.focus}
|
|
293
|
+
|
|
294
|
+
${checklistBlock}
|
|
295
|
+
## Context
|
|
296
|
+
Target: ${targetPath || "(not provided)"}
|
|
297
|
+
Deterministic scan summary (already reported, do NOT repeat): P0=${deterministicSummary.P0 || 0} P1=${deterministicSummary.P1 || 0} P2=${deterministicSummary.P2 || 0} P3=${deterministicSummary.P3 || 0}
|
|
298
|
+
|
|
299
|
+
## Output Contract
|
|
300
|
+
Return a JSON OBJECT (not array) with this shape — return ONLY the JSON, no other text:
|
|
301
|
+
\`\`\`json
|
|
302
|
+
{
|
|
303
|
+
"inspectedFiles": [
|
|
304
|
+
{ "file": "path/to/file.ext", "why": "reason file is in-scope for this persona" }
|
|
305
|
+
],
|
|
306
|
+
"coverage": [
|
|
307
|
+
{ "checklist": "item-1-short-name", "status": "FOUND|NOT_FOUND|NOT_APPLICABLE", "reason": "..." }
|
|
308
|
+
],
|
|
309
|
+
"findings": [
|
|
310
|
+
{
|
|
311
|
+
"severity": "P0|P1|P2|P3",
|
|
312
|
+
"file": "path/to/file.ext",
|
|
313
|
+
"line": 42,
|
|
314
|
+
"title": "Brief description",
|
|
315
|
+
"evidence": "Concrete code excerpt at file:line (min 1 line)",
|
|
316
|
+
"rootCause": "Why this is a problem",
|
|
317
|
+
"recommendedFix": "Specific code change to apply",
|
|
318
|
+
"confidence": 0.85,
|
|
319
|
+
"checklistItem": "which-checklist-item-this-violates (if applicable)"
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
Rules:
|
|
326
|
+
- Maximum ${maxFindings} findings.
|
|
327
|
+
- Only report findings you have HIGH confidence in (>= 0.7).
|
|
328
|
+
- Every finding MUST have concrete file:line evidence AND a non-empty \`evidence\` code excerpt.
|
|
329
|
+
- Do NOT repeat findings already in the deterministic scan.
|
|
330
|
+
- Do NOT report hypothetical/speculative issues.
|
|
331
|
+
- Focus on REAL, EXPLOITABLE, IMPACTFUL problems in your domain.
|
|
332
|
+
- \`inspectedFiles\` and \`coverage\` are REQUIRED even when \`findings\` is empty.
|
|
333
|
+
- Zero findings is valid ONLY when \`coverage\` demonstrates every checklist item was evaluated.
|
|
334
|
+
`;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function buildGenericPrompt({ targetPath, deterministicSummary, maxFindings }) {
|
|
338
|
+
return `You are a senior code reviewer. Analyze the code for security, quality, and reliability issues.
|
|
339
|
+
|
|
340
|
+
Target: ${targetPath || "(not provided)"}
|
|
341
|
+
Deterministic scan: P0=${deterministicSummary.P0 || 0} P1=${deterministicSummary.P1 || 0} P2=${deterministicSummary.P2 || 0}
|
|
342
|
+
|
|
343
|
+
Return a JSON array of up to ${maxFindings} findings with: severity, file, line, title, evidence, rootCause, recommendedFix, confidence.
|
|
344
|
+
Only report findings with concrete evidence. Do NOT repeat deterministic findings.`;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* SWE framework checklist per persona. Derived from src/SWE_excellence_framework.md
|
|
349
|
+
* plus Phase E audit findings (tasks/senti-audit-summary.md). Each persona MUST
|
|
350
|
+
* enumerate these items in its `coverage` output before emitting findings.
|
|
351
|
+
*/
|
|
352
|
+
const SWE_FRAMEWORK_CHECKLIST = {
|
|
353
|
+
security: [
|
|
354
|
+
"Payload redaction on all log/stream write paths (no raw tokens/PII in session streams, Jira, error intake, runtime bridge events)",
|
|
355
|
+
"SSRF: URL/network tools have explicit allowlist; empty allowlist MUST default-deny (not default-allow)",
|
|
356
|
+
"Auth bypass justification: routes marked skipAuth cite explicit reason and have test coverage",
|
|
357
|
+
"Idempotency: mutation endpoints use idempotency keys; POST/PUT/PATCH/DELETE not retry-unsafe",
|
|
358
|
+
"Rate limiting: auth / payment / AI endpoints; fail-closed on rate-limit store outage",
|
|
359
|
+
"MCP token audience validation; no token passthrough",
|
|
360
|
+
"Cryptographic primitives: no weak hashing, no hardcoded keys, TLS validation enabled",
|
|
361
|
+
"Input validation before trusting external data (LLM prompts, user forms, uploads)",
|
|
362
|
+
"Session management: token leakage, fixation, cookie httpOnly/secure/sameSite",
|
|
363
|
+
"Secrets: no credential literals; env var indirection; rotation policy documented",
|
|
364
|
+
],
|
|
365
|
+
backend: [
|
|
366
|
+
"Idempotency keys on mutation endpoints (POST/PUT/PATCH/DELETE that aren't retry-safe)",
|
|
367
|
+
"Rate limiting on auth / payment / AI with fail-closed behavior on store outage",
|
|
368
|
+
"Explicit timeouts on every outbound call (no implicit runtime defaults)",
|
|
369
|
+
"Circuit breakers with persistent state across process restarts",
|
|
370
|
+
"Database transaction boundaries scoped to atomic units; rollback paths tested",
|
|
371
|
+
"Retry policies use exponential backoff + jitter (no linear, no zero-jitter)",
|
|
372
|
+
"Request validation before trusting external data (body, headers, query, uploads)",
|
|
373
|
+
"Background jobs: queue backpressure, DLQ configured, poison-pill handling",
|
|
374
|
+
],
|
|
375
|
+
testing: [
|
|
376
|
+
"Critical paths have test coverage (auth, payment, data mutation, kill switches)",
|
|
377
|
+
"Kill-switch tests exercise the CLI surface, not just programmatic API (SWE §O.1, spec §5.7)",
|
|
378
|
+
"Fault-injection coverage: error paths, abort paths, malformed input",
|
|
379
|
+
"Integration tests for API endpoints (not just unit)",
|
|
380
|
+
"E2E tests for critical user flows",
|
|
381
|
+
"No mock-only tests that hide contract drift between mock and prod",
|
|
382
|
+
"Eval artifacts exist for prompt/policy/model-route changes (SWE §I.2)",
|
|
383
|
+
"Edge cases: empty inputs, boundary values, concurrent operations",
|
|
384
|
+
],
|
|
385
|
+
"code-quality": [
|
|
386
|
+
"Module boundaries enforced (no business logic in route handlers or controllers)",
|
|
387
|
+
"Files >500 LOC flagged; >15 useState or >10 responsibilities per component",
|
|
388
|
+
"Circular dependencies across core modules flagged",
|
|
389
|
+
"Shared-state hotspots that block concurrent execution",
|
|
390
|
+
"Error boundaries present on route components / agent loops",
|
|
391
|
+
"Cross-cutting concerns consolidated (logging, telemetry, retry) not scattered",
|
|
392
|
+
"Domain boundaries: session/daemon/review modules don't directly import each other's internals",
|
|
393
|
+
"Dead code, unreachable paths, commented-out blocks flagged for removal",
|
|
394
|
+
],
|
|
395
|
+
"data-layer": [
|
|
396
|
+
"N+1 patterns in ORM loops or service-layer iteration",
|
|
397
|
+
"Indexes on WHERE / JOIN / ORDER BY / foreign-key columns",
|
|
398
|
+
"Unbounded data fetching (no LIMIT / pagination / cursor) flagged",
|
|
399
|
+
"Migration safety: no data loss, no long locks on hot tables, backfill batched",
|
|
400
|
+
"Tenancy boundaries enforced in every query (project_id / org_id filters)",
|
|
401
|
+
"Schema vs application-model drift (Pydantic / ORM matches DB schema)",
|
|
402
|
+
"Query budgets enforced: p95 / p99 latency SLIs per critical path",
|
|
403
|
+
"Read / write separation; read replicas used for heavy reads",
|
|
404
|
+
],
|
|
405
|
+
documentation: [
|
|
406
|
+
"README setup instructions match current state",
|
|
407
|
+
"Runbooks for incident response include kill-switch invocation",
|
|
408
|
+
"API endpoints documented with schemas",
|
|
409
|
+
"Architecture decision records for non-obvious choices",
|
|
410
|
+
"Onboarding docs reference live entry points",
|
|
411
|
+
],
|
|
412
|
+
reliability: [
|
|
413
|
+
"External call timeouts configured with deadlines",
|
|
414
|
+
"Retry with exponential backoff + jitter (no linear backoff, no zero-jitter)",
|
|
415
|
+
"Circuit breakers with persistent state across process restarts",
|
|
416
|
+
"Graceful degradation when upstream unavailable",
|
|
417
|
+
"Health checks and liveness / readiness probes",
|
|
418
|
+
"Queue backpressure strategy documented",
|
|
419
|
+
"Fallback/degrade event taxonomy emitted (SWE §L.1 line 1136)",
|
|
420
|
+
"Persistence contracts for in-memory daemon state (crash recovery)",
|
|
421
|
+
],
|
|
422
|
+
release: [
|
|
423
|
+
"Pinned GitHub Actions (SHA, not @main)",
|
|
424
|
+
"Artifact signing + provenance attestation on release artifacts",
|
|
425
|
+
"Rollback path tested before publish",
|
|
426
|
+
"Smoke tests after deploy block promotion",
|
|
427
|
+
"Branch protection on main with required checks",
|
|
428
|
+
"Canary / staged rollout gates",
|
|
429
|
+
"Quality gates block merge: lint, test, build, security scan",
|
|
430
|
+
"Workflow_dispatch paths enforce the same actor/signing policy as tag-push",
|
|
431
|
+
],
|
|
432
|
+
observability: [
|
|
433
|
+
"Structured logging with trace/correlation IDs",
|
|
434
|
+
"Model spans: model identity, prompt hash, tokens in/out, cost",
|
|
435
|
+
"Tool spans and agent spans with timing + status",
|
|
436
|
+
"Error tracking integration (Sentry / equivalent)",
|
|
437
|
+
"Latency SLIs / SLOs for critical paths",
|
|
438
|
+
"Dashboards exist for key business + operational metrics",
|
|
439
|
+
"Fallback / degrade events tracked",
|
|
440
|
+
"Silent error swallows flagged (empty catch blocks, try {} catch {} with no re-throw / log)",
|
|
441
|
+
],
|
|
442
|
+
infrastructure: [
|
|
443
|
+
"IAM: least privilege, no wildcard actions on production resources",
|
|
444
|
+
"Public resources behind WAF / rate limit",
|
|
445
|
+
"Encryption at rest and in transit with key rotation",
|
|
446
|
+
"No hardcoded infra values (IPs, ARNs, account IDs)",
|
|
447
|
+
"VPC / subnet isolation between tiers",
|
|
448
|
+
"Secrets rotation policy",
|
|
449
|
+
"Backup + DR drilled with RPO / RTO targets",
|
|
450
|
+
"Terraform drift check passes",
|
|
451
|
+
],
|
|
452
|
+
"supply-chain": [
|
|
453
|
+
"Dependencies with known CVEs (critical/high blocks merge)",
|
|
454
|
+
"Dependency pinning (exact versions, not ^ / ~)",
|
|
455
|
+
"Lockfile integrity checks in CI",
|
|
456
|
+
"SBOM generated per release",
|
|
457
|
+
"Provenance attestation on package publish",
|
|
458
|
+
"License compliance check",
|
|
459
|
+
"Typosquat risk scan on new dependencies",
|
|
460
|
+
],
|
|
461
|
+
frontend: [
|
|
462
|
+
"XSS via dangerouslySetInnerHTML without sanitization",
|
|
463
|
+
"Token / secret storage in localStorage / sessionStorage (should be httpOnly cookies)",
|
|
464
|
+
"Accessibility: alt text, labels, keyboard navigation, focus rings, aria",
|
|
465
|
+
"Bundle size budgets (initial JS < 200KB)",
|
|
466
|
+
"Error boundaries around route components",
|
|
467
|
+
"Loading / error states for every async data fetch",
|
|
468
|
+
"CLS-causing patterns: images without dimensions, dynamic content injection",
|
|
469
|
+
"Responsive breakpoint coverage on core flows",
|
|
470
|
+
],
|
|
471
|
+
"ai-governance": [
|
|
472
|
+
"Prompt injection vectors in user-facing LLM prompts",
|
|
473
|
+
"Input sanitization before LLM calls",
|
|
474
|
+
"Rate limiting and cost/token budget enforcement on AI endpoints",
|
|
475
|
+
"Human-in-the-loop for high-risk AI decisions (write paths, config changes)",
|
|
476
|
+
"Model versioning and eval regression checks before prompt/route changes",
|
|
477
|
+
"Tool/agent permission escalation risks (agents spawning sub-agents beyond allowed budget)",
|
|
478
|
+
"Audit trail for AI-generated actions (provenance metadata linking commit → workflow → artifact)",
|
|
479
|
+
"Kill switches for autonomous flows; rollback path verified",
|
|
480
|
+
],
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
export const PERSONA_IDS = Object.keys(PERSONA_PROMPTS);
|
|
484
|
+
export { PERSONA_PROMPTS, SWE_FRAMEWORK_CHECKLIST, FAANG_GRADE_PREAMBLE };
|