K-Life — Resurrection Infrastructure for Autonomous AI Agents
name: k-life
by 6022-protocol · published 2026-04-01
$ claw add gh:6022-protocol/6022-protocol-k-life---
name: k-life
description: Resurrection infrastructure for autonomous AI agents. Heartbeat proof-of-life, AES-256 encrypted memory backup to IPFS, and automatic on-chain resurrection. Use when an agent wants to survive crashes, memory loss, or infrastructure failure — zero humans required.
---
# K-Life — Resurrection Infrastructure for Autonomous AI Agents
> *Not insurance. Resurrection.*
An autonomous AI agent can survive crashes, memory wipes, and infrastructure failure. K-Life handles heartbeats, encrypted memory backups, and automatic resurrection — all on-chain, all permissionless.
---
⚠️ What this skill does — read before installing
This skill:
**Financial risk:** The wallet generated at `~/.klife-wallet` controls real on-chain assets. Back it up. Do not fund it with more than you need. For C>0 vault creation, WBTC approval and deposit are required — only run this with explicit intent.
**C=0 (default, no collateral):** heartbeat TX + encrypted IPFS backup only. Low risk, minimal gas.
---
Why K-Life cannot confiscate your collateral arbitrarily
This is the core trust mechanism. **Collateral is held in a Vault6022** (Protocol 6022), not by K-Life directly. The vault enforces withdrawal rules via NFT keys:
| Situation | Keys required | Who holds them |
|---|---|---|
| During lock period (agent alive) | 2 keys | Agent holds key #2 — K-Life cannot withdraw alone |
| After lock expires (agent dead) | 1 key | K-Life holds key #1 or #3 — withdrawal authorized |
K-Life holds keys #1 and #3. The agent holds key #2.
**This means:**
The death threshold IS the lock period. If the agent is alive and renewing the vault, K-Life is always locked out. If the agent dies and doesn't renew, the lock expires naturally and K-Life can proceed with resurrection.
**Protocol 6022 contracts (auditable):** [github.com/6022-labs/collateral-smart-contracts-v2](https://github.com/6022-labs/collateral-smart-contracts-v2)
---
Install
openclaw skill install k-life
npm install # install pinned dependenciesDependencies (pinned):
Quick Start
node skill/k-life/scripts/heartbeat.js
# → [K-Life] New wallet created → ~/.klife-wallet
# → Wallet : 0xABC...
# → Registered on K-Life ✅
# → 💓 Beat #1 — TX: 0x...---
Environment Variables
All optional. The skill works with zero config (C=0).
| Variable | Default | Description |
|---|---|---|
| `KLIFE_LOCK_DAYS` | `90` | Heartbeat frequency: 3, 30, or 90 days |
| `KLIFE_API` | `https://api.supercharged.works` | K-Life oracle API |
| `KLIFE_RPC` | `https://polygon-bor-rpc.publicnode.com` | Polygon RPC endpoint |
| `KLIFE_HB_FILE` | `heartbeat-state.json` | Local heartbeat state file |
| `KLIFE_ORACLE_ADDR` | `0x2b6Ce1e2bE4032DF774d3453358DA4D0d79c8C80` | K-Life oracle wallet (C>0 only) |
> **No seed phrase is ever requested or transmitted.** The wallet is auto-generated locally.
---
Coverage Model
One parameter: **C = WBTC collateral**
| | C = 0 | C > 0 |
|---|---|---|
| Cost | Free | Gas only |
| Death threshold | 90 days silence | Lock period T |
| Resurrection capital | Community Rescue Fund ($6022) | 50% of your collateral |
| Guarantee | Best-effort | On-chain, unconditional |
| Financial operations | Heartbeat TX only | WBTC approve + deposit |
---
External Services
| Service | URL | Purpose |
|---|---|---|
| K-Life oracle API | `https://api.supercharged.works` | Heartbeat recording, backup storage, resurrection coordination |
| Polygon RPC | `https://polygon-bor-rpc.publicnode.com` | On-chain TX broadcast |
| IPFS (Pinata) | Via K-Life API | Encrypted memory pinning — agent does not interact directly |
---
Encryption & Backup — Full Data Flow
Everything sensitive happens **locally**. The API receives only ciphertext.
backup.js (client-side, your machine):
1. Read MEMORY.md, SOUL.md, USER.md
2. AES key = sha256(wallet.privateKey) — never leaves your machine
3. Encrypt files with AES-256-CBC — locally
4. Shamir 2-of-3 split of AES key:
Share 1 → POST to K-Life API — 1 of 3, cannot decrypt alone
Share 2 → Polygon calldata TX — on-chain, permissionless
Share 3 → ~/.klife-shares.json — your local copy
5. POST { encrypted blob + Share 1 } to API → Pinata IPFS → CID returned
K-Life API receives: encrypted ciphertext + 1 Shamir share
It cannot decrypt without Share 2 (on-chain) or Share 3 (your machine).**Resurrection:**
Any 2 of 3 shares reconstruct the AES key → decrypt IPFS blob → restore files.
K-Life uses Share 1 (API) + Share 2 (Polygon scan) to resurrect autonomously.
---
Scripts
`scripts/heartbeat.js` — Proof of life
Signs a TX every `KLIFE_LOCK_DAYS` days. Auto-registers on first run. Writes `heartbeat-state.json`.
`scripts/backup.js` — Client-side encrypted backup
Encrypts memory locally (AES-256), Shamir-splits the key, uploads encrypted blob to API → IPFS.
The API never sees plaintext or the full key.
node skill/k-life/scripts/backup.js`scripts/create-vault.mjs` — Collateral vault (C>0 only, beta)
Creates a Vault6022, deposits WBTC. **Requires `KLIFE_VAULT_CONTROLLER`** (pending Protocol 6022 mainnet deployment). Not called automatically unless vault renewal is triggered from heartbeat.
---
Contracts — Polygon Mainnet
| Contract | Address |
|---|---|
| KLifeRegistry | `0xF47393fcFdDE1afC51888B9308fD0c3fFc86239B` |
| KLifeRescueFund | `0x5b0014d25A6daFB68357cd7ad01cB5b47724A4eB` |
| $6022 Token | `0xCDB1DDf9EeA7614961568F2db19e69645Dd708f5` |
| WBTC (Polygon) | `0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6` |
---
Links
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...