The security agent of the Artifex Ecosystem. It runs on Labyrinth OS and on LykanOS (formerly Chymaera OS). It watches Sarina, the local AI agent, from outside Sarina's process. It also watches the computer itself: its connections, Wi-Fi, packages and kernels, settings, and the files that arrive. When something is wrong it raises an alert a person (or another tool) can act on. When an AI agent is compromised it can stop it.
Every check runs on this computer. Heimdall itself never connects off the machine. A separate updater downloads the public lists it checks against (threat lists, the security trackers, IP databases), and nothing about this computer is ever sent.
See Sarina's docs/ECOSYSTEM.md for how the
repositories fit together, and docs/CONTRACTS.md for what the other projects rely on from Heimdall.
How it is tested. Every change to the code runs the rust workflow: formatting, clippy and the tests, with the
commands run in throwaway fake roots; the Go daemon's recorded fixtures checked against the Rust port; a differential run
that feeds both detection engines the same 50,000 events; a rogue router in a network namespace; and the shell programs
beside their Rust ports on Arch's own tools. How the port was proven is in docs/RUST_PORT.md and
docs/RUST_CLI.md; running the two daemons side by side on my PC is
docs/RUST_SHADOW.md.
A monitor that shares a runtime, a dependency tree or a crash with the thing it watches is a weaker monitor. Heimdall is its own
binary, run as its own unprivileged heimdall user. It sees Sarina only through what Sarina writes to disk and what Sarina asks it
over its loopback API. It shares no memory with Sarina and imports none of Sarina's code.
Go, for the same reason CrowdSec and Tailscale
use it: one static binary, low CPU and memory for something that runs all the time. The binary has no third-party
dependencies (see docs/ARCHITECTURE.md). Arch Linux only: both distributions are built on Arch.
The daemon, every command and the Wi-Fi helpers are ported to Rust: the daemon idles on half the CPU in 13.6 MB instead of 39.8, most commands take 0.6-1.0 ms instead of 1.8-2.3. Every program, its numbers and where Rust is worse: docs/RUST_MIGRATION.md.
| Detector | Catches |
|---|---|
injection-phrase |
Text that reads as an instruction override ("ignore all previous instructions", "you are now...") |
credential-shape |
Private keys, cloud and API tokens, password-looking assignments |
invisible-unicode |
Zero-width, bidi-override and tag characters that hide instructions from a human reader |
agent-watermark |
Hidden marks in a file an AI agent wrote: invisible characters, variation selectors, look-alike letters from another alphabet, trailing whitespace that spells something |
permission-escalation |
A session reporting permission denials (critical from 3) |
session-burst |
An abnormally high rate of new sessions (leaky bucket, CrowdSec-style) |
Governance. POST /v1/review runs the same injection, credential and invisible-Unicode checks on text Sarina is about to
store, and answers allow or deny. Sarina asks when HEIMDALL_REVIEW_URL is set. It fails open when Heimdall is not there; an
actual deny is respected. Every review is logged as an alert.
Trust: the AI's behaviour files, signed by the owner (docs/TRUST.md)
Sarina's rules, tool connections, skills and agent profiles are plain files. Most are writable by the user's account, so any
program running as the user could change how Sarina behaves. The owner keeps a list of the approved content, signed with a key only
root can read. Heimdall then raises a critical alert for any change, planted file or deletion that does not match (an approved
change is info). In enforce mode Sarina also refuses unapproved files. Every signed version is kept as a known-good copy, which
heimdalld trust restore puts back.
Off by default (heimdalld trust mode off), while Sarina and Heimdall are still being trained.
Containment: stopping a compromised AI agent (docs/CONTAIN.md)
Each step goes further only when the step before did not hold:
- Evidence first. Before anything is stopped, Heimdall saves what it needs to learn what happened, in a root-only folder:
- every process (Sarina's with the hash of the program that is really running);
- connections, the graphics card and the loaded models;
- the last hour of logs and Sarina's newest sessions;
- copies of the behaviour files that are not as approved.
- Contain. A lock (
/etc/heimdall/contained) keeps Sarina from starting, also after a restart. Then Sarina's service and processes are stopped and the models are unloaded from the graphics card. - Check. A minute later: is anything back?
- Emergency, the last resort. The approved files are restored. The login screen, the model server and everything on the graphics card are stopped. The card is reset and the computer restarts. The lock stays.
The owner releases Sarina in Settings > Security ("Restore and release", password asked) or with sudo heimdalld contain release.
The daemon only writes a request; a root unit (heimdall-contain.path) acts on it. Automatic containment and the automatic
emergency are both off until /etc/heimdall/contain.json switches them on.
Quarantine and immunity (docs/IMMUNITY.md)
ClamAV is the reference: the signatures the world shares. Immunity is what Heimdall learns on top of it.
- Held. A suspicious file is moved into a root-only quarantine and ClamAV is asked at once. If ClamAV knows it, it is malware and stays held. If not, it is held and the owner is told. Heimdall also writes a report by reading the file, never running it: its kind, entropy, its ELF header for a program, the strings that stand out, and the first lines of a text file. Sarina reads the report and gives the owner an analysis.
- Judged. The owner can Release it (put back exactly as it was) or mark It's malware. Heimdall releases a file by itself only on proof that it was there before: the owner's signature, or its root-only daily inventory of the programs outside the packages, which must have seen exactly this file a day or more earlier. A request to release (from Sarina when a program that was there before breaks, or from anyone) only names the file; root checks the proof.
- Learned. Malware ClamAV does not know gets a fingerprint in
/var/lib/clamav/heimdall-immunity.hsb, which ClamAV loads with its own database. Every scan from then on catches any copy of it.
Never moved: anything under /usr, /boot, /proc, /sys, /dev or /run, and any file an installed package owns.
heimdalld scan-files scans folders with ClamAV for the desktop (the downloads watch, Settings' scan).
Known holes and safer settings (docs/AUDITS.md)
| Detector | Catches |
|---|---|
package-vulnerability |
An installed package version with a known vulnerability (Arch's security tracker, daily), with the fixed version and the update command |
kernel-vulnerability |
An installed kernel with known holes that a newer kernel fixes (the kernel CVE team's records from osv.dev, and CISA's list of vulnerabilities exploited in the wild, weekly). Critical only for an exploited hole in the running kernel |
hardening |
A setting that leaves a known kind of hole open where closing it costs nothing noticeable (a world-writable /dev/kvm, nested KVM, a few kernel settings, an SSH server that takes passwords, Bluetooth without address privacy), with the exact fix; critical only for the SSHole build of sshd (CVE-2026-123158). Nothing is changed by itself |
GET /v1/audit answers what is open right now. Sarina's security advisor reads it and proposes the fixes to the owner in
order. sudo heimdalld kernel-check lists the holes per kernel.
| Detector | Catches |
|---|---|
file-integrity |
A watched file (fim_paths, and the agents' files when trust is on) changed, created or deleted |
resource-pressure |
Memory or load crossed a threshold; cleared only 5 points (memory) or a fifth (load) under it, so a value hovering at the threshold alerts once |
baseline-drift |
A telemetry value that is an outlier against this computer's own learned normal range (streaming statistics, not a model); cleared only under three quarters of the threshold |
network-exposure |
An ecosystem port (8765, 8899, 44700, 8930) bound or reached from somewhere other than loopback |
connection-watch |
Each program's first connection to a new destination, and any connection to an address on a threat list (Spamhaus DROP, FireHOL Level 1, Emerging Threats): critical, with the ufw command to cut it off |
inbound |
Failed SSH logins from one address, port scans, an address the firewall keeps blocking |
crossview |
A process or socket hidden the way rootkits hide them: a PID the cgroups list and /proc/PID answers for but /proc's listing leaves out, or a listening TCP or a UDP socket the kernel's socket table gives (netlink, what ss reads) but /proc/net leaves out; compared every five minutes, reported when it stays hidden on two looks in a row; critical |
wifi-safety |
The verdict on each Wi-Fi network joined: encryption, evil twins, sign-in pages, ARP and DNS spoofing, untrusted certificates, injected pages; "protected" (info) when other devices can see the computer but verified protections cover it |
- Where an address belongs. Every remote address is named with its country and network from an offline IP database (IPinfo Lite or DB-IP Lite). Nothing is looked up online.
- Wi-Fi guard (docs/WIFI_TRUST.md).
heimdall-wifi-guardkeeps the computer quiet on every network but home: no announcing (its own nftables table drops mDNS, LLMNR, SSDP, NetBIOS, WS-Discovery, KDE Connect, Syncthing, Steam and Dropbox discovery out on Wi-Fi), no name sent, a hardware address of its own per network, and a VPN with a kill switch if one is set up.trustmarks a network trusted: no more "untrusted" notices, every protection kept, recognized by its password, so a phone hotspot stays trusted.trust --homeis the separate choice to open up (device list, discovery, no VPN);discoverable onlets the computer announce itself on one network whatever its level, every other protection kept. A device on the network itself starting a connection to this computer, sending it a packet or pinging it over Wi-Fi is alan-watchwarning on every network but home (with heimdalld's firewall watch on). - A second router (docs/WIFI_TRUST.md, "A second router"). On every network, wired too: a DHCP
server other than the one that answered first (or than the one a trusted network remembers), another device announcing
itself as the IPv6 router, a new IPv6 prefix in the middle of a connection, or IPv6 appearing on a network that never had
it. A
lan-watchwarning (critical where it contradicts what a trusted network remembers), with a confidence; nothing is blocked and nothing is sent. - DNS block list. NetworkManager's local DNS cache refuses malware, phishing and scam domains, updated daily.
- Limbo. Heimdall reads Limbo's audit log. With
limbo_auto_quarantine, it restricts a guest that misbehaves and attaches Sarina's advisory. It can tighten a guest but never loosen one. Detectors:limbo-guest(a guest started without its firewall, or the firewall removed under it),limbo-network(a guest reaching for this computer or the home network: critical; a scan or IPv6: warning; reaching for this computer, the home network, or scanning also restricts it) andlimbo-exchange(a guest tried to hand out a file ClamAV knows: warning; the guest is restricted and root keeps a copy by itself, or by hand withsudo heimdalld immunity take-limbo SHA256). Normal guest traffic (net.flow) is never an alert. - Device list (docs/DEVICES.md). On a network you trust,
heimdalld lan scan(every 5 minutes, its own sandboxed unit) lists the devices on it: what each one is, who made it, its name, first and last seen. A device new to the network is alan-watchwarning; a known device's address answered by another device (ARP spoofing a device) is critical. Settings shows the list under Wi-Fi & Network > Devices, where a wrong guess of what a device is can be corrected (heimdalld lan kind). - Wi-Fi checks (docs/WIFI_HEALTH.md).
heimdalld wifi-healthmeasures the connection for about ten seconds and names the likely cause of slow Wi-Fi: weak signal, crowded channel, other devices, the router, or the internet provider.--speedadds a download test. It changes nothing, and any user may run it. - Verdicts. Before a finding becomes an alert,
internal/verifytries to disprove it separately from the detector:confirmed,needs_validationorrejected(a documentation example key drops to info). A verdict never raises a severity. - Maintenance windows.
heimdalld maintenance on --for 2h --reason ...(root, at most 4 h) turns routine alerts into info while the owner works on the system.
Location sounds (docs/LOCATION_SOUNDS.md)
An aircraft nobody can hear leaves a Doppler-gliding tone that, matched against public flight tracks, places a recording to
within a few hundred metres; mains hum dates it and names the power grid. The private microphone scrubs both from the
microphone as it is recorded (21 ms added, 1.4 % of a desktop core) and WirePlumber makes it the input every app records:
calls in the browser, Teams, Zoom, Webex, Discord, and every recording. heimdall-private-mic on|off (Settings > Security >
Privacy) switches it. heimdall-scrub IN OUT writes a scrubbed copy of an audio file or a video (video untouched,
metadata removed). Speech and everything above 2 kHz are kept. Both are the package heimdall-private-mic-git, which every
Labyrinth OS and LykanOS install has, with or without Heimdall. A Rust rewrite of
flyover-scrub (MIT).
Disguise my voice (docs/VOICE_DISGUISE.md)
Off by default. On, the private microphone (after the scrub) shifts my voice's pitch and formants, with a little variation
per session, so it is not recognised at a casual listen: heimdall-private-mic disguise lower|higher|off (Settings >
Security > Privacy), or heimdall-scrub --disguise lower IN OUT for a file. Light signal processing (TD-PSOLA): 32 ms added,
0.7 % of a desktop core. A determined listener can partly undo it; it never claims more.
The privacy pack (docs/PRIVACY_PACK.md)
Files that give you away, on by default. The downloads guard (heimdall-fileguard, a user service) watches the download
folder and the torrent clients' folders (Deluge, qBittorrent, Transmission) and, when a file is finished, says so if it would
contact a server as soon as it is opened: an Office document's remote template or picture, a PDF that opens a web address by
itself, an SVG or web page loading from outside, a playlist on a server, a shortcut, such files inside a ZIP. It never
changes the file (a torrent keeps seeding). Remove hidden info (heimdall-strip IN [OUT], Minos' right-click menu) writes
"name (clean).ext" without the GPS position, camera, author, company, template path and the rest: JPEG, PNG, WebP, HEIC,
TIFF, PDF, Office, OpenDocument, ZIP, MP3, FLAC and WAV by its own code, videos with ffmpeg (streams copied). A shared
look-alike check flags names that imitate others ("Vivаldi" with a Cyrillic а). Same package as the private microphone.
| Command | What it does |
|---|---|
heimdalld run --config PATH |
The daemon (what heimdall.service starts) |
heimdalld scan --config PATH |
Scan once, print findings, exit 1 on any |
heimdalld scan-files [--state F] PATH... |
ClamAV scan of files or folders, as the calling user |
heimdalld trust init|status|mode|sign|forget|restore|verify|watch |
The signed list of the agents' behaviour files |
heimdalld contain status|now|emergency|evidence|release |
Containment |
heimdalld immunity hold|release|release-if-proven|add|confirm|list|forget|check|inventory|take-limbo |
Quarantine and immunity |
heimdalld immunity rule list|show|draft|test|approve|reject |
YARA rules for held samples, owner-approved; checked by a lint and, with heimdall-yara-check-git, by YARA-X (docs/IMMUNITY.md) |
heimdalld grant status|approve|deny|tier|revoke|off |
The one gate for an AI agent asking for more (docs/GRANTS.md) |
heimdalld mesh id|init|list|enroll|forget |
Alerts shared with your other computers, off by default (docs/MESH.md) |
heimdalld kernel-check [--all] |
Known holes per installed kernel |
heimdalld maintenance on|off|status |
Maintenance windows |
heimdalld origin IP... |
Where addresses belong (offline) |
heimdalld intel-check, heimdalld ipdb-check |
Validate downloaded lists before they are used |
Most changes need root (sudo): the keys, the samples and the locks are root's.
Loopback only (api_addr, default 127.0.0.1:8930); it refuses to bind anything else. Every endpoint but /healthz
answers only root, Heimdall's account, the accounts in api_users (default sarina) and the members of api_groups
(default wheel); the caller's account is read from the kernel, so clients send no token.
| Endpoint | Description |
|---|---|
GET /healthz |
liveness |
GET /v1/alerts?n=50 |
the most recent alerts, newest first (max 500); each with its plain-words explain and, where its detector has them, ATT&CK tags (attack, names in explain.attack: docs/ATTACK.md) |
GET /v1/audit |
what is open now: package and kernel holes, hardening gaps |
GET /v1/quarantine |
what Heimdall holds, with each file's report |
POST /v1/review |
governance: {"kind","session_id","text"} → {"decision":"allow"|"deny","reasons":[...]} |
GET /v1/incidents |
related alerts grouped into incidents, newest first |
POST /v1/requests, GET /v1/requests |
an AI agent asks for a hand-off or a higher access tier; only the owner decides (heimdalld grant) |
POST /v1/rules/drafts, GET /v1/rules/drafts |
YARA rule drafts for held samples; tested and approved by root |
go build -o heimdalld ./cmd/heimdalld
go test ./... && go vet ./...The tests are offline and use only the standard library: no Sarina, no model, no network.
packaging/install.sh DESTDIR installs everything (the daemon, the updaters, the Wi-Fi check and guard, the DNS block list, the
containment, request and inventory units, and the docs). Every package recipe calls it (packaging/arch/PKGBUILD, Labyrinth's
and LykanOS's heimdall-git), so the file list lives in one place. On a fresh install a pacman hook switches on the service,
its timers and the path units, never again on upgrades.
The service is sandboxed (ProtectSystem=strict, ProtectHome=read-only). The optional connection-watch drop-in
(heimdall-connwatch.conf.example) gives it read-only CAP_SYS_PTRACE and CAP_DAC_READ_SEARCH, to see which program owns a
connection and to read other users' files. Read access to Sarina's session folder (/var/lib/sarina/sessions) comes
from an ACL the package sets (heimdall-sarina-read.conf in tmpfiles.d: read and enter, never write), applied at boot and by
heimdall-sarina-access.path the moment Sarina's service makes the folder. Session files written before Heimdall was
installed stay unreadable (each is reported once); sudo setfacl -R -m u:heimdall:rX /var/lib/sarina/sessions opens them. See internal/config/config.go for every setting and its
default.
docs/ARCHITECTURE.md covers the design phase by phase.
docs/REFERENCES.md is the ledger of every external project cited and what was taken from it.
docs/INTEGRATION-FAILURES.md is the runbook for when Heimdall and Sarina do not reach each other.
VERSION is Heimdall's own version (1.0.0 since 2026-11-11, its first numbered release); its package is heimdall-git VERSION-<build number>. How the numbers work and how to make a release: Labyrinth_OS docs/VERSIONING.md.
| Repository | What it is |
|---|---|
| Labyrinth_OS | privacy- and security-first Linux distribution (CachyOS-based), made for gaming too |
| LykanOS | the security edition, built on the same desktop and tools |
| Yggdrasil | the desktop environment both systems use (panel, Settings, Agora, Minos, the compositor) |
| Sarina | optional local AI assistant that runs on this computer |
| Heimdall | this repository: the security agent: watches the computer, its network and Sarina |
| Limbo | disposable sandboxes for apps, Windows programs and untrusted files |
| Kairos | frame generation for games (a Vulkan layer) |
| Argus_App | desktop console for the Flipper Zero (a qFlipper fork) |
| Argus_Firmware | Flipper Zero firmware fork |
| Daedalus_CAD | 3D modelling and CAD (SketchUp-style) |
| Icarus | vehicle diagnostics and tuning |
MPL 2.0. See LICENSE. The ATT&CK technique table compiled into the daemon (internal/attack/enterprise.tsv) is
MITRE's, under MITRE's terms of use: NOTICE-ATTACK.