loki-mode 5.51.0 → 5.52.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 (40) hide show
  1. package/README.md +2 -2
  2. package/SKILL.md +2 -2
  3. package/VERSION +1 -1
  4. package/dashboard/__init__.py +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/docs/alternative-installations.md +3 -3
  7. package/docs/certification/01-core-concepts/lab.md +174 -0
  8. package/docs/certification/01-core-concepts/lesson.md +182 -0
  9. package/docs/certification/01-core-concepts/quiz.md +93 -0
  10. package/docs/certification/02-enterprise-features/lab.md +154 -0
  11. package/docs/certification/02-enterprise-features/lesson.md +202 -0
  12. package/docs/certification/02-enterprise-features/quiz.md +93 -0
  13. package/docs/certification/03-advanced-patterns/lab.md +138 -0
  14. package/docs/certification/03-advanced-patterns/lesson.md +199 -0
  15. package/docs/certification/03-advanced-patterns/quiz.md +93 -0
  16. package/docs/certification/04-production-deployment/lab.md +160 -0
  17. package/docs/certification/04-production-deployment/lesson.md +261 -0
  18. package/docs/certification/04-production-deployment/quiz.md +93 -0
  19. package/docs/certification/05-troubleshooting/lab.md +254 -0
  20. package/docs/certification/05-troubleshooting/lesson.md +266 -0
  21. package/docs/certification/05-troubleshooting/quiz.md +93 -0
  22. package/docs/certification/README.md +80 -0
  23. package/docs/certification/answer-key.md +117 -0
  24. package/docs/certification/certification-exam.md +471 -0
  25. package/docs/certification/sample-prds/microservices-platform.md +100 -0
  26. package/docs/certification/sample-prds/saas-dashboard.md +60 -0
  27. package/docs/certification/sample-prds/todo-app.md +44 -0
  28. package/mcp/__init__.py +1 -1
  29. package/package.json +1 -1
  30. package/src/plugins/agent-plugin.js +123 -0
  31. package/src/plugins/gate-plugin.js +153 -0
  32. package/src/plugins/index.js +116 -0
  33. package/src/plugins/integration-plugin.js +174 -0
  34. package/src/plugins/loader.js +275 -0
  35. package/src/plugins/mcp-plugin.js +190 -0
  36. package/src/plugins/schemas/agent.json +59 -0
  37. package/src/plugins/schemas/integration.json +62 -0
  38. package/src/plugins/schemas/mcp_tool.json +73 -0
  39. package/src/plugins/schemas/quality_gate.json +52 -0
  40. package/src/plugins/validator.js +297 -0
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![Agent Types](https://img.shields.io/badge/Agent%20Types-41-blue)]()
12
12
  [![Benchmarks](https://img.shields.io/badge/Benchmarks-Infrastructure%20Ready-blue)](benchmarks/)
13
13
 
14
- **Current Version: v5.51.0**
14
+ **Current Version: v5.52.0**
15
15
 
16
16
  **[Autonomi](https://www.autonomi.dev/)** | **[Documentation](https://www.autonomi.dev/docs)** | **[GitHub](https://github.com/asklokesh/loki-mode)**
17
17
 
@@ -85,7 +85,7 @@ gemini
85
85
  ### Verify Installation
86
86
 
87
87
  ```bash
88
- loki --version # Should print 5.51.0
88
+ loki --version # Should print 5.52.0
89
89
  loki doctor # Check skill symlinks and provider availability
90
90
  ```
91
91
 
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v5.51.0
6
+ # Loki Mode v5.52.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -263,4 +263,4 @@ The following features are documented in skill modules but not yet fully automat
263
263
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
264
264
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
265
265
 
266
- **v5.51.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
266
+ **v5.52.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.51.0
1
+ 5.52.0
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "5.51.0"
10
+ __version__ = "5.52.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v5.51.0
5
+ **Version:** v5.52.0
6
6
 
7
7
  ---
8
8
 
@@ -28,7 +28,7 @@ ln -sf ~/.claude/skills/loki-mode/autonomy/loki /usr/local/bin/loki
28
28
 
29
29
  ## Docker
30
30
 
31
- **Status:** Image exists on Docker Hub. Tags: `latest`, version-specific (e.g., `5.51.0`).
31
+ **Status:** Image exists on Docker Hub. Tags: `latest`, version-specific (e.g., `5.52.0`).
32
32
 
33
33
  ```bash
34
34
  docker pull asklokesh/loki-mode:latest
@@ -108,8 +108,8 @@ jobs:
108
108
 
109
109
  ```bash
110
110
  # Download and extract to skills directory
111
- curl -sL https://github.com/asklokesh/loki-mode/archive/refs/tags/v5.51.0.tar.gz | tar xz
112
- mv loki-mode-5.51.0 ~/.claude/skills/loki-mode
111
+ curl -sL https://github.com/asklokesh/loki-mode/archive/refs/tags/v5.52.0.tar.gz | tar xz
112
+ mv loki-mode-5.52.0 ~/.claude/skills/loki-mode
113
113
  ```
114
114
 
115
115
  **Best for:** Offline or air-gapped environments, pinned version deployments.
@@ -0,0 +1,174 @@
1
+ # Module 1 Lab: Install and Run Loki Mode
2
+
3
+ ## Objective
4
+
5
+ Install Loki Mode, verify the installation, create a simple PRD, run it, and examine the output directory structure.
6
+
7
+ ## Prerequisites
8
+
9
+ - Node.js 18+ installed
10
+ - npm available on your PATH
11
+ - A supported AI provider CLI installed (Claude Code, Codex CLI, or Gemini CLI)
12
+ - An active API key for your chosen provider
13
+
14
+ ## Step 1: Install Loki Mode
15
+
16
+ ```bash
17
+ npm install -g loki-mode
18
+ ```
19
+
20
+ Verify the installation:
21
+
22
+ ```bash
23
+ loki version
24
+ ```
25
+
26
+ You should see output like `5.51.0` (or the current version).
27
+
28
+ ## Step 2: Run the Doctor Check
29
+
30
+ The `loki doctor` command checks all system prerequisites:
31
+
32
+ ```bash
33
+ loki doctor
34
+ ```
35
+
36
+ This verifies:
37
+ - Node.js version
38
+ - Required CLI tools (git, jq, etc.)
39
+ - AI provider CLI availability
40
+ - Skill symlink configuration
41
+
42
+ Review the output and install any missing dependencies it reports.
43
+
44
+ For machine-readable output:
45
+
46
+ ```bash
47
+ loki doctor --json
48
+ ```
49
+
50
+ ## Step 3: Create a Simple PRD
51
+
52
+ Create a file called `simple-prd.md` with the following content:
53
+
54
+ ```markdown
55
+ # Simple Todo App
56
+
57
+ ## Overview
58
+ A command-line todo application written in Node.js.
59
+
60
+ ## Requirements
61
+ - Add a todo item with a title
62
+ - List all todo items
63
+ - Mark a todo item as complete
64
+ - Delete a todo item
65
+ - Store todos in a local JSON file
66
+
67
+ ## Tech Stack
68
+ - Node.js
69
+ - No external dependencies (use built-in fs module)
70
+
71
+ ## Success Criteria
72
+ - All CRUD operations work from the command line
73
+ - Data persists between runs via JSON file
74
+ - Unit tests pass with >80% coverage
75
+ ```
76
+
77
+ ## Step 4: Start Loki Mode
78
+
79
+ **Important:** Running `loki start` will invoke an AI provider and may incur API costs. Ensure you have a valid API key configured for your provider.
80
+
81
+ ```bash
82
+ loki start ./simple-prd.md
83
+ ```
84
+
85
+ Alternatively, if using a specific provider:
86
+
87
+ ```bash
88
+ loki start --provider claude ./simple-prd.md # Claude Code (default)
89
+ loki start --provider codex ./simple-prd.md # OpenAI Codex CLI
90
+ loki start --provider gemini ./simple-prd.md # Google Gemini CLI
91
+ ```
92
+
93
+ You can also force the simple complexity tier to limit the number of phases:
94
+
95
+ ```bash
96
+ loki start --simple ./simple-prd.md
97
+ ```
98
+
99
+ ## Step 5: Examine the Output
100
+
101
+ After Loki Mode starts (or after you pause it with `loki pause`), examine the `.loki/` directory:
102
+
103
+ ```bash
104
+ ls -la .loki/
105
+ ```
106
+
107
+ You should see a structure similar to:
108
+
109
+ ```
110
+ .loki/
111
+ session.json # Session metadata (pid, start time, provider, status)
112
+ state/
113
+ orchestrator.json # Current phase, task counts
114
+ queue/
115
+ pending.json # Tasks waiting to be executed
116
+ current-task.json # Task currently in progress
117
+ dead-letter.json # Failed tasks (if any)
118
+ memory/
119
+ index.json # Memory index
120
+ episodic/ # Task execution traces
121
+ semantic/ # Learned patterns
122
+ signals/ # Inter-process communication files
123
+ logs/ # Execution logs
124
+ ```
125
+
126
+ Inspect the orchestrator state:
127
+
128
+ ```bash
129
+ cat .loki/state/orchestrator.json | jq .
130
+ ```
131
+
132
+ Check the current session:
133
+
134
+ ```bash
135
+ loki status
136
+ ```
137
+
138
+ ## Step 6: Control Execution
139
+
140
+ Practice the control commands:
141
+
142
+ ```bash
143
+ # Pause after current iteration
144
+ loki pause
145
+
146
+ # Check status while paused
147
+ loki status
148
+
149
+ # Resume execution
150
+ loki resume
151
+
152
+ # Stop immediately
153
+ loki stop
154
+ ```
155
+
156
+ ## Verification Checklist
157
+
158
+ After completing this lab, confirm you can answer these questions:
159
+
160
+ - [ ] What version of Loki Mode is installed? (`loki version`)
161
+ - [ ] Does `loki doctor` report all checks passing?
162
+ - [ ] What files are created in the `.loki/` directory?
163
+ - [ ] What phase does the orchestrator start in?
164
+ - [ ] Can you pause and resume a Loki Mode session?
165
+
166
+ ## Cleanup
167
+
168
+ To clean up the lab environment:
169
+
170
+ ```bash
171
+ loki stop
172
+ rm -rf .loki/
173
+ rm simple-prd.md
174
+ ```
@@ -0,0 +1,182 @@
1
+ # Module 1: Core Concepts
2
+
3
+ ## What is Loki Mode?
4
+
5
+ Loki Mode is a multi-agent autonomous system created by [Autonomi](https://www.autonomi.dev/). It takes a Product Requirements Document (PRD) and builds a fully deployed product with minimal human intervention. It supports three AI provider CLIs: Claude Code (full features), OpenAI Codex CLI (degraded mode), and Google Gemini CLI (degraded mode).
6
+
7
+ Loki Mode is installed as an npm package and invoked through the `loki` CLI or directly within Claude Code as a skill.
8
+
9
+ ```bash
10
+ # Install
11
+ npm install -g loki-mode
12
+
13
+ # Verify installation
14
+ loki version
15
+
16
+ # Check system prerequisites
17
+ loki doctor
18
+
19
+ # Start with a PRD
20
+ loki start ./prd.md
21
+ ```
22
+
23
+ When started, Loki Mode creates a `.loki/` directory in your project root that holds all state: task queues, session data, memory, metrics, and signals.
24
+
25
+ ## The RARV Cycle
26
+
27
+ Every action in Loki Mode follows a strict four-step cycle called RARV:
28
+
29
+ 1. **Reason** -- Determine the highest priority unblocked task from `.loki/queue/pending.json`
30
+ 2. **Act** -- Execute the task: write code, run commands, commit atomically
31
+ 3. **Reflect** -- Evaluate the outcome, log results
32
+ 4. **Verify** -- Run tests, check build, validate against the specification
33
+
34
+ If verification passes, the task is marked complete and the cycle returns to Reason. If verification fails, the error is captured and the agent retries with a different approach. After 3 failures, it tries a simpler approach. After 5 failures, the task is moved to a dead-letter queue (`.loki/queue/dead-letter.json`) and the agent moves on.
35
+
36
+ ```
37
+ REASON --> ACT --> REFLECT --> VERIFY
38
+ ^ |
39
+ | [PASS] |
40
+ +-----------------------------+
41
+ | [FAIL]
42
+ +--- Retry (up to 5x) --> Dead Letter Queue
43
+ ```
44
+
45
+ ## Phase Transitions
46
+
47
+ Loki Mode organizes work into sequential phases. Each phase must pass all quality gates before the next begins:
48
+
49
+ ```
50
+ BOOTSTRAP --> DISCOVERY --> ARCHITECTURE --> DEEPEN_PLAN --> INFRASTRUCTURE
51
+ --> DEVELOPMENT --> QA --> DEPLOYMENT --> GROWTH
52
+ ```
53
+
54
+ Not all phases run for every project. Complexity tiers determine which phases execute:
55
+
56
+ | Tier | Phases | When Used |
57
+ |------|--------|-----------|
58
+ | **simple** | 3 | 1-2 files, UI fixes, text changes |
59
+ | **standard** | 6 | 3-10 files, features, bug fixes |
60
+ | **complex** | 8 | 10+ files, microservices, external integrations |
61
+
62
+ The tier is auto-detected from the PRD or can be forced with:
63
+
64
+ ```bash
65
+ loki start --simple ./prd.md # Force simple tier
66
+ loki start --complex ./prd.md # Force complex tier
67
+ ```
68
+
69
+ Or via the environment variable `LOKI_COMPLEXITY=simple|standard|complex`.
70
+
71
+ ## Agents
72
+
73
+ Loki Mode defines **41 specialized agent types** organized into **8 swarms**:
74
+
75
+ | Swarm | Agent Count | Examples |
76
+ |-------|-------------|----------|
77
+ | Engineering | 8 | frontend, backend, database, mobile, api, qa, perf, infra |
78
+ | Operations | 8 | devops, sre, security, monitor, incident, release, cost, compliance |
79
+ | Business | 8 | marketing, sales, finance, legal, support, hr, investor, partnerships |
80
+ | Data | 3 | ml, eng, analytics |
81
+ | Product | 3 | pm, design, techwriter |
82
+ | Growth | 4 | hacker, community, success, lifecycle |
83
+ | Review | 3 | code, business, security |
84
+ | Orchestration | 4 | (internal system agents) |
85
+
86
+ These agents are **roles defined through prompts**, not separate programs. They are implemented using the Claude Code Task tool with role-specific prompts:
87
+
88
+ ```python
89
+ # Example: Creating a security reviewer agent
90
+ Task(
91
+ subagent_type="general-purpose",
92
+ model="opus",
93
+ description="Security review: auth module",
94
+ prompt="""You are a security reviewer. Focus on:
95
+ - Authentication vulnerabilities
96
+ - Input validation gaps
97
+ - OWASP Top 10 issues
98
+ Review: src/auth/*.ts"""
99
+ )
100
+ ```
101
+
102
+ A simple project typically uses 5-10 agents. Complex projects use more as needed. The orchestrator spawns only the agents required for the current task.
103
+
104
+ Full agent type definitions are in `references/agent-types.md`.
105
+
106
+ ## Quality Gates
107
+
108
+ Loki Mode enforces a 9-gate quality system. Code must pass all applicable gates before moving forward:
109
+
110
+ | Gate | Name | Purpose |
111
+ |------|------|---------|
112
+ | 1 | Input Guardrails | Validate scope, detect injection, check constraints |
113
+ | 2 | Static Analysis | CodeQL, ESLint/Pylint, type checking |
114
+ | 3 | Blind Review System | 3 specialist reviewers in parallel, blind to each other |
115
+ | 4 | Anti-Sycophancy Check | If reviewers unanimously approve, run a Devil's Advocate reviewer |
116
+ | 5 | Output Guardrails | Validate code quality, spec compliance, no secrets |
117
+ | 6 | Severity-Based Blocking | Critical/High/Medium = BLOCK; Low/Cosmetic = TODO |
118
+ | 7 | Test Coverage Gates | Unit: 100% pass, >80% coverage; Integration: 100% pass |
119
+ | 8 | Mock Detector | Flags tests that mock internal modules instead of real code |
120
+ | 9 | Test Mutation Detector | Detects assertion value changes alongside implementation changes |
121
+
122
+ The blind review system (Gate 3) selects 3 reviewers from a pool of 5 named specialists:
123
+
124
+ - **security-sentinel** -- OWASP Top 10, injection, auth, secrets
125
+ - **performance-oracle** -- N+1 queries, memory leaks, caching
126
+ - **architecture-strategist** -- SOLID, coupling, patterns (always included)
127
+ - **test-coverage-auditor** -- Missing tests, edge cases, error paths
128
+ - **dependency-analyst** -- Outdated packages, CVEs, license issues
129
+
130
+ The architecture-strategist is always one of the 3. The other 2 are selected by matching trigger keywords in the diff. Full details are in `skills/quality-gates.md`.
131
+
132
+ ## Memory System
133
+
134
+ Loki Mode maintains three types of memory in the `.loki/memory/` directory:
135
+
136
+ - **Episodic** (`.loki/memory/episodic/`) -- Specific interaction traces. Records what happened during each task, including errors and decisions.
137
+ - **Semantic** (`.loki/memory/semantic/`) -- Generalized patterns and anti-patterns extracted from episodic memory. Includes `patterns.json` (what works) and `anti-patterns.json` (what to avoid).
138
+ - **Procedural** (`.loki/memory/skills/`) -- Learned skills and reusable solutions.
139
+
140
+ The memory system uses progressive disclosure with three layers: index (lightweight), timeline (moderate), and full details (heavy). This prevents loading the entire memory store into the context window.
141
+
142
+ Memory retrieval is task-aware, weighting different memory types based on the current activity:
143
+
144
+ | Task Type | Episodic Weight | Semantic Weight | Skills Weight |
145
+ |-----------|----------------|-----------------|---------------|
146
+ | Exploration | 0.6 | 0.3 | 0.1 |
147
+ | Implementation | 0.15 | 0.5 | 0.35 |
148
+ | Debugging | 0.4 | 0.2 | 0.0 (+ 0.4 anti-patterns) |
149
+
150
+ The memory engine is implemented in Python (`memory/engine.py`, `memory/retrieval.py`, `memory/storage.py`).
151
+
152
+ ## Model Selection
153
+
154
+ Loki Mode maps tasks to model tiers rather than specific model names:
155
+
156
+ | Task Type | Tier | Claude | Codex | Gemini |
157
+ |-----------|------|--------|-------|--------|
158
+ | Architecture, system design | planning | opus | effort=xhigh | thinking=high |
159
+ | Feature implementation, bugs | development | opus | effort=high | thinking=medium |
160
+ | Code review | development | opus (sonnet for reviewers) | effort=high | thinking=medium |
161
+ | Unit tests, linting, docs | fast | sonnet | effort=low | thinking=low |
162
+
163
+ Claude Code has full feature support: parallel agents (up to 10 simultaneous), the Task tool, and MCP integration. Codex and Gemini run in degraded mode: sequential execution only, no Task tool, no parallel agents.
164
+
165
+ ## Key Files
166
+
167
+ Every Loki Mode project uses these files in the `.loki/` directory:
168
+
169
+ | File | Purpose |
170
+ |------|---------|
171
+ | `session.json` | Current session state (pid, start time, provider, status) |
172
+ | `state/orchestrator.json` | Current phase, tasks completed/failed |
173
+ | `queue/pending.json` | Tasks waiting to be executed |
174
+ | `queue/current-task.json` | The task currently being worked on |
175
+ | `queue/dead-letter.json` | Tasks that failed 5+ times |
176
+ | `memory/index.json` | Lightweight memory index |
177
+ | `memory/timeline.json` | Memory timeline for context retrieval |
178
+ | `signals/` | Inter-process signals (PAUSE, STOP, DRIFT_DETECTED, etc.) |
179
+
180
+ ## Summary
181
+
182
+ Loki Mode is an autonomous multi-agent system that follows the RARV cycle to build software from PRDs. It uses 41 agent types organized into 8 swarms, enforces quality through 9 gates with blind peer review, and maintains episodic/semantic/procedural memory for continuous learning. Projects are classified into simple, standard, or complex tiers that determine the number of phases executed.
@@ -0,0 +1,93 @@
1
+ # Module 1 Quiz: Core Concepts
2
+
3
+ Answer each question by selecting the best option (A, B, C, or D).
4
+
5
+ ---
6
+
7
+ **Question 1:** What does the RARV cycle stand for?
8
+
9
+ A) Read, Analyze, Review, Validate
10
+ B) Reason, Act, Reflect, Verify
11
+ C) Request, Assign, Run, Verify
12
+ D) Review, Approve, Release, Validate
13
+
14
+ ---
15
+
16
+ **Question 2:** How many specialized agent types does Loki Mode define?
17
+
18
+ A) 8
19
+ B) 25
20
+ C) 41
21
+ D) 50
22
+
23
+ ---
24
+
25
+ **Question 3:** What happens when a task fails 5 times in the RARV cycle?
26
+
27
+ A) The entire session terminates
28
+ B) The task is moved to the dead-letter queue
29
+ C) The task is automatically deleted
30
+ D) The agent escalates to a more powerful model
31
+
32
+ ---
33
+
34
+ **Question 4:** Which specialist reviewer is ALWAYS included in the 3-reviewer blind review system?
35
+
36
+ A) security-sentinel
37
+ B) performance-oracle
38
+ C) architecture-strategist
39
+ D) test-coverage-auditor
40
+
41
+ ---
42
+
43
+ **Question 5:** How many quality gates does Loki Mode enforce?
44
+
45
+ A) 3
46
+ B) 5
47
+ C) 7
48
+ D) 9
49
+
50
+ ---
51
+
52
+ **Question 6:** What are the three types of memory in the Loki Mode memory system?
53
+
54
+ A) Short-term, long-term, working
55
+ B) Episodic, semantic, procedural
56
+ C) Cache, storage, archive
57
+ D) Input, processing, output
58
+
59
+ ---
60
+
61
+ **Question 7:** Which complexity tier uses 3 phases?
62
+
63
+ A) basic
64
+ B) simple
65
+ C) standard
66
+ D) complex
67
+
68
+ ---
69
+
70
+ **Question 8:** What is the minimum test coverage required by Gate 7 (Test Coverage Gates)?
71
+
72
+ A) 50%
73
+ B) 60%
74
+ C) 80%
75
+ D) 100%
76
+
77
+ ---
78
+
79
+ **Question 9:** Which AI provider supports full Loki Mode features including parallel agents and the Task tool?
80
+
81
+ A) OpenAI Codex CLI
82
+ B) Google Gemini CLI
83
+ C) Claude Code
84
+ D) All three providers equally
85
+
86
+ ---
87
+
88
+ **Question 10:** What does Gate 4 (Anti-Sycophancy Check) do?
89
+
90
+ A) Blocks all code that has any warnings
91
+ B) Runs a Devil's Advocate reviewer when all 3 reviewers unanimously approve
92
+ C) Requires human approval for every change
93
+ D) Checks for duplicate code across the project
@@ -0,0 +1,154 @@
1
+ # Module 2 Lab: Configure Enterprise Features
2
+
3
+ ## Objective
4
+
5
+ Enable and verify enterprise features: audit logging, OTEL observability, token authentication, and dashboard TLS.
6
+
7
+ ## Prerequisites
8
+
9
+ - Loki Mode installed (`npm install -g loki-mode`)
10
+ - `loki doctor` passing
11
+ - `jq` installed for JSON inspection
12
+
13
+ ## Step 1: Verify Audit Logging Is Active
14
+
15
+ Audit logging is enabled by default. Verify its status:
16
+
17
+ ```bash
18
+ loki enterprise status
19
+ ```
20
+
21
+ The output should show audit logging as enabled.
22
+
23
+ Start a session briefly to generate audit entries:
24
+
25
+ ```bash
26
+ # Create a minimal project directory
27
+ mkdir -p /tmp/enterprise-lab && cd /tmp/enterprise-lab
28
+ git init
29
+
30
+ # Check audit status
31
+ loki enterprise audit status
32
+ ```
33
+
34
+ **Note:** Viewing actual audit log entries requires a running session that has performed agent actions. The audit log records actions taken during `loki start`.
35
+
36
+ ## Step 2: Explore Audit Configuration
37
+
38
+ Review the available audit environment variables:
39
+
40
+ ```bash
41
+ # These are the key audit variables:
42
+ # LOKI_AUDIT_DISABLED=true -- Disable audit logging
43
+ # LOKI_AUDIT_SYSLOG_HOST -- Enable syslog forwarding
44
+ # LOKI_AUDIT_SYSLOG_PORT -- Syslog port (default: 514)
45
+ # LOKI_AUDIT_SYSLOG_PROTO -- Syslog protocol: udp or tcp
46
+ # LOKI_AUDIT_LEVEL -- Minimum severity to log
47
+ # LOKI_AUDIT_EXCLUDE_EVENTS -- Comma-separated events to skip
48
+ ```
49
+
50
+ To temporarily disable audit logging (not recommended for production):
51
+
52
+ ```bash
53
+ LOKI_AUDIT_DISABLED=true loki enterprise status
54
+ ```
55
+
56
+ ## Step 3: Check OTEL Readiness
57
+
58
+ OTEL is lazy-loaded. Verify the conditional loading behavior:
59
+
60
+ ```bash
61
+ # Without OTEL endpoint -- should report no OTEL
62
+ loki enterprise status
63
+
64
+ # To enable OTEL (requires a running OTLP collector):
65
+ # export LOKI_OTEL_ENDPOINT=http://localhost:4318
66
+ # loki start ./prd.md
67
+ ```
68
+
69
+ **Note:** Actually sending OTEL data requires a running OTLP-compatible collector (such as the OpenTelemetry Collector, Jaeger, or Grafana Tempo) on the specified endpoint.
70
+
71
+ ## Step 4: Generate an API Token
72
+
73
+ Enable enterprise authentication and generate a token:
74
+
75
+ ```bash
76
+ # Enable token auth
77
+ export LOKI_ENTERPRISE_AUTH=true
78
+
79
+ # Generate a token
80
+ loki enterprise token generate lab-test-token
81
+
82
+ # Generate with expiration
83
+ loki enterprise token generate lab-expires --expires 7
84
+ ```
85
+
86
+ **Note:** Token authentication requires the dashboard API server to be running (`loki dashboard start` or `loki serve`). Without a running server, token generation creates the token but there is no API to authenticate against.
87
+
88
+ ## Step 5: Start and Inspect the Dashboard
89
+
90
+ ```bash
91
+ # Start the dashboard server
92
+ loki dashboard start
93
+
94
+ # Check if it is running
95
+ loki dashboard status
96
+
97
+ # Get the URL
98
+ loki dashboard url
99
+
100
+ # Open in browser (macOS/Linux)
101
+ loki dashboard open
102
+ ```
103
+
104
+ The dashboard should be accessible at `http://localhost:57374`.
105
+
106
+ ## Step 6: Inspect Metrics
107
+
108
+ While the dashboard is running:
109
+
110
+ ```bash
111
+ # View Prometheus-format metrics
112
+ loki metrics
113
+ ```
114
+
115
+ This outputs metrics in OpenMetrics format suitable for Prometheus scraping.
116
+
117
+ ## Step 7: Review SIEM Integration Options
118
+
119
+ Read the SIEM integration documentation:
120
+
121
+ ```bash
122
+ # The full guide is at docs/siem-integration.md in the Loki Mode installation
123
+ # Key platforms supported:
124
+ # - Splunk
125
+ # - IBM QRadar
126
+ # - Elastic SIEM
127
+ # - Datadog Security Monitoring
128
+ ```
129
+
130
+ To configure syslog forwarding (requires an actual syslog server):
131
+
132
+ ```bash
133
+ export LOKI_AUDIT_SYSLOG_HOST=your-syslog-server.example.com
134
+ export LOKI_AUDIT_SYSLOG_PORT=514
135
+ export LOKI_AUDIT_SYSLOG_PROTO=tcp
136
+ ```
137
+
138
+ ## Verification Checklist
139
+
140
+ - [ ] `loki enterprise status` shows audit logging enabled
141
+ - [ ] You understand the difference between `LOKI_AUDIT_DISABLED` and `LOKI_ENTERPRISE_AUDIT`
142
+ - [ ] You know which environment variable activates OTEL (`LOKI_OTEL_ENDPOINT`)
143
+ - [ ] You can generate an enterprise token with `loki enterprise token generate`
144
+ - [ ] `loki dashboard status` correctly reports whether the dashboard is running
145
+ - [ ] `loki metrics` outputs Prometheus-format metrics
146
+
147
+ ## Cleanup
148
+
149
+ ```bash
150
+ loki dashboard stop
151
+ cd ~
152
+ rm -rf /tmp/enterprise-lab
153
+ unset LOKI_ENTERPRISE_AUTH
154
+ ```