loki-mode 10.5.17 → 10.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +877 -30
- package/SKILL.md +3 -3
- package/VERSION +1 -1
- package/autonomy/lib/proof-generator.py +251 -0
- package/autonomy/lib/proof-verify.py +1 -0
- package/autonomy/loki +52 -6
- package/autonomy/run.sh +35 -5
- package/autonomy/verify.sh +1 -1
- package/dashboard/__init__.py +1 -1
- package/dashboard/api_start.py +463 -0
- package/dashboard/server.py +31 -0
- package/dashboard/static/start.html +100 -0
- package/docs/COMPARISON.md +6 -19
- package/docs/COMPETITIVE-ANALYSIS.md +6 -41
- package/docs/CRASH-REPORTING-PLAN.md +1 -1
- package/docs/ENTERPRISE-IDENTITY-ROADMAP.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/PRIVACY.md +1 -1
- package/docs/R8-SHAREABLE-TEAM-ASSETS-PLAN.md +1 -1
- package/docs/WANG-PRINCIPLES-PLAN.md +1 -1
- package/docs/architecture/STATE-MACHINES.md +18 -27
- package/docs/architecture/bmad-integration-validation.md +2 -2
- package/docs/audit-logging.md +12 -86
- package/docs/authentication.md +4 -4
- package/docs/authorization.md +15 -47
- package/docs/auto-claude-comparison.md +1 -33
- package/docs/certification/01-core-concepts/lab.md +3 -3
- package/docs/certification/01-core-concepts/lesson.md +11 -22
- package/docs/certification/01-core-concepts/quiz.md +7 -7
- package/docs/certification/02-enterprise-features/lab.md +0 -2
- package/docs/certification/02-enterprise-features/lesson.md +0 -10
- package/docs/certification/04-production-deployment/lab.md +1 -1
- package/docs/certification/05-troubleshooting/lab.md +2 -2
- package/docs/certification/README.md +1 -1
- package/docs/certification/answer-key.md +37 -20
- package/docs/certification/certification-exam.md +7 -7
- package/docs/competitive/emergence-others-analysis.md +3 -3
- package/docs/competitive/replit-lovable-analysis.md +2 -2
- package/docs/cursor-comparison.md +2 -2
- package/docs/dashboard-guide.md +14 -2
- package/docs/dev/architecture-reference.md +2 -2
- package/docs/dev/project-structure.md +1 -1
- package/docs/enterprise/architecture.md +11 -8
- package/docs/enterprise/integration-cookbook.md +23 -14
- package/docs/enterprise/migration.md +5 -9
- package/docs/enterprise/performance.md +3 -6
- package/docs/enterprise/sdk-guide.md +1 -1
- package/docs/enterprise/security.md +8 -17
- package/docs/exit-codes.md +14 -0
- package/docs/git-workflow.md +4 -62
- package/docs/network-security.md +3 -13
- package/docs/plans/ULTRAPLAN-FORGE-BAAS.md +1 -1
- package/docs/prd-purple-lab-platform-v2.md +1 -1
- package/docs/prd-purple-lab-platform.md +1 -3
- package/docs/research-2026-07/GAP-ANALYSIS-BACKLOG.md +1 -1
- package/docs/show-hn-post.md +3 -4
- package/docs/siem-integration.md +8 -10
- package/docs/test-scenarios/edge-cases.md +2 -2
- package/docs/test-scenarios/enterprise-scenarios.md +4 -4
- package/docs/v10/BOARD.md +7 -5
- package/docs/v10/GUIDE.md +5 -3
- package/docs/v10/METRICS.md +36 -0
- package/docs/v10/PROGRESS.md +42 -0
- package/docs/walkthrough/README.md +1 -7
- package/loki-ts/dist/loki.js +370 -370
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-DxGZSpFg.js → AdminPage-HjtApbcL.js} +1 -1
- package/web-app/dist/assets/{Avatar-BZEp23D8.js → Avatar-BcwLENsU.js} +1 -1
- package/web-app/dist/assets/{Badge-DnDwqDLu.js → Badge-DjJhHJj0.js} +1 -1
- package/web-app/dist/assets/{Button-C9KDP4c1.js → Button-CSMstrCz.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-DRlh3LV2.js → CockpitPage-BHihN-aq.js} +1 -1
- package/web-app/dist/assets/{ComparePage-C_gE45dQ.js → ComparePage-_6JtexDp.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-CL-J9-Cs.js → ErrorBoundary-Cx2fnw3q.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-DABd176Y.js → EvidenceReceiptPanel-DcUQAnju.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-C4lYbm6O.js → GitHubIssuesPanel-1dYpQ5Rx.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-CgiUixwo.js → GitHubPRsPanel-BPdDD1kX.js} +1 -1
- package/web-app/dist/assets/{HomePage-DC99RIrz.js → HomePage-JfmwLGnQ.js} +2 -2
- package/web-app/dist/assets/{LoginPage-Bd72QWNk.js → LoginPage-7SnMHzPc.js} +1 -1
- package/web-app/dist/assets/{MagicPage-CBouFs2K.js → MagicPage-C0IkoOzD.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-c9MyDcBp.js → MetricsPage-BJOZ0L3F.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-ZPhiebiW.js → NotFoundPage-S49UjLyW.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-DKwrALUb.js → ProjectPage-Dj_nv2kT.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-X1uZKZC_.js → ProjectsPage-C7thLjOm.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-CiZKZRto.js → SettingsPage-DEcJyfsU.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-k_imKfeh.js → ShowcasePage-B5PshXNg.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-Wx9ESLll.js → SystemSettingsPage-Cnp4BkN7.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-B7upn-I7.js → TeamsPage-1ImpgMzs.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-oJf_VKgh.js → TemplatesPage-BOYKrPX8.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-BdfPlgLI.js → TerminalOutput-LPxzwfwm.js} +1 -1
- package/web-app/dist/assets/{activity-BcZTsgWH.js → activity-Hl7iDpX_.js} +1 -1
- package/web-app/dist/assets/{bell-JNEkjWQ2.js → bell-DrBfjAq4.js} +1 -1
- package/web-app/dist/assets/{bot-DMAJobP_.js → bot-6SoklKaZ.js} +1 -1
- package/web-app/dist/assets/{check-DPTry-z2.js → check-DhHuZH8k.js} +1 -1
- package/web-app/dist/assets/{chevron-left-DSqOEtTV.js → chevron-left-BUERGaLO.js} +1 -1
- package/web-app/dist/assets/{circle-alert-BbL8Vysv.js → circle-alert-D7UOw5bc.js} +1 -1
- package/web-app/dist/assets/{clock-BHEr5lGW.js → clock-t3v_i7fP.js} +1 -1
- package/web-app/dist/assets/{cloud-C48PunYo.js → cloud-CP3eLZts.js} +1 -1
- package/web-app/dist/assets/{code-xml-Boa7kRqT.js → code-xml-DU-CmwVx.js} +1 -1
- package/web-app/dist/assets/{database-Eu35Gv7z.js → database-J27fE_Ot.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-BO9fCnHW.js → dollar-sign-BdU_HR9C.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-DHsSDIL_.js → file-code-corner-Cu4A1aIH.js} +1 -1
- package/web-app/dist/assets/{file-plus-BYiQLe5l.js → file-plus-BTli76r5.js} +1 -1
- package/web-app/dist/assets/{globe-BPZ5sQI2.js → globe-Bz3m1c_-.js} +1 -1
- package/web-app/dist/assets/{hammer-DlOLTsH3.js → hammer-HNN6jr92.js} +1 -1
- package/web-app/dist/assets/{index-BrgkuqSA.js → index-CgK4xqUy.js} +3 -3
- package/web-app/dist/assets/{layers-DMNdn1GR.js → layers-DhuXUuM6.js} +1 -1
- package/web-app/dist/assets/{loader-circle-_e9fypHL.js → loader-circle-CeBjdh2y.js} +1 -1
- package/web-app/dist/assets/{lock-D_elxMZb.js → lock-DjSqmIVZ.js} +1 -1
- package/web-app/dist/assets/{package-Bw-7g3JI.js → package-NL0AdpIi.js} +1 -1
- package/web-app/dist/assets/{plus-CZeq0pgJ.js → plus-Lbz3hom-.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-D0WMyffs.js → refresh-cw-uKARwuER.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CcKyNwXG.js → rotate-ccw-ByA6XJq1.js} +1 -1
- package/web-app/dist/assets/{scroll-text-C0L9Vqpm.js → scroll-text-BV8Blxig.js} +1 -1
- package/web-app/dist/assets/{server-SgwFv6cd.js → server-Cy3R5hde.js} +1 -1
- package/web-app/dist/assets/{shield-alert-D1tESlfI.js → shield-alert-rE_xXx7r.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-bUtUA15O.js → thumbs-up-CNMITZHD.js} +1 -1
- package/web-app/dist/assets/{trash-2-C9Nv1kKk.js → trash-2-BP3Rr5SU.js} +1 -1
- package/web-app/dist/assets/{trending-down-Bh107AJe.js → trending-down-BE_8lCjD.js} +1 -1
- package/web-app/dist/assets/{trending-up-25BqhLVq.js → trending-up-CF6E9-9a.js} +1 -1
- package/web-app/dist/assets/{upload-DDYtMbN5.js → upload-D-Ui4N6K.js} +1 -1
- package/web-app/dist/assets/{usePolling-BSDT0il_.js → usePolling-DIVX97OV.js} +1 -1
- package/web-app/dist/assets/{user-CKpUEUhK.js → user-7rTiTfDj.js} +1 -1
- package/web-app/dist/index.html +1 -1
- package/docs/README-FULL.md +0 -977
package/README.md
CHANGED
|
@@ -1,59 +1,906 @@
|
|
|
1
1
|
Your agent says done. Loki proves it.
|
|
2
2
|
|
|
3
3
|
An autonomous software factory that knows what it is supposed to deliver, and proves it did.
|
|
4
|
-
Install: `/plugin marketplace add asklokesh/loki-mode` then `/plugin install loki-seal@loki-mode`
|
|
5
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/loki-mode)
|
|
6
|
+
[](https://www.npmjs.com/package/loki-mode)
|
|
7
|
+
[](https://hub.docker.com/r/asklokesh/loki-mode)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
[Website](https://www.autonomi.dev/) | [Documentation](wiki/Home.md) | [Installation](docs/INSTALLATION.md) | [Changelog](CHANGELOG.md)
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
Loki Mode is a free, source-available autonomous coding agent by [Autonomi](https://www.autonomi.dev/). Hand it a PRD, GitHub issue, OpenAPI doc or one-line brief. It derives a delivery contract (the acceptance criteria), builds against it, and ends with a signed Evidence Receipt that states what was proven and what was not. If the contract cannot be derived, it stops and asks one question instead of guessing.
|
|
13
|
+
|
|
14
|
+
Before a build counts as done, a review council selects reviewers from a specialist pool (`agents/types.json`, scored by `run.sh:FOCUS_KEYWORDS`). The bundled MCP server exposes 36 tools over stdio (`mcp/server.py`).
|
|
15
|
+
|
|
16
|
+
## Contents
|
|
17
|
+
|
|
18
|
+
- [Install](#install)
|
|
19
|
+
- [Loki 10 engine](#loki-10-engine)
|
|
20
|
+
- [Outcomes and exit codes](#outcomes-and-exit-codes)
|
|
21
|
+
- [Signed receipts and loki verify](#signed-receipts-and-loki-verify)
|
|
22
|
+
- [Quiet output](#quiet-output)
|
|
23
|
+
- [Release channels: next and latest](#release-channels-next-and-latest)
|
|
24
|
+
- [loki doctor](#loki-doctor)
|
|
25
|
+
- [Modernization: status of loki modernize](#modernization-status-of-loki-modernize)
|
|
26
|
+
- [Providers](#providers)
|
|
27
|
+
- [Legacy engine reference](#legacy-engine-reference) (the engine `loki` runs by default today)
|
|
9
28
|
|
|
10
29
|
## Install
|
|
11
30
|
|
|
12
31
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
npx loki-mode tour # zero-key replay of a real Evidence Receipt
|
|
32
|
+
bun install -g loki-mode # recommended (npm, Homebrew, Docker below)
|
|
33
|
+
loki doctor # checks your setup, names any blocker
|
|
16
34
|
```
|
|
17
35
|
|
|
18
|
-
|
|
36
|
+
| Method | Command | Notes |
|
|
37
|
+
|--------|---------|-------|
|
|
38
|
+
| **Bun (recommended)** | `bun install -g loki-mode` | Fastest startup for CLI commands. |
|
|
39
|
+
| **npm** | `npm install -g loki-mode` | Works without Bun (bash fallback). Migrate any time with `loki self-update --to bun`. |
|
|
40
|
+
| **Homebrew** | `brew tap asklokesh/tap && brew install loki-mode` | Auto-installs Bun as a dependency. |
|
|
41
|
+
| **Docker** | `docker pull asklokesh/loki-mode:latest` | Bun and the Claude CLI pre-installed. See [DOCKER_README.md](DOCKER_README.md). |
|
|
42
|
+
| **No install** | `npx loki-mode tour` | Prints a real Evidence Receipt from a past build. No key, no spend, no network. |
|
|
19
43
|
|
|
20
|
-
|
|
44
|
+
Upgrade with `loki self-update`. Long form: [Installation Guide](docs/INSTALLATION.md). `npm install -g loki-mode` installs the `latest` dist-tag; see [Release channels](#release-channels-next-and-latest) for `next`.
|
|
21
45
|
|
|
22
|
-
|
|
46
|
+
**Loki needs a model to drive.** An `ANTHROPIC_API_KEY` alone is enough (the Claude Agent SDK ships inside Loki; on the default engine this path needs Bun and `LOKI_SDK_MODE=full`, see Setup details below), or point it at Claude Code, Cline, Codex, Aider or opencode. `loki doctor` tells you exactly what is missing.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
export ANTHROPIC_API_KEY=sk-...
|
|
50
|
+
loki doctor
|
|
51
|
+
```
|
|
23
52
|
|
|
24
|
-
|
|
53
|
+
<details>
|
|
54
|
+
<summary>Claude Code plugin (adds /loki-grill, /loki-spec-status, /loki-verify)</summary>
|
|
25
55
|
|
|
26
56
|
```bash
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
loki start ./prd.md # build from a PRD
|
|
30
|
-
loki start owner/repo#123 # build from an issue
|
|
57
|
+
claude plugin marketplace add asklokesh/loki-mode
|
|
58
|
+
claude plugin install loki-mode@loki-mode
|
|
31
59
|
```
|
|
32
60
|
|
|
33
|
-
|
|
61
|
+
Adds three slash commands and the Loki MCP server (memory, task queue, code search, build management) to Claude Code. It calls the CLI rather than bundling it, so install `loki-mode` above first. Verify with `claude plugin list`: a healthy install reports `Status: enabled`.
|
|
34
62
|
|
|
35
|
-
|
|
63
|
+
</details>
|
|
64
|
+
|
|
65
|
+
loki-seal is a Claude Code Stop hook that runs your repo's real test suite when the agent tries to finish and refuses "done" if tests newly fail or tests or CI config were deleted, skipped or weakened (details: [packages/loki-seal/README.md](packages/loki-seal/README.md)). Install it from the repository's plugin marketplace:
|
|
36
66
|
|
|
37
|
-
|
|
67
|
+
```
|
|
68
|
+
/plugin marketplace add asklokesh/loki-mode
|
|
69
|
+
/plugin install loki-seal@loki-mode
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Loki 10 engine
|
|
38
73
|
|
|
39
74
|
Opt-in: set LOKI_ENGINE=v10 <!-- loki10-default -->
|
|
40
75
|
|
|
41
|
-
Guide, provider table and summary format: [docs/v10/GUIDE.md](docs/v10/GUIDE.md).
|
|
76
|
+
Loki 10 is the rewritten engine. It is not the default yet: with `LOKI_ENGINE` unset, `loki` runs the [legacy engine](#legacy-engine-reference) exactly as before. A default flip is in flight; this section describes what `main` does today (`bin/loki` routes to the v10 engine only when `LOKI_ENGINE=v10` is set). Guide, provider table and summary format: [docs/v10/GUIDE.md](docs/v10/GUIDE.md).
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
LOKI_ENGINE=v10 loki "fix the login redirect loop" --no-pr
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
LOKI_ENGINE=v10 loki owner/repo#123
|
|
84
|
+
```
|
|
42
85
|
|
|
43
|
-
|
|
86
|
+
The router sends a quoted multi-word task, a GitHub, GitLab or Jira issue reference, and the `status`, `verify` and `dashboard` subcommands to the v10 engine. A one-word argument that is not an issue ref, or any first argument starting with `-`, stays on the legacy CLI. Flags (`loki-ts/src/engine10/cli.ts` USAGE): `--no-pr` builds and verifies without opening a pull request, `--deep` requests the deep verify pass and a longer implement budget, `--provider <name>` picks the coding provider (`--json` and `--verbose` are also parsed by the supervisor, see [Quiet output](#quiet-output)). The v10 engine needs Bun; without it the command exits 1 with a message.
|
|
44
87
|
|
|
45
|
-
The
|
|
88
|
+
### The state machine
|
|
46
89
|
|
|
47
|
-
|
|
48
|
-
- Try it without installing, and read-only brownfield mode
|
|
49
|
-
- The Evidence Receipt, verification and Proven PR sections
|
|
50
|
-
- Architecture, quality gates, memory, dashboard and the enterprise layer
|
|
51
|
-
- Comparisons with other tools, the CLI reference and configuration
|
|
52
|
-
- Loki 10 engine preview, limitations and research foundation
|
|
90
|
+
Every run starts from an explicit delivery contract and is judged only against it. The stage table lives in `loki-ts/src/engine10/machine.ts` (`FLOW`), the stages in `loki-ts/src/engine10/stages/`.
|
|
53
91
|
|
|
54
|
-
|
|
92
|
+
```mermaid
|
|
93
|
+
flowchart TD
|
|
94
|
+
A[Intake: task or issue, repo map, test map] --> P[Plan]
|
|
95
|
+
A --> W[Wall: checks written from the task alone, sealed]
|
|
96
|
+
P --> G{Wall already passes on the base tree?}
|
|
97
|
+
W --> G
|
|
98
|
+
G -- yes --> C[Commit]
|
|
99
|
+
G -- no --> I[Implement]
|
|
100
|
+
I --> V[Verify]
|
|
101
|
+
V -- checks fail --> F[Fix, at most 2 rounds]
|
|
102
|
+
F --> V
|
|
103
|
+
V -- pass, stall, cap or spec conflict --> C
|
|
104
|
+
C --> S[Seal: signed receipt]
|
|
105
|
+
S --> R[PR: opened by the supervisor]
|
|
106
|
+
R --> D[Deep verify, detached: full suite, app boot, council, secret scan]
|
|
107
|
+
```
|
|
55
108
|
|
|
56
|
-
|
|
57
|
-
|
|
109
|
+
| Stage | What it does |
|
|
110
|
+
|-------|--------------|
|
|
111
|
+
| intake | Reads the task or issue, builds the repo map and the test map. |
|
|
112
|
+
| plan and wall | Run in parallel. Plan decides the approach. The Wall author sees only the task and the repo map, never the code, and writes `loki_wall_*` tests that are sealed (sha256) before implement. If they already pass on the untouched base tree, the run ends early as ALREADY_SATISFIED. |
|
|
113
|
+
| implement | A provider session makes the change, under a time budget (480s default, 1800s with `--deep`). |
|
|
114
|
+
| verify and fix | Runs the checks. Failures feed up to 2 fix rounds (`MAX_FIX_ROUNDS`). The same failures three verifies running end the run as STALLED. |
|
|
115
|
+
| commit and seal | Commits the diff, then writes `.loki/runs/<run-id>/receipt.json` and `receipt.md`, signed by default. |
|
|
116
|
+
| pr | Opened by the supervisor, not the worker (the worker never holds a GitHub token). A non-VERIFIED run opens a draft PR. |
|
|
117
|
+
| deep verify | Detached, started after the PR opens (so not with `--no-pr`): full suite, app-boot probe, council, secret scan. A check that is refused or unavailable is reported as NOT PROVEN, never as red. `--deep` is a separate flag that raises the implement and run budgets. |
|
|
118
|
+
|
|
119
|
+
The run cap is 900s (2700s with `--deep`, `DEFAULT_CAP_S` and `DEEP_CAP_S` in `types.ts`); commit, seal and pr still run after the cap fires. A run whose cap fired and which did not verify exits BUDGET_STOP.
|
|
120
|
+
|
|
121
|
+
A finished run prints a short summary (see [Quiet output](#quiet-output), which also shows an example) whose `NOT PROVEN` line is never empty by omission: deep checks deferred to the deep-verify pass are always listed there.
|
|
122
|
+
|
|
123
|
+
`loki status [run-id]`, `loki verify [run-id]` and `loki dashboard` are built on the v10 path. Slack notifications are not part of the v10 engine surface yet.
|
|
124
|
+
|
|
125
|
+
## Outcomes and exit codes
|
|
126
|
+
|
|
127
|
+
A v10 run ends in exactly one outcome. The mapping is `EXIT` in `loki-ts/src/engine10/output.ts`.
|
|
128
|
+
|
|
129
|
+
| Exit | Outcome | Meaning |
|
|
130
|
+
|------|---------|---------|
|
|
131
|
+
| 0 | VERIFIED | The contract's checks ran and passed. |
|
|
132
|
+
| 0 | ALREADY_SATISFIED | The work was already done; evidence is recorded. |
|
|
133
|
+
| 1 | FAILED | A check failed, the stage failed, or the event log was modified outside the engine. |
|
|
134
|
+
| 2 | (usage) | No task given, not inside a git repository, or a preflight refusal. Nothing ran. |
|
|
135
|
+
| 3 | BUDGET_STOP | The cost or time cap fired before the work finished. |
|
|
136
|
+
| 4 | BLOCKED | Spec conflict: the contract cannot be satisfied as written. The summary names the conflict (`spec conflict: <reason>`); the run never guesses and calls it done. |
|
|
137
|
+
| 5 | STALLED | The same failures three verifies in a row. |
|
|
138
|
+
|
|
139
|
+
Severity rises with the code, so `[ $rc -ge 2 ]` always means worse than FAILED. The full table for other commands (`loki verify`, `loki proof verify`, `loki ci`, `loki doctor`, `loki start`) is in [docs/exit-codes.md](docs/exit-codes.md); that page does not yet list the v10 run ladder above, which is read from the code.
|
|
140
|
+
|
|
141
|
+
Known gap: the legacy `loki verify` exit table in `docs/exit-codes.md` lists four inputs that do not yet return the documented target. They are tracked as pending moat cases.
|
|
142
|
+
|
|
143
|
+
## Signed receipts and loki verify
|
|
144
|
+
|
|
145
|
+
Every sealed v10 run writes a receipt to `.loki/runs/<run-id>/receipt.json`. `receipt_sha256` hashes the canonical JSON without the `verification` block, so verifying never trusts the receipt's own signature field to compute the hash it checks.
|
|
146
|
+
|
|
147
|
+
Receipts are signed by default. On the first run Loki generates an Ed25519 key at `~/.loki/keys/receipt-ed25519.pem` (mode 0600, directory 0700), or you supply your own with `LOKI_RECEIPT_SIGNING_KEY` or `LOKI_RECEIPT_SIGNING_KEY_FILE`. See [docs/SIGNED-RECEIPTS.md](docs/SIGNED-RECEIPTS.md).
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
LOKI_ENGINE=v10 loki verify
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`loki verify [run-id]` (latest run by default) re-hashes the receipt, checks the signature against your local key (and retired keys listed in `LOKI_RECEIPT_RETIRED_PUBKEYS`), and checks the receipt against the event log. Verdicts and exit codes on the v10 path (`loki-ts/src/engine10/verify_cmd.ts`):
|
|
154
|
+
|
|
155
|
+
| Verdict | Exit | Meaning |
|
|
156
|
+
|---------|------|---------|
|
|
157
|
+
| VERIFIED | 0 | Hash and signature check out. |
|
|
158
|
+
| UNSIGNED | 3 | The receipt carries no signature, so its integrity is not attested and `loki verify` refuses it. Pass `--allow-unsigned` (or set `LOKI_VERIFY_ALLOW_UNSIGNED=1`) to accept it and exit 0; the output still says UNSIGNED. A receipt whose body was edited and whose signature was stripped reads UNSIGNED. |
|
|
159
|
+
| TAMPERED | 1 | The hash, the signature, or the event log does not match. |
|
|
160
|
+
| UNCHECKED | 2 | The signature cannot be checked here, for example the signing key is on another machine. |
|
|
161
|
+
| (no runs) | 66 | No receipt to verify. |
|
|
162
|
+
|
|
163
|
+
A verified receipt is bound to the run's event log, so a receipt lifted out of its run, or a log edited after sealing, does not verify. Signing proves the receipt came from the key holder; it does not prove the generated code is bug-free. A receipt only claims what its checks ran, and states what they did not.
|
|
164
|
+
|
|
165
|
+
On the legacy engine, receipts live under `.loki/proofs/<run_id>/` and are inspected with `loki proof list`, `loki proof show <id>` and `loki proof verify <id>` (exit 0 clean, 1 on tamper or drift, 2 could not check).
|
|
166
|
+
|
|
167
|
+
## Quiet output
|
|
168
|
+
|
|
169
|
+
The v10 run is quiet by default: no stage chatter, only the final summary. `--verbose` tails the event stream live (one line per finished stage and a heartbeat with elapsed time and the running diff size). `--json` prints one JSON object (`ok`, `outcome`, `stop`, `run_id`, `receipt_sha256`) instead of text.
|
|
170
|
+
|
|
171
|
+
The summary is one outcome line, an optional reason on a non-VERIFIED run, then the PR, the receipt, what was NOT PROVEN, the cost and the time (`formatSummary` in `output.ts`):
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Outcome: VERIFIED
|
|
175
|
+
PR: https://github.com/owner/repo/pull/1
|
|
176
|
+
Receipt: sha256:2f9a41c7e0b3...
|
|
177
|
+
NOT PROVEN: full suite, app boot, council, security scan
|
|
178
|
+
Cost: $0.42 (claude, 212k tokens)
|
|
179
|
+
Time: 4m12s (intake 11s, plan 20s, implement 3m10s, verify 31s)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Cost is the provider-reported figure. When a provider does not report cost the line reads `not measured`, never `$0.00`. The legacy `loki quick` is also quiet by default; `--verbose` or `LOKI_VERBOSE=1` shows setup and progress.
|
|
183
|
+
|
|
184
|
+
## Release channels: next and latest
|
|
185
|
+
|
|
186
|
+
Releases are built in slices and shipped in trains: green slices merge, one train is pushed, and the release workflow publishes the exact tested tree to the npm `next` dist-tag. `latest` moves only through the promote workflow (`.github/workflows/promote.yml`), which installs that exact version from npm, runs the first-run gate on it (`scripts/first-run-gate.sh --installed`), and only then moves `latest`, Docker `:latest` and the Homebrew formula. A version whose commit is not an ancestor of main can never become `latest`.
|
|
187
|
+
|
|
188
|
+
The first-run gate runs the README's default entry point for a new user on a throwaway repo with a throwaway HOME and a stub provider, and asserts the run is honest: the exit code matches the result, tests are green, only the fix file changed, the printed digest equals what `loki verify` checks, the receipt is signed, output stays short, and a run that skips the target test does not end VERIFIED.
|
|
189
|
+
|
|
190
|
+
Policy (D49): every green release is promoted to `latest` after the automated first-run gate. The promote workflow runs automatically after Post-Release Smoke succeeds; a failed smoke or gate leaves the version on `next`. `workflow_dispatch` remains for manual runs of an exact version.
|
|
191
|
+
|
|
192
|
+
```mermaid
|
|
193
|
+
flowchart LR
|
|
194
|
+
S[Slice: one engineer, own tests] --> M[Merge when green]
|
|
195
|
+
M --> T[Train: batch pushed once]
|
|
196
|
+
T --> CI[Full CI on the exact SHA]
|
|
197
|
+
CI --> N[npm next]
|
|
198
|
+
N --> G[Automated first-run gate on the installed version]
|
|
199
|
+
G -- pass --> L[npm latest, Docker latest, Homebrew]
|
|
200
|
+
G -- fail --> X[Stays on next, fix-forward slice]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## loki doctor
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
loki doctor # human-readable check of prerequisites and providers
|
|
207
|
+
loki doctor --json # machine-readable; JSON is emitted in full even on failure
|
|
208
|
+
loki doctor --airgap # audit network egress and how to disable each
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Exit 0 when every required check passes; optional warnings (an absent provider CLI) do not fail it. It checks the required tools, the provider CLIs and your login, and says what to install for each gap. The same contract holds for `--json`, so it is usable as an init-container or CI preflight gate.
|
|
212
|
+
|
|
213
|
+
## Modernization: status of loki modernize
|
|
214
|
+
|
|
215
|
+
There are two different things behind the name today.
|
|
216
|
+
|
|
217
|
+
- `loki modernize heal <path>` and `loki modernize migrate <path>` are the shipped legacy commands (agent-driven phases). `loki modernize heal <path> --assess` is read-only. See [Already have a codebase](#already-have-a-codebase-start-read-only).
|
|
218
|
+
- `loki modernize <repo> --to <target>` is the new v10 command with behavior-captured equivalence. It is routed to the v10 engine whatever `LOKI_ENGINE` says, but it is not finished: only the `--dry-run` estimate works (inventory, dependency graph, unit clustering, cost, time and risk estimate, no model spend). A real run stops after the estimate and prints `modernize: oracle capture and execution are not built yet; use --dry-run`. Targets `python3` and `java21` exist; the Java dependency graph is not wired in yet. Nothing in v10 modernize claims a unit is proven equivalent today. Design: [docs/v10/MODERNIZE.md](docs/v10/MODERNIZE.md), user summary: [docs/v10/GUIDE-MODERNIZE.md](docs/v10/GUIDE-MODERNIZE.md).
|
|
219
|
+
|
|
220
|
+
## Providers
|
|
221
|
+
|
|
222
|
+
Loki's autonomy and quality loop are the product; the coding CLI is swappable. With `LOKI_PROVIDER` unset, Loki auto-detects the first installed provider in this order (`providers/loader.sh`): claude, cline, codex, aider, opencode. An explicit choice always wins and is never silently substituted. Gemini CLI is deprecated: `LOKI_PROVIDER=gemini` exits with a migration message.
|
|
223
|
+
|
|
224
|
+
| Provider | Tier | Autonomous flag | Parallel | v10 engine cost and kill-blocking | Install |
|
|
225
|
+
|----------|------|-----------------|:--------:|:---------------------------------:|---------|
|
|
226
|
+
| **Claude Code** | 1, full support | `--dangerously-skip-permissions` | Yes | measured, enforced | `npm i -g @anthropic-ai/claude-code` |
|
|
227
|
+
| **Cline CLI** | 2, reduced | `-y` | Sequential | not measured, not enforced | `npm install -g cline` |
|
|
228
|
+
| **Codex CLI** | 3, degraded | `exec --sandbox workspace-write --skip-git-repo-check` | Limited (2) | not measured, not enforced | `npm i -g @openai/codex` |
|
|
229
|
+
| **Aider** | 3, degraded | `--yes-always` | Sequential | not measured, not enforced | `pip install aider-chat` |
|
|
230
|
+
| **opencode** | model-agnostic | `--auto` | Sequential | not supported by the v10 engine | `npm install -g opencode-ai` |
|
|
231
|
+
|
|
232
|
+
Claude Code is the provider Loki is built for and the one that is run end to end by us. The others are wired in but are experimental. On a non-Claude provider the v10 summary says so: the Cost line reads `not measured` and NOT PROVEN adds `kill blocking not enforced`. See [Provider Guide](skills/providers.md).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
# Legacy engine reference
|
|
237
|
+
|
|
238
|
+
Everything below describes the legacy engine, which `loki` still runs by default (and which stays reachable when Loki 10 is made the default). The long-form commands, `loki start`, `loki quick`, `loki quickstart` and `loki proof` all live here.
|
|
239
|
+
|
|
240
|
+
## Use it
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
loki quickstart # guided first build: asks a few questions, quotes cost, builds
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
That is the whole happy path. It asks for a one-line idea, picks a template,
|
|
247
|
+
shows the real cost and time estimate before spending anything, then builds.
|
|
248
|
+
Press Enter through every step and you get a sample Todo app.
|
|
249
|
+
|
|
250
|
+
One command, no prompts (CI, scripts, containers, any shell without a terminal):
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
loki quickstart "a todo app with user accounts" --yes
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Both halves are required with no terminal: an idea (or a path to a PRD file)
|
|
257
|
+
and an explicit `--yes`. Given both, Loki picks the top-ranked template
|
|
258
|
+
automatically, prints the same honest cost and time estimate, and starts the
|
|
259
|
+
build without asking anything. Missing either half exits 2 with the
|
|
260
|
+
needs-a-terminal message and writes nothing, so an ambient `LOKI_AUTO_CONFIRM`
|
|
261
|
+
or a stray argument in CI can never start a paid build on its own. Existing
|
|
262
|
+
files are never overwritten: if `prd.md` is present the PRD lands at
|
|
263
|
+
`prd-quickstart.md`, then numbered suffixes as needed.
|
|
264
|
+
|
|
265
|
+
Choose an exact shipped starter when the top-ranked match is not the one you
|
|
266
|
+
want:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
loki quickstart --list-templates
|
|
270
|
+
loki quickstart --list-templates --json # schema-v1 automation output
|
|
271
|
+
loki quickstart "an internal reporting workspace" --template dashboard --yes
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Template discovery works without a terminal or provider and lists every shipped
|
|
275
|
+
starter's stable name and purpose in catalog order. It returns before estimation,
|
|
276
|
+
consent, PRD writes, or build execution. Positional input and execution/preview
|
|
277
|
+
flags are intentionally incompatible; `--json` is the only optional modifier.
|
|
278
|
+
|
|
279
|
+
`--template` accepts an exact template name for idea inputs and works the same
|
|
280
|
+
way with interactive use or `--dry-run` (including JSON preview). Unknown
|
|
281
|
+
templates, duplicate flags, and combinations with a PRD path refuse before
|
|
282
|
+
provider discovery, estimation, writes, or build execution.
|
|
283
|
+
|
|
284
|
+
Preview the same deterministic template choice and estimator-backed plan with
|
|
285
|
+
zero writes or execution:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
loki quickstart "a todo app with user accounts" --dry-run
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Preview requires an idea or readable PRD path, works without a terminal or AI
|
|
292
|
+
provider, and exits before creating a PRD or starting a build. `--dry-run` and
|
|
293
|
+
`--yes` are mutually exclusive so execution intent is never ambiguous.
|
|
294
|
+
|
|
295
|
+
For scripts and local dashboards, add `--json` to receive one versioned JSON
|
|
296
|
+
object instead of terminal text:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
loki quickstart "a todo app with user accounts" --dry-run --json > preview.json
|
|
300
|
+
loki quickstart --verify-preview preview.json --json
|
|
301
|
+
loki quickstart --from-preview preview.json --yes
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The object contains the input kind, deterministic selected template (or `null`
|
|
305
|
+
for an existing PRD), the exact estimator response under `plan`, and a bounded
|
|
306
|
+
continuation containing the exact idea/template or the PRD path and SHA-256.
|
|
307
|
+
`--verify-preview` validates the same bounded duplicate-key-rejecting schema and
|
|
308
|
+
requires either a currently shipped idea template or the unchanged digest-bound
|
|
309
|
+
PRD, while emitting no idea or PRD path. It accepts a file or piped stdin and
|
|
310
|
+
returns before provider discovery, estimation, writes, or build execution.
|
|
311
|
+
`--from-preview` requires explicit argv `--yes`, rejects malformed, conflicting,
|
|
312
|
+
symlinked, or changed inputs before provider and build boundaries, then uses the
|
|
313
|
+
existing no-clobber quickstart path. The saved plan is evidence rather than
|
|
314
|
+
execution authority: Loki recomputes and displays the current estimate before
|
|
315
|
+
starting. `--json` requires `--dry-run`; invalid input or estimator failure
|
|
316
|
+
writes no JSON, and preview still exits before provider discovery, file writes,
|
|
317
|
+
or build execution.
|
|
318
|
+
|
|
319
|
+
Or go straight at it:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
loki quick "build a landing page with a signup form" # one-shot task
|
|
323
|
+
loki start prd.md # build from a spec you wrote
|
|
324
|
+
loki modernize heal ./your-repo --assess # existing codebase, read-only
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
## Try it first, without installing
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
npx loki-mode tour # no install, no API key, no spend, no network
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Prints a real Evidence Receipt from a past build, headline and all:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
Headline: VERIFIED WITH GAPS
|
|
338
|
+
|
|
339
|
+
| Fact | Value |
|
|
340
|
+
| Files changed | 8 |
|
|
341
|
+
| Diff sha256 | c2be6fff3e774c387f276277b25fc424f07b667… |
|
|
342
|
+
| Tests | verified (node-test) |
|
|
343
|
+
| Build | not_run |
|
|
344
|
+
| Security | findings |
|
|
345
|
+
| Cost | $10.3218 |
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**"WITH GAPS" is the point.** Build was not run, security has findings, and the
|
|
349
|
+
receipt says so on its own front page. Recompute the diff hash yourself and
|
|
350
|
+
check it matches -- you are not asked to trust the agent's self-report.
|
|
351
|
+
|
|
352
|
+
## How the legacy engine works
|
|
353
|
+
|
|
354
|
+
Drop a spec: a PRD, GitHub issue, OpenAPI/JSON/YAML, or a one-line brief. Loki Mode classifies complexity (`run.sh:detect_complexity()`), selects reviewers from a specialist pool (`agents/types.json` ships the role definitions; 10 are keyword-scored by the review selector at `run.sh:FOCUS_KEYWORDS`, alongside the mandatory reviewers, and the rest are role descriptions in `references/agents.md` that the orchestrator adopts per phase rather than separate processes), with a blind review council and optional git-worktree streams on Claude Code, sequential on most other providers, and runs autonomous RARV cycles (Reason, Act, Reflect, Verify; see `run.sh:run_autonomous()`) with 8 quality gates (see `skills/quality-gates.md`). Code is not "done" until it passes automated verification. Output is a Git repo with source, tests, configs and audit logs.
|
|
355
|
+
|
|
356
|
+
**Why verified completion matters.** Self-reported completion is the failure users actually hit: the agent says it is done and the work is not. Loki treats "done" as a claim to be checked. [docs/EVALUATING.md](docs/EVALUATING.md) puts a runnable command next to every claim we make, and states plainly what we do not have (no enterprise case studies, no independent benchmark placement, and generation is not air-gapped). `bash tests/test-competitor-verify-surface.sh` reruns our check of which local agent CLIs expose a command that verifies their own output.
|
|
357
|
+
|
|
358
|
+
## Already have a codebase? Start read-only.
|
|
359
|
+
|
|
360
|
+
Most agents are built to create new apps. The harder, more valuable problem is
|
|
361
|
+
the ten-year-old repo that pays the bills. Loki works on both, and on an
|
|
362
|
+
existing codebase it starts by **changing nothing**:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
loki modernize heal ./your-repo --assess # read-only. no writes, no commits.
|
|
366
|
+
loki modernize heal ./your-repo --assess --json # same, machine-readable
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
You get a modernization readiness report: language mix, a 4-level maturity
|
|
370
|
+
rating, technical-debt signals (test coverage, TODO density, oversized files,
|
|
371
|
+
dependency staleness), and a **ranked list of where to start** -- ordered by
|
|
372
|
+
blast radius, so the first change is the one least likely to break something.
|
|
373
|
+
|
|
374
|
+
Then, if you want it to act:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
loki modernize heal ./your-repo --strict # block ALL behavioral change without approval
|
|
378
|
+
loki modernize heal ./your-repo --phase archaeology # extract knowledge only
|
|
379
|
+
loki modernize heal ./your-repo --compliance healthcare # preset flag: healthcare, fintech or government (not a certification)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
The healing pipeline runs in phases -- archaeology, stabilize, isolate,
|
|
383
|
+
modernize, validate -- and the validate phase checks **behavioral equivalence
|
|
384
|
+
against the pre-change baseline**, not just that the tests are green. Friction
|
|
385
|
+
points (the weird code that exists for a reason nobody remembers) are cataloged
|
|
386
|
+
before anything touches them, because in a legacy system the strange code is
|
|
387
|
+
usually load-bearing.
|
|
388
|
+
|
|
389
|
+
## The Evidence Receipt: don't trust the agent, check it
|
|
390
|
+
|
|
391
|
+
Every coding agent tells you it finished. Loki hands you something you can
|
|
392
|
+
check yourself.
|
|
393
|
+
|
|
394
|
+
**We are not the only tool that checks its own work, and you should be
|
|
395
|
+
suspicious of anyone who claims to be.** Lovable runs a security scan on every
|
|
396
|
+
publish and can block the publish outright. Claude Code's review has a step that
|
|
397
|
+
checks findings against actual code behavior. Replit says its agent tests its
|
|
398
|
+
own work.
|
|
399
|
+
|
|
400
|
+
The difference is what you are left holding. Their output lives in their
|
|
401
|
+
dashboard: a findings count in a dialog, a check run that by design never blocks
|
|
402
|
+
a merge. Ours is a **file**. It is bound to a specific diff by `diff_sha256`, it
|
|
403
|
+
records what was NOT proven as prominently as what was, and someone who has
|
|
404
|
+
never installed Loki can re-verify it from the repository alone. Commit it,
|
|
405
|
+
attach it to the PR, hand it to an auditor.
|
|
406
|
+
|
|
407
|
+
Portable, diff-bound, and honest about its gaps -- that is the claim, and it is
|
|
408
|
+
the one worth checking.
|
|
409
|
+
|
|
410
|
+
Each run writes a receipt to `.loki/proofs/<run_id>/` that separates
|
|
411
|
+
**deterministic FACTS** (the git diff with base and head SHAs plus a
|
|
412
|
+
`diff_sha256`, the test command and its exit code, the build command and its
|
|
413
|
+
exit code, each gate verdict) from **AI ASSESSMENTS** (the council verdict,
|
|
414
|
+
labeled as judgment, never as proof). The headline is computed from the facts
|
|
415
|
+
alone:
|
|
416
|
+
|
|
417
|
+
| Headline | Means |
|
|
418
|
+
|---|---|
|
|
419
|
+
| VERIFIED | tests ran a real command and exited 0, diff non-empty, nothing skipped |
|
|
420
|
+
| VERIFIED WITH GAPS | each gap listed by name |
|
|
421
|
+
| NOT VERIFIED | a check ran and failed |
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
loki proof list # every receipt from this project
|
|
425
|
+
loki proof show <id> # the facts, the assessments, and the headline
|
|
426
|
+
loki proof verify <id> # re-hash the receipt and re-derive the diff
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
`loki proof verify` exits 0 clean, 1 on tamper or drift, 2 when it could not check
|
|
430
|
+
(full table: [docs/exit-codes.md](docs/exit-codes.md)). Receipts are attached
|
|
431
|
+
to pull requests automatically (`LOKI_PROVEN_PR=0` to opt out), so a reviewer
|
|
432
|
+
sees the evidence next to the code.
|
|
433
|
+
|
|
434
|
+
**What the receipt does NOT claim.** On the unsigned path the generator is
|
|
435
|
+
trusted: someone who rewrites both the facts and the headline into a mutually
|
|
436
|
+
consistent lie and recomputes the hash will still pass verification. That is
|
|
437
|
+
defense-in-depth, not non-forgeability, and neutral non-forgeability needs the
|
|
438
|
+
signed record. We tested for exactly this and locked the limitation into the
|
|
439
|
+
suite (`tests/test-proof-forgery-defense.sh`), and in v7.111.0 we removed our
|
|
440
|
+
own earlier "non-forgeable" claim once we found it was false on that path. An
|
|
441
|
+
honest boundary you can verify beats a marketing claim you cannot.
|
|
442
|
+
|
|
443
|
+
To close that gap, receipts are signed automatically with an Ed25519 key
|
|
444
|
+
generated on first run (or your own via `LOKI_RECEIPT_SIGNING_KEY_FILE`; this needs the
|
|
445
|
+
Python `cryptography` package, otherwise the receipt stays unsigned). See [docs/SIGNED-RECEIPTS.md](docs/SIGNED-RECEIPTS.md).
|
|
446
|
+
|
|
447
|
+
## What the legacy engine guarantees
|
|
448
|
+
|
|
449
|
+
- **Verified completion** - the evidence gate (`skills/quality-gates.md`) refuses a "done" claim on an empty git diff against the run-start commit, blocks completion when tests run red, blocks when a serveable app is confirmed unhealthy (opt out `LOKI_EVIDENCE_BOOT_GATE=0`) or a credential is detected in the changed files (opt out `LOKI_EVIDENCE_SECRET_GATE=0`).
|
|
450
|
+
- **An honest checklist verifier** - each completion checklist item is checked deterministically before the completion council accepts "done". A check that cannot be established is reported as inconclusive (pending), never as a false pass or a false failure. `rc == 0` alone is not a pass: a test check goes green only on a real "N passed" signal from the runner.
|
|
451
|
+
- **Quality gates and review** - 8 quality gates (`skills/quality-gates.md`), blind 3-reviewer code review (`run.sh:run_code_review()`), anti-sycophancy checks.
|
|
452
|
+
- **Standalone verification: `loki verify`** - runs the deterministic gates (build, tests, static analysis, secret scan, dependency audit) against any branch or PR diff, including code written by other agents or humans. Exit codes 0 VERIFIED, 1 CONCERNS, 2 BLOCKED, 3 verifier error; machine-readable evidence at `.loki/verify/evidence.json`. Inconclusive evidence is reported as CONCERNS; see [docs/exit-codes.md](docs/exit-codes.md) for the known gaps, including `--fast`, which can exit 0 when nothing was scanned.
|
|
453
|
+
- **Living spec and pre-build interrogation** - `loki spec` locks a spec and detects drift; `loki grill` runs a Devil's-Advocate interrogation of the spec before you build.
|
|
454
|
+
- **Confidence is not evidence** - when the agent's self-reported confidence spikes to near-certainty, Loki forces an extra verification pass (opt out `LOKI_CONFIDENCE_SPIKE=0`).
|
|
455
|
+
- **Stops paying for failures that cannot succeed** - a positively identified permanent failure (bad credentials, unknown model, exhausted quota) exits instead of burning the retry budget; an unrecognized error still retries (opt out `LOKI_SMART_RETRY=0`).
|
|
456
|
+
- **Cross-project memory** - episodic, semantic and procedural memory with optional vector search (`memory/engine.py`).
|
|
457
|
+
- **Guided first build** - `loki quickstart` quotes the real cost and time estimate before anything is spent. `loki preview` prints the running app URL.
|
|
458
|
+
- **MCP server** - 36 tools plus 3 resources and 2 prompts (`mcp/server.py`, magic tools from `mcp/magic_tools.py`, the managed-memory tool from `mcp/managed_tools.py`). Of the 36, 35 are always available; `loki_memory_redact` only succeeds when `LOKI_MANAGED_AGENTS=true` and `LOKI_MANAGED_MEMORY=true`. Launch with `loki mcp`.
|
|
459
|
+
- **Legacy system healing** - `loki modernize heal` runs archaeology, stabilize, isolate, modernize and validate phases (`skills/healing.md`).
|
|
460
|
+
- **Self-hosted and source-available (BUSL-1.1)** - your keys, your infrastructure. Free for personal, internal and academic use.
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Loki does not lie about "done"
|
|
465
|
+
|
|
466
|
+
Most coding agents declare a task done by telling you so in a transcript. The
|
|
467
|
+
transcript is the agent's own narration; there is nothing to check. Loki Mode
|
|
468
|
+
takes a different stance: it does not call work done until the work is verified,
|
|
469
|
+
and every build produces an **Evidence Receipt** you can re-verify yourself.
|
|
470
|
+
|
|
471
|
+
The receipt separates two things most tools blur together:
|
|
472
|
+
|
|
473
|
+
- **Facts** -- deterministic, non-LLM, and re-derivable by anyone: the git diff
|
|
474
|
+
(base/head SHAs, file/insertion/deletion counts, a `diff_sha256`), the test
|
|
475
|
+
command that ran with its exit code, the build command with its exit code, and
|
|
476
|
+
each quality-gate verdict. A skeptic can recompute every one of these from the
|
|
477
|
+
same repo state.
|
|
478
|
+
- **Assessments** -- AI judgments such as the review council's verdict. These are
|
|
479
|
+
labeled explicitly as judgment, not proof, and never make the headline green on
|
|
480
|
+
their own.
|
|
481
|
+
|
|
482
|
+
The receipt's headline is computed only from the facts:
|
|
483
|
+
|
|
484
|
+
- **VERIFIED** -- tests recorded a real command, ran, and exited 0; the diff is
|
|
485
|
+
non-empty; nothing was skipped.
|
|
486
|
+
- **VERIFIED WITH GAPS** -- some facts checked out, but something was not run or
|
|
487
|
+
was inconclusive. Every gap is listed by name, so silence never reads as a pass.
|
|
488
|
+
- **NOT VERIFIED** -- a test, build, or gate ran and failed (or there was nothing
|
|
489
|
+
to verify).
|
|
490
|
+
|
|
491
|
+
This is honesty-of-done, not a claim of perfection. The receipt proves the
|
|
492
|
+
completion claim is backed by deterministic evidence and is independently
|
|
493
|
+
re-checkable; it does not claim the generated code is bug-free.
|
|
494
|
+
|
|
495
|
+
<details>
|
|
496
|
+
<summary><strong>Verify a receipt yourself -- <code>loki proof</code> commands, tamper/drift checks, proven PRs (advanced)</strong></summary>
|
|
497
|
+
|
|
498
|
+
### Verify it yourself
|
|
499
|
+
|
|
500
|
+
Receipts are written to `.loki/proofs/<run_id>/` automatically at run completion
|
|
501
|
+
(opt out with `LOKI_PROOF=0`). Inspect and re-check them with `loki proof`
|
|
502
|
+
(aliased as `loki receipt`):
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
loki proof list # every receipt: run id, time, council verdict, cost, files
|
|
506
|
+
loki proof show <id> # the full proof.json (facts, assessments, honesty)
|
|
507
|
+
loki proof verify <id> # re-check the receipt against the repo (exit 0 clean, 1 tamper/drift, 2 could not check)
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
`loki proof verify` does two independent checks and prints the result as JSON:
|
|
511
|
+
|
|
512
|
+
- **Tamper check** -- recomputes the receipt's integrity hash and compares it to
|
|
513
|
+
the recorded one. If anyone edited the receipt after it was written, `hash_ok`
|
|
514
|
+
is `false`.
|
|
515
|
+
- **Drift check** -- re-runs the diff from the recorded base SHA against the
|
|
516
|
+
current repo and compares the file/insertion/deletion counts and `diff_sha256`
|
|
517
|
+
to what the receipt recorded. If the repo no longer matches, `diff_drift` is
|
|
518
|
+
`true`.
|
|
519
|
+
|
|
520
|
+
A clean receipt prints `"ok": true` and exits 0. A tampered or drifted receipt
|
|
521
|
+
exits 1. When a check cannot run (for example a receipt with no recorded base
|
|
522
|
+
SHA), the verifier reports it as unverifiable rather than passing it silently.
|
|
523
|
+
|
|
524
|
+
```json
|
|
525
|
+
{
|
|
526
|
+
"hash_ok": true,
|
|
527
|
+
"diff_drift": false,
|
|
528
|
+
"gpg_ok": "n/a",
|
|
529
|
+
"degraded": [],
|
|
530
|
+
"reason": "",
|
|
531
|
+
"ok": true
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
You can share a receipt as a self-contained HTML page (`loki proof open <id>`),
|
|
536
|
+
or publish it as a GitHub Gist with `loki proof share <id>` (opt-in; the page is
|
|
537
|
+
redacted before it leaves your machine). Receipts carry an Ed25519
|
|
538
|
+
attestation (`LOKI_RECEIPT_SIGNING_KEY_FILE` to use your own key).
|
|
539
|
+
|
|
540
|
+
### Proven PR
|
|
541
|
+
|
|
542
|
+
When Loki opens a pull request, the PR body includes the Evidence Receipt
|
|
543
|
+
summary, so a reviewer does not have to take the agent on faith. It shows the
|
|
544
|
+
honest verdict (VERIFIED / VERIFIED WITH GAPS / NOT VERIFIED), the key facts
|
|
545
|
+
(diff hash, tests, secure-gate, cost), and a "verify this yourself" line:
|
|
546
|
+
`loki proof verify <id>` against the recorded base SHA. A green claim appears
|
|
547
|
+
only when the receipt's own headline is VERIFIED. This is on by default whenever
|
|
548
|
+
Loki opens or advises a PR; opt out with `LOKI_PROVEN_PR=0`.
|
|
549
|
+
|
|
550
|
+
For a review-before-publish workflow, preparation and GitHub mutation are two
|
|
551
|
+
explicit steps:
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
loki start owner/repo#42 --prepare-pr # builds and writes exact title/body locally
|
|
555
|
+
loki ship --publish # pushes that issue branch and opens the PR
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
The second command consumes `.loki/state/pr-title.txt` and
|
|
559
|
+
`.loki/state/pr-body.md` byte-for-byte. Plain `loki ship`, previews, and default
|
|
560
|
+
start paths remain non-publishing. A failed PR creation preserves both files and
|
|
561
|
+
prints the exact remote-branch rollback command.
|
|
562
|
+
|
|
563
|
+
An optional advisory status check (`loki: verified-completion`) maps the verdict
|
|
564
|
+
to a GitHub check-run. It is opt-in (`LOKI_PROVEN_PR_CHECK=1`) and can never block
|
|
565
|
+
a merge on its own. To make verified-completion blocking, add it as a required
|
|
566
|
+
status check in your repository's branch-protection settings.
|
|
567
|
+
|
|
568
|
+
</details>
|
|
569
|
+
|
|
570
|
+
<details>
|
|
571
|
+
<summary><b>Setup details: providers, other models, what loki doctor checks</b></summary>
|
|
572
|
+
|
|
573
|
+
Other spec sources work the same way:
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
loki init my-app --template simple-todo-app # scaffold a starter PRD
|
|
577
|
+
loki start owner/repo#123 # a GitHub issue
|
|
578
|
+
loki start ./openapi.yaml # an OpenAPI/YAML spec
|
|
579
|
+
loki demo --offline # replay a sample receipt, no key, no spend
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Loki needs a model to drive. There are two ways to give it one.
|
|
583
|
+
|
|
584
|
+
**Without a separate CLI (v8).** The Claude Agent SDK ships inside Loki, so an API key alone is enough:
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
export ANTHROPIC_API_KEY=sk-... # or ANTHROPIC_AUTH_TOKEN / ANTHROPIC_BASE_URL
|
|
588
|
+
LOKI_SDK_MODE=full loki start prd.md # runs the loop and the judges through the bundled SDK
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
This needs Bun on your PATH (the SDK loop runs on the Bun runtime). `loki doctor` reports `Bundled Claude Agent SDK is usable -- no separate CLI needed` when that path is genuinely ready, and stays on the normal blocker otherwise: it checks that the SDK's platform binary is actually extracted, that credentials are present, and that the SDK loop is really the route your next run will take. It will not tell you that you are ready and then fail the build.
|
|
592
|
+
|
|
593
|
+
**With a coding-agent CLI.** The classic path, and still the default: Loki drives a separate CLI (Claude Code is the recommended one) plus a couple of common tools on your PATH.
|
|
594
|
+
|
|
595
|
+
**With a different model or provider.** Loki is not tied to Anthropic, but
|
|
596
|
+
*how* you reach another model depends on which API the endpoint speaks. There
|
|
597
|
+
are two routes, and picking the wrong one fails confusingly.
|
|
598
|
+
|
|
599
|
+
*Route 1 -- OpenAI-shaped endpoints (OpenRouter, and most hosted open models).*
|
|
600
|
+
Use a provider that speaks that API natively. `aider` and `cline` both do, and
|
|
601
|
+
Loki now defaults them to open-weight models rather than Claude:
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
loki provider set aider
|
|
605
|
+
export OPENROUTER_API_KEY=sk-or-...
|
|
606
|
+
loki start prd.md # defaults to deepseek-v3.2
|
|
607
|
+
|
|
608
|
+
export LOKI_AIDER_MODEL=openrouter/z-ai/glm-4.6 # or pick your own
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
OpenRouter serves **only** the OpenAI-shaped `/v1/chat/completions`; it has no
|
|
612
|
+
Anthropic `/v1/messages` endpoint. Pointing `ANTHROPIC_BASE_URL` at it does not
|
|
613
|
+
work, which earlier versions of this README incorrectly suggested.
|
|
614
|
+
|
|
615
|
+
[OrcaRouter](https://www.orcarouter.ai) is an OpenAI-compatible gateway that
|
|
616
|
+
also serves the Anthropic Messages API, so unlike OpenRouter the same key works
|
|
617
|
+
through Route 2 below as well as Route 1 here.
|
|
618
|
+
|
|
619
|
+
*Route 2 -- Anthropic-protocol gateways.* `ANTHROPIC_BASE_URL` routes Claude
|
|
620
|
+
Code itself, so the endpoint must speak the Anthropic Messages API. LiteLLM,
|
|
621
|
+
Bedrock proxies, and self-hosted gateways can:
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
# Ollama, fully local (no API key, no per-token cost)
|
|
625
|
+
export ANTHROPIC_BASE_URL=http://localhost:11434/v1
|
|
626
|
+
export LOKI_MODEL_OVERRIDE=<model you have pulled, e.g. the output of `ollama list`>
|
|
627
|
+
loki start prd.md
|
|
628
|
+
|
|
629
|
+
# LiteLLM / vLLM / any self-hosted gateway
|
|
630
|
+
export ANTHROPIC_BASE_URL=https://your-gateway.internal/v1
|
|
631
|
+
export ANTHROPIC_API_KEY=...
|
|
632
|
+
export LOKI_MODEL_OVERRIDE=<whatever your gateway calls the model>
|
|
633
|
+
loki start prd.md
|
|
634
|
+
|
|
635
|
+
# OrcaRouter (one key for both routes; model ids are namespaced by provider).
|
|
636
|
+
# The bare host is deliberate here: the Anthropic SDK appends /v1/messages
|
|
637
|
+
# itself, so adding /v1 would double it.
|
|
638
|
+
export ANTHROPIC_BASE_URL=https://api.orcarouter.ai
|
|
639
|
+
export ANTHROPIC_API_KEY=sk-orca-...
|
|
640
|
+
export LOKI_MODEL_OVERRIDE=<namespaced id, e.g. anthropic/claude-sonnet-5>
|
|
641
|
+
loki start prd.md
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
**Set both variables.** `LOKI_MODEL_OVERRIDE` is what makes the alt-provider
|
|
645
|
+
path work: without it Loki keeps asking for `opus` / `sonnet` / `haiku`, which
|
|
646
|
+
only Anthropic resolves, and most providers reject those names outright. A
|
|
647
|
+
proxy that maps the aliases for you (LiteLLM can) is the one exception.
|
|
648
|
+
|
|
649
|
+
Model IDs are not listed here on purpose -- OpenRouter's catalogue changes every
|
|
650
|
+
week, and a stale ID in a README is a failure you would hit at runtime. Take the
|
|
651
|
+
exact string from your provider's own model list.
|
|
652
|
+
|
|
653
|
+
Both routes honor these variables identically -- the bundled-SDK path and the
|
|
654
|
+
Claude Code CLI path -- and `loki doctor` reports the endpoint it detected plus a
|
|
655
|
+
warning if the model override is missing.
|
|
656
|
+
|
|
657
|
+
The quality gates, the completion council, and the Evidence Receipt do not care
|
|
658
|
+
which model produced the code. They check what was actually built.
|
|
659
|
+
|
|
660
|
+
Either way, run `loki doctor` any time and it tells you exactly what is present and what is missing, with a copy-pasteable install command for each gap.
|
|
661
|
+
|
|
662
|
+
**What Loki needs (and what `loki doctor` checks)**
|
|
663
|
+
|
|
664
|
+
Required:
|
|
665
|
+
|
|
666
|
+
- An agent provider CLI: [Claude Code](https://docs.claude.com/en/docs/claude-code) (`claude`, Tier 1, recommended and E2E-verified - the provider Loki Mode is built for). Cline, Codex, Aider, and opencode are supported as experimental providers (wiring in place; not yet E2E-verified by us). Loki cannot run a build without one of these installed and authenticated.
|
|
667
|
+
- Python 3.8+ (`python3`) for the dashboard, memory system, and orchestration helpers.
|
|
668
|
+
- Node.js 18+ (`node`) for the npm install path and the bundled runtime.
|
|
669
|
+
- `jq` for the JSON that the shell flows and the quality gates parse.
|
|
670
|
+
- Git 2.x (`git`) for checkpoints and worktrees.
|
|
671
|
+
- `curl` for installation and network calls.
|
|
672
|
+
|
|
673
|
+
Recommended:
|
|
674
|
+
|
|
675
|
+
- Bun 1.3.0+ (`bun`) for the fast runtime (the recommended install path above installs it).
|
|
676
|
+
- Docker if you want Loki's App Runner to run containerized projects, or to run Loki itself from the published image.
|
|
677
|
+
|
|
678
|
+
You also need credentials for whichever provider you use (for Claude Code, an authenticated `claude` login or `ANTHROPIC_API_KEY`). `loki doctor` flags a missing or unauthenticated provider as the first thing to fix.
|
|
679
|
+
|
|
680
|
+
If you do not have Bun yet:
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
curl -fsSL https://bun.sh/install | bash # macOS / Linux (or: brew install oven-sh/bun/bun)
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
Docker without installing loki locally: `loki docker start prd.md` runs it in the
|
|
687
|
+
published image with zero config, bind-mounting the current folder so `.loki`
|
|
688
|
+
state and resume work exactly like local. See [DOCKER_README.md](DOCKER_README.md).
|
|
689
|
+
|
|
690
|
+
Upgrading: `loki self-update` auto-detects which package manager installed loki
|
|
691
|
+
and runs the right upgrade. `loki self-update --to bun` migrates an npm install
|
|
692
|
+
to Bun in one command. `loki self-update --check` shows the install path.
|
|
693
|
+
|
|
694
|
+
See the [Installation Guide](docs/INSTALLATION.md) for the long form.
|
|
695
|
+
|
|
696
|
+
</details>
|
|
697
|
+
|
|
698
|
+
---
|
|
699
|
+
|
|
700
|
+
<details>
|
|
701
|
+
<summary><strong>Runtime architecture: dual Bash/Bun runtime and the rollback flag</strong></summary>
|
|
702
|
+
|
|
703
|
+
Loki Mode runs a dual runtime by design: the Bash engine is the stable core (the autonomous loop, quality gates and completion council), and newer product surfaces are TypeScript/Bun modules that wrap it. Bash support is not going away.
|
|
704
|
+
|
|
705
|
+
- Commands routed to the Bun runtime when `bun` is on `PATH` (the router is `bin/loki`): `version`, `--version`, `-v`, `status`, `stats`, `doctor`, `provider`, `memory`, `rollback`, `kpis`, `trust`, `proof`, `receipt`, `wiki`, `crash`, `internal`, and `report kpis`. Every other command runs on the Bash CLI (`autonomy/loki`), including the autonomous `loki start` loop (`autonomy/run.sh`), unless `LOKI_SDK_LOOP` or `LOKI_SDK_MODE=full` selects the Bun loop.
|
|
706
|
+
- If `bun` is not on `PATH`, the shim falls through to Bash silently.
|
|
707
|
+
- Force every command onto the Bash path with `LOKI_LEGACY_BASH=1 loki <cmd>`. This is a rollback flag for the Bun route; it is not the same as the legacy engine switch.
|
|
708
|
+
|
|
709
|
+
See [UPGRADING.md](UPGRADING.md) and [ADR-001: Runtime Migration](docs/architecture/ADR-001-runtime-migration.md).
|
|
710
|
+
|
|
711
|
+
</details>
|
|
712
|
+
|
|
713
|
+
<details>
|
|
714
|
+
<summary><strong>Supported spec formats</strong></summary>
|
|
715
|
+
|
|
716
|
+
A "spec" is whatever you hand `loki start`. Loki auto-detects the format and normalises it before the RARV loop. A Markdown PRD is one form of spec; the table below lists every input the CLI accepts.
|
|
717
|
+
|
|
718
|
+
| Format | Example | Notes |
|
|
719
|
+
|--------|---------|-------|
|
|
720
|
+
| Markdown PRD | `loki start ./prd.md` | Canonical form. Headings become section anchors. |
|
|
721
|
+
| JSON spec | `loki start ./spec.json` | Free-form JSON; keys surfaced to agents. |
|
|
722
|
+
| YAML spec | `loki start ./openapi.yaml` | OpenAPI / AsyncAPI / plain YAML all accepted. An OpenAPI/GraphQL/Postman contract expands into a per-operation build checklist (one item per operationId/field/request) so no operation is lost to prompt truncation (v8.0.0). |
|
|
723
|
+
| Plain text brief | `loki start ./brief.txt` | One-paragraph briefs work; complexity auto-detects to "simple". |
|
|
724
|
+
| GitHub issue URL | `loki start https://github.com/owner/repo/issues/42` | Title + body + labels become the spec. |
|
|
725
|
+
| GitHub shorthand | `loki start owner/repo#42` | Same as above, shorter. |
|
|
726
|
+
| Jira ticket key | `loki start PROJ-456` | Requires `JIRA_BASE_URL` + `JIRA_TOKEN` env vars. |
|
|
727
|
+
| GitLab / Azure DevOps URL | `loki start https://gitlab.com/group/proj/-/issues/7` | GitLab and Azure DevOps issue URLs both supported. |
|
|
728
|
+
| Bare issue number | `loki start #123` or `loki start 123` | Resolved against the current repo's `origin` remote. |
|
|
729
|
+
| OpenSpec change directory | `loki start --openspec ./openspec/change-001` | Reads OpenSpec change manifest + delta files. |
|
|
730
|
+
| Auto-detect (no input) | `loki start` | Picks up `./prd.md`, `./spec.{json,yaml,yml}`, or `./SPEC.md` from cwd. |
|
|
731
|
+
|
|
732
|
+
All formats land in the same RARV pipeline and pass the same 8 quality gates (`skills/quality-gates.md`).
|
|
733
|
+
|
|
734
|
+
</details>
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## Internal architecture (legacy engine)
|
|
739
|
+
|
|
740
|
+
- **RARV cycle** - every iteration: Reason (read state), Act (execute, commit), Reflect (update context), Verify (run tests, check spec). Failures trigger self-correction. [Core Workflow](references/core-workflow.md)
|
|
741
|
+
- **8 quality gates** - static analysis, test suite (pass/fail), blind 3-reviewer code review with severity blocking, anti-sycophancy Devil's Advocate, mock-integrity detection, test-mutation detection, documentation coverage, and Magic Modules debate. Backward compatibility is a conditional healing-mode auditor, not one of the 8. [Quality Gates](skills/quality-gates.md)
|
|
742
|
+
- **Memory** - episodic (interaction traces), semantic (generalized patterns), procedural (learned skills). Vector search optional. [Memory Architecture](references/memory-system.md)
|
|
743
|
+
- **Dashboard** - real-time monitoring, task queue, WebSocket streaming and a Live App Preview. Starts at `localhost:57374`. [Dashboard Guide](docs/dashboard-guide.md)
|
|
744
|
+
- **Enterprise layer** - TLS, OIDC bearer-token validation (the foundation for SSO; browser SAML login is roadmap), scoped RBAC, OTEL tracing and audit logs, activated via env vars. See [Enterprise Identity Roadmap](docs/ENTERPRISE-IDENTITY-ROADMAP.md) and [Enterprise Guide](docs/enterprise/architecture.md).
|
|
745
|
+
|
|
746
|
+
For how Loki compares with other tools, see [docs/COMPARISON.md](docs/COMPARISON.md) and [docs/EVALUATING.md](docs/EVALUATING.md).
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
## CLI Reference
|
|
751
|
+
|
|
752
|
+
<details>
|
|
753
|
+
<summary><strong>All commands</strong></summary>
|
|
754
|
+
|
|
755
|
+
| Command | Description |
|
|
756
|
+
|---------|-------------|
|
|
757
|
+
| `loki start [PRD]` | Start with optional PRD file (also accepts an issue ref; replaces deprecated `loki run`). Auto-opens the dashboard in the browser for interactive runs and passes native `--effort`/`--max-budget-usd`/`--fallback-model` for resilience (v7.25.0) |
|
|
758
|
+
| `loki stop` | Stop execution |
|
|
759
|
+
| `loki modernize heal <path>` | Legacy system healing (archaeology, stabilize, isolate, modernize, validate -- v6.67.0; was: `loki heal`) |
|
|
760
|
+
| `loki pause` / `resume` | Pause/resume after current session |
|
|
761
|
+
| `loki steer "<note>"` | Nudge a running build with a directive (writes `.loki/HUMAN_INPUT.md`; the loop reads it when `LOKI_PROMPT_INJECTION=1`) (v8.0.0) |
|
|
762
|
+
| `loki status` | Show current status |
|
|
763
|
+
| `loki why` | Explain the last outcome; on a stalled run names the real stall reason (proactive stuck-detector + convergence signal) and suggests `loki steer` (v8.0.0) |
|
|
764
|
+
| `loki cockpit` | Live multi-repo status as an inline terminal image (Kitty/iTerm2/WezTerm/Ghostty); text + dashboard fallback elsewhere (v7.126.0) |
|
|
765
|
+
| `loki dashboard` | Open web dashboard |
|
|
766
|
+
| `loki preview` | Print running app URL and open in browser (Live App Preview, v7.24.0; was: `loki open`) |
|
|
767
|
+
| `loki web` | Launch Purple Lab web UI [DEPRECATED in v7.44.0 -- use `loki start` which auto-opens the dashboard at http://localhost:57374; for the hosted platform see Autonomi Cloud] |
|
|
768
|
+
| `loki doctor` | Check environment and dependencies |
|
|
769
|
+
| `loki plan [PRD]` | Pre-execution analysis: complexity, cost, iterations |
|
|
770
|
+
| `loki review [--staged\|--diff]` | AI-powered code review with severity filtering |
|
|
771
|
+
| `loki test [--file\|--dir\|--changed]` | AI test generation |
|
|
772
|
+
| `loki analyze onboard [path]` | Project analysis and CLAUDE.md generation (was: `loki onboard`) |
|
|
773
|
+
| `loki import` | Import GitHub issues as tasks |
|
|
774
|
+
| `loki ci` | CI/CD quality gate integration |
|
|
775
|
+
| `loki failover` | Cross-provider auto-failover management |
|
|
776
|
+
| `loki memory <cmd>` | Memory system: index, timeline, search, consolidate |
|
|
777
|
+
| `loki enterprise` | Enterprise feature management |
|
|
778
|
+
| `loki version` | Show version |
|
|
779
|
+
|
|
780
|
+
</details>
|
|
781
|
+
|
|
782
|
+
Run `loki --help` for all options. Full reference: [CLI Reference](wiki/CLI-Reference.md) | Config: [config.example.yaml](autonomy/config.example.yaml)
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
Pass a config file to `loki start` with `--config <path>` (aliases `--env-file`, `--vars`), or set `LOKI_CONFIG_FILE`. The format is detected from the extension or content: `.yaml`/`.yml`, `.json`, or `.env` (flat `LOKI_*=value` lines). A CLI flag beats an ambient env var, which beats the `--config` file, which beats built-in defaults. Never inline a secret; reference an env var with `${VAR}`. Manage settings with `loki config show|init|edit|path|set|get`; a sample is in [autonomy/config.example.yaml](autonomy/config.example.yaml).
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
<details>
|
|
790
|
+
<summary><strong>Configuration env vars (intelligent defaults, opt-out knobs)</strong></summary>
|
|
791
|
+
|
|
792
|
+
Loki Mode's accuracy and autonomy behaviors are default-on. Each is an opt-out escape hatch, not a setting you have to discover. The most relevant knobs from the v7.41.x accuracy/autonomy hardening:
|
|
793
|
+
|
|
794
|
+
| Env var | Default | Effect |
|
|
795
|
+
|---------|---------|--------|
|
|
796
|
+
| `LOKI_REVIEW_INCONCLUSIVE_BLOCK` | `1` | Blocks completion when a code-review round returns zero usable verdicts (an all-empty review proves nothing). Set `0` to record the inconclusive result without blocking. |
|
|
797
|
+
| `LOKI_COMPLETION_TEST_CAPTURE` | `1` | Captures fresh test results before the verified-completion evidence gate evaluates. Set `0` to skip the pre-gate capture. |
|
|
798
|
+
| `LOKI_AUTO_DOCS` | `true` | Generates the `.loki/docs/` suite before the documentation gate scores it (bounded: once per run when docs are missing, and again only when >10 commits stale). Set `false` to opt out. |
|
|
799
|
+
| `LOKI_CAVEMAN` | `1` (on) | Output-token compressor for free-form generation only (never trust-gate subcalls). Set `0` to opt out. |
|
|
800
|
+
| `LOKI_CAVEMAN_LEVEL` | inferred | Compression level for the compressor. Auto-inferred per invocation from the run's RARV tier; set explicitly (`lite` / `full` / `ultra`) to override the inference. |
|
|
801
|
+
| `LOKI_CONFIDENCE_SPIKE` | `1` (on) | Forces one EXTRA verification pass when the agent's self-reported confidence spikes, instead of trusting the claim. Strictly additive -- it can never skip a gate. Set `0` to opt out; tune with `LOKI_CONFIDENCE_SPIKE_DELTA` (default `40`) and `LOKI_CONFIDENCE_SPIKE_MIN` (default `90`). |
|
|
802
|
+
| `LOKI_GOAL_SCORING` | `1` (on) | Flags a goal with no measurable success condition and asks for a threshold, metric, or concrete artifact. Advisory only -- never blocks a build or rewrites the goal. Set `0` to opt out. |
|
|
803
|
+
| `LOKI_SMART_RETRY` | `1` (on) | Stops early on a positively-identified permanent failure (bad credentials, unknown model, exhausted quota) rather than burning retries. Unrecognized errors and rate limits still retry as before. Set `0` to retry every failure. |
|
|
804
|
+
| `LOKI_SIMPLE` | `0` (off) | EXPERIMENTAL. Strips the coaching half of the system prompt -- the RARV cycle, SDLC phases and memory habits that a frontier model already does natively. Per-iteration state (which gate failed, self-heal output, checklist status) is never touched, because that is information the model cannot derive. Measured at -78% prompt size, ~1562 tokens per iteration, on both the bash and Bun routes. INERT on degraded providers (Codex, Aider): those take an earlier return path whose prompt is already minimal by design, so the flag has nothing to strip there -- a measured zero, not an untested case. Whether it changes build speed or quality is NOT yet measured, so treat it as an experiment, not a tuning knob: run `benchmarks/run-prompt-ablation.sh` on your own workload before adopting it. |
|
|
805
|
+
|
|
806
|
+
This is a subset. See the [wiki](wiki/Home.md) for the full env-var reference and the RARV-C closure knobs (`LOKI_INJECT_FINDINGS`, `LOKI_OVERRIDE_COUNCIL`, `LOKI_AUTO_LEARNINGS`, `LOKI_HANDOFF_MD`).
|
|
807
|
+
|
|
808
|
+
</details>
|
|
809
|
+
|
|
810
|
+
<details>
|
|
811
|
+
<summary><strong>BMAD Method Integration</strong></summary>
|
|
812
|
+
|
|
813
|
+
Loki Mode integrates with the [BMAD Method](https://github.com/bmad-code-org/BMAD-METHOD), a structured AI-driven agile methodology. If your project uses BMAD for requirements elicitation, Loki Mode can consume those artifacts directly:
|
|
814
|
+
|
|
815
|
+
```bash
|
|
816
|
+
loki start --bmad-project ./my-project
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
The adapter handles BMAD's frontmatter conventions, FR-format functional requirements, Given/When/Then acceptance criteria, and artifact chain validation. Non-BMAD projects are unaffected -- the integration is opt-in via `--bmad-project`.
|
|
820
|
+
|
|
821
|
+
See [BMAD Integration Validation](docs/architecture/bmad-integration-validation.md).
|
|
822
|
+
|
|
823
|
+
</details>
|
|
824
|
+
|
|
825
|
+
<details>
|
|
826
|
+
<summary><strong>Enterprise Features</strong></summary>
|
|
827
|
+
|
|
828
|
+
Enterprise features are included but require env var activation.
|
|
829
|
+
|
|
830
|
+
```bash
|
|
831
|
+
export LOKI_ENTERPRISE_AUTH=true # token auth (dashboard/auth.py)
|
|
832
|
+
export LOKI_OIDC_ISSUER=https://accounts.google.com
|
|
833
|
+
export LOKI_OIDC_CLIENT_ID=your-client-id # OIDC needs issuer + client id
|
|
834
|
+
export LOKI_ENTERPRISE_AUDIT=true # force audit logging on
|
|
835
|
+
export LOKI_TLS_CERT=/path/cert.pem # HTTPS: set BOTH cert and key
|
|
836
|
+
export LOKI_TLS_KEY=/path/key.pem
|
|
837
|
+
loki enterprise status
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
[Enterprise Architecture](docs/enterprise/architecture.md) | [Security](docs/enterprise/security.md) | [Authentication](docs/authentication.md) | [Authorization](docs/authorization.md) | [Metrics](docs/metrics.md) | [Audit Logging](docs/audit-logging.md)
|
|
841
|
+
|
|
842
|
+
</details>
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
---
|
|
846
|
+
|
|
847
|
+
## Limitations
|
|
848
|
+
|
|
849
|
+
| Area | What Works | What Doesn't (Yet) |
|
|
850
|
+
|------|-----------|---------------------|
|
|
851
|
+
| **Code Gen** | Full-stack apps from PRDs | Complex domain logic may need human review |
|
|
852
|
+
| **Deploy** | Generates configs, Dockerfiles, CI/CD; `loki deploy` prints the exact deploy command | Does not deploy: a human runs the printed command (Loki never runs a cloud CLI or git push) |
|
|
853
|
+
| **Testing** | 8 automated quality gates | Test quality depends on AI assertions |
|
|
854
|
+
| **Providers** | Claude, Cline, Codex, Aider and opencode | Non-Claude providers are experimental and mostly sequential |
|
|
855
|
+
| **Dashboard** | Real-time single-machine monitoring | No multi-node clustering |
|
|
856
|
+
| **Loki 10** | The v10 run, `status`, `verify`, `dashboard` | Not the default yet; `loki modernize <repo> --to` runs `--dry-run` only; Slack is not wired in |
|
|
857
|
+
|
|
858
|
+
> **What "autonomous" means:** the system runs RARV cycles without prompting. It does NOT access your cloud accounts, payment systems or external services unless you provide credentials. Human oversight is expected for deployment, API keys and critical decisions.
|
|
859
|
+
|
|
860
|
+
---
|
|
861
|
+
|
|
862
|
+
## Research Foundation
|
|
863
|
+
|
|
864
|
+
<details>
|
|
865
|
+
<summary><strong>Papers and sources</strong></summary>
|
|
866
|
+
|
|
867
|
+
| Source | What We Use |
|
|
868
|
+
|--------|-------------|
|
|
869
|
+
| [Anthropic: Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) | Evaluator-optimizer, parallelization |
|
|
870
|
+
| [Anthropic: Constitutional AI](https://www.anthropic.com/research/constitutional-ai-harmlessness-from-ai-feedback) | Self-critique against quality principles |
|
|
871
|
+
| [DeepMind: Scalable Oversight via Debate](https://deepmind.google/research/publications/34920/) | Debate-based verification in council review |
|
|
872
|
+
| [DeepMind: SIMA 2](https://deepmind.google/blog/sima-2-an-agent-that-plays-reasons-and-learns-with-you-in-virtual-3d-worlds/) | Self-improvement loop design |
|
|
873
|
+
| [OpenAI: Agents SDK](https://openai.github.io/openai-agents-python/) | Guardrails, tripwires, tracing |
|
|
874
|
+
| [NVIDIA ToolOrchestra](https://github.com/NVlabs/ToolOrchestra) | Efficiency metrics, reward signals |
|
|
875
|
+
| [CONSENSAGENT (ACL 2025)](https://aclanthology.org/2025.findings-acl.1141/) | Anti-sycophancy in blind review |
|
|
876
|
+
| [GoalAct](https://arxiv.org/abs/2504.16563) | Hierarchical planning for complex PRDs |
|
|
877
|
+
|
|
878
|
+
**Practitioner insights:** Boris Cherny, Simon Willison, [HN Community](https://news.ycombinator.com/item?id=44623207)
|
|
879
|
+
|
|
880
|
+
**[Full Acknowledgements](docs/ACKNOWLEDGEMENTS.md)** -- 50+ papers and resources
|
|
881
|
+
|
|
882
|
+
</details>
|
|
883
|
+
|
|
884
|
+
---
|
|
885
|
+
|
|
886
|
+
## Contributing
|
|
887
|
+
|
|
888
|
+
```bash
|
|
889
|
+
git clone https://github.com/asklokesh/loki-mode.git && cd loki-mode
|
|
890
|
+
npm install && npm test # CLI + Node test suites
|
|
891
|
+
python3 -m pytest # Python test suite
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
895
|
+
|
|
896
|
+
## License
|
|
897
|
+
|
|
898
|
+
[Business Source License 1.1](LICENSE) -- Free for personal, internal, academic, and non-commercial use. Converts to Apache 2.0 on March 19, 2030. Contact founder@autonomi.dev for commercial licensing.
|
|
899
|
+
|
|
900
|
+
---
|
|
901
|
+
|
|
902
|
+
<div align="center">
|
|
903
|
+
|
|
904
|
+
**[Autonomi](https://www.autonomi.dev/)** | **[Documentation](wiki/Home.md)** | **[Changelog](CHANGELOG.md)** | **[Comparisons](references/competitive-analysis.md)**
|
|
58
905
|
|
|
59
|
-
|
|
906
|
+
</div>
|