loki-mode 8.1.0 → 8.3.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.
package/README.md CHANGED
@@ -15,16 +15,102 @@ _The free, source-available autonomous coding agent by [Autonomi](https://www.au
15
15
 
16
16
  [Website](https://www.autonomi.dev/) | [Documentation](wiki/Home.md) | [Installation](docs/INSTALLATION.md) | [Changelog](CHANGELOG.md) | [Purple Lab -- deprecated v7.44.0](#purple-lab)
17
17
 
18
- **Current release: v8.0.0**
18
+ **Current release: v8.3.0**
19
19
 
20
20
  </div>
21
21
 
22
22
  ---
23
23
 
24
+ ## See the receipt before you install anything
25
+
26
+ Every agent claims it finished. Ours hands you an artifact you can check:
27
+
28
+ ```bash
29
+ npx loki-mode tour # no install, no API key, no spend, no network
30
+ ```
31
+
32
+ That prints a real Evidence Receipt from a past build. Note what it says:
33
+
34
+ ```
35
+ Headline: VERIFIED WITH GAPS
36
+
37
+ | Fact | Value |
38
+ | Files changed | 8 |
39
+ | Diff sha256 | c2be6fff3e774c387f276277b25fc424f07b667… |
40
+ | Tests | verified (node-test) |
41
+ | Build | not_run |
42
+ | Security | findings |
43
+ | Cost | $10.3218 |
44
+ ```
45
+
46
+ **"WITH GAPS" is the point.** Build was not run. Security has findings. The
47
+ receipt says so on its own front page, and separates deterministic FACTS -- the
48
+ diff hash, the test result, the cost -- from AI ASSESSMENTS, because only four
49
+ of the eight quality gates are agent-independent and a receipt that implied
50
+ otherwise would be marketing.
51
+
52
+ Recompute the diff hash yourself and check it matches. That is the whole idea:
53
+ you are not asked to trust the agent's self-report.
54
+
55
+ Self-reported completion is the failure users actually hit. A survey of the
56
+ open issue trackers of seven coding harnesses (OpenHands, Cline, Aider,
57
+ SWE-agent, Roo-Code, OpenCode, Continue) found the recurring complaint is the
58
+ agent silently not doing the work -- "always stuck at Preparing write"
59
+ ([opencode#11112](https://github.com/anomalyco/opencode/issues/11112), 76
60
+ comments), "Continue not making changes to code"
61
+ ([continue#7143](https://github.com/continuedev/continue/issues/7143)), "Agent
62
+ does not execute functions"
63
+ ([continue#5696](https://github.com/continuedev/continue/issues/5696)). None of
64
+ those seven publishes a machine-checkable completion artifact.
65
+
66
+ We have not audited the closed-source products (Cursor, Devin, Replit Agent)
67
+ feature by feature, so treat this as "unclaimed as far as we can verify" rather
68
+ than a proven first. The receipt stands on its own either way: run the tour and
69
+ check the hash.
70
+
71
+ **Evaluating this against something else?** [docs/EVALUATING.md](docs/EVALUATING.md)
72
+ puts a runnable command next to every claim we make, and states plainly what we
73
+ do not have (no enterprise case studies, no independent benchmark placement, and
74
+ generation is not air-gapped). It ends with the one question worth asking any
75
+ agent vendor, including us.
76
+
77
+ ---
78
+
24
79
  > **How it works:** Drop a spec -- a PRD, GitHub issue, OpenAPI/JSON/YAML, or one-line brief. Loki Mode classifies complexity (`run.sh:detect_complexity()`), assembles an agent team from 41 specialized agent roles across 8 domains - prompt-defined specifications the orchestrator adopts per phase, with parallel review (blind council) and optional worktree streams on Claude Code, sequential on 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.
25
80
 
26
81
  ---
27
82
 
83
+ ## Already have a codebase? Start read-only.
84
+
85
+ Most agents are built to create new apps. The harder, more valuable problem is
86
+ the ten-year-old repo that pays the bills. Loki works on both, and on an
87
+ existing codebase it starts by **changing nothing**:
88
+
89
+ ```bash
90
+ loki modernize heal ./your-repo --assess # read-only. no writes, no commits.
91
+ loki modernize heal ./your-repo --assess --json # same, machine-readable
92
+ ```
93
+
94
+ You get a modernization readiness report: language mix, a 4-level maturity
95
+ rating, technical-debt signals (test coverage, TODO density, oversized files,
96
+ dependency staleness), and a **ranked list of where to start** -- ordered by
97
+ blast radius, so the first change is the one least likely to break something.
98
+
99
+ Then, if you want it to act:
100
+
101
+ ```bash
102
+ loki modernize heal ./your-repo --strict # block ALL behavioral change without approval
103
+ loki modernize heal ./your-repo --phase archaeology # extract knowledge only
104
+ loki modernize heal ./your-repo --compliance healthcare # or fintech | government
105
+ ```
106
+
107
+ The healing pipeline runs in phases -- archaeology, stabilize, isolate,
108
+ modernize, validate -- and the validate phase checks **behavioral equivalence
109
+ against the pre-change baseline**, not just that the tests are green. Friction
110
+ points (the weird code that exists for a reason nobody remembers) are cataloged
111
+ before anything touches them, because in a legacy system the strange code is
112
+ usually load-bearing.
113
+
28
114
  ## The Evidence Receipt: don't trust the agent, check it
29
115
 
30
116
  Every coding agent tells you it finished. Loki hands you something you can
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Autonomous spec-driven build system with a built-in trust layer. It does not call work done until it is verified (RARV-C closure loop, 8 quality gates, completion council, verified-completion evidence gate). Triggers on "Loki Mode". Takes a spec (PRD, GitHub issue, OpenAPI doc, etc.) to deployed product with minimal human intervention. Provider-agnostic. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v8.1.0
6
+ # Loki Mode v8.2.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -469,4 +469,4 @@ See `CHANGELOG.md` entries [7.5.7], [7.5.8], [7.5.13] for the per-fix list and r
469
469
 
470
470
  ---
471
471
 
472
- **v8.1.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~410 lines core**
472
+ **v8.2.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~410 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 8.1.0
1
+ 8.3.0
@@ -2267,11 +2267,17 @@ PYEOF
2267
2267
  if [ -z "$_nm_cc_dir" ] || [ ! -f "$_nm_scanner" ]; then
2268
2268
  _nm_status="INCONCLUSIVE:scanner_unavailable"
2269
2269
  else
2270
+ # STDIN, not an env var: a single env string is capped at
2271
+ # MAX_ARG_STRLEN (131071 bytes) on Linux, so a large changed-file
2272
+ # union makes execve fail with E2BIG and this gate silently
2273
+ # degrades to inconclusive (pass-through). macOS has no per-string
2274
+ # cap, so that failure mode was Linux-only.
2270
2275
  _nm_status=$(
2271
- _NM_FILES="$_nm_files" \
2272
- _NM_TREE="." \
2273
- python3 -I "$_nm_scanner" 2>/dev/null \
2274
- || echo "INCONCLUSIVE:detector_error"
2276
+ printf '%s\n' "$_nm_files" | {
2277
+ _NM_TREE="." \
2278
+ python3 -I "$_nm_scanner" 2>/dev/null \
2279
+ || echo "INCONCLUSIVE:detector_error"
2280
+ }
2275
2281
  )
2276
2282
  fi
2277
2283
  case "$_nm_status" in
@@ -3135,6 +3141,25 @@ ISSUES: CRITICAL:description (optional, one per line per issue)"
3135
3141
  _provider_rc=$?
3136
3142
  fi
3137
3143
  ;;
3144
+ *)
3145
+ # v8.2.0 TIMEOUT SEAM. Any provider exposing provider_invoke_argv can
3146
+ # cast a real council vote instead of falling straight to the
3147
+ # heuristic. argv is a REAL command, so `timeout` bounds it exactly as
3148
+ # it bounds the named arms above (providers/claude.sh:321).
3149
+ #
3150
+ # SEMANTICS PRESERVED: _provider_rc is captured the same way, so the
3151
+ # bash-F4 safe default below still forces a conservative REJECT on a
3152
+ # timeout kill (124/137/143). An empty verdict falls to
3153
+ # council_heuristic_review, identical to a missing CLI today.
3154
+ if type provider_invoke_argv >/dev/null 2>&1; then
3155
+ provider_invoke_argv fast "$prompt"
3156
+ # caveman HARD-SUPPRESS: this vote is parsed for "VOTE:".
3157
+ verdict=$(timeout "${LOKI_COUNCIL_REVIEW_TIMEOUT:-600}" \
3158
+ env CAVEMAN_DEFAULT_MODE=off \
3159
+ "${_LOKI_INVOKE_ARGV[@]+"${_LOKI_INVOKE_ARGV[@]}"}" 2>/dev/null)
3160
+ _provider_rc=$?
3161
+ fi
3162
+ ;;
3138
3163
  esac
3139
3164
 
3140
3165
  # bash-F4 (WAVE10 SAFE-DEFAULT): a provider timeout (124, incl. 128+SIGTERM
@@ -3303,6 +3328,22 @@ REASON: your reasoning"
3303
3328
  verdict=$(timeout "${LOKI_COUNCIL_REVIEW_TIMEOUT:-600}" aider --message "$prompt" --yes-always --no-auto-commits --no-git 2>/dev/null)
3304
3329
  fi
3305
3330
  ;;
3331
+ *)
3332
+ # v8.2.0 TIMEOUT SEAM (contrarian / devil's-advocate vote). Same
3333
+ # rationale as the member vote: a real argv keeps the `timeout`
3334
+ # bound that a shell function would silently remove.
3335
+ #
3336
+ # SEMANTICS PRESERVED: this path tracks no _provider_rc by design --
3337
+ # an empty verdict (timeout or failure) already routes to the
3338
+ # conservative REJECT fallback immediately below.
3339
+ if type provider_invoke_argv >/dev/null 2>&1; then
3340
+ provider_invoke_argv fast "$prompt"
3341
+ # caveman HARD-SUPPRESS: parsed for "VOTE:".
3342
+ verdict=$(timeout "${LOKI_COUNCIL_REVIEW_TIMEOUT:-600}" \
3343
+ env CAVEMAN_DEFAULT_MODE=off \
3344
+ "${_LOKI_INVOKE_ARGV[@]+"${_LOKI_INVOKE_ARGV[@]}"}" 2>/dev/null)
3345
+ fi
3346
+ ;;
3306
3347
  esac
3307
3348
 
3308
3349
  if [ -z "$verdict" ]; then
@@ -441,7 +441,29 @@ except Exception:
441
441
  fi
442
442
  ;;
443
443
  *)
444
- result='{"verdict":"INCONCLUSIVE","reasoning":"review not supported for this provider (no verdict obtained; NOT a rejection)","issues":[]}'
444
+ # v8.2.0 TIMEOUT SEAM. A provider exposing provider_invoke_argv gets
445
+ # a real reviewer instead of an automatic INCONCLUSIVE. The argv is a
446
+ # REAL command so `timeout` genuinely bounds it (providers/claude.sh:321);
447
+ # routing this through a shell function would silently drop the bound.
448
+ #
449
+ # VERDICT SEMANTICS UNCHANGED: on empty output, non-zero exit, or a
450
+ # timeout kill (124/137/143) we fall back to the SAME INCONCLUSIVE
451
+ # string used below -- never REJECT. A judge that produced no
452
+ # judgement has not rejected anything (v8.1.0 TRUST-3).
453
+ result=''
454
+ if type provider_invoke_argv >/dev/null 2>&1; then
455
+ local _c2_seam_rc=0
456
+ provider_invoke_argv fast "$full_prompt"
457
+ # caveman HARD-SUPPRESS: this verdict is parsed for the JSON
458
+ # "verdict" field; compression would reword it.
459
+ result="$(timeout "${LOKI_SDK_REVIEW_TIMEOUT:-180}" \
460
+ env CAVEMAN_DEFAULT_MODE=off \
461
+ "${_LOKI_INVOKE_ARGV[@]+"${_LOKI_INVOKE_ARGV[@]}"}" 2>/dev/null)" || _c2_seam_rc=$?
462
+ [ "$_c2_seam_rc" -ne 0 ] && result=''
463
+ fi
464
+ if [ -z "$result" ]; then
465
+ result='{"verdict":"INCONCLUSIVE","reasoning":"review not supported for this provider (no verdict obtained; NOT a rejection)","issues":[]}'
466
+ fi
445
467
  ;;
446
468
  esac
447
469
 
@@ -452,6 +474,46 @@ except Exception:
452
474
  # Try removing markdown fencing
453
475
  extracted=$(echo "$result" | sed 's/^```json//;s/^```//' | sed -n '/^{/,/^}/p' | head -50)
454
476
  fi
477
+ # STRUCTURE-TOLERANT RECOVERY (v8.2.0).
478
+ #
479
+ # A strict JSON carve is the single most model-sensitive contract in the
480
+ # engine: schema adherence is exactly what varies most across models, while
481
+ # every coding model can state a verdict in prose. Measured elsewhere (Forge
482
+ # replication): scaffolding drove tool-call errors 42 -> 0 while
483
+ # advanced-reasoning accuracy stayed flat -- i.e. a harness CAN rescue
484
+ # format compliance but cannot manufacture judgment. So recovering a verdict
485
+ # the model genuinely expressed is legitimate; inventing one is not.
486
+ #
487
+ # This runs ONLY when the JSON carve produced nothing, and it accepts a
488
+ # verdict only when the model stated it UNAMBIGUOUSLY (exactly one of
489
+ # APPROVE/REJECT appears as a standalone word). A response mentioning both,
490
+ # or neither, stays INCONCLUSIVE -- never guessed.
491
+ if [ -z "$extracted" ] && [ -n "${result:-}" ]; then
492
+ local _recovered
493
+ _recovered="$(printf '%s' "$result" | _LOKI_RAW="$result" python3 -c '
494
+ import os, re, sys, json
495
+ raw = os.environ.get("_LOKI_RAW", "")
496
+ # Standalone words only: "APPROVE" not "approved-by", and not inside a URL.
497
+ approve = len(re.findall(r"(?<![A-Za-z0-9_-])APPROVE(?![A-Za-z0-9_-])", raw, re.I))
498
+ reject = len(re.findall(r"(?<![A-Za-z0-9_-])REJECT(?![A-Za-z0-9_-])", raw, re.I))
499
+ if approve and not reject:
500
+ v = "APPROVE"
501
+ elif reject and not approve:
502
+ v = "REJECT"
503
+ else:
504
+ sys.exit(1) # ambiguous or absent -> stay inconclusive
505
+ print(json.dumps({
506
+ "verdict": v,
507
+ "reasoning": "recovered from unstructured output (model stated %s in prose)" % v,
508
+ "issues": [],
509
+ "recovered": True,
510
+ }))
511
+ ' 2>/dev/null)" || _recovered=""
512
+ if [ -n "$_recovered" ]; then
513
+ extracted="$_recovered"
514
+ fi
515
+ fi
516
+
455
517
  if [ -z "$extracted" ]; then
456
518
  # The weak-model case, and the reason this matters most: a model whose
457
519
  # prose could not be carved into JSON did not vote REJECT. Recording one
package/autonomy/grill.sh CHANGED
@@ -158,6 +158,12 @@ grill_check_provider() {
158
158
  fi
159
159
  ;;
160
160
  *)
161
+ # v8.2.0: capability, not identity. Must stay in lockstep with the
162
+ # matching arm in grill_invoke_provider -- this gate runs FIRST, so
163
+ # rejecting here would make that arm dead code.
164
+ if type provider_invoke_argv >/dev/null 2>&1; then
165
+ return 0
166
+ fi
161
167
  _grill_err "grill currently supports the claude and codex providers (got: $provider)"
162
168
  return $GRILL_EXIT_ERROR
163
169
  ;;
@@ -278,6 +284,32 @@ grill_invoke_provider() {
278
284
  return 0
279
285
  ;;
280
286
  *)
287
+ # v8.2.0 TIMEOUT SEAM. Previously any other provider was a hard
288
+ # error. A provider exposing provider_invoke_argv builds a REAL argv
289
+ # (not a shell function), so _grill_with_timeout still bounds it --
290
+ # the whole reason the seam exists (providers/claude.sh:321).
291
+ # Nothing to preserve on this arm, so nothing can regress: it
292
+ # produced no output at all before.
293
+ #
294
+ # Deliberate: no --disallowedTools. That flag is claude-specific with
295
+ # no portable equivalent, so a seam-provider grill CAN write to the
296
+ # tree. Accepted; the alternative is the hard error below.
297
+ if type provider_invoke_argv >/dev/null 2>&1; then
298
+ local out
299
+ provider_invoke_argv fast "$prompt"
300
+ # env CAVEMAN_DEFAULT_MODE=off: grill output is parsed downstream
301
+ # and caveman compression would reword the questions. `env` (not a
302
+ # bare prefix) because _grill_with_timeout execs its first token.
303
+ out="$(_grill_with_timeout "${LOKI_GRILL_TIMEOUT:-180}" \
304
+ env CAVEMAN_DEFAULT_MODE=off \
305
+ "${_LOKI_INVOKE_ARGV[@]+"${_LOKI_INVOKE_ARGV[@]}"}" 2>/dev/null)"
306
+ if [ -z "$out" ]; then
307
+ _grill_err "provider returned no output (timeout or invocation error)"
308
+ return $GRILL_EXIT_ERROR
309
+ fi
310
+ printf '%s\n' "$out"
311
+ return 0
312
+ fi
281
313
  _grill_err "grill currently supports the claude and codex providers (got: $provider)"
282
314
  return $GRILL_EXIT_ERROR
283
315
  ;;
@@ -159,12 +159,24 @@ except Exception:
159
159
  return 0
160
160
  }
161
161
 
162
- # Decide whether model verification can be attempted. Returns 0 (ok) only when
163
- # the active provider is claude and not degraded. Mirrors
164
- # _loki_prd_enrich_provider_ok (autonomy/lib/prd-enrich.sh:65).
162
+ # Decide whether model verification can be attempted.
163
+ #
164
+ # v8.2.0: this used to require LOKI_PROVIDER=claude specifically, so a user on
165
+ # codex/opencode/cline/aider silently lost done-recognition. That is a
166
+ # CAPABILITY question, not an identity question -- the real requirement is "can
167
+ # we reach a model AND bound the call with a timeout". Any provider exposing the
168
+ # argv seam (provider_invoke_argv, see providers/claude.sh) satisfies both.
169
+ #
170
+ # Falls back to the historical claude-binary check when the seam is absent, so
171
+ # nothing regresses for existing installs.
165
172
  _loki_done_recog_provider_ok() {
166
- [ "${LOKI_PROVIDER:-claude}" = "claude" ] || return 1
167
173
  [ "${PROVIDER_DEGRADED:-false}" != "true" ] || return 1
174
+ # Preferred: a provider that can build a timeout-able argv.
175
+ if type provider_invoke_argv >/dev/null 2>&1; then
176
+ return 0
177
+ fi
178
+ # Legacy path: claude binary present.
179
+ [ "${LOKI_PROVIDER:-claude}" = "claude" ] || return 1
168
180
  command -v claude >/dev/null 2>&1 || return 1
169
181
  return 0
170
182
  }