loki-mode 6.76.0 → 6.76.1
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 -2
- package/VERSION +1 -1
- package/autonomy/run.sh +115 -4
- 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/magic-rarv-integration.md +87 -0
- package/skills/00-index.md +2 -1
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.
|
|
6
|
+
# Loki Mode v6.76.1
|
|
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.
|
|
275
|
+
**v6.76.1 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.76.
|
|
1
|
+
6.76.1
|
package/autonomy/run.sh
CHANGED
|
@@ -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"
|
|
@@ -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"
|
package/dashboard/__init__.py
CHANGED
package/docs/INSTALLATION.md
CHANGED
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
|
@@ -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
|
package/skills/00-index.md
CHANGED
|
@@ -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
|
-
|
|
|
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
|
|