loki-mode 9.8.0 → 9.12.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 (79) hide show
  1. package/README.md +19 -14
  2. package/SKILL.md +3 -2
  3. package/VERSION +1 -1
  4. package/autonomy/loki +122 -1
  5. package/autonomy/run.sh +49 -2
  6. package/dashboard/__init__.py +1 -1
  7. package/dashboard/api_evidence.py +411 -0
  8. package/dashboard/api_operator.py +283 -0
  9. package/dashboard/api_phases.py +262 -0
  10. package/dashboard/api_releases.py +242 -0
  11. package/dashboard/api_runs.py +477 -0
  12. package/dashboard/api_tests.py +444 -0
  13. package/dashboard/api_v2.py +47 -1
  14. package/dashboard/server.py +54 -0
  15. package/dashboard/static/index.html +246 -135
  16. package/docs/ARCHITECTURE-OVERVIEW.md +5 -3
  17. package/docs/CAPABILITY-BACKLOG.md +53 -0
  18. package/docs/COMPARISON.md +2 -2
  19. package/docs/COMPETITIVE-ANALYSIS.md +1 -1
  20. package/docs/COMPETITIVE-SCORECARD.md +422 -0
  21. package/docs/DASHBOARD-9.12-EVIDENCE.md +97 -0
  22. package/docs/DASHBOARD-ARCHITECTURE.md +423 -0
  23. package/docs/DEMOS.md +21 -23
  24. package/docs/HANDOFF-2026-08-03.md +439 -0
  25. package/docs/INSTALLATION.md +17 -10
  26. package/docs/OUTCOME-FRONTIER.md +536 -0
  27. package/docs/PROMPT-ABLATION-RESULT.md +97 -0
  28. package/docs/TOOLS.md +800 -0
  29. package/docs/alternative-installations.md +2 -3
  30. package/docs/audit-logging.md +44 -35
  31. package/docs/authentication.md +13 -2
  32. package/docs/authorization.md +87 -81
  33. package/docs/git-workflow.md +6 -3
  34. package/docs/metrics.md +15 -16
  35. package/docs/network-security.md +16 -13
  36. package/docs/openclaw-integration.md +36 -556
  37. package/docs/show-hn-post.md +2 -2
  38. package/docs/siem-integration.md +39 -36
  39. package/loki-ts/dist/loki.js +18 -18
  40. package/mcp/__init__.py +1 -1
  41. package/package.json +2 -2
  42. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  43. package/references/confidence-routing.md +18 -1
  44. package/references/invariant-checks.md +13 -8
  45. package/references/magic-rarv-integration.md +0 -1
  46. package/references/multi-provider.md +27 -5
  47. package/skills/healing.md +4 -2
  48. package/tools/audit-docs.py +488 -0
  49. package/tools/baseline-pin.py +19 -1
  50. package/tools/calibration-audit.py +523 -0
  51. package/tools/ci-gate.py +19 -1
  52. package/tools/cost-forecast.py +344 -0
  53. package/tools/cost-guard.py +19 -1
  54. package/tools/cost-history.py +19 -1
  55. package/tools/cost-per-outcome.py +394 -0
  56. package/tools/estimate-run.py +19 -1
  57. package/tools/evidence-freshness.py +307 -0
  58. package/tools/gate-init.py +19 -1
  59. package/tools/gate-report.py +19 -1
  60. package/tools/gate-simulate.py +570 -0
  61. package/tools/gate-trend.py +354 -0
  62. package/tools/model-advisor.py +52 -1
  63. package/tools/policy-load.py +19 -1
  64. package/tools/prompt-cost.py +363 -0
  65. package/tools/prompt-diff.py +448 -0
  66. package/tools/prompt-lint.py +448 -0
  67. package/tools/receipt-bundle.py +72 -2
  68. package/tools/receipt-diff.py +19 -1
  69. package/tools/receipt-find.py +19 -1
  70. package/tools/receipt-stats.py +380 -0
  71. package/tools/receipt-timeline.py +478 -0
  72. package/tools/receipt-verify-batch.py +291 -0
  73. package/tools/run-replay.py +19 -1
  74. package/tools/signing-status.py +19 -1
  75. package/tools/token-guard.py +19 -1
  76. package/tools/token-tax.py +375 -0
  77. package/tools/tool-index.py +19 -1
  78. package/tools/verification-tax.py +277 -0
  79. package/tools/verify-chain.py +361 -0
@@ -14,7 +14,6 @@ git clone https://github.com/asklokesh/loki-mode.git ~/.claude/skills/loki-mode
14
14
 
15
15
  # Optionally symlink for other providers:
16
16
  ln -sf ~/.claude/skills/loki-mode ~/.codex/skills/loki-mode
17
- ln -sf ~/.claude/skills/loki-mode ~/.gemini/skills/loki-mode
18
17
 
19
18
  # Optionally add CLI to PATH:
20
19
  ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
@@ -28,7 +27,7 @@ ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
28
27
 
29
28
  ## Docker
30
29
 
31
- **Status:** Image exists on Docker Hub. Tags: `latest`, version-specific (e.g., `8.0.0`).
30
+ **Status:** Image exists on Docker Hub. Tags: `latest`, version-specific (e.g., `9.8.0`).
32
31
 
33
32
  ```bash
34
33
  docker pull asklokesh/loki-mode:latest
@@ -84,7 +83,7 @@ jobs:
84
83
  | Input | Default | Description |
85
84
  |-------|---------|-------------|
86
85
  | `mode` | `review` | `review`, `fix`, or `test` |
87
- | `provider` | `claude` | `claude` (recommended), `codex`, `cline`, or `aider`. `gemini` is DEPRECATED (v7.5.18). |
86
+ | `provider` | `claude` | `claude` (recommended), `cline`, `codex`, `aider`, or `opencode`. `gemini` was REMOVED in v7.5.18. |
88
87
  | `budget_limit` | `5.00` | Max cost in USD |
89
88
  | `max_iterations` | `3` | Max RARV cycles |
90
89
  | `github_token` | (required) | GitHub token for PR comments |
@@ -44,8 +44,8 @@ enterprise:
44
44
  |----------|---------|-------------|
45
45
  | `LOKI_AUDIT_DISABLED` | `false` | Set to `true` to disable audit logging |
46
46
  | `LOKI_ENTERPRISE_AUDIT` | `false` | Force audit on (legacy, audit is now on by default) |
47
- | `LOKI_AUDIT_LEVEL` | `info` | Minimum log level: debug, info, warning, error |
48
- | `LOKI_AUDIT_RETENTION` | `90` | Retention period in days |
47
+ | `LOKI_AUDIT_MAX_SIZE_MB` | `10` | Rotate the log once it exceeds this size |
48
+ | `LOKI_AUDIT_MAX_FILES` | `10` | Number of rotated log files to keep |
49
49
  | `LOKI_AUDIT_SYSLOG_HOST` | - | Syslog server hostname for forwarding |
50
50
  | `LOKI_AUDIT_SYSLOG_PORT` | `514` | Syslog server port |
51
51
  | `LOKI_AUDIT_SYSLOG_PROTO` | `udp` | Syslog protocol: `udp` or `tcp` |
@@ -202,33 +202,34 @@ loki enterprise audit tail --event session.start
202
202
  loki enterprise audit tail --level error
203
203
  ```
204
204
 
205
- ### Search Logs
205
+ ### Search and export logs
206
+
207
+ `loki enterprise audit` has exactly two subcommands: `summary` and `tail`.
208
+ There is no `search` and no `export` (an earlier version of this page
209
+ documented both, with filter flags that do not exist). The log is newline
210
+ -delimited JSON on disk, so query and export it with ordinary tools:
206
211
 
207
212
  ```bash
208
- # Search by event
209
- loki enterprise audit search --event auth.fail
213
+ AUDIT=~/.loki/dashboard/audit/audit.jsonl
214
+
215
+ # Search by event type
216
+ jq -c 'select(.event == "auth.fail")' "$AUDIT"
210
217
 
211
218
  # Search by date range
212
- loki enterprise audit search --from 2026-02-01 --to 2026-02-15
219
+ jq -c 'select(.timestamp >= "2026-02-01" and .timestamp <= "2026-02-15")' "$AUDIT"
213
220
 
214
221
  # Search by actor
215
- loki enterprise audit search --actor ci-bot
222
+ jq -c 'select(.actor == "ci-bot")' "$AUDIT"
216
223
 
217
- # Combined filters
218
- loki enterprise audit search --event task.fail --from 2026-02-15 --level error
224
+ # Export a filtered slice
225
+ jq -s 'map(select(.event == "task.fail"))' "$AUDIT" > errors.json
219
226
  ```
220
227
 
221
- ### Export Logs
228
+ The built-in views:
222
229
 
223
230
  ```bash
224
- # Export to file
225
- loki enterprise audit export --output audit-export.json
226
-
227
- # Export with filters
228
- loki enterprise audit export --from 2026-01-01 --level error --output errors.json
229
-
230
- # Export as CSV
231
- loki enterprise audit export --format csv --output audit.csv
231
+ loki enterprise audit summary # aggregate counts
232
+ loki enterprise audit tail # most recent entries
232
233
  ```
233
234
 
234
235
  ## API Endpoints
@@ -297,10 +298,10 @@ Each audit entry includes a `chain_hash` field:
297
298
 
298
299
  ### Verification
299
300
 
300
- ```bash
301
- # Verify integrity via CLI
302
- loki audit verify
301
+ There is no `loki audit verify` subcommand (`loki audit` has `log`, `count`,
302
+ and `scan`). Verify the chain through the Python API:
303
303
 
304
+ ```bash
304
305
  # Python verification
305
306
  from dashboard.audit import verify_log_integrity
306
307
 
@@ -422,20 +423,25 @@ In addition to dashboard audit logs, agent actions are tracked separately.
422
423
 
423
424
  ### CLI Commands
424
425
 
426
+ Note that `loki audit` reads the agent-action audit trail, which is a separate
427
+ store from the enterprise audit log covered above.
428
+
425
429
  ```bash
426
- # View recent agent actions
430
+ # View recent agent actions (optional positional line count, default 50)
427
431
  loki audit log
432
+ loki audit log 200
428
433
 
429
434
  # Count total agent actions
430
435
  loki audit count
431
436
 
432
- # Filter by action type
433
- loki audit log --action git_commit
434
-
435
- # Show help
436
- loki audit help
437
+ # Run a quality scan
438
+ loki audit scan --preset default
437
439
  ```
438
440
 
441
+ `loki audit log` takes a line count, not filter flags; an earlier version of
442
+ this page showed `--action git_commit`, which is not implemented. Filter with
443
+ `grep` or `jq` over `.loki/audit.jsonl` instead.
444
+
439
445
  ## Compliance
440
446
 
441
447
  ### SOC2
@@ -521,16 +527,18 @@ echo '{"test": "entry"}' >> ~/.loki/dashboard/audit/test.jsonl
521
527
  ### Missing Events
522
528
 
523
529
  ```bash
524
- # Check minimum level configuration
530
+ # Check audit status and recent events
525
531
  loki enterprise audit summary
526
532
 
527
- # Lower level to capture more events
528
- export LOKI_AUDIT_LEVEL=debug
529
-
530
- # Check exclude_events in config
531
- cat .loki/config.yaml | grep -A 5 exclude_events
533
+ # Confirm audit is not disabled (it is ON by default)
534
+ echo "${LOKI_AUDIT_DISABLED:-unset}"
532
535
  ```
533
536
 
537
+ There is no minimum-severity filter and no per-event exclude list. Audit
538
+ logging is all-or-nothing: on by default, off with `LOKI_AUDIT_DISABLED=true`.
539
+ `LOKI_AUDIT_LEVEL` and `LOKI_AUDIT_EXCLUDE_EVENTS` appeared in an earlier
540
+ version of this page and were never implemented.
541
+
534
542
  ### Disk Space Issues
535
543
 
536
544
  ```bash
@@ -543,8 +551,9 @@ find ~/.loki/dashboard/audit/ -type f -size +100M
543
551
  # Manually clean old logs
544
552
  find ~/.loki/dashboard/audit/ -name "*.jsonl" -mtime +30 -delete
545
553
 
546
- # Enable compression
547
- export LOKI_AUDIT_COMPRESS=true
554
+ # Bound disk use via rotation (there is no built-in compression option)
555
+ export LOKI_AUDIT_MAX_SIZE_MB=5
556
+ export LOKI_AUDIT_MAX_FILES=4
548
557
  ```
549
558
 
550
559
  ### Syslog Not Forwarding
@@ -154,7 +154,18 @@ export LOKI_OIDC_CLIENT_ID=your-client-id
154
154
  | `LOKI_OIDC_ISSUER` | - | OIDC issuer URL (required) |
155
155
  | `LOKI_OIDC_CLIENT_ID` | - | OIDC client/application ID (required) |
156
156
  | `LOKI_OIDC_AUDIENCE` | *(client_id)* | Expected JWT audience claim |
157
- | `LOKI_OIDC_SCOPES` | `openid,email,profile` | OIDC scopes to request |
157
+ | `LOKI_OIDC_ROLES_CLAIM` | - | Claim to read roles from; supports a dotted path |
158
+ | `LOKI_OIDC_DEFAULT_ROLE` | `viewer` | Role applied when no recognized role claim is present |
159
+ | `LOKI_OIDC_SKIP_SIGNATURE_VERIFY` | `false` | Allow the claims-only path without PyJWT. **Insecure**; see the warning below. |
160
+
161
+ Scopes are requested by your identity provider configuration, not by Loki:
162
+ there is no `LOKI_OIDC_SCOPES` variable (an earlier version of this page listed
163
+ one). All of the above are read in `dashboard/auth.py`.
164
+
165
+ **Install PyJWT and cryptography for any production deployment.** Without them
166
+ JWT signatures are not cryptographically verified, and the claims-only path is
167
+ refused unless you explicitly set `LOKI_OIDC_SKIP_SIGNATURE_VERIFY=true`.
168
+ Running with signature verification off provides no authentication security.
158
169
 
159
170
  ### OIDC Flow
160
171
 
@@ -256,7 +267,7 @@ GET /auth/logout
256
267
  ### General
257
268
 
258
269
  1. Enable `LOKI_ENTERPRISE_AUTH` in production
259
- 2. Enable `LOKI_TLS_ENABLED` for encrypted connections
270
+ 2. Set both `LOKI_TLS_CERT` and `LOKI_TLS_KEY` for encrypted connections (HTTPS turns on when both are present; there is no `LOKI_TLS_ENABLED` switch)
260
271
  3. Use audit logging to track authentication events
261
272
  4. Monitor failed authentication attempts
262
273
  5. Implement rate limiting on auth endpoints
@@ -100,19 +100,27 @@ Security and compliance monitoring.
100
100
 
101
101
  ## Configuration
102
102
 
103
- ### Enable RBAC
103
+ ### Enable enterprise auth
104
+
105
+ There is no separate `LOKI_RBAC_ENABLED` switch. Role mapping is part of the
106
+ enterprise auth path, enabled by `LOKI_ENTERPRISE_AUTH` for token auth and by
107
+ `LOKI_OIDC_ISSUER` + `LOKI_OIDC_CLIENT_ID` for OIDC/SSO (`dashboard/auth.py`).
104
108
 
105
109
  ```bash
106
- export LOKI_RBAC_ENABLED=true
110
+ export LOKI_ENTERPRISE_AUTH=true
107
111
  loki start ./prd.md
108
112
  ```
109
113
 
110
- ### Assign Roles via Tokens
114
+ ### Assign scopes via tokens
115
+
116
+ `loki enterprise token generate` takes `--scopes` (a comma-separated scope
117
+ list), not a `--role` flag. Roles as such are resolved from OIDC claims; tokens
118
+ carry scopes directly.
111
119
 
112
120
  ```bash
113
- # Generate token with role
114
- loki enterprise token generate dev-1 --role operator --expires 30
115
- loki enterprise token generate viewer-1 --role viewer --expires 90
121
+ # Generate token with scopes
122
+ loki enterprise token generate dev-1 --scopes control,read,write --expires 30
123
+ loki enterprise token generate viewer-1 --scopes read --expires 90
116
124
  loki enterprise token generate auditor-1 --role auditor --expires 180
117
125
  loki enterprise token generate admin-1 --role admin --expires 365
118
126
  ```
@@ -228,81 +236,75 @@ loki enterprise token generate metrics-bot --role metrics_viewer
228
236
 
229
237
  ### CLI
230
238
 
231
- ```bash
232
- # Check current permissions
233
- loki enterprise rbac check
234
-
235
- # Check specific permission
236
- loki enterprise rbac check --scope control
239
+ There is no `loki enterprise rbac` subcommand. `loki enterprise` has exactly
240
+ `status`, `token`, and `audit`. To see what a token can do, list the tokens and
241
+ read their scopes:
237
242
 
238
- # List permissions for role
239
- loki enterprise rbac permissions --role operator
243
+ ```bash
244
+ loki enterprise token list
245
+ loki enterprise status
240
246
  ```
241
247
 
242
248
  ### API
243
249
 
250
+ There is no `/api/enterprise/rbac/check` endpoint; an earlier version of this
251
+ page documented one along with a `permissions` response object, and neither
252
+ exists. Scopes are enforced per-route: each `/api/*` route declares the scope it
253
+ requires via `Depends(auth.require_scope(...))` in `dashboard/server.py`. A
254
+ request either succeeds or is rejected, so exercise the route you care about:
255
+
244
256
  ```bash
245
- # Check token permissions
246
- curl -H "Authorization: Bearer $LOKI_TOKEN" \
247
- http://localhost:57374/api/enterprise/rbac/check
248
-
249
- # Response:
250
- {
251
- "role": "operator",
252
- "scopes": ["control", "read", "write"],
253
- "permissions": {
254
- "can_start_session": true,
255
- "can_stop_session": true,
256
- "can_create_tasks": true,
257
- "can_modify_config": false,
258
- "can_manage_tokens": false
259
- }
260
- }
257
+ # Succeeds only if the token carries the route's required scope
258
+ curl -i -H "Authorization: Bearer $LOKI_TOKEN" \
259
+ http://localhost:57374/api/status
261
260
  ```
262
261
 
262
+ Scope implication is resolved by `has_scope()` in `dashboard/auth.py:394`.
263
+
263
264
  ## Agent Action Authorization
264
265
 
265
- Control which roles can trigger agent actions:
266
-
267
- ```yaml
268
- enterprise:
269
- rbac:
270
- agent_actions:
271
- git_commit:
272
- required_scope: control
273
- cli_invoke:
274
- required_scope: control
275
- file_write:
276
- required_scope: write
277
- file_read:
278
- required_scope: read
279
- ```
266
+ **Not implemented.** An earlier version of this page showed an
267
+ `enterprise.rbac.agent_actions` block mapping individual agent actions
268
+ (`git_commit`, `cli_invoke`, `file_write`, `file_read`) to required scopes. No
269
+ such configuration is read by any code. Scope enforcement happens at the
270
+ dashboard API boundary only, per route, not per agent action.
280
271
 
281
272
  ## Environment Variables
282
273
 
274
+ These are the variables actually read by `dashboard/auth.py`. There is no
275
+ `LOKI_RBAC_ENABLED`, `LOKI_RBAC_STRICT_MODE`, or `LOKI_RBAC_AUDIT_CHECKS`; an
276
+ earlier version of this page listed all three and they were never implemented.
277
+
283
278
  | Variable | Default | Description |
284
279
  |----------|---------|-------------|
285
- | `LOKI_RBAC_ENABLED` | `false` | Enable RBAC system |
286
- | `LOKI_RBAC_DEFAULT_ROLE` | `viewer` | Default role for OIDC users |
287
- | `LOKI_RBAC_STRICT_MODE` | `false` | Deny access when role is undefined (vs default to viewer) |
288
- | `LOKI_RBAC_AUDIT_CHECKS` | `true` | Log all permission checks to audit log |
280
+ | `LOKI_ENTERPRISE_AUTH` | `false` | Enable token authentication |
281
+ | `LOKI_OIDC_ISSUER` | (empty) | OIDC issuer URL; set with `LOKI_OIDC_CLIENT_ID` to enable OIDC/SSO |
282
+ | `LOKI_OIDC_CLIENT_ID` | (empty) | OIDC client id |
283
+ | `LOKI_OIDC_AUDIENCE` | (empty) | Expected audience; usually the same as the client id |
284
+ | `LOKI_OIDC_ROLES_CLAIM` | (empty) | Claim to read roles from; supports a dotted path |
285
+ | `LOKI_OIDC_DEFAULT_ROLE` | `viewer` | Role applied when no recognized role claim is present |
286
+
287
+ `_scopes_from_claims()` never returns `["*"]`/admin by default: full access
288
+ requires an explicit admin role claim. When no recognized role claim is present,
289
+ the least-privileged default role applies.
289
290
 
290
291
  ## Examples
291
292
 
292
293
  ### Multi-Environment Setup
293
294
 
294
295
  ```bash
295
- # Production - strict RBAC
296
- export LOKI_RBAC_ENABLED=true
297
- export LOKI_RBAC_STRICT_MODE=true
298
- export LOKI_RBAC_DEFAULT_ROLE=viewer
299
-
300
- # Development - relaxed RBAC
301
- export LOKI_RBAC_ENABLED=false
302
-
303
- # Staging - moderate RBAC
304
- export LOKI_RBAC_ENABLED=true
305
- export LOKI_RBAC_DEFAULT_ROLE=operator
296
+ # Production - OIDC with a least-privilege default
297
+ export LOKI_ENTERPRISE_AUTH=true
298
+ export LOKI_OIDC_ISSUER=https://accounts.example.com
299
+ export LOKI_OIDC_CLIENT_ID=loki-prod
300
+ export LOKI_OIDC_DEFAULT_ROLE=viewer
301
+
302
+ # Development - auth off
303
+ export LOKI_ENTERPRISE_AUTH=false
304
+
305
+ # Staging - OIDC with a more permissive default
306
+ export LOKI_ENTERPRISE_AUTH=true
307
+ export LOKI_OIDC_DEFAULT_ROLE=operator
306
308
  ```
307
309
 
308
310
  ### Team-Based Access
@@ -362,7 +364,8 @@ loki enterprise token generate security-scanner \
362
364
 
363
365
  ### Auditing
364
366
 
365
- 1. Enable `LOKI_RBAC_AUDIT_CHECKS` to log permission checks
367
+ 1. Review audit logs for authentication and authorization events (audit logging
368
+ is on by default; there is no separate per-permission-check toggle)
366
369
  2. Review audit logs for unauthorized access attempts
367
370
  3. Monitor for privilege escalation attempts
368
371
  4. Alert on admin role usage in production
@@ -376,8 +379,8 @@ loki enterprise token generate security-scanner \
376
379
  # Check token role and scopes
377
380
  loki enterprise token list
378
381
 
379
- # Verify required scope for operation
380
- loki enterprise rbac permissions --role <your-role>
382
+ # Read the route's required scope from dashboard/server.py, then compare
383
+ # against the scopes on your token from the listing above
381
384
 
382
385
  # Check audit log for denial reason
383
386
  loki enterprise audit tail --event permission.denied
@@ -406,10 +409,10 @@ loki enterprise audit tail --event auth.oidc.success
406
409
  ### Scope Confusion
407
410
 
408
411
  ```bash
409
- # List all scopes for a role
410
- loki enterprise rbac permissions --role operator
412
+ # List the scopes actually attached to each token
413
+ loki enterprise token list
411
414
 
412
- # Check if scope is implied by hierarchy
415
+ # Check if scope is implied by hierarchy (see has_scope, dashboard/auth.py:394)
413
416
  # control -> write -> read
414
417
  # audit (separate, not included in control)
415
418
 
@@ -420,32 +423,35 @@ curl -H "Authorization: Bearer $TOKEN" \
420
423
 
421
424
  ## Migration Guide
422
425
 
423
- ### Upgrading from Token-Only to RBAC
426
+ ### Upgrading from Token-Only to role-mapped OIDC
424
427
 
425
- 1. Enable RBAC in audit mode first:
426
- ```bash
427
- export LOKI_RBAC_ENABLED=true
428
- export LOKI_RBAC_STRICT_MODE=false # Allow during migration
429
- ```
428
+ There is no separate "RBAC mode" to switch on, and no in-place token editing.
429
+ `loki enterprise` has exactly three subcommands: `status`, `token`, and
430
+ `audit`. An earlier version of this page described `loki enterprise rbac check`
431
+ and `loki enterprise token update --role`; neither exists.
430
432
 
431
- 2. Assign roles to existing tokens:
433
+ 1. Turn on enterprise auth and point Loki at your identity provider:
432
434
  ```bash
433
- for token in $(loki enterprise token list --format json | jq -r '.[].id'); do
434
- loki enterprise token update $token --role operator
435
- done
435
+ export LOKI_ENTERPRISE_AUTH=true
436
+ export LOKI_OIDC_ISSUER=https://accounts.example.com
437
+ export LOKI_OIDC_CLIENT_ID=your-client-id
438
+ export LOKI_OIDC_DEFAULT_ROLE=viewer
436
439
  ```
437
440
 
438
- 3. Test permissions:
441
+ 2. Re-issue tokens with the scopes each holder should have. Tokens carry scopes
442
+ directly and are not editable after creation, so revoke and regenerate:
439
443
  ```bash
440
- loki enterprise rbac check
444
+ loki enterprise token list
445
+ loki enterprise token generate dev-1 --scopes control,read,write --expires 30
441
446
  ```
442
447
 
443
- 4. Enable strict mode:
448
+ 3. Confirm the configuration is active:
444
449
  ```bash
445
- export LOKI_RBAC_STRICT_MODE=true
450
+ loki enterprise status
446
451
  ```
447
452
 
448
- 5. Monitor audit logs for denials and adjust roles as needed.
453
+ 4. Monitor audit logs for denials and adjust the role claim mapping
454
+ (`LOKI_OIDC_ROLES_CLAIM`) as needed.
449
455
 
450
456
  ## See Also
451
457
 
@@ -169,7 +169,7 @@ Estimated cost: $X.XX USD
169
169
  - End: YYYY-MM-DD HH:MM:SS
170
170
  - Duration: X hours
171
171
  - Iterations: X
172
- - Provider: claude/codex/gemini
172
+ - Provider: claude/cline/codex/aider/opencode
173
173
  ```
174
174
 
175
175
  Set template path:
@@ -200,8 +200,11 @@ All Git operations performed by agents are logged to `.loki/logs/agent-audit.jso
200
200
  View audit log:
201
201
 
202
202
  ```bash
203
- loki audit log
204
- loki audit log --action git_commit
203
+ loki audit log # most recent entries (optional positional line count)
204
+ loki audit log 200
205
+
206
+ # loki audit log takes a line count, not filter flags. Filter with grep:
207
+ loki audit log 500 | grep git_commit
205
208
  ```
206
209
 
207
210
  ## Git Hooks
package/docs/metrics.md CHANGED
@@ -15,12 +15,12 @@ Loki Mode exposes a `/metrics` endpoint that returns production-ready metrics in
15
15
 
16
16
  ## Quick Start
17
17
 
18
- ```bash
19
- # Enable metrics endpoint
20
- export LOKI_METRICS_ENABLED=true
18
+ The `/metrics` endpoint is served by the dashboard and needs no enabling flag.
19
+ Start the dashboard and scrape it.
21
20
 
22
- # Start Loki Mode
23
- loki start ./prd.md
21
+ ```bash
22
+ # Start the dashboard (serves /metrics)
23
+ loki dashboard start
24
24
 
25
25
  # View metrics
26
26
  curl http://localhost:57374/metrics
@@ -362,22 +362,21 @@ Configure alerts in Grafana panels:
362
362
 
363
363
  ## Environment Variables
364
364
 
365
- | Variable | Default | Description |
366
- |----------|---------|-------------|
367
- | `LOKI_METRICS_ENABLED` | `false` | Enable `/metrics` endpoint |
368
- | `LOKI_METRICS_PORT` | `57374` | Port for metrics endpoint (same as dashboard) |
369
- | `LOKI_METRICS_PATH` | `/metrics` | Endpoint path |
365
+ There are none. `/metrics` is an unconditional route on the dashboard app
366
+ (`dashboard/server.py:9637`), served at the dashboard's own port and path. An
367
+ earlier version of this page listed `LOKI_METRICS_ENABLED`,
368
+ `LOKI_METRICS_PORT`, and `LOKI_METRICS_PATH`; none of the three is read by any
369
+ code, so the endpoint cannot be turned off, moved, or re-pathed by environment.
370
+
371
+ To change the port, change the dashboard port. To restrict access, put the
372
+ dashboard behind a reverse proxy: unlike the `/api/*` routes, `/metrics` has no
373
+ auth scope dependency, so anything that can reach the port can read it.
370
374
 
371
375
  ## Best Practices
372
376
 
373
377
  ### Production Deployment
374
378
 
375
- 1. Enable metrics in production:
376
- ```bash
377
- export LOKI_METRICS_ENABLED=true
378
- ```
379
-
380
- 2. Secure endpoint with reverse proxy authentication
379
+ 1. Secure endpoint with reverse proxy authentication
381
380
  3. Set up Prometheus scraping with appropriate interval (15-30s)
382
381
  4. Create Grafana dashboards for visualization
383
382
  5. Configure alerts for budget, stagnation, and failures
@@ -8,15 +8,17 @@ This guide covers network-level security controls for restricting outbound netwo
8
8
 
9
9
  ## Environment Variables
10
10
 
11
- The following environment variables control network egress policy enforcement:
12
-
13
- | Variable | Default | Description |
14
- |----------|---------|-------------|
15
- | `LOKI_NETWORK_EGRESS_POLICY` | `unrestricted` | `unrestricted` (default), `ai-only` (restrict to AI APIs), `none` (block all outbound) |
16
- | `LOKI_ALLOWED_HOSTS` | (empty) | Comma-separated list of additional hostnames to allow when egress policy is `ai-only` |
17
- | `LOKI_BLOCK_METADATA_ENDPOINT` | `false` | Block cloud metadata endpoint (169.254.169.254) from within the application |
18
-
19
- Note: These variables are reserved for future application-level enforcement. Currently, network security is implemented at the infrastructure level using Docker networks or Kubernetes NetworkPolicy.
11
+ **None of the variables below are implemented. Do not rely on them.** They are
12
+ reserved names for a planned application-level enforcement layer, and no
13
+ runtime code reads any of them today. Network security is enforced entirely at
14
+ the infrastructure level, using the Docker network and Kubernetes NetworkPolicy
15
+ recipes in the rest of this guide.
16
+
17
+ | Variable | Default | Description | Status |
18
+ |----------|---------|-------------|--------|
19
+ | `LOKI_NETWORK_EGRESS_POLICY` | `unrestricted` | `unrestricted` (default), `ai-only` (restrict to AI APIs), `none` (block all outbound) | Planned, target TBD |
20
+ | `LOKI_ALLOWED_HOSTS` | (empty) | Comma-separated list of additional hostnames to allow when egress policy is `ai-only` | Planned, target TBD |
21
+ | `LOKI_BLOCK_METADATA_ENDPOINT` | `false` | Block cloud metadata endpoint (169.254.169.254) from within the application | Planned, target TBD |
20
22
 
21
23
  ## Docker Network Isolation
22
24
 
@@ -56,8 +58,10 @@ iptables -A DOCKER-USER -p tcp --dport 53 -j ACCEPT
56
58
  iptables -A DOCKER-USER -d api.anthropic.com -p tcp --dport 443 -j ACCEPT
57
59
  # OpenAI (Codex)
58
60
  iptables -A DOCKER-USER -d api.openai.com -p tcp --dport 443 -j ACCEPT
59
- # Google (Gemini)
60
- iptables -A DOCKER-USER -d generativelanguage.googleapis.com -p tcp --dport 443 -j ACCEPT
61
+ # Add one rule per endpoint your chosen provider actually calls. Cline, Aider,
62
+ # and opencode are model-agnostic, so their endpoints depend on your config.
63
+ # The Gemini rule that used to sit here was removed with the provider (v7.5.18);
64
+ # do not re-add an allowlist entry for a provider you are not running.
61
65
 
62
66
  # Drop all other outbound traffic from the isolated network
63
67
  iptables -A DOCKER-USER -s 172.28.0.0/16 -j DROP
@@ -185,8 +189,7 @@ spec:
185
189
  Enable encrypted dashboard connections:
186
190
 
187
191
  ```bash
188
- # Using environment variables
189
- export LOKI_TLS_ENABLED=true
192
+ # HTTPS turns on when BOTH are set. There is no LOKI_TLS_ENABLED switch.
190
193
  export LOKI_TLS_CERT=/path/to/cert.pem
191
194
  export LOKI_TLS_KEY=/path/to/key.pem
192
195