@kybernesis/create 0.1.4 → 0.2.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/dist/cli.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * kyb init [name] scaffold a governed, remembering, multiplayer,
6
6
  * self-testing eve agent (also: npm create @kybernesis)
7
7
  * kyb doctor preflight an agent project: keys, issuer, envs, discovery
8
+ * kyb skills [--global] install/refresh the FDE Claude Code skill suite
8
9
  * kyb upgrade bump @kybernesis/* to latest, gated on the eval suite
9
10
  * --skip-eval skip the eval gate (not for production changes)
10
11
  */
@@ -12,6 +13,7 @@ import { bold, dim } from "./util.js";
12
13
  import { init } from "./init.js";
13
14
  import { doctor } from "./doctor.js";
14
15
  import { upgrade } from "./upgrade.js";
16
+ import { installSkills } from "./skills.js";
15
17
  const [, , command, ...rest] = process.argv;
16
18
  switch (command) {
17
19
  case "init":
@@ -20,6 +22,9 @@ switch (command) {
20
22
  case "doctor":
21
23
  await doctor();
22
24
  break;
25
+ case "skills":
26
+ installSkills({ global: rest.includes("--global") });
27
+ break;
23
28
  case "upgrade":
24
29
  await upgrade(rest.includes("--skip-eval"));
25
30
  break;
@@ -38,6 +43,8 @@ ${bold("kyb")} — Kybernesis agent scaffolder & FDE toolkit
38
43
  ${bold("kyb init [name]")} scaffold a full Kybernesis eve agent
39
44
  --engineer ${dim("add the engineer layer: workshop sandbox + vision dev loop")}
40
45
  ${bold("kyb doctor")} preflight checks (keys, issuer, envs, discovery)
46
+ ${bold("kyb skills")} install/refresh the FDE skill suite for Claude Code
47
+ --global ${dim("install to ~/.claude/skills instead of this repo")}
41
48
  ${bold("kyb upgrade")} bump @kybernesis/* packages, gated on evals
42
49
  --skip-eval ${dim("skip the eval gate")}
43
50
 
package/dist/doctor.js CHANGED
@@ -91,6 +91,35 @@ export async function doctor() {
91
91
  add("pass", `Slack connector uid: ${env.SLACK_CONNECTOR_UID}`, "verify trigger path /eve/v1/slack (vercel connect list)");
92
92
  else
93
93
  add("warn", "SLACK_CONNECTOR_UID not set", "vercel connect create slack --triggers");
94
+ // ── engineer layer (optional — checked only when installed) ────────────
95
+ const hasEngineer = Boolean(deps["@kybernesis/engineer"]) || existsSync(join(cwd, "agent/extensions/engineer.ts"));
96
+ if (hasEngineer) {
97
+ add("pass", `@kybernesis/engineer ${deps["@kybernesis/engineer"] ?? "(extension file present)"}`);
98
+ if (existsSync(join(cwd, "agent/sandbox/sandbox.ts")))
99
+ add("pass", "workshop sandbox file present");
100
+ else
101
+ add("fail", "agent/sandbox/sandbox.ts missing", "eve add @kybernesis/engineer --overwrite writes it");
102
+ if (env.BLOB_READ_WRITE_TOKEN)
103
+ add("pass", "file delivery configured (BLOB_READ_WRITE_TOKEN)");
104
+ else
105
+ add("warn", "BLOB_READ_WRITE_TOKEN not set — deliver tool will fail", "vercel blob create-store <name>-deliverables --access public --yes");
106
+ const vercelConn = join(cwd, "agent/connections/vercel.ts");
107
+ if (existsSync(vercelConn)) {
108
+ const src = readFileSync(vercelConn, "utf8");
109
+ const uid = /connect\(\s*"([^"]+)"/.exec(src)?.[1];
110
+ if (uid && uid.includes("/"))
111
+ add("pass", `vercel connection uses connector UID (${uid})`, "verify attached: vercel connect list");
112
+ else
113
+ add("fail", `vercel connection uses "${uid ?? "?"}" — must be the connector UID`, 'e.g. connect("mcp.vercel.com/vercel")');
114
+ }
115
+ else {
116
+ add("warn", "agent/connections/vercel.ts missing — no preview deploys/link-back", "eve add connection/vercel, then vercel connect create + attach");
117
+ }
118
+ if (env.VERCEL_OIDC_TOKEN || env.VERCEL_TOKEN)
119
+ add("pass", "Vercel credentials for local hosted sandboxes");
120
+ else
121
+ add("warn", "no VERCEL_OIDC_TOKEN — local sandbox/eval runs cannot reach Vercel Sandbox", "vercel link && vercel env pull");
122
+ }
94
123
  // ── eve discovery + local port ─────────────────────────────────────────
95
124
  const info = capture("npx", ["eve", "info"], cwd);
96
125
  if (info === null)
package/dist/init.js CHANGED
@@ -2,6 +2,7 @@ import { cpSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync
2
2
  import { join, resolve } from "node:path";
3
3
  import { DEFAULT_ISSUER, EVE_VERSION, REGISTRY_URL, ask, bold, closePrompts, green, run, slug, yellow, } from "./util.js";
4
4
  import { envExample, evalFileTs, evalScript, identityMd, rootArcanaTs, subagentAgentTs, subagentArcanaTs, subagentInstructionsMd, } from "./templates.js";
5
+ import { suiteDir } from "./skills.js";
5
6
  const ITEMS = ["enterprise", "arcana", "multiplayer", "evals"];
6
7
  // Official eve-registry limbs installed alongside the engineer layer.
7
8
  const ENGINEER_OFFICIAL_ITEMS = ["extension/agent-browser", "extension/github-tools", "connection/vercel"];
@@ -43,6 +44,13 @@ export async function init(rawName, options) {
43
44
  console.log(yellow(` ! ${item} did not install cleanly — re-run: npx eve add ${item}`));
44
45
  }
45
46
  }
47
+ console.log(bold("\n2c Seeding the FDE Claude Code skill suite (.claude/skills) …"));
48
+ try {
49
+ cpSync(suiteDir(), join(dir, ".claude/skills"), { recursive: true });
50
+ }
51
+ catch {
52
+ console.log(yellow(" ! skill suite not found — run kyb skills inside the repo later"));
53
+ }
46
54
  console.log(bold("\n3/6 Writing agent identity, memory mount, and eval wiring …"));
47
55
  mkdirSync(join(dir, "agent/instructions"), { recursive: true });
48
56
  writeFileSync(join(dir, "agent/instructions/identity.md"), identityMd(displayName, depts));
@@ -0,0 +1,15 @@
1
+ /** The skill suite shipped inside this package (skills/ beside dist/). */
2
+ export declare function suiteDir(): string;
3
+ /**
4
+ * Install/refresh the Kybernesis FDE skill suite for Claude Code.
5
+ *
6
+ * Default target: ./.claude/skills (the repo you're standing in — the suite
7
+ * then travels with the repo, including through client handover).
8
+ * --global targets ~/.claude/skills for the FDE's own machine.
9
+ *
10
+ * Existing suite skills are overwritten (that IS the update); skills outside
11
+ * the suite are never touched.
12
+ */
13
+ export declare function installSkills(opts?: {
14
+ global?: boolean;
15
+ }): void;
package/dist/skills.js ADDED
@@ -0,0 +1,40 @@
1
+ import { cpSync, existsSync, mkdirSync, readdirSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { bold, dim, green } from "./util.js";
6
+ /** The skill suite shipped inside this package (skills/ beside dist/). */
7
+ export function suiteDir() {
8
+ return join(dirname(dirname(fileURLToPath(import.meta.url))), "skills");
9
+ }
10
+ /**
11
+ * Install/refresh the Kybernesis FDE skill suite for Claude Code.
12
+ *
13
+ * Default target: ./.claude/skills (the repo you're standing in — the suite
14
+ * then travels with the repo, including through client handover).
15
+ * --global targets ~/.claude/skills for the FDE's own machine.
16
+ *
17
+ * Existing suite skills are overwritten (that IS the update); skills outside
18
+ * the suite are never touched.
19
+ */
20
+ export function installSkills(opts = {}) {
21
+ const src = suiteDir();
22
+ if (!existsSync(src)) {
23
+ console.error("skill suite not found in this install — reinstall @kybernesis/create");
24
+ process.exit(2);
25
+ }
26
+ const target = opts.global
27
+ ? join(homedir(), ".claude", "skills")
28
+ : join(process.cwd(), ".claude", "skills");
29
+ mkdirSync(target, { recursive: true });
30
+ const names = readdirSync(src).filter((n) => !n.startsWith("."));
31
+ for (const name of names) {
32
+ cpSync(join(src, name), join(target, name), { recursive: true });
33
+ }
34
+ console.log(`${green("✓")} ${bold("FDE skill suite")} → ${target}`);
35
+ for (const name of names)
36
+ console.log(` ${name}`);
37
+ console.log(dim(opts.global
38
+ ? " Available in every Claude Code session on this machine."
39
+ : " Travels with this repo — every Claude Code session here loads them."));
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "The Kybernesis agent scaffolder and FDE toolkit: one command to a governed, remembering, multiplayer, self-testing eve agent — plus doctor and upgrade.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,6 +20,7 @@
20
20
  ],
21
21
  "files": [
22
22
  "dist",
23
+ "skills",
23
24
  "NOTICE"
24
25
  ],
25
26
  "bin": {
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Use when running evals, certifying an agent or an eve version bump, debugging eval failures, or preparing a release — the Kybernesis QA discipline and its run hygiene.
3
+ ---
4
+
5
+ # Certification & eval discipline
6
+
7
+ The rule: **evals gate every deploy, and the consuming agent's suite is the
8
+ release gate for every package change.** Nothing ships on "it looks right" —
9
+ green suite or it doesn't go.
10
+
11
+ ## The suite
12
+
13
+ `kybernesisBaseline()` from `@kybernesis/evals` in `evals/kybernesis.eval.ts`:
14
+ smoke (boots, replies, identifies itself), five memory evals (no memory
15
+ thrash on greetings; explicit remember never refused; proactive storage;
16
+ brain-note two-step in order; cross-session unprompted recall), one routing
17
+ eval per department, and with `engineer: true` the vision-loop eval
18
+ (screenshot tool fires and the judge confirms the model SAW the render).
19
+ Judge model is configured in `evals/evals.config.ts` and must NEVER be the
20
+ model under test.
21
+
22
+ ## Run hygiene (each rule ate a real run)
23
+
24
+ - `npm run eval` — always through the npm script: it forces every Arcana
25
+ workspace to `<name>-eval` so evals never write into a real brain.
26
+ - **Kill any running dev server first** (`pkill -f "eve dev"`) — eve eval
27
+ attaches to an existing instance and runs stale code.
28
+ - **Never edit the repo mid-run** — the dev runtime watches `agent/`; an
29
+ edit breaks the rebuild and kills remaining evals.
30
+ - Engineer eval: hosted Vercel sandbox (no Docker), needs `vercel link` +
31
+ `vercel env pull` (VERCEL_OIDC_TOKEN). Warm template ≈3–4 min; a
32
+ pre-first-deploy cold bake is budgeted 20 min.
33
+ - Stale sandbox state (migration errors, re-baking templates):
34
+ `rm -rf .eve/sandbox-cache .eve/dev-runtime` and rerun.
35
+ - Don't pipe the eval command through `tail` in scripts — it masks the exit
36
+ code.
37
+
38
+ ## eve version certification
39
+
40
+ Clients pin the **Kybernesis-certified** eve version (`kyb upgrade` carries
41
+ them there — never blind npm-latest). Certifying a new eve: bump in a branch
42
+ → typecheck → `npx eve info` → full suite → live smoke on the deployed
43
+ surface → advance the pin in @kybernesis/create → record the certification.
44
+
45
+ ## When an eval fails
46
+
47
+ Read the eval's transcript before touching fixtures. Order of suspicion:
48
+ (1) environment (stale dev server, missing env, cold template), (2) a real
49
+ behavior regression — fix the agent, (3) only THEN the fixture — and if a
50
+ fixture changes, the reason becomes a comment on it. A failure that reveals
51
+ a new failure mode becomes a new fixture: that is how the suite grew every
52
+ guard it has.
53
+
54
+ ## Release flow (packages)
55
+
56
+ Edit in `~/platform` → build → bump → human publishes (browser auth) →
57
+ consuming agent bumps → **full suite green** → deploy → registry item update
58
+ + deploy if install files changed. Then propagate the lesson (see the
59
+ `source-of-truth` skill).
@@ -0,0 +1,54 @@
1
+ ---
2
+ description: Use when registering an agent with the Kybernesis control plane, granting/revoking user access, wiring kybernesisAuth, running the governance E2E check, or debugging 401/403s from a governed agent.
3
+ ---
4
+
5
+ # The Kybernesis control plane (agent.kybernesis.ai)
6
+
7
+ The control plane governs WHO may talk to which agent. It is an OIDC-style
8
+ issuer (per-org ES256 keys at `/api/jwks`) minting **IdentitySessions**
9
+ `{ issuer, token, bundle, jwks }`; the policy bundle carries
10
+ `agentGrants[{agent, level}]`. Agents verify OFFLINE via
11
+ `kybernesisAuth()` from `@kybernesis/enterprise` — no callback to the plane
12
+ on each request.
13
+
14
+ ## Wiring a governed agent
15
+
16
+ Env: `KYBERNESIS_ISSUER=https://agent.kybernesis.ai` and
17
+ `KYBERNESIS_AGENT=<agent-name>` (must equal the name registered in the
18
+ admin). The registry item writes the route-auth file; `kyb doctor` checks
19
+ JWKS reachability. Callers send `authorization: Bearer <token>` +
20
+ `x-kybernesis-bundle: <bundle>`. Expected failures: 401 = no/bad
21
+ credentials; 403 `agent_not_granted` = valid user, no grant for THIS agent.
22
+
23
+ ## Admin flow (browser, agent.kybernesis.ai)
24
+
25
+ Register the agent under Agents (runtime: ▲ eve + deployment URL — the row
26
+ shows a health probe). Grant users under their profile (grants resolve at
27
+ MINT time). Users page also links/revokes chat identities (Slack ↔ user).
28
+ Sign-in for humans is RFC 8628 device flow (user code, e.g. ABCD-EFGH).
29
+
30
+ ## Timing semantics (the support-ticket section)
31
+
32
+ Token TTL defaults to 1h — that IS the revocation SLA for already-minted
33
+ sessions. Suspension blocks new mints immediately; revocation of a grant
34
+ takes effect at next mint. Tune `IDENTITY_TOKEN_TTL_SECONDS` to the client's
35
+ appetite and tell them the number.
36
+
37
+ ## The governance E2E check (run before any client demo)
38
+
39
+ 1. Call the governed agent with no credentials → expect 401.
40
+ 2. Mint via device flow WITHOUT a grant → call → expect 403 agent_not_granted.
41
+ 3. Grant the user in the admin → re-mint → call → expect 200/202.
42
+ 4. Revoke the grant → old token still works until TTL; re-mint refused.
43
+ 5. Suspend the user → mint refused immediately; restore → mint works.
44
+
45
+ This exact sequence was verified against production 2026-08-05. The demo
46
+ moment for clients is step 3→4 — access appearing and disappearing from the
47
+ admin screen.
48
+
49
+ ## Boundaries to state plainly
50
+
51
+ Control-plane grants govern the HTTP/desktop doors — NOT the Slack door
52
+ (Slack access = workspace membership). Person-scoped approvals and
53
+ `governedSlackChannel()` are specced, not built. HITL approvals are
54
+ session-scoped; any thread member can click them.
@@ -0,0 +1,94 @@
1
+ ---
2
+ description: Use when building out an eve agent — adding channels (Slack, iMessage, Telegram, Discord…), connections to client systems, agent skills, model pinning, instructions, or testing in eve dev. The how-to for every eve authoring surface.
3
+ ---
4
+
5
+ # Building eve agents
6
+
7
+ **The prime rule: read the pinned docs before writing eve code.** The
8
+ installed framework docs are the source of truth for THIS project's version:
9
+ `node_modules/eve/docs/` (README.md indexes them). Never author a channel,
10
+ connection, sandbox, or schedule from memory — read its doc page first.
11
+ Fallback when docs are absent: https://eve.dev/docs.
12
+
13
+ ## The loop
14
+
15
+ `read the doc → write the file → npx eve info (0 diagnostics) → test a turn
16
+ in npx eve dev → eval`. Every authoring task follows it.
17
+
18
+ ## Model (agent/agent.ts)
19
+
20
+ `defineAgent({ model })`. No agent.ts → defaults to anthropic/claude-sonnet-5;
21
+ once the file exists, `model` is required. String = Vercel AI Gateway id
22
+ (`anthropic/claude-opus-4.8`, dot version) — the client-deploy default.
23
+ Direct provider: install `@ai-sdk/<provider>`, pass `anthropic("claude-opus-4-8")`
24
+ (hyphen version) + provider key in env. Dynamic per-principal selection via
25
+ `defineDynamic({ fallback, events })` — prefer `session.started` scope (prompt
26
+ caches are per model). Docs: `agent-config.md`.
27
+
28
+ ## Channels (agent/channels/, one file per surface)
29
+
30
+ Filename = channel id. eve normalizes every surface into one runtime — tools/
31
+ instructions/memory never change per channel. Available: Slack, Photon
32
+ (iMessage), Telegram, Discord, Teams, Twilio (SMS/voice), GitHub, Linear,
33
+ web (eve HTTP + useEveAgent), custom (`defineChannel`). Install:
34
+ `eve add channel/<name>` (e.g. `channel/photon-imessage`, `channel/telegram`).
35
+
36
+ Setup is always three steps: (1) the channel file, (2) provider-side
37
+ credentials in env — the HUMAN runs anything with a browser login, (3) point
38
+ the provider at the mounted route (`/eve/v1/<channel>`). Each channel's doc
39
+ page (`docs/channels/<name>.mdx`) has the complete recipe including webhook
40
+ registration and HITL behavior. For Kybernesis Slack deploys use
41
+ `@kybernesis/multiplayer` (group semantics) — see the `kybernesis-packages`
42
+ skill.
43
+
44
+ ## Connections (agent/connections/)
45
+
46
+ Search before writing: `eve registry list` / `search <term>` / `view <item>`
47
+ / `add <item>` (setup flows resume via `eve add <item> --skip-install`).
48
+ Hand-author only for client-internal services. Two shapes: MCP server →
49
+ `defineMcpClientConnection`; OpenAPI 3.x doc → `defineOpenAPIConnection`.
50
+ Four auth modes: static token (`auth.getToken` from env — pilot default),
51
+ Vercel Connect user-scoped (`connect("<connector-UID>")` — UID not short
52
+ name; first use posts an OAuth link in-thread, turn parks + resumes), Connect
53
+ app-scoped (`connect({connector, principalType:"app"})` — non-interactive),
54
+ or none. Connector provisioning is CLI-able:
55
+ `vercel connect create <service> --name <n>` + `vercel connect attach <uid> --yes`.
56
+ Subagents have NO user principal — static or app-scoped only. Write the
57
+ connection `description` as a capability naming the systems; decide surface
58
+ gating (fail-closed) and `approval` gates per connection at install time.
59
+ Docs: `docs/connections/*`.
60
+
61
+ ## Skills (agent/skills/)
62
+
63
+ On-demand procedures (model calls `load_skill` when the description matches).
64
+ Forms: flat `.md` (first line = routing description) → packaged dir with
65
+ `SKILL.md` (+`references/`, description frontmatter required) → `defineSkill`
66
+ (only for typed/generated content). The description is a ROUTING HINT — write
67
+ it as the triggering task ("Use when…") and test by asking without naming the
68
+ skill. Scoped per agent: subagents need their own copies (or subagent-local
69
+ extension mounts that ship them). Community marketplace: skills.sh — included
70
+ in `eve registry search`; install `eve add @skills/<owner>/<repo>/<name>`;
71
+ ALWAYS review the diff before running. Docs: `docs/skills.mdx`.
72
+
73
+ ## Instructions (agent/instructions.md or instructions/)
74
+
75
+ Always-on context: identity, tone, standing rules ONLY — procedures go in
76
+ skills. Directory entries combine alphabetically (root file first); `.ts`
77
+ entries wrap `defineInstructions` (compile-time) or `defineDynamic`
78
+ (per-session, e.g. surface-aware greetings). Draft with Claude from discovery
79
+ notes, then judge by test (eve dev turns + evals), never by reading.
80
+
81
+ ## Subagents (agent/subagents/<id>/)
82
+
83
+ Inherit NOTHING. Own tools/skills/connections/instructions/sandbox; on eve
84
+ ≥0.30 also OWN extension mounts (`subagents/<id>/extensions/` — mounts only
85
+ into that subagent). No channels/schedules; no user principal; whole job must
86
+ fit one delegation call. Docs: `docs/subagents.mdx`.
87
+
88
+ ## Test in eve dev
89
+
90
+ `npx eve dev` boots the local runtime + chat TUI. Walk: identity → skill
91
+ routing (watch load_skill) → delegation → memory round-trip → (engineer)
92
+ screenshot turn. Local principal counts as a DM surface. Kill the dev server
93
+ before `npm run eval`. The TUI is NOT the deployed agent — redeploy after
94
+ every change.
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: Use when running or planning a Kybernesis FDE client engagement — pilot phases, discovery questions, day-by-day plan, demo script, handover. The operating manual for deploying an eve agent at a client.
3
+ ---
4
+
5
+ # Kybernesis FDE engagement
6
+
7
+ Kybernesis forward-deploys engineers into companies to agentify them: we build
8
+ eve-framework agents the client reaches on surfaces they already use (Slack,
9
+ iMessage, Telegram, web…), wired to their systems, governed by our control
10
+ plane (agent.kybernesis.ai), remembering through Arcana, and quality-gated by
11
+ evals. You (Claude) are the FDE's co-builder for all of it.
12
+
13
+ The complete engagement runbook is `references/playbook.md` — READ THE PHASE
14
+ YOU ARE IN before acting. Map of the playbook:
15
+
16
+ - **Fast path**: `npm create @kybernesis <name> -- [--engineer]` scaffolds the
17
+ entire baseline (governance + memory + multiplayer Slack + evals, optional
18
+ engineer layer). `kyb doctor` checks wiring at any point.
19
+ - **Phase 1–2**: pre-engagement checklist; the discovery conversation (agent
20
+ name, departments, SURFACES — never assume Slack, §2.3 — cohort, data
21
+ sensitivities). Leave discovery with the §2.6 table filled in.
22
+ - **Phase 3**: environment setup — scaffold, `vercel link`, registry, version
23
+ pins (eve pinned to the Kybernesis-CERTIFIED version, never blind latest).
24
+ - **Phase 4**: the build — model pinning (§4.0b), our packages (§4.1–4.3b),
25
+ channels/connections/skills for the client's stack (§4.3c–e), instructions
26
+ (§4.4), `eve dev` test-drive (§4.4b), subagents (§4.5), evals (§4.8).
27
+ - **Phase 5–6**: deploy + control-plane registration and grants.
28
+ - **Phase 7–9**: pilot onboarding, the acceptance demo script, handover.
29
+ - **§10**: troubleshooting appendix — check it before debugging from scratch.
30
+ - **§11**: known gaps — state them plainly to the client, never sell around.
31
+
32
+ Non-negotiables that survive every engagement: production promotion is
33
+ human-approved; evals gate every deploy; secrets live in env (Vercel
34
+ Sensitive), never in code or memory; every live failure becomes a playbook or
35
+ skill edit the same day (see the `source-of-truth` skill).