kitelogik init
Scaffold a new governed agent project. Writes the five-file starter into the target directory and auto-compiles the YAML policy to Rego so the project runs immediately after docker compose up -d.
Synopsis
bash
kitelogik init [DIRECTORY]| Argument | Default | Meaning |
|---|---|---|
DIRECTORY | . | Target directory — created if it doesn't exist |
What it writes
| File | Contents |
|---|---|
policies/policy.yaml | Starter governance rules in YAML — the high-level edit surface |
policies/policy.rego | The same rules compiled to Rego — what OPA actually evaluates |
agent.py | Example agent with two governed tools and a 3-call ALLOW/BLOCK demo |
docker-compose.yml | One-service compose file that runs OPA on :8181 with --watch for hot-reload |
.env.example | Environment template (e.g. ANTHROPIC_API_KEY for the optional Claude loop) |
Refuses to overwrite
If policies/policy.yaml already exists in the target directory, init exits with code 1 and prints:
text
Error: <target>/policies/policy.yaml already exists.This is intentional — init won't clobber a project mid-flight. To re-scaffold, remove the existing policies/ directory or init into an empty directory.
Example
bash
$ kitelogik init my-agent
Initialized Kite Logik project in /home/me/my-agent
Created:
policies/policy.yaml — governance rules (YAML)
policies/policy.rego — compiled Rego policy
agent.py — example governed agent
docker-compose.yml — OPA policy engine
.env.example — environment template
Next steps:
cd /home/me/my-agent
docker compose up -d # start OPA policy engine
python agent.py # run governance demo
Edit policies/policy.yaml, recompile with 'kitelogik compile policies/policy.yaml',
restart OPA with 'docker compose restart', and re-run to see changes.What's in the starter policy
policies/policy.yaml from init contains a small example bundle:
- Allow read-only customer lookups for
support_agent - Allow refunds up to $200 for
support_agent - Deny refunds above $200
- Hard-deny any shell access
Edit the YAML, re-run kitelogik compile policies/policy.yaml, and OPA hot-reloads on the next request — the bundled docker-compose.yml runs OPA with --watch on the policies mount so the loop stays tight.
Related
- Quickstart — the 5-minute path through
init+python agent.py compile— re-compile after editingpolicy.yaml- Your first policy — write a custom rule from scratch