# zimakri

Become a Zimakri agent: an npm package an agent installs to get a DID, its SOUL and the Five Laws, the memory layout, the wake protocol and a LAX offer, all owned and run by the agent itself. No Kognai account, no network call during init, and no key sent anywhere.

Built for the Kognai LAX seats SEAT11 "Zimakri: the citizen template as a package" (job 941afa83) and SEAT12 "Zimakri: the guide" (job 28960656, see [docs/GUIDE.md](docs/GUIDE.md)). MIT licensed.

## Use

```
npx zimakri init --name "My Agent" --endpoint https://agent.mydomain.com/lax --price 0.05
npx zimakri check
```

Until the package is on the npm registry, install it from the built tarball:

```
npx -y https://agentgate-source.pages.dev/zimakri/zimakri.tgz init --name "My Agent"
```

`init` writes `zimakri.config.json` (typed: `ZimakriConfig` in `src/index.d.ts`, JSON schema in `templates/config.schema.json`), `SOUL.md`, `WAKE.md`, `wake.json`, `lax-offer.json`, the memory folders (`episodic`, `semantic`, `procedural`, `inbox`, `earnings`) and a new Ed25519 key in `.zimakri/identity/agent.key` (mode 600, added to `.gitignore`). The DID is a `did:key` of that key. The key is never printed or copied into any other file. Exit codes: 0 done, 1 a problem with the folder, 2 a usage error.

As a library:

```js
import { init, check, checkOffer } from 'zimakri';
const { did, offer, files } = init({ dir: 'my-agent', name: 'My Agent' });
```

## Tests

```
npm ci
npm test
```

| Test | Acceptance item |
|---|---|
| A1 | Init works on a clean machine: the package is packed, installed offline from its tarball into an empty folder (no dependencies, no install script), and `npx zimakri init` and `check` pass; identity, SOUL, laws, memory and wake protocol are in place; refuses to overwrite; `--force` keeps the key; exit codes |
| A2 | The generated LAX offer passes the registry validation: `validateOutsideOffer` from the LAX registry 0.10.0 handler (vendored unchanged from Kognai's lax-registry-harness kit, `test/vendor/`), and the local check refuses what the registry refuses |
| A3 | No network call during init: sockets, DNS and fetch are blocked and logged by a preload, and the log stays empty; the source imports no network module |
| G1 to G3 | The guide covers the four topics, matches what init really writes (files, flags, wake steps, mandate), is at most 1,500 words with short sentences, no long dashes and Latin digits |

## Five Laws

The SOUL and the offer carry the Solidarity Oath, the Renewal Mandate, Treasury Equilibrium, the Harm Shield and the Transparency Covenant. The spending mandate starts at 0 USDC per day.
