loki-mode 6.80.0 → 6.81.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/SKILL.md +2 -5
- package/VERSION +1 -1
- package/autonomy/CONSTITUTION.md +2 -2
- package/autonomy/run.sh +32 -28
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/references/core-workflow.md +0 -13
- package/skills/model-selection.md +18 -0
- package/skills/troubleshooting.md +4 -41
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.
|
|
6
|
+
# Loki Mode v6.81.0
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -131,7 +131,6 @@ GROWTH ──[continuous improvement loop]──> GROWTH
|
|
|
131
131
|
|
|
132
132
|
- Load only 1-2 skill modules at a time (from skills/00-index.md)
|
|
133
133
|
- Use Task tool with subagents for exploration (isolates context)
|
|
134
|
-
- IF context feels heavy: Create `.loki/signals/CONTEXT_CLEAR_REQUESTED`
|
|
135
134
|
- **Context Window Tracking (v5.40.0):** Dashboard gauge, timeline, and per-agent breakdown at `GET /api/context`
|
|
136
135
|
- **Notification Triggers (v5.40.0):** Configurable alerts when context exceeds thresholds, tasks fail, or budget limits hit. Manage via `GET/PUT /api/notifications/triggers`
|
|
137
136
|
|
|
@@ -154,7 +153,6 @@ GROWTH ──[continuous improvement loop]──> GROWTH
|
|
|
154
153
|
| `.loki/memory/semantic/patterns.json` | Before implementation tasks | On consolidation |
|
|
155
154
|
| `.loki/memory/semantic/anti-patterns.json` | Before debugging tasks | On error learning |
|
|
156
155
|
| `.loki/queue/dead-letter.json` | Session start | On task failure (5+ attempts) |
|
|
157
|
-
| `.loki/signals/CONTEXT_CLEAR_REQUESTED` | Never | When context heavy |
|
|
158
156
|
| `.loki/signals/HUMAN_REVIEW_NEEDED` | Never | When human decision required |
|
|
159
157
|
| `.loki/state/checkpoints/` | After task completion | Automatic + manual via `loki checkpoint` |
|
|
160
158
|
|
|
@@ -266,10 +264,9 @@ The following features are documented in skill modules but not yet fully automat
|
|
|
266
264
|
|
|
267
265
|
| Feature | Status | Notes |
|
|
268
266
|
|---------|--------|-------|
|
|
269
|
-
| PRE-ACT goal drift detection | Planned | Agent-level attention check before each action; no automated enforcement yet |
|
|
270
267
|
| CONTINUITY.md working memory | Implemented (v5.35.0) | Auto-managed by run.sh, updated each iteration |
|
|
271
268
|
| GitHub integration | Implemented (v5.42.2) | Import, sync-back, PR creation, export. CLI: `loki github`, API: `/api/github/*` |
|
|
272
269
|
| Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
|
|
273
270
|
| Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
|
|
274
271
|
|
|
275
|
-
**v6.
|
|
272
|
+
**v6.81.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.81.0
|
package/autonomy/CONSTITUTION.md
CHANGED
|
@@ -433,8 +433,8 @@ git reset --hard ${checkpoint_hash}
|
|
|
433
433
|
|
|
434
434
|
- Load only 1-2 skill modules at a time
|
|
435
435
|
- Use Task tool with subagents for exploration (isolates context)
|
|
436
|
-
-
|
|
437
|
-
-
|
|
436
|
+
- Periodically consolidate learnings to CONTINUITY.md
|
|
437
|
+
- Rely on provider-native context management when context feels heavy (no explicit clear signal)
|
|
438
438
|
|
|
439
439
|
---
|
|
440
440
|
|
package/autonomy/run.sh
CHANGED
|
@@ -294,7 +294,6 @@ parse_simple_yaml() {
|
|
|
294
294
|
set_from_yaml "$file" "model.planning" "LOKI_MODEL_PLANNING"
|
|
295
295
|
set_from_yaml "$file" "model.development" "LOKI_MODEL_DEVELOPMENT"
|
|
296
296
|
set_from_yaml "$file" "model.fast" "LOKI_MODEL_FAST"
|
|
297
|
-
set_from_yaml "$file" "model.compaction_interval" "LOKI_COMPACTION_INTERVAL"
|
|
298
297
|
|
|
299
298
|
# Parallel
|
|
300
299
|
set_from_yaml "$file" "parallel.enabled" "LOKI_PARALLEL_MODE"
|
|
@@ -432,7 +431,6 @@ parse_yaml_with_yq() {
|
|
|
432
431
|
"model.prompt_repetition:LOKI_PROMPT_REPETITION"
|
|
433
432
|
"model.confidence_routing:LOKI_CONFIDENCE_ROUTING"
|
|
434
433
|
"model.autonomy_mode:LOKI_AUTONOMY_MODE"
|
|
435
|
-
"model.compaction_interval:LOKI_COMPACTION_INTERVAL"
|
|
436
434
|
"parallel.enabled:LOKI_PARALLEL_MODE"
|
|
437
435
|
"parallel.max_worktrees:LOKI_MAX_WORKTREES"
|
|
438
436
|
"parallel.max_sessions:LOKI_MAX_PARALLEL_SESSIONS"
|
|
@@ -637,8 +635,14 @@ PROMPT_REPETITION=${LOKI_PROMPT_REPETITION:-true}
|
|
|
637
635
|
CONFIDENCE_ROUTING=${LOKI_CONFIDENCE_ROUTING:-true}
|
|
638
636
|
AUTONOMY_MODE=${LOKI_AUTONOMY_MODE:-perpetual} # perpetual|checkpoint|supervised
|
|
639
637
|
|
|
640
|
-
#
|
|
641
|
-
|
|
638
|
+
# Session-pinned model (S0.1): pin a single tier for the whole main loop.
|
|
639
|
+
# Default is "sonnet" -> resolved via the "development" tier in the abstract
|
|
640
|
+
# tier map. Set LOKI_LEGACY_TIER_SWITCHING=true to restore the old
|
|
641
|
+
# per-iteration RARV-driven tier rotation in the main loop. The
|
|
642
|
+
# get_rarv_tier function is preserved for subagent dispatch regardless.
|
|
643
|
+
LOKI_SESSION_MODEL="${LOKI_SESSION_MODEL:-sonnet}"
|
|
644
|
+
LOKI_LEGACY_TIER_SWITCHING="${LOKI_LEGACY_TIER_SWITCHING:-false}"
|
|
645
|
+
export LOKI_SESSION_MODEL LOKI_LEGACY_TIER_SWITCHING
|
|
642
646
|
|
|
643
647
|
# Parallel Workflows (Git Worktrees)
|
|
644
648
|
PARALLEL_MODE=${LOKI_PARALLEL_MODE:-false}
|
|
@@ -7618,16 +7622,6 @@ check_max_iterations() {
|
|
|
7618
7622
|
return 1
|
|
7619
7623
|
}
|
|
7620
7624
|
|
|
7621
|
-
# Check if context clear was requested by agent
|
|
7622
|
-
check_context_clear_signal() {
|
|
7623
|
-
if [ -f ".loki/signals/CONTEXT_CLEAR_REQUESTED" ]; then
|
|
7624
|
-
log_info "Context clear signal detected from agent"
|
|
7625
|
-
rm -f ".loki/signals/CONTEXT_CLEAR_REQUESTED"
|
|
7626
|
-
return 0
|
|
7627
|
-
fi
|
|
7628
|
-
return 1
|
|
7629
|
-
}
|
|
7630
|
-
|
|
7631
7625
|
# Load latest ledger content for context injection
|
|
7632
7626
|
load_ledger_context() {
|
|
7633
7627
|
local ledger_content=""
|
|
@@ -8389,13 +8383,7 @@ build_prompt() {
|
|
|
8389
8383
|
local analysis_instruction="CODEBASE_ANALYSIS_MODE: No PRD. FIRST: Analyze codebase - scan structure, read package.json/requirements.txt, examine README. THEN: Generate PRD at .loki/generated-prd.md. FINALLY: Execute SDLC phases."
|
|
8390
8384
|
|
|
8391
8385
|
# Context Memory Instructions (integrated with new memory system)
|
|
8392
|
-
local memory_instruction="MEMORY SYSTEM: Relevant context from past sessions is provided below (if any). Your actions will be automatically recorded for future reference. For complex handoffs: create .loki/memory/handoffs/{timestamp}.md. For important decisions: they will be captured in the timeline. Check .loki/CONTINUITY.md for session-level working memory.
|
|
8393
|
-
|
|
8394
|
-
# Proactive Compaction Reminder (every N iterations)
|
|
8395
|
-
local compaction_reminder=""
|
|
8396
|
-
if [ $((iteration % COMPACTION_INTERVAL)) -eq 0 ] && [ $iteration -gt 0 ]; then
|
|
8397
|
-
compaction_reminder="PROACTIVE_CONTEXT_CHECK: You are at iteration $iteration. Review context size - if conversation history is long, consolidate to CONTINUITY.md and consider creating .loki/signals/CONTEXT_CLEAR_REQUESTED to reset context while preserving state."
|
|
8398
|
-
fi
|
|
8386
|
+
local memory_instruction="MEMORY SYSTEM: Relevant context from past sessions is provided below (if any). Your actions will be automatically recorded for future reference. For complex handoffs: create .loki/memory/handoffs/{timestamp}.md. For important decisions: they will be captured in the timeline. Check .loki/CONTINUITY.md for session-level working memory."
|
|
8399
8387
|
|
|
8400
8388
|
# Load existing context if resuming
|
|
8401
8389
|
local context_injection=""
|
|
@@ -8691,15 +8679,15 @@ except Exception:
|
|
|
8691
8679
|
else
|
|
8692
8680
|
if [ $retry -eq 0 ]; then
|
|
8693
8681
|
if [ -n "$prd" ]; then
|
|
8694
|
-
echo "Loki Mode with PRD at $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $
|
|
8682
|
+
echo "Loki Mode with PRD at $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
8695
8683
|
else
|
|
8696
|
-
echo "Loki Mode. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $analysis_instruction $rarv_instruction $memory_instruction $
|
|
8684
|
+
echo "Loki Mode. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $analysis_instruction $rarv_instruction $memory_instruction $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
8697
8685
|
fi
|
|
8698
8686
|
else
|
|
8699
8687
|
if [ -n "$prd" ]; then
|
|
8700
|
-
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $
|
|
8688
|
+
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
8701
8689
|
else
|
|
8702
|
-
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $
|
|
8690
|
+
echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $magic_context $checklist_status $app_runner_info $playwright_info $memory_context_section Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $completion_instruction $sdlc_instruction $autonomous_suffix"
|
|
8703
8691
|
fi
|
|
8704
8692
|
fi
|
|
8705
8693
|
fi
|
|
@@ -9728,9 +9716,25 @@ except Exception as exc:
|
|
|
9728
9716
|
echo "=== Provider: ${PROVIDER_NAME:-claude} ===" | tee -a "$log_file" "$agent_log"
|
|
9729
9717
|
echo "=== Prompt (truncated): ${prompt:0:200}... ===" | tee -a "$log_file" "$agent_log"
|
|
9730
9718
|
|
|
9731
|
-
#
|
|
9732
|
-
|
|
9733
|
-
#
|
|
9719
|
+
# Tier selection (S0.1):
|
|
9720
|
+
# Default: pin a single tier for the whole session via LOKI_SESSION_MODEL.
|
|
9721
|
+
# Legacy: LOKI_LEGACY_TIER_SWITCHING=true restores RARV-driven rotation.
|
|
9722
|
+
if [ "${LOKI_LEGACY_TIER_SWITCHING:-false}" = "true" ]; then
|
|
9723
|
+
CURRENT_TIER=$(get_rarv_tier "$ITERATION_COUNT")
|
|
9724
|
+
else
|
|
9725
|
+
# Map session-pinned model name to an abstract tier so provider
|
|
9726
|
+
# helpers (which expect tier names) resolve correctly. Unknown
|
|
9727
|
+
# model strings are passed through as-is; provider loaders fall
|
|
9728
|
+
# back to a sane default.
|
|
9729
|
+
case "${LOKI_SESSION_MODEL:-sonnet}" in
|
|
9730
|
+
opus) CURRENT_TIER="planning" ;;
|
|
9731
|
+
sonnet) CURRENT_TIER="development" ;;
|
|
9732
|
+
haiku) CURRENT_TIER="fast" ;;
|
|
9733
|
+
planning|development|fast) CURRENT_TIER="${LOKI_SESSION_MODEL}" ;;
|
|
9734
|
+
*) CURRENT_TIER="${LOKI_SESSION_MODEL}" ;;
|
|
9735
|
+
esac
|
|
9736
|
+
fi
|
|
9737
|
+
# Export LOKI_CURRENT_TIER so provider helper functions
|
|
9734
9738
|
# (e.g., gemini.sh:provider_get_current_model) can resolve the correct model.
|
|
9735
9739
|
# Without this, LOKI_CURRENT_TIER is always empty and defaults to "planning".
|
|
9736
9740
|
LOKI_CURRENT_TIER="$CURRENT_TIER"
|
package/dashboard/__init__.py
CHANGED
package/docs/INSTALLATION.md
CHANGED
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
|
@@ -33,13 +33,6 @@ Every iteration follows this cycle:
|
|
|
33
33
|
| - Identify highest priority unblocked task |
|
|
34
34
|
| - Determine exact steps to complete it |
|
|
35
35
|
+-------------------------------------------------------------------+
|
|
36
|
-
| PRE-ACT ATTENTION: Goal alignment check (prevents context drift) |
|
|
37
|
-
| - Re-read .loki/queue/current-task.json |
|
|
38
|
-
| - Verify: "Does my planned action serve task.goal?" |
|
|
39
|
-
| - Check: "Am I solving the original problem, not a tangent?" |
|
|
40
|
-
| - IF drift detected: Log to .loki/signals/DRIFT_DETECTED, |
|
|
41
|
-
| return to REASON |
|
|
42
|
-
+-------------------------------------------------------------------+
|
|
43
36
|
| ACT: Execute the task |
|
|
44
37
|
| - Dispatch subagent via Task tool OR execute directly |
|
|
45
38
|
| - Write code, run tests, fix issues |
|
|
@@ -77,12 +70,6 @@ Every iteration follows this cycle:
|
|
|
77
70
|
- Retries with learned context
|
|
78
71
|
- Achieves 2-3x quality improvement (Boris Cherny's observed result)
|
|
79
72
|
|
|
80
|
-
**Key Enhancement (PRE-ACT ATTENTION):** The planning-with-files pattern adds a goal alignment check:
|
|
81
|
-
- Context drift is silent - agents don't notice they've drifted off-task
|
|
82
|
-
- Forcing goal re-read before each action catches drift early
|
|
83
|
-
- Prevents "correct solution to wrong problem" failure mode
|
|
84
|
-
- Cost: One file read per action. Benefit: Catches misalignment before wasted work.
|
|
85
|
-
|
|
86
73
|
---
|
|
87
74
|
|
|
88
75
|
## CONTINUITY.md - Working Memory Protocol
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Model Selection & Task Tool
|
|
2
2
|
|
|
3
|
+
## Session-Pinned Model (default)
|
|
4
|
+
|
|
5
|
+
Since v6.81.0, the main RARV loop uses **one pinned model per session** instead of rotating models per RARV phase. This eliminates per-iteration tier churn and keeps the main loop behavior predictable.
|
|
6
|
+
|
|
7
|
+
- Controlled by `LOKI_SESSION_MODEL` (default: `sonnet`).
|
|
8
|
+
- Accepted values: `opus`, `sonnet`, `haiku`, or a raw tier name (`planning`, `development`, `fast`). Model names are mapped to abstract tiers (opus -> planning, sonnet -> development, haiku -> fast) so provider helpers resolve correctly.
|
|
9
|
+
- `get_rarv_tier()` is retained and still used for subagent Task-tool dispatches (planning vs implementation vs fast work), not for the main loop.
|
|
10
|
+
|
|
11
|
+
**Rollback (legacy RARV tier rotation in the main loop):**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
LOKI_LEGACY_TIER_SWITCHING=true ./autonomy/run.sh ./prd.md
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Set `LOKI_LEGACY_TIER_SWITCHING=true` to restore the previous per-iteration `get_rarv_tier "$ITERATION_COUNT"` behavior in the main loop.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
3
21
|
## Multi-Provider Support (v5.0.0)
|
|
4
22
|
|
|
5
23
|
Loki Mode supports five AI providers. Claude has full features; all others run in **degraded mode** (sequential execution only, no Task tool, no parallel agents).
|
|
@@ -577,7 +577,7 @@ Signals are inter-process communication files in `.loki/signals/` that trigger a
|
|
|
577
577
|
| Any drift detected | Return to REASON phase immediately |
|
|
578
578
|
| 1 drift in task | Log warning, continue with corrected action |
|
|
579
579
|
| 2 drifts in same task | Escalate to orchestrator for task review |
|
|
580
|
-
| 3+ drifts accumulated |
|
|
580
|
+
| 3+ drifts accumulated | Escalate to orchestrator, consolidate state to CONTINUITY.md |
|
|
581
581
|
| High/Critical severity | Pause task, dispatch opus reviewer |
|
|
582
582
|
|
|
583
583
|
**Automated Responses:**
|
|
@@ -590,9 +590,9 @@ immediate:
|
|
|
590
590
|
|
|
591
591
|
accumulated_threshold: 3
|
|
592
592
|
accumulated_action:
|
|
593
|
-
-
|
|
594
|
-
-
|
|
595
|
-
-
|
|
593
|
+
- Consolidate working memory to CONTINUITY.md
|
|
594
|
+
- Escalate to orchestrator for task review
|
|
595
|
+
- Rely on provider-native context management (no explicit clear signal)
|
|
596
596
|
```
|
|
597
597
|
|
|
598
598
|
**How to Write:**
|
|
@@ -605,42 +605,6 @@ EOF
|
|
|
605
605
|
|
|
606
606
|
---
|
|
607
607
|
|
|
608
|
-
### CONTEXT_CLEAR_REQUESTED Signal
|
|
609
|
-
|
|
610
|
-
**Purpose:** Agent requests context window reset while preserving state.
|
|
611
|
-
|
|
612
|
-
**Schema:** File presence only (empty file is sufficient).
|
|
613
|
-
|
|
614
|
-
**When to Create:**
|
|
615
|
-
- Context feels heavy/slow
|
|
616
|
-
- After 25+ iterations
|
|
617
|
-
- Conversation history exceeds 50KB
|
|
618
|
-
- Agent detects own confusion or loops
|
|
619
|
-
- 3+ accumulated DRIFT_DETECTED events
|
|
620
|
-
|
|
621
|
-
**Processing (by run.sh wrapper):**
|
|
622
|
-
1. Detect signal file
|
|
623
|
-
2. Load ledger context from `.loki/memory/ledgers/`
|
|
624
|
-
3. Load recent handoffs from `.loki/memory/handoffs/`
|
|
625
|
-
4. Delete signal file
|
|
626
|
-
5. Start new Claude session with injected context
|
|
627
|
-
6. Continue from last CONTINUITY.md state
|
|
628
|
-
|
|
629
|
-
**How to Create:**
|
|
630
|
-
```bash
|
|
631
|
-
touch .loki/signals/CONTEXT_CLEAR_REQUESTED
|
|
632
|
-
```
|
|
633
|
-
|
|
634
|
-
**Thresholds:**
|
|
635
|
-
| Trigger | Threshold |
|
|
636
|
-
|---------|-----------|
|
|
637
|
-
| Iteration count | Every 25 iterations (compaction reminder) |
|
|
638
|
-
| Drift accumulation | 3+ DRIFT_DETECTED events |
|
|
639
|
-
| Agent self-assessment | "Context feels heavy" |
|
|
640
|
-
| Error loop detection | Same error 3+ times |
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
608
|
### HUMAN_REVIEW_NEEDED Signal
|
|
645
609
|
|
|
646
610
|
**Purpose:** Escalate to human when autonomous action is inappropriate.
|
|
@@ -762,7 +726,6 @@ These signals coordinate parallel worktrees (see `skills/parallel-workflows.md`)
|
|
|
762
726
|
```
|
|
763
727
|
.loki/signals/
|
|
764
728
|
DRIFT_DETECTED # Append-only log (JSON lines)
|
|
765
|
-
CONTEXT_CLEAR_REQUESTED # Presence flag (empty file OK)
|
|
766
729
|
HUMAN_REVIEW_NEEDED # JSON with review context
|
|
767
730
|
HUMAN_APPROVED # JSON with decision
|
|
768
731
|
FEATURE_READY_auth # Worktree signal
|