@kybernesis/create 0.1.4 → 0.3.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
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { bold, capture, dim, green, parseEnv, red, yellow } from "./util.js";
4
4
  const MARK = {
@@ -91,6 +91,80 @@ 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
+ }
123
+ // ── dispatch edges (agent-to-agent — checked only when present) ────────
124
+ const subagentsDir = join(cwd, "agent/subagents");
125
+ const edgeFiles = [];
126
+ if (existsSync(subagentsDir)) {
127
+ for (const entry of readdirSync(subagentsDir)) {
128
+ const flat = join(subagentsDir, entry);
129
+ const nested = join(subagentsDir, entry, "agent.ts");
130
+ const path = entry.endsWith(".ts") ? flat : existsSync(nested) ? nested : null;
131
+ if (!path)
132
+ continue;
133
+ const src = readFileSync(path, "utf8");
134
+ if (src.includes("remotePeer") || src.includes("defineRemoteAgent"))
135
+ edgeFiles.push(path);
136
+ }
137
+ }
138
+ const eveChannelPath = join(cwd, "agent/channels/eve.ts");
139
+ const eveChannelSrc = existsSync(eveChannelPath) ? readFileSync(eveChannelPath, "utf8") : null;
140
+ const hasDispatch = Boolean(deps["@kybernesis/dispatch"]) || edgeFiles.length > 0 ||
141
+ Boolean(eveChannelSrc && (eveChannelSrc.includes("dispatchChannel") || eveChannelSrc.includes("trustedForwarders")));
142
+ if (hasDispatch) {
143
+ for (const path of edgeFiles) {
144
+ const src = readFileSync(path, "utf8");
145
+ const name = path.split("/agent/subagents/")[1];
146
+ const envVar = /envVar:\s*"([A-Z0-9_]+)"/.exec(src)?.[1] ?? /process\.env\.([A-Z0-9_]+)/.exec(src)?.[1];
147
+ if (!envVar)
148
+ add("warn", `dispatch edge ${name}: no env-var URL found`, "use remotePeer({ envVar }) so the target is repointable");
149
+ else if (env[envVar])
150
+ add("pass", `dispatch edge ${name} → $${envVar} set locally`, "confirm it's also set on the Vercel project");
151
+ else
152
+ add("warn", `dispatch edge ${name}: $${envVar} unset locally`, `printf "<peer-url>" | vercel env add ${envVar} production (and vercel env pull)`);
153
+ if (src.includes("defineRemoteAgent") && !src.includes("forwardPrincipal"))
154
+ add("warn", `dispatch edge ${name}: forwardPrincipal not set`, "peer will see this app's service identity, not the human — use remotePeer() for the safe defaults");
155
+ }
156
+ if (edgeFiles.length > 0)
157
+ add("warn", "dispatch: verify BOTH ends run compatible eve versions", "an old receiver silently drops forwardPrincipal (runs as service identity)");
158
+ if (eveChannelSrc) {
159
+ if (/trustedForwarders:\s*(\(\s*\)|\([^)]*\))\s*=>\s*true/.test(eveChannelSrc))
160
+ add("fail", "eve channel: trustedForwarders is () => true", "any authenticated caller can assert any identity — enumerate peers (dispatchChannel)");
161
+ else if (eveChannelSrc.includes("dispatchChannel") || eveChannelSrc.includes("trustedForwarders"))
162
+ add("pass", "eve channel accepts forwarded principals from enumerated peers only");
163
+ }
164
+ else if (Boolean(deps["@kybernesis/dispatch"]) && edgeFiles.length === 0) {
165
+ add("warn", "@kybernesis/dispatch installed but no edges or dispatch channel found", "see the connect-agents skill");
166
+ }
167
+ }
94
168
  // ── eve discovery + local port ─────────────────────────────────────────
95
169
  const info = capture("npx", ["eve", "info"], cwd);
96
170
  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/dist/upgrade.js CHANGED
@@ -5,6 +5,8 @@ const PACKAGES = [
5
5
  "@kybernesis/arcana",
6
6
  "@kybernesis/enterprise",
7
7
  "@kybernesis/multiplayer",
8
+ "@kybernesis/engineer",
9
+ "@kybernesis/dispatch",
8
10
  "@kybernesis/evals",
9
11
  ];
10
12
  function versionLt(a, b) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.1.4",
3
+ "version": "0.3.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": {
@@ -39,5 +40,8 @@
39
40
  },
40
41
  "engines": {
41
42
  "node": ">=20"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
42
46
  }
43
47
  }
@@ -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,88 @@
1
+ ---
2
+ description: Use when connecting two deployed eve agents so one can delegate to the other — "connect agent A to agent B", agent-to-agent communication, remote peers, cross-deployment delegation. Wires @kybernesis/dispatch edges end to end.
3
+ ---
4
+
5
+ # Connecting two eve agents (@kybernesis/dispatch)
6
+
7
+ An **edge** lets one deployed eve agent call another as if it were a local
8
+ subagent, with the human's identity carried across the hop. One edge covers a
9
+ full question-and-answer round trip (the caller parks until the peer's callback
10
+ returns). Wire the mirror-image edge only if the other agent should also be
11
+ able to *initiate*.
12
+
13
+ ## Before wiring — gather the facts
14
+
15
+ 1. **Both repos' eve versions must be compatible** (`node_modules/eve/package.json`
16
+ in each). An old receiver silently drops principal forwarding and runs as
17
+ service identity — no error. Upgrade both ends together first if they differ.
18
+ 2. **Vercel identities** of both projects: team slug + project name as shown in
19
+ `npx vercel ls <project>` (slugs, not `team_…`/`prj_…` IDs).
20
+ 3. **Stable production URL** of the callee: `npx vercel inspect <latest-prod-url>`
21
+ → Aliases → prefer the `<project>-<team>.vercel.app` form (survives redeploys).
22
+ 4. Both repos need `@kybernesis/dispatch` installed (`npm i @kybernesis/dispatch`).
23
+
24
+ ## Caller side — one file
25
+
26
+ `agent/subagents/<peer-name>.ts` (file name = tool name the model routes to):
27
+
28
+ ```ts
29
+ import { remotePeer } from "@kybernesis/dispatch";
30
+
31
+ export default remotePeer({
32
+ envVar: "GTM_AGENT_URL",
33
+ description: "…", // see below — this is the whole routing story
34
+ });
35
+ ```
36
+
37
+ **Write the description from the CALLEE's actual capabilities.** Read the peer
38
+ repo's `agent/instructions*`, subagent descriptions, and skills, then write the
39
+ concrete topics people ask about ("posting cadence, open GTM plays, outreach
40
+ targets, content drafting in the house voice") — not a generic blurb. If the
41
+ caller has local subagents with overlapping remits, differentiate explicitly or
42
+ routing will be ambiguous.
43
+
44
+ Set the env var on the caller's Vercel project:
45
+ `printf "<stable-prod-url>" | npx vercel env add GTM_AGENT_URL production`
46
+
47
+ ## Receiver side — one file
48
+
49
+ `agent/channels/eve.ts` on the callee:
50
+
51
+ ```ts
52
+ import { dispatchChannel } from "@kybernesis/dispatch";
53
+
54
+ export default dispatchChannel({
55
+ trustedPeers: [{ teamSlug: "<caller-team>", projectName: "<caller-project>" }],
56
+ });
57
+ ```
58
+
59
+ If the callee already has an authored `agent/channels/eve.ts` with app auth,
60
+ either migrate it to `dispatchChannel({ trustedPeers, extraAuth: […] })` or add
61
+ the peer by hand to BOTH the `vercelOidc({ subjects })` list and the
62
+ `trustedForwarders` predicate — they must never drift apart. Never write
63
+ `trustedForwarders: () => true`.
64
+
65
+ ## Verify
66
+
67
+ 1. `npx eve info` in both repos: 0 diagnostics; the caller's manifest gains a
68
+ `remoteAgents` entry (it does NOT appear in the local subagent count).
69
+ 2. `npm run typecheck` both.
70
+ 3. Deploy BOTH (`npx eve deploy` / git push per repo convention). The edge is
71
+ live only when both ends are.
72
+ 4. Live test from the caller's real surface (e.g. Slack): ask something only
73
+ the peer knows. Confirm delegation in the caller's reply, then check
74
+ telemetry (PostHog): the peer-side turn should carry the human's
75
+ distinct_id, plus the `eve:forwarded-by` attribute naming the caller.
76
+
77
+ ## Failure signatures
78
+
79
+ - **403 on dispatch** → receiver has no authored eve channel, or the caller
80
+ isn't in `trustedPeers`. Check team slug/project name spelling — a typo
81
+ silently rejects everything.
82
+ - **`principal_required` on the peer's user-scoped connections** → forwarding
83
+ isn't arriving: receiver predates forwarding, or the assertion was dropped.
84
+ - **Peer never gets called** → routing description too vague, or it collides
85
+ with a local subagent's remit. Rewrite from the callee's real capabilities.
86
+ - **Works locally, 401 in production** → caller's OIDC not accepted: the
87
+ receiver's `trustedPeers` names the wrong environment (default is
88
+ production-only) or wrong project.
@@ -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,106 @@
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
+ **Sandbox layout trap:** a FLAT `agent/sandbox.ts` is discovered but scopes to
89
+ the ROOT agent only — subagents silently fall back to the default backend
90
+ chain (Docker → microsandbox → just-bash), which surfaces as
91
+ `opening sandbox session "subagents/<id>" on backend "docker"` in eval logs.
92
+ Use the directory form `agent/sandbox/sandbox.ts` — that one is app-level and
93
+ subagents get it free. (Cost a debugging session on eve-gtm, 2026-08-07.)
94
+
95
+ **Parallel same-subagent delegation collides** (`Session … lost
96
+ continuationToken … to session …`, failed subagent-result actions): two
97
+ delegations to the SAME subagent fired in one step race on child sessions.
98
+ Instruct serial delegation ("one draft at a time, wait for each result").
99
+
100
+ ## Test in eve dev
101
+
102
+ `npx eve dev` boots the local runtime + chat TUI. Walk: identity → skill
103
+ routing (watch load_skill) → delegation → memory round-trip → (engineer)
104
+ screenshot turn. Local principal counts as a DM surface. Kill the dev server
105
+ before `npm run eval`. The TUI is NOT the deployed agent — redeploy after
106
+ 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).