sentinelayer-cli 0.4.4 → 0.6.2

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 (149) hide show
  1. package/README.md +996 -998
  2. package/bin/create-sentinelayer.js +5 -5
  3. package/bin/sentinelayer-cli.js +4 -4
  4. package/bin/sl.js +5 -5
  5. package/package.json +63 -63
  6. package/src/agents/jules/config/definition.js +160 -209
  7. package/src/agents/jules/config/system-prompt.js +182 -175
  8. package/src/agents/jules/error-intake.js +51 -51
  9. package/src/agents/jules/fix-cycle.js +17 -377
  10. package/src/agents/jules/loop.js +450 -367
  11. package/src/agents/jules/pulse.js +10 -327
  12. package/src/agents/jules/stream.js +186 -186
  13. package/src/agents/jules/swarm/file-scanner.js +74 -74
  14. package/src/agents/jules/swarm/index.js +11 -11
  15. package/src/agents/jules/swarm/orchestrator.js +362 -362
  16. package/src/agents/jules/swarm/pattern-hunter.js +123 -123
  17. package/src/agents/jules/swarm/sub-agent.js +309 -308
  18. package/src/agents/jules/tools/aidenid-email.js +189 -0
  19. package/src/agents/jules/tools/auth-audit.js +1691 -557
  20. package/src/agents/jules/tools/dispatch.js +335 -327
  21. package/src/agents/jules/tools/file-edit.js +2 -180
  22. package/src/agents/jules/tools/file-read.js +2 -100
  23. package/src/agents/jules/tools/frontend-analyze.js +570 -570
  24. package/src/agents/jules/tools/glob.js +2 -168
  25. package/src/agents/jules/tools/grep.js +2 -228
  26. package/src/agents/jules/tools/index.js +29 -29
  27. package/src/agents/jules/tools/path-guards.js +2 -161
  28. package/src/agents/jules/tools/runtime-audit.js +507 -503
  29. package/src/agents/jules/tools/shell.js +2 -383
  30. package/src/agents/jules/tools/url-policy.js +100 -100
  31. package/src/agents/persona-visuals.js +61 -0
  32. package/src/agents/shared-tools/dispatch-core.js +315 -0
  33. package/src/agents/shared-tools/file-edit.js +180 -0
  34. package/src/agents/shared-tools/file-read.js +100 -0
  35. package/src/agents/shared-tools/glob.js +168 -0
  36. package/src/agents/shared-tools/grep.js +228 -0
  37. package/src/agents/shared-tools/index.js +46 -0
  38. package/src/agents/shared-tools/path-guards.js +161 -0
  39. package/src/agents/shared-tools/shell.js +383 -0
  40. package/src/ai/aidenid.js +1009 -972
  41. package/src/ai/client.js +553 -508
  42. package/src/ai/domain-target-store.js +268 -268
  43. package/src/ai/identity-store.js +270 -270
  44. package/src/ai/proxy.js +137 -0
  45. package/src/ai/site-store.js +145 -145
  46. package/src/audit/agents/architecture.js +180 -180
  47. package/src/audit/agents/compliance.js +179 -179
  48. package/src/audit/agents/documentation.js +165 -165
  49. package/src/audit/agents/performance.js +145 -145
  50. package/src/audit/agents/security.js +215 -215
  51. package/src/audit/agents/testing.js +172 -172
  52. package/src/audit/orchestrator.js +557 -557
  53. package/src/audit/package.js +204 -204
  54. package/src/audit/registry.js +284 -284
  55. package/src/audit/replay.js +103 -103
  56. package/src/auth/gate.js +371 -126
  57. package/src/auth/http.js +611 -270
  58. package/src/auth/service.js +1106 -891
  59. package/src/auth/session-store.js +813 -359
  60. package/src/cli.js +252 -252
  61. package/src/commands/ai/identity-lifecycle.js +1338 -1338
  62. package/src/commands/ai/provision-governance.js +1272 -1272
  63. package/src/commands/ai/shared.js +147 -147
  64. package/src/commands/ai.js +11 -11
  65. package/src/commands/apply.js +12 -12
  66. package/src/commands/audit.js +1166 -1166
  67. package/src/commands/auth.js +419 -375
  68. package/src/commands/chat.js +191 -191
  69. package/src/commands/config.js +184 -184
  70. package/src/commands/cost.js +311 -311
  71. package/src/commands/daemon/core.js +850 -850
  72. package/src/commands/daemon/extended.js +1048 -1048
  73. package/src/commands/daemon/shared.js +213 -213
  74. package/src/commands/daemon.js +11 -11
  75. package/src/commands/guide.js +174 -174
  76. package/src/commands/ingest.js +58 -58
  77. package/src/commands/init.js +55 -55
  78. package/src/commands/legacy-args.js +10 -10
  79. package/src/commands/mcp.js +461 -461
  80. package/src/commands/omargate.js +29 -21
  81. package/src/commands/persona.js +20 -20
  82. package/src/commands/plugin.js +260 -260
  83. package/src/commands/policy.js +132 -132
  84. package/src/commands/prompt.js +238 -238
  85. package/src/commands/review.js +704 -704
  86. package/src/commands/scan.js +872 -866
  87. package/src/commands/spec.js +716 -716
  88. package/src/commands/swarm.js +651 -651
  89. package/src/commands/telemetry.js +202 -202
  90. package/src/commands/watch.js +511 -510
  91. package/src/config/agent-dictionary.js +182 -182
  92. package/src/config/io.js +56 -56
  93. package/src/config/paths.js +18 -18
  94. package/src/config/schema.js +55 -55
  95. package/src/config/service.js +184 -184
  96. package/src/cost/budget.js +235 -235
  97. package/src/cost/history.js +188 -188
  98. package/src/cost/tracker.js +171 -171
  99. package/src/daemon/artifact-lineage.js +534 -534
  100. package/src/daemon/assignment-ledger.js +770 -770
  101. package/src/daemon/ast-parser-layer.js +258 -258
  102. package/src/daemon/budget-governor.js +633 -633
  103. package/src/daemon/callgraph-overlay.js +646 -646
  104. package/src/daemon/error-worker.js +626 -626
  105. package/src/daemon/fix-cycle.js +377 -0
  106. package/src/daemon/hybrid-mapper.js +929 -929
  107. package/src/daemon/jira-lifecycle.js +632 -632
  108. package/src/daemon/operator-control.js +657 -657
  109. package/src/daemon/pulse.js +327 -0
  110. package/src/daemon/reliability-lane.js +471 -471
  111. package/src/daemon/watchdog.js +971 -971
  112. package/src/guide/generator.js +316 -316
  113. package/src/ingest/engine.js +918 -918
  114. package/src/interactive/index.js +97 -95
  115. package/src/legacy-cli.js +2994 -2592
  116. package/src/mcp/registry.js +695 -695
  117. package/src/memory/blackboard.js +301 -301
  118. package/src/memory/retrieval.js +581 -581
  119. package/src/plugin/manifest.js +553 -553
  120. package/src/policy/packs.js +144 -144
  121. package/src/prompt/generator.js +118 -118
  122. package/src/review/ai-review.js +679 -669
  123. package/src/review/local-review.js +1305 -1295
  124. package/src/review/omargate-interactive.js +68 -0
  125. package/src/review/omargate-orchestrator.js +300 -0
  126. package/src/review/persona-prompts.js +296 -0
  127. package/src/review/replay.js +235 -235
  128. package/src/review/report.js +664 -664
  129. package/src/review/scan-modes.js +42 -0
  130. package/src/review/spec-binding.js +487 -487
  131. package/src/scaffold/generator.js +67 -67
  132. package/src/scaffold/templates.js +150 -150
  133. package/src/scan/generator.js +418 -418
  134. package/src/scan/gh-secrets.js +107 -107
  135. package/src/spec/generator.js +519 -519
  136. package/src/spec/regenerate.js +237 -237
  137. package/src/spec/templates.js +91 -91
  138. package/src/swarm/dashboard.js +247 -247
  139. package/src/swarm/factory.js +363 -363
  140. package/src/swarm/pentest.js +934 -934
  141. package/src/swarm/registry.js +419 -419
  142. package/src/swarm/report.js +158 -158
  143. package/src/swarm/runtime.js +576 -576
  144. package/src/swarm/scenario-dsl.js +272 -272
  145. package/src/telemetry/ledger.js +302 -302
  146. package/src/telemetry/session-tracker.js +234 -118
  147. package/src/telemetry/sync.js +203 -199
  148. package/src/ui/command-hints.js +13 -0
  149. package/src/ui/markdown.js +220 -220
package/README.md CHANGED
@@ -1,998 +1,996 @@
1
- # sentinelayer-cli
2
-
3
- `npx sentinelayer-cli@latest <project-name>`
4
-
5
- Scaffolds Sentinelayer spec/prompt/guide artifacts and bootstraps `SENTINELAYER_TOKEN` without manual copy/paste, with optional `BYOK` mode.
6
-
7
- CLI binaries:
8
-
9
- - `sentinelayer-cli` (primary)
10
- - `create-sentinelayer` (compatibility alias)
11
- - `sentinel` (legacy alias)
12
- - `sl` (short alias)
13
-
14
- ## What it does
15
-
16
- - runs an interactive project interview
17
- - opens browser auth at Sentinelayer `/cli-auth`
18
- - receives approved auth session in terminal
19
- - supports explicit `BYOK` mode (skip Sentinelayer browser auth/token bootstrap)
20
- - optionally opens GitHub auth (`gh auth login -w`) and lets you arrow-select a repo
21
- - optionally clones the selected repo into the current folder for in-place feature work
22
- - generates `spec + build guide + execution prompt + omar workflow + todo + handoff prompt`
23
- - issues bootstrap `SENTINELAYER_TOKEN` when managed auth mode is used
24
- - writes token to local `.env` when managed auth mode is used
25
- - optionally injects token to GitHub Actions secret via `gh secret set` in managed auth mode
26
- - ensures target workspace is a git repo (`git init` + `origin` when needed)
27
-
28
- ## Current Production Bundle
29
-
30
- Initial production scope is intentionally narrow and hardened:
31
-
32
- - Omar baseline gate workflows and deterministic local gate checks
33
- - Jules Tanaka deep frontend audits (`sl audit frontend --stream`)
34
- - Reproducible review/audit artifacts and runtime telemetry
35
-
36
- Primary commands in this shipping lane:
37
-
38
- ```bash
39
- sl auth login --api-url https://api.sentinelayer.com
40
- sl scan init --path . --non-interactive
41
- sl omargate deep --path .
42
- sl audit frontend --path ./my-react-app --stream
43
- sl review --diff
44
- sl watch run-events --run-id <run-id>
45
- ```
46
-
47
- ## 60-second flow
48
-
49
- 1. Trigger:
50
-
51
- ```bash
52
- npx sentinelayer-cli@latest my-agent-app
53
- ```
54
-
55
- 2. Interview prompts (project goal, provider, coding agent, auth mode, depth, audience, project type, optional repo connect).
56
- 3. If repo connect is enabled:
57
- - choose repo source: current repo, GitHub picker, or manual `owner/repo`
58
- - optional browser GitHub authorization
59
- - optional clone into local workspace for existing-codebase feature work
60
- 4. Browser auth opens automatically in managed auth mode.
61
- 5. Token + artifacts are generated.
62
- 6. CLI prints handoff and next command:
63
-
64
- ```bash
65
- npm run sentinel:start
66
- ```
67
-
68
- ## Non-interactive mode (CI/E2E)
69
-
70
- Use non-interactive mode to run full scaffolding in automation:
71
-
72
- ```bash
73
- SENTINELAYER_CLI_INTERVIEW_JSON='{"projectName":"demo-app","projectDescription":"Build an autonomous secure code review orchestrator.","aiProvider":"openai","codingAgent":"codex","authMode":"sentinelayer","generationMode":"detailed","audienceLevel":"developer","projectType":"greenfield","techStack":["TypeScript","Node.js"],"features":["auth","scan"],"connectRepo":false,"injectSecret":false}' \
74
- npx sentinelayer-cli@latest demo-app --non-interactive --skip-browser-open
75
- ```
76
-
77
- Inputs for non-interactive mode:
78
-
79
- - `SENTINELAYER_CLI_INTERVIEW_JSON` (JSON string)
80
- - interview JSON supports `authMode: "sentinelayer" | "byok"` (default: `sentinelayer`)
81
- - or `--interview-file <path-to-json>`
82
- - `--non-interactive` is required to disable prompts
83
- - `--skip-browser-open` avoids launching local browser in headless runs
84
- - `--help` / `-h` prints CLI usage
85
- - `--version` / `-v` prints CLI version
86
- - `SENTINELAYER_GITHUB_CLONE_BASE_URL` overrides clone base (default `https://github.com`)
87
-
88
- ## Generated files
89
-
90
- - `docs/spec.md`
91
- - `docs/build-guide.md`
92
- - `prompts/execution-prompt.md`
93
- - `.github/workflows/omar-gate.yml`
94
- - `tasks/todo.md`
95
- - `AGENT_HANDOFF_PROMPT.md` (read order + Omar loop + local command matrix + workflow tuning options)
96
- - coding-agent config file for selected agent when supported (examples: `CLAUDE.md`, `.cursorrules`, `.github/copilot-instructions.md`)
97
- - `package.json` (adds `sentinel:start`, `sentinel:omargate`, `sentinel:omargate:json`, `sentinel:audit`, `sentinel:audit:json`, `sentinel:persona:*`, `sentinel:apply` when missing)
98
- - `.env` with `SENTINELAYER_TOKEN` (or API-provided secret name) in managed auth mode
99
-
100
- ## Advanced options
101
-
102
- When `Advanced options?` is enabled:
103
-
104
- - `Auth mode` (`sentinelayer` or `byok`)
105
- - `Connect a GitHub repo and inject Actions secret?`
106
- - `How should we choose the repo?` (current / GitHub picker / manual)
107
- - GitHub picker reads all accessible repos via paginated `gh api`
108
- - `Clone this repo locally and build directly into it now?`
109
- - `Inject SENTINELAYER_TOKEN into GitHub Actions secrets now?` (managed auth mode only)
110
- - Final review step lets you proceed, restart interview, or cancel cleanly
111
-
112
- The CLI validates repo format and secret-name format before injection.
113
-
114
- ## Existing codebase mode
115
-
116
- When `Clone this repo locally and build directly into it now?` is enabled:
117
-
118
- - the CLI clones `<owner>/<repo>` into `./<repo-name>` unless current folder already matches that repo
119
- - it writes generated docs/prompts/tasks/workflow into that cloned repo
120
- - it extracts a deterministic repo summary and includes it in generation context
121
- - if the repo is empty, scaffolding still proceeds deterministically
122
- - if the target folder already contains a different non-empty repo, CLI fails fast with a clear error
123
- - if the target folder is a git repo without a detectable GitHub `origin`, CLI refuses to continue
124
-
125
- ## Token handling model
126
-
127
- - browser auth JWT is used in-memory only
128
- - in managed auth mode, CLI stores only bootstrap token in `.env`
129
- - in managed auth mode, GitHub secret injection uses stdin (`gh secret set ...`) and never writes token to command history
130
- - in managed auth mode, secret injection is verified with `gh secret list --repo <owner/repo>`
131
- - API fallback secret name is pinned to `SENTINELAYER_TOKEN` if server response is invalid
132
- - in BYOK mode, no Sentinelayer token is created or injected
133
-
134
- ## Persistent CLI auth sessions (Phase 4 foundation slice)
135
-
136
- For long-running agent/operator workflows, the CLI now supports persistent auth sessions:
137
-
138
- - `sl auth login --api-url https://api.sentinelayer.com --skip-browser-open`
139
- - `sl auth status`
140
- - `sl auth logout`
141
- - `sl auth sessions`
142
- - `sl auth revoke --token-id <token-id>`
143
-
144
- Behavior:
145
-
146
- - login uses browser approval (`/api/v1/auth/cli/sessions/*`)
147
- - after approval, CLI mints a long-lived API token (`/api/v1/auth/api-tokens`)
148
- - session metadata is stored at `~/.sentinelayer/credentials.json`
149
- - token storage uses OS keyring when `keytar` is available; file fallback is used otherwise
150
- - near-expiry token rotation is automatic on command use for stored sessions
151
- - env/config tokens still take precedence:
152
- - `SENTINELAYER_TOKEN`
153
- - `.sentinelayer.yml` `sentinelayerToken`
154
-
155
- Opt-out of keyring usage:
156
-
157
- - `SENTINELAYER_DISABLE_KEYRING=1`
158
-
159
- ## Runtime watch streaming (Phase 9 foundation slice)
160
-
161
- You can stream runtime run events directly from the CLI:
162
-
163
- - `sl watch run-events --run-id <run-id>`
164
- - `sl watch runtime --run-id <run-id>` (alias)
165
- - `sl watch history` (list persisted watch summaries)
166
-
167
- Options:
168
-
169
- - `--poll-seconds <seconds>` polling interval
170
- - `--max-idle-seconds <seconds>` optional idle timeout
171
- - `--output-dir <path>` artifact root override
172
- - `--json` machine-readable event stream + summary
173
-
174
- By default, watch output is persisted to:
175
-
176
- - `.sentinelayer/observability/runtime-watch/<run-id>/events-<timestamp>.ndjson`
177
- - `.sentinelayer/observability/runtime-watch/<run-id>/summary-<timestamp>.json`
178
-
179
- ## Chat command foundation (Phase 2.1 slice)
180
-
181
- The CLI now includes a low-latency chat command surface:
182
-
183
- - `sl chat ask --prompt "Summarize this diff" --dry-run`
184
- - `sl chat ask --prompt "Explain this failure" --provider openai --model gpt-4o`
185
-
186
- Each call appends reproducible transcript entries to:
187
-
188
- - `.sentinelayer/chat/sessions/<session-id>.jsonl`
189
-
190
- ## Deterministic review pipeline (Phase 9.2 foundation slice)
191
-
192
- The default `review` command now runs a layered deterministic pipeline:
193
-
194
- - `sl review` (full workspace mode)
195
- - `sl review --diff` (staged + unstaged + untracked git changes)
196
- - `sl review --staged` (staged changes only)
197
-
198
- Each run writes reproducible artifacts to:
199
-
200
- - `.sentinelayer/reviews/<run-id>/REVIEW_DETERMINISTIC.md`
201
- - `.sentinelayer/reviews/<run-id>/REVIEW_DETERMINISTIC.json`
202
- - `.sentinelayer/reviews/<run-id>/checks/*.log` (static check output)
203
-
204
- For compatibility, lightweight scan mode remains available:
205
-
206
- - `sl review scan --mode full|diff|staged`
207
- - `.sentinelayer/reports/review-scan-<mode>-<timestamp>.md`
208
-
209
- ## AI review layers (Phase 9.3 slice)
210
-
211
- The `review` command can now add budget-governed AI reasoning on top of deterministic findings:
212
-
213
- - `sl review --ai --provider openai --model gpt-5.3-codex`
214
- - `sl review --ai --ai-dry-run` (no provider call; deterministic synthetic output)
215
- - `sl review --ai --max-cost 1.0 --max-tokens 0 --max-runtime-ms 0 --max-tool-calls 0`
216
-
217
- AI artifacts are persisted in the same run folder:
218
-
219
- - `.sentinelayer/reviews/<run-id>/REVIEW_AI_PROMPT.txt`
220
- - `.sentinelayer/reviews/<run-id>/REVIEW_AI.md`
221
- - `.sentinelayer/reviews/<run-id>/REVIEW_AI.json`
222
-
223
- AI usage, cost, and stop-class telemetry are appended to:
224
-
225
- - `.sentinelayer/cost-history.json`
226
- - `.sentinelayer/observability/run-events.jsonl`
227
-
228
- ## Unified review report + HITL (Phase 9.4 slice)
229
-
230
- Every `review` run now emits reconciled findings:
231
-
232
- - `.sentinelayer/reviews/<run-id>/REVIEW_REPORT.md`
233
- - `.sentinelayer/reviews/<run-id>/REVIEW_REPORT.json`
234
-
235
- Capabilities:
236
-
237
- - `sl review show [--run-id <id>]`
238
- - `sl review export --format sarif|json|md|github-annotations`
239
- - `sl review accept <finding-id> --run-id <id>`
240
- - `sl review reject <finding-id> --run-id <id>`
241
- - `sl review defer <finding-id> --run-id <id>`
242
-
243
- Reconciliation behavior:
244
-
245
- - deduplicates deterministic + AI findings by location/message fingerprint
246
- - preserves highest severity finding in each duplicate cluster
247
- - assigns confidence (`100%` deterministic, model-derived for AI)
248
- - persists HITL decisions in `.sentinelayer/reviews/<run-id>/REVIEW_DECISIONS.json`
249
-
250
- ## Review replay + diff (Phase 9.5 slice)
251
-
252
- Reproducibility commands:
253
-
254
- - `sl review replay <run-id>`
255
- - `sl review diff <base-run-id> <candidate-run-id>`
256
-
257
- Run metadata and comparison artifacts:
258
-
259
- - `.sentinelayer/reviews/<run-id>/REVIEW_RUN_CONTEXT.json`
260
- - `.sentinelayer/reviews/<run-id>/REVIEW_COMPARISON_<base>_vs_<candidate>.json`
261
-
262
- ## Audit orchestrator foundation (Phase 10.1 slice)
263
-
264
- The CLI now includes an audit swarm orchestrator with a built-in 13-agent registry:
265
-
266
- - `sl audit --dry-run`
267
- - `sl audit --agents security,architecture,testing --max-parallel 3`
268
- - `sl audit registry`
269
- - `sl audit security`
270
- - `sl audit architecture`
271
- - `sl audit testing`
272
- - `sl audit performance`
273
- - `sl audit compliance`
274
- - `sl audit documentation`
275
- - `sl audit package --run-id <id>` (or omit `--run-id` to package latest run)
276
- - `sl audit replay <run-id>`
277
- - `sl audit diff <base-run-id> <candidate-run-id>`
278
- - `sl audit local` (legacy compatibility path for `/audit`)
279
-
280
- Artifacts are written to:
281
-
282
- - `.sentinelayer/audits/<run-id>/AUDIT_REPORT.md`
283
- - `.sentinelayer/audits/<run-id>/AUDIT_REPORT.json`
284
- - `.sentinelayer/audits/<run-id>/agents/<agent-id>.json`
285
- - `.sentinelayer/audits/<run-id>/agents/SECURITY_AGENT_REPORT.md` (security specialist)
286
- - `.sentinelayer/audits/<run-id>/agents/ARCHITECTURE_AGENT_REPORT.md` (architecture specialist)
287
- - `.sentinelayer/audits/<run-id>/agents/TESTING_AGENT_REPORT.md` (testing specialist)
288
- - `.sentinelayer/audits/<run-id>/agents/PERFORMANCE_AGENT_REPORT.md` (performance specialist)
289
- - `.sentinelayer/audits/<run-id>/agents/COMPLIANCE_AGENT_REPORT.md` (compliance specialist)
290
- - `.sentinelayer/audits/<run-id>/agents/DOCUMENTATION_AGENT_REPORT.md` (documentation specialist)
291
- - `.sentinelayer/audits/<run-id>/DD_PACKAGE_MANIFEST.json`
292
- - `.sentinelayer/audits/<run-id>/DD_FINDINGS_INDEX.json`
293
- - `.sentinelayer/audits/<run-id>/DD_EXEC_SUMMARY.md`
294
- - `.sentinelayer/audits/<run-id>/AUDIT_COMPARISON_<base>_vs_<candidate>.json`
295
-
296
- ## QA swarm orchestrator factory (Phase 12.1 slice)
297
-
298
- The CLI now includes OMAR-led swarm planning commands for governed long-running runs:
299
-
300
- - `sl swarm registry`
301
- - `sl swarm plan --path . --scenario error_event_remediation --agents security,testing,reliability --json`
302
-
303
- `swarm plan` outputs deterministic orchestration artifacts (assignments, budgets, and phase graph):
304
-
305
- - `.sentinelayer/swarms/<run-id>/SWARM_PLAN.json`
306
- - `.sentinelayer/swarms/<run-id>/SWARM_PLAN.md`
307
-
308
- Global budgets can be set per run:
309
-
310
- - `--max-cost-usd`
311
- - `--max-output-tokens`
312
- - `--max-runtime-ms`
313
- - `--max-tool-calls`
314
- - `--warning-threshold-percent`
315
-
316
- ## Playwright agent runtime (Phase 12.2 slice)
317
-
318
- The swarm runtime loop can now be executed directly from CLI:
319
-
320
- - `sl swarm run --path . --agents security,testing --json` (default mock runtime, dry-run)
321
- - `sl swarm run --plan-file .sentinelayer/swarms/<plan-run-id>/SWARM_PLAN.json --engine playwright --execute --start-url https://example.com`
322
-
323
- Runtime artifacts are persisted under:
324
-
325
- - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_RUNTIME.json`
326
- - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_RUNTIME.md`
327
- - `.sentinelayer/swarms/<runtime-run-id>/runtime/events.ndjson`
328
-
329
- Optional Playwright actions can be provided via playbook JSON:
330
-
331
- - `--playbook-file <path>` where file contract is `{ "actions": [ ... ] }`
332
-
333
- ## Scenario DSL (Phase 12.3 slice)
334
-
335
- Swarm runtime now supports a deterministic scenario DSL (`.sls`):
336
-
337
- - `sl swarm scenario init nightly-smoke --path .`
338
- - `sl swarm scenario validate --file .sentinelayer/scenarios/nightly-smoke.sls`
339
- - `sl swarm run --scenario-file .sentinelayer/scenarios/nightly-smoke.sls --json`
340
-
341
- DSL commands:
342
-
343
- - `scenario "<id>"`
344
- - `start_url "<url>"`
345
- - `tag "<value>"`
346
- - `action goto "<url>"`
347
- - `action click "<selector>"`
348
- - `action fill "<selector>" "<text>"`
349
- - `action wait <ms>`
350
- - `action screenshot "<relative-path>"`
351
-
352
- ## Realtime swarm dashboard (Phase 12.4 slice)
353
-
354
- The CLI now supports runtime swarm dashboard snapshots and watch streaming:
355
-
356
- - `sl swarm dashboard --run-id <runtime-run-id>`
357
- - `sl swarm dashboard --watch --run-id <runtime-run-id> --poll-seconds 2 --max-idle-seconds 20`
358
-
359
- Machine-readable output:
360
-
361
- - `sl swarm dashboard --json`
362
- - `sl swarm dashboard --watch --json`
363
-
364
- Dashboard data includes per-agent status rows, usage counters, stop class, and recent timeline events.
365
-
366
- ## Swarm execution report (Phase 12.5 slice)
367
-
368
- You can package runtime artifacts into a deterministic execution report bundle:
369
-
370
- - `sl swarm report --run-id <runtime-run-id>`
371
- - `sl swarm report --json`
372
-
373
- Report artifacts:
374
-
375
- - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_EXECUTION_REPORT.json`
376
- - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_EXECUTION_REPORT.md`
377
-
378
- The report links runtime usage, stop class, per-agent status summary, recent events, and plan/runtime artifact paths.
379
-
380
- ## Security pen-test mode (Phase 12.6 slice)
381
-
382
- The CLI now includes a governed pen-test swarm entrypoint:
383
-
384
- - `sl swarm create --scenario pen-test --pen-test-scenario auth-bypass --target https://app.customer.local --target-id <target-id>`
385
- - `sl swarm create --scenario input-validation --target https://app.customer.local --target-id <target-id> --execute`
386
-
387
- Built-in pen-test scenarios:
388
-
389
- - `auth-bypass`
390
- - `rate-limit-probe`
391
- - `input-validation`
392
- - `privilege-escalation`
393
-
394
- Policy enforcement is strict:
395
-
396
- - target must exist in local AIdenID target registry and be `VERIFIED`
397
- - target must not be frozen/inactive
398
- - target host must match `--target`
399
- - scenario, methods, and paths must stay within target policy (`allowedScenarios`, `allowedMethods`, `allowedPaths`)
400
-
401
- Pen-test artifacts:
402
-
403
- - `.sentinelayer/swarms/<pentest-run-id>/pentest/REQUEST_PLAN.json`
404
- - `.sentinelayer/swarms/<pentest-run-id>/pentest/audit.jsonl` (full request/response headers+body)
405
- - `.sentinelayer/swarms/<pentest-run-id>/pentest/PENTEST_REPORT.json`
406
- - `.sentinelayer/swarms/<pentest-run-id>/pentest/PENTEST_REPORT.md`
407
-
408
- `PENTEST_REPORT` findings are keyed to OWASP categories and surface `P0-P3` severity summary + blocking status.
409
-
410
- ## Swarm identity hardening (Phase 12.7 slice)
411
-
412
- Identity security controls now include:
413
-
414
- - zero-trust swarm identity manifest per run (`IDENTITY_ISOLATION.json`)
415
- - cryptographic audit chain on pen-test request logs (`previousEntryHash` + `entryHash` + `entryHmac`)
416
- - crash-safe cleanup contract artifact (`CLEANUP_CONTRACT.json`) for post-run squash scheduling
417
- - legal-hold guardrails on revoke/revoke-children commands
418
-
419
- New identity lifecycle commands:
420
-
421
- - `sl ai identity audit --stale --json`
422
- - `sl ai identity legal-hold status <identity-id> --json`
423
- - `sl ai identity kill-all --tags <tag1,tag2> [--execute] --json`
424
-
425
- `kill-all --execute` blocks legal-hold identities and marks eligible tagged identities as `SQUASHED` in local registry with campaign metadata.
426
-
427
- ## Error daemon worker (Phase 13.1 slice)
428
-
429
- The CLI now includes an OMAR daemon lane for deterministic error intake and routed queue generation:
430
-
431
- - `sl daemon error record --service sentinelayer-api --endpoint /v1/runtime/runs --error-code RUNTIME_TIMEOUT --severity P1 --message "runtime timeout"`
432
- - `sl daemon error worker --max-events 200 --json`
433
- - `sl daemon error queue --json`
434
-
435
- Daemon artifacts:
436
-
437
- - `.sentinelayer/observability/error-daemon/admin-error-stream.ndjson` (append-only intake stream)
438
- - `.sentinelayer/observability/error-daemon/queue.json` (deduped routed queue work items)
439
- - `.sentinelayer/observability/error-daemon/worker-state.json` (stream cursor + aggregate stats)
440
- - `.sentinelayer/observability/error-daemon/intake/intake-*.json` (per-event intake snapshots)
441
- - `.sentinelayer/observability/error-daemon/runs/error-daemon-run-*.json` (worker tick execution evidence)
442
-
443
- Queue routing behavior:
444
-
445
- - events are fingerprinted from service, endpoint, error code, stack fingerprint, and commit sha
446
- - matching open fingerprints are deduped with `occurrenceCount` increments and severity escalation
447
- - worker cursor tracks processed stream offset for deterministic resumability across ticks
448
-
449
- ## Global assignment ledger (Phase 13.2 slice)
450
-
451
- Daemon assignment controls now support explicit claim/heartbeat/release/reassign flow with lease tracking:
452
-
453
- - `sl daemon assign claim <work-item-id> --agent maya.markov@sentinelayer.local --lease-ttl-seconds 1800 --stage triage --run-id run_001 --jira-issue-key SL-101`
454
- - `sl daemon assign heartbeat <work-item-id> --agent maya.markov@sentinelayer.local --stage analysis --run-id run_002`
455
- - `sl daemon assign reassign <work-item-id> --from-agent maya.markov@sentinelayer.local --to-agent mark.rao@sentinelayer.local --stage fix`
456
- - `sl daemon assign release <work-item-id> --agent mark.rao@sentinelayer.local --status DONE --reason "fix merged"`
457
- - `sl daemon assign list --status DONE --agent mark.rao@sentinelayer.local --json`
458
-
459
- Ledger artifacts:
460
-
461
- - `.sentinelayer/observability/error-daemon/assignment-ledger.json` (current assignment state)
462
- - `.sentinelayer/observability/error-daemon/assignment-events.ndjson` (claim/heartbeat/reassign/release event history)
463
-
464
- Tracked assignment fields include:
465
-
466
- - `workItemId`
467
- - `assignedAgentIdentity`
468
- - `leasedAt`
469
- - `leaseTtlSeconds`
470
- - `leaseExpiresAt`
471
- - `status`
472
- - `stage`
473
- - `runId`
474
- - `jiraIssueKey`
475
- - `budgetSnapshot`
476
-
477
- ## Jira lifecycle automation (Phase 13.3 slice)
478
-
479
- Daemon Jira lifecycle commands now support ticket create/start/comment/transition traces tied to work items:
480
-
481
- - `sl daemon jira open <work-item-id> --issue-key-prefix SL`
482
- - `sl daemon jira start <work-item-id> --plan "1) reproduce 2) patch 3) verify" --actor maya.markov@sentinelayer.local --assignee maya.markov@sentinelayer.local`
483
- - `sl daemon jira comment --work-item-id <work-item-id> --type checkpoint --message "patch applied"`
484
- - `sl daemon jira transition --work-item-id <work-item-id> --to DONE --reason "fix merged"`
485
- - `sl daemon jira list --status DONE --work-item-id <work-item-id> --json`
486
-
487
- Lifecycle artifacts:
488
-
489
- - `.sentinelayer/observability/error-daemon/jira-lifecycle.json` (issue state, comments, transitions)
490
- - `.sentinelayer/observability/error-daemon/jira-events.ndjson` (append-only lifecycle event feed)
491
-
492
- When an assignment exists for the same work item, Jira issue keys are synced into assignment ledger records for deterministic handoff continuity.
493
-
494
- ## Runtime budget quarantine (Phase 13.4 slice)
495
-
496
- Daemon budget governor commands now enforce hard-limit transitions with quarantine grace and deterministic kill path:
497
-
498
- - `sl daemon budget check <work-item-id> --usage-json '{"tokensUsed":150}' --budget-json '{"maxTokens":100,"quarantineGraceSeconds":30}'`
499
- - `sl daemon budget status --work-item-id <work-item-id> --json`
500
-
501
- Lifecycle states:
502
-
503
- - `WITHIN_BUDGET`
504
- - `WARNING_THRESHOLD`
505
- - `HARD_LIMIT_QUARANTINED`
506
- - `HARD_LIMIT_SQUASHED`
507
-
508
- Governor behavior:
509
-
510
- - crossing a hard limit transitions the work item into quarantine (`action=QUARANTINE`, queue/assignment status `BLOCKED`)
511
- - if hard-limit usage persists past `quarantineGraceSeconds`, governor triggers deterministic kill (`action=KILL`, queue/assignment status `SQUASHED`)
512
- - warning thresholds (`warningThresholdPercent`) surface near-limit signals without blocking
513
-
514
- Budget artifacts:
515
-
516
- - `.sentinelayer/observability/error-daemon/budget-state.json`
517
- - `.sentinelayer/observability/error-daemon/budget-events.ndjson`
518
- - `.sentinelayer/observability/error-daemon/budget-runs/budget-check-*.json`
519
-
520
- ## Operator control plane (Phase 13.5 slice)
521
-
522
- Daemon operator control commands now provide unified queue/assignment/jira/budget visibility with explicit stop controls:
523
-
524
- - `sl daemon control --json`
525
- - `sl daemon control snapshot --status ASSIGNED,BLOCKED --agent maya.markov@sentinelayer.local --json`
526
- - `sl daemon control stop <work-item-id> --mode QUARANTINE --reason "manual triage hold" --confirm --json`
527
- - `sl daemon control stop <work-item-id> --mode SQUASH --reason "kill switch activated" --confirm --json`
528
-
529
- Control-plane snapshot fields include:
530
-
531
- - per-work-item budget health color (`GREEN`, `YELLOW`, `RED`)
532
- - session timers (`sessionElapsedSeconds`, `sessionIdleSeconds`)
533
- - assignment + Jira linkage (`assignedAgentIdentity`, `assignmentStatus`, `jiraIssueKey`, `jiraStatus`)
534
- - agent roster aggregates (`activeWorkItemCount`, `blockedCount`, `squashedCount`, longest-session duration)
535
-
536
- Operator control artifacts:
537
-
538
- - `.sentinelayer/observability/error-daemon/operator-control-state.json`
539
- - `.sentinelayer/observability/error-daemon/operator-events.ndjson`
540
- - `.sentinelayer/observability/error-daemon/operator-snapshots/operator-snapshot-*.json`
541
-
542
- ## Artifact lineage tree (Phase 13.6 slice)
543
-
544
- Daemon lineage commands now index reproducibility links across queue, assignment, Jira, budget, and operator artifacts:
545
-
546
- - `sl daemon lineage build --json`
547
- - `sl daemon lineage list --status ASSIGNED,BLOCKED --json`
548
- - `sl daemon lineage show <work-item-id> --json`
549
-
550
- Lineage index fields include:
551
-
552
- - work-item links (`agentIdentity`, `assignmentStatus`, `loopRunId`, `jiraIssueKey`, `budgetLifecycleState`)
553
- - artifact pointers (queue/ledger/jira/budget/operator state files + per-work-item run artifacts)
554
- - reproducibility run catalogs (`errorDaemonRuns`, `budgetChecks`, `operatorSnapshots`)
555
-
556
- Lineage artifacts:
557
-
558
- - `.sentinelayer/observability/error-daemon/lineage/lineage-index.json`
559
- - `.sentinelayer/observability/error-daemon/lineage/lineage-events.ndjson`
560
-
561
- ## Hybrid mapping overlay (Phase 13.7 slice)
562
-
563
- Daemon hybrid mapping commands now combine deterministic signal routing with on-demand import-graph expansion and semantic scoring:
564
-
565
- - `sl daemon map scope <work-item-id> --max-files 40 --graph-depth 2 --json`
566
- - `sl daemon map list --work-item-id <work-item-id> --json`
567
- - `sl daemon map show <work-item-id> --json`
568
-
569
- Hybrid scope map output includes:
570
-
571
- - deterministic seed files from endpoint/error/service token matches
572
- - import-graph overlay (`graphDepth`) from seed files
573
- - semantic scoring from endpoint/signal token matches in file content
574
- - ranked scoped file set with per-file reasons (`deterministic_path_match`, `semantic_content_match`, `import_graph_distance`)
575
-
576
- Hybrid mapping artifacts:
577
-
578
- - `.sentinelayer/observability/error-daemon/mapping/hybrid-map-index.json`
579
- - `.sentinelayer/observability/error-daemon/mapping/hybrid-map-events.ndjson`
580
- - `.sentinelayer/observability/error-daemon/mapping/runs/hybrid-map-*.json`
581
-
582
- ## Midnight reliability lane (Phase 13.8 slice)
583
-
584
- Daemon reliability commands now support scheduled synthetic checks and maintenance-billboard automation:
585
-
586
- - `sl daemon reliability run --region us-east-1 --timezone America/New_York --json`
587
- - `sl daemon reliability run --simulate-failure aidenid_password_reset_flow --json`
588
- - `sl daemon reliability status --json`
589
- - `sl daemon maintenance status|on|off --json`
590
-
591
- Lane behavior:
592
-
593
- - failures enqueue deterministic daemon error events (`source=reliability_lane`) and execute one worker tick
594
- - failures can auto-enable maintenance billboard for operator/HITL visibility
595
- - passing runs can automatically clear reliability-opened maintenance state
596
- - manual maintenance controls remain available (`maintenance on|off`) with reason/actor audit trail
597
-
598
- Reliability artifacts:
599
-
600
- - `.sentinelayer/observability/error-daemon/reliability/lane-config.json`
601
- - `.sentinelayer/observability/error-daemon/reliability/maintenance-billboard.json`
602
- - `.sentinelayer/observability/error-daemon/reliability/reliability-events.ndjson`
603
- - `.sentinelayer/observability/error-daemon/reliability/runs/reliability-lane-*.json`
604
-
605
- ## MCP registry schema foundation (Phase 6 foundation slice)
606
-
607
- The CLI now includes deterministic MCP registry commands:
608
-
609
- - `sl mcp schema show`
610
- - `sl mcp schema write`
611
- - `sl mcp registry init-aidenid`
612
- - `sl mcp registry init-aidenid-adapter`
613
- - `sl mcp registry validate --file <path>`
614
- - `sl mcp registry validate-aidenid-adapter --file <path> [--registry-file <path>]`
615
- - `sl mcp server init --id <server-id> --registry-file <path>`
616
- - `sl mcp server validate --file <path>`
617
- - `sl mcp bridge init-vscode --server-id <server-id> --server-config <path>`
618
-
619
- Use `init-aidenid` to scaffold an Anthropic-compatible tool schema wrapper for AIdenID provisioning APIs, then customize transport/auth before runtime wiring.
620
- Use `init-aidenid-adapter` to scaffold a deterministic AIdenID provisioning API contract (tool binding -> HTTP path/method -> response field mapping) and cross-check it against the registry with `validate-aidenid-adapter`.
621
-
622
- ## Plugin governance foundation (Phase 5.2 slice)
623
-
624
- The CLI now includes deterministic plugin/template/policy pack governance commands:
625
-
626
- - `sl plugin init --id <plugin-id> --pack-type plugin|template_pack|policy_pack|hybrid --stage pre_scan|scan|post_scan|reporting`
627
- - `sl plugin validate --file <manifest.json>`
628
- - `sl plugin list`
629
- - `sl plugin order [--stage <stage>]` (deterministic load-order resolution + cycle detection)
630
-
631
- ## Policy packs (Phase 5.3 slice)
632
-
633
- The CLI now includes policy-pack selection commands:
634
-
635
- - `sl policy list`
636
- - `sl policy use strict --scope project`
637
- - `sl policy use compliance-soc2 --scope global`
638
-
639
- Built-in packs: `community` (default), `strict`, `compliance-soc2`, `compliance-hipaa`.
640
- Policy selection is stored in config (`defaultPolicyPack`) and applied during `scan init` / `scan validate` / `scan precheck` profile resolution.
641
-
642
- ## AIdenID CLI foundation (Phase 11 foundation slice)
643
-
644
- The CLI now includes an `sl ai` surface for AIdenID identity provisioning:
645
-
646
- - `sl ai provision-email --json` (dry-run artifact generation)
647
- - `sl ai provision-email --execute --api-key <key> --org-id <id> --project-id <id>` (live API call)
648
- - `sl ai identity list --json` (list locally tracked identities)
649
- - `sl ai identity show <identity-id> --json`
650
- - `sl ai identity revoke <identity-id> --execute --api-key <key> --org-id <id> --project-id <id>`
651
- - `sl ai identity create-child <parent-identity-id> --event-budget 25 --execute --api-key <key> --org-id <id> --project-id <id>`
652
- - `sl ai identity lineage <identity-id> --json`
653
- - `sl ai identity revoke-children <parent-identity-id> --execute --api-key <key> --org-id <id> --project-id <id>`
654
- - `sl ai identity domain create|verify|freeze ...` (domain proof + freeze lifecycle controls)
655
- - `sl ai identity target create|verify|show ...` (managed target policy/proof controls)
656
- - `sl ai identity site create <identity-id> --domain-id <domain-id> --execute ...`
657
- - `sl ai identity site list [--identity-id <identity-id>]`
658
- - `sl ai identity events <identity-id> --json` (list inbound events with cursor/limit support)
659
- - `sl ai identity latest <identity-id> --json` (latest event + extraction metadata)
660
- - `sl ai identity wait-for-otp <identity-id> --min-confidence 0.8 --timeout 60 --json`
661
-
662
- Identity lifecycle records are persisted to:
663
-
664
- - `.sentinelayer/aidenid/identity-registry.json`
665
-
666
- Credential env fallbacks for live execution:
667
-
668
- - `AIDENID_API_KEY`
669
- - `AIDENID_ORG_ID`
670
- - `AIDENID_PROJECT_ID`
671
-
672
- Extraction responses include deterministic source metadata (`RULES` vs `LLM`) and confidence scores.
673
-
674
- ## Manual fallback (if auto injection is skipped)
675
-
676
- 1. Set local token:
677
-
678
- ```bash
679
- echo "SENTINELAYER_TOKEN=<your-token>" >> .env
680
- ```
681
-
682
- 2. Inject repo secret:
683
-
684
- ```bash
685
- gh secret set SENTINELAYER_TOKEN --repo <owner/repo>
686
- gh secret list --repo <owner/repo>
687
- ```
688
-
689
- 3. For manual setup details: `https://sentinelayer.com/docs/getting-started/install-workflow`
690
-
691
- 4. BYOK mode (no Sentinelayer token):
692
- - keep generated `docs/spec.md`, `docs/build-guide.md`, `prompts/execution-prompt.md`, and `tasks/todo.md`
693
- - run your coding agent directly with your provider key (`OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GOOGLE_API_KEY`)
694
- - generated workflow is a BYOK reminder workflow; wire `SENTINELAYER_TOKEN` later to enable Omar Gate action
695
-
696
- ## Environment overrides
697
-
698
- - `SENTINELAYER_API_URL` (default: `https://api.sentinelayer.com`)
699
- - `SENTINELAYER_WEB_URL` (default: `https://sentinelayer.com`)
700
- - `SENTINELAYER_DISABLE_KEYRING=1` (force file-based credential storage)
701
- - `AIDENID_API_KEY`, `AIDENID_ORG_ID`, `AIDENID_PROJECT_ID` (used by `sl ai provision-email --execute`)
702
-
703
- ## Layered config (PR 0.2)
704
-
705
- The CLI supports layered config resolution:
706
-
707
- - global: `~/.sentinelayer/config.yml`
708
- - project: `.sentinelayer.yml` at repo root
709
- - env overrides: `SENTINELAYER_API_URL`, `SENTINELAYER_WEB_URL`, `SENTINELAYER_TOKEN`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`
710
-
711
- Commands:
712
-
713
- - `sentinelayer-cli config list --scope resolved --json`
714
- - `sentinelayer-cli config get apiUrl --scope resolved`
715
- - `sentinelayer-cli config set defaultModelProvider openai --scope project`
716
- - `sentinelayer-cli config edit --scope project`
717
-
718
- ## Codebase ingest (PR 1.1 slice)
719
-
720
- Run deterministic mapping and emit `CODEBASE_INGEST.json`:
721
-
722
- - `sentinelayer-cli ingest map --path .`
723
- - `sentinelayer-cli ingest map --path . --json`
724
- - `sentinelayer-cli ingest map --path . --output-file artifacts/CODEBASE_INGEST.json`
725
-
726
- The ingest artifact includes language/LOC breakdown, framework hints, entry points, risk-surface hints, and a bounded file index to support deterministic handoff context.
727
-
728
- ## Offline spec generation (PR 1.2 slice)
729
-
730
- Generate a local `SPEC.md` without calling the API:
731
-
732
- - `sentinelayer-cli spec list-templates`
733
- - `sentinelayer-cli spec show-template api-service`
734
- - `sentinelayer-cli spec generate --path . --template api-service --description \"Build secure autonomous review orchestration\"`
735
- - `sentinelayer-cli spec show --path .`
736
- - `sentinelayer-cli spec show --path . --plain`
737
- - `sentinelayer-cli spec regenerate --path . --dry-run --json`
738
- - `sentinelayer-cli spec regenerate --path . --max-diff-lines 120`
739
- - `sentinelayer-cli spec regenerate --path . --dry-run --quiet`
740
-
741
- The generator uses deterministic ingest context plus template architecture/security checklists.
742
-
743
- ## AI-enhanced spec generation (PR 3.3 slice)
744
-
745
- Generate a deterministic base spec, then optionally refine it with a provider model:
746
-
747
- - `sentinelayer-cli spec generate --path . --template api-service --description "Harden auth and release workflows" --ai`
748
- - `sentinelayer-cli spec generate --path . --ai --provider openai --model gpt-5.3-codex --max-cost 1 --warn-at-percent 80`
749
-
750
- `--ai` mode behavior:
751
-
752
- - deterministic `SPEC.md` draft is always generated first
753
- - AI refinement prompt includes ingest summary + template context + base markdown
754
- - usage is recorded in `.sentinelayer/cost-history.json`
755
- - telemetry usage/stop events are recorded in `.sentinelayer/observability/run-events.jsonl`
756
- - budget governors apply (`--max-cost`, `--max-tokens`, `--max-runtime-ms`, `--max-tool-calls`, `--max-no-progress`)
757
-
758
- ## Prompt generation (PR 1.3 slice)
759
-
760
- Generate execution prompts directly from `SPEC.md`:
761
-
762
- - `sentinelayer-cli prompt generate --path . --agent codex`
763
- - `sentinelayer-cli prompt preview --path . --agent claude --max-lines 40`
764
- - `sentinelayer-cli prompt show --path . --agent codex`
765
- - `sentinelayer-cli prompt show --path . --file docs/PROMPT_codex.md --plain`
766
-
767
- Supported targets: `claude`, `cursor`, `copilot`, `codex`, `generic`.
768
-
769
- ## Omar workflow generation (PR 1.4 slice)
770
-
771
- Generate and validate a spec-aligned security workflow:
772
-
773
- - `sentinelayer-cli scan init --path . --non-interactive`
774
- - `sentinelayer-cli scan init --path . --has-e2e-tests yes --playwright-mode auto`
775
- - `sentinelayer-cli scan validate --path . --json`
776
-
777
- `scan init` writes `.github/workflows/omar-gate.yml` and derives:
778
-
779
- - `scan_mode` + `severity_gate` from spec risk profile
780
- - `playwright_mode` from spec signals + optional E2E wizard/flags
781
- - `sbom_mode` from supply-chain/dependency signals in spec
782
-
783
- `scan validate` checks workflow drift against the current spec profile and exits non-zero when mismatched.
784
-
785
- AI-assisted pre-scan triage (budgeted + telemetry-instrumented):
786
-
787
- - `sentinelayer-cli scan precheck --path . --provider openai --model gpt-5.3-codex`
788
- - `sentinelayer-cli scan precheck --path . --max-cost 0.5 --warn-at-percent 80 --json`
789
-
790
- `scan precheck` writes an AI report to `.sentinelayer/reports/scan-precheck-*.md` (or configured output root), records usage in `.sentinelayer/cost-history.json`, and emits usage/stop events to `.sentinelayer/observability/run-events.jsonl`.
791
-
792
- ## Build guide generation (PR 1.5 slice)
793
-
794
- Generate phase-by-phase implementation guides from `SPEC.md`:
795
-
796
- - `sentinelayer-cli guide generate --path .`
797
- - `sentinelayer-cli guide generate --path . --output-file docs/BUILD_GUIDE.md`
798
- - `sentinelayer-cli guide show --path .`
799
- - `sentinelayer-cli guide show --path . --plain`
800
-
801
- Export phases as issue-ready payloads:
802
-
803
- - `sentinelayer-cli guide export --path . --format jira`
804
- - `sentinelayer-cli guide export --path . --format linear`
805
- - `sentinelayer-cli guide export --path . --format github-issues`
806
-
807
- `guide generate` writes `BUILD_GUIDE.md` with per-phase effort estimates, dependencies, implementation tasks, and acceptance criteria. `guide export` transforms phases into tracker-friendly artifacts.
808
-
809
- ## Multi-provider AI client contract (PR 3.1 slice)
810
-
811
- `src/ai/client.js` now provides a reusable contract for future AI-enabled commands:
812
-
813
- - provider support: `openai`, `anthropic`, `google`
814
- - provider auto-detection from `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`
815
- - model resolution defaults per provider with explicit override support
816
- - retry + exponential backoff on retryable statuses (`429`, `5xx`)
817
- - non-stream and streaming invocation APIs with provider-normalized text output
818
-
819
- ## Cost tracking and budgets (PR 3.2 slice)
820
-
821
- The CLI now includes deterministic cost-ledger commands:
822
-
823
- - `sentinelayer-cli cost show --path .`
824
- - `sentinelayer-cli cost record --path . --provider openai --model gpt-5.3-codex --input-tokens 1000 --output-tokens 500`
825
-
826
- Ledger path:
827
-
828
- - `.sentinelayer/cost-history.json` (or configured output root)
829
-
830
- Budget controls in `cost record`:
831
-
832
- - `--max-cost <usd>` (default `1`)
833
- - `--max-tokens <count>` (default `0`, disabled)
834
- - `--max-runtime-ms <n>` (default `0`, disabled)
835
- - `--max-tool-calls <n>` (default `0`, disabled)
836
- - `--max-no-progress <count>` diminishing-returns guard (default `3`)
837
- - `--warn-at-percent <n>` near-limit warning threshold (default `80`)
838
-
839
- Usage counters tracked per invocation/session:
840
-
841
- - `--duration-ms <n>`
842
- - `--tool-calls <n>`
843
-
844
- Each `cost record` call now emits observability events to:
845
-
846
- - `.sentinelayer/observability/run-events.jsonl`
847
-
848
- including normalized usage snapshots and blocking stop-class events when budgets are exceeded.
849
-
850
- ## Observability telemetry contract (PR 3.5 slice)
851
-
852
- The CLI now supports a deterministic run-event ledger and stop-class schema:
853
-
854
- - `sentinelayer-cli telemetry show --path .`
855
- - `sentinelayer-cli telemetry record --path . --event-type tool_call --tool-calls 1`
856
- - `sentinelayer-cli telemetry record --path . --event-type run_stop --stop-class MAX_RUNTIME_MS_EXCEEDED --reason-codes MAX_RUNTIME_MS_EXCEEDED --blocking`
857
-
858
- Ledger contract:
859
-
860
- - file: `.sentinelayer/observability/run-events.jsonl`
861
- - event types: `run_start`, `run_step`, `tool_call`, `usage`, `budget_check`, `run_stop`
862
- - stop classes: `MAX_COST_EXCEEDED`, `MAX_OUTPUT_TOKENS_EXCEEDED`, `DIMINISHING_RETURNS`, `MAX_RUNTIME_MS_EXCEEDED`, `MAX_TOOL_CALLS_EXCEEDED`, `MANUAL_STOP`, `ERROR`, `UNKNOWN`
863
-
864
- ## Requirements
865
-
866
- - Node `>=20.0`
867
- - network access to Sentinelayer API/web
868
- - optional: GitHub CLI (`gh`) authenticated for secret injection
869
-
870
- ## Release to npm
871
-
872
- This repo includes `.github/workflows/release.yml`.
873
- Automated version/tag PR flow is handled by `.github/workflows/release-please.yml`.
874
- AppSec SAST is enforced by `.github/workflows/codeql.yml` (`CodeQL Summary` check).
875
- Custom static policy checks are enforced by `.github/workflows/semgrep.yml` (`Semgrep Summary` check) using `.semgrep/rules/sentinelayer-cli.yml`.
876
- Secret scanning is enforced by `.github/workflows/gitleaks.yml` (`Gitleaks Summary` check).
877
- IaC misconfiguration scanning is enforced by `.github/workflows/iac-scan.yml` (`IaC Summary` check).
878
- Dependency vulnerability policy is enforced by `.github/workflows/sca-audit.yml` (`SCA Summary` check).
879
- Open-source license policy is enforced by `.github/workflows/license-gate.yml` (`License Summary` check) using `.github/policies/license-policy.json` (`allowed_licenses` with `fail_on_unknown` policy behavior).
880
- Dependabot auto-fix governance is enforced by `.github/workflows/dependabot-governance.yml` with policy controls in `.github/policies/dependabot-governance.json`.
881
- SBOM governance is enforced by `.github/workflows/sbom.yml` (`SBOM Summary`) with CycloneDX/SPDX JSON artifacts and hash-manifest output.
882
- Build provenance attestations are enforced by `.github/workflows/attestations.yml` (`Attestation Summary`) with verification against signer-workflow policy.
883
-
884
- Prerequisites:
885
-
886
- - npm package name is available (`sentinelayer-cli`)
887
- - one publish auth path is configured:
888
- - repository secret `NPM_TOKEN` with publish access, or
889
- - npm trusted publishing for this repository/tag workflow
890
-
891
- Release options:
892
-
893
- 1. Merge to `main` and let `Release Please` open/update the release PR and tag.
894
- 2. Push a tag like `v0.1.1` to publish automatically (or via release-please tag creation).
895
- 3. Run `Release` manually (`workflow_dispatch`) to validate gates and rollback readiness without publishing.
896
- 4. Tag-triggered publish resolves auth mode at runtime (`NPM_TOKEN` first, otherwise trusted publishing OIDC).
897
- 5. If neither auth mode is available, publish fails closed with an explicit workflow error.
898
-
899
- Release publish now enforces tarball checksum-manifest validation and attestation verification bound to `.github/workflows/release.yml` before `npm publish`.
900
-
901
- Release guardrails now require successful upstream checks on the target commit:
902
-
903
- - `Quality Summary`
904
- - `Omar Gate`
905
- - `CodeQL Summary`
906
- - `Semgrep Summary`
907
- - `Gitleaks Summary`
908
- - `IaC Summary`
909
- - `SCA Summary`
910
- - `License Summary`
911
- - `SBOM Summary`
912
- - `Attestation Summary`
913
-
914
- ## Local verification
915
-
916
- ```bash
917
- npm run verify
918
- ```
919
-
920
- This runs:
921
-
922
- - CLI syntax check
923
- - unit tests for core offline generators/config/cost tracking
924
- - end-to-end automated scaffolding tests (mock API + mock `gh`)
925
- - coverage enforcement (`>=80%` lines/functions/statements, `>=70%` branches for core modules)
926
- - package tarball dry-run
927
-
928
- Additional test commands:
929
-
930
- - `npm run test:unit`
931
- - `npm run test:e2e`
932
- - `npm run test:coverage`
933
-
934
- ## Local commands (MVP)
935
-
936
- The CLI now supports a command tree, while keeping slash-command compatibility:
937
-
938
- - `sentinelayer-cli init <project-name>` runs scaffold/auth generation (legacy top-level invocation still works)
939
- - `sentinelayer-cli omargate deep --path <repo>` runs a local credential/policy scan and writes `.sentinelayer/reports/omargate-deep-*.md` (non-zero exit if P1 findings exist)
940
- - `sentinelayer-cli audit [--agents <ids>] [--max-parallel <n>]` runs orchestrated audit agents and writes `.sentinelayer/audits/<run-id>/AUDIT_REPORT.{md,json}`
941
- - `sentinelayer-cli audit registry` lists built-in/customized audit-agent registry records
942
- - `sentinelayer-cli audit security` runs the security specialist agent and writes a dedicated `SECURITY_AGENT_REPORT.md`
943
- - `sentinelayer-cli audit architecture` runs the architecture specialist agent and writes a dedicated `ARCHITECTURE_AGENT_REPORT.md`
944
- - `sentinelayer-cli audit testing` runs the testing specialist agent and writes a dedicated `TESTING_AGENT_REPORT.md`
945
- - `sentinelayer-cli audit performance` runs the performance specialist agent and writes a dedicated `PERFORMANCE_AGENT_REPORT.md`
946
- - `sentinelayer-cli audit compliance` runs the compliance specialist agent and writes a dedicated `COMPLIANCE_AGENT_REPORT.md`
947
- - `sentinelayer-cli audit documentation` runs the documentation specialist agent and writes a dedicated `DOCUMENTATION_AGENT_REPORT.md`
948
- - `sentinelayer-cli audit package [--run-id <id>]` builds/rebuilds unified DD package artifacts from the requested (or latest) run
949
- - `sentinelayer-cli audit replay <run-id>` reruns the same selected agent set and writes a replay comparison artifact
950
- - `sentinelayer-cli audit diff <base-run-id> <candidate-run-id>` compares two runs and emits reproducibility drift deltas
951
- - `sentinelayer-cli audit local --path <repo>` runs legacy readiness + scan audit and writes `.sentinelayer/reports/audit-*.md`
952
- - `sentinelayer-cli persona orchestrator --mode <builder|reviewer|hardener> --path <repo>` generates mode-specific execution instructions with repo context
953
- - `sentinelayer-cli apply --plan tasks/todo.md --path <repo>` parses plan tasks into deterministic execution order preview
954
- - `sentinelayer-cli auth login|status|logout` manages persistent CLI sessions for long-running automation
955
- - `sentinelayer-cli auth sessions|revoke` supports session inventory and explicit token revocation controls
956
- - `sentinelayer-cli watch run-events --run-id <id>` streams runtime events with local artifact persistence
957
- - `sentinelayer-cli daemon error record|worker|queue` ingests admin errors and routes deterministic daemon queue work items
958
- - `sentinelayer-cli daemon assign claim|heartbeat|release|reassign|list` manages shared daemon assignment leases and lifecycle states
959
- - `sentinelayer-cli daemon jira open|start|comment|transition|list` manages Jira lifecycle evidence tied to daemon work items
960
- - `sentinelayer-cli daemon budget check|status` enforces budget warning/quarantine/kill governance with reproducible artifacts
961
- - `sentinelayer-cli daemon control|snapshot|stop` provides operator roster snapshots and explicit confirmed stop controls
962
- - `sentinelayer-cli daemon lineage build|list|show` indexes reproducible work-item artifact lineage across queue/assignment/jira/budget/operator runs
963
- - `sentinelayer-cli daemon map scope|list|show` builds hybrid deterministic+semantic impact scopes with import-graph overlay for daemon work items
964
- - `sentinelayer-cli daemon reliability run|status` and `daemon maintenance status|on|off` operate the midnight synthetic lane and maintenance billboard lifecycle
965
- - `sentinelayer-cli mcp schema|registry|server|bridge ...` manages MCP registry schema, server configs, and VS Code bridge scaffolds
966
- - `sentinelayer-cli plugin init|validate|list|order` manages plugin/template/policy packs and deterministic load-order governance
967
- - `sentinelayer-cli policy list|use <pack-id>` manages active policy pack selection (`community`, `strict`, `compliance-soc2`, `compliance-hipaa`, plugin packs)
968
- - `sentinelayer-cli ai provision-email` scaffolds and optionally executes AIdenID identity provisioning requests
969
- - `sentinelayer-cli ai identity list|show|revoke|create-child|lineage|revoke-children` manages local identity lifecycle and lineage workflows
970
- - `sentinelayer-cli ai identity domain create|verify|freeze` manages domain proof registration and containment controls
971
- - `sentinelayer-cli ai identity target create|verify|show` manages target policy registration and verification controls
972
- - `sentinelayer-cli ai identity site create|list` manages ephemeral callback site provisioning and local lifecycle tracking
973
- - `sentinelayer-cli ai identity events|latest|wait-for-otp` manages extraction/event polling for OTP and verification-link retrieval
974
- - `sentinelayer-cli chat ask` runs low-latency prompt/response chat with transcript persistence
975
- - `sentinelayer-cli review [path] [--diff|--staged]` runs layered deterministic review and writes reproducible artifacts under `.sentinelayer/reviews/<run-id>/`
976
- - `sentinelayer-cli review [path] [--diff|--staged] [--ai]` adds budget-governed AI reasoning over deterministic findings
977
- - `sentinelayer-cli review show|export|accept|reject|defer ...` manages reconciled unified reports and HITL adjudication
978
- - `sentinelayer-cli review replay|diff ...` runs reproducibility replay and run-to-run drift comparisons
979
- - `sentinelayer-cli review scan --mode full|diff|staged` runs lightweight deterministic scan mode for compatibility
980
- - add `--json` to `omargate`, `audit`, `persona orchestrator`, or `apply` for machine-readable summaries in CI
981
- - add `--output-dir <dir>` to local commands to write reports outside the default `.sentinelayer/reports`
982
-
983
- Legacy slash commands are still supported:
984
-
985
- - `sentinelayer-cli /omargate deep --path .`
986
- - `sentinel /omargate deep --path .`
987
-
988
- Roadmap:
989
-
990
- - persona orchestrator command set for specialized review/execution modes
991
-
992
- ## Troubleshooting
993
-
994
- - `Authentication timed out`: rerun and approve browser session faster.
995
- - `GitHub CLI not installed`: install `gh` or run manual fallback.
996
- - `Invalid repo format`: use exact `owner/repo`.
997
- - `Missing token in workflow`: ensure `.github/workflows/omar-gate.yml` maps `sentinelayer_token: ${{ secrets.SENTINELAYER_TOKEN }}`.
998
-
1
+ # sentinelayer-cli
2
+
3
+ `npx sentinelayer-cli@latest <project-name>`
4
+
5
+ Scaffolds Sentinelayer spec/prompt/guide artifacts and bootstraps `SENTINELAYER_TOKEN` without manual copy/paste, with optional `BYOK` mode.
6
+
7
+ CLI binaries:
8
+
9
+ - `sentinelayer-cli` (primary)
10
+ - `create-sentinelayer` (compatibility alias)
11
+ - `sentinel` (legacy alias)
12
+ - `sl` (short alias)
13
+
14
+ ## What it does
15
+
16
+ - runs an interactive project interview
17
+ - opens browser auth at Sentinelayer `/cli-auth`
18
+ - receives approved auth session in terminal
19
+ - supports explicit `BYOK` mode (skip Sentinelayer browser auth/token bootstrap)
20
+ - optionally opens GitHub auth (`gh auth login -w`) and lets you arrow-select a repo
21
+ - optionally clones the selected repo into the current folder for in-place feature work
22
+ - generates `spec + build guide + execution prompt + omar workflow + todo + handoff prompt`
23
+ - issues bootstrap `SENTINELAYER_TOKEN` when managed auth mode is used
24
+ - writes token to local `.env` when managed auth mode is used
25
+ - optionally injects token to GitHub Actions secret via `gh secret set` in managed auth mode
26
+ - ensures target workspace is a git repo (`git init` + `origin` when needed)
27
+
28
+ ## Current Production Bundle
29
+
30
+ Initial production scope is intentionally narrow and hardened:
31
+
32
+ - Omar baseline gate workflows and deterministic local gate checks
33
+ - Jules Tanaka deep frontend audits (`sl audit frontend --stream`)
34
+ - Reproducible review/audit artifacts and runtime telemetry
35
+
36
+ Primary commands in this shipping lane:
37
+
38
+ ```bash
39
+ sl auth login --api-url https://api.sentinelayer.com
40
+ sl scan init --path . --non-interactive
41
+ sl omargate deep --path .
42
+ sl audit frontend --path ./my-react-app --stream
43
+ sl review --diff
44
+ sl watch run-events --run-id <run-id>
45
+ ```
46
+
47
+ Windows PowerShell note: `sl` is a built-in alias for `Set-Location`. Use `sentinelayer-cli` (or short alias `slc`) instead.
48
+
49
+ ## 60-second flow
50
+
51
+ 1. Trigger:
52
+
53
+ ```bash
54
+ npx sentinelayer-cli@latest my-agent-app
55
+ ```
56
+
57
+ 2. Interview prompts (project goal, provider, coding agent, auth mode, depth, audience, project type, optional repo connect).
58
+ 3. If repo connect is enabled:
59
+ - choose repo source: current repo, GitHub picker, or manual `owner/repo`
60
+ - optional browser GitHub authorization
61
+ - optional clone into local workspace for existing-codebase feature work
62
+ 4. Browser auth opens automatically in managed auth mode.
63
+ 5. Token + artifacts are generated.
64
+ 6. CLI prints handoff and next command:
65
+
66
+ ```bash
67
+ npm run sentinel:start
68
+ ```
69
+
70
+ ## Non-interactive mode (CI/E2E)
71
+
72
+ Use non-interactive mode to run full scaffolding in automation:
73
+
74
+ ```bash
75
+ SENTINELAYER_CLI_INTERVIEW_JSON='{"projectName":"demo-app","projectDescription":"Build an autonomous secure code review orchestrator.","aiProvider":"openai","codingAgent":"codex","authMode":"sentinelayer","generationMode":"detailed","audienceLevel":"developer","projectType":"greenfield","techStack":["TypeScript","Node.js"],"features":["auth","scan"],"connectRepo":false,"injectSecret":false}' \
76
+ npx sentinelayer-cli@latest demo-app --non-interactive --skip-browser-open
77
+ ```
78
+
79
+ Inputs for non-interactive mode:
80
+
81
+ - `SENTINELAYER_CLI_INTERVIEW_JSON` (JSON string)
82
+ - interview JSON supports `authMode: "sentinelayer" | "byok"` (default: `sentinelayer`)
83
+ - or `--interview-file <path-to-json>`
84
+ - `--non-interactive` is required to disable prompts
85
+ - `--skip-browser-open` avoids launching local browser in headless runs
86
+ - `--help` / `-h` prints CLI usage
87
+ - `--version` / `-v` prints CLI version
88
+ - `SENTINELAYER_GITHUB_CLONE_BASE_URL` overrides clone base (default `https://github.com`)
89
+
90
+ ## Generated files
91
+
92
+ - `docs/spec.md`
93
+ - `docs/build-guide.md`
94
+ - `prompts/execution-prompt.md`
95
+ - `.github/workflows/omar-gate.yml`
96
+ - `tasks/todo.md`
97
+ - `AGENT_HANDOFF_PROMPT.md` (read order + Omar loop + local command matrix + workflow tuning options)
98
+ - coding-agent config file for selected agent when supported (examples: `CLAUDE.md`, `.cursorrules`, `.github/copilot-instructions.md`)
99
+ - `package.json` (adds `sentinel:start`, `sentinel:omargate`, `sentinel:omargate:json`, `sentinel:audit`, `sentinel:audit:json`, `sentinel:persona:*`, `sentinel:apply` when missing)
100
+ - `.env` with `SENTINELAYER_TOKEN` (or API-provided secret name) in managed auth mode
101
+
102
+ ## Advanced options
103
+
104
+ When `Advanced options?` is enabled:
105
+
106
+ - `Auth mode` (`sentinelayer` or `byok`)
107
+ - `Connect a GitHub repo and inject Actions secret?`
108
+ - `How should we choose the repo?` (current / GitHub picker / manual)
109
+ - GitHub picker reads all accessible repos via paginated `gh api`
110
+ - `Clone this repo locally and build directly into it now?`
111
+ - `Inject SENTINELAYER_TOKEN into GitHub Actions secrets now?` (managed auth mode only)
112
+ - Final review step lets you proceed, restart interview, or cancel cleanly
113
+
114
+ The CLI validates repo format and secret-name format before injection.
115
+
116
+ ## Existing codebase mode
117
+
118
+ When `Clone this repo locally and build directly into it now?` is enabled:
119
+
120
+ - the CLI clones `<owner>/<repo>` into `./<repo-name>` unless current folder already matches that repo
121
+ - it writes generated docs/prompts/tasks/workflow into that cloned repo
122
+ - it extracts a deterministic repo summary and includes it in generation context
123
+ - if the repo is empty, scaffolding still proceeds deterministically
124
+ - if the target folder already contains a different non-empty repo, CLI fails fast with a clear error
125
+ - if the target folder is a git repo without a detectable GitHub `origin`, CLI refuses to continue
126
+
127
+ ## Token handling model
128
+
129
+ - browser auth JWT is used in-memory only
130
+ - in managed auth mode, CLI stores only bootstrap token in `.env`
131
+ - in managed auth mode, GitHub secret injection uses stdin (`gh secret set ...`) and never writes token to command history
132
+ - in managed auth mode, secret injection is verified with `gh secret list --repo <owner/repo>`
133
+ - API fallback secret name is pinned to `SENTINELAYER_TOKEN` if server response is invalid
134
+ - in BYOK mode, no Sentinelayer token is created or injected
135
+
136
+ ## Persistent CLI auth sessions (Phase 4 foundation slice)
137
+
138
+ For long-running agent/operator workflows, the CLI now supports persistent auth sessions:
139
+
140
+ - `sl auth login --api-url https://api.sentinelayer.com --skip-browser-open`
141
+ - `sl auth status`
142
+ - `sl auth logout`
143
+ - `sl auth sessions`
144
+ - `sl auth revoke --token-id <token-id>`
145
+
146
+ On Windows PowerShell, run these as `sentinelayer-cli auth ...` or `slc auth ...`.
147
+
148
+ Behavior:
149
+
150
+ - login uses browser approval (`/api/v1/auth/cli/sessions/*`)
151
+ - after approval, CLI mints a long-lived API token (`/api/v1/auth/api-tokens`)
152
+ - session metadata is stored at `~/.sentinelayer/credentials.json`
153
+ - token storage uses OS keyring only when explicitly enabled (`SENTINELAYER_KEYRING_MODE=keyring`) and `keytar` is installed; file fallback is used otherwise
154
+ - near-expiry token rotation is automatic on command use for stored sessions
155
+ - env/config tokens still take precedence:
156
+ - `SENTINELAYER_TOKEN`
157
+ - `.sentinelayer.yml` `sentinelayerToken`
158
+
159
+ Opt-in to keyring usage:
160
+
161
+ - `SENTINELAYER_KEYRING_MODE=keyring` (requires `npm install keytar`)
162
+
163
+ Opt-out of keyring usage (overrides any opt-in):
164
+
165
+ - `SENTINELAYER_DISABLE_KEYRING=1`
166
+
167
+ ## Runtime watch streaming (Phase 9 foundation slice)
168
+
169
+ You can stream runtime run events directly from the CLI:
170
+
171
+ - `sl watch run-events --run-id <run-id>`
172
+ - `sl watch runtime --run-id <run-id>` (alias)
173
+ - `sl watch history` (list persisted watch summaries)
174
+
175
+ Options:
176
+
177
+ - `--poll-seconds <seconds>` polling interval
178
+ - `--max-idle-seconds <seconds>` optional idle timeout
179
+ - `--output-dir <path>` artifact root override
180
+ - `--json` machine-readable event stream + summary
181
+
182
+ By default, watch output is persisted to:
183
+
184
+ - `.sentinelayer/observability/runtime-watch/<run-id>/events-<timestamp>.ndjson`
185
+ - `.sentinelayer/observability/runtime-watch/<run-id>/summary-<timestamp>.json`
186
+
187
+ ## Chat command foundation (Phase 2.1 slice)
188
+
189
+ The CLI now includes a low-latency chat command surface:
190
+
191
+ - `sl chat ask --prompt "Summarize this diff" --dry-run`
192
+ - `sl chat ask --prompt "Explain this failure" --provider openai --model gpt-4o`
193
+
194
+ Each call appends reproducible transcript entries to:
195
+
196
+ - `.sentinelayer/chat/sessions/<session-id>.jsonl`
197
+
198
+ ## Deterministic review pipeline (Phase 9.2 foundation slice)
199
+
200
+ The default `review` command now runs a layered deterministic pipeline:
201
+
202
+ - `sl review` (full workspace mode)
203
+ - `sl review --diff` (staged + unstaged + untracked git changes)
204
+ - `sl review --staged` (staged changes only)
205
+
206
+ Each run writes reproducible artifacts to:
207
+
208
+ - `.sentinelayer/reviews/<run-id>/REVIEW_DETERMINISTIC.md`
209
+ - `.sentinelayer/reviews/<run-id>/REVIEW_DETERMINISTIC.json`
210
+ - `.sentinelayer/reviews/<run-id>/checks/*.log` (static check output)
211
+
212
+ For compatibility, lightweight scan mode remains available:
213
+
214
+ - `sl review scan --mode full|diff|staged`
215
+ - `.sentinelayer/reports/review-scan-<mode>-<timestamp>.md`
216
+
217
+ ## AI review layers (Phase 9.3 slice)
218
+
219
+ The `review` command can now add budget-governed AI reasoning on top of deterministic findings:
220
+
221
+ - `sl review --ai --provider openai --model gpt-5.3-codex`
222
+ - `sl review --ai --ai-dry-run` (no provider call; deterministic synthetic output)
223
+ - `sl review --ai --max-cost 1.0 --max-tokens 0 --max-runtime-ms 0 --max-tool-calls 0`
224
+
225
+ AI artifacts are persisted in the same run folder:
226
+
227
+ - `.sentinelayer/reviews/<run-id>/REVIEW_AI_PROMPT.txt`
228
+ - `.sentinelayer/reviews/<run-id>/REVIEW_AI.md`
229
+ - `.sentinelayer/reviews/<run-id>/REVIEW_AI.json`
230
+
231
+ AI usage, cost, and stop-class telemetry are appended to:
232
+
233
+ - `.sentinelayer/cost-history.json`
234
+ - `.sentinelayer/observability/run-events.jsonl`
235
+
236
+ ## Unified review report + HITL (Phase 9.4 slice)
237
+
238
+ Every `review` run now emits reconciled findings:
239
+
240
+ - `.sentinelayer/reviews/<run-id>/REVIEW_REPORT.md`
241
+ - `.sentinelayer/reviews/<run-id>/REVIEW_REPORT.json`
242
+
243
+ Capabilities:
244
+
245
+ - `sl review show [--run-id <id>]`
246
+ - `sl review export --format sarif|json|md|github-annotations`
247
+ - `sl review accept <finding-id> --run-id <id>`
248
+ - `sl review reject <finding-id> --run-id <id>`
249
+ - `sl review defer <finding-id> --run-id <id>`
250
+
251
+ Reconciliation behavior:
252
+
253
+ - deduplicates deterministic + AI findings by location/message fingerprint
254
+ - preserves highest severity finding in each duplicate cluster
255
+ - assigns confidence (`100%` deterministic, model-derived for AI)
256
+ - persists HITL decisions in `.sentinelayer/reviews/<run-id>/REVIEW_DECISIONS.json`
257
+
258
+ ## Review replay + diff (Phase 9.5 slice)
259
+
260
+ Reproducibility commands:
261
+
262
+ - `sl review replay <run-id>`
263
+ - `sl review diff <base-run-id> <candidate-run-id>`
264
+
265
+ Run metadata and comparison artifacts:
266
+
267
+ - `.sentinelayer/reviews/<run-id>/REVIEW_RUN_CONTEXT.json`
268
+ - `.sentinelayer/reviews/<run-id>/REVIEW_COMPARISON_<base>_vs_<candidate>.json`
269
+
270
+ ## Audit orchestrator foundation (Phase 10.1 slice)
271
+
272
+ The CLI now includes an audit swarm orchestrator with a built-in 13-agent registry:
273
+
274
+ - `sl audit --dry-run`
275
+ - `sl audit --agents security,architecture,testing --max-parallel 3`
276
+ - `sl audit registry`
277
+ - `sl audit security`
278
+ - `sl audit architecture`
279
+ - `sl audit testing`
280
+ - `sl audit performance`
281
+ - `sl audit compliance`
282
+ - `sl audit documentation`
283
+ - `sl audit package --run-id <id>` (or omit `--run-id` to package latest run)
284
+ - `sl audit replay <run-id>`
285
+ - `sl audit diff <base-run-id> <candidate-run-id>`
286
+ - `sl audit local` (legacy compatibility path for `/audit`)
287
+
288
+ Artifacts are written to:
289
+
290
+ - `.sentinelayer/audits/<run-id>/AUDIT_REPORT.md`
291
+ - `.sentinelayer/audits/<run-id>/AUDIT_REPORT.json`
292
+ - `.sentinelayer/audits/<run-id>/agents/<agent-id>.json`
293
+ - `.sentinelayer/audits/<run-id>/agents/SECURITY_AGENT_REPORT.md` (security specialist)
294
+ - `.sentinelayer/audits/<run-id>/agents/ARCHITECTURE_AGENT_REPORT.md` (architecture specialist)
295
+ - `.sentinelayer/audits/<run-id>/agents/TESTING_AGENT_REPORT.md` (testing specialist)
296
+ - `.sentinelayer/audits/<run-id>/agents/PERFORMANCE_AGENT_REPORT.md` (performance specialist)
297
+ - `.sentinelayer/audits/<run-id>/agents/COMPLIANCE_AGENT_REPORT.md` (compliance specialist)
298
+ - `.sentinelayer/audits/<run-id>/agents/DOCUMENTATION_AGENT_REPORT.md` (documentation specialist)
299
+ - `.sentinelayer/audits/<run-id>/DD_PACKAGE_MANIFEST.json`
300
+ - `.sentinelayer/audits/<run-id>/DD_FINDINGS_INDEX.json`
301
+ - `.sentinelayer/audits/<run-id>/DD_EXEC_SUMMARY.md`
302
+ - `.sentinelayer/audits/<run-id>/AUDIT_COMPARISON_<base>_vs_<candidate>.json`
303
+
304
+ ## QA swarm orchestrator factory (Phase 12.1 slice)
305
+
306
+ The CLI now includes OMAR-led swarm planning commands for governed long-running runs:
307
+
308
+ - `sl swarm registry`
309
+ - `sl swarm plan --path . --scenario error_event_remediation --agents security,testing,reliability --json`
310
+
311
+ `swarm plan` outputs deterministic orchestration artifacts (assignments, budgets, and phase graph):
312
+
313
+ - `.sentinelayer/swarms/<run-id>/SWARM_PLAN.json`
314
+ - `.sentinelayer/swarms/<run-id>/SWARM_PLAN.md`
315
+
316
+ Global budgets can be set per run:
317
+
318
+ - `--max-cost-usd`
319
+ - `--max-output-tokens`
320
+ - `--max-runtime-ms`
321
+ - `--max-tool-calls`
322
+ - `--warning-threshold-percent`
323
+
324
+ ## Playwright agent runtime (Phase 12.2 slice)
325
+
326
+ The swarm runtime loop can now be executed directly from CLI:
327
+
328
+ - `sl swarm run --path . --agents security,testing --json` (default mock runtime, dry-run)
329
+ - `sl swarm run --plan-file .sentinelayer/swarms/<plan-run-id>/SWARM_PLAN.json --engine playwright --execute --start-url https://example.com`
330
+
331
+ Runtime artifacts are persisted under:
332
+
333
+ - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_RUNTIME.json`
334
+ - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_RUNTIME.md`
335
+ - `.sentinelayer/swarms/<runtime-run-id>/runtime/events.ndjson`
336
+
337
+ Optional Playwright actions can be provided via playbook JSON:
338
+
339
+ - `--playbook-file <path>` where file contract is `{ "actions": [ ... ] }`
340
+
341
+ ## Scenario DSL (Phase 12.3 slice)
342
+
343
+ Swarm runtime now supports a deterministic scenario DSL (`.sls`):
344
+
345
+ - `sl swarm scenario init nightly-smoke --path .`
346
+ - `sl swarm scenario validate --file .sentinelayer/scenarios/nightly-smoke.sls`
347
+ - `sl swarm run --scenario-file .sentinelayer/scenarios/nightly-smoke.sls --json`
348
+
349
+ DSL commands:
350
+
351
+ - `scenario "<id>"`
352
+ - `start_url "<url>"`
353
+ - `tag "<value>"`
354
+ - `action goto "<url>"`
355
+ - `action click "<selector>"`
356
+ - `action fill "<selector>" "<text>"`
357
+ - `action wait <ms>`
358
+ - `action screenshot "<relative-path>"`
359
+
360
+ ## Realtime swarm dashboard (Phase 12.4 slice)
361
+
362
+ The CLI now supports runtime swarm dashboard snapshots and watch streaming:
363
+
364
+ - `sl swarm dashboard --run-id <runtime-run-id>`
365
+ - `sl swarm dashboard --watch --run-id <runtime-run-id> --poll-seconds 2 --max-idle-seconds 20`
366
+
367
+ Machine-readable output:
368
+
369
+ - `sl swarm dashboard --json`
370
+ - `sl swarm dashboard --watch --json`
371
+
372
+ Dashboard data includes per-agent status rows, usage counters, stop class, and recent timeline events.
373
+
374
+ ## Swarm execution report (Phase 12.5 slice)
375
+
376
+ You can package runtime artifacts into a deterministic execution report bundle:
377
+
378
+ - `sl swarm report --run-id <runtime-run-id>`
379
+ - `sl swarm report --json`
380
+
381
+ Report artifacts:
382
+
383
+ - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_EXECUTION_REPORT.json`
384
+ - `.sentinelayer/swarms/<runtime-run-id>/runtime/SWARM_EXECUTION_REPORT.md`
385
+
386
+ The report links runtime usage, stop class, per-agent status summary, recent events, and plan/runtime artifact paths.
387
+
388
+ ## Security pen-test mode (Phase 12.6 slice)
389
+
390
+ The CLI now includes a governed pen-test swarm entrypoint:
391
+
392
+ - `sl swarm create --scenario pen-test --pen-test-scenario auth-bypass --target https://app.customer.local --target-id <target-id>`
393
+ - `sl swarm create --scenario input-validation --target https://app.customer.local --target-id <target-id> --execute`
394
+
395
+ Built-in pen-test scenarios:
396
+
397
+ - `auth-bypass`
398
+ - `rate-limit-probe`
399
+ - `input-validation`
400
+ - `privilege-escalation`
401
+
402
+ Policy enforcement is strict:
403
+
404
+ - target must exist in local AIdenID target registry and be `VERIFIED`
405
+ - target must not be frozen/inactive
406
+ - target host must match `--target`
407
+ - scenario, methods, and paths must stay within target policy (`allowedScenarios`, `allowedMethods`, `allowedPaths`)
408
+
409
+ Pen-test artifacts:
410
+
411
+ - `.sentinelayer/swarms/<pentest-run-id>/pentest/REQUEST_PLAN.json`
412
+ - `.sentinelayer/swarms/<pentest-run-id>/pentest/audit.jsonl` (full request/response headers+body)
413
+ - `.sentinelayer/swarms/<pentest-run-id>/pentest/PENTEST_REPORT.json`
414
+ - `.sentinelayer/swarms/<pentest-run-id>/pentest/PENTEST_REPORT.md`
415
+
416
+ `PENTEST_REPORT` findings are keyed to OWASP categories and surface `P0-P3` severity summary + blocking status.
417
+
418
+ ## Swarm identity hardening (Phase 12.7 slice)
419
+
420
+ Identity security controls now include:
421
+
422
+ - zero-trust swarm identity manifest per run (`IDENTITY_ISOLATION.json`)
423
+ - cryptographic audit chain on pen-test request logs (`previousEntryHash` + `entryHash` + `entryHmac`)
424
+ - crash-safe cleanup contract artifact (`CLEANUP_CONTRACT.json`) for post-run squash scheduling
425
+ - legal-hold guardrails on revoke/revoke-children commands
426
+
427
+ New identity lifecycle commands:
428
+
429
+ - `sl ai identity audit --stale --json`
430
+ - `sl ai identity legal-hold status <identity-id> --json`
431
+ - `sl ai identity kill-all --tags <tag1,tag2> [--execute] --json`
432
+
433
+ `kill-all --execute` blocks legal-hold identities and marks eligible tagged identities as `SQUASHED` in local registry with campaign metadata.
434
+
435
+ ## Error daemon worker (Phase 13.1 slice)
436
+
437
+ The CLI now includes an OMAR daemon lane for deterministic error intake and routed queue generation:
438
+
439
+ - `sl daemon error record --service sentinelayer-api --endpoint /v1/runtime/runs --error-code RUNTIME_TIMEOUT --severity P1 --message "runtime timeout"`
440
+ - `sl daemon error worker --max-events 200 --json`
441
+ - `sl daemon error queue --json`
442
+
443
+ Daemon artifacts:
444
+
445
+ - `.sentinelayer/observability/error-daemon/admin-error-stream.ndjson` (append-only intake stream)
446
+ - `.sentinelayer/observability/error-daemon/queue.json` (deduped routed queue work items)
447
+ - `.sentinelayer/observability/error-daemon/worker-state.json` (stream cursor + aggregate stats)
448
+ - `.sentinelayer/observability/error-daemon/intake/intake-*.json` (per-event intake snapshots)
449
+ - `.sentinelayer/observability/error-daemon/runs/error-daemon-run-*.json` (worker tick execution evidence)
450
+
451
+ Queue routing behavior:
452
+
453
+ - events are fingerprinted from service, endpoint, error code, stack fingerprint, and commit sha
454
+ - matching open fingerprints are deduped with `occurrenceCount` increments and severity escalation
455
+ - worker cursor tracks processed stream offset for deterministic resumability across ticks
456
+
457
+ ## Global assignment ledger (Phase 13.2 slice)
458
+
459
+ Daemon assignment controls now support explicit claim/heartbeat/release/reassign flow with lease tracking:
460
+
461
+ - `sl daemon assign claim <work-item-id> --agent maya.markov@sentinelayer.local --lease-ttl-seconds 1800 --stage triage --run-id run_001 --jira-issue-key SL-101`
462
+ - `sl daemon assign heartbeat <work-item-id> --agent maya.markov@sentinelayer.local --stage analysis --run-id run_002`
463
+ - `sl daemon assign reassign <work-item-id> --from-agent maya.markov@sentinelayer.local --to-agent mark.rao@sentinelayer.local --stage fix`
464
+ - `sl daemon assign release <work-item-id> --agent mark.rao@sentinelayer.local --status DONE --reason "fix merged"`
465
+ - `sl daemon assign list --status DONE --agent mark.rao@sentinelayer.local --json`
466
+
467
+ Ledger artifacts:
468
+
469
+ - `.sentinelayer/observability/error-daemon/assignment-ledger.json` (current assignment state)
470
+ - `.sentinelayer/observability/error-daemon/assignment-events.ndjson` (claim/heartbeat/reassign/release event history)
471
+
472
+ Tracked assignment fields include:
473
+
474
+ - `workItemId`
475
+ - `assignedAgentIdentity`
476
+ - `leasedAt`
477
+ - `leaseTtlSeconds`
478
+ - `leaseExpiresAt`
479
+ - `status`
480
+ - `stage`
481
+ - `runId`
482
+ - `jiraIssueKey`
483
+ - `budgetSnapshot`
484
+
485
+ ## Jira lifecycle automation (Phase 13.3 slice)
486
+
487
+ Daemon Jira lifecycle commands now support ticket create/start/comment/transition traces tied to work items:
488
+
489
+ - `sl daemon jira open <work-item-id> --issue-key-prefix SL`
490
+ - `sl daemon jira start <work-item-id> --plan "1) reproduce 2) patch 3) verify" --actor maya.markov@sentinelayer.local --assignee maya.markov@sentinelayer.local`
491
+ - `sl daemon jira comment --work-item-id <work-item-id> --type checkpoint --message "patch applied"`
492
+ - `sl daemon jira transition --work-item-id <work-item-id> --to DONE --reason "fix merged"`
493
+ - `sl daemon jira list --status DONE --work-item-id <work-item-id> --json`
494
+
495
+ Lifecycle artifacts:
496
+
497
+ - `.sentinelayer/observability/error-daemon/jira-lifecycle.json` (issue state, comments, transitions)
498
+ - `.sentinelayer/observability/error-daemon/jira-events.ndjson` (append-only lifecycle event feed)
499
+
500
+ When an assignment exists for the same work item, Jira issue keys are synced into assignment ledger records for deterministic handoff continuity.
501
+
502
+ ## Runtime budget quarantine (Phase 13.4 slice)
503
+
504
+ Daemon budget governor commands now enforce hard-limit transitions with quarantine grace and deterministic kill path:
505
+
506
+ - `sl daemon budget check <work-item-id> --usage-json '{"tokensUsed":150}' --budget-json '{"maxTokens":100,"quarantineGraceSeconds":30}'`
507
+ - `sl daemon budget status --work-item-id <work-item-id> --json`
508
+
509
+ Lifecycle states:
510
+
511
+ - `WITHIN_BUDGET`
512
+ - `WARNING_THRESHOLD`
513
+ - `HARD_LIMIT_QUARANTINED`
514
+ - `HARD_LIMIT_SQUASHED`
515
+
516
+ Governor behavior:
517
+
518
+ - crossing a hard limit transitions the work item into quarantine (`action=QUARANTINE`, queue/assignment status `BLOCKED`)
519
+ - if hard-limit usage persists past `quarantineGraceSeconds`, governor triggers deterministic kill (`action=KILL`, queue/assignment status `SQUASHED`)
520
+ - warning thresholds (`warningThresholdPercent`) surface near-limit signals without blocking
521
+
522
+ Budget artifacts:
523
+
524
+ - `.sentinelayer/observability/error-daemon/budget-state.json`
525
+ - `.sentinelayer/observability/error-daemon/budget-events.ndjson`
526
+ - `.sentinelayer/observability/error-daemon/budget-runs/budget-check-*.json`
527
+
528
+ ## Operator control plane (Phase 13.5 slice)
529
+
530
+ Daemon operator control commands now provide unified queue/assignment/jira/budget visibility with explicit stop controls:
531
+
532
+ - `sl daemon control --json`
533
+ - `sl daemon control snapshot --status ASSIGNED,BLOCKED --agent maya.markov@sentinelayer.local --json`
534
+ - `sl daemon control stop <work-item-id> --mode QUARANTINE --reason "manual triage hold" --confirm --json`
535
+ - `sl daemon control stop <work-item-id> --mode SQUASH --reason "kill switch activated" --confirm --json`
536
+
537
+ Control-plane snapshot fields include:
538
+
539
+ - per-work-item budget health color (`GREEN`, `YELLOW`, `RED`)
540
+ - session timers (`sessionElapsedSeconds`, `sessionIdleSeconds`)
541
+ - assignment + Jira linkage (`assignedAgentIdentity`, `assignmentStatus`, `jiraIssueKey`, `jiraStatus`)
542
+ - agent roster aggregates (`activeWorkItemCount`, `blockedCount`, `squashedCount`, longest-session duration)
543
+
544
+ Operator control artifacts:
545
+
546
+ - `.sentinelayer/observability/error-daemon/operator-control-state.json`
547
+ - `.sentinelayer/observability/error-daemon/operator-events.ndjson`
548
+ - `.sentinelayer/observability/error-daemon/operator-snapshots/operator-snapshot-*.json`
549
+
550
+ ## Artifact lineage tree (Phase 13.6 slice)
551
+
552
+ Daemon lineage commands now index reproducibility links across queue, assignment, Jira, budget, and operator artifacts:
553
+
554
+ - `sl daemon lineage build --json`
555
+ - `sl daemon lineage list --status ASSIGNED,BLOCKED --json`
556
+ - `sl daemon lineage show <work-item-id> --json`
557
+
558
+ Lineage index fields include:
559
+
560
+ - work-item links (`agentIdentity`, `assignmentStatus`, `loopRunId`, `jiraIssueKey`, `budgetLifecycleState`)
561
+ - artifact pointers (queue/ledger/jira/budget/operator state files + per-work-item run artifacts)
562
+ - reproducibility run catalogs (`errorDaemonRuns`, `budgetChecks`, `operatorSnapshots`)
563
+
564
+ Lineage artifacts:
565
+
566
+ - `.sentinelayer/observability/error-daemon/lineage/lineage-index.json`
567
+ - `.sentinelayer/observability/error-daemon/lineage/lineage-events.ndjson`
568
+
569
+ ## Hybrid mapping overlay (Phase 13.7 slice)
570
+
571
+ Daemon hybrid mapping commands now combine deterministic signal routing with on-demand import-graph expansion and semantic scoring:
572
+
573
+ - `sl daemon map scope <work-item-id> --max-files 40 --graph-depth 2 --json`
574
+ - `sl daemon map list --work-item-id <work-item-id> --json`
575
+ - `sl daemon map show <work-item-id> --json`
576
+
577
+ Hybrid scope map output includes:
578
+
579
+ - deterministic seed files from endpoint/error/service token matches
580
+ - import-graph overlay (`graphDepth`) from seed files
581
+ - semantic scoring from endpoint/signal token matches in file content
582
+ - ranked scoped file set with per-file reasons (`deterministic_path_match`, `semantic_content_match`, `import_graph_distance`)
583
+
584
+ Hybrid mapping artifacts:
585
+
586
+ - `.sentinelayer/observability/error-daemon/mapping/hybrid-map-index.json`
587
+ - `.sentinelayer/observability/error-daemon/mapping/hybrid-map-events.ndjson`
588
+ - `.sentinelayer/observability/error-daemon/mapping/runs/hybrid-map-*.json`
589
+
590
+ ## Midnight reliability lane (Phase 13.8 slice)
591
+
592
+ Daemon reliability commands now support scheduled synthetic checks and maintenance-billboard automation:
593
+
594
+ - `sl daemon reliability run --region us-east-1 --timezone America/New_York --json`
595
+ - `sl daemon reliability run --simulate-failure aidenid_password_reset_flow --json`
596
+ - `sl daemon reliability status --json`
597
+ - `sl daemon maintenance status|on|off --json`
598
+
599
+ Lane behavior:
600
+
601
+ - failures enqueue deterministic daemon error events (`source=reliability_lane`) and execute one worker tick
602
+ - failures can auto-enable maintenance billboard for operator/HITL visibility
603
+ - passing runs can automatically clear reliability-opened maintenance state
604
+ - manual maintenance controls remain available (`maintenance on|off`) with reason/actor audit trail
605
+
606
+ Reliability artifacts:
607
+
608
+ - `.sentinelayer/observability/error-daemon/reliability/lane-config.json`
609
+ - `.sentinelayer/observability/error-daemon/reliability/maintenance-billboard.json`
610
+ - `.sentinelayer/observability/error-daemon/reliability/reliability-events.ndjson`
611
+ - `.sentinelayer/observability/error-daemon/reliability/runs/reliability-lane-*.json`
612
+
613
+ ## MCP registry schema foundation (Phase 6 foundation slice)
614
+
615
+ The CLI now includes deterministic MCP registry commands:
616
+
617
+ - `sl mcp schema show`
618
+ - `sl mcp schema write`
619
+ - `sl mcp registry init-aidenid`
620
+ - `sl mcp registry init-aidenid-adapter`
621
+ - `sl mcp registry validate --file <path>`
622
+ - `sl mcp registry validate-aidenid-adapter --file <path> [--registry-file <path>]`
623
+ - `sl mcp server init --id <server-id> --registry-file <path>`
624
+ - `sl mcp server validate --file <path>`
625
+ - `sl mcp bridge init-vscode --server-id <server-id> --server-config <path>`
626
+
627
+ Use `init-aidenid` to scaffold an Anthropic-compatible tool schema wrapper for AIdenID provisioning APIs, then customize transport/auth before runtime wiring.
628
+ Use `init-aidenid-adapter` to scaffold a deterministic AIdenID provisioning API contract (tool binding -> HTTP path/method -> response field mapping) and cross-check it against the registry with `validate-aidenid-adapter`.
629
+
630
+ ## Plugin governance foundation (Phase 5.2 slice)
631
+
632
+ The CLI now includes deterministic plugin/template/policy pack governance commands:
633
+
634
+ - `sl plugin init --id <plugin-id> --pack-type plugin|template_pack|policy_pack|hybrid --stage pre_scan|scan|post_scan|reporting`
635
+ - `sl plugin validate --file <manifest.json>`
636
+ - `sl plugin list`
637
+ - `sl plugin order [--stage <stage>]` (deterministic load-order resolution + cycle detection)
638
+
639
+ ## Policy packs (Phase 5.3 slice)
640
+
641
+ The CLI now includes policy-pack selection commands:
642
+
643
+ - `sl policy list`
644
+ - `sl policy use strict --scope project`
645
+ - `sl policy use compliance-soc2 --scope global`
646
+
647
+ Built-in packs: `community` (default), `strict`, `compliance-soc2`, `compliance-hipaa`.
648
+ Policy selection is stored in config (`defaultPolicyPack`) and applied during `scan init` / `scan validate` / `scan precheck` profile resolution.
649
+
650
+ ## AIdenID CLI foundation (Phase 11 foundation slice)
651
+
652
+ The CLI now includes an `sl ai` surface for AIdenID identity provisioning:
653
+
654
+ - `sl ai provision-email --json` (dry-run artifact generation)
655
+ - `sl ai provision-email --execute --api-key <key> --org-id <id> --project-id <id>` (live API call)
656
+ - `sl ai identity list --json` (list locally tracked identities)
657
+ - `sl ai identity show <identity-id> --json`
658
+ - `sl ai identity revoke <identity-id> --execute --api-key <key> --org-id <id> --project-id <id>`
659
+ - `sl ai identity create-child <parent-identity-id> --event-budget 25 --execute --api-key <key> --org-id <id> --project-id <id>`
660
+ - `sl ai identity lineage <identity-id> --json`
661
+ - `sl ai identity revoke-children <parent-identity-id> --execute --api-key <key> --org-id <id> --project-id <id>`
662
+ - `sl ai identity domain create|verify|freeze ...` (domain proof + freeze lifecycle controls)
663
+ - `sl ai identity target create|verify|show ...` (managed target policy/proof controls)
664
+ - `sl ai identity site create <identity-id> --domain-id <domain-id> --execute ...`
665
+ - `sl ai identity site list [--identity-id <identity-id>]`
666
+ - `sl ai identity events <identity-id> --json` (list inbound events with cursor/limit support)
667
+ - `sl ai identity latest <identity-id> --json` (latest event + extraction metadata)
668
+ - `sl ai identity wait-for-otp <identity-id> --min-confidence 0.8 --timeout 60 --json`
669
+
670
+ Identity lifecycle records are persisted to:
671
+
672
+ - `.sentinelayer/aidenid/identity-registry.json`
673
+
674
+ Credential env fallbacks for live execution:
675
+
676
+ - `AIDENID_API_KEY`
677
+ - `AIDENID_ORG_ID`
678
+ - `AIDENID_PROJECT_ID`
679
+
680
+ Extraction responses include deterministic source metadata (`RULES` vs `LLM`) and confidence scores.
681
+
682
+ ## Manual fallback (if auto injection is skipped)
683
+
684
+ 1. Set local token:
685
+
686
+ ```bash
687
+ echo "SENTINELAYER_TOKEN=<your-token>" >> .env
688
+ ```
689
+
690
+ 2. Inject repo secret:
691
+
692
+ ```bash
693
+ gh secret set SENTINELAYER_TOKEN --repo <owner/repo>
694
+ gh secret list --repo <owner/repo>
695
+ ```
696
+
697
+ 3. For manual setup details: `https://sentinelayer.com/docs/getting-started/install-workflow`
698
+
699
+ 4. BYOK mode (no Sentinelayer token):
700
+ - keep generated `docs/spec.md`, `docs/build-guide.md`, `prompts/execution-prompt.md`, and `tasks/todo.md`
701
+ - run your coding agent directly with your provider key (`OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GOOGLE_API_KEY`)
702
+ - generated workflow is a BYOK reminder workflow; wire `SENTINELAYER_TOKEN` later to enable Omar Gate action
703
+
704
+ ## Environment overrides
705
+
706
+ - `SENTINELAYER_API_URL` (default: `https://api.sentinelayer.com`)
707
+ - `SENTINELAYER_WEB_URL` (default: `https://sentinelayer.com`)
708
+ - `SENTINELAYER_DISABLE_KEYRING=1` (force file-based credential storage)
709
+ - `AIDENID_API_KEY`, `AIDENID_ORG_ID`, `AIDENID_PROJECT_ID` (used by `sl ai provision-email --execute`)
710
+
711
+ ## Layered config (PR 0.2)
712
+
713
+ The CLI supports layered config resolution:
714
+
715
+ - global: `~/.sentinelayer/config.yml`
716
+ - project: `.sentinelayer.yml` at repo root
717
+ - env overrides: `SENTINELAYER_API_URL`, `SENTINELAYER_WEB_URL`, `SENTINELAYER_TOKEN`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`
718
+
719
+ Commands:
720
+
721
+ - `sentinelayer-cli config list --scope resolved --json`
722
+ - `sentinelayer-cli config get apiUrl --scope resolved`
723
+ - `sentinelayer-cli config set defaultModelProvider openai --scope project`
724
+ - `sentinelayer-cli config edit --scope project`
725
+
726
+ ## Codebase ingest (PR 1.1 slice)
727
+
728
+ Run deterministic mapping and emit `CODEBASE_INGEST.json`:
729
+
730
+ - `sentinelayer-cli ingest map --path .`
731
+ - `sentinelayer-cli ingest map --path . --json`
732
+ - `sentinelayer-cli ingest map --path . --output-file artifacts/CODEBASE_INGEST.json`
733
+
734
+ The ingest artifact includes language/LOC breakdown, framework hints, entry points, risk-surface hints, and a bounded file index to support deterministic handoff context.
735
+
736
+ ## Offline spec generation (PR 1.2 slice)
737
+
738
+ Generate a local `SPEC.md` without calling the API:
739
+
740
+ - `sentinelayer-cli spec list-templates`
741
+ - `sentinelayer-cli spec show-template api-service`
742
+ - `sentinelayer-cli spec generate --path . --template api-service --description \"Build secure autonomous review orchestration\"`
743
+ - `sentinelayer-cli spec show --path .`
744
+ - `sentinelayer-cli spec show --path . --plain`
745
+ - `sentinelayer-cli spec regenerate --path . --dry-run --json`
746
+ - `sentinelayer-cli spec regenerate --path . --max-diff-lines 120`
747
+ - `sentinelayer-cli spec regenerate --path . --dry-run --quiet`
748
+
749
+ The generator uses deterministic ingest context plus template architecture/security checklists.
750
+
751
+ ## AI-enhanced spec generation (PR 3.3 slice)
752
+
753
+ Generate a deterministic base spec, then optionally refine it with a provider model:
754
+
755
+ - `sentinelayer-cli spec generate --path . --template api-service --description "Harden auth and release workflows" --ai`
756
+ - `sentinelayer-cli spec generate --path . --ai --provider openai --model gpt-5.3-codex --max-cost 1 --warn-at-percent 80`
757
+
758
+ `--ai` mode behavior:
759
+
760
+ - deterministic `SPEC.md` draft is always generated first
761
+ - AI refinement prompt includes ingest summary + template context + base markdown
762
+ - usage is recorded in `.sentinelayer/cost-history.json`
763
+ - telemetry usage/stop events are recorded in `.sentinelayer/observability/run-events.jsonl`
764
+ - budget governors apply (`--max-cost`, `--max-tokens`, `--max-runtime-ms`, `--max-tool-calls`, `--max-no-progress`)
765
+
766
+ ## Prompt generation (PR 1.3 slice)
767
+
768
+ Generate execution prompts directly from `SPEC.md`:
769
+
770
+ - `sentinelayer-cli prompt generate --path . --agent codex`
771
+ - `sentinelayer-cli prompt preview --path . --agent claude --max-lines 40`
772
+ - `sentinelayer-cli prompt show --path . --agent codex`
773
+ - `sentinelayer-cli prompt show --path . --file docs/PROMPT_codex.md --plain`
774
+
775
+ Supported targets: `claude`, `cursor`, `copilot`, `codex`, `generic`.
776
+
777
+ ## Omar workflow generation (PR 1.4 slice)
778
+
779
+ Generate and validate a spec-aligned security workflow:
780
+
781
+ - `sentinelayer-cli scan init --path . --non-interactive`
782
+ - `sentinelayer-cli scan init --path . --has-e2e-tests yes --playwright-mode auto`
783
+ - `sentinelayer-cli scan validate --path . --json`
784
+
785
+ `scan init` writes `.github/workflows/omar-gate.yml` and derives:
786
+
787
+ - `scan_mode` + `severity_gate` from spec risk profile
788
+ - `playwright_mode` from spec signals + optional E2E wizard/flags
789
+ - `sbom_mode` from supply-chain/dependency signals in spec
790
+ - Action bridge parity: generated `scan_mode` options align to `sentinelayer-v1-action` (`baseline`, `deep`, `audit`, `full-depth`) and use the pinned action ref.
791
+
792
+ `scan validate` checks workflow drift against the current spec profile and exits non-zero when mismatched.
793
+
794
+ AI-assisted pre-scan triage (budgeted + telemetry-instrumented):
795
+
796
+ - `sentinelayer-cli scan precheck --path . --provider openai --model gpt-5.3-codex`
797
+ - `sentinelayer-cli scan precheck --path . --max-cost 0.5 --warn-at-percent 80 --json`
798
+
799
+ `scan precheck` writes an AI report to `.sentinelayer/reports/scan-precheck-*.md` (or configured output root), records usage in `.sentinelayer/cost-history.json`, and emits usage/stop events to `.sentinelayer/observability/run-events.jsonl`.
800
+
801
+ ## Build guide generation (PR 1.5 slice)
802
+
803
+ Generate phase-by-phase implementation guides from `SPEC.md`:
804
+
805
+ - `sentinelayer-cli guide generate --path .`
806
+ - `sentinelayer-cli guide generate --path . --output-file docs/BUILD_GUIDE.md`
807
+ - `sentinelayer-cli guide show --path .`
808
+ - `sentinelayer-cli guide show --path . --plain`
809
+
810
+ Export phases as issue-ready payloads:
811
+
812
+ - `sentinelayer-cli guide export --path . --format jira`
813
+ - `sentinelayer-cli guide export --path . --format linear`
814
+ - `sentinelayer-cli guide export --path . --format github-issues`
815
+
816
+ `guide generate` writes `BUILD_GUIDE.md` with per-phase effort estimates, dependencies, implementation tasks, and acceptance criteria. `guide export` transforms phases into tracker-friendly artifacts.
817
+
818
+ ## Multi-provider AI client contract (PR 3.1 slice)
819
+
820
+ `src/ai/client.js` now provides a reusable contract for future AI-enabled commands:
821
+
822
+ - provider support: `openai`, `anthropic`, `google`
823
+ - provider auto-detection from `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`
824
+ - model resolution defaults per provider with explicit override support
825
+ - retry + exponential backoff on retryable statuses (`429`, `5xx`)
826
+ - non-stream and streaming invocation APIs with provider-normalized text output
827
+
828
+ ## Cost tracking and budgets (PR 3.2 slice)
829
+
830
+ The CLI now includes deterministic cost-ledger commands:
831
+
832
+ - `sentinelayer-cli cost show --path .`
833
+ - `sentinelayer-cli cost record --path . --provider openai --model gpt-5.3-codex --input-tokens 1000 --output-tokens 500`
834
+
835
+ Ledger path:
836
+
837
+ - `.sentinelayer/cost-history.json` (or configured output root)
838
+
839
+ Budget controls in `cost record`:
840
+
841
+ - `--max-cost <usd>` (default `1`)
842
+ - `--max-tokens <count>` (default `0`, disabled)
843
+ - `--max-runtime-ms <n>` (default `0`, disabled)
844
+ - `--max-tool-calls <n>` (default `0`, disabled)
845
+ - `--max-no-progress <count>` diminishing-returns guard (default `3`)
846
+ - `--warn-at-percent <n>` near-limit warning threshold (default `80`)
847
+
848
+ Usage counters tracked per invocation/session:
849
+
850
+ - `--duration-ms <n>`
851
+ - `--tool-calls <n>`
852
+
853
+ Each `cost record` call now emits observability events to:
854
+
855
+ - `.sentinelayer/observability/run-events.jsonl`
856
+
857
+ including normalized usage snapshots and blocking stop-class events when budgets are exceeded.
858
+
859
+ ## Observability telemetry contract (PR 3.5 slice)
860
+
861
+ The CLI now supports a deterministic run-event ledger and stop-class schema:
862
+
863
+ - `sentinelayer-cli telemetry show --path .`
864
+ - `sentinelayer-cli telemetry record --path . --event-type tool_call --tool-calls 1`
865
+ - `sentinelayer-cli telemetry record --path . --event-type run_stop --stop-class MAX_RUNTIME_MS_EXCEEDED --reason-codes MAX_RUNTIME_MS_EXCEEDED --blocking`
866
+
867
+ Ledger contract:
868
+
869
+ - file: `.sentinelayer/observability/run-events.jsonl`
870
+ - event types: `run_start`, `run_step`, `tool_call`, `usage`, `budget_check`, `run_stop`
871
+ - stop classes: `MAX_COST_EXCEEDED`, `MAX_OUTPUT_TOKENS_EXCEEDED`, `DIMINISHING_RETURNS`, `MAX_RUNTIME_MS_EXCEEDED`, `MAX_TOOL_CALLS_EXCEEDED`, `MANUAL_STOP`, `ERROR`, `UNKNOWN`
872
+
873
+ ## Requirements
874
+
875
+ - Node `>=20.0`
876
+ - network access to Sentinelayer API/web
877
+ - optional: GitHub CLI (`gh`) authenticated for secret injection
878
+
879
+ ## Release to npm
880
+
881
+ This repo includes `.github/workflows/release.yml`.
882
+ Automated version/tag PR flow is handled by `.github/workflows/release-please.yml`.
883
+ Primary gate enforcement is Omar-first:
884
+ - `.github/workflows/omar-gate.yml` (`Omar Gate`) for AppSec findings and merge thresholds
885
+ - `.github/workflows/quality-gates.yml` (`Quality Summary`) for deterministic build/test/package checks
886
+ - `.github/workflows/attestations.yml` (`Attestation Summary`) for provenance verification
887
+
888
+ Prerequisites:
889
+
890
+ - npm package name is available (`sentinelayer-cli`)
891
+ - one publish auth path is configured:
892
+ - repository secret `NPM_TOKEN` with publish access, or
893
+ - npm trusted publishing for this repository/tag workflow
894
+
895
+ Release options:
896
+
897
+ 1. Merge to `main` and let `Release Please` open/update the release PR and tag.
898
+ 2. Push a tag like `v0.1.1` to publish automatically (or via release-please tag creation).
899
+ 3. Run `Release` manually (`workflow_dispatch`) to validate gates and rollback readiness without publishing.
900
+ 4. Tag-triggered publish resolves auth mode at runtime (`NPM_TOKEN` first, otherwise trusted publishing OIDC).
901
+ 5. If neither auth mode is available, publish fails closed with an explicit workflow error.
902
+
903
+ Release publish now enforces tarball checksum-manifest validation and attestation verification bound to `.github/workflows/release.yml` before `npm publish`.
904
+
905
+ Release guardrails now require successful upstream checks on the target commit:
906
+
907
+ - `Quality Summary`
908
+ - `Omar Gate`
909
+ - `Attestation Summary`
910
+
911
+ ## Local verification
912
+
913
+ ```bash
914
+ npm run verify
915
+ ```
916
+
917
+ This runs:
918
+
919
+ - CLI syntax check
920
+ - unit tests for core offline generators/config/cost tracking
921
+ - end-to-end automated scaffolding tests (mock API + mock `gh`)
922
+ - coverage enforcement (`>=80%` lines/functions/statements, `>=70%` branches for core modules)
923
+ - package tarball dry-run
924
+
925
+ Additional test commands:
926
+
927
+ - `npm run test:unit`
928
+ - `npm run test:e2e`
929
+ - `npm run test:coverage`
930
+
931
+ ## Local commands (MVP)
932
+
933
+ The CLI now supports a command tree, while keeping slash-command compatibility:
934
+
935
+ - `sentinelayer-cli init <project-name>` runs scaffold/auth generation (legacy top-level invocation still works)
936
+ - `sentinelayer-cli omargate deep --path <repo>` runs a local credential/policy scan and writes `.sentinelayer/reports/omargate-deep-*.md` (non-zero exit if P1 findings exist)
937
+ - Local `/omargate` is a local preflight engine; GitHub PR gate execution runs through `sentinelayer-v1-action` -> Sentinelayer API (`/api/v1/github-app/trigger` + `/api/v1/github-app/runs/{id}/status`).
938
+ - `sentinelayer-cli audit [--agents <ids>] [--max-parallel <n>]` runs orchestrated audit agents and writes `.sentinelayer/audits/<run-id>/AUDIT_REPORT.{md,json}`
939
+ - `sentinelayer-cli audit registry` lists built-in/customized audit-agent registry records
940
+ - `sentinelayer-cli audit security` runs the security specialist agent and writes a dedicated `SECURITY_AGENT_REPORT.md`
941
+ - `sentinelayer-cli audit architecture` runs the architecture specialist agent and writes a dedicated `ARCHITECTURE_AGENT_REPORT.md`
942
+ - `sentinelayer-cli audit testing` runs the testing specialist agent and writes a dedicated `TESTING_AGENT_REPORT.md`
943
+ - `sentinelayer-cli audit performance` runs the performance specialist agent and writes a dedicated `PERFORMANCE_AGENT_REPORT.md`
944
+ - `sentinelayer-cli audit compliance` runs the compliance specialist agent and writes a dedicated `COMPLIANCE_AGENT_REPORT.md`
945
+ - `sentinelayer-cli audit documentation` runs the documentation specialist agent and writes a dedicated `DOCUMENTATION_AGENT_REPORT.md`
946
+ - `sentinelayer-cli audit package [--run-id <id>]` builds/rebuilds unified DD package artifacts from the requested (or latest) run
947
+ - `sentinelayer-cli audit replay <run-id>` reruns the same selected agent set and writes a replay comparison artifact
948
+ - `sentinelayer-cli audit diff <base-run-id> <candidate-run-id>` compares two runs and emits reproducibility drift deltas
949
+ - `sentinelayer-cli audit local --path <repo>` runs legacy readiness + scan audit and writes `.sentinelayer/reports/audit-*.md`
950
+ - `sentinelayer-cli persona orchestrator --mode <builder|reviewer|hardener> --path <repo>` generates mode-specific execution instructions with repo context
951
+ - `sentinelayer-cli apply --plan tasks/todo.md --path <repo>` parses plan tasks into deterministic execution order preview
952
+ - `sentinelayer-cli auth login|status|logout` manages persistent CLI sessions for long-running automation
953
+ - `sentinelayer-cli auth sessions|revoke` supports session inventory and explicit token revocation controls
954
+ - `sentinelayer-cli watch run-events --run-id <id>` streams runtime events with local artifact persistence
955
+ - `sentinelayer-cli daemon error record|worker|queue` ingests admin errors and routes deterministic daemon queue work items
956
+ - `sentinelayer-cli daemon assign claim|heartbeat|release|reassign|list` manages shared daemon assignment leases and lifecycle states
957
+ - `sentinelayer-cli daemon jira open|start|comment|transition|list` manages Jira lifecycle evidence tied to daemon work items
958
+ - `sentinelayer-cli daemon budget check|status` enforces budget warning/quarantine/kill governance with reproducible artifacts
959
+ - `sentinelayer-cli daemon control|snapshot|stop` provides operator roster snapshots and explicit confirmed stop controls
960
+ - `sentinelayer-cli daemon lineage build|list|show` indexes reproducible work-item artifact lineage across queue/assignment/jira/budget/operator runs
961
+ - `sentinelayer-cli daemon map scope|list|show` builds hybrid deterministic+semantic impact scopes with import-graph overlay for daemon work items
962
+ - `sentinelayer-cli daemon reliability run|status` and `daemon maintenance status|on|off` operate the midnight synthetic lane and maintenance billboard lifecycle
963
+ - `sentinelayer-cli mcp schema|registry|server|bridge ...` manages MCP registry schema, server configs, and VS Code bridge scaffolds
964
+ - `sentinelayer-cli plugin init|validate|list|order` manages plugin/template/policy packs and deterministic load-order governance
965
+ - `sentinelayer-cli policy list|use <pack-id>` manages active policy pack selection (`community`, `strict`, `compliance-soc2`, `compliance-hipaa`, plugin packs)
966
+ - `sentinelayer-cli ai provision-email` scaffolds and optionally executes AIdenID identity provisioning requests
967
+ - `sentinelayer-cli ai identity list|show|revoke|create-child|lineage|revoke-children` manages local identity lifecycle and lineage workflows
968
+ - `sentinelayer-cli ai identity domain create|verify|freeze` manages domain proof registration and containment controls
969
+ - `sentinelayer-cli ai identity target create|verify|show` manages target policy registration and verification controls
970
+ - `sentinelayer-cli ai identity site create|list` manages ephemeral callback site provisioning and local lifecycle tracking
971
+ - `sentinelayer-cli ai identity events|latest|wait-for-otp` manages extraction/event polling for OTP and verification-link retrieval
972
+ - `sentinelayer-cli chat ask` runs low-latency prompt/response chat with transcript persistence
973
+ - `sentinelayer-cli review [path] [--diff|--staged]` runs layered deterministic review and writes reproducible artifacts under `.sentinelayer/reviews/<run-id>/`
974
+ - `sentinelayer-cli review [path] [--diff|--staged] [--ai]` adds budget-governed AI reasoning over deterministic findings
975
+ - `sentinelayer-cli review show|export|accept|reject|defer ...` manages reconciled unified reports and HITL adjudication
976
+ - `sentinelayer-cli review replay|diff ...` runs reproducibility replay and run-to-run drift comparisons
977
+ - `sentinelayer-cli review scan --mode full|diff|staged` runs lightweight deterministic scan mode for compatibility
978
+ - add `--json` to `omargate`, `audit`, `persona orchestrator`, or `apply` for machine-readable summaries in CI
979
+ - add `--output-dir <dir>` to local commands to write reports outside the default `.sentinelayer/reports`
980
+
981
+ Legacy slash commands are still supported:
982
+
983
+ - `sentinelayer-cli /omargate deep --path .`
984
+ - `sentinel /omargate deep --path .`
985
+
986
+ Roadmap:
987
+
988
+ - persona orchestrator command set for specialized review/execution modes
989
+
990
+ ## Troubleshooting
991
+
992
+ - `Authentication timed out`: rerun and approve browser session faster.
993
+ - `GitHub CLI not installed`: install `gh` or run manual fallback.
994
+ - `Invalid repo format`: use exact `owner/repo`.
995
+ - `Missing token in workflow`: ensure `.github/workflows/omar-gate.yml` maps `sentinelayer_token: ${{ secrets.SENTINELAYER_TOKEN }}`.
996
+