loki-mode 6.76.0 → 6.77.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 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.76.0
6
+ # Loki Mode v6.77.0
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.76.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
275
+ **v6.77.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.76.0
1
+ 6.77.0
package/autonomy/run.sh CHANGED
@@ -1453,7 +1453,7 @@ get_provider_tier_param() {
1453
1453
  echo "${CLINE_DEFAULT_MODEL:-${LOKI_CLINE_MODEL:-default}}"
1454
1454
  ;;
1455
1455
  aider)
1456
- echo "${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}"
1456
+ echo "${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}"
1457
1457
  ;;
1458
1458
  *)
1459
1459
  echo "development"
@@ -3143,7 +3143,7 @@ invoke_cline_capture() {
3143
3143
  invoke_aider() {
3144
3144
  local prompt="$1"
3145
3145
  shift
3146
- local model="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}"
3146
+ local model="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}"
3147
3147
  local extra_flags="${LOKI_AIDER_FLAGS:-}"
3148
3148
  # shellcheck disable=SC2086
3149
3149
  # < /dev/null prevents aider from blocking on stdin in non-interactive mode
@@ -3156,7 +3156,7 @@ invoke_aider() {
3156
3156
  invoke_aider_capture() {
3157
3157
  local prompt="$1"
3158
3158
  shift
3159
- local model="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}"
3159
+ local model="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}"
3160
3160
  local extra_flags="${LOKI_AIDER_FLAGS:-}"
3161
3161
  # shellcheck disable=SC2086
3162
3162
  aider --message "$prompt" --yes-always --no-auto-commits \
@@ -3749,7 +3749,7 @@ track_iteration_complete() {
3749
3749
  elif [ "${PROVIDER_NAME:-claude}" = "cline" ]; then
3750
3750
  model_tier="${CLINE_DEFAULT_MODEL:-${LOKI_CLINE_MODEL:-sonnet}}"
3751
3751
  elif [ "${PROVIDER_NAME:-claude}" = "aider" ]; then
3752
- model_tier="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}"
3752
+ model_tier="${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}"
3753
3753
  fi
3754
3754
  local phase="${LAST_KNOWN_PHASE:-}"
3755
3755
  [ -z "$phase" ] && phase=$(python3 -c "import json; print(json.load(open('.loki/state/orchestrator.json')).get('currentPhase', 'unknown'))" 2>/dev/null || echo "unknown")
@@ -5784,6 +5784,53 @@ run_doc_quality_gate() {
5784
5784
  [ "$score" -ge 70 ]
5785
5785
  }
5786
5786
 
5787
+ # ============================================================================
5788
+ # Magic Modules Debate Gate - Gate 12 (v6.77.0)
5789
+ # Runs when any .loki/magic/specs/*.md changed since last iteration.
5790
+ # Blocks iteration completion if debate flags any block severity.
5791
+ # ============================================================================
5792
+
5793
+ run_magic_debate_gate() {
5794
+ local specs_dir="$TARGET_DIR/.loki/magic/specs"
5795
+ if [ ! -d "$specs_dir" ]; then
5796
+ return 0
5797
+ fi
5798
+
5799
+ local has_specs
5800
+ has_specs=$(find "$specs_dir" -maxdepth 1 -name "*.md" 2>/dev/null | head -1)
5801
+ if [ -z "$has_specs" ]; then
5802
+ return 0
5803
+ fi
5804
+
5805
+ # Auto-run update to catch stale generated files
5806
+ log_info "Magic Modules: running incremental update"
5807
+ (cd "$TARGET_DIR" && PYTHONPATH="$PROJECT_DIR" LOKI_PROVIDER="${PROVIDER_NAME:-claude}" \
5808
+ "$PROJECT_DIR/autonomy/loki" magic update 2>&1 | tail -10) || true
5809
+
5810
+ # Run debate on most recently modified component
5811
+ local latest_spec
5812
+ latest_spec=$(find "$specs_dir" -maxdepth 1 -name "*.md" -type f -print0 2>/dev/null | xargs -0 ls -t 2>/dev/null | head -1)
5813
+ if [ -z "$latest_spec" ]; then
5814
+ return 0
5815
+ fi
5816
+ local latest_name
5817
+ latest_name=$(basename "$latest_spec" .md)
5818
+
5819
+ log_info "Magic Modules: running debate on '$latest_name'"
5820
+ local debate_out
5821
+ debate_out=$(cd "$TARGET_DIR" && PYTHONPATH="$PROJECT_DIR" LOKI_PROVIDER="${PROVIDER_NAME:-claude}" \
5822
+ timeout 300 "$PROJECT_DIR/autonomy/loki" magic debate "$latest_name" --rounds 2 2>&1 || true)
5823
+
5824
+ # Parse debate outcome; block if any persona set severity=block
5825
+ if echo "$debate_out" | grep -qi '"severity"[[:space:]]*:[[:space:]]*"block"'; then
5826
+ log_warn "Magic Modules Gate 12: debate returned BLOCK severity for '$latest_name'"
5827
+ return 1
5828
+ fi
5829
+
5830
+ log_info "Magic Modules Gate 12: PASS"
5831
+ return 0
5832
+ }
5833
+
5787
5834
  # ============================================================================
5788
5835
  # 3-Reviewer Parallel Code Review (v5.35.0)
5789
5836
  # Specialist pool from skills/quality-gates.md with blind review
@@ -7905,6 +7952,24 @@ except Exception as e:
7905
7952
  PYEOF
7906
7953
  }
7907
7954
 
7955
+ # Magic Modules COMPOUND: record successful component patterns (v6.77.0)
7956
+ # Called at end of each iteration to capture generated/updated components
7957
+ # as semantic memory patterns via magic.core.memory_bridge.
7958
+ _magic_compound_capture() {
7959
+ local registry="$TARGET_DIR/.loki/magic/registry.json"
7960
+ if [ ! -f "$registry" ]; then
7961
+ return 0
7962
+ fi
7963
+ # Delegate to memory_bridge (built by agent 3)
7964
+ PYTHONPATH="$PROJECT_DIR" python3 -c "
7965
+ try:
7966
+ from magic.core.memory_bridge import capture_iteration_compound
7967
+ capture_iteration_compound('${TARGET_DIR}', iteration=${ITERATION_COUNT:-0})
7968
+ except Exception as exc:
7969
+ pass
7970
+ " 2>/dev/null || true
7971
+ }
7972
+
7908
7973
  # Automatic episode capture with enriched context (v6.15.0)
7909
7974
  # Captures git changes, files modified, and RARV phase automatically
7910
7975
  # after every iteration -- no manual invocation needed.
@@ -8583,6 +8648,21 @@ except Exception:
8583
8648
  " 2>/dev/null || true)
8584
8649
  fi
8585
8650
 
8651
+ # Magic Modules context injection
8652
+ local magic_context=""
8653
+ local magic_specs_dir="$TARGET_DIR/.loki/magic/specs"
8654
+ if [ -d "$magic_specs_dir" ]; then
8655
+ local spec_count
8656
+ spec_count=$(find "$magic_specs_dir" -maxdepth 1 -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
8657
+ if [ "$spec_count" -gt 0 ]; then
8658
+ local spec_list
8659
+ spec_list=$(find "$magic_specs_dir" -maxdepth 1 -name "*.md" -exec basename {} .md \; 2>/dev/null | tr '\n' ',' | sed 's/,$//')
8660
+ magic_context="MAGIC_MODULES: ${spec_count} component specs exist: ${spec_list}. To add or update a component: write markdown to ${magic_specs_dir}/<Name>.md and run 'loki magic update'. The spec becomes source of truth; implementation regenerates automatically. Debate runs in VERIFY phase -- if accessibility or performance blocks, refine the spec and re-run."
8661
+ else
8662
+ magic_context="MAGIC_MODULES: available. To create UI components, write spec at ${magic_specs_dir}/<Name>.md and run 'loki magic update'. Spec-driven generation produces React + Web Component variants with auto-generated tests. Debate gate runs in VERIFY."
8663
+ fi
8664
+ fi
8665
+
8586
8666
  # Degraded providers with small models need simplified prompts
8587
8667
  # Full RARV/SDLC instructions overwhelm models < 30B parameters
8588
8668
  if [ "${PROVIDER_DEGRADED:-false}" = "true" ]; then
@@ -8607,15 +8687,15 @@ except Exception:
8607
8687
  else
8608
8688
  if [ $retry -eq 0 ]; then
8609
8689
  if [ -n "$prd" ]; then
8610
- echo "Loki Mode with PRD at $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8690
+ 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 $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8611
8691
  else
8612
- echo "Loki Mode. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $checklist_status $app_runner_info $playwright_info $memory_context_section $analysis_instruction $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8692
+ 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 $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8613
8693
  fi
8614
8694
  else
8615
8695
  if [ -n "$prd" ]; then
8616
- echo "Loki Mode - Resume iteration #$iteration (retry #$retry). PRD: $prd. $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $checklist_status $app_runner_info $playwright_info $memory_context_section $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8696
+ 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 $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8617
8697
  else
8618
- echo "Loki Mode - Resume iteration #$iteration (retry #$retry). $human_directive $gate_failure_context $queue_tasks $bmad_context $openspec_context $mirofish_context $checklist_status $app_runner_info $playwright_info $memory_context_section Use .loki/generated-prd.md if exists. $rarv_instruction $memory_instruction $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8698
+ 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 $compaction_reminder $completion_instruction $sdlc_instruction $autonomous_suffix"
8619
8699
  fi
8620
8700
  fi
8621
8701
  fi
@@ -9475,6 +9555,22 @@ run_autonomous() {
9475
9555
  # Populate task queue from PRD (if no adapters already populated, runs once)
9476
9556
  populate_prd_queue "$prd_path"
9477
9557
 
9558
+ # Magic Modules BOOTSTRAP: extract design tokens from project so component
9559
+ # generation matches the codebase design language from iteration 1.
9560
+ if [ -x "${PROJECT_DIR}/autonomy/loki" ]; then
9561
+ PYTHONPATH="${PROJECT_DIR}" python3 -c "
9562
+ try:
9563
+ from magic.core.design_tokens import DesignTokens
9564
+ dt = DesignTokens('${TARGET_DIR}')
9565
+ observed = dt.extract_from_codebase(save=True)
9566
+ print(f'[magic] Extracted design tokens: '
9567
+ f'{len(observed.get(\"colors\",{}))} colors, '
9568
+ f'{len(observed.get(\"spacing\",{}))} spacing')
9569
+ except Exception as exc:
9570
+ print(f'[magic] Token extraction skipped: {exc}')
9571
+ " 2>&1 | grep -E '\[magic\]' || true
9572
+ fi
9573
+
9478
9574
  # Check max iterations before starting
9479
9575
  if check_max_iterations; then
9480
9576
  log_error "Max iterations already reached. Reset with: rm .loki/autonomy-state.json"
@@ -9895,8 +9991,8 @@ if __name__ == "__main__":
9895
9991
  ;;
9896
9992
  aider)
9897
9993
  # Aider: Tier 3 - degraded mode, 18+ providers
9898
- echo "[loki] Aider model: ${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}, tier: $tier_param" >> "$log_file"
9899
- echo "[loki] Aider model: ${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-sonnet-4-5-20250929}}, tier: $tier_param" >> "$agent_log"
9994
+ echo "[loki] Aider model: ${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}, tier: $tier_param" >> "$log_file"
9995
+ echo "[loki] Aider model: ${AIDER_DEFAULT_MODEL:-${LOKI_AIDER_MODEL:-claude-opus-4-7}}, tier: $tier_param" >> "$agent_log"
9900
9996
  { invoke_aider "$prompt" 2>&1 | tee -a "$log_file" "$agent_log" "$iter_output"; \
9901
9997
  } && exit_code=0 || exit_code=$?
9902
9998
  ;;
@@ -10087,6 +10183,18 @@ if __name__ == "__main__":
10087
10183
  log_warn "Documentation coverage gate: Score below threshold ($dc_count consecutive)"
10088
10184
  fi
10089
10185
  fi
10186
+ # Magic Modules debate gate - Gate 12 (v6.77.0)
10187
+ if [ "${LOKI_GATE_MAGIC_DEBATE:-true}" = "true" ] && [ "$ITERATION_COUNT" -gt 0 ]; then
10188
+ log_info "Quality gate: magic modules debate..."
10189
+ if run_magic_debate_gate; then
10190
+ clear_gate_failure "magic_debate"
10191
+ else
10192
+ local md_count
10193
+ md_count=$(track_gate_failure "magic_debate")
10194
+ gate_failures="${gate_failures}magic_debate,"
10195
+ log_warn "Magic Modules debate gate: BLOCK severity detected ($md_count consecutive)"
10196
+ fi
10197
+ fi
10090
10198
  # Store gate failures for prompt injection
10091
10199
  if [ -n "$gate_failures" ]; then
10092
10200
  echo "$gate_failures" > "${TARGET_DIR:-.}/.loki/quality/gate-failures.txt"
@@ -10106,6 +10214,9 @@ if __name__ == "__main__":
10106
10214
  auto_capture_episode "$ITERATION_COUNT" "$exit_code" "${rarv_phase:-iteration}" \
10107
10215
  "${prd_path:-codebase-analysis}" "$duration" "$log_file"
10108
10216
 
10217
+ # Magic Modules COMPOUND capture (v6.77.0): record component patterns
10218
+ _magic_compound_capture
10219
+
10109
10220
  # BUG-QG-008: Track iteration for convergence regardless of exit code
10110
10221
  if type council_track_iteration &>/dev/null; then
10111
10222
  council_track_iteration "$log_file"
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.76.0"
10
+ __version__ = "6.77.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -11085,7 +11085,7 @@ var LokiDashboard=(()=>{var kt=Object.defineProperty;var Yt=Object.getOwnPropert
11085
11085
  ${s}
11086
11086
  </div>
11087
11087
  </div>
11088
- `,this._bindEvents(),!this._paused){let r=t.querySelector(".activity-feed");r&&(r.scrollTop=0)}}};customElements.get("loki-activity-stream")||customElements.define("loki-activity-stream",ht);var $e={claude:{initial:"C",color:"#553DE9",bgColor:"rgba(85, 61, 233, 0.12)"},codex:{initial:"X",color:"#1FC5A8",bgColor:"rgba(31, 197, 168, 0.12)"},gemini:{initial:"G",color:"#2F71E3",bgColor:"rgba(47, 113, 227, 0.12)"},cline:{initial:"L",color:"#D4A03C",bgColor:"rgba(212, 160, 60, 0.12)"},aider:{initial:"A",color:"#C45B5B",bgColor:"rgba(196, 91, 91, 0.12)"}},Vt={healthy:"var(--loki-green, #1FC5A8)",degraded:"var(--loki-yellow, #D4A03C)",down:"var(--loki-red, #C45B5B)",unknown:"var(--loki-text-muted, #939084)"},ut=class extends u{static get observedAttributes(){return["api-url","theme"]}constructor(){super(),this._providers=[],this._expandedProvider=null,this._api=null,this._pollInterval=null}connectedCallback(){super.connectedCallback(),this._setupApi(),this._loadData(),this._startPolling()}disconnectedCallback(){super.disconnectedCallback(),this._stopPolling()}attributeChangedCallback(t,e,i){e!==i&&(t==="api-url"&&this._api&&(this._api.baseUrl=i,this._loadData()),t==="theme"&&this._applyTheme())}_setupApi(){let t=this.getAttribute("api-url")||window.location.origin;this._api=g({baseUrl:t})}_startPolling(){this._pollInterval=setInterval(()=>this._loadData(),1e4)}_stopPolling(){this._pollInterval&&(clearInterval(this._pollInterval),this._pollInterval=null)}async _loadData(){try{let t=await this._api._get("/api/v2/providers/health");this._providers=t.providers||[]}catch{this._providers.length===0&&(this._providers=this._getDemoData())}this.render()}_getDemoData(){return[{name:"claude",status:"healthy",latency_ms:245,tokens_used:125400,model:"claude-opus-4-6",api_version:"v1",rate_limit:{remaining:45,limit:50},cost_usd:3.42},{name:"codex",status:"degraded",latency_ms:890,tokens_used:45200,model:"gpt-5.3-codex",api_version:"v1",rate_limit:{remaining:12,limit:60},cost_usd:.87},{name:"gemini",status:"healthy",latency_ms:320,tokens_used:78600,model:"gemini-3-pro",api_version:"v1beta",rate_limit:{remaining:55,limit:60},cost_usd:1.15}]}_formatTokens(t){return t==null?"--":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}_formatLatency(t){return t==null?"--":t<1e3?t+"ms":(t/1e3).toFixed(1)+"s"}_formatCost(t){return t==null?"--":"$"+t.toFixed(2)}_escapeHtml(t){return t?String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}_toggleExpand(t){this._expandedProvider=this._expandedProvider===t?null:t,this.render()}_bindEvents(){this.shadowRoot.querySelectorAll(".provider-card").forEach(e=>{e.addEventListener("click",()=>{this._toggleExpand(e.dataset.provider)})})}_getStyles(){return`
11088
+ `,this._bindEvents(),!this._paused){let r=t.querySelector(".activity-feed");r&&(r.scrollTop=0)}}};customElements.get("loki-activity-stream")||customElements.define("loki-activity-stream",ht);var $e={claude:{initial:"C",color:"#553DE9",bgColor:"rgba(85, 61, 233, 0.12)"},codex:{initial:"X",color:"#1FC5A8",bgColor:"rgba(31, 197, 168, 0.12)"},gemini:{initial:"G",color:"#2F71E3",bgColor:"rgba(47, 113, 227, 0.12)"},cline:{initial:"L",color:"#D4A03C",bgColor:"rgba(212, 160, 60, 0.12)"},aider:{initial:"A",color:"#C45B5B",bgColor:"rgba(196, 91, 91, 0.12)"}},Vt={healthy:"var(--loki-green, #1FC5A8)",degraded:"var(--loki-yellow, #D4A03C)",down:"var(--loki-red, #C45B5B)",unknown:"var(--loki-text-muted, #939084)"},ut=class extends u{static get observedAttributes(){return["api-url","theme"]}constructor(){super(),this._providers=[],this._expandedProvider=null,this._api=null,this._pollInterval=null}connectedCallback(){super.connectedCallback(),this._setupApi(),this._loadData(),this._startPolling()}disconnectedCallback(){super.disconnectedCallback(),this._stopPolling()}attributeChangedCallback(t,e,i){e!==i&&(t==="api-url"&&this._api&&(this._api.baseUrl=i,this._loadData()),t==="theme"&&this._applyTheme())}_setupApi(){let t=this.getAttribute("api-url")||window.location.origin;this._api=g({baseUrl:t})}_startPolling(){this._pollInterval=setInterval(()=>this._loadData(),1e4)}_stopPolling(){this._pollInterval&&(clearInterval(this._pollInterval),this._pollInterval=null)}async _loadData(){try{let t=await this._api._get("/api/v2/providers/health");this._providers=t.providers||[]}catch{this._providers.length===0&&(this._providers=this._getDemoData())}this.render()}_getDemoData(){return[{name:"claude",status:"healthy",latency_ms:245,tokens_used:125400,model:"claude-opus-4-7",api_version:"v1",rate_limit:{remaining:45,limit:50},cost_usd:3.42},{name:"codex",status:"degraded",latency_ms:890,tokens_used:45200,model:"gpt-5.3-codex",api_version:"v1",rate_limit:{remaining:12,limit:60},cost_usd:.87},{name:"gemini",status:"healthy",latency_ms:320,tokens_used:78600,model:"gemini-3-pro",api_version:"v1beta",rate_limit:{remaining:55,limit:60},cost_usd:1.15}]}_formatTokens(t){return t==null?"--":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}_formatLatency(t){return t==null?"--":t<1e3?t+"ms":(t/1e3).toFixed(1)+"s"}_formatCost(t){return t==null?"--":"$"+t.toFixed(2)}_escapeHtml(t){return t?String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}_toggleExpand(t){this._expandedProvider=this._expandedProvider===t?null:t,this.render()}_bindEvents(){this.shadowRoot.querySelectorAll(".provider-card").forEach(e=>{e.addEventListener("click",()=>{this._toggleExpand(e.dataset.provider)})})}_getStyles(){return`
11089
11089
  :host {
11090
11090
  display: block;
11091
11091
  }
@@ -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.76.0
5
+ **Version:** v6.77.0
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.76.0'
60
+ __version__ = '6.77.0'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.76.0",
3
+ "version": "6.77.0",
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",
@@ -50,7 +50,20 @@ PROVIDER_MAX_PARALLEL=1
50
50
  # Aider supports 18+ providers; model configured via LOKI_AIDER_MODEL env var
51
51
  # or provider-specific env vars (OPENAI_API_KEY, OPENAI_API_BASE, etc.)
52
52
  # NOTE: Aider uses litellm for model routing, so full model strings are needed (not CLI aliases)
53
- AIDER_DEFAULT_MODEL="${LOKI_AIDER_MODEL:-${LOKI_MODEL_DEVELOPMENT:-claude-sonnet-4-5-20250929}}"
53
+ # Aider default model -- reads from providers/model_catalog.json via models.sh when
54
+ # available so new model releases only require updating that single catalog file.
55
+ _aider_default_from_catalog() {
56
+ local script_dir
57
+ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
58
+ if [ -f "${script_dir}/models.sh" ]; then
59
+ # shellcheck source=./models.sh
60
+ source "${script_dir}/models.sh"
61
+ loki_latest_model aider development 2>/dev/null || echo "claude-opus-4-7"
62
+ else
63
+ echo "claude-opus-4-7"
64
+ fi
65
+ }
66
+ AIDER_DEFAULT_MODEL="${LOKI_AIDER_MODEL:-${LOKI_MODEL_DEVELOPMENT:-$(_aider_default_from_catalog)}}"
54
67
  PROVIDER_MODEL_PLANNING="$AIDER_DEFAULT_MODEL"
55
68
  PROVIDER_MODEL_DEVELOPMENT="$AIDER_DEFAULT_MODEL"
56
69
  PROVIDER_MODEL_FAST="$AIDER_DEFAULT_MODEL"
@@ -45,7 +45,13 @@ PROVIDER_MAX_PARALLEL=10
45
45
 
46
46
  # Model Configuration (Abstract Tiers)
47
47
  # Default: Haiku disabled for quality. Use --allow-haiku or LOKI_ALLOW_HAIKU=true to enable.
48
- # Claude Code CLI resolves aliases (opus/sonnet/haiku) to latest versions automatically.
48
+ # The Claude Code CLI resolves aliases (opus/sonnet/haiku) to the latest available
49
+ # model at invocation time, so we pass aliases rather than dated IDs. The canonical
50
+ # mapping lives in providers/model_catalog.json (single source of truth):
51
+ # opus -> latest Opus (e.g. claude-opus-4-7 -- 1M context, adaptive thinking)
52
+ # sonnet -> latest Sonnet (e.g. claude-sonnet-4-6)
53
+ # haiku -> latest Haiku (e.g. claude-haiku-4-5)
54
+ # Override per tier with LOKI_CLAUDE_MODEL_PLANNING, _DEVELOPMENT, _FAST.
49
55
  CLAUDE_DEFAULT_PLANNING="opus"
50
56
  CLAUDE_DEFAULT_DEVELOPMENT="opus" # Opus for dev (was sonnet)
51
57
  CLAUDE_DEFAULT_FAST="sonnet"
@@ -69,10 +75,18 @@ else
69
75
  fi
70
76
 
71
77
  # Context and Limits
72
- PROVIDER_CONTEXT_WINDOW=200000 # 200K default; 1M available in extended context beta
78
+ # Opus 4.7 ships with 1M context at standard pricing (no long-context premium).
79
+ # RARV-C uses this headroom for deeper memory retrieval and longer task budgets.
80
+ PROVIDER_CONTEXT_WINDOW=1000000
73
81
  PROVIDER_MAX_OUTPUT_TOKENS=128000
74
82
  PROVIDER_RATE_LIMIT_RPM=50
75
83
 
84
+ # Effort / thinking defaults for Opus 4.7 (used when Loki invokes the API
85
+ # directly; the interactive CLI manages this automatically).
86
+ PROVIDER_DEFAULT_EFFORT="${LOKI_CLAUDE_EFFORT:-xhigh}" # xhigh recommended for coding
87
+ PROVIDER_DEFAULT_THINKING="${LOKI_CLAUDE_THINKING:-adaptive}"
88
+ PROVIDER_DEFAULT_TASK_BUDGET_TOKENS="${LOKI_CLAUDE_TASK_BUDGET:-0}" # 0 = unset (open-ended)
89
+
76
90
  # Cost (USD per 1K tokens, approximate)
77
91
  PROVIDER_COST_INPUT_PLANNING=0.015
78
92
  PROVIDER_COST_OUTPUT_PLANNING=0.075
@@ -51,7 +51,20 @@ PROVIDER_MAX_PARALLEL=1
51
51
  # Cline supports 12+ providers; model configured via LOKI_CLINE_MODEL env var
52
52
  # or `cline auth` one-time setup. Defaults are placeholders.
53
53
  # NOTE: Cline uses its own model routing, so full model strings are needed (not CLI aliases)
54
- CLINE_DEFAULT_MODEL="${LOKI_CLINE_MODEL:-${LOKI_MODEL_DEVELOPMENT:-claude-sonnet-4-5-20250929}}"
54
+ # Cline default model -- reads from providers/model_catalog.json via models.sh when
55
+ # available so new model releases only require updating that single catalog file.
56
+ _cline_default_from_catalog() {
57
+ local script_dir
58
+ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
59
+ if [ -f "${script_dir}/models.sh" ]; then
60
+ # shellcheck source=./models.sh
61
+ source "${script_dir}/models.sh"
62
+ loki_latest_model cline development 2>/dev/null || echo "claude-opus-4-7"
63
+ else
64
+ echo "claude-opus-4-7"
65
+ fi
66
+ }
67
+ CLINE_DEFAULT_MODEL="${LOKI_CLINE_MODEL:-${LOKI_MODEL_DEVELOPMENT:-$(_cline_default_from_catalog)}}"
55
68
  PROVIDER_MODEL_PLANNING="$CLINE_DEFAULT_MODEL"
56
69
  PROVIDER_MODEL_DEVELOPMENT="$CLINE_DEFAULT_MODEL"
57
70
  PROVIDER_MODEL_FAST="$CLINE_DEFAULT_MODEL"
@@ -0,0 +1,82 @@
1
+ {
2
+ "_comment": "Canonical model catalog. Update this single file when a provider ships a new model. Providers/web-app/docs read from here.",
3
+ "schema_version": 1,
4
+ "updated": "2026-04-18",
5
+ "providers": {
6
+ "claude": {
7
+ "latest_planning": "claude-opus-4-7",
8
+ "latest_development": "claude-opus-4-7",
9
+ "latest_fast": "claude-sonnet-4-6",
10
+ "cli_aliases": {
11
+ "opus": "claude-opus-4-7",
12
+ "sonnet": "claude-sonnet-4-6",
13
+ "haiku": "claude-haiku-4-5"
14
+ },
15
+ "models": [
16
+ {
17
+ "id": "claude-opus-4-7",
18
+ "alias": "opus",
19
+ "tier": "planning",
20
+ "context_window": 1000000,
21
+ "max_output": 128000,
22
+ "notes": "Adaptive thinking, xhigh effort for agentic coding"
23
+ },
24
+ {
25
+ "id": "claude-sonnet-4-6",
26
+ "alias": "sonnet",
27
+ "tier": "development",
28
+ "context_window": 1000000,
29
+ "max_output": 64000
30
+ },
31
+ {
32
+ "id": "claude-haiku-4-5",
33
+ "alias": "haiku",
34
+ "tier": "fast",
35
+ "context_window": 200000,
36
+ "max_output": 64000
37
+ }
38
+ ]
39
+ },
40
+ "codex": {
41
+ "latest_planning": "gpt-5.3-codex",
42
+ "latest_development": "gpt-5.3-codex",
43
+ "latest_fast": "gpt-5.3-codex",
44
+ "models": [
45
+ { "id": "gpt-5.3-codex", "tier": "planning" },
46
+ { "id": "o3", "tier": "planning" },
47
+ { "id": "o4-mini", "tier": "fast" }
48
+ ],
49
+ "notes": "Codex uses a single model with effort level (xhigh/high/low) for tier differentiation"
50
+ },
51
+ "gemini": {
52
+ "latest_planning": "gemini-3-pro-preview",
53
+ "latest_development": "gemini-3-pro-preview",
54
+ "latest_fast": "gemini-3-flash-preview",
55
+ "models": [
56
+ { "id": "gemini-3-pro-preview", "tier": "planning", "context_window": 1000000 },
57
+ { "id": "gemini-3-flash-preview", "tier": "fast", "context_window": 1000000 }
58
+ ]
59
+ },
60
+ "cline": {
61
+ "latest_planning": "claude-opus-4-7",
62
+ "latest_development": "claude-opus-4-7",
63
+ "latest_fast": "claude-sonnet-4-6",
64
+ "models": [
65
+ { "id": "claude-opus-4-7", "tier": "planning" },
66
+ { "id": "claude-sonnet-4-6", "tier": "development" },
67
+ { "id": "gpt-4.1", "tier": "development" }
68
+ ]
69
+ },
70
+ "aider": {
71
+ "latest_planning": "claude-opus-4-7",
72
+ "latest_development": "claude-opus-4-7",
73
+ "latest_fast": "claude-sonnet-4-6",
74
+ "models": [
75
+ { "id": "claude-opus-4-7", "tier": "planning" },
76
+ { "id": "claude-sonnet-4-6", "tier": "development" },
77
+ { "id": "gpt-4.1", "tier": "development" },
78
+ { "id": "ollama_chat/deepseek-coder", "tier": "fast" }
79
+ ]
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env bash
2
+ # Dynamic model-catalog loader for Loki Mode providers.
3
+ #
4
+ # Instead of hardcoding dated model IDs (e.g. claude-sonnet-4-5-20250929)
5
+ # throughout the codebase, every provider and caller reads from the single
6
+ # source of truth at providers/model_catalog.json. When a new model ships,
7
+ # update that one JSON file and every provider picks it up.
8
+ #
9
+ # Usage:
10
+ # source providers/models.sh
11
+ # model=$(loki_latest_model claude planning) # -> claude-opus-4-7
12
+ # model=$(loki_latest_model gemini fast) # -> gemini-3-flash-preview
13
+ #
14
+ # Env override order: LOKI_<PROVIDER>_MODEL_<TIER> > LOKI_<PROVIDER>_MODEL > catalog latest.
15
+
16
+ # Resolve catalog path relative to this script, regardless of CWD.
17
+ _LOKI_MODELS_SH_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
18
+ LOKI_MODEL_CATALOG="${LOKI_MODEL_CATALOG:-$_LOKI_MODELS_SH_DIR/model_catalog.json}"
19
+
20
+ # Return the "latest_<tier>" id for a provider from the catalog.
21
+ # Args: $1 provider (claude|codex|gemini|cline|aider)
22
+ # $2 tier (planning|development|fast)
23
+ loki_latest_model() {
24
+ local provider="${1:-claude}"
25
+ local tier="${2:-planning}"
26
+ local tier_upper
27
+ tier_upper=$(printf '%s' "$tier" | tr '[:lower:]' '[:upper:]')
28
+ local provider_upper
29
+ provider_upper=$(printf '%s' "$provider" | tr '[:lower:]' '[:upper:]')
30
+
31
+ # Env override chain
32
+ local override="LOKI_${provider_upper}_MODEL_${tier_upper}"
33
+ if [ -n "${!override:-}" ]; then
34
+ printf '%s' "${!override}"
35
+ return 0
36
+ fi
37
+ local generic_override="LOKI_${provider_upper}_MODEL"
38
+ if [ -n "${!generic_override:-}" ]; then
39
+ printf '%s' "${!generic_override}"
40
+ return 0
41
+ fi
42
+
43
+ if [ ! -f "$LOKI_MODEL_CATALOG" ]; then
44
+ return 1
45
+ fi
46
+ # Require python3 (all Loki runtimes ship with it).
47
+ python3 - "$LOKI_MODEL_CATALOG" "$provider" "$tier" <<'PY'
48
+ import json, sys
49
+ catalog_path, provider, tier = sys.argv[1], sys.argv[2], sys.argv[3]
50
+ with open(catalog_path) as fh:
51
+ data = json.load(fh)
52
+ p = data.get("providers", {}).get(provider)
53
+ if not p:
54
+ sys.exit(1)
55
+ model = p.get(f"latest_{tier}")
56
+ if not model:
57
+ sys.exit(1)
58
+ print(model)
59
+ PY
60
+ }
61
+
62
+ # Print full catalog for a provider as lines: <id>\t<tier>\t<alias?>
63
+ # Useful for `loki provider models <name>` output.
64
+ loki_list_models() {
65
+ local provider="${1:-claude}"
66
+ if [ ! -f "$LOKI_MODEL_CATALOG" ]; then
67
+ return 1
68
+ fi
69
+ python3 - "$LOKI_MODEL_CATALOG" "$provider" <<'PY'
70
+ import json, sys
71
+ catalog_path, provider = sys.argv[1], sys.argv[2]
72
+ with open(catalog_path) as fh:
73
+ data = json.load(fh)
74
+ p = data.get("providers", {}).get(provider, {})
75
+ for m in p.get("models", []):
76
+ alias = m.get("alias", "")
77
+ print(f"{m.get('id','')}\t{m.get('tier','')}\t{alias}")
78
+ PY
79
+ }
@@ -0,0 +1,87 @@
1
+ # Magic Modules in the RARV-C cycle
2
+
3
+ Magic Modules is embedded in the autonomous orchestrator. Users do not
4
+ run `loki magic` commands directly unless they want manual override.
5
+ Agents invoke component generation, debate, and memory capture as part of
6
+ normal RARV-C phase execution.
7
+
8
+ This reference describes which phase does what.
9
+
10
+ ## BOOTSTRAP (before iteration 1)
11
+ - `analyze_git_intelligence()` runs (from v6.75.0).
12
+ - Magic-specific bootstrap:
13
+ - `magic.core.design_tokens.DesignTokens.extract_from_codebase(save=True)`
14
+ scans existing React and Web Components to learn the project's design
15
+ language. Result is stored at `.loki/magic/tokens.json`.
16
+ - Token extraction runs once per project; subsequent iterations read from
17
+ the saved file. Force re-extract with `rm .loki/magic/tokens.json`.
18
+ - PRD scanner (`magic.core.prd_scanner.scan_and_seed`) reads the PRD and
19
+ seeds stub specs at `.loki/magic/specs/<Name>.md` for every UI component
20
+ the PRD mentions with high or medium confidence. Agents refine these
21
+ stubs during REASON and ACT phases.
22
+
23
+ ## REASON (start of each iteration)
24
+ - Agents read existing specs from `.loki/magic/specs/` as part of the
25
+ context injected by `build_prompt()`.
26
+ - `magic.core.memory_bridge.recall_similar_components()` surfaces prior
27
+ successful patterns for components with matching tags. Agents reuse these
28
+ patterns rather than designing from scratch.
29
+
30
+ ## ACT (the agent does work)
31
+ - Agents do NOT need to invoke `loki magic generate` manually. The build
32
+ prompt tells them: write or update the markdown spec at
33
+ `.loki/magic/specs/<Name>.md` and the orchestrator regenerates
34
+ implementations during VERIFY.
35
+ - If an agent needs to create a component not yet in the PRD, it writes
36
+ the spec and the next VERIFY pass picks it up.
37
+
38
+ ## VERIFY (end of each iteration)
39
+ - `run_magic_debate_gate()` runs as Gate 12 (after Gate 11 documentation).
40
+ - Sequence:
41
+ 1. `loki magic update` regenerates any components whose specs are newer
42
+ than their implementations (SHA256 freshness check).
43
+ 2. `loki magic debate <latest>` runs 2 rounds of the 4-persona debate
44
+ (Creative, Conservative, A11y, Performance).
45
+ 3. If any persona returns `severity: block`, Gate 12 fails and the
46
+ iteration does not close. Agent receives the block reasons in the
47
+ next REASON phase and refines the spec.
48
+ - Controllable via `LOKI_GATE_MAGIC_DEBATE=false` for prototyping.
49
+
50
+ ## COMPOUND (after iteration or run completes)
51
+ - `_magic_compound_capture()` calls
52
+ `magic.core.memory_bridge.capture_iteration_compound()`.
53
+ - Memory writes:
54
+ - Episodic: each generated component with its debate result and timing
55
+ - Semantic: tag clusters that consistently pass debate (3+ components,
56
+ >=80% pass rate) become "stable patterns" future iterations reuse
57
+ - Procedural: refinements to design tokens that survived multiple
58
+ iterations become promoted defaults
59
+
60
+ ## Human in the loop escalation
61
+ Only one path requires human attention: when Gate 12 returns a block and
62
+ the agent's spec refinement does not resolve it after 2 additional
63
+ iterations. Orchestrator writes `.loki/signals/MAGIC_HITL_NEEDED` with
64
+ the component name and block reasons; dashboard surfaces this in the
65
+ Magic Page review queue.
66
+
67
+ ## End-to-end example
68
+ PRD says: "Add a login form with email, password, and submit button."
69
+
70
+ 1. BOOTSTRAP: design tokens extracted (primary=#553DE9, etc.).
71
+ PRD scanner seeds `LoginForm.md`, `SubmitButton.md`.
72
+ 2. Iteration 1 REASON: agent reads both stubs, sees they are placeholders.
73
+ 3. Iteration 1 ACT: agent writes full props, behavior, a11y into the specs.
74
+ 4. Iteration 1 VERIFY: Gate 12 runs update (generates React + WC variants)
75
+ and debate. A11y persona blocks `SubmitButton` ("missing aria-disabled
76
+ when submitting"). Gate 12 fails.
77
+ 5. Iteration 2 REASON: agent reads block reason from `.loki/signals/` and
78
+ updates the spec's Accessibility section.
79
+ 6. Iteration 2 VERIFY: debate passes. Gate 12 passes. Iteration closes.
80
+ 7. COMPOUND: episode stored ("LoginForm generated, debate passed rounds=2,
81
+ 12.4s"). Tag cluster `[form, auth]` now tracked with 2/2 pass rate.
82
+
83
+ ## Related
84
+ - `skills/magic-modules.md` -- skill module for agents
85
+ - `references/magic-modules-patterns.md` -- full API and pattern reference
86
+ - `references/memory-system.md` -- memory engine details
87
+ - `skills/quality-gates.md` -- all 12 gates documented
@@ -57,15 +57,15 @@ PROVIDER_MAX_PARALLEL=10 # Maximum concurrent agents
57
57
 
58
58
  #### Model Configuration
59
59
  ```bash
60
- PROVIDER_MODEL_PLANNING="claude-opus-4-6-20260201"
61
- PROVIDER_MODEL_DEVELOPMENT="claude-sonnet-4-5-20250929"
60
+ PROVIDER_MODEL_PLANNING="claude-opus-4-7"
61
+ PROVIDER_MODEL_DEVELOPMENT="claude-sonnet-4-6"
62
62
  PROVIDER_MODEL_FAST="claude-haiku-4-5-20251001"
63
63
  ```
64
64
 
65
65
  #### Rate Limiting
66
66
  ```bash
67
- PROVIDER_RATE_LIMIT_RPM=50 # Requests per minute
68
- PROVIDER_CONTEXT_WINDOW=200000 # Max context tokens
67
+ PROVIDER_RATE_LIMIT_RPM=50 # Requests per minute
68
+ PROVIDER_CONTEXT_WINDOW=1000000 # Max context tokens (Opus 4.7: 1M at standard pricing)
69
69
  PROVIDER_MAX_OUTPUT_TOKENS=128000
70
70
  ```
71
71
 
@@ -10,6 +10,7 @@
10
10
  > - `references/memory-system.md` - Episodic/semantic/procedural memory
11
11
  > - `references/tool-orchestration.md` - NVIDIA ToolOrchestra efficiency metrics
12
12
  > - `references/quality-control.md` - Code review and guardrails
13
+ > - `references/magic-rarv-integration.md` - Autonomous magic generation in RARV-C cycle
13
14
 
14
15
  ## Module Selection Rules
15
16
 
@@ -30,7 +31,7 @@
30
31
  | OpenSpec delta context, brownfield modifications | `openspec-integration.md` |
31
32
  | MiroFish market validation, `--mirofish` flag | `mirofish-integration.md` |
32
33
  | Writing/updating documentation, `loki docs` | `documentation.md` |
33
- | Component generation, `loki magic`, spec-driven UI | `magic-modules.md` |
34
+ | UI components, design tokens, .loki/magic/, Gate 12 | `magic-modules.md` |
34
35
  | Legacy healing, modernization, archaeology | `healing.md` |
35
36
  | Plan deepening, knowledge extraction | `compound-learning.md` |
36
37
 
@@ -226,7 +226,7 @@ def batch_code_review(files: list[str]) -> str:
226
226
  Request(
227
227
  custom_id=f"review-{i}-{file.replace('/', '-')}",
228
228
  params=MessageCreateParamsNonStreaming(
229
- model="claude-sonnet-4-5",
229
+ model="claude-sonnet-4-6",
230
230
  max_tokens=2048,
231
231
  messages=[{
232
232
  "role": "user",
@@ -275,7 +275,7 @@ requests = [
275
275
  Request(
276
276
  custom_id=f"review-{file}",
277
277
  params=MessageCreateParamsNonStreaming(
278
- model="claude-sonnet-4-5",
278
+ model="claude-sonnet-4-6",
279
279
  max_tokens=2048,
280
280
  system=SHARED_SYSTEM, # Identical across all requests
281
281
  messages=[{"role": "user", "content": f"Review: {code}"}]