loki-mode 7.5.6 → 7.5.8

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/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '7.5.6'
60
+ __version__ = '7.5.8'
package/mcp/server.py CHANGED
@@ -1554,7 +1554,13 @@ async def loki_code_search(
1554
1554
  logger.error(f"Code search failed: {e}")
1555
1555
  _emit_tool_event_async('loki_code_search', 'complete',
1556
1556
  result_status='error', error=str(e))
1557
- return json.dumps({"error": str(e)})
1557
+ # Generic envelope: do not leak raw exception text (may include
1558
+ # ChromaDB connection details / internal field names) to client.
1559
+ return json.dumps({
1560
+ "error": "Code search failed",
1561
+ "code": "CHROMA_QUERY_ERROR",
1562
+ "hint": "Ensure ChromaDB is running: docker start loki-chroma",
1563
+ })
1558
1564
 
1559
1565
 
1560
1566
  @mcp.tool()
@@ -1601,7 +1607,13 @@ async def loki_code_search_stats() -> str:
1601
1607
  "reindex_command": "python3.12 tools/index-codebase.py --reset",
1602
1608
  })
1603
1609
  except Exception as e:
1604
- return json.dumps({"error": str(e)})
1610
+ logger.error(f"Code search stats failed: {e}")
1611
+ # Generic envelope: do not leak raw exception text to client.
1612
+ return json.dumps({
1613
+ "error": "Index unavailable",
1614
+ "code": "CHROMA_STATS_ERROR",
1615
+ "hint": "docker start loki-chroma",
1616
+ })
1605
1617
 
1606
1618
 
1607
1619
  # ============================================================
@@ -1882,7 +1894,7 @@ async def loki_get_hotspots(
1882
1894
 
1883
1895
  try:
1884
1896
  results = []
1885
- with open(hotspots_path, 'r') as f:
1897
+ with safe_open(hotspots_path, 'r') as f:
1886
1898
  for line in f:
1887
1899
  line = line.strip()
1888
1900
  if not line:
@@ -1940,7 +1952,7 @@ async def loki_get_co_changes(
1940
1952
  })
1941
1953
 
1942
1954
  try:
1943
- with open(co_changes_path, 'r') as f:
1955
+ with safe_open(co_changes_path, 'r') as f:
1944
1956
  pairs = json.load(f)
1945
1957
 
1946
1958
  # Filter pairs involving the requested file
@@ -1993,7 +2005,7 @@ async def loki_get_doc_coverage() -> str:
1993
2005
  })
1994
2006
 
1995
2007
  try:
1996
- with open(manifest_path, 'r') as f:
2008
+ with safe_open(manifest_path, 'r') as f:
1997
2009
  manifest = json.load(f)
1998
2010
 
1999
2011
  total_files = manifest.get("total_files", 0)
@@ -2077,7 +2089,13 @@ async def loki_findings(iteration: int = -1) -> str:
2077
2089
  if entry.endswith('-prompt.txt'):
2078
2090
  continue
2079
2091
  reviewer = entry[:-4]
2080
- with safe_open(os.path.join(review_path, entry), 'r') as f:
2092
+ try:
2093
+ entry_path = safe_path_join(review_path, entry)
2094
+ except PathTraversalError:
2095
+ # Skip listdir entries that resolve outside the review dir
2096
+ # (defensive against e.g. "../etc/passwd"-style names).
2097
+ continue
2098
+ with safe_open(entry_path, 'r') as f:
2081
2099
  body = f.read()
2082
2100
  for line in body.splitlines():
2083
2101
  stripped = line.strip().lstrip('-* ').strip()
@@ -2110,8 +2128,20 @@ async def loki_learnings(limit: int = 50) -> str:
2110
2128
  path = safe_path_join('.loki', 'state', 'relevant-learnings.json')
2111
2129
  if not os.path.exists(path):
2112
2130
  return json.dumps({"version": 1, "learnings": [], "total": 0})
2113
- with safe_open(path, 'r') as f:
2114
- data = json.load(f)
2131
+ try:
2132
+ with safe_open(path, 'r') as f:
2133
+ data = json.load(f)
2134
+ except (json.JSONDecodeError, ValueError) as je:
2135
+ # Surface corruption explicitly rather than masking it as empty.
2136
+ logger.error(f"loki_learnings corrupt file at {path}: {je}")
2137
+ _emit_tool_event_async('loki_learnings', 'complete',
2138
+ result_status='error', error=str(je))
2139
+ return json.dumps({
2140
+ "error": "Learning file corrupted",
2141
+ "code": "LEARNINGS_CORRUPT",
2142
+ "path": path,
2143
+ "entries": [],
2144
+ })
2115
2145
  learnings = data.get('learnings', []) if isinstance(data, dict) else []
2116
2146
  if not isinstance(learnings, list):
2117
2147
  learnings = []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "7.5.6",
3
+ "version": "7.5.8",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "agent",
@@ -124,7 +124,7 @@
124
124
  "@opentelemetry/exporter-trace-otlp-http": "^0.57.0"
125
125
  },
126
126
  "overrides": {
127
- "protobufjs": ">=7.5.6"
127
+ "protobufjs": ">=7.5.8"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@types/node": "^25.2.0",
@@ -70,6 +70,10 @@ Every iteration follows this cycle:
70
70
  - Retries with learned context
71
71
  - Achieves 2-3x quality improvement (Boris Cherny's observed result)
72
72
 
73
+ ### Phase 1 RARV-C Closure (v7.5.0+)
74
+
75
+ The RARV cycle now closes with an explicit Critique step (RARV-C). After VERIFY, an override council of real provider judges (v7.5.4) issues a binding decision before the iteration is marked complete. See `references/quality-control.md` for the override council protocol.
76
+
73
77
  ---
74
78
 
75
79
  ## CONTINUITY.md - Working Memory Protocol
@@ -602,3 +602,9 @@ vault kv get -field=database-url secret/app
602
602
  ```
603
603
 
604
604
  All production secrets must be in a secrets manager, never in code or environment files.
605
+
606
+ ---
607
+
608
+ ## Loki Mode Release Workflow
609
+
610
+ Releasing a new Loki Mode version requires bumping the version string in 14 locations in a single commit (VERSION, package.json, SKILL.md header and footer, Dockerfile, Dockerfile.sandbox, vscode-extension/package.json, CLAUDE.md, dashboard/__init__.py, mcp/__init__.py, CHANGELOG.md, docs/INSTALLATION.md, wiki/Home.md, wiki/_Sidebar.md, wiki/API-Reference.md). The full step-by-step procedure, pre-publish validation, and distribution channel checklist live in the project root `CLAUDE.md` Release Workflow section.
@@ -4,7 +4,7 @@ Enhanced memory architecture based on 2025 research (MIRIX, A-Mem, MemGPT, AriGr
4
4
 
5
5
  ---
6
6
 
7
- ## Implementation Status (v5.15.0)
7
+ ## Implementation Status (introduced v5.15.0, current as of v7.5.x)
8
8
 
9
9
  | Feature | Status | Location |
10
10
  |---------|--------|----------|
@@ -550,6 +550,12 @@ cost_patterns:
550
550
 
551
551
  ---
552
552
 
553
+ ## Cross-Process File Lock (v7.5.5)
554
+
555
+ Concurrent loki invocations on the same `.loki/` workspace previously raced on `state/orchestrator.json`, `queue/pending.json`, and CONTINUITY.md. v7.5.5 introduces a `flock`-backed cross-process lock around all state writes. Concurrent runs serialize state mutations cleanly; readers continue without blocking.
556
+
557
+ ---
558
+
553
559
  ## Sources
554
560
 
555
561
  **Hacker News Discussions:**
@@ -14,13 +14,13 @@ Research-backed technique from arXiv 2512.14982v1: "Prompt Repetition Improves N
14
14
 
15
15
  ## When to Apply
16
16
 
17
- ### USE Prompt Repetition For:
17
+ ### USE Prompt Repetition For:
18
18
  - **Haiku agents** (non-reasoning model)
19
19
  - **Structured tasks** (unit tests, linting, formatting)
20
20
  - **Position-dependent operations** (finding items in lists, parsing structured data)
21
21
  - **Simple bug fixes** (typos, imports, syntax errors)
22
22
 
23
- ### DO NOT Use For:
23
+ ### DO NOT Use For:
24
24
  - **Opus agents** (reasoning model - neutral/slightly negative effect)
25
25
  - **Sonnet agents** (reasoning model - neutral effect)
26
26
  - **Complex reasoning tasks** (architecture decisions, planning)
@@ -135,6 +135,12 @@ See `references/openai-patterns.md` for full guardrails implementation.
135
135
 
136
136
  ---
137
137
 
138
+ ## Override Council (v7.5.4)
139
+
140
+ The override council closes the RARV-C cycle with real provider judges (Claude/Codex/Gemini) rather than scripted heuristics. Each judge reviews the iteration outcome independently and casts a binding ALLOW or BLOCK vote. A unanimous ALLOW closes the iteration; any BLOCK reopens REASON with the judge's rationale appended to CONTINUITY.md. See Phase 1 RARV-C closure in `references/core-workflow.md`.
141
+
142
+ ---
143
+
138
144
  ## Quality Gates
139
145
 
140
146
  **Never ship code without passing all quality gates:**
package/skills/agents.md CHANGED
@@ -93,11 +93,11 @@ Success: Endpoint works, tests pass, matches OpenAPI spec.
93
93
 
94
94
  ## Specialist Review Pattern (v5.30.0)
95
95
 
96
- **Code review uses 3 specialist reviewers selected from a pool of 5 named experts.**
96
+ **Code review uses 3 specialist reviewers selected from a pool of 6 named experts.**
97
97
 
98
98
  See `quality-gates.md` for full specialist definitions, selection rules, and prompt templates.
99
99
 
100
- **Pool:** security-sentinel, performance-oracle, architecture-strategist, test-coverage-auditor, dependency-analyst
100
+ **Pool:** security-sentinel, performance-oracle, architecture-strategist, test-coverage-auditor, dependency-analyst, legacy-healing-auditor
101
101
 
102
102
  **Selection:** architecture-strategist always included + top 2 by trigger keyword match against diff.
103
103
 
package/skills/healing.md CHANGED
@@ -257,6 +257,22 @@ VERIFY: Run the test.
257
257
  (Amazon: "the hardest part is teaching why workflows fail")
258
258
  ```
259
259
 
260
+ ### RARV-C Closure Flags (v7.5.0+)
261
+
262
+ The Phase 1 RARV-C closure pipeline is also useful in healing runs because
263
+ characterization-test failures generate structured findings that benefit
264
+ from override-council adjudication and persistent learnings:
265
+
266
+ ```bash
267
+ LOKI_INJECT_FINDINGS=1 # structured findings -> next-iteration prompt
268
+ LOKI_OVERRIDE_COUNCIL=1 # 3-judge override council on BLOCK
269
+ LOKI_AUTO_LEARNINGS=1 # persist code_review failures as learnings
270
+ LOKI_HANDOFF_MD=1 # write handoff doc before PAUSE
271
+ ```
272
+
273
+ Full spec and counter-evidence schema: `skills/quality-gates.md` (v7.5.0
274
+ Phase 1 environment flags section).
275
+
260
276
  ---
261
277
 
262
278
  ## Structured Fault Injection (Honest Alternative to RL Gyms)
@@ -166,7 +166,7 @@ loki start --provider cline ./prd.md
166
166
  # With specific model
167
167
  loki start --provider cline --cline-model deepseek/deepseek-chat ./prd.md
168
168
 
169
- # With loki run
169
+ # With loki run (DEPRECATED -- still works; prefer `loki start`)
170
170
  loki run 52 --provider cline --ship -d
171
171
  ```
172
172
 
@@ -110,6 +110,24 @@ LOKI_HANDOFF_MD=1 # write a structured handoff doc to
110
110
  Optional: `LOKI_AUTO_LEARNINGS_EPISODE=1` also writes the learning into
111
111
  the Python episodic memory layer via `memory.engine.save_episode`.
112
112
 
113
+ **Override-judge knobs (v7.5.4+):**
114
+
115
+ ```bash
116
+ LOKI_OVERRIDE_JUDGES=claude,gemini # csv of provider names for the
117
+ # 3-judge override council. Defaults
118
+ # to the available installed providers
119
+ # (claude, codex, gemini, cline, aider).
120
+ LOKI_OVERRIDE_REAL_JUDGE=0 # force the deterministic stub-judge
121
+ # path (hermetic CI / cost control).
122
+ # Default: 1 = real provider-backed
123
+ # judges when their CLIs are present;
124
+ # falls back to stub on missing CLI
125
+ # or transient provider failure.
126
+ ```
127
+
128
+ Implementation: `loki-ts/src/runner/quality_gates.ts:760` (judge dispatch),
129
+ `:780` (csv parse), `:987` (real-judge gate).
130
+
113
131
  **Reachability note (v7.5.0/v7.5.1)**: these flags activate inside the
114
132
  Bun runtime. Today `loki start <prd>` routes through the bash runner via
115
133
  `bin/loki` shim fall-through, so the flags do not yet trigger on a real