sentinelayer-cli 0.6.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +996 -996
  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 +64 -63
  6. package/src/agents/jules/config/definition.js +160 -160
  7. package/src/agents/jules/config/system-prompt.js +182 -182
  8. package/src/agents/jules/error-intake.js +51 -51
  9. package/src/agents/jules/fix-cycle.js +17 -17
  10. package/src/agents/jules/loop.js +457 -450
  11. package/src/agents/jules/pulse.js +10 -10
  12. package/src/agents/jules/stream.js +187 -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 +311 -309
  18. package/src/agents/jules/tools/aidenid-email.js +189 -189
  19. package/src/agents/jules/tools/auth-audit.js +1699 -1691
  20. package/src/agents/jules/tools/dispatch.js +340 -335
  21. package/src/agents/jules/tools/file-edit.js +2 -2
  22. package/src/agents/jules/tools/file-read.js +2 -2
  23. package/src/agents/jules/tools/frontend-analyze.js +570 -570
  24. package/src/agents/jules/tools/glob.js +2 -2
  25. package/src/agents/jules/tools/grep.js +2 -2
  26. package/src/agents/jules/tools/index.js +29 -29
  27. package/src/agents/jules/tools/path-guards.js +2 -2
  28. package/src/agents/jules/tools/runtime-audit.js +507 -507
  29. package/src/agents/jules/tools/shell.js +2 -2
  30. package/src/agents/jules/tools/url-policy.js +100 -100
  31. package/src/agents/persona-visuals.js +64 -61
  32. package/src/agents/shared-tools/dispatch-core.js +320 -315
  33. package/src/agents/shared-tools/file-edit.js +180 -180
  34. package/src/agents/shared-tools/file-read.js +100 -100
  35. package/src/agents/shared-tools/glob.js +168 -168
  36. package/src/agents/shared-tools/grep.js +228 -228
  37. package/src/agents/shared-tools/index.js +46 -46
  38. package/src/agents/shared-tools/path-guards.js +161 -161
  39. package/src/agents/shared-tools/shell.js +383 -383
  40. package/src/ai/aidenid.js +1021 -1009
  41. package/src/ai/client.js +553 -553
  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 -137
  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 +400 -371
  57. package/src/auth/http.js +681 -611
  58. package/src/auth/service.js +1106 -1106
  59. package/src/auth/session-store.js +813 -813
  60. package/src/cli.js +257 -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 +1171 -1166
  67. package/src/commands/auth.js +419 -419
  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 -29
  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 -872
  87. package/src/commands/session.js +590 -0
  88. package/src/commands/spec.js +778 -716
  89. package/src/commands/swarm.js +651 -651
  90. package/src/commands/telemetry.js +202 -202
  91. package/src/commands/watch.js +511 -511
  92. package/src/config/agent-dictionary.js +182 -182
  93. package/src/config/io.js +56 -56
  94. package/src/config/paths.js +18 -18
  95. package/src/config/schema.js +55 -55
  96. package/src/config/service.js +184 -184
  97. package/src/cost/budget.js +235 -235
  98. package/src/cost/history.js +188 -188
  99. package/src/cost/tracker.js +171 -171
  100. package/src/daemon/artifact-lineage.js +534 -534
  101. package/src/daemon/assignment-ledger.js +966 -770
  102. package/src/daemon/ast-parser-layer.js +258 -258
  103. package/src/daemon/budget-governor.js +633 -633
  104. package/src/daemon/callgraph-overlay.js +646 -646
  105. package/src/daemon/error-worker.js +1209 -626
  106. package/src/daemon/fix-cycle.js +384 -377
  107. package/src/daemon/hybrid-mapper.js +929 -929
  108. package/src/daemon/ingest-refresh.js +10 -9
  109. package/src/daemon/jira-lifecycle.js +767 -632
  110. package/src/daemon/operator-control.js +657 -657
  111. package/src/daemon/pulse.js +327 -327
  112. package/src/daemon/reliability-lane.js +471 -471
  113. package/src/daemon/scope-engine.js +1068 -0
  114. package/src/daemon/watchdog.js +971 -971
  115. package/src/events/schema.js +190 -0
  116. package/src/guide/generator.js +316 -316
  117. package/src/ingest/engine.js +918 -918
  118. package/src/interactive/index.js +97 -97
  119. package/src/legacy-cli.js +3161 -2994
  120. package/src/mcp/registry.js +695 -695
  121. package/src/memory/blackboard.js +301 -301
  122. package/src/memory/retrieval.js +581 -581
  123. package/src/plugin/manifest.js +553 -553
  124. package/src/policy/packs.js +144 -144
  125. package/src/prompt/generator.js +136 -118
  126. package/src/review/ai-review.js +679 -679
  127. package/src/review/local-review.js +1351 -1305
  128. package/src/review/omargate-interactive.js +68 -68
  129. package/src/review/omargate-orchestrator.js +404 -300
  130. package/src/review/persona-prompts.js +296 -296
  131. package/src/review/replay.js +235 -235
  132. package/src/review/report.js +664 -664
  133. package/src/review/scan-modes.js +48 -42
  134. package/src/review/spec-binding.js +487 -487
  135. package/src/scaffold/generator.js +67 -67
  136. package/src/scaffold/templates.js +150 -150
  137. package/src/scan/generator.js +418 -418
  138. package/src/scan/gh-secrets.js +107 -107
  139. package/src/session/agent-registry.js +352 -0
  140. package/src/session/daemon.js +801 -0
  141. package/src/session/paths.js +33 -0
  142. package/src/session/runtime-bridge.js +739 -0
  143. package/src/session/store.js +388 -0
  144. package/src/session/stream.js +325 -0
  145. package/src/spec/generator.js +619 -519
  146. package/src/spec/regenerate.js +237 -237
  147. package/src/spec/templates.js +91 -91
  148. package/src/swarm/dashboard.js +247 -247
  149. package/src/swarm/factory.js +363 -363
  150. package/src/swarm/pentest.js +934 -934
  151. package/src/swarm/registry.js +419 -419
  152. package/src/swarm/report.js +158 -158
  153. package/src/swarm/runtime.js +576 -576
  154. package/src/swarm/scenario-dsl.js +272 -272
  155. package/src/telemetry/ledger.js +302 -302
  156. package/src/telemetry/session-tracker.js +234 -234
  157. package/src/telemetry/sync.js +203 -203
  158. package/src/ui/command-hints.js +13 -13
  159. package/src/ui/markdown.js +220 -220
package/README.md CHANGED
@@ -1,996 +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
- 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
-
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
+