loki-mode 5.8.7 → 5.8.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/VERSION CHANGED
@@ -1 +1 @@
1
- 5.8.7
1
+ 5.8.8
package/autonomy/run.sh CHANGED
@@ -3515,6 +3515,71 @@ load_state() {
3515
3515
  fi
3516
3516
  }
3517
3517
 
3518
+ # Load tasks from queue files for prompt injection
3519
+ # Supports both array format [...] and object format {"tasks": [...]}
3520
+ load_queue_tasks() {
3521
+ local task_injection=""
3522
+
3523
+ # Helper Python script to extract and format tasks
3524
+ # Handles both formats, truncates long actions, normalizes newlines
3525
+ local extract_script='
3526
+ import json
3527
+ import sys
3528
+
3529
+ def extract_tasks(filepath, prefix):
3530
+ try:
3531
+ data = json.load(open(filepath))
3532
+ # Support both formats: [...] and {"tasks": [...]}
3533
+ tasks = data.get("tasks", data) if isinstance(data, dict) else data
3534
+ if not isinstance(tasks, list):
3535
+ return ""
3536
+
3537
+ results = []
3538
+ for i, task in enumerate(tasks[:3]): # Limit to first 3 tasks
3539
+ if not isinstance(task, dict):
3540
+ continue
3541
+ task_id = task.get("id") or "unknown"
3542
+ task_type = task.get("type") or "unknown"
3543
+ payload = task.get("payload", {})
3544
+
3545
+ # Extract action from payload
3546
+ if isinstance(payload, dict):
3547
+ action = payload.get("action") or payload.get("goal") or ""
3548
+ else:
3549
+ action = str(payload) if payload else ""
3550
+
3551
+ # Normalize: remove newlines, truncate to 500 chars
3552
+ action = str(action).replace("\n", " ").replace("\r", "")[:500]
3553
+ if len(str(task.get("payload", {}).get("action", ""))) > 500:
3554
+ action += "..."
3555
+
3556
+ results.append(f"{prefix}[{i+1}] id={task_id} type={task_type}: {action}")
3557
+
3558
+ return " ".join(results)
3559
+ except:
3560
+ return ""
3561
+
3562
+ # Check in-progress first
3563
+ in_progress = extract_tasks(".loki/queue/in-progress.json", "TASK")
3564
+ pending = extract_tasks(".loki/queue/pending.json", "PENDING")
3565
+
3566
+ output = []
3567
+ if in_progress:
3568
+ output.append(f"IN-PROGRESS TASKS (EXECUTE THESE): {in_progress}")
3569
+ if pending:
3570
+ output.append(f"PENDING: {pending}")
3571
+
3572
+ print(" | ".join(output))
3573
+ '
3574
+
3575
+ # First check in-progress tasks (highest priority)
3576
+ if [ -f ".loki/queue/in-progress.json" ] || [ -f ".loki/queue/pending.json" ]; then
3577
+ task_injection=$(python3 -c "$extract_script" 2>/dev/null || echo "")
3578
+ fi
3579
+
3580
+ echo "$task_injection"
3581
+ }
3582
+
3518
3583
  #===============================================================================
3519
3584
  # Build Resume Prompt
3520
3585
  #===============================================================================
@@ -3588,17 +3653,24 @@ build_prompt() {
3588
3653
  human_directive="HUMAN_DIRECTIVE (PRIORITY): $LOKI_HUMAN_INPUT Execute this directive BEFORE continuing normal tasks."
3589
3654
  fi
3590
3655
 
3656
+ # Queue task injection (from dashboard or API)
3657
+ local queue_tasks=""
3658
+ queue_tasks=$(load_queue_tasks)
3659
+ if [ -n "$queue_tasks" ]; then
3660
+ queue_tasks="QUEUED_TASKS (PRIORITY): $queue_tasks. Execute these tasks BEFORE finding new improvements."
3661
+ fi
3662
+
3591
3663
  if [ $retry -eq 0 ]; then
3592
3664
  if [ -n "$prd" ]; then
3593
- echo "Loki Mode with PRD at $prd. $human_directive $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3665
+ echo "Loki Mode with PRD at $prd. $human_directive $queue_tasks $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3594
3666
  else
3595
- echo "Loki Mode. $human_directive $analysis_instruction $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3667
+ echo "Loki Mode. $human_directive $queue_tasks $analysis_instruction $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3596
3668
  fi
3597
3669
  else
3598
3670
  if [ -n "$prd" ]; then
3599
- echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $human_directive $context_injection $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3671
+ echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $human_directive $queue_tasks $context_injection $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3600
3672
  else
3601
- echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $human_directive $context_injection Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3673
+ echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $human_directive $queue_tasks $context_injection Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
3602
3674
  fi
3603
3675
  fi
3604
3676
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "5.8.7",
3
+ "version": "5.8.8",
4
4
  "description": "Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "claude",