loki-mode 5.2.4 → 5.4.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 +10 -0
- package/SKILL.md +28 -14
- package/VERSION +1 -1
- package/autonomy/run.sh +61 -9
- package/docs/loki-mode-presentation.gif +0 -0
- package/docs/loki-mode-presentation.pptx +0 -0
- package/package.json +1 -1
- package/providers/claude.sh +33 -9
- package/skills/model-selection.md +28 -6
package/README.md
CHANGED
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
+
## Presentation
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
*9 slides: Problem, Solution, 37 Agents, RARV Cycle, Benchmarks, Multi-Provider, Full Lifecycle*
|
|
33
|
+
|
|
34
|
+
**[Download PPTX](docs/loki-mode-presentation.pptx)** for offline viewing
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
28
38
|
## Usage
|
|
29
39
|
|
|
30
40
|
### Option 1: Claude Code Skill (Recommended)
|
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.
|
|
6
|
+
# Loki Mode v5.4.0
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -88,15 +88,17 @@ These rules are ABSOLUTE. Violating them is a critical failure.
|
|
|
88
88
|
|
|
89
89
|
## Model Selection
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|-----------|------|--------|-------|--------|
|
|
93
|
-
| PRD analysis, architecture, system design | **planning** | opus | effort=xhigh | thinking=high |
|
|
94
|
-
| Feature implementation, complex bugs | **development** | sonnet | effort=high | thinking=medium |
|
|
95
|
-
| Code review (always 3 parallel reviewers) | **development** | sonnet | effort=high | thinking=medium |
|
|
96
|
-
| Integration tests, E2E, deployment | **development** | sonnet | effort=high | thinking=medium |
|
|
97
|
-
| Unit tests, linting, docs, simple fixes | **fast** | haiku | effort=low | thinking=low |
|
|
91
|
+
**Default (v5.3.0):** Haiku disabled for quality. Use `--allow-haiku` or `LOKI_ALLOW_HAIKU=true` to enable.
|
|
98
92
|
|
|
99
|
-
|
|
93
|
+
| Task Type | Tier | Claude (default) | Claude (--allow-haiku) | Codex | Gemini |
|
|
94
|
+
|-----------|------|------------------|------------------------|-------|--------|
|
|
95
|
+
| PRD analysis, architecture, system design | **planning** | opus | opus | effort=xhigh | thinking=high |
|
|
96
|
+
| Feature implementation, complex bugs | **development** | opus | sonnet | effort=high | thinking=medium |
|
|
97
|
+
| Code review (always 3 parallel reviewers) | **development** | opus | sonnet | effort=high | thinking=medium |
|
|
98
|
+
| Integration tests, E2E, deployment | **development** | opus | sonnet | effort=high | thinking=medium |
|
|
99
|
+
| Unit tests, linting, docs, simple fixes | **fast** | sonnet | haiku | effort=low | thinking=low |
|
|
100
|
+
|
|
101
|
+
**Parallelization rule (Claude only):** Launch up to 10 agents simultaneously for independent tasks.
|
|
100
102
|
|
|
101
103
|
**Degraded mode (Codex/Gemini):** No parallel agents or Task tool. Runs RARV cycle sequentially. See `skills/model-selection.md`.
|
|
102
104
|
|
|
@@ -180,11 +182,11 @@ GROWTH ──[continuous improvement loop]──> GROWTH
|
|
|
180
182
|
```bash
|
|
181
183
|
# Standard mode (Claude - full features)
|
|
182
184
|
claude --dangerously-skip-permissions
|
|
183
|
-
# Then say: "Loki Mode" or "Loki Mode with PRD at path/to/prd.md"
|
|
185
|
+
# Then say: "Loki Mode" or "Loki Mode with PRD at path/to/prd.md" (or .json)
|
|
184
186
|
|
|
185
|
-
# With provider selection
|
|
187
|
+
# With provider selection (supports .md and .json PRDs)
|
|
186
188
|
./autonomy/run.sh --provider claude ./prd.md # Default, full features
|
|
187
|
-
./autonomy/run.sh --provider codex ./prd.
|
|
189
|
+
./autonomy/run.sh --provider codex ./prd.json # GPT-5.2 Codex, degraded mode
|
|
188
190
|
./autonomy/run.sh --provider gemini ./prd.md # Gemini 3 Pro, degraded mode
|
|
189
191
|
|
|
190
192
|
# Or via CLI wrapper
|
|
@@ -208,11 +210,23 @@ When running with `autonomy/run.sh`, you can intervene:
|
|
|
208
210
|
| Method | Effect |
|
|
209
211
|
|--------|--------|
|
|
210
212
|
| `touch .loki/PAUSE` | Pauses after current session |
|
|
211
|
-
| `echo "instructions" > .loki/HUMAN_INPUT.md` | Injects
|
|
213
|
+
| `echo "instructions" > .loki/HUMAN_INPUT.md` | Injects directive into next prompt (executed immediately) |
|
|
212
214
|
| `touch .loki/STOP` | Stops immediately |
|
|
213
215
|
| Ctrl+C (once) | Pauses, shows options |
|
|
214
216
|
| Ctrl+C (twice) | Exits immediately |
|
|
215
217
|
|
|
218
|
+
### Hints vs Directives
|
|
219
|
+
|
|
220
|
+
| Type | File | Behavior |
|
|
221
|
+
|------|------|----------|
|
|
222
|
+
| **Hint** | `.loki/CONTINUITY.md` "Mistakes & Learnings" | Passive memory - remembered but not acted upon |
|
|
223
|
+
| **Directive** | `.loki/HUMAN_INPUT.md` | Active instruction - executed BEFORE normal tasks |
|
|
224
|
+
|
|
225
|
+
**Example directive** (check all .astro files):
|
|
226
|
+
```bash
|
|
227
|
+
echo "Check all .astro files for missing BaseLayout imports. Fix any issues found. Add a compilation test to prevent this regression." > .loki/HUMAN_INPUT.md
|
|
228
|
+
```
|
|
229
|
+
|
|
216
230
|
---
|
|
217
231
|
|
|
218
232
|
## Complexity Tiers (v3.4.0)
|
|
@@ -227,4 +241,4 @@ Auto-detected or force with `LOKI_COMPLEXITY`:
|
|
|
227
241
|
|
|
228
242
|
---
|
|
229
243
|
|
|
230
|
-
**v5.
|
|
244
|
+
**v5.4.0 | JSON PRD Support + HUMAN_INPUT.md Fix | ~245 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.4.0
|
package/autonomy/run.sh
CHANGED
|
@@ -53,6 +53,12 @@
|
|
|
53
53
|
# LOKI_PERPETUAL_MODE - Ignore ALL completion signals (default: false)
|
|
54
54
|
# Set to 'true' for truly infinite operation
|
|
55
55
|
#
|
|
56
|
+
# Model Selection:
|
|
57
|
+
# LOKI_ALLOW_HAIKU - Enable Haiku model for fast tier (default: false)
|
|
58
|
+
# When false: Opus for dev/bugfix, Sonnet for tests/docs
|
|
59
|
+
# When true: Sonnet for dev, Haiku for tests/docs (original)
|
|
60
|
+
# Use --allow-haiku flag or set to 'true'
|
|
61
|
+
#
|
|
56
62
|
# 2026 Research Enhancements:
|
|
57
63
|
# LOKI_PROMPT_REPETITION - Enable prompt repetition for Haiku agents (default: true)
|
|
58
64
|
# arXiv 2512.14982v1: Improves accuracy 4-5x on structured tasks
|
|
@@ -577,7 +583,25 @@ detect_complexity() {
|
|
|
577
583
|
local prd_complexity="standard"
|
|
578
584
|
if [ -n "$prd_path" ] && [ -f "$prd_path" ]; then
|
|
579
585
|
local prd_words=$(wc -w < "$prd_path" | tr -d ' ')
|
|
580
|
-
local feature_count
|
|
586
|
+
local feature_count=0
|
|
587
|
+
|
|
588
|
+
# Detect PRD format and count features accordingly
|
|
589
|
+
if [[ "$prd_path" == *.json ]]; then
|
|
590
|
+
# JSON PRD: count features, requirements, tasks arrays
|
|
591
|
+
if command -v jq &>/dev/null; then
|
|
592
|
+
feature_count=$(jq '
|
|
593
|
+
[.features, .requirements, .tasks, .user_stories, .epics] |
|
|
594
|
+
map(select(. != null) | if type == "array" then length else 0 end) |
|
|
595
|
+
add // 0
|
|
596
|
+
' "$prd_path" 2>/dev/null || echo "0")
|
|
597
|
+
else
|
|
598
|
+
# Fallback: count array elements by pattern
|
|
599
|
+
feature_count=$(grep -c '"title"\|"name"\|"feature"\|"requirement"' "$prd_path" 2>/dev/null || echo "0")
|
|
600
|
+
fi
|
|
601
|
+
else
|
|
602
|
+
# Markdown PRD: count headers and checkboxes
|
|
603
|
+
feature_count=$(grep -c "^##\|^- \[" "$prd_path" 2>/dev/null || echo "0")
|
|
604
|
+
fi
|
|
581
605
|
|
|
582
606
|
if [ "$prd_words" -lt 200 ] && [ "$feature_count" -lt 5 ]; then
|
|
583
607
|
prd_complexity="simple"
|
|
@@ -3255,17 +3279,23 @@ build_prompt() {
|
|
|
3255
3279
|
fi
|
|
3256
3280
|
fi
|
|
3257
3281
|
|
|
3282
|
+
# Human directive injection (from HUMAN_INPUT.md)
|
|
3283
|
+
local human_directive=""
|
|
3284
|
+
if [ -n "${LOKI_HUMAN_INPUT:-}" ]; then
|
|
3285
|
+
human_directive="HUMAN_DIRECTIVE (PRIORITY): $LOKI_HUMAN_INPUT Execute this directive BEFORE continuing normal tasks."
|
|
3286
|
+
fi
|
|
3287
|
+
|
|
3258
3288
|
if [ $retry -eq 0 ]; then
|
|
3259
3289
|
if [ -n "$prd" ]; then
|
|
3260
|
-
echo "Loki Mode with PRD at $prd. $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3290
|
+
echo "Loki Mode with PRD at $prd. $human_directive $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3261
3291
|
else
|
|
3262
|
-
echo "Loki Mode. $analysis_instruction $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3292
|
+
echo "Loki Mode. $human_directive $analysis_instruction $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3263
3293
|
fi
|
|
3264
3294
|
else
|
|
3265
3295
|
if [ -n "$prd" ]; then
|
|
3266
|
-
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $context_injection $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3296
|
+
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"
|
|
3267
3297
|
else
|
|
3268
|
-
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $context_injection Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
3298
|
+
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"
|
|
3269
3299
|
fi
|
|
3270
3300
|
fi
|
|
3271
3301
|
}
|
|
@@ -3284,10 +3314,14 @@ run_autonomous() {
|
|
|
3284
3314
|
log_step "No PRD provided, searching for existing PRD files..."
|
|
3285
3315
|
local found_prd=""
|
|
3286
3316
|
|
|
3287
|
-
# Search common PRD file patterns
|
|
3288
|
-
for pattern in "PRD.md" "prd.md" "
|
|
3289
|
-
"
|
|
3290
|
-
"
|
|
3317
|
+
# Search common PRD file patterns (markdown and JSON)
|
|
3318
|
+
for pattern in "PRD.md" "prd.md" "PRD.json" "prd.json" \
|
|
3319
|
+
"REQUIREMENTS.md" "requirements.md" "requirements.json" \
|
|
3320
|
+
"SPEC.md" "spec.md" "spec.json" \
|
|
3321
|
+
"docs/PRD.md" "docs/prd.md" "docs/PRD.json" "docs/prd.json" \
|
|
3322
|
+
"docs/REQUIREMENTS.md" "docs/requirements.md" "docs/requirements.json" \
|
|
3323
|
+
"docs/SPEC.md" "docs/spec.md" "docs/spec.json" \
|
|
3324
|
+
".github/PRD.md" ".github/PRD.json" "PROJECT.md" "project.md" "project.json"; do
|
|
3291
3325
|
if [ -f "$pattern" ]; then
|
|
3292
3326
|
found_prd="$pattern"
|
|
3293
3327
|
break
|
|
@@ -3300,6 +3334,9 @@ run_autonomous() {
|
|
|
3300
3334
|
elif [ -f ".loki/generated-prd.md" ]; then
|
|
3301
3335
|
log_info "Using previously generated PRD: .loki/generated-prd.md"
|
|
3302
3336
|
prd_path=".loki/generated-prd.md"
|
|
3337
|
+
elif [ -f ".loki/generated-prd.json" ]; then
|
|
3338
|
+
log_info "Using previously generated PRD: .loki/generated-prd.json"
|
|
3339
|
+
prd_path=".loki/generated-prd.json"
|
|
3303
3340
|
else
|
|
3304
3341
|
log_info "No PRD found - will analyze codebase and generate one"
|
|
3305
3342
|
fi
|
|
@@ -3335,6 +3372,15 @@ run_autonomous() {
|
|
|
3335
3372
|
return 0
|
|
3336
3373
|
fi
|
|
3337
3374
|
|
|
3375
|
+
# Check for human intervention (PAUSE, HUMAN_INPUT.md, STOP)
|
|
3376
|
+
local intervention_result
|
|
3377
|
+
intervention_result=$(check_human_intervention; echo $?)
|
|
3378
|
+
intervention_result=${intervention_result##*$'\n'} # Get exit code
|
|
3379
|
+
case $intervention_result in
|
|
3380
|
+
1) continue ;; # PAUSE handled, restart loop
|
|
3381
|
+
2) return 0 ;; # STOP requested
|
|
3382
|
+
esac
|
|
3383
|
+
|
|
3338
3384
|
local prompt=$(build_prompt $retry "$prd_path" $ITERATION_COUNT)
|
|
3339
3385
|
|
|
3340
3386
|
echo ""
|
|
@@ -3867,6 +3913,11 @@ main() {
|
|
|
3867
3913
|
PARALLEL_MODE=true
|
|
3868
3914
|
shift
|
|
3869
3915
|
;;
|
|
3916
|
+
--allow-haiku)
|
|
3917
|
+
export LOKI_ALLOW_HAIKU=true
|
|
3918
|
+
log_info "Haiku model enabled for fast tier"
|
|
3919
|
+
shift
|
|
3920
|
+
;;
|
|
3870
3921
|
--provider)
|
|
3871
3922
|
if [[ -n "${2:-}" ]]; then
|
|
3872
3923
|
LOKI_PROVIDER="$2"
|
|
@@ -3909,6 +3960,7 @@ main() {
|
|
|
3909
3960
|
echo ""
|
|
3910
3961
|
echo "Options:"
|
|
3911
3962
|
echo " --parallel Enable git worktree-based parallel workflows"
|
|
3963
|
+
echo " --allow-haiku Enable Haiku model for fast tier (default: disabled)"
|
|
3912
3964
|
echo " --provider <name> Provider: claude (default), codex, gemini"
|
|
3913
3965
|
echo " --help, -h Show this help message"
|
|
3914
3966
|
echo ""
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/providers/claude.sh
CHANGED
|
@@ -44,13 +44,23 @@ PROVIDER_HAS_MCP=true
|
|
|
44
44
|
PROVIDER_MAX_PARALLEL=10
|
|
45
45
|
|
|
46
46
|
# Model Configuration (Abstract Tiers)
|
|
47
|
+
# Default: Haiku disabled for quality. Use --allow-haiku or LOKI_ALLOW_HAIKU=true to enable.
|
|
47
48
|
PROVIDER_MODEL_PLANNING="claude-opus-4-5-20251101"
|
|
48
|
-
PROVIDER_MODEL_DEVELOPMENT="claude-
|
|
49
|
-
|
|
49
|
+
PROVIDER_MODEL_DEVELOPMENT="claude-opus-4-5-20251101" # Opus for dev (was sonnet)
|
|
50
|
+
if [ "${LOKI_ALLOW_HAIKU:-false}" = "true" ]; then
|
|
51
|
+
PROVIDER_MODEL_FAST="claude-haiku-4-5-20251101"
|
|
52
|
+
PROVIDER_MODEL_DEVELOPMENT="claude-sonnet-4-5-20251101" # Sonnet for dev when haiku enabled
|
|
53
|
+
else
|
|
54
|
+
PROVIDER_MODEL_FAST="claude-sonnet-4-5-20251101" # Sonnet for fast (no haiku)
|
|
55
|
+
fi
|
|
50
56
|
|
|
51
57
|
# Model Selection (for Task tool)
|
|
52
58
|
PROVIDER_TASK_MODEL_PARAM="model"
|
|
53
|
-
|
|
59
|
+
if [ "${LOKI_ALLOW_HAIKU:-false}" = "true" ]; then
|
|
60
|
+
PROVIDER_TASK_MODEL_VALUES=("opus" "sonnet" "haiku")
|
|
61
|
+
else
|
|
62
|
+
PROVIDER_TASK_MODEL_VALUES=("opus" "sonnet") # No haiku option
|
|
63
|
+
fi
|
|
54
64
|
|
|
55
65
|
# Context and Limits
|
|
56
66
|
PROVIDER_CONTEXT_WINDOW=200000
|
|
@@ -87,14 +97,28 @@ provider_invoke() {
|
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
# Model tier to Task tool model parameter value
|
|
100
|
+
# Respects LOKI_ALLOW_HAIKU flag for tier mapping
|
|
90
101
|
provider_get_tier_param() {
|
|
91
102
|
local tier="$1"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
if [ "${LOKI_ALLOW_HAIKU:-false}" = "true" ]; then
|
|
104
|
+
# With haiku: original tier mapping
|
|
105
|
+
case "$tier" in
|
|
106
|
+
planning) echo "opus" ;;
|
|
107
|
+
development) echo "sonnet" ;;
|
|
108
|
+
fast) echo "haiku" ;;
|
|
109
|
+
*) echo "sonnet" ;;
|
|
110
|
+
esac
|
|
111
|
+
else
|
|
112
|
+
# Without haiku (default): upgrade all tiers
|
|
113
|
+
# - Development + bug fixes -> opus
|
|
114
|
+
# - Testing + documentation -> sonnet
|
|
115
|
+
case "$tier" in
|
|
116
|
+
planning) echo "opus" ;;
|
|
117
|
+
development) echo "opus" ;; # Upgraded from sonnet
|
|
118
|
+
fast) echo "sonnet" ;; # Upgraded from haiku
|
|
119
|
+
*) echo "opus" ;; # Default to opus
|
|
120
|
+
esac
|
|
121
|
+
fi
|
|
98
122
|
}
|
|
99
123
|
|
|
100
124
|
# Tier-aware invocation (Claude supports model selection via --model flag)
|
|
@@ -20,11 +20,33 @@ Loki Mode supports three AI providers. Claude has full features; Codex and Gemin
|
|
|
20
20
|
|
|
21
21
|
## Abstract Model Tiers
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
| **
|
|
23
|
+
**Default (v5.3.0):** Haiku disabled for quality. All tasks use Opus or Sonnet.
|
|
24
|
+
|
|
25
|
+
| Tier | Purpose | Claude (default) | Claude (--allow-haiku) | Codex | Gemini |
|
|
26
|
+
|------|---------|------------------|------------------------|-------|--------|
|
|
27
|
+
| **planning** | PRD analysis, architecture, system design | opus | opus | effort=xhigh | thinking=high |
|
|
28
|
+
| **development** | Feature implementation, complex bugs, tests | opus | sonnet | effort=high | thinking=medium |
|
|
29
|
+
| **fast** | Unit tests, docs, linting, simple tasks | sonnet | haiku | effort=low | thinking=low |
|
|
30
|
+
|
|
31
|
+
### Enabling Haiku
|
|
32
|
+
|
|
33
|
+
To enable Haiku for fast-tier tasks (cost optimization at potential quality trade-off):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Via environment variable
|
|
37
|
+
LOKI_ALLOW_HAIKU=true ./autonomy/run.sh ./prd.md
|
|
38
|
+
|
|
39
|
+
# Via CLI flag
|
|
40
|
+
./autonomy/run.sh --allow-haiku ./prd.md
|
|
41
|
+
|
|
42
|
+
# Via loki CLI wrapper
|
|
43
|
+
loki start --allow-haiku ./prd.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
When Haiku is enabled:
|
|
47
|
+
- Development tier uses Sonnet (instead of Opus)
|
|
48
|
+
- Fast tier uses Haiku (instead of Sonnet)
|
|
49
|
+
- Planning tier always uses Opus (unchanged)
|
|
28
50
|
|
|
29
51
|
---
|
|
30
52
|
|
|
@@ -36,7 +58,7 @@ Loki Mode supports three AI providers. Claude has full features; Codex and Gemin
|
|
|
36
58
|
| **development** | Development, QA, Deployment | Feature implementation, complex bugs, integration/E2E tests, code review, deployment |
|
|
37
59
|
| **fast** | All other operations (parallel for Claude) | Unit tests, docs, bash commands, linting, monitoring |
|
|
38
60
|
|
|
39
|
-
**Claude-specific model names:** opus, sonnet, haiku
|
|
61
|
+
**Claude-specific model names:** opus, sonnet, haiku (haiku requires --allow-haiku flag)
|
|
40
62
|
**Codex effort levels:** xhigh, high, medium, low
|
|
41
63
|
**Gemini thinking levels:** high, medium, low
|
|
42
64
|
|