loki-mode 5.30.0 → 5.31.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
@@ -82,8 +82,44 @@ jobs:
82
82
  github_token: ${{ secrets.GITHUB_TOKEN }}
83
83
  mode: review # review, fix, or test
84
84
  provider: claude # claude, codex, or gemini
85
- max_iterations: 3 # higher = more thorough
86
- budget_limit: '5.00' # max cost in USD
85
+ max_iterations: 3 # sets LOKI_MAX_ITERATIONS env var
86
+ budget_limit: '5.00' # max cost in USD (maps to --budget flag)
87
+ env:
88
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
89
+ ```
90
+
91
+ **Prerequisites:**
92
+ - An API key for your chosen provider (set as a repository secret):
93
+ - Claude: `ANTHROPIC_API_KEY`
94
+ - Codex: `OPENAI_API_KEY`
95
+ - Gemini: `GOOGLE_API_KEY`
96
+ - The action automatically installs `loki-mode` and `@anthropic-ai/claude-code` (for the Claude provider)
97
+
98
+ **Action Inputs:**
99
+
100
+ | Input | Default | Description |
101
+ |-------|---------|-------------|
102
+ | `mode` | `review` | `review`, `fix`, or `test` |
103
+ | `provider` | `claude` | `claude`, `codex`, or `gemini` |
104
+ | `budget_limit` | `5.00` | Max cost in USD (maps to `--budget` CLI flag) |
105
+ | `budget` | | Alias for `budget_limit` |
106
+ | `max_iterations` | `3` | Sets `LOKI_MAX_ITERATIONS` env var |
107
+ | `github_token` | (required) | GitHub token for PR comments |
108
+ | `prd_file` | | Path to PRD file relative to repo root |
109
+ | `auto_confirm` | `true` | Skip confirmation prompts (always true in CI) |
110
+ | `install_claude` | `true` | Auto-install Claude Code CLI if not present |
111
+ | `node_version` | `20` | Node.js version |
112
+
113
+ **Using with a PRD file (fix/test modes):**
114
+
115
+ ```yaml
116
+ - uses: asklokesh/loki-mode@v5
117
+ with:
118
+ mode: fix
119
+ prd_file: 'docs/my-prd.md'
120
+ github_token: ${{ secrets.GITHUB_TOKEN }}
121
+ env:
122
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
87
123
  ```
88
124
 
89
125
  **Modes:**
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 zero human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v5.30.0
6
+ # Loki Mode v5.31.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -267,4 +267,4 @@ Auto-detected or force with `LOKI_COMPLEXITY`:
267
267
 
268
268
  ---
269
269
 
270
- **v5.30.0 | Compound learning, specialist reviewers, deepen-plan | ~280 lines core**
270
+ **v5.31.0 | Shell completions, GitHub Action enhancements, auto-confirm | ~280 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.30.0
1
+ 5.31.0
package/autonomy/loki CHANGED
@@ -317,6 +317,7 @@ show_help() {
317
317
  echo " voice [cmd] Voice input for PRD creation (status|listen|dictate|speak|start)"
318
318
  echo " import Import GitHub issues as tasks"
319
319
  echo " config [cmd] Manage configuration (show|init|edit|path)"
320
+ echo " completions [bash|zsh] Output shell completion scripts"
320
321
  echo " memory [cmd] Cross-project learnings (list|show|search|stats)"
321
322
  echo " compound [cmd] Knowledge compounding (list|show|search|run|stats)"
322
323
  echo " council [cmd] Completion council (status|verdicts|convergence|force-review|report)"
@@ -389,12 +390,22 @@ cmd_start() {
389
390
  echo " --sandbox Run in Docker sandbox"
390
391
  echo " --skip-memory Skip loading memory context at startup"
391
392
  echo " --budget USD Cost budget limit (auto-pause when exceeded)"
393
+ echo " --yes, -y Skip confirmation prompts (auto-confirm)"
394
+ echo ""
395
+ echo "Environment Variables:"
396
+ echo " LOKI_PRD_FILE Path to PRD file (alternative to positional arg)"
397
+ echo " LOKI_AUTO_CONFIRM Set to 'true' to skip confirmation prompts"
398
+ echo " CI When 'true', auto-confirms prompts"
399
+ echo " LOKI_MAX_ITERATIONS Max iteration count"
400
+ echo " LOKI_BUDGET_LIMIT Cost budget limit in USD"
392
401
  echo ""
393
402
  echo "Examples:"
394
403
  echo " loki start # Interactive or resume existing"
395
404
  echo " loki start ./prd.md # Start with PRD file"
396
405
  echo " loki start ./prd.md --parallel # Parallel mode with worktrees"
397
406
  echo " loki start --provider codex # Use OpenAI Codex CLI"
407
+ echo " loki start --yes # Skip confirmation prompt"
408
+ echo " LOKI_PRD_FILE=./prd.md loki start # PRD via env var"
398
409
  exit 0
399
410
  ;;
400
411
  --provider)
@@ -444,6 +455,10 @@ cmd_start() {
444
455
  export LOKI_SKIP_MEMORY=true
445
456
  shift
446
457
  ;;
458
+ --yes|-y)
459
+ export LOKI_AUTO_CONFIRM=true
460
+ shift
461
+ ;;
447
462
  --budget)
448
463
  if [[ -n "${2:-}" ]]; then
449
464
  if ! echo "$2" | grep -qE '^[0-9]+(\.[0-9]+)?$'; then
@@ -477,19 +492,29 @@ cmd_start() {
477
492
  esac
478
493
  done
479
494
 
495
+ # Support LOKI_PRD_FILE environment variable as fallback
496
+ if [ -z "$prd_file" ] && [ -n "${LOKI_PRD_FILE:-}" ]; then
497
+ prd_file="$LOKI_PRD_FILE"
498
+ fi
499
+
480
500
  if [ -n "$prd_file" ]; then
481
501
  args+=("$prd_file")
482
502
  else
483
503
  # No PRD file specified -- warn and confirm before consuming API credits
484
- echo -e "${YELLOW}Warning: No PRD file specified.${NC}"
485
- echo "Loki Mode will start autonomous execution in the current directory"
486
- echo "without a requirements document."
487
- echo ""
488
- echo -e "This will consume API credits. Continue? [y/N] \c"
489
- read -r confirm
490
- if [[ ! "$confirm" =~ ^[Yy] ]]; then
491
- echo "Aborted. Usage: loki start <path-to-prd.md>"
492
- exit 0
504
+ # Auto-confirm in CI environments or when LOKI_AUTO_CONFIRM is set
505
+ if [[ "${LOKI_AUTO_CONFIRM:-}" == "true" ]] || [[ "${CI:-}" == "true" ]]; then
506
+ echo -e "${YELLOW}Warning: No PRD file specified. Auto-confirming (CI mode).${NC}"
507
+ else
508
+ echo -e "${YELLOW}Warning: No PRD file specified.${NC}"
509
+ echo "Loki Mode will start autonomous execution in the current directory"
510
+ echo "without a requirements document."
511
+ echo ""
512
+ echo -e "This will consume API credits. Continue? [y/N] \c"
513
+ read -r confirm
514
+ if [[ ! "$confirm" =~ ^[Yy] ]]; then
515
+ echo "Aborted. Usage: loki start <path-to-prd.md>"
516
+ exit 0
517
+ fi
493
518
  fi
494
519
  fi
495
520
 
@@ -3568,6 +3593,9 @@ main() {
3568
3593
  version|--version|-v)
3569
3594
  cmd_version
3570
3595
  ;;
3596
+ completions)
3597
+ cmd_completions "$@"
3598
+ ;;
3571
3599
  help|--help|-h)
3572
3600
  show_help
3573
3601
  ;;
@@ -3845,9 +3873,13 @@ for filename in ['patterns.jsonl', 'mistakes.jsonl', 'successes.jsonl']:
3845
3873
  local type="${2:-}"
3846
3874
 
3847
3875
  if [ -z "$type" ]; then
3848
- echo -e "${YELLOW}This will delete ALL cross-project learnings.${NC}"
3849
- echo -n "Are you sure? (yes/no): "
3850
- read -r confirm
3876
+ if [[ "${LOKI_AUTO_CONFIRM:-}" == "true" ]] || [[ "${CI:-}" == "true" ]]; then
3877
+ confirm="yes"
3878
+ else
3879
+ echo -e "${YELLOW}This will delete ALL cross-project learnings.${NC}"
3880
+ echo -n "Are you sure? (yes/no): "
3881
+ read -r confirm
3882
+ fi
3851
3883
  if [ "$confirm" = "yes" ]; then
3852
3884
  rm -rf "$learnings_dir"
3853
3885
  mkdir -p "$learnings_dir"
@@ -5888,4 +5920,54 @@ for line in sys.stdin:
5888
5920
  esac
5889
5921
  }
5890
5922
 
5923
+ # Output shell completion scripts
5924
+ cmd_completions() {
5925
+ local shell="${1:-bash}"
5926
+ local skill_dir
5927
+
5928
+ # Find the skill directory (where autonomy/loki is located)
5929
+ skill_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5930
+ local completions_dir="$skill_dir/completions"
5931
+
5932
+ case "$shell" in
5933
+ bash)
5934
+ if [ -f "$completions_dir/loki.bash" ]; then
5935
+ cat "$completions_dir/loki.bash"
5936
+ else
5937
+ echo -e "${RED}Error: Bash completion script not found at $completions_dir/loki.bash${NC}" >&2
5938
+ exit 1
5939
+ fi
5940
+ ;;
5941
+ zsh)
5942
+ if [ -f "$completions_dir/_loki" ]; then
5943
+ cat "$completions_dir/_loki"
5944
+ else
5945
+ echo -e "${RED}Error: Zsh completion script not found at $completions_dir/_loki${NC}" >&2
5946
+ exit 1
5947
+ fi
5948
+ ;;
5949
+ *)
5950
+ echo -e "${BOLD}Loki Shell Completions${NC}"
5951
+ echo ""
5952
+ echo "Output shell completion scripts for bash or zsh."
5953
+ echo ""
5954
+ echo "Usage: loki completions <shell>"
5955
+ echo ""
5956
+ echo "Shells:"
5957
+ echo " bash Bash completion script"
5958
+ echo " zsh Zsh completion script"
5959
+ echo ""
5960
+ echo "Installation:"
5961
+ echo ""
5962
+ echo "Bash:"
5963
+ echo " eval \"\$(loki completions bash)\" >> ~/.bashrc"
5964
+ echo ""
5965
+ echo "Zsh:"
5966
+ echo " eval \"\$(loki completions zsh)\" >> ~/.zshrc"
5967
+ echo ""
5968
+ exit 1
5969
+ ;;
5970
+ esac
5971
+ }
5972
+
5891
5973
  main "$@"
package/autonomy/run.sh CHANGED
@@ -712,15 +712,28 @@ emit_learning_signal() {
712
712
 
713
713
  # Track iteration timing for efficiency signals
714
714
  ITERATION_START_MS=""
715
+
716
+ # Get current time in milliseconds (portable: works on macOS BSD date and GNU date)
717
+ _now_ms() {
718
+ local ms
719
+ ms=$(date +%s%3N 2>/dev/null)
720
+ # macOS BSD date doesn't support %N -- outputs literal "N" or "%3N"
721
+ # Detect non-numeric output and fall back to seconds * 1000
722
+ case "$ms" in
723
+ *[!0-9]*) echo $(( $(date +%s) * 1000 )) ;;
724
+ *) echo "$ms" ;;
725
+ esac
726
+ }
727
+
715
728
  record_iteration_start() {
716
- ITERATION_START_MS=$(date +%s%3N 2>/dev/null || echo $(($(date +%s) * 1000)))
729
+ ITERATION_START_MS=$(_now_ms)
717
730
  }
718
731
 
719
732
  # Get iteration duration in milliseconds
720
733
  get_iteration_duration_ms() {
721
734
  if [ -n "$ITERATION_START_MS" ]; then
722
735
  local end_ms
723
- end_ms=$(date +%s%3N 2>/dev/null || echo $(($(date +%s) * 1000)))
736
+ end_ms=$(_now_ms)
724
737
  echo $((end_ms - ITERATION_START_MS))
725
738
  else
726
739
  echo "0"
@@ -2577,7 +2590,7 @@ track_iteration_complete() {
2577
2590
  elif [ "${PROVIDER_NAME:-claude}" = "gemini" ]; then
2578
2591
  model_tier="gemini-3-pro"
2579
2592
  fi
2580
- local phase="$current_phase"
2593
+ local phase="${LAST_KNOWN_PHASE:-}"
2581
2594
  [ -z "$phase" ] && phase=$(python3 -c "import json; print(json.load(open('.loki/state/orchestrator.json')).get('currentPhase', 'unknown'))" 2>/dev/null || echo "unknown")
2582
2595
  cat > ".loki/metrics/efficiency/iteration-${iteration}.json" << EFF_EOF
2583
2596
  {
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "5.30.0"
10
+ __version__ = "5.31.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v5.30.0
5
+ **Version:** v5.31.0
6
6
 
7
7
  ---
8
8
 
@@ -20,6 +20,7 @@ Complete installation instructions for all platforms and use cases.
20
20
  - [Anthropic API Console](#anthropic-api-console)
21
21
  - [Verify Installation](#verify-installation)
22
22
  - [Ports](#ports)
23
+ - [Shell Completions](#shell-completions)
23
24
  - [Troubleshooting](#troubleshooting)
24
25
 
25
26
  ---
@@ -36,7 +37,7 @@ npm install -g loki-mode
36
37
  brew tap asklokesh/tap && brew install loki-mode
37
38
 
38
39
  # Option C: Docker
39
- docker pull asklokesh/loki-mode:5.30.0
40
+ docker pull asklokesh/loki-mode:5.31.0
40
41
 
41
42
  # Option D: Git clone
42
43
  git clone https://github.com/asklokesh/loki-mode.git ~/.claude/skills/loki-mode
@@ -227,7 +228,7 @@ Run Loki Mode in a container for isolated execution.
227
228
 
228
229
  ```bash
229
230
  # Pull the image
230
- docker pull asklokesh/loki-mode:5.30.0
231
+ docker pull asklokesh/loki-mode:5.31.0
231
232
 
232
233
  # Or use docker-compose
233
234
  curl -o docker-compose.yml https://raw.githubusercontent.com/asklokesh/loki-mode/main/docker-compose.yml
@@ -237,10 +238,10 @@ curl -o docker-compose.yml https://raw.githubusercontent.com/asklokesh/loki-mode
237
238
 
238
239
  ```bash
239
240
  # Run with a PRD file
240
- docker run -v $(pwd):/workspace -w /workspace asklokesh/loki-mode:5.30.0 start ./my-prd.md
241
+ docker run -v $(pwd):/workspace -w /workspace asklokesh/loki-mode:5.31.0 start ./my-prd.md
241
242
 
242
243
  # Interactive mode
243
- docker run -it -v $(pwd):/workspace -w /workspace asklokesh/loki-mode:5.30.0
244
+ docker run -it -v $(pwd):/workspace -w /workspace asklokesh/loki-mode:5.31.0
244
245
 
245
246
  # Using docker-compose
246
247
  docker-compose run loki start ./my-prd.md
@@ -253,7 +254,7 @@ Pass your configuration via environment variables:
253
254
  ```bash
254
255
  docker run -e LOKI_MAX_RETRIES=100 -e LOKI_BASE_WAIT=120 \
255
256
  -v $(pwd):/workspace -w /workspace \
256
- asklokesh/loki-mode:5.30.0 start ./my-prd.md
257
+ asklokesh/loki-mode:5.31.0 start ./my-prd.md
257
258
  ```
258
259
 
259
260
  ### Updating
@@ -369,12 +370,12 @@ Pass the provider as an environment variable:
369
370
  # Use Codex with Docker
370
371
  docker run -e LOKI_PROVIDER=codex \
371
372
  -v $(pwd):/workspace -w /workspace \
372
- asklokesh/loki-mode:5.30.0 start ./my-prd.md
373
+ asklokesh/loki-mode:5.31.0 start ./my-prd.md
373
374
 
374
375
  # Use Gemini with Docker
375
376
  docker run -e LOKI_PROVIDER=gemini \
376
377
  -v $(pwd):/workspace -w /workspace \
377
- asklokesh/loki-mode:5.30.0 start ./my-prd.md
378
+ asklokesh/loki-mode:5.31.0 start ./my-prd.md
378
379
  ```
379
380
 
380
381
  ### Degraded Mode
@@ -611,6 +612,107 @@ CORS_ALLOWED_ORIGINS="http://localhost:3000,https://my-dashboard.example.com" lo
611
612
 
612
613
  ---
613
614
 
615
+ ## Shell Completions
616
+
617
+ Enable tab completion for the `loki` CLI to support subcommands, flags, and file arguments.
618
+
619
+ ---
620
+
621
+ ## Bash Setup
622
+
623
+ ### Option 1: Permanent Setup (Recommended)
624
+
625
+ Add the source command to your startup file so completions load every time you open a terminal.
626
+
627
+ Add this line to your `~/.bashrc` (Linux) or `~/.bash_profile` (macOS):
628
+
629
+ ```bash
630
+ source /path/to/loki/completions/loki.bash
631
+ ```
632
+
633
+ ---
634
+
635
+ ### Option 2: Manual Sourcing (Temporary)
636
+
637
+ If you only want to enable completions for your current terminal session (for example, for testing), run:
638
+
639
+ ```bash
640
+ source completions/loki.bash
641
+ ```
642
+
643
+ ---
644
+
645
+ ### Optional: Smoother Bash Experience
646
+
647
+ By default, Bash requires two **TAB** presses to show the completion menu. To make it instant (similar to Zsh) and cycle through options more easily, add the following lines to your `~/.inputrc` file:
648
+
649
+ ```bash
650
+ # Show menu immediately on first TAB
651
+ set show-all-if-ambiguous on
652
+
653
+ # Case-insensitive completion (optional)
654
+ set completion-ignore-case on
655
+ ```
656
+
657
+ > **Note:** You will need to restart your terminal for `~/.inputrc` changes to take effect.
658
+
659
+ ---
660
+
661
+ ## Zsh Setup
662
+
663
+ Zsh completions require the script to be located in a directory listed in your `$fpath`.
664
+
665
+ ### Permanent Setup
666
+
667
+ Add the `loki` completions directory to your `$fpath` in `~/.zshrc` **before** initializing completions:
668
+
669
+ ```bash
670
+ # 1. Add the completions directory to fpath
671
+ fpath=(/path/to/loki/completions $fpath)
672
+
673
+ # 2. Initialize completions
674
+ autoload -Uz compinit && compinit
675
+ ```
676
+
677
+ ---
678
+
679
+ ## Testing Completions
680
+
681
+ After installation, restart your shell or source your configuration file, then verify:
682
+
683
+ ### Bash
684
+
685
+ ```bash
686
+ loki <TAB> # Should immediately list subcommands
687
+ loki start -<TAB> # Should list flags (--provider, --parallel, etc.)
688
+ ```
689
+
690
+ ### Zsh
691
+
692
+ ```bash
693
+ loki <TAB> # Should show subcommands with descriptions
694
+ loki start --pro<TAB> # Should autocomplete to --provider
695
+ ```
696
+
697
+ ---
698
+
699
+ ## Completion Features
700
+
701
+ The completion scripts support:
702
+
703
+ * **Subcommands**
704
+ `start`, `stop`, `pause`, `resume`, `status`, `dashboard`, `import`, `council`, `memory`, `provider`, `config`, `help`, `completions`
705
+
706
+ * **Smart Context**
707
+
708
+ * `loki start --provider <TAB>` shows only installed providers (`claude`, `codex`, `gemini`).
709
+ * `loki start <TAB>` defaults to file completion for PRD templates.
710
+
711
+ * **Nested Commands**
712
+ Handles specific subcommands for `council`, `memory`, and `config`.
713
+
714
+ ---
715
+
614
716
  ## Troubleshooting
615
717
 
616
718
  ### Skill Not Found
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "claude",