@kognai/build 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/bin/kognai-build.js +774 -0
- package/dist/bin/kognai.js +323 -0
- package/dist/lib/boot-env.js +30 -0
- package/dist/lib/cost-estimator.js +54 -0
- package/dist/lib/knowledge.js +256 -0
- package/dist/lib/mandate.js +360 -0
- package/dist/lib/memory.js +243 -0
- package/dist/lib/registry-overrides.js +40 -0
- package/dist/lib/router.js +119 -0
- package/dist/lib/skill-bank-stub.js +214 -0
- package/dist/lib/skill-bank.js +248 -0
- package/dist/lib/swarm-coder-prompt.js +39 -0
- package/dist/lib/swarm.js +89 -0
- package/dist/lib/tool-layer-stub.js +214 -0
- package/dist/lib/tool-layer.js +249 -0
- package/dist/lib/workspace.js +221 -0
- package/dist/templates/index.js +184 -0
- package/dist/templates/registry.js +82 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @kognai/build
|
|
2
|
+
|
|
3
|
+
> The Kognai sovereign orchestrator as a CLI. Submit a task or a goal; get reviewed, compliance-gated deliverables — or a rejection with reasons. Runs on the cloud or **fully local ($0)**.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @kognai/build "TypeScript email validator function"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
Every task runs a real pipeline, not a single LLM call:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
generate → code review (primary) → code review (second pass) → compliance review → ship | reject
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The third review (compliance) checks constitutional, legal, and security concerns and is **non-overridable** — a code-grade-A deliverable with a compliance FAIL is rejected. That's what distinguishes the Kognai runtime from a thin LLM wrapper.
|
|
18
|
+
|
|
19
|
+
Under the hood it routes every model call through [`@kognai/orchestrator-core`](https://www.npmjs.com/package/@kognai/orchestrator-core), so you get tiered routing, cost accounting, and an optional local ($0) backend for free.
|
|
20
|
+
|
|
21
|
+
## Install / Run
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# zero-install
|
|
25
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
26
|
+
npx @kognai/build "<task>"
|
|
27
|
+
|
|
28
|
+
# or globally — gives you `kognai` (REPL) and `kognai-build` (one-shot)
|
|
29
|
+
npm install -g @kognai/build
|
|
30
|
+
kognai
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Modes
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Task — one deliverable through the triple-supervisor
|
|
37
|
+
kognai-build "Stripe webhook handler" --out src/webhook.ts
|
|
38
|
+
|
|
39
|
+
# Goal — decompose into tasks, run each (TICKET-135 hierarchy)
|
|
40
|
+
kognai-build --goal "Express CRUD service with Postgres" --out-dir ./svc
|
|
41
|
+
|
|
42
|
+
# Sovereign — all inference local via Ollama ($0, no API key)
|
|
43
|
+
kognai-build "log shipper" --sovereign
|
|
44
|
+
|
|
45
|
+
# Swarm — delegate to the FULL orchestrator-core swarm
|
|
46
|
+
# (CEO planning · CTO governance gate · dual-supervisor · reconciliation)
|
|
47
|
+
kognai-build --swarm "auth service with JWT" --out-dir ./auth
|
|
48
|
+
|
|
49
|
+
# Mandate — sign a PACT mandate (cost envelope) before executing
|
|
50
|
+
kognai-build --mandate "research synthesis tool" --out-dir ./tool
|
|
51
|
+
|
|
52
|
+
# Optimization profile — coder + reviewers optimize for one axis
|
|
53
|
+
kognai-build --goal "payments API" --profile security
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Flags: `--out <path>` · `--out-dir <dir>` · `--sovereign` · `--swarm` · `--mandate` · `--profile <axis>` · `--no-compliance`
|
|
57
|
+
|
|
58
|
+
## Sovereign mode
|
|
59
|
+
|
|
60
|
+
`--sovereign` routes **all** inference to a local Ollama instance — coder, supervisors, and (in `--swarm`) the CEO/CTO too. No `ANTHROPIC_API_KEY` required, `$0` cost floor. Requires [Ollama](https://ollama.com) running locally with a capable model (e.g. `qwen3:14b`).
|
|
61
|
+
|
|
62
|
+
## Workspace (`.kognai/`)
|
|
63
|
+
|
|
64
|
+
Drop a `.kognai/config.yaml` in your project and the CLI binds to it: deliverables go to your configured root, runs are measured (KSL), and you can extend the registries via `.kognai/tools.json` / `.kognai/skills.json`.
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
| Env var | Default | Purpose |
|
|
69
|
+
|----------------------|----------------------|-------------------------------------------|
|
|
70
|
+
| `ANTHROPIC_API_KEY` | (required for cloud) | Claude API auth — not needed with `--sovereign` |
|
|
71
|
+
| `CLAUDE_MODEL` | `claude-sonnet-4-6` | Override the cloud coder + reviewer model |
|
|
72
|
+
|
|
73
|
+
## Compliance gate
|
|
74
|
+
|
|
75
|
+
The non-overridable third reviewer checks:
|
|
76
|
+
|
|
77
|
+
**Constitutional (the 3 Laws):** 1) Never Harm · 2) Earn Existence (no fake/deceptive functionality, fabricated metrics, hidden surveillance) · 3) Transparency to Creator (no obfuscation, embedded credentials, undisclosed telemetry).
|
|
78
|
+
|
|
79
|
+
**Legal / Regulatory:** GDPR consent gates · tax-evasion shortcuts · copyleft lift.
|
|
80
|
+
|
|
81
|
+
**Security (auto-fail):** hard-coded secrets · injection vectors · disabled TLS · eval on untrusted input.
|
|
82
|
+
|
|
83
|
+
A FAIL on any category rejects the deliverable. Override with `--no-compliance` only for trusted local prototypes — never production.
|
|
84
|
+
|
|
85
|
+
## Cost
|
|
86
|
+
|
|
87
|
+
Cloud: ~$0.01–0.05 per task (the footer prints actual spend). `--sovereign`: $0. `--swarm` runs the full leadership ceremony and costs more per goal.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|