Playground & .loki/ Files
Test LOKI locally against playground/index.html and understand every file inside .loki/ (knowledge.json, models.json, authorized_targets.json, config.yaml, and rules.md).
Bundled Sandbox (`playground/index.html`)
The LOKI repository includes a self-contained testbed at playground/index.html (LOKI Chaos Playground — Vulnerable Checkout). It renders a checkout card (*Neural Interface Pro V2 — $499.00 USD*) with a #coupon-code input, a #pay-button action button, and an 800ms simulated payment gateway.
# Terminal 1 — serve playground/index.html on port 8000python -m http.server 8000 --directory playground# Terminal 2 — attack it with Swarm Mode, concurrency probes, or self-healingloki run http://localhost:8000 --swarm --duration 5 --no-rulesloki run http://localhost:8000 -c 3 --target-selector "#pay-button"loki fix --apply
Offline healer fallback for `playground/index.html`
CodeHealer automatically resolves playground/index.html as a local target and includes a built-in offline fallback patch (_playground_fallback_patch) so you can test the .loki.bak backup, diff preview, and repro_test.py verification loop even without an AI API key.
Workspace files in `.loki/`
| Flag | Type | Default | Description |
|---|---|---|---|
| .loki/config.yaml | yaml | loki init | Project configuration: target (default_url, timeout_seconds, headless), chaos (default_persona, click_burst_count), api_chaos (enabled, fault_rate, auth_chaos, auth_fault_rate), and ai (provider, model, api_base, api_key_env). |
| .loki/rules.md | markdown | loki init | Plain-English business rules and invariants evaluated once at the end of each chaos session (PASSED or VIOLATED). |
| .loki/knowledge.json | json | loki init | Detected repository architecture fingerprint generated by ProjectScanner: languages, frameworks_and_tools, detected_files, and project_name. Injected automatically into loki chat context. |
| .loki/models.json | json | /model in chat | Named AI connection profile registry (active profile name + profiles array). Managed via /model in loki chat and shared across chat, rules evaluation, fix, and --auto-heal. |
| .loki/authorized_targets.json | json | loki auth | Per-machine registry of non-local hostnames confirmed for chaos testing (hosts dictionary with authorized_at and note). Managed with loki auth list/add/remove. |
| .loki/journeys/<name>.json | json | loki record | Recorded user workflow blueprints captured by loki record (with passwords and sensitive inputs masked as ********), replayed with chaos mutations via loki run --journey <name>. |
| .loki/runs/run_*/ | directory | loki run | Session evidence bundles containing incident.json, network.har, replay.webm, report.html, and repro_test.py. |
`.loki/knowledge.json` schema
ProjectScanner.detect_stack() inspects signature files (requirements.txt, pyproject.toml, package.json, tsconfig.json, Cargo.toml, go.mod, index.html, Dockerfile, docker-compose.yml) and package.json dependencies (react, vue, svelte, next, express, playwright) to build .loki/knowledge.json:
{"stack": {"languages": ["Python","Node.js / TypeScript","Web / Static HTML"],"frameworks_and_tools": ["react","playwright"],"detected_files": ["pyproject.toml","package.json","index.html"]},"project_name": "my-web-app","initialized_at": true}
`.loki/models.json` & `.loki/authorized_targets.json`
{"active": "local","profiles": [{"name": "local","model": "ollama/llama3","api_base": "http://localhost:11434/v1"},{"name": "work","model": "mistral/mistral-large-latest","api_key_env": "MISTRAL_API_KEY"}]}
{"hosts": {"staging.example.com": {"authorized_at": "2026-10-22T15:30:00+00:00","note": "loki auth add"}}}
