loki-mode 6.77.0 → 6.77.1

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 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 v6.77.0
6
+ # Loki Mode v6.77.1
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -272,4 +272,4 @@ The following features are documented in skill modules but not yet fully automat
272
272
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
273
273
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
274
274
 
275
- **v6.77.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
275
+ **v6.77.1 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.77.0
1
+ 6.77.1
@@ -345,9 +345,16 @@ def _parse_scenario(name: str, body: str) -> Dict[str, Any]:
345
345
 
346
346
  # -- Tasks Parsing ------------------------------------------------------------
347
347
 
348
- def parse_tasks(tasks_path: Path) -> Tuple[List[Dict[str, Any]], Dict[str, Dict[str, Any]]]:
348
+ def parse_tasks(tasks_path: Path, change_name: str = "") -> Tuple[List[Dict[str, Any]], Dict[str, Dict[str, Any]]]:
349
349
  """Parse tasks.md into structured task list and source map.
350
350
 
351
+ Args:
352
+ tasks_path: path to the change's tasks.md
353
+ change_name: OpenSpec change name, used to scope task IDs so that IDs
354
+ from different changes cannot collide in the pending queue. Default
355
+ empty string preserves backward compatibility with any caller that
356
+ does not pass the argument.
357
+
351
358
  Returns:
352
359
  (tasks_list, source_map)
353
360
  tasks_list: list of task objects
@@ -373,7 +380,9 @@ def parse_tasks(tasks_path: Path) -> Tuple[List[Dict[str, Any]], Dict[str, Dict[
373
380
  checked = task_match.group(1).lower() == "x"
374
381
  task_id_num = task_match.group(2)
375
382
  description = task_match.group(3).strip()
376
- task_id = f"openspec-{task_id_num}"
383
+ task_id = (
384
+ f"openspec-{change_name}-{task_id_num}" if change_name else f"openspec-{task_id_num}"
385
+ )
377
386
 
378
387
  task = {
379
388
  "id": task_id,
@@ -696,7 +705,7 @@ def run(
696
705
  source_map: Dict[str, Dict[str, Any]] = {}
697
706
  tasks_path = change_dir / "tasks.md"
698
707
  if tasks_path.exists():
699
- tasks_list, source_map = parse_tasks(tasks_path)
708
+ tasks_list, source_map = parse_tasks(tasks_path, change_name=change_name)
700
709
 
701
710
  # -- Parse design.md (optional) --
702
711
  design_data: Optional[Dict[str, str]] = None
package/autonomy/run.sh CHANGED
@@ -3594,9 +3594,13 @@ except: pass
3594
3594
  local prd_escaped
3595
3595
  prd_escaped=$(printf '%s' "${prd:-Codebase Analysis}" | sed 's/\\/\\\\/g; s/"/\\"/g; s/\t/\\t/g')
3596
3596
 
3597
- # Build enriched task JSON with pending task context
3598
- local task_json
3599
- if [[ -n "$next_task_context" ]]; then
3597
+ # Build enriched task JSON with pending task context.
3598
+ # Must initialize to empty: this script runs under `set -u` (line 152),
3599
+ # so `local task_json` without a value leaves it unset. When the pending
3600
+ # queue is empty, the enrichment `if` is skipped and the `-z` check below
3601
+ # would fire on an unset variable and kill the run.
3602
+ local task_json=""
3603
+ if [[ -n "${next_task_context:-}" ]]; then
3600
3604
  task_json=$(python3 -c "
3601
3605
  import json, sys
3602
3606
  ctx = json.loads('''$next_task_context''')
@@ -3619,11 +3623,11 @@ if ctx.get('source'):
3619
3623
  if ctx.get('project'):
3620
3624
  task['project'] = ctx['project']
3621
3625
  print(json.dumps(task, indent=2))
3622
- " 2>/dev/null)
3626
+ " 2>/dev/null) || task_json=""
3623
3627
  fi
3624
3628
 
3625
3629
  # Fallback to basic task JSON if enrichment failed
3626
- if [[ -z "$task_json" ]]; then
3630
+ if [[ -z "${task_json:-}" ]]; then
3627
3631
  task_json=$(cat <<EOF
3628
3632
  {
3629
3633
  "id": "$task_id",
@@ -8901,18 +8905,68 @@ bmad_write_back() {
8901
8905
  # OpenSpec Task Queue Population
8902
8906
  #===============================================================================
8903
8907
 
8904
- # Populate the task queue from OpenSpec task artifacts
8905
- # Only runs once -- skips if queue was already populated from OpenSpec
8908
+ # Compute a content hash for a file (cross-platform: uses Python hashlib so
8909
+ # behavior is identical on macOS and Linux, no md5/md5sum fork).
8910
+ _openspec_content_hash() {
8911
+ local file="$1"
8912
+ [[ -f "$file" ]] || { echo "none"; return 0; }
8913
+ python3 -c "import hashlib,sys; print(hashlib.md5(open(sys.argv[1],'rb').read()).hexdigest())" "$file" 2>/dev/null || echo "none"
8914
+ }
8915
+
8916
+ # Remove all tasks with source=="openspec" from a queue JSON file, preserving
8917
+ # every other source (prd, bmad, mirofish). Atomic: writes tmp + renames.
8918
+ purge_openspec_from_queue() {
8919
+ local queue_file="$1"
8920
+ [[ -f "$queue_file" ]] || return 0
8921
+ local tmp="${queue_file}.tmp.$$"
8922
+ if jq '[.[] | select(.source != "openspec")]' "$queue_file" > "$tmp" 2>/dev/null; then
8923
+ local before after
8924
+ before=$(jq 'length' "$queue_file" 2>/dev/null || echo 0)
8925
+ after=$(jq 'length' "$tmp" 2>/dev/null || echo 0)
8926
+ mv "$tmp" "$queue_file"
8927
+ if [[ "$before" != "$after" ]]; then
8928
+ log_info "Purged $((before - after)) OpenSpec tasks from $(basename "$queue_file")"
8929
+ fi
8930
+ else
8931
+ rm -f "$tmp"
8932
+ log_warn "Could not purge OpenSpec tasks from $(basename "$queue_file") (jq failed)"
8933
+ return 1
8934
+ fi
8935
+ }
8936
+
8937
+ # Populate the task queue from OpenSpec task artifacts.
8938
+ # The sentinel .loki/queue/.openspec-populated is scoped per change:
8939
+ # line 1 = change path, line 2 = content hash of openspec-tasks.json.
8940
+ # Same path + same hash -> skip (crash-restart preserves progress).
8941
+ # Different path -> change switched, purge stale tasks and repopulate.
8942
+ # Same path + different hash -> tasks.md edited, purge and repopulate.
8906
8943
  populate_openspec_queue() {
8907
8944
  # Skip if no OpenSpec tasks file
8908
8945
  if [[ ! -f ".loki/openspec-tasks.json" ]]; then
8909
8946
  return 0
8910
8947
  fi
8911
8948
 
8912
- # Skip if already populated (marker file)
8913
- if [[ -f ".loki/queue/.openspec-populated" ]]; then
8914
- log_info "OpenSpec queue already populated, skipping"
8915
- return 0
8949
+ local sentinel=".loki/queue/.openspec-populated"
8950
+ local current_path="${OPENSPEC_CHANGE_PATH:-}"
8951
+ local current_hash
8952
+ current_hash="$(_openspec_content_hash ".loki/openspec-tasks.json")"
8953
+
8954
+ if [[ -f "$sentinel" ]]; then
8955
+ local stored_path stored_hash
8956
+ stored_path="$(sed -n '1p' "$sentinel")"
8957
+ stored_hash="$(sed -n '2p' "$sentinel")"
8958
+ if [[ "$stored_path" == "$current_path" ]] && [[ "$stored_hash" == "$current_hash" ]]; then
8959
+ log_info "OpenSpec queue already populated for this change (path + hash match), skipping"
8960
+ return 0
8961
+ fi
8962
+ if [[ "$stored_path" != "$current_path" ]]; then
8963
+ log_info "OpenSpec change switched (was: ${stored_path:-<legacy>}, now: ${current_path:-<unset>}) -- purging stale OpenSpec tasks"
8964
+ else
8965
+ log_info "OpenSpec tasks.md content changed (hash mismatch) -- purging and reloading"
8966
+ fi
8967
+ purge_openspec_from_queue ".loki/queue/pending.json"
8968
+ purge_openspec_from_queue ".loki/queue/in-progress.json"
8969
+ purge_openspec_from_queue ".loki/queue/completed.json"
8916
8970
  fi
8917
8971
 
8918
8972
  log_step "Populating task queue from OpenSpec tasks..."
@@ -8985,8 +9039,9 @@ OPENSPEC_QUEUE_EOF
8985
9039
  return 0
8986
9040
  fi
8987
9041
 
8988
- # Mark as populated so we don't re-add on restart
8989
- touch ".loki/queue/.openspec-populated"
9042
+ # Mark as populated for this specific change + content hash so we don't
9043
+ # re-add on restart but DO repopulate when change-switching or tasks.md edits.
9044
+ printf '%s\n%s\n' "${OPENSPEC_CHANGE_PATH:-}" "$current_hash" > ".loki/queue/.openspec-populated"
8990
9045
  log_info "OpenSpec queue population complete"
8991
9046
  }
8992
9047
 
@@ -9836,7 +9891,13 @@ def process_stream():
9836
9891
  elif tool == "Bash":
9837
9892
  tool_desc = tool_input.get("description", tool_input.get("command", "")[:60])
9838
9893
  elif tool == "Grep":
9839
- tool_desc = f"pattern: {tool_input.get('pattern', '')}"
9894
+ # This Python block runs inside bash `python3 -u -c '...'`,
9895
+ # wrapped in a bash single-quoted string. A single-quoted
9896
+ # Python literal here would close bash SQ mid-code and
9897
+ # Python would receive a bare identifier instead of the
9898
+ # "pattern" string, crashing with NameError on every Grep
9899
+ # tool call. Use double quotes + concatenation only.
9900
+ tool_desc = "pattern: " + tool_input.get("pattern", "")
9840
9901
  elif tool == "Glob":
9841
9902
  tool_desc = tool_input.get("pattern", "")
9842
9903
 
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.77.0"
10
+ __version__ = "6.77.1"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.77.0
5
+ **Version:** v6.77.1
6
6
 
7
7
  ---
8
8
 
package/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '6.77.0'
60
+ __version__ = '6.77.1'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.77.0",
3
+ "version": "6.77.1",
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",