loki-mode 6.66.0 → 6.67.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 +3 -2
- package/VERSION +1 -1
- package/autonomy/hooks/migration-hooks.sh +170 -0
- package/autonomy/loki +1018 -1
- package/autonomy/notification-checker.py +4 -3
- package/autonomy/run.sh +22 -10
- package/autonomy/tui.sh +471 -0
- package/completions/_loki +57 -0
- package/completions/loki.bash +39 -1
- package/dashboard/__init__.py +1 -1
- package/dashboard/server.py +20 -6
- package/docs/INSTALLATION.md +1 -1
- package/events/bus.py +9 -1
- package/events/emit.sh +2 -2
- package/mcp/__init__.py +1 -1
- package/memory/namespace.py +14 -11
- package/memory/schemas.py +155 -0
- package/memory/storage.py +29 -4
- package/package.json +1 -1
- package/references/legacy-healing-patterns.md +352 -0
- package/skills/00-index.md +13 -1
- package/skills/healing.md +491 -0
- package/skills/quality-gates.md +31 -2
- package/skills/troubleshooting.md +33 -0
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.67.1
|
|
7
7
|
|
|
8
8
|
**You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
|
|
9
9
|
|
|
@@ -165,6 +165,7 @@ GROWTH ──[continuous improvement loop]──> GROWTH
|
|
|
165
165
|
- Running tests? Load testing.md
|
|
166
166
|
- Code review? Load quality-gates.md
|
|
167
167
|
- Debugging? Load troubleshooting.md
|
|
168
|
+
- Legacy healing? Load healing.md
|
|
168
169
|
- Deploying? Load production.md
|
|
169
170
|
- Parallel features? Load parallel-workflows.md
|
|
170
171
|
- Architecture planning? Load compound-learning.md (deepen-plan)
|
|
@@ -267,4 +268,4 @@ The following features are documented in skill modules but not yet fully automat
|
|
|
267
268
|
| Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
|
|
268
269
|
| Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
|
|
269
270
|
|
|
270
|
-
**v6.
|
|
271
|
+
**v6.67.1 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.67.1
|
|
@@ -271,3 +271,173 @@ except: print(0)
|
|
|
271
271
|
|
|
272
272
|
return 0
|
|
273
273
|
}
|
|
274
|
+
|
|
275
|
+
#===============================================================================
|
|
276
|
+
# Healing-Specific Hooks (v6.67.0)
|
|
277
|
+
# Inspired by Amazon AGI Lab's legacy system healing approach.
|
|
278
|
+
# These hooks enforce behavioral preservation during healing operations.
|
|
279
|
+
#===============================================================================
|
|
280
|
+
|
|
281
|
+
# Hook: pre_healing_modify - runs BEFORE agent modifies any file in healing mode
|
|
282
|
+
# Checks friction map to prevent removal of undocumented business rules
|
|
283
|
+
hook_pre_healing_modify() {
|
|
284
|
+
local file_path="${1:-}"
|
|
285
|
+
local codebase_path="${LOKI_CODEBASE_PATH:-.}"
|
|
286
|
+
local heal_dir="${codebase_path}/.loki/healing"
|
|
287
|
+
local strict="${LOKI_HEAL_STRICT:-false}"
|
|
288
|
+
|
|
289
|
+
# Only enforce in healing mode
|
|
290
|
+
[[ "${LOKI_HEAL_MODE:-false}" != "true" ]] && return 0
|
|
291
|
+
[[ -z "$file_path" ]] && return 0
|
|
292
|
+
|
|
293
|
+
# Check if file has friction points
|
|
294
|
+
if [[ -f "$heal_dir/friction-map.json" ]]; then
|
|
295
|
+
local blocked
|
|
296
|
+
blocked=$(python3 -c "
|
|
297
|
+
import json, sys
|
|
298
|
+
file_path = sys.argv[1]
|
|
299
|
+
strict = sys.argv[2] == 'true'
|
|
300
|
+
with open(sys.argv[3]) as f:
|
|
301
|
+
data = json.load(f)
|
|
302
|
+
for friction in data.get('frictions', []):
|
|
303
|
+
loc = friction.get('location', '')
|
|
304
|
+
if file_path in loc:
|
|
305
|
+
cls = friction.get('classification', 'unknown')
|
|
306
|
+
safe = friction.get('safe_to_remove', False)
|
|
307
|
+
if cls in ('business_rule', 'unknown') and not safe:
|
|
308
|
+
print(f'BLOCKED: Friction {friction.get(\"id\", \"?\")} in {loc} classified as {cls}')
|
|
309
|
+
sys.exit(0)
|
|
310
|
+
if strict and cls != 'true_bug':
|
|
311
|
+
print(f'BLOCKED (strict): Friction {friction.get(\"id\", \"?\")} in {loc} - strict mode requires explicit approval')
|
|
312
|
+
sys.exit(0)
|
|
313
|
+
print('OK')
|
|
314
|
+
" "$file_path" "$strict" "$heal_dir/friction-map.json" 2>/dev/null || echo "OK")
|
|
315
|
+
|
|
316
|
+
if [[ "$blocked" == BLOCKED* ]]; then
|
|
317
|
+
echo "HOOK_BLOCKED: $blocked"
|
|
318
|
+
echo "To proceed: Update friction-map.json to classify this friction or set safe_to_remove=true"
|
|
319
|
+
return 1
|
|
320
|
+
fi
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
return 0
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
# Hook: post_healing_modify - runs AFTER agent modifies a file in healing mode
|
|
327
|
+
# Verifies characterization tests still pass after modification
|
|
328
|
+
hook_post_healing_modify() {
|
|
329
|
+
local file_path="${1:-}"
|
|
330
|
+
local codebase_path="${LOKI_CODEBASE_PATH:-.}"
|
|
331
|
+
local heal_dir="${codebase_path}/.loki/healing"
|
|
332
|
+
|
|
333
|
+
[[ "${LOKI_HEAL_MODE:-false}" != "true" ]] && return 0
|
|
334
|
+
|
|
335
|
+
# Log the modification
|
|
336
|
+
if [[ -d "$heal_dir" ]]; then
|
|
337
|
+
local log_entry
|
|
338
|
+
log_entry="{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"healing_modify\",\"file\":\"${file_path}\",\"agent\":\"${LOKI_AGENT_ID:-unknown}\",\"phase\":\"${LOKI_HEAL_PHASE:-unknown}\"}"
|
|
339
|
+
echo "$log_entry" >> "$heal_dir/activity.jsonl" 2>/dev/null || true
|
|
340
|
+
fi
|
|
341
|
+
|
|
342
|
+
# Run characterization tests
|
|
343
|
+
local test_cmd
|
|
344
|
+
test_cmd=$(detect_test_command "$codebase_path")
|
|
345
|
+
local test_result_file
|
|
346
|
+
test_result_file=$(mktemp)
|
|
347
|
+
|
|
348
|
+
if ! eval "$test_cmd" > "$test_result_file" 2>&1; then
|
|
349
|
+
local test_output
|
|
350
|
+
test_output=$(cat "$test_result_file")
|
|
351
|
+
rm -f "$test_result_file"
|
|
352
|
+
|
|
353
|
+
# Revert the change - characterization tests must pass
|
|
354
|
+
git -C "$codebase_path" checkout -- "$file_path" 2>/dev/null || true
|
|
355
|
+
echo "HOOK_BLOCKED: Characterization tests failed after healing modification to ${file_path}. Change reverted."
|
|
356
|
+
echo "Test output: ${test_output}"
|
|
357
|
+
|
|
358
|
+
# Record failure in failure-modes.json
|
|
359
|
+
if [[ -f "$heal_dir/failure-modes.json" ]]; then
|
|
360
|
+
python3 -c "
|
|
361
|
+
import json, sys
|
|
362
|
+
from datetime import datetime
|
|
363
|
+
with open(sys.argv[1]) as f:
|
|
364
|
+
data = json.load(f)
|
|
365
|
+
data.get('modes', []).append({
|
|
366
|
+
'mode_id': 'heal-fail-' + datetime.now().strftime('%Y%m%dT%H%M%S'),
|
|
367
|
+
'trigger': 'healing_modification',
|
|
368
|
+
'file': sys.argv[2],
|
|
369
|
+
'behavior': 'Characterization tests failed after modification',
|
|
370
|
+
'recovery': 'Change automatically reverted',
|
|
371
|
+
'is_intentional': False
|
|
372
|
+
})
|
|
373
|
+
with open(sys.argv[1], 'w') as f:
|
|
374
|
+
json.dump(data, f, indent=2)
|
|
375
|
+
" "$heal_dir/failure-modes.json" "$file_path" 2>/dev/null || true
|
|
376
|
+
fi
|
|
377
|
+
|
|
378
|
+
return 1
|
|
379
|
+
fi
|
|
380
|
+
|
|
381
|
+
rm -f "$test_result_file"
|
|
382
|
+
return 0
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
# Hook: healing_phase_gate - mechanical verification before healing phase transition
|
|
386
|
+
hook_healing_phase_gate() {
|
|
387
|
+
local from_phase="${1:-}"
|
|
388
|
+
local to_phase="${2:-}"
|
|
389
|
+
local codebase_path="${LOKI_CODEBASE_PATH:-.}"
|
|
390
|
+
local heal_dir="${codebase_path}/.loki/healing"
|
|
391
|
+
|
|
392
|
+
[[ "${LOKI_HEAL_MODE:-false}" != "true" ]] && return 0
|
|
393
|
+
|
|
394
|
+
case "${from_phase}:${to_phase}" in
|
|
395
|
+
archaeology:stabilize)
|
|
396
|
+
# Require: friction map has entries, characterization tests pass
|
|
397
|
+
local friction_count
|
|
398
|
+
friction_count=$(HEAL_DIR="$heal_dir" python3 -c "
|
|
399
|
+
import json, os
|
|
400
|
+
try:
|
|
401
|
+
with open(os.path.join(os.environ['HEAL_DIR'], 'friction-map.json')) as f:
|
|
402
|
+
print(len(json.load(f).get('frictions', [])))
|
|
403
|
+
except: print(0)
|
|
404
|
+
" 2>/dev/null || echo 0)
|
|
405
|
+
[[ "$friction_count" -eq 0 ]] && echo "GATE_BLOCKED: friction-map.json has 0 entries. Run archaeology first." && return 1
|
|
406
|
+
|
|
407
|
+
[[ ! -f "$heal_dir/institutional-knowledge.md" ]] && echo "GATE_BLOCKED: institutional-knowledge.md not found" && return 1
|
|
408
|
+
|
|
409
|
+
local test_cmd
|
|
410
|
+
test_cmd=$(detect_test_command "$codebase_path")
|
|
411
|
+
if ! eval "$test_cmd" >/dev/null 2>&1; then
|
|
412
|
+
echo "GATE_BLOCKED: Characterization tests do not pass"
|
|
413
|
+
return 1
|
|
414
|
+
fi
|
|
415
|
+
;;
|
|
416
|
+
stabilize:isolate)
|
|
417
|
+
local test_cmd
|
|
418
|
+
test_cmd=$(detect_test_command "$codebase_path")
|
|
419
|
+
if ! eval "$test_cmd" >/dev/null 2>&1; then
|
|
420
|
+
echo "GATE_BLOCKED: Tests do not pass after stabilization"
|
|
421
|
+
return 1
|
|
422
|
+
fi
|
|
423
|
+
;;
|
|
424
|
+
isolate:modernize)
|
|
425
|
+
local test_cmd
|
|
426
|
+
test_cmd=$(detect_test_command "$codebase_path")
|
|
427
|
+
if ! eval "$test_cmd" >/dev/null 2>&1; then
|
|
428
|
+
echo "GATE_BLOCKED: Tests do not pass after isolation"
|
|
429
|
+
return 1
|
|
430
|
+
fi
|
|
431
|
+
;;
|
|
432
|
+
modernize:validate)
|
|
433
|
+
local test_cmd
|
|
434
|
+
test_cmd=$(detect_test_command "$codebase_path")
|
|
435
|
+
if ! eval "$test_cmd" >/dev/null 2>&1; then
|
|
436
|
+
echo "GATE_BLOCKED: Tests do not pass after modernization"
|
|
437
|
+
return 1
|
|
438
|
+
fi
|
|
439
|
+
;;
|
|
440
|
+
esac
|
|
441
|
+
|
|
442
|
+
return 0
|
|
443
|
+
}
|