loki-mode 7.5.0 → 7.5.2
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/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/loki +27 -1
- package/bin/loki +11 -1
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +39 -28
- package/loki-ts/dist/loki.js +154 -112
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/skills/quality-gates.md +68 -8
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: loki-mode
|
|
|
3
3
|
description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Loki Mode v7.5.
|
|
6
|
+
# Loki Mode v7.5.2
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -322,4 +322,4 @@ The following features are documented in skill modules but not yet fully automat
|
|
|
322
322
|
| Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
|
|
323
323
|
| Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
|
|
324
324
|
|
|
325
|
-
**v7.5.
|
|
325
|
+
**v7.5.2 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
7.5.
|
|
1
|
+
7.5.2
|
package/autonomy/loki
CHANGED
|
@@ -459,7 +459,6 @@ show_help() {
|
|
|
459
459
|
echo " setup-skill Create skill symlinks for all providers"
|
|
460
460
|
echo " self-update Upgrade loki via current manager (use --to bun|npm|brew to switch)"
|
|
461
461
|
echo " watchdog [cmd] Process health monitoring (status|help)"
|
|
462
|
-
echo " telemetry [cmd] OpenTelemetry management (status|enable|disable)"
|
|
463
462
|
echo " worktree [cmd] Parallel worktree management (list|merge|clean|status)"
|
|
464
463
|
echo " agent [cmd] Agent type dispatch (list|info|run|start|review)"
|
|
465
464
|
echo " remote [PRD] Start remote session (connect from phone/browser, Claude Pro/Max)"
|
|
@@ -6750,6 +6749,33 @@ cmd_doctor() {
|
|
|
6750
6749
|
fi
|
|
6751
6750
|
echo ""
|
|
6752
6751
|
|
|
6752
|
+
# v7.5.1 fix B23: Runtime route -- mirror loki-ts/src/commands/doctor.ts.
|
|
6753
|
+
# Informational only; does NOT contribute to pass/fail/warn counts so
|
|
6754
|
+
# the bun-parity matrix can normalize it without reconciling summary
|
|
6755
|
+
# totals across routes.
|
|
6756
|
+
echo -e "${CYAN}Runtime route:${NC}"
|
|
6757
|
+
echo -e " ${GREEN}PASS${NC} Active runtime: Bash (autonomy/loki)"
|
|
6758
|
+
if [ "${LOKI_LEGACY_BASH:-}" = "1" ] || [ "${LOKI_LEGACY_BASH:-}" = "true" ]; then
|
|
6759
|
+
echo -e " ${YELLOW}WARN${NC} LOKI_LEGACY_BASH set: shim routes every command to autonomy/loki (bash)"
|
|
6760
|
+
fi
|
|
6761
|
+
if [ -n "${LOKI_TS_ENTRY:-}" ]; then
|
|
6762
|
+
echo -e " ${GREEN}PASS${NC} LOKI_TS_ENTRY override: ${LOKI_TS_ENTRY}"
|
|
6763
|
+
fi
|
|
6764
|
+
if [ "${BUN_FROM_SOURCE:-}" = "1" ] || [ "${BUN_FROM_SOURCE:-}" = "true" ]; then
|
|
6765
|
+
echo -e " ${GREEN}PASS${NC} BUN_FROM_SOURCE set: shim prefers loki-ts/src/ over dist/"
|
|
6766
|
+
fi
|
|
6767
|
+
# v7.5.2: explicit python3.12 probe -- chromadb + sentence-transformers
|
|
6768
|
+
# require it; the generic Python 3 check passes Python 3.13/3.14 and
|
|
6769
|
+
# silently fails at runtime. Informational only.
|
|
6770
|
+
py312_path=$(command -v python3.12 2>/dev/null || true)
|
|
6771
|
+
if [ -n "$py312_path" ]; then
|
|
6772
|
+
py312_ver=$("$py312_path" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")' 2>/dev/null)
|
|
6773
|
+
echo -e " ${GREEN}PASS${NC} Python 3.12 (chromadb / sentence-transformers): ${py312_ver} at ${py312_path}"
|
|
6774
|
+
else
|
|
6775
|
+
echo -e " ${YELLOW}WARN${NC} Python 3.12 NOT on PATH -- chromadb / sentence-transformers may fail. Install via brew install python@3.12 or apt install python3.12."
|
|
6776
|
+
fi
|
|
6777
|
+
echo ""
|
|
6778
|
+
|
|
6753
6779
|
# Summary
|
|
6754
6780
|
echo -e "${BOLD}Summary:${NC} ${GREEN}$pass_count passed${NC}, ${RED}$fail_count failed${NC}, ${YELLOW}$warn_count warnings${NC}"
|
|
6755
6781
|
echo ""
|
package/bin/loki
CHANGED
|
@@ -43,6 +43,15 @@ BASH_CLI="$REPO_ROOT/autonomy/loki"
|
|
|
43
43
|
# installs because src/ is excluded by .npmignore. Now we warn once and fall
|
|
44
44
|
# back to dist if src/cli.ts is missing.
|
|
45
45
|
if [ -n "${LOKI_TS_ENTRY:-}" ]; then
|
|
46
|
+
# v7.5.1 fix B18: validate that the explicit override actually exists.
|
|
47
|
+
# Pre-v7.5.1 a typo (LOKI_TS_ENTRY=/nonexistent) produced a raw Bun
|
|
48
|
+
# "Module not found" error with no hint about the env var. Now we warn
|
|
49
|
+
# to stderr and fall through to the bash CLI so the user can still
|
|
50
|
+
# invoke commands while they fix the path.
|
|
51
|
+
if [ ! -f "$LOKI_TS_ENTRY" ]; then
|
|
52
|
+
echo "ERROR: LOKI_TS_ENTRY=$LOKI_TS_ENTRY does not exist; falling through to bash CLI. Unset the variable or fix the path." >&2
|
|
53
|
+
exec "$BASH_CLI" "$@"
|
|
54
|
+
fi
|
|
46
55
|
BUN_CLI="$LOKI_TS_ENTRY"
|
|
47
56
|
elif [ "${BUN_FROM_SOURCE:-0}" = "1" ] || [ "${BUN_FROM_SOURCE:-}" = "true" ]; then
|
|
48
57
|
if [ -f "$REPO_ROOT/loki-ts/src/cli.ts" ]; then
|
|
@@ -94,7 +103,8 @@ fi
|
|
|
94
103
|
# Two-token routes (provider show/list, memory list/index) match on the first
|
|
95
104
|
# token only; the Bun dispatcher handles subcommand routing internally.
|
|
96
105
|
case "${1:-}" in
|
|
97
|
-
version|--version|-v|status|stats|doctor|provider|memory)
|
|
106
|
+
version|--version|-v|status|stats|doctor|provider|memory|rollback)
|
|
107
|
+
# v7.5.2: rollback added (wires loki-ts/src/commands/rollback.ts).
|
|
98
108
|
exec bun "$BUN_CLI" "$@"
|
|
99
109
|
;;
|
|
100
110
|
*)
|
package/dashboard/__init__.py
CHANGED
package/docs/INSTALLATION.md
CHANGED
|
@@ -2,28 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
|
|
4
4
|
|
|
5
|
-
**Version:** v7.5.
|
|
5
|
+
**Version:** v7.5.2
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## What's New in
|
|
9
|
+
## What's New in v7.5.0
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
- `
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
11
|
+
### Phase 1 RARV-C closure (Bun route, default-off feature flags)
|
|
12
|
+
- `findings_injector.ts` -- structured per-finding records (severity, file,
|
|
13
|
+
line, reviewer) injected into the next iteration's prompt instead of bare
|
|
14
|
+
comma-separated tokens. Enable with `LOKI_INJECT_FINDINGS=1`.
|
|
15
|
+
- `counter_evidence.ts` -- 3-judge override council. Drop a
|
|
16
|
+
`.loki/state/counter-evidence-<iter>.json` to dispute reviewer findings;
|
|
17
|
+
2-of-3 approval lifts the BLOCK. Enable with `LOKI_OVERRIDE_COUNCIL=1`
|
|
18
|
+
(requires `LOKI_INJECT_FINDINGS=1`).
|
|
19
|
+
- `learnings_writer.ts` -- automatic structured learnings to
|
|
20
|
+
`.loki/state/relevant-learnings.json` on every code_review failure.
|
|
21
|
+
Enable with `LOKI_AUTO_LEARNINGS=1`.
|
|
22
|
+
- `escalation_handoff.ts` -- structured human-handoff doc to
|
|
23
|
+
`.loki/escalations/handoff-*.md` before PAUSE. Enable with
|
|
24
|
+
`LOKI_HANDOFF_MD=1`.
|
|
25
|
+
- See `skills/quality-gates.md` for full schema and reachability notes.
|
|
16
26
|
|
|
17
|
-
###
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
### Memory System (v5.15.0+)
|
|
23
|
-
- Episodic, semantic, and procedural memory layers
|
|
24
|
-
- Progressive disclosure with 3-layer loading
|
|
25
|
-
- Token economics tracking for discovery vs read tokens
|
|
26
|
-
- Optional vector search with sentence-transformers
|
|
27
|
+
### Earlier highlights still in scope
|
|
28
|
+
- Bash-to-Bun runtime migration in progress (see `UPGRADING.md`)
|
|
29
|
+
- 5-provider support: Claude (full), Codex, Gemini, Cline, Aider
|
|
30
|
+
- Memory system (episodic / semantic / procedural)
|
|
31
|
+
- ChromaDB semantic code search via MCP
|
|
27
32
|
|
|
28
33
|
---
|
|
29
34
|
|
|
@@ -52,14 +57,18 @@ The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installa
|
|
|
52
57
|
npm install -g loki-mode
|
|
53
58
|
```
|
|
54
59
|
|
|
55
|
-
Installs the `loki` CLI
|
|
60
|
+
Installs the `loki` CLI. As of v7.4.12 there is no postinstall step; run
|
|
61
|
+
`loki setup-skill` once after install to create the per-provider skill
|
|
62
|
+
symlinks (Claude Code, Codex CLI, Gemini CLI). The `loki` shim auto-routes
|
|
63
|
+
read-only commands to the Bun runtime when `bun` is on `PATH` and falls
|
|
64
|
+
back to the bash CLI otherwise.
|
|
56
65
|
|
|
57
|
-
**Prerequisites:** Node.js 18+
|
|
66
|
+
**Prerequisites:** Node.js 18+. Bun 1.3+ optional but recommended for the
|
|
67
|
+
faster routed commands and forward-compat with v8.0.0.
|
|
58
68
|
|
|
59
69
|
**What it does:**
|
|
60
|
-
- Installs the `loki` CLI binary to your PATH
|
|
61
|
-
-
|
|
62
|
-
- Each provider auto-discovers skills in its respective directory
|
|
70
|
+
- Installs the `loki` CLI binary to your PATH (`bin/loki` shim)
|
|
71
|
+
- Subsequent `loki setup-skill` creates symlinks at `~/.claude/skills/loki-mode`, `~/.codex/skills/loki-mode`, `~/.gemini/skills/loki-mode`
|
|
63
72
|
|
|
64
73
|
**Opt out of anonymous install telemetry:**
|
|
65
74
|
```bash
|
|
@@ -222,15 +231,17 @@ The `HUMAN_INPUT.md` file has security controls:
|
|
|
222
231
|
|
|
223
232
|
## Multi-Provider Support
|
|
224
233
|
|
|
225
|
-
Loki Mode
|
|
234
|
+
Loki Mode supports five providers across three tiers. Pick by capability + cost.
|
|
226
235
|
|
|
227
236
|
### Supported Providers
|
|
228
237
|
|
|
229
|
-
| Provider |
|
|
230
|
-
|
|
231
|
-
| `claude` |
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
238
|
+
| Provider | Tier | Notes |
|
|
239
|
+
|----------|------|-------|
|
|
240
|
+
| `claude` | Tier 1 (full) | Default. All features incl. Task subagents, MCP, council. |
|
|
241
|
+
| `cline` | Tier 2 | Full feature set; small models (<13B) may fail tool-use. |
|
|
242
|
+
| `codex` | Tier 3 (degraded) | Sequential only, no Task tool; aligned with `@openai/codex` v0.125+. |
|
|
243
|
+
| `gemini` | Tier 3 (degraded) | Sequential only, no Task tool; uses `--approval-mode=yolo`. |
|
|
244
|
+
| `aider` | Tier 3 (degraded) | Sequential only; `ollama_chat/<model>` works for local models. |
|
|
234
245
|
|
|
235
246
|
### Configuration
|
|
236
247
|
|
package/loki-ts/dist/loki.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var _0=Object.defineProperty;var O0=($)=>$;function T0($,Z){this[$]=O0.bind(null,Z)}var o=($,Z)=>{for(var Q in Z)_0($,Q,{get:Z[Q],enumerable:!0,configurable:!0,set:T0.bind(Z,Q)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var w0=import.meta.require;var N1={};o(N1,{lokiDir:()=>P,homeLokiDir:()=>M1,findSkillDir:()=>F0,findRepoRootForVersion:()=>B1,REPO_ROOT:()=>p});import{resolve as E,dirname as G1}from"path";import{fileURLToPath as I0}from"url";import{existsSync as n}from"fs";import{homedir as k1}from"os";function L0(){let $=E1;for(let Z=0;Z<6;Z++){if(n(E($,"VERSION"))&&n(E($,"autonomy/run.sh")))return $;let Q=G1($);if(Q===$)break;$=Q}return E(E1,"..","..","..")}function B1($){let Z=$;for(let Q=0;Q<6;Q++){if(n(E(Z,"VERSION"))&&n(E(Z,"autonomy/run.sh")))return Z;let X=G1(Z);if(X===Z)break;Z=X}return E($,"..","..","..")}function P(){return process.env.LOKI_DIR??E(process.cwd(),".loki")}function M1(){return E(k1(),".loki")}function F0(){let $=[p,E(k1(),".claude/skills/loki-mode"),process.cwd()];for(let Z of $)if(n(E(Z,"SKILL.md"))&&n(E(Z,"autonomy/run.sh")))return Z;return null}var E1,p;var v=b(()=>{E1=G1(I0(import.meta.url));p=L0()});var g1={};o(g1,{runOrThrow:()=>D0,run:()=>T,commandVersion:()=>k0,commandExists:()=>k,ShellError:()=>Y1});async function T($,Z={}){let Q=Bun.spawn({cmd:[...$],stdout:"pipe",stderr:"pipe",env:Z.env?{...process.env,...Z.env}:process.env,cwd:Z.cwd}),X,z;if(Z.timeoutMs&&Z.timeoutMs>0)X=setTimeout(()=>{try{Q.kill("SIGTERM")}catch{}z=setTimeout(()=>{try{Q.kill("SIGKILL")}catch{}},2000)},Z.timeoutMs);try{let[H,V,U]=await Promise.all([new Response(Q.stdout).text(),new Response(Q.stderr).text(),Q.exited]);return{stdout:H,stderr:V,exitCode:U}}finally{if(X)clearTimeout(X);if(z)clearTimeout(z)}}async function D0($,Z={}){let Q=await T($,Z);if(Q.exitCode!==0)throw new Y1(`command failed (${Q.exitCode}): ${$.join(" ")}`,Q.exitCode,Q.stdout,Q.stderr);return Q}async function k($){let Z=E0($),Q=await T(["sh","-c",`command -v ${Z}`],{timeoutMs:5000});if(Q.exitCode===0)return Q.stdout.trim()||null;return null}function E0($){if(!/^[A-Za-z0-9._/-]+$/.test($))throw Error(`refused to shell-escape suspect token: ${$}`);return $}async function k0($,Z="--version"){if(!await k($))return null;let X=await T([$,Z],{timeoutMs:5000});if(X.exitCode!==0)return null;return((X.stdout||X.stderr).split(/\r?\n/)[0]?.trim()??"")||null}var Y1;var y=b(()=>{Y1=class Y1 extends Error{message;exitCode;stdout;stderr;constructor($,Z,Q,X){super($);this.message=$;this.exitCode=Z;this.stdout=Q;this.stderr=X;this.name="ShellError"}}});function h($){return N0?"":$}var N0,j,R,O,o3,q,I,_,K;var l=b(()=>{N0=(process.env.NO_COLOR??"").length>0;j=h("\x1B[0;31m"),R=h("\x1B[0;32m"),O=h("\x1B[1;33m"),o3=h("\x1B[0;34m"),q=h("\x1B[0;36m"),I=h("\x1B[1m"),_=h("\x1B[2m"),K=h("\x1B[0m")});import{existsSync as p0}from"fs";async function r(){if(e!==void 0)return e;let $="/opt/homebrew/bin/python3.12";if(p0($))return e=$,$;let Z=await k("python3.12");if(Z)return e=Z,Z;let Q=await k("python3");return e=Q,Q}async function $1($,Z={}){let Q=await r();if(!Q)return{stdout:"",stderr:"python3 not found",exitCode:127};return T([Q,"-c",$],Z)}var e;var z1=b(()=>{y()});var d1={};o(d1,{runStatus:()=>e0});import{existsSync as D,readFileSync as Z1,readdirSync as u1,statSync as m1}from"fs";import{resolve as S,basename as n0}from"path";async function t0(){if(await k("jq"))return!0;return process.stdout.write(`${j}Error: jq is required but not installed.${K}
|
|
3
3
|
`),process.stdout.write(`Install with:
|
|
4
4
|
`),process.stdout.write(` brew install jq (macOS)
|
|
5
5
|
`),process.stdout.write(` apt install jq (Debian/Ubuntu)
|
|
6
6
|
`),process.stdout.write(` yum install jq (RHEL/CentOS)
|
|
7
|
-
`),!1}function
|
|
7
|
+
`),!1}function K1($){if(!Number.isFinite($)||$<=0)return!1;try{return process.kill($,0),!0}catch{return!1}}function H1($){if(!D($))return null;try{let Z=Z1($,"utf-8").trim();if(!Z)return null;let Q=Number.parseInt(Z,10);return Number.isFinite(Q)?Q:null}catch{return null}}function a0($){let Z=[],Q=H1(S($,"loki.pid"));if(Q!==null&&K1(Q))Z.push(`global:${Q}`);let X=S($,"sessions");if(D(X)){let z=[];try{z=u1(X)}catch{z=[]}for(let H of z){let V=S(X,H);try{if(!m1(V).isDirectory())continue}catch{continue}let U=S(V,"loki.pid"),B=H1(U);if(B!==null&&K1(B))Z.push(`${H}:${B}`)}}if(D($)){let z=[];try{z=u1($)}catch{z=[]}for(let H of z){if(!H.startsWith("run-")||!H.endsWith(".pid"))continue;let V=S($,H);try{if(!m1(V).isFile())continue}catch{continue}let U=n0(H,".pid").slice(4),B=H1(V);if(B!==null&&K1(B)){if(!Z.some((L)=>L.startsWith(`${U}:`)))Z.push(`${U}:${B}`)}}}return Z}async function p1($,Z){let Q=await T(["jq","-r",$,Z]);if(Q.exitCode!==0)return null;return Q.stdout.trim()}function c1($,Z){try{let Q=Z1($,"utf-8"),z=JSON.parse(Q)[Z];if(typeof z==="number"){if(Z==="budget_used"){let H=Math.round(z*100)/100;if(Number.isInteger(H))return String(H);return String(H)}return String(z)}if(z===void 0||z===null)return"0";return String(z)}catch{return"0"}}function l1($,Z,Q){try{let X=Z1($,"utf-8"),H=JSON.parse(X)[Z];if(typeof H==="number"&&Number.isFinite(H))return H;return Q}catch{return Q}}async function s0(){let $=P();if(!await t0())return 1;if(!D($))return process.stdout.write(`${I}Loki Mode Status${K}
|
|
8
8
|
`),process.stdout.write(`
|
|
9
|
-
`),process.stdout.write(`${
|
|
9
|
+
`),process.stdout.write(`${O}No active session found.${K}
|
|
10
10
|
`),process.stdout.write(`Loki Mode has not been initialized in this directory.
|
|
11
11
|
`),process.stdout.write(`
|
|
12
12
|
`),process.stdout.write(`To start a session:
|
|
13
13
|
`),process.stdout.write(` loki start <prd> - Start with a PRD file
|
|
14
14
|
`),process.stdout.write(` loki start - Start without a PRD
|
|
15
15
|
`),process.stdout.write(`
|
|
16
|
-
`),process.stdout.write(`${
|
|
17
|
-
`),0;process.stdout.write(`${
|
|
16
|
+
`),process.stdout.write(`${_}Current directory: ${process.cwd()}${K}
|
|
17
|
+
`),0;process.stdout.write(`${I}Loki Mode Status${K}
|
|
18
18
|
`),process.stdout.write(`
|
|
19
|
-
`);let
|
|
20
|
-
`),process.stdout.write(`${
|
|
19
|
+
`);let Z="",Q=S($,"state","provider");if(D(Q))try{Z=Z1(Q,"utf-8").trim()}catch{Z=""}let X=Z||process.env.LOKI_PROVIDER||"claude",z="full features";switch(X){case"codex":case"gemini":case"aider":z="degraded mode";break;case"cline":z="near-full mode";break;default:z="full features";break}process.stdout.write(`${q}Provider:${K} ${X} (${z})
|
|
20
|
+
`),process.stdout.write(`${_} Switch with: loki provider set <claude|codex|gemini|cline|aider>${K}
|
|
21
21
|
`),process.stdout.write(`
|
|
22
|
-
`);let H=
|
|
23
|
-
`);for(let
|
|
24
|
-
`);else process.stdout.write(` ${
|
|
22
|
+
`);let H=a0($);if(H.length>0){process.stdout.write(`${R}Active Sessions: ${H.length}${K}
|
|
23
|
+
`);for(let J of H){let A=J.indexOf(":"),F=A>=0?J.slice(0,A):J,f=A>=0?J.slice(A+1):"";if(F==="global")process.stdout.write(` ${q}[global]${K} PID ${f}
|
|
24
|
+
`);else process.stdout.write(` ${q}[#${F}]${K} PID ${f}
|
|
25
25
|
`)}process.stdout.write(`
|
|
26
|
-
`),process.stdout.write(`${
|
|
27
|
-
`),process.stdout.write(`${
|
|
26
|
+
`),process.stdout.write(`${_} Stop specific: loki stop <session-id>${K}
|
|
27
|
+
`),process.stdout.write(`${_} Stop all: loki stop${K}
|
|
28
28
|
`),process.stdout.write(`
|
|
29
|
-
`)}if(
|
|
30
|
-
`),process.stdout.write(`${
|
|
29
|
+
`)}if(D(S($,"PAUSE")))process.stdout.write(`${O}Status: PAUSED${K}
|
|
30
|
+
`),process.stdout.write(`${_} Resume with: loki resume${K}
|
|
31
31
|
`),process.stdout.write(`
|
|
32
|
-
`);else if(
|
|
33
|
-
`),process.stdout.write(`${
|
|
32
|
+
`);else if(D(S($,"STOP")))process.stdout.write(`${j}Status: STOPPED${K}
|
|
33
|
+
`),process.stdout.write(`${_} Clear with: loki resume${K}
|
|
34
34
|
`),process.stdout.write(`
|
|
35
|
-
`);let
|
|
36
|
-
`);try{process.stdout.write(
|
|
37
|
-
`)}let
|
|
38
|
-
`);let
|
|
39
|
-
`)}let
|
|
40
|
-
`)}let
|
|
41
|
-
`);else process.stdout.write(`${
|
|
42
|
-
`)}let
|
|
43
|
-
`)}let
|
|
35
|
+
`);let V=S($,"STATUS.txt");if(D(V)){process.stdout.write(`${q}Session Info:${K}
|
|
36
|
+
`);try{process.stdout.write(Z1(V,"utf-8"))}catch{}process.stdout.write(`
|
|
37
|
+
`)}let U=S($,"state","orchestrator.json");if(D(U)){process.stdout.write(`${q}Orchestrator State:${K}
|
|
38
|
+
`);let J=await p1('.currentPhase // "unknown"',U);process.stdout.write(`${J??"unknown"}
|
|
39
|
+
`)}let B=S($,"queue","pending.json");if(D(B)){let J=await p1('if type == "array" then length elif .tasks then .tasks | length else 0 end',B);process.stdout.write(`${q}Pending Tasks:${K} ${J??"0"}
|
|
40
|
+
`)}let w=S($,"metrics","budget.json");if(D(w)){let J=c1(w,"budget_limit"),A=c1(w,"budget_used");if(J!=="0")process.stdout.write(`${q}Budget:${K} $${A} / $${J}
|
|
41
|
+
`);else process.stdout.write(`${q}Cost:${K} $${A} (no limit)
|
|
42
|
+
`)}let L=S($,"state","context-usage.json");if(D(L)){let J=l1(L,"window_size",200000),A=l1(L,"used_tokens",0),F=0;if(J>0)F=Math.floor(A*100/J);process.stdout.write(`${q}Context:${K} ${F}% (${A} / ${J} tokens)
|
|
43
|
+
`)}let N=S($,"dashboard","dashboard.pid");if(D(N)){let J=H1(N);if(J!==null&&K1(J)){let A=process.env.LOKI_DASHBOARD_PORT||"57374";process.stdout.write(`${q}Dashboard:${K} http://127.0.0.1:${A}/
|
|
44
44
|
`)}}return process.stdout.write(`
|
|
45
|
-
`),process.stdout.write(`${
|
|
46
|
-
`),process.stdout.write(`${
|
|
47
|
-
`),0}async function
|
|
48
|
-
`),1;let Q=
|
|
49
|
-
`),1;return process.stdout.write(H.stdout),0}async function
|
|
50
|
-
`),0;return process.stdout.write(`${
|
|
45
|
+
`),process.stdout.write(`${_} Tip: loki context show - detailed token breakdown${K}
|
|
46
|
+
`),process.stdout.write(`${_} Tip: loki code overview - codebase intelligence${K}
|
|
47
|
+
`),0}async function i0(){let $=await r();if(!$)return process.stderr.write(`{"error": "Failed to generate JSON status. Ensure python3 is available."}
|
|
48
|
+
`),1;let Z=p,Q=P(),X=process.env.LOKI_DASHBOARD_PORT||"57374",z=process.env.LOKI_PROVIDER||"claude",H=await T([$,"-c",r0,Z,Q,X,z],{timeoutMs:30000});if(H.exitCode!==0)return process.stderr.write(`{"error": "Failed to generate JSON status. Ensure python3 is available."}
|
|
49
|
+
`),1;return process.stdout.write(H.stdout),0}async function e0($){let Z=[...$];while(Z.length>0){let Q=Z[0];if(Q==="--json")return i0();if(Q==="--help"||Q==="-h")return process.stdout.write(`Usage: loki status [--json]
|
|
50
|
+
`),0;return process.stdout.write(`${j}Unknown flag: ${Q}${K}
|
|
51
51
|
`),process.stdout.write(`Usage: loki status [--json]
|
|
52
|
-
`),1}return
|
|
52
|
+
`),1}return s0()}var r0=`
|
|
53
53
|
import json, os, sys, time
|
|
54
54
|
|
|
55
55
|
skill_dir = sys.argv[1]
|
|
@@ -195,9 +195,9 @@ if os.path.isdir(queue_dir):
|
|
|
195
195
|
result['task_counts'] = task_counts
|
|
196
196
|
|
|
197
197
|
print(json.dumps(result, indent=2))
|
|
198
|
-
`;var
|
|
199
|
-
`)}function
|
|
200
|
-
Start a session with: loki start <prd>`}}let
|
|
198
|
+
`;var o1=b(()=>{y();z1();l();v()});var a1={};o(a1,{runStats:()=>K3,computeStats:()=>t1});import{readdirSync as n1,readFileSync as $3,statSync as r1}from"fs";import{join as u}from"path";function a($){try{if(!r1($).isFile())return null;return JSON.parse($3($,"utf-8"))}catch{return null}}function O1($){try{return r1($).isDirectory()}catch{return!1}}function Q3($){if(!O1($))return[];try{let Z=n1($).filter((Q)=>Q.startsWith("iteration-")&&Q.endsWith(".json"));return Z.sort(),Z.map((Q)=>u($,Q))}catch{return[]}}function s($){return Math.trunc($).toLocaleString("en-US")}function j1($){let Z=Math.trunc($);if(Z<60)return`${Z}s`;let Q=Math.trunc(Z/3600),X=Math.trunc(Z%3600/60),z=Z%60;if(Q>0)return`${Q}h ${String(X).padStart(2,"0")}m`;return`${X}m ${String(z).padStart(2,"0")}s`}function m($,Z=0){let Q=Math.pow(10,Z);return Math.round($*Q)/Q}function i($,Z){return $.toFixed(Z)}function _1($,Z){return $.length>=Z?$:$+" ".repeat(Z-$.length)}function Z3($){let Z="N/A",Q=0,X=a(u($,"state","orchestrator.json"));if(X&&typeof X==="object"){if(typeof X.currentPhase==="string")Z=X.currentPhase;if(typeof X.currentIteration==="number")Q=X.currentIteration}let z=u($,"metrics","efficiency"),H=Q3(z),V=[];for(let G of H){let M=a(G);if(M&&typeof M==="object")V.push(M)}if(V.length>0)Q=Math.max(Q,V.length);let U=V.reduce((G,M)=>G+(M.input_tokens??0),0),B=V.reduce((G,M)=>G+(M.output_tokens??0),0),w=U+B,L=V.reduce((G,M)=>G+(M.cost_usd??0),0),N=V.reduce((G,M)=>G+(M.duration_seconds??0),0),J=0,A=0,F=a(u($,"metrics","budget.json"));if(F&&typeof F==="object"){if(typeof F.budget_limit==="number")J=F.budget_limit;if(typeof F.budget_used==="number")A=F.budget_used}let f=0,C=0,Y=a(u($,"state","quality-gates.json"));if(Y&&typeof Y==="object"){if(Array.isArray(Y)){for(let G of Y)if(C+=1,G===!0)f+=1;else if(G&&typeof G==="object"){let M=G;if(M.passed===!0||M.status==="passed")f+=1}}else for(let G of Object.values(Y))if(typeof G==="boolean"){if(C+=1,G)f+=1}else if(G&&typeof G==="object"){C+=1;let M=G;if(M.passed===!0||M.status==="passed")f+=1}}let x={},X1=a(u($,"quality","gate-failure-count.json"));if(X1&&typeof X1==="object"&&!Array.isArray(X1)){let G={};for(let[M,g]of Object.entries(X1))if(typeof g==="number")G[M]=g;x=G}let P1=0,R1=0,S1=0,J1=u($,"quality");if(O1(J1)){let G=[];try{G=n1(J1)}catch{G=[]}for(let M of G){if(!M.endsWith(".json")||M==="gate-failure-count.json")continue;let g=a(u(J1,M));if(!g||typeof g!=="object")continue;if(!(("verdict"in g)||("approved"in g)||("reviewers"in g)))continue;P1+=1;let D1=(g.verdict??"").toString().toLowerCase();if(g.approved===!0||["approved","approve","pass"].includes(D1))R1+=1;else if(["revision","revise","changes_requested","reject"].includes(D1))S1+=1}}return{phase:Z,iterationCount:Q,iterations:V,totalInput:U,totalOutput:B,totalTokens:w,totalCost:L,totalDuration:N,budgetLimit:J,budgetUsed:A,gatesPassed:f,gatesTotal:C,gateFailures:x,reviewsTotal:P1,reviewsApproved:R1,reviewsRevision:S1}}function X3($,Z){let Q=$.iterationCount,X={session:{iterations:Q,duration_seconds:$.totalDuration,phase:$.phase},tokens:{input:$.totalInput,output:$.totalOutput,total:$.totalTokens,cost_usd:m($.totalCost,2)},quality:{gates_passed:$.gatesPassed,gates_total:$.gatesTotal,reviews_total:$.reviewsTotal,reviews_approved:$.reviewsApproved,reviews_revision:$.reviewsRevision,gate_failures:$.gateFailures},efficiency:{avg_tokens_per_iteration:Q>0?m($.totalTokens/Q,0):0,avg_cost_per_iteration:Q>0?m($.totalCost/Q,2):0,avg_duration_per_iteration:Q>0?m($.totalDuration/Q,1):0},budget:{used:m($.budgetUsed,2),limit:$.budgetLimit,percent:$.budgetLimit>0?m($.budgetUsed/$.budgetLimit*100,1):0}};if(Z)X.iterations=$.iterations.map((V,U)=>({number:U+1,input_tokens:V.input_tokens??0,output_tokens:V.output_tokens??0,cost_usd:m(V.cost_usd??0,2),duration_seconds:V.duration_seconds??0}));let z=JSON.stringify(X,null,2);function H(V,U){if(!U)return;let B=new RegExp(`("${V}": )(-?\\d+)(,?)$`,"m");z=z.replace(B,(w,L,N,J)=>`${L}${N}.0${J}`)}if(H("avg_duration_per_iteration",Q>0&&Number.isInteger(X.efficiency.avg_duration_per_iteration)),H("percent",$.budgetLimit>0&&Number.isInteger(X.budget.percent)),H("cost_usd",Q>0&&Number.isInteger(X.tokens.cost_usd)),Z)z=z.replace(/("cost_usd": )(-?\d+)(,?)$/gm,(V,U,B,w)=>`${U}${B}.0${w}`);return z}function z3($,Z){let Q=[];if(Q.push("Loki Mode Session Statistics"),Q.push("============================"),Q.push(""),Q.push("Session"),Q.push(` Iterations completed: ${$.iterationCount}`),Q.push(` Duration: ${j1($.totalDuration)}`),Q.push(` Current phase: ${$.phase}`),Q.push(""),Q.push("Token Usage"),$.iterations.length>0)Q.push(` Input tokens: ${s($.totalInput)}`),Q.push(` Output tokens: ${s($.totalOutput)}`),Q.push(` Total tokens: ${s($.totalTokens)}`),Q.push(` Estimated cost: $${i($.totalCost,2)}`);else Q.push(" N/A (no iteration metrics found)");if(Q.push(""),Q.push("Quality Gates"),$.gatesTotal>0){let X=Math.round($.gatesPassed/$.gatesTotal*100);Q.push(` Gates passed: ${$.gatesPassed}/${$.gatesTotal} (${X}%)`)}else Q.push(" Gates passed: N/A");if($.reviewsTotal>0){let X=[];if($.reviewsApproved>0)X.push(`${$.reviewsApproved} approved`);if($.reviewsRevision>0)X.push(`${$.reviewsRevision} revision requested`);let z=X.length>0?X.join(", "):"N/A";Q.push(` Code reviews: ${$.reviewsTotal} (${z})`)}if(Object.keys($.gateFailures).length>0){let X=Object.entries($.gateFailures).filter(([,z])=>z>0).map(([z,H])=>`${z} (${H})`);if(X.length>0)Q.push(` Gate failures: ${X.join(", ")}`)}if(Q.push(""),Q.push("Efficiency"),$.iterationCount>0&&$.iterations.length>0){let X=Math.round($.totalTokens/$.iterationCount),z=$.totalCost/$.iterationCount,H=$.totalDuration/$.iterationCount;Q.push(` Avg tokens/iteration: ${s(X)}`),Q.push(` Avg cost/iteration: $${i(z,2)}`),Q.push(` Avg duration/iteration: ${j1(H)}`)}else Q.push(" N/A (no iteration metrics found)");if(Q.push(""),Q.push("Budget"),$.budgetLimit>0){let X=m($.budgetUsed/$.budgetLimit*100,1),z=Number.isInteger(X)?`${X}.0`:`${X}`;Q.push(` Used: $${i($.budgetUsed,2)} / $${i($.budgetLimit,2)} (${z}%)`)}else if($.budgetUsed>0)Q.push(` Used: $${i($.budgetUsed,2)} (no limit set)`);else Q.push(" N/A");if(Z&&$.iterations.length>0)Q.push(""),Q.push("Per-Iteration Breakdown"),$.iterations.forEach((X,z)=>{let H=z+1,V=_1(s(X.input_tokens??0),10),U=_1(s(X.output_tokens??0),10),B=X.cost_usd??0,w=j1(X.duration_seconds??0),L=_1(`${H}`,3);Q.push(` #${L} input: ${V} output: ${U} cost: $${i(B,2)} time: ${w}`)});return Q.join(`
|
|
199
|
+
`)}function t1($){let Z=!1,Q=!1;for(let V of $)if(V==="--json")Z=!0;else if(V==="--efficiency")Q=!0;let X=P();if(!O1(X)){if(Z)return{exitCode:0,stdout:'{"error": "No active session"}'};return{exitCode:0,stdout:`${O}No active session found.${K}
|
|
200
|
+
Start a session with: loki start <prd>`}}let z=Z3(X);return{exitCode:0,stdout:Z?X3(z,Q):z3(z,Q)}}async function K3($){let Z=t1($);return console.log(Z.stdout),Z.exitCode}var s1=b(()=>{v();l()});var K0={};o(K0,{runDoctor:()=>j3,httpReachable:()=>w1,checkTool:()=>Q0,checkSkills:()=>Z0,checkDisk:()=>I1,buildDoctorJson:()=>z0});import{existsSync as H3,lstatSync as V3,readlinkSync as U3,statfsSync as W3}from"fs";import{homedir as e1}from"os";import{resolve as i1}from"path";function J3($){let Z=$.match(q3);return Z?Z[1]:null}async function G3($){try{let Z=await T([$,"--version"],{timeoutMs:5000}),Q=(Z.stdout||Z.stderr||"").trim();return J3(Q)}catch{return null}}function $0($,Z){let Q=$.split(".").map((z)=>parseInt(z,10)),X=Z.split(".").map((z)=>parseInt(z,10));while(Q.length<2)Q.push(0);while(X.length<2)X.push(0);for(let z=0;z<2;z++){let H=Q[z]??0,V=X[z]??0;if(Number.isNaN(H)||Number.isNaN(V))return 0;if(H!==V)return H-V}return 0}async function Q0($,Z,Q,X=null){let z=await k(Z),H=z!==null,V=H?await G3(Z):null,U="pass";if(!H)U=Q==="required"?"fail":"warn";else if(X&&V){if($0(V,X)<0)U=Q==="required"?"fail":"warn"}return{name:$,command:Z,found:H,version:V,required:Q,min_version:X,status:U,path:z}}function I1(){let $=null;try{let Q=W3(e1()),X=Number(Q.bavail)*Number(Q.bsize);$=Math.round(X/1073741824*10)/10}catch{$=null}let Z="pass";if($!==null){if($<1)Z="fail";else if($<5)Z="warn"}return{available_gb:$,status:Z}}async function w1($,Z=2000){try{return(await fetch($,{signal:AbortSignal.timeout(Z)})).ok}catch{return!1}}async function T1($,Z=!1){let Q=`import ${$}`,X=Z?30000:5000;if(!Z)return(await $1(Q,{timeoutMs:X})).exitCode===0;let z=await r();if(!z)return!1;return(await T([z,"-c",Q],{timeoutMs:X})).exitCode===0}function Z0(){let $=e1();return B3.map(({name:Z,dir:Q})=>{let X=i1($,Q),z=X,H=i1(X,"SKILL.md");if(H3(H))return{name:Z,path:z,status:"pass",detail:""};try{if(V3(X).isSymbolicLink()){let U="unknown";try{U=U3(X)}catch{}return{name:Z,path:z,status:"fail",detail:`(broken symlink -> ${U})`}}}catch{}return{name:Z,path:z,status:"warn",detail:"(not found - run 'loki setup-skill')"}})}async function X0(){return Promise.all(M3.map(async($)=>{return{...await Q0($.jsonName,$.cmd,$.required,$.min??null),displayName:$.displayName}}))}async function z0(){let Z=(await X0()).map(({displayName:V,...U})=>U),Q=I1(),X=0,z=0,H=0;for(let V of Z)if(V.status==="pass")X++;else if(V.status==="fail")z++;else H++;if(Q.status==="pass")X++;else if(Q.status==="fail")z++;else H++;return{checks:Z,disk:Q,summary:{passed:X,failed:z,warnings:H,ok:z===0}}}function W($){switch($){case"pass":return`${R}PASS${K}`;case"fail":return`${j}FAIL${K}`;case"warn":return`${O}WARN${K}`}}function V1($){let Z=$.version?` (v${$.version})`:"",Q=$.displayName;if(!$.found){let X=$.required==="required"?"not found":$.required==="recommended"?"not found (recommended)":"not found (optional)";return` ${W($.status)} ${Q} - ${X}`}if($.min_version&&$.version&&$0($.version,$.min_version)<0){let X=$.required==="required"?"requires":"recommended";return` ${W($.status)} ${Q}${Z} - ${X} >= ${$.min_version}`}return` ${W($.status)} ${Q}${Z}`}function U1($,Z){if(Z==="pass")$.pass++;else if(Z==="fail")$.fail++;else $.warn++}function Y3(){process.stdout.write(`${I}loki doctor${K} - Check system prerequisites
|
|
201
201
|
|
|
202
202
|
`),process.stdout.write(`Usage: loki doctor [--json]
|
|
203
203
|
|
|
@@ -206,81 +206,121 @@ Start a session with: loki start <prd>`}}let Z=m0(X);return{exitCode:0,stdout:Q?
|
|
|
206
206
|
|
|
207
207
|
`),process.stdout.write(`Checks: node, python3, jq, git, curl, bash version,
|
|
208
208
|
`),process.stdout.write(` claude/codex/gemini CLIs, and disk space.
|
|
209
|
-
`)}async function
|
|
209
|
+
`)}async function A3(){process.stdout.write(`${I}Loki Mode Doctor${K}
|
|
210
210
|
|
|
211
211
|
`),process.stdout.write(`Checking system prerequisites...
|
|
212
212
|
|
|
213
|
-
`);let
|
|
214
|
-
`);for(let
|
|
215
|
-
`),
|
|
216
|
-
`),process.stdout.write(`${
|
|
217
|
-
`);let X=["claude","codex","gemini","cline","aider"],
|
|
218
|
-
`),
|
|
219
|
-
`),process.stdout.write(` ${
|
|
220
|
-
`)
|
|
221
|
-
`),process.stdout.write(`${
|
|
222
|
-
`);let H
|
|
223
|
-
`)
|
|
224
|
-
`);if(
|
|
225
|
-
`)
|
|
226
|
-
`);if(
|
|
227
|
-
`)
|
|
213
|
+
`);let $={pass:0,fail:0,warn:0},Z=await X0(),Q=new Map(Z.map((Y)=>[Y.command,Y]));process.stdout.write(`${q}Required:${K}
|
|
214
|
+
`);for(let Y of["node","python3","jq","git","curl"]){let x=Q.get(Y);process.stdout.write(V1(x)+`
|
|
215
|
+
`),U1($,x.status)}process.stdout.write(`
|
|
216
|
+
`),process.stdout.write(`${q}AI Providers:${K}
|
|
217
|
+
`);let X=["claude","codex","gemini","cline","aider"],z=!1;for(let Y of X){let x=Q.get(Y);if(process.stdout.write(V1(x)+`
|
|
218
|
+
`),U1($,x.status),x.found)z=!0}if(!z)process.stdout.write(` ${W("fail")} No AI provider CLI installed -- at least one is required
|
|
219
|
+
`),process.stdout.write(` ${O}Install: npm install -g @anthropic-ai/claude-code${K}
|
|
220
|
+
`),$.fail++;process.stdout.write(`
|
|
221
|
+
`),process.stdout.write(`${q}API Keys:${K}
|
|
222
|
+
`);let H=Q.get("claude").found,V=Q.get("codex").found,U=Q.get("gemini").found,B=process.env;if(B.ANTHROPIC_API_KEY)process.stdout.write(` ${W("pass")} ANTHROPIC_API_KEY is set
|
|
223
|
+
`),$.pass++;else if(H)process.stdout.write(` ${_} -- ${K} ANTHROPIC_API_KEY not set (Claude CLI uses its own login)
|
|
224
|
+
`);if(B.OPENAI_API_KEY)process.stdout.write(` ${W("pass")} OPENAI_API_KEY is set
|
|
225
|
+
`),$.pass++;else if(V)process.stdout.write(` ${_} -- ${K} OPENAI_API_KEY not set (Codex CLI uses its own login)
|
|
226
|
+
`);if(B.GOOGLE_API_KEY||B.GEMINI_API_KEY)process.stdout.write(` ${W("pass")} GOOGLE_API_KEY is set
|
|
227
|
+
`),$.pass++;else if(U)process.stdout.write(` ${_} -- ${K} GOOGLE_API_KEY not set (Gemini CLI uses its own login)
|
|
228
228
|
`);process.stdout.write(`
|
|
229
|
-
`),process.stdout.write(`${
|
|
230
|
-
`);for(let
|
|
231
|
-
`)
|
|
232
|
-
`),process.stdout.write(` ${
|
|
233
|
-
`)
|
|
234
|
-
`)
|
|
235
|
-
`),process.stdout.write(`${
|
|
236
|
-
`),await
|
|
237
|
-
`)
|
|
238
|
-
`)
|
|
239
|
-
`)
|
|
240
|
-
`)
|
|
241
|
-
`)
|
|
242
|
-
`)
|
|
243
|
-
`)
|
|
244
|
-
`)
|
|
245
|
-
`)
|
|
246
|
-
`)
|
|
247
|
-
`)
|
|
248
|
-
`)
|
|
249
|
-
`),process.stdout.write(`${
|
|
250
|
-
`);let
|
|
251
|
-
`),
|
|
252
|
-
`),
|
|
253
|
-
`)
|
|
254
|
-
`)
|
|
255
|
-
`)
|
|
256
|
-
`)
|
|
257
|
-
`),process.stdout.write(`${
|
|
229
|
+
`),process.stdout.write(`${q}Skills:${K}
|
|
230
|
+
`);for(let Y of Z0())if(Y.status==="pass")process.stdout.write(` ${W("pass")} ${Y.name} ${_}${Y.path}${K}
|
|
231
|
+
`),$.pass++;else if(Y.status==="fail")process.stdout.write(` ${W("fail")} ${Y.name} ${_}${Y.detail}${K}
|
|
232
|
+
`),process.stdout.write(` ${O}Fix: loki setup-skill${K}
|
|
233
|
+
`),$.fail++;else process.stdout.write(` ${W("warn")} ${Y.name} ${_}${Y.detail}${K}
|
|
234
|
+
`),$.warn++;if(process.stdout.write(`
|
|
235
|
+
`),process.stdout.write(`${q}Integrations:${K}
|
|
236
|
+
`),await T1("mcp"))process.stdout.write(` ${W("pass")} MCP SDK (Python)
|
|
237
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} MCP SDK - not installed (pip3 install mcp)
|
|
238
|
+
`),$.warn++;if(await T1("numpy",!0))process.stdout.write(` ${W("pass")} numpy (vector search)
|
|
239
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} numpy - not installed (pip3 install numpy)
|
|
240
|
+
`),$.warn++;if(await T1("sentence_transformers",!0))process.stdout.write(` ${W("pass")} sentence-transformers (embeddings)
|
|
241
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} sentence-transformers - not installed (loki memory vectors setup)
|
|
242
|
+
`),$.warn++;if(await w1("http://localhost:8100/api/v2/heartbeat"))process.stdout.write(` ${W("pass")} ChromaDB server (port 8100)
|
|
243
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} ChromaDB - not running (docker start loki-chroma)
|
|
244
|
+
`),$.warn++;let w=process.env.LOKI_MIROFISH_URL;if(w)if(await w1(`${w}/health`))process.stdout.write(` ${W("pass")} MiroFish server (${w})
|
|
245
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} MiroFish - not running (loki start --mirofish-docker <image>)
|
|
246
|
+
`),$.warn++;if(process.env.LOKI_OTEL_ENDPOINT)process.stdout.write(` ${W("pass")} OTEL endpoint: ${process.env.LOKI_OTEL_ENDPOINT}
|
|
247
|
+
`),$.pass++;else process.stdout.write(` ${W("warn")} OTEL - not configured (set LOKI_OTEL_ENDPOINT)
|
|
248
|
+
`),$.warn++;process.stdout.write(`
|
|
249
|
+
`),process.stdout.write(`${q}System:${K}
|
|
250
|
+
`);let L=Q.get("bash");process.stdout.write(V1(L)+`
|
|
251
|
+
`),U1($,L.status);let N=Q.get("bun");if(N)process.stdout.write(V1(N)+`
|
|
252
|
+
`),U1($,N.status);let J=I1(),A=J.available_gb===null?null:Math.floor(J.available_gb);if(A===null)process.stdout.write(` ${W("warn")} Disk space: unable to determine
|
|
253
|
+
`),$.warn++;else if(J.status==="fail")process.stdout.write(` ${W("fail")} Disk space: ${A}GB available (need >= 1GB)
|
|
254
|
+
`),$.fail++;else if(J.status==="warn")process.stdout.write(` ${W("warn")} Disk space: ${A}GB available (low)
|
|
255
|
+
`),$.warn++;else process.stdout.write(` ${W("pass")} Disk space: ${A}GB available
|
|
256
|
+
`),$.pass++;process.stdout.write(`
|
|
257
|
+
`),process.stdout.write(`${q}Runtime route:${K}
|
|
258
|
+
`);let F=process.versions.bun!==void 0,f=process.argv[0]??"(unknown)";if(process.stdout.write(` ${W("pass")} Active runtime: ${F?"Bun":"Node"} (${f})
|
|
259
|
+
`),process.env.LOKI_LEGACY_BASH==="1"||process.env.LOKI_LEGACY_BASH==="true")process.stdout.write(` ${W("warn")} LOKI_LEGACY_BASH set: shim routes every command to autonomy/loki (bash)
|
|
260
|
+
`);if(process.env.LOKI_TS_ENTRY)process.stdout.write(` ${W("pass")} LOKI_TS_ENTRY override: ${process.env.LOKI_TS_ENTRY}
|
|
261
|
+
`);if(process.env.BUN_FROM_SOURCE==="1"||process.env.BUN_FROM_SOURCE==="true")process.stdout.write(` ${W("pass")} BUN_FROM_SOURCE set: shim prefers loki-ts/src/ over dist/
|
|
262
|
+
`);let C=await r();if(C!==null){let x=(await T([C,"-c","import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"],{timeoutMs:5000})).stdout.trim();if(x.startsWith("3.12"))process.stdout.write(` ${W("pass")} Python 3.12 (chromadb / sentence-transformers): ${x} at ${C}
|
|
263
|
+
`);else if(x)process.stdout.write(` ${W("warn")} Python 3.12 NOT found -- using ${x} at ${C}; chromadb / sentence-transformers may fail. Install python3.12 (brew install python@3.12 / apt install python3.12).
|
|
264
|
+
`);else process.stdout.write(` ${W("warn")} Python 3 found at ${C} but version probe failed; chromadb may not work.
|
|
265
|
+
`)}else process.stdout.write(` ${W("warn")} Python 3 not on PATH -- memory + MCP integrations disabled.
|
|
266
|
+
`);if(process.stdout.write(`
|
|
267
|
+
`),process.stdout.write(`${I}Summary:${K} ${R}${$.pass} passed${K}, ${j}${$.fail} failed${K}, ${O}${$.warn} warnings${K}
|
|
258
268
|
|
|
259
|
-
`)
|
|
269
|
+
`),$.fail>0)return process.stdout.write(`${j}Some required prerequisites are missing.${K}
|
|
260
270
|
`),process.stdout.write(`Install missing dependencies and run 'loki doctor' again.
|
|
261
|
-
`),1;if(
|
|
262
|
-
`),0;return process.stdout.write(`${
|
|
263
|
-
`),0}async function $
|
|
271
|
+
`),1;if($.warn>0)return process.stdout.write(`${O}All required checks passed with some warnings.${K}
|
|
272
|
+
`),0;return process.stdout.write(`${R}All checks passed. System is ready for Loki Mode.${K}
|
|
273
|
+
`),0}async function j3($){let Z=!1;for(let Q of $)if(Q==="--json")Z=!0;else if(Q==="--help"||Q==="-h")return Y3(),0;else return process.stderr.write(`${j}Unknown option: ${Q}${K}
|
|
264
274
|
`),process.stderr.write(`Usage: loki doctor [--json]
|
|
265
|
-
`),1;if(
|
|
266
|
-
`),0}return
|
|
267
|
-
`),0
|
|
275
|
+
`),1;if(Z){let Q=await z0();return process.stdout.write(JSON.stringify(Q,null,2)+`
|
|
276
|
+
`),0}return A3()}var q3,B3,M3;var H0=b(()=>{y();z1();l();q3=/(\d+\.\d+(?:\.\d+)*)/;B3=[{name:"Claude Code",dir:".claude/skills/loki-mode"},{name:"Codex CLI",dir:".codex/skills/loki-mode"},{name:"Gemini CLI",dir:".gemini/skills/loki-mode"},{name:"Cline CLI",dir:".cline/skills/loki-mode"},{name:"Aider CLI",dir:".aider/skills/loki-mode"}];M3=[{displayName:"Node.js (>= 18)",jsonName:"Node.js",cmd:"node",required:"required",min:"18.0"},{displayName:"Python 3 (>= 3.8)",jsonName:"Python 3",cmd:"python3",required:"required",min:"3.8"},{displayName:"jq",jsonName:"jq",cmd:"jq",required:"required"},{displayName:"git",jsonName:"git",cmd:"git",required:"required"},{displayName:"curl",jsonName:"curl",cmd:"curl",required:"required"},{displayName:"bash (>= 4.0)",jsonName:"bash",cmd:"bash",required:"recommended",min:"4.0"},{displayName:"Bun (>= 1.3)",jsonName:"Bun",cmd:"bun",required:"recommended",min:"1.3"},{displayName:"Claude CLI",jsonName:"Claude CLI",cmd:"claude",required:"optional"},{displayName:"Codex CLI",jsonName:"Codex CLI",cmd:"codex",required:"optional"},{displayName:"Gemini CLI",jsonName:"Gemini CLI",cmd:"gemini",required:"optional"},{displayName:"Cline CLI",jsonName:"Cline CLI",cmd:"cline",required:"optional"},{displayName:"Aider CLI",jsonName:"Aider CLI",cmd:"aider",required:"optional"}]});import{existsSync as W1,mkdirSync as _3,copyFileSync as O3,readFileSync as T3,readdirSync as w3,statSync as I3,writeFileSync as S6,renameSync as L3,appendFileSync as D6,rmSync as E6}from"fs";import{join as d,dirname as F3}from"path";function q1($){return d($,"state","checkpoints")}function P3($){let Z=q1($);if(!W1(Z))return[];return w3(Z).filter((Q)=>Q.startsWith("cp-")).filter((Q)=>{try{return I3(d(Z,Q)).isDirectory()}catch{return!1}})}function R3($){return[...$].sort((Z,Q)=>{let X=V0(Z),z=V0(Q);return X-z})}function V0($){let Z=$.split("-");if(Z.length<3)return 0;let Q=Z[Z.length-1],X=Number.parseInt(Q??"0",10);return Number.isFinite(X)?X:0}function F1($){let Z=$??P(),Q=R3(P3(Z)),X=[];for(let z of Q){let H=U0(Z,z);if(H)X.push(H)}return X}function U0($,Z){let Q=d(q1($),Z,"metadata.json");if(!W1(Q))return null;try{return JSON.parse(T3(Q,"utf-8"))}catch{return null}}function x1($,Z){if(!S3.test($))throw new W0($);let Q=Z??P(),X=d(q1(Q),$);if(!W1(X))throw new L1($);let z=U0(Q,$);if(!z)throw new L1($);return z}function q0($,Z){let Q=x1($,Z),X=Z??P(),z=d(q1(X),$),H=[];for(let V of D3){let U=d(z,V);if(!W1(U))continue;H.push({from:U,to:d(X,V)})}return{id:$,metadata:Q,restore:H}}function J0($){let Z=[],Q=0;for(let X of $.restore)try{_3(F3(X.to),{recursive:!0});let z=`${X.to}.tmp.${process.pid}.${++x3}`;O3(X.from,z),L3(z,X.to),Q+=1}catch(z){Z.push(`${X.from} -> ${X.to}: ${z.message}`)}return{restored:Q,errors:Z}}var C6,x3=0,S3,L1,W0,D3;var G0=b(()=>{v();y();C6=Promise.resolve();S3=/^[a-zA-Z0-9_-]+$/;L1=class L1 extends Error{id;constructor($){super(`Checkpoint not found: ${$}`);this.id=$;this.name="CheckpointNotFoundError"}};W0=class W0 extends Error{id;constructor($){super(`Invalid checkpoint ID: must be alphanumeric, hyphens, underscores only (got: ${$})`);this.id=$;this.name="InvalidCheckpointIdError"}};D3=["state/orchestrator.json","queue/pending.json","queue/completed.json","queue/in-progress.json","queue/current-task.json"]});var Y0={};o(Y0,{runRollback:()=>E3});async function E3($){let Z=$[0],Q=$.slice(1);if(Z===void 0||Z==="help"||Z==="--help"||Z==="-h")return process.stdout.write(B0),Z===void 0?1:0;switch(Z){case"list":{let X=[...F1()].reverse();if(X.length===0)return process.stdout.write(`${O}No checkpoints found.${K}
|
|
277
|
+
`),0;process.stdout.write(`${I}Checkpoints${K} (${X.length}, newest first):
|
|
278
|
+
`);for(let z of X)process.stdout.write(` ${q}${z.id}${K} iter=${z.iteration} ${z.git_branch||"(no branch)"}@${(z.git_sha||"").slice(0,7)} ${z.timestamp}
|
|
279
|
+
`);return 0}case"show":{let X=Q[0];if(!X)return process.stderr.write(`${j}Missing checkpoint id.${K} Use \`loki rollback list\`.
|
|
280
|
+
`),2;try{let z=x1(X);return process.stdout.write(`${JSON.stringify(z,null,2)}
|
|
281
|
+
`),0}catch(z){return process.stderr.write(`${j}Failed to read checkpoint:${K} ${z.message}
|
|
282
|
+
`),1}}case"to":{let X=Q[0];if(!X)return process.stderr.write(`${j}Missing checkpoint id.${K} Use \`loki rollback list\`.
|
|
283
|
+
`),2;return M0(X)}case"latest":{let X=F1(),z=X[X.length-1];if(!z)return process.stderr.write(`${j}No checkpoints found to roll back to.${K}
|
|
284
|
+
`),1;return process.stdout.write(`Rolling back to latest checkpoint: ${q}${z.id}${K}
|
|
285
|
+
`),M0(z.id)}default:return process.stderr.write(`Unknown subcommand: ${Z}
|
|
286
|
+
`),process.stderr.write(B0),2}}function M0($){let Z;try{Z=q0($)}catch(X){return process.stderr.write(`${j}Cannot plan rollback:${K} ${X.message}
|
|
287
|
+
`),1}if(Z.restore.length===0)return process.stdout.write(`${O}Checkpoint ${$} has no restorable state files; nothing to do.${K}
|
|
288
|
+
`),0;let Q=J0(Z);if(Q.errors.length>0){for(let X of Q.errors)process.stderr.write(`${j}restore error:${K} ${X}
|
|
289
|
+
`);return process.stderr.write(`${j}Partial rollback: ${Q.restored}/${Z.restore.length} files restored.${K}
|
|
290
|
+
`),1}return process.stdout.write(`${R}Rolled back ${Q.restored}/${Z.restore.length} state files from ${$}.${K}
|
|
291
|
+
`),process.stdout.write("Run `loki start` to resume from the restored state.\n"),0}var B0=`Usage: loki rollback <subcommand>
|
|
292
|
+
|
|
293
|
+
Subcommands:
|
|
294
|
+
list List checkpoints (newest first)
|
|
295
|
+
show <id> Print metadata for one checkpoint
|
|
296
|
+
to <id> Restore .loki/ state files to that checkpoint
|
|
297
|
+
latest Restore to the most recent checkpoint
|
|
298
|
+
|
|
299
|
+
Restored files (matches autonomy/run.sh:7028 byte-for-byte):
|
|
300
|
+
.loki/state/orchestrator.json
|
|
301
|
+
.loki/queue/{pending,completed,in-progress,current-task}.json
|
|
302
|
+
|
|
303
|
+
Note: only state files are restored. Source code, git history, and the
|
|
304
|
+
session's autonomy-state.json are unchanged. Re-run \`loki start\` to
|
|
305
|
+
resume from the restored state.
|
|
306
|
+
`;var A0=b(()=>{G0();l()});v();import{readFileSync as x0}from"fs";import{resolve as P0,dirname as R0}from"path";import{fileURLToPath as S0}from"url";var c=null;function f1(){if(c!==null)return c;let $="7.5.2";if(typeof $==="string"&&$.length>0)return c=$,c;try{let Z=R0(S0(import.meta.url)),Q=B1(Z);c=x0(P0(Q,"VERSION"),"utf-8").trim()}catch{c="unknown"}return c}function C1(){return process.stdout.write(`Loki Mode v${f1()}
|
|
307
|
+
`),0}y();l();v();import{readFileSync as f0,existsSync as C0}from"fs";import{resolve as g0}from"path";var b0=["claude","codex","gemini","cline","aider"];function b1(){let $=g0(P(),"state","provider");if(!C0($))return"";try{return f0($,"utf-8").trim()}catch{return""}}function v0($,Z){return $||Z||process.env.LOKI_PROVIDER||"claude"}function y0($){let Z=b1(),Q=v0($,Z);switch(process.stdout.write(`${I}Current Provider${K}
|
|
268
308
|
`),process.stdout.write(`
|
|
269
|
-
`),process.stdout.write(`${
|
|
270
|
-
`)
|
|
271
|
-
`);break;case"cline":process.stdout.write(`${
|
|
272
|
-
`);break;case"codex":case"gemini":case"aider":process.stdout.write(`${
|
|
273
|
-
`);break;default:break}if(
|
|
274
|
-
`);else process.stdout.write(`${
|
|
309
|
+
`),process.stdout.write(`${q}Provider:${K} ${Q}
|
|
310
|
+
`),Q){case"claude":process.stdout.write(`${R}Status:${K} Full features (subagents, parallel, MCP)
|
|
311
|
+
`);break;case"cline":process.stdout.write(`${R}Status:${K} Near-full mode (subagents, MCP, 12+ providers)
|
|
312
|
+
`);break;case"codex":case"gemini":case"aider":process.stdout.write(`${O}Status:${K} Degraded mode (sequential only)
|
|
313
|
+
`);break;default:break}if(Z)process.stdout.write(`${_}(saved in .loki/state/provider)${K}
|
|
314
|
+
`);else process.stdout.write(`${_}(default - not explicitly set)${K}
|
|
275
315
|
`);return process.stdout.write(`
|
|
276
|
-
`),process.stdout.write(`Switch provider: ${
|
|
277
|
-
`),process.stdout.write(`Available: ${
|
|
278
|
-
`),0}async function
|
|
316
|
+
`),process.stdout.write(`Switch provider: ${q}loki provider set <name>${K}
|
|
317
|
+
`),process.stdout.write(`Available: ${q}loki provider list${K}
|
|
318
|
+
`),0}async function h0(){let Z=b1()||process.env.LOKI_PROVIDER||"claude";process.stdout.write(`${I}Available Providers${K}
|
|
279
319
|
`),process.stdout.write(`
|
|
280
|
-
`);let
|
|
320
|
+
`);let Q=await Promise.all(b0.map(async(H)=>[H,await k(H)!==null])),X=new Map;for(let[H,V]of Q)X.set(H,V?`${R}installed${K}`:`${j}not installed${K}`);let z=[["claude","claude - Claude Code (Anthropic) "],["codex","codex - Codex CLI (OpenAI) "],["gemini","gemini - Gemini CLI (Google) "],["cline","cline - Cline (multi-provider) "],["aider","aider - Aider (terminal pair prog) "]];for(let[H,V]of z){let U=Z===H?` ${q}(current)${K}`:"";process.stdout.write(` ${V} ${X.get(H)}${U}
|
|
281
321
|
`)}return process.stdout.write(`
|
|
282
|
-
`),process.stdout.write(`Set provider: ${
|
|
283
|
-
`),0}function
|
|
322
|
+
`),process.stdout.write(`Set provider: ${q}loki provider set <name>${K}
|
|
323
|
+
`),0}function u0(){return process.stdout.write(`${I}Loki Mode Provider Management${K}
|
|
284
324
|
`),process.stdout.write(`
|
|
285
325
|
`),process.stdout.write(`Usage: loki provider <command>
|
|
286
326
|
`),process.stdout.write(`
|
|
@@ -298,17 +338,17 @@ Start a session with: loki start <prd>`}}let Z=m0(X);return{exitCode:0,stdout:Q?
|
|
|
298
338
|
`),process.stdout.write(` loki provider list
|
|
299
339
|
`),process.stdout.write(` loki provider info gemini
|
|
300
340
|
`),process.stdout.write(` loki provider models
|
|
301
|
-
`),0}async function
|
|
302
|
-
`))if(X.includes('"description"'))
|
|
341
|
+
`),0}async function v1($){let Z=$[0]??"show",Q=$.slice(1);switch(Z){case"show":case"current":return y0(Q[0]);case"list":return h0();case"set":case"info":case"models":return m0(["provider",Z,...Q]);default:return u0()}}async function m0($){let{run:Z}=await Promise.resolve().then(() => (y(),g1)),{resolve:Q}=await import("path"),{REPO_ROOT:X}=await Promise.resolve().then(() => (v(),N1)),z=Q(X,"autonomy","loki"),H=await Z([z,...$],{env:{LOKI_LEGACY_BASH:"1"},timeoutMs:3600000});return process.stdout.write(H.stdout),process.stderr.write(H.stderr),H.exitCode}l();v();z1();y();import{existsSync as y1,readFileSync as c0}from"fs";import{resolve as t}from"path";import{mkdir as l0}from"fs/promises";var Q1=t(M1(),"learnings");function A1($){if(!y1($))return 0;try{let Z=c0($,"utf-8"),Q=0;for(let X of Z.split(`
|
|
342
|
+
`))if(X.includes('"description"'))Q++;return Q}catch{return 0}}async function d0(){await l0(Q1,{recursive:!0});let $=A1(t(Q1,"patterns.jsonl")),Z=A1(t(Q1,"mistakes.jsonl")),Q=A1(t(Q1,"successes.jsonl"));return process.stdout.write(`${I}Cross-Project Learnings${K}
|
|
303
343
|
`),process.stdout.write(`
|
|
304
|
-
`),process.stdout.write(` Patterns: ${
|
|
305
|
-
`),process.stdout.write(` Mistakes: ${
|
|
306
|
-
`),process.stdout.write(` Successes: ${
|
|
344
|
+
`),process.stdout.write(` Patterns: ${R}${$}${K}
|
|
345
|
+
`),process.stdout.write(` Mistakes: ${O}${Z}${K}
|
|
346
|
+
`),process.stdout.write(` Successes: ${q}${Q}${K}
|
|
307
347
|
`),process.stdout.write(`
|
|
308
|
-
`),process.stdout.write(`Location: ${
|
|
348
|
+
`),process.stdout.write(`Location: ${Q1}
|
|
309
349
|
`),process.stdout.write(`
|
|
310
350
|
`),process.stdout.write(`Use 'loki memory show <type>' to view entries
|
|
311
|
-
`),0}async function
|
|
351
|
+
`),0}async function o0($){if($){let X=`
|
|
312
352
|
try:
|
|
313
353
|
from memory.layers import IndexLayer
|
|
314
354
|
layer = IndexLayer('.loki/memory')
|
|
@@ -318,9 +358,9 @@ except ImportError:
|
|
|
318
358
|
print('Error: memory.layers module not found')
|
|
319
359
|
except Exception as e:
|
|
320
360
|
print(f'Error: {e}')
|
|
321
|
-
`.trim(),
|
|
322
|
-
`),0;let
|
|
323
|
-
`),0;return process.stdout.write(
|
|
361
|
+
`.trim(),z=await $1(X,{cwd:p});return process.stdout.write(z.stdout),0}let Z=t(P(),"memory","index.json");if(!y1(Z))return process.stdout.write(`No index found
|
|
362
|
+
`),0;let Q=await $1(`import json, sys; sys.stdout.write(json.dumps(json.load(open(${JSON.stringify(Z)})), indent=4) + "\\n")`);if(Q.exitCode!==0)return process.stdout.write(`No index found
|
|
363
|
+
`),0;return process.stdout.write(Q.stdout),0}async function h1($){switch($[0]??"list"){case"list":case"ls":return d0();case"index":return o0($[1]==="rebuild");default:{let Q=t(p,"autonomy","loki"),X=await T([Q,"memory",...$],{env:{LOKI_LEGACY_BASH:"1"},timeoutMs:3600000});return process.stdout.write(X.stdout),process.stderr.write(X.stderr),X.exitCode}}}var j0=`Loki Mode (TypeScript port, Phase 2 of bash->Bun migration)
|
|
324
364
|
|
|
325
365
|
Usage: loki <command> [args...]
|
|
326
366
|
|
|
@@ -333,10 +373,12 @@ Phase 2 ported (Bun-native, fast):
|
|
|
333
373
|
memory list Cross-project learnings counts
|
|
334
374
|
memory index [rebuild] Show or rebuild memory index
|
|
335
375
|
doctor [--json] System prerequisites health check
|
|
376
|
+
rollback <subcmd> Restore .loki/ state from a checkpoint
|
|
377
|
+
(subcmds: list | show <id> | to <id> | latest)
|
|
336
378
|
|
|
337
379
|
All other commands fall through to the bash CLI (autonomy/loki).
|
|
338
380
|
Set LOKI_LEGACY_BASH=1 to force the bash CLI for every command.
|
|
339
|
-
`;async function
|
|
340
|
-
`),process.stderr.write(
|
|
381
|
+
`;async function k3($){let Z=$[0],Q=$.slice(1);switch(Z){case void 0:case"help":case"--help":case"-h":return process.stdout.write(j0),0;case"version":case"--version":case"-v":return C1();case"provider":return v1(Q);case"memory":return h1(Q);case"status":{let{runStatus:X}=await Promise.resolve().then(() => (o1(),d1));return X(Q)}case"stats":{let{runStats:X}=await Promise.resolve().then(() => (s1(),a1));return X(Q)}case"doctor":{let{runDoctor:X}=await Promise.resolve().then(() => (H0(),K0));return X(Q)}case"rollback":{let{runRollback:X}=await Promise.resolve().then(() => (A0(),Y0));return X(Q)}default:return process.stderr.write(`Unknown command: ${Z}
|
|
382
|
+
`),process.stderr.write(j0),2}}process.on("SIGINT",()=>process.exit(130));process.on("SIGTERM",()=>process.exit(143));var N3=await k3(Bun.argv.slice(2));process.exit(N3);
|
|
341
383
|
|
|
342
|
-
//# debugId=
|
|
384
|
+
//# debugId=F6986F139DFEE70364756E2164756E21
|
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
package/skills/quality-gates.md
CHANGED
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
- Missing adapter for replaced component = **High** (BLOCK)
|
|
37
37
|
- Behavioral baseline mismatch without documentation = **Medium** (BLOCK)
|
|
38
38
|
|
|
39
|
-
**Disabling
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
**Disabling**: gate 10 only fires when `LOKI_HEAL_MODE=true` or
|
|
40
|
+
`.loki/healing/friction-map.json` exists in the project root (v7.4.20).
|
|
41
|
+
Greenfield projects skip the auditor entirely. To suppress on a healing
|
|
42
|
+
project, set `LOKI_HEAL_MODE=false`.
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
@@ -76,11 +76,71 @@ Gates 8 (Mock Detector) and 9 (Test Mutation Detector) run during the VERIFY pha
|
|
|
76
76
|
- Both produce findings at HIGH/MEDIUM/LOW severity levels
|
|
77
77
|
- HIGH findings = automatic FAIL (same as other blocking gates)
|
|
78
78
|
|
|
79
|
-
**Disabling (
|
|
79
|
+
**Disabling**: gates 8 and 9 are baked into the test pipeline (the bash
|
|
80
|
+
scripts at `tests/detect-mock-problems.sh` and
|
|
81
|
+
`tests/detect-test-mutations.sh`); they have no env-var toggle today.
|
|
82
|
+
Skip the gate by not running the script in your CI.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## v7.5.0 Phase 1 environment flags
|
|
87
|
+
|
|
88
|
+
These four flags activate the override council and structured-findings
|
|
89
|
+
pipeline added in v7.5.0. All default off; behavior is byte-identical
|
|
90
|
+
when unset.
|
|
91
|
+
|
|
80
92
|
```bash
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
LOKI_INJECT_FINDINGS=1 # inject structured per-finding records into the
|
|
94
|
+
# next iteration's prompt (instead of just the
|
|
95
|
+
# comma-separated gate-failure tokens)
|
|
96
|
+
|
|
97
|
+
LOKI_OVERRIDE_COUNCIL=1 # enable the 3-judge override council on BLOCK
|
|
98
|
+
# when .loki/state/counter-evidence-<iter>.json
|
|
99
|
+
# exists. Requires LOKI_INJECT_FINDINGS=1.
|
|
100
|
+
|
|
101
|
+
LOKI_AUTO_LEARNINGS=1 # auto-write structured learnings to
|
|
102
|
+
# .loki/state/relevant-learnings.json on every
|
|
103
|
+
# code_review gate failure
|
|
104
|
+
|
|
105
|
+
LOKI_HANDOFF_MD=1 # write a structured handoff doc to
|
|
106
|
+
# .loki/escalations/handoff-*.md before PAUSE
|
|
107
|
+
# (in addition to the bare PAUSE signal)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Optional: `LOKI_AUTO_LEARNINGS_EPISODE=1` also writes the learning into
|
|
111
|
+
the Python episodic memory layer via `memory.engine.save_episode`.
|
|
112
|
+
|
|
113
|
+
**Reachability note (v7.5.0/v7.5.1)**: these flags activate inside the
|
|
114
|
+
Bun runtime. Today `loki start <prd>` routes through the bash runner via
|
|
115
|
+
`bin/loki` shim fall-through, so the flags do not yet trigger on a real
|
|
116
|
+
`loki start`. They DO activate in any code path that calls
|
|
117
|
+
`loki-ts/src/runner/runQualityGates` directly (e.g. tests, programmatic
|
|
118
|
+
integration). End-to-end activation lands when Part A Phase 4 wires the
|
|
119
|
+
Bun `start` route. See CHANGELOG v7.5.0 NOT-tested section.
|
|
120
|
+
|
|
121
|
+
### Counter-evidence file format (`.loki/state/counter-evidence-<iter>.json`)
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"iteration": 7,
|
|
126
|
+
"evidence": [
|
|
127
|
+
{
|
|
128
|
+
"findingId": "eng-qa::- [Critical] dead code path bug at sdk/python/...",
|
|
129
|
+
"claim": "this code path is dead duplicate; live code is at sdk/src/gauge/",
|
|
130
|
+
"proofType": "duplicate-code-path",
|
|
131
|
+
"artifacts": ["sdk/python/ is excluded by pyproject.toml"]
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`findingId` is `canonicalFindingId(finding)` -- `<reviewer>::<first 80 chars
|
|
138
|
+
of the finding's raw text>`. `proofType` MUST be one of:
|
|
139
|
+
`file-exists`, `test-passes`, `grep-miss`, `reviewer-misread`,
|
|
140
|
+
`duplicate-code-path`, `out-of-scope`. Entries with any other proofType
|
|
141
|
+
are silently dropped at load time. The override council uses a stub
|
|
142
|
+
judge in v7.5.x that approves any of those six trusted proofTypes;
|
|
143
|
+
real provider-backed judges land in Phase 2 of Part B.
|
|
84
144
|
|
|
85
145
|
---
|
|
86
146
|
|