kenso 0.1.155 → 0.1.157

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/kenso.js CHANGED
@@ -3389,7 +3389,7 @@ var VERSION;
3389
3389
  var init_version = __esm({
3390
3390
  "src/core/version.ts"() {
3391
3391
  "use strict";
3392
- VERSION = true ? "0.1.155" : "0.0.0-dev";
3392
+ VERSION = true ? "0.1.157" : "0.0.0-dev";
3393
3393
  }
3394
3394
  });
3395
3395
 
@@ -4685,19 +4685,19 @@ function ensureDir(dir3, mode) {
4685
4685
  if (stats.uid !== uid) throw notPrivateError(dir3, `another user (uid ${stats.uid}) owns it`);
4686
4686
  if ((stats.mode & 18 & ~mode) !== 0) throw notPrivateError(dir3, `its mode stayed ${modeText(stats)} after kenso set it`);
4687
4687
  }
4688
- async function checkRoot(root2) {
4688
+ async function checkRoot(root3) {
4689
4689
  let stats;
4690
4690
  try {
4691
- stats = await stat(root2);
4691
+ stats = await stat(root3);
4692
4692
  } catch {
4693
4693
  return false;
4694
4694
  }
4695
4695
  if (rootRefusal(stats) !== void 0 && stats.uid === currentUid()) {
4696
- ensurePrivateDir2(root2);
4697
- stats = await stat(root2);
4696
+ ensurePrivateDir2(root3);
4697
+ stats = await stat(root3);
4698
4698
  }
4699
4699
  const refusal3 = rootRefusal(stats);
4700
- if (refusal3) throw notPrivateError(root2, refusal3);
4700
+ if (refusal3) throw notPrivateError(root3, refusal3);
4701
4701
  return true;
4702
4702
  }
4703
4703
  function ensurePrivateDir2(dir3) {
@@ -4792,11 +4792,11 @@ async function readRunDir(dir3) {
4792
4792
  return readRun(dir3).catch(() => null);
4793
4793
  }
4794
4794
  async function listRuns(env = process.env) {
4795
- const root2 = runsRoot(env);
4796
- if (!await checkRoot(root2)) return [];
4795
+ const root3 = runsRoot(env);
4796
+ if (!await checkRoot(root3)) return [];
4797
4797
  let names;
4798
4798
  try {
4799
- names = await readdir(root2);
4799
+ names = await readdir(root3);
4800
4800
  } catch {
4801
4801
  return [];
4802
4802
  }
@@ -4805,7 +4805,7 @@ async function listRuns(env = process.env) {
4805
4805
  if (!RUN_ID_PATTERN.test(name)) continue;
4806
4806
  let dir3;
4807
4807
  try {
4808
- dir3 = await realpath(join7(root2, name));
4808
+ dir3 = await realpath(join7(root3, name));
4809
4809
  } catch {
4810
4810
  continue;
4811
4811
  }
@@ -4873,10 +4873,10 @@ import { existsSync as existsSync4 } from "node:fs";
4873
4873
  import { symlink, unlink as unlink2 } from "node:fs/promises";
4874
4874
  import { join as join8, resolve as resolve4 } from "node:path";
4875
4875
  async function prepareRunDir(outDir, runId, identical, ctx) {
4876
- const root2 = runsRoot(ctx.env);
4876
+ const root3 = runsRoot(ctx.env);
4877
4877
  if (outDir === void 0) {
4878
- const dir4 = join8(root2, runId);
4879
- ensurePrivateDir2(root2);
4878
+ const dir4 = join8(root3, runId);
4879
+ ensurePrivateDir2(root3);
4880
4880
  ensurePrivateDir2(dir4);
4881
4881
  return dir4;
4882
4882
  }
@@ -4893,10 +4893,10 @@ async function prepareRunDir(outDir, runId, identical, ctx) {
4893
4893
  await unlink2(join8(dir3, name)).catch(() => void 0);
4894
4894
  }
4895
4895
  try {
4896
- ensurePrivateDir2(root2);
4897
- await symlink(dir3, join8(root2, runId), "junction");
4896
+ ensurePrivateDir2(root3);
4897
+ await symlink(dir3, join8(root3, runId), "junction");
4898
4898
  } catch (err) {
4899
- ctx.output.warn(`Could not link ${dir3} into ${root2} (${errorText(err)}): kenso runs will not list this run.`);
4899
+ ctx.output.warn(`Could not link ${dir3} into ${root3} (${errorText(err)}): kenso runs will not list this run.`);
4900
4900
  }
4901
4901
  return dir3;
4902
4902
  }
@@ -8213,7 +8213,7 @@ var init_help_agent = __esm({
8213
8213
  "src/commands/help-agent.ts"() {
8214
8214
  "use strict";
8215
8215
  init_session();
8216
- AGENT_SKILL_POINTER = "Agents: load the kenso-cli skill first: kenso skill install";
8216
+ AGENT_SKILL_POINTER = "Agents: load the kenso skill first: kenso skill show kenso";
8217
8217
  AGENT_RULES_LINE = "Agent rules: kenso --help --verbose (dry-run first, one command per file, next is the next command).";
8218
8218
  FOR_AGENTS = [
8219
8219
  "For agents:",
@@ -9733,7 +9733,7 @@ var init_client = __esm({
9733
9733
  var agents_default;
9734
9734
  var init_agents = __esm({
9735
9735
  "docs/agents.md"() {
9736
- agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: on macOS or Linux, the [install script](https://ken.so/install.sh) piped to `sh` needs no Node; anywhere, `npm i -g kenso` needs Node 22 or newer. Without a global install, `npx -y kenso@latest <command>` runs any command.\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\nkenso auth login\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill and connect the Kenso MCP server in one step, then check everything:\n\n```bash\nkenso agent setup\nkenso agent setup -y\nkenso doctor\n```\n\nTo hand the whole setup to an agent, give it [ken.so/get-started.md](https://ken.so/get-started.md): it runs these steps and stops only where a person has to act.\n\n## kenso agent setup\n\n`kenso agent setup` installs the `kenso-cli` skill (as `kenso skill install` does) and registers the Kenso MCP server, `https://mcp.ken.so/mcp`, with each coding agent:\n\n| Agent | `--client` | MCP server added with |\n|---|---|---|\n| Claude Code | `claude-code` | `claude mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| Codex | `codex` | `codex mcp add kenso --url https://mcp.ken.so/mcp` |\n| Cursor | `cursor` | a `kenso` entry in `~/.cursor/mcp.json` |\n| Gemini CLI | `gemini` | `gemini mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| OpenCode | `opencode` | a `kenso` entry in `~/.config/opencode/opencode.json` |\n\n```bash\nkenso agent setup --client claude-code -y\nkenso agent setup --client all -y\nkenso agent setup --status --json\n```\n\n- Without `--client`, it sets up the agent that runs it, else every agent found on the machine (its command on `PATH` or its config folder present).\n- Without `-y` it prints the plan and changes nothing; the plan\'s `next` applies it. `--status` reports, for every agent, the state of each bundled skill (`missing`, `current`, `stale` from an older kenso, or `edited` by hand) and whether the MCP server is `registered`, `missing`, in `conflict` or `unknown` (a config file it cannot read as JSON), and changes nothing. `--json` prints JSON on a terminal too.\n- An MCP entry with the Kenso URL under another name (such as `ken-ai` from the plugin) counts as registered, and nothing is added. A `kenso` entry pointing at another URL is left alone (`conflict`). A config file that is not plain JSON (it has comments) is left alone (`skipped`), and so is an agent whose command is not on `PATH`: their `next` is the command or edit to make by hand.\n- A missing `SKILL.md` and one an older kenso wrote are written. One edited by hand is left alone (`"status":"edited"`, with a stderr line naming `--force`) while the rest of the setup runs; `--force` replaces it. After a successful run, four requests to start with follow on stderr.\n- It exits 1 when any agent was not fully set up. The MCP server signs in with your Kenso account in the browser the first time the agent uses it; each agent\'s `next` says how (in Claude Code, `/mcp`).\n\n## An AGENTS.md section for your repo\n\nPaste this into the `AGENTS.md` (or `CLAUDE.md`) of a repo whose agents work in Kenso:\n\n```markdown\n## Kenso\n\n- Kenso is our outbound platform. One record or a question: use the Kenso MCP server (https://mcp.ken.so/mcp). A file or more than about 50 records: use the `kenso` CLI.\n- Setup: `npm i -g kenso`, `kenso auth login` (a person approves in the browser), `kenso agent setup -y`, `kenso doctor`.\n- Every write runs first with `--dry-run`; apply with the plan\'s `next`. Never put an API key in a flag, a file or the chat: use `KENSO_API_KEY`.\n- Code that calls the API: send `Authorization: Bearer $KENSO_API_KEY`, `Ken-Version` and `X-Ken-Workspace-Id`. Reference: ken.so/docs.md; the kenso-api skill is listed at ken.so/.well-known/skills/index.json.\n```\n\n## The Agent Skill\n\n`kenso skill install` writes each skill bundled with this CLI (one `SKILL.md` in a folder named like the skill) where each agent looks for skills:\n\n| Agent | `--client` | Folder |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso-cli/` |\n| Gemini CLI | `gemini` | `~/.gemini/skills/kenso-cli/` |\n| OpenCode | `opencode` | `~/.config/opencode/skills/kenso-cli/` |\n\nClaude Code\'s folder follows `CLAUDE_CONFIG_DIR` when that is set. Without `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all five. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--skill <name>` installs one bundled skill. `--dir` writes one skill into that folder instead (`--skill`, else `kenso-cli`), for example a project\'s own skills folder. Name the folder like the skill, as agents expect.\n- A missing file is written (`"status":"created"`) and one an older kenso wrote is replaced (`"status":"updated"`); the same file is left as it is (`"status":"unchanged"`). A `SKILL.md` edited by hand is left alone (`"status":"edited"`) with a stderr line that names `--force`, and the command still exits 0. `--force` replaces it (`"status":"replaced"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status and a `next` that applies it.\n- Under a detected agent, when a bundled skill in that agent\'s folder is from an older kenso, a command ends with one stderr line, once per agent session: `The installed kenso-cli skill is from an older kenso: kenso skill install`. It reads the files only. `KENSO_NO_SKILL_NOTICE=1` turns it off.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/` (Gemini CLI and OpenCode read `~/.agents/skills/` too), so after a default install for all of them an agent may list `kenso-cli` more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nThe skill also ships in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs it along with the MCP skills. The plugin\'s copy is this file byte for byte. To read it without installing, open `skill/kenso-cli/SKILL.md` in the package.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`). A command with no dry run refuses `--dry-run` with `usage_error` and does nothing.\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n\n## What a command does and what it costs\n\nEvery command declares its effect. Help and `kenso describe` print it, so an agent can tell a look from a change before it runs anything:\n\n| Effect | Meaning |\n|---|---|\n| `read` | Changes nothing and charges nothing |\n| `write` | Creates or changes workspace data. Charges nothing the API contract declares. Nothing leaves Kenso |\n| `spend` | Can charge credits under at least one of its flags |\n| `send` | Sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending |\n| `destructive` | Deletes, archives, removes or merges |\n\nA `write` is not proof that a command is free: the API contract does not mark every route that charges. The dry run\'s `credits` and estimate are the authority on what a command costs.\n\n- Command help prints `Effect: <effect>.` under the summary. A command that charges adds a `Cost:` line in credits, priced from your workspace\'s rate card; signed out or offline it shows both rate cards, labelled `rate card v1` and `rate card v2`. Work your plan bills another way reads `not charged in credits`. No price is typed into the CLI: it comes from the rate card or a dry run\'s estimate.\n- A command that spends, sends or deletes, and each command an agent starts with (`kenso doctor`, `kenso describe`, `kenso docs`, `kenso agent setup`, `kenso skill install`, `kenso auth login`), also prints `When:` (when to pick it) and `Next:` (what to run after it) under its description.\n- A command that only reads says `Read-only.` under its global flags line.\n- `kenso describe <resource> <action>` has the same `effect` and `cost` as JSON.\n- `kenso api`, `kenso mcp call` and `kenso runs resume` read `destructive`, because one call of theirs can do anything. Read-only mode judges each call on its own.\n\n```bash\nkenso describe email-finds create\nkenso email-finds create --help\n```\n\n### Read-only mode\n\nSet `KENSO_READ_ONLY=1`, or pass `--read-only`, while an agent looks into something: every command whose effect is not `read` is refused before it sends a request, with exit 2 and the code `read_only` (see [Output and errors](output-and-errors.md)). A POST that only reads still runs, and a GET that charges is refused. A dry run still prints its plan; the dry run of `bulk-update` and `bulk-delete` asks Kenso for a preview, which Kenso stores. `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs. `kenso mcp call` runs `list_skills` and `load_skill` only.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n| `KENSO_READ_ONLY` | Set to `1` to refuse every command that is not a read, as `--read-only` does. Any value except empty, `0` or `false` turns it on |\n| `KENSO_AGENT_SESSION` | The agent session id: the full agent help, the update notice and the stale-skill notice each print once per session |\n| `KENSO_NO_UPDATE_NOTIFIER` | Set to `1` to turn off the "a newer kenso is out" line on stderr. A person at a terminal gets it after the weekly check; under a detected agent it comes from the last check, once per agent session, with no request. Never in CI |\n| `KENSO_NO_SKILL_NOTICE` | Set to `1` to turn off the line that says an installed skill is from an older kenso |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable, that the key works, and that the skills and the Kenso MCP server are set up for the agent. It exits 0 when the first four checks pass (the skill and MCP checks never change the exit code), and its `next` names the command to run.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help starts with `Agents: load the kenso-cli skill first: kenso skill install`;\n- the first help an agent reads in a session ends with the "For agents" block. After that the block is one line, `Agent rules: kenso --help --verbose (dry-run first, one command per file, next is the next command).`, and `kenso --help --verbose` always prints it in full;\n- browser login never opens a browser itself: it prints the link for you to open.\n\nA session is `KENSO_AGENT_SESSION` when that is set, else `CODEX_THREAD_ID`, else `CLAUDE_CODE_SESSION_ID`, else the agent\'s name and the current two-hour block of the day (UTC), so an agent that sets none of them reads the whole block again every two hours. The CLI keeps what it has shown in `session-seen.json` in the config folder (mode 0600) and forgets an entry after 7 days.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts_read --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
9736
+ agents_default = '# Coding agents\n\nThe CLI is built to be driven by a coding agent: Claude Code, Codex, Cursor, Gemini CLI or anything else that runs shell commands. An agent learns it from the Agent Skill, `kenso --help` and `kenso describe`, and never needs these web pages.\n\n## Set up an agent in three steps\n\n1. Install the CLI where the agent runs: on macOS or Linux, the [install script](https://ken.so/install.sh) piped to `sh` needs no Node; anywhere, `npm i -g kenso` needs Node 22 or newer. Without a global install, `npx -y kenso@latest <command>` runs any command.\n2. Give it a key. Either set `KENSO_API_KEY` (and `KENSO_WORKSPACE_ID` when the key reaches several workspaces) in the agent\'s environment, or log in once on that machine:\n\n```bash\nkenso auth login\nkenso workspace use 1234\n```\n\n3. Install the Agent Skill and connect the Kenso MCP server in one step, then check everything:\n\n```bash\nkenso agent setup\nkenso agent setup -y\nkenso doctor\n```\n\nTo hand the whole setup to an agent, give it [ken.so/get-started.md](https://ken.so/get-started.md): it runs these steps and stops only where a person has to act.\n\n## kenso agent setup\n\n`kenso agent setup` installs the `kenso` and `kenso-cli` skills (as `kenso skill install` does) and registers the Kenso MCP server, `https://mcp.ken.so/mcp`, with each coding agent:\n\n| Agent | `--client` | MCP server added with |\n|---|---|---|\n| Claude Code | `claude-code` | `claude mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| Codex | `codex` | `codex mcp add kenso --url https://mcp.ken.so/mcp` |\n| Cursor | `cursor` | a `kenso` entry in `~/.cursor/mcp.json` |\n| Gemini CLI | `gemini` | `gemini mcp add --scope user --transport http kenso https://mcp.ken.so/mcp` |\n| OpenCode | `opencode` | a `kenso` entry in `~/.config/opencode/opencode.json` |\n\n```bash\nkenso agent setup --client claude-code -y\nkenso agent setup --client all -y\nkenso agent setup --status --json\n```\n\n- Without `--client`, it sets up the agent that runs it, else every agent found on the machine (its command on `PATH` or its config folder present).\n- Without `-y` it prints the plan and changes nothing; the plan\'s `next` applies it. `--status` reports, for every agent, the state of each bundled skill (`missing`, `current`, `stale` from an older kenso, or `edited` by hand) and whether the MCP server is `registered`, `missing`, in `conflict` or `unknown` (a config file it cannot read as JSON), and changes nothing. `--json` prints JSON on a terminal too.\n- An MCP entry with the Kenso URL under another name (such as `ken-ai` from the plugin) counts as registered, and nothing is added. A `kenso` entry pointing at another URL is left alone (`conflict`). A config file that is not plain JSON (it has comments) is left alone (`skipped`), and so is an agent whose command is not on `PATH`: their `next` is the command or edit to make by hand.\n- A missing `SKILL.md` and one an older kenso wrote are written. One edited by hand is left alone (`"status":"edited"`, with a stderr line naming `--force`) while the rest of the setup runs; `--force` replaces it. After a successful run, four requests to start with follow on stderr.\n- It exits 1 when any agent was not fully set up. The MCP server signs in with your Kenso account in the browser the first time the agent uses it; each agent\'s `next` says how (in Claude Code, `/mcp`).\n\n## An AGENTS.md section for your repo\n\nPaste this into the `AGENTS.md` (or `CLAUDE.md`) of a repo whose agents work in Kenso:\n\n```markdown\n## Kenso\n\n- Kenso is our outbound platform. One record or a question: use the Kenso MCP server (https://mcp.ken.so/mcp). A file or more than about 50 records: use the `kenso` CLI.\n- Setup: `npm i -g kenso`, `kenso auth login` (a person approves in the browser), `kenso agent setup -y`, `kenso doctor`.\n- Every write runs first with `--dry-run`; apply with the plan\'s `next`. Never put an API key in a flag, a file or the chat: use `KENSO_API_KEY`.\n- Code that calls the API: send `Authorization: Bearer $KENSO_API_KEY`, `Ken-Version` and `X-Ken-Workspace-Id`. Reference: ken.so/docs.md; the kenso-api skill is listed at ken.so/.well-known/skills/index.json.\n```\n\n## The Agent Skills\n\n`kenso skill install` writes the two skills bundled with this CLI, each one `SKILL.md` in a folder named like the skill, where each agent looks for skills:\n\n- `kenso`, the entry skill: it sends the agent to the Kenso skill for the job and sets the rules for the workspace, credits, sends and the final reply. Agents load it first; every help under an agent starts with `Agents: load the kenso skill first: kenso skill show kenso`.\n- `kenso-cli`: the CLI\'s commands for work from a file or over about 50 records.\n\n| Agent | `--client` | Folders |\n|---|---|---|\n| Claude Code | `claude-code` | `~/.claude/skills/kenso/`, `~/.claude/skills/kenso-cli/` |\n| Codex | `codex` | `~/.agents/skills/kenso/`, `~/.agents/skills/kenso-cli/` |\n| Cursor | `cursor` | `~/.cursor/skills/kenso/`, `~/.cursor/skills/kenso-cli/` |\n| Gemini CLI | `gemini` | `~/.gemini/skills/kenso/`, `~/.gemini/skills/kenso-cli/` |\n| OpenCode | `opencode` | `~/.config/opencode/skills/kenso/`, `~/.config/opencode/skills/kenso-cli/` |\n\nClaude Code\'s folders follow `CLAUDE_CONFIG_DIR` when that is set. Without `--client`, it installs for the agent that runs it when that is Claude Code, Codex or Cursor (detected from the environment, see below), else for all five. It prints what it wrote:\n\n```json\n{"installed":[{"client":"claude-code","path":"/home/you/.claude/skills/kenso-cli/SKILL.md","status":"created"},{"client":"claude-code","path":"/home/you/.claude/skills/kenso/SKILL.md","status":"created"}]}\n```\n\n```bash\nkenso skill install --client claude-code\nkenso skill install --client all\nkenso skill install --skill kenso\nkenso skill install --dir .claude/skills/kenso-cli\nkenso skill install --force\n```\n\n- `--skill <name>` installs one of the two. `--dir` writes one skill into that folder instead (`--skill`, else `kenso-cli`), for example a project\'s own skills folder. Name the folder like the skill, as agents expect.\n- A missing file is written (`"status":"created"`) and one an older kenso wrote is replaced (`"status":"updated"`); the same file is left as it is (`"status":"unchanged"`). A `SKILL.md` edited by hand is left alone (`"status":"edited"`) with a stderr line that names `--force`, and the command still exits 0. `--force` replaces it (`"status":"replaced"`).\n- `--dry-run` writes nothing and exits 0. It prints each target\'s status and a `next` that applies it.\n- Under a detected agent, when a bundled skill in that agent\'s folder is from an older kenso, a command ends with one stderr line, once per agent session: `The installed <name> skill is from an older kenso: kenso skill install`. It reads the files only, and nothing is replaced until you run `kenso skill install` or `kenso agent setup`. `KENSO_NO_SKILL_NOTICE=1` turns it off.\n- Cursor also reads `~/.claude/skills/` and `~/.agents/skills/` (Gemini CLI and OpenCode read `~/.agents/skills/` too), so after a default install for all of them an agent may list each Kenso skill more than once. To avoid that, install with `--client cursor` only, or remove the copies you do not need.\n\nBoth skills also ship in the Kenso plugin for Claude Code (`Ken-Technology/ken-ai-plugin`), so `npx skills add Ken-Technology/ken-ai-plugin` installs them along with the MCP skills; the plugin\'s copies are these files byte for byte. The other Kenso skills come from the MCP: list them, and read any of them without installing it:\n\n```bash\nkenso skill list\nkenso skill show kenso\nkenso skill show workflows --reference files.md\n```\n\n`kenso skill show` prints `kenso` and `kenso-cli` from the CLI itself, with no network and no sign-in. Any other skill is read from the Kenso MCP with your key.\n\n## Rules the skill teaches\n\n- **Data is on stdout, as JSON when piped.** Progress, warnings and errors are on stderr. Parse stdout; read stderr when the exit code is not 0.\n- **Plan, then apply.** Run a write with `--dry-run`, read the plan, then run the exact command in its `next` (the same command with `--yes`). A command with no dry run refuses `--dry-run` with `usage_error` and does nothing.\n- **Pass files, not rows.** Never paste a CSV into the conversation. Write the file, pass its path with `--file`, and read the summary.\n- **Read failures only.** If the summary\'s `failed`, `notFound` and `invalid` are 0, the work is done. Otherwise read just the problem rows from `results.csv` or `invalid.csv`.\n- **Follow `next`.** Every error with a known fix carries the exact command to run.\n- **Branch on the exit code:** 0 ok, 2 fix the command, 3 fix the key, 5 some rows failed, 6 wait or raise a limit, 130 resume.\n- **Look things up, do not guess.** `kenso describe <resource> <action>` prints any command\'s flags and body schema as JSON.\n- **Find, then look up.** `kenso discover` turns a plain request into the command, doc, skill or workflow step for it, offline, with the next command to run.\n- **See the cost first.** Every dry run of paid work prints `credits` with `needed`, `available` and `sufficient`. `kenso credits` reads the balance, usage and prices.\n\n## What a command does and what it costs\n\nEvery command declares its effect. Help and `kenso describe` print it, so an agent can tell a look from a change before it runs anything:\n\n| Effect | Meaning |\n|---|---|\n| `read` | Changes nothing and charges nothing |\n| `write` | Creates or changes workspace data. Charges nothing the API contract declares. Nothing leaves Kenso |\n| `spend` | Can charge credits under at least one of its flags |\n| `send` | Sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending |\n| `destructive` | Deletes, archives, removes or merges |\n\nA `write` is not proof that a command is free: the API contract does not mark every route that charges. The dry run\'s `credits` and estimate are the authority on what a command costs.\n\n- Command help prints `Effect: <effect>.` under the summary. A command that charges adds a `Cost:` line in credits, priced from your workspace\'s rate card; signed out or offline it shows both rate cards, labelled `rate card v1` and `rate card v2`. Work your plan bills another way reads `not charged in credits`. No price is typed into the CLI: it comes from the rate card or a dry run\'s estimate.\n- A command that spends, sends or deletes, and each command an agent starts with (`kenso doctor`, `kenso describe`, `kenso docs`, `kenso agent setup`, `kenso skill install`, `kenso auth login`), also prints `When:` (when to pick it) and `Next:` (what to run after it) under its description.\n- A command that only reads says `Read-only.` under its global flags line.\n- `kenso describe <resource> <action>` has the same `effect` and `cost` as JSON.\n- `kenso api`, `kenso mcp call` and `kenso runs resume` read `destructive`, because one call of theirs can do anything. Read-only mode judges each call on its own.\n\n```bash\nkenso describe email-finds create\nkenso email-finds create --help\n```\n\n### Read-only mode\n\nSet `KENSO_READ_ONLY=1`, or pass `--read-only`, while an agent looks into something: every command whose effect is not `read` is refused before it sends a request, with exit 2 and the code `read_only` (see [Output and errors](output-and-errors.md)). A POST that only reads still runs, and a GET that charges is refused. A dry run still prints its plan; the dry run of `bulk-update` and `bulk-delete` asks Kenso for a preview, which Kenso stores. `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs. `kenso mcp call` runs `list_skills` and `load_skill` only.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## Find a command: kenso discover\n\n`kenso discover` searches every command, doc topic, skill and workflow step type this release has, with no network and no key. Each argument is one query: plain words, or `"<what you have> -> <what you need>"`.\n\n```bash\nkenso discover "linkedin url -> email"\nkenso discover "pause a campaign" "export leads" --kind command --limit 3\nkenso describe email-finds create\n```\n\nIt prints one object per query, `{"query", "hits", "more"}` (NDJSON when piped). Each hit has its `kind`, `id`, `summary`, `effect` (`read`, `write`, `spend`, `send` or `destructive`), `cost` (in credits, from your saved or the bundled rate card, or `null`) and `describe`, the exact command to run next. `--limit` is 5 by default and at most 10. A query with no hit prints an empty `hits` and exits 0. The index is built when the CLI is released, so a skill added since then shows up in the next release.\n\n## Credits\n\nPrices are in credits only, from your workspace\'s own rate card. A skill or a doc never states a price: ask the CLI.\n\n```bash\nkenso credits balance\nkenso credits rate-card --action email_found\nkenso credits quote --kind leads --count 200\nkenso credits usage --since 7d\nkenso credits usage --run <runId>\n```\n\n- `balance`: credits `available`, and where they come from.\n- `rate-card`: what each action costs on your card. Offline it prints the card saved in the last day, else the two bundled cards, labelled.\n- `quote`: an estimate before you run anything, as `credits` with `needed`, `available` and `sufficient`. `--kind` is `campaign`, `build`, `infra`, `accounts`, `leads` or `places`; `--workflow <id or file> --records <n>` prices a workflow run.\n- `usage`: the ledger, filtered by `--run`, `--workflow`, `--campaign`, `--action`, `--since` and `--until`, with the total on stderr. With no filter, this billing month\'s spend by category.\n- `limit` (beta) shows the workflow spend limits, and `savings` the work Kenso did without taking credits.\n\n## The token-saving pattern\n\nAdding 5,000 leads through the MCP sends every lead through the model, hundreds of thousands of tokens. Through the CLI it is two commands and two short JSON objects:\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\nThen, only if the summary shows failures:\n\n```bash\ngrep -E \'^[0-9]+,(failed|not_found|invalid),\' ~/.kenso/runs/r_tdi5cdnx/results.csv | head -50\n```\n\n## Environment variables\n\n| Variable | What it does |\n|---|---|\n| `KENSO_API_KEY` | The API key. Wins over any saved profile |\n| `KENSO_WORKSPACE_ID` | The workspace for every command. `--workspace` wins over it |\n| `KENSO_PROFILE` | The saved profile to use. `--profile` wins over it |\n| `KENSO_API_URL` | The API, default `https://api.ken.so` |\n| `KENSO_CONFIG_DIR` | Where the config file and cache live, default `~/.kenso` |\n| `KENSO_RUNS_DIR` | Where run folders live, default `<config dir>/runs` |\n| `KENSO_MCP_URL` | The MCP for `kenso mcp`, default `https://mcp.ken.so/mcp` |\n| `KENSO_READ_ONLY` | Set to `1` to refuse every command that is not a read, as `--read-only` does. Any value except empty, `0` or `false` turns it on |\n| `KENSO_AGENT_SESSION` | The agent session id: the full agent help, the update notice and the stale-skill notice each print once per session |\n| `KENSO_NO_UPDATE_NOTIFIER` | Set to `1` to turn off the "a newer kenso is out" line on stderr. A person at a terminal gets it after the weekly check; under a detected agent it comes from the last check, once per agent session, with no request. Never in CI |\n| `KENSO_NO_SKILL_NOTICE` | Set to `1` to turn off the line that says an installed skill is from an older kenso |\n\n## Cloud sandboxes\n\nCloud agents (Claude Code on the web, Codex cloud, Cursor background agents and similar) often run with a network allowlist. Allow:\n\n- `api.ken.so`: every command\n- `mcp.ken.so`: only `kenso mcp tools` and `kenso mcp call`\n- `registry.npmjs.org`: to install the CLI with npm\n\nStore the key as the platform\'s secret and expose it as `KENSO_API_KEY`. Run `kenso doctor` as the first command: it checks Node, the config, that the API is reachable, that the key works, and that the skills and the Kenso MCP server are set up for the agent. It exits 0 when the first four checks pass (the skill and MCP checks never change the exit code), and its `next` names the command to run.\n\n```bash\nkenso doctor\n```\n\nPoint the run folders at the workspace if the home folder does not persist between sessions: `KENSO_RUNS_DIR=./.kenso-runs`. Keep that folder out of git.\n\n## How Kenso knows an agent ran a command\n\nThe CLI checks these environment variables, in this order: `CLAUDECODE` and `CLAUDE_CODE_ENTRYPOINT` (Claude Code), `CODEX_SANDBOX` and `CODEX_THREAD_ID` (Codex), `CURSOR_AGENT` (Cursor), `GEMINI_CLI` (Gemini CLI), `OPENCODE` (OpenCode), then `AI_AGENT`, a free-form name any other agent can set. When one is set:\n\n- every request carries `X-Ken-Client: Kenso CLI via <agent>`, and writes carry `X-Ken-Actor: agent`, so Kenso shows the change as made by you through that agent;\n- help starts with `Agents: load the kenso skill first: kenso skill show kenso`;\n- the first help an agent reads in a session ends with the "For agents" block. After that the block is one line, `Agent rules: kenso --help --verbose (dry-run first, one command per file, next is the next command).`, and `kenso --help --verbose` always prints it in full;\n- browser login never opens a browser itself: it prints the link for you to open.\n\nA session is `KENSO_AGENT_SESSION` when that is set, else `CODEX_THREAD_ID`, else `CLAUDE_CODE_SESSION_ID`, else the agent\'s name and the current two-hour block of the day (UTC), so an agent that sets none of them reads the whole block again every two hours. The CLI keeps what it has shown in `session-seen.json` in the config folder (mode 0600) and forgets an entry after 7 days.\n\n`kenso doctor` shows the agent it detected.\n\n## MCP-only tools\n\nA few Kenso MCP tools have no API route, such as the skills Kenso\'s own agents use. Reach them from the shell with the same key:\n\n```bash\nkenso mcp tools\nkenso mcp call list_skills\nkenso mcp call load_skill --args \'{"name":"create-campaign"}\'\nkenso mcp call contacts_read --operation list --args \'{"limit":5}\'\n```\n\n`mcp call` prints the tool\'s structured result, else its text parsed as JSON, else the text. A tool error exits 1 with `mcp_tool_error`.\n';
9737
9737
  }
9738
9738
  });
9739
9739
 
@@ -9781,7 +9781,7 @@ var init_leads = __esm({
9781
9781
  var output_and_errors_default;
9782
9782
  var init_output_and_errors = __esm({
9783
9783
  "docs/output-and-errors.md"() {
9784
- output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives, removes or merges, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive`, `kenso people merge` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create`, `kenso notes add` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it. A command that reads before it writes (`kenso layouts set --header` reads the layout it edits) still reads with `--dry-run`, and prints the write it would send. A POST that changes nothing, such as `kenso accounts search` or `kenso reports query`, is a read like a GET.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, or with `Read-only.` when the command only reads, and `kenso describe <resource> <action>` shows `"dryRun": false`. Every command that only reads, generated ones included, says `Read-only.` there.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204, such as a delete) | key-value lines: `ok`, `status`, `request` | `{"ok":true,"status":204,"request":{"method":"DELETE","path":"/v1/tasks/7"}}` |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table` or `ids`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n- A thread list\'s `preview` is a one-line preview by default: the first 280 characters of the newest message\'s text (the API\'s `bodyFormat=snippet`), in every format. `--full`, or `--fields` that names `preview` or `htmlBody`, prints the whole message text, and `kenso threads list-messages --thread-id <id>` reads every message of a thread whole.\n- A contact list asks the API for only the fields it prints (the API\'s `fields`), so a page downloads what it shows. A thread list printed with `-o ids`, or with `--fields` that names neither `preview` nor `htmlBody`, asks for no message bodies (`bodyFormat=none`). `--full` and `--query` ask for every field, and `--param-fields` or `--body-format` sent by hand wins.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --fields id,subject,preview\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `read_only` | 2 | `--read-only` or `KENSO_READ_ONLY` is on and the command is not a read: nothing was sent. `next` (with `--read-only` only, on a command with a dry run) is the same command with `--dry-run`, which prints the plan and changes nothing |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that is not a file of the Studio bundle layout (such as a dotfile, `opencode.json` or `CLAUDE.md`), would land outside `--dir`, or passes through a symbolic link, or a `samples/*.json` that does not hold a sample |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Effect, cost and read-only mode\n\nEvery command has an effect: `read` (changes nothing, charges nothing), `write` (changes workspace data, charges nothing the API contract declares, nothing leaves Kenso), `spend` (can charge credits), `send` (sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending) or `destructive` (deletes, archives, removes or merges). Command help prints `Effect: <effect>.` under the summary, and a command that charges adds a `Cost:` line in credits from your workspace\'s rate card.\n\n`kenso describe <resource> <action>` adds `effect` and `cost` to its JSON. `cost` is `null` for a command that does not charge, else `{"lines": [...], "rateCard": {"source": ..., "versions": [...]}}`: each line is the command\'s credit line with its `price` text, and `source` is `live`, `cache` or `bundled`. A command that charges something no rate-card row prices has `{"lines": [], "rateCard": null}`, with `text` saying what it charges when the command states it. `kenso describe` and `kenso describe <resource>` add `effect` to each row.\n\nA generated command that charges prints the same `cost` in its `--dry-run` plan, for the request it would send. A flag that turns off every charge says so: `kenso accounts create --skip-research --dry-run` prints `"cost": {"lines": [], "text": "not charged in credits (--skip-research: no research or committee run)", "rateCard": null}` and `"credits": {"needed": 0, "available": null, "sufficient": null}`, and reads nothing.\n\n`--read-only`, or `KENSO_READ_ONLY=1` in the environment, refuses every command whose effect is not `read` before it sends a request, with exit 2:\n\n```json\n{"error":{"code":"read_only","message":"kenso campaigns launch is a send command, and this session is read-only.","hint":"Read-only is on through --read-only: next prints the plan. Run the command again without --read-only to make the change.","next":"kenso --read-only campaigns launch --campaign-id 1 --dry-run"}}\n```\n\n`next` never makes the change: on a command with a dry run it is the same command with `--dry-run` and without `--yes`, which prints the plan. A command with no dry run gets no `next`, and its hint says to run it again without `--read-only`. A command with its own `--body-read-only` option (`kenso api-keys create`) gets no `next` either, and its hint names that option. When the variable turned read-only on, the hint reads `KENSO_READ_ONLY is set: unset it to run this command.` and there is no `next`, so an agent that runs `next` cannot loop. A POST that only reads, such as `kenso contacts search`, still runs; a GET that charges, such as `kenso search get-place`, is refused; a command with a dry run still prints its plan with `--dry-run`; `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
9784
+ output_and_errors_default = '# Output and errors\n\nEvery command follows one contract, so a script or an agent can parse any of them the same way.\n\n## stdout and stderr\n\n- **stdout carries data only.** Progress, warnings, notices and errors go to stderr.\n- No colors, spinners or pagers. On a terminal you get readable tables; in a pipe you get JSON.\n- A batch command (an import, update, remove, tag or `--each` write) takes `--yes`; without it, the command plans or refuses.\n- A command that deletes, archives, removes or merges, such as `kenso tags delete --tag-id 7`, `kenso campaigns archive`, `kenso people merge` or `kenso api DELETE /v1/tags/7`, needs `--yes` too. Without it, a person at a terminal is asked to confirm; anywhere else (a pipe, a script, CI, a coding agent) it sends nothing and fails with `confirmation_required`, whose `next` is the same command with `--yes`.\n- Any other single write, such as `kenso tags create`, `kenso notes add` or a write through `kenso api` or `kenso mcp call`, sends at once: add `--dry-run` to print the request first (it sends nothing), then run the command without it. A command that reads before it writes (`kenso layouts set --header` reads the layout it edits) still reads with `--dry-run`, and prints the write it would send. A POST that changes nothing, such as `kenso accounts search` or `kenso reports query`, is a read like a GET.\n- A command with no dry run, such as `kenso contacts export`, `kenso auth logout` or `kenso workspace use`, refuses `--dry-run` with `usage_error` (exit 2) and does nothing. Its help ends with `No --dry-run`, or with `Read-only.` when the command only reads, and `kenso describe <resource> <action>` shows `"dryRun": false`. Every command that only reads, generated ones included, says `Read-only.` there.\n- A dry run of a command that can charge credits adds `credits`: `{"needed": n, "available": n, "sufficient": true}`, in credits. A batch command prices the whole file; a single API command adds `cost`, its price lines from your rate card. No output shows a currency amount.\n\n## Formats\n\n| What the command returns | stdout is a terminal | stdout is a pipe or file |\n|---|---|---|\n| One object | key-value lines | compact JSON on one line |\n| A list | a table (first 8 scalar fields, cells cut at 60 characters) | NDJSON: one JSON object per line |\n| A batch run | key-value lines | one JSON summary object |\n| No content (HTTP 204, such as a delete) | key-value lines: `ok`, `status`, `request` | `{"ok":true,"status":204,"request":{"method":"DELETE","path":"/v1/tasks/7"}}` |\n\n`-o` or `--output` picks the format: `json`, `ndjson`, `table`, `ids` or `csv`. `--json` is the same as `-o json`.\n\n- `-o json` on a list prints one JSON array. On a terminal, `-o json` pretty-prints an object.\n- `-o ids` prints one id per line, ready for `--ids -`. Items without an `id` are skipped with one warning.\n- `-o csv` prints a header row, then one row per item (RFC 4180, `\\n` line ends). The columns are the `--fields` names in the order you give them; without `--fields`, the top-level keys of the first 100 rows, in the order they first appear. A nested field is `a.b`, an object or array in a cell is its compact JSON, and `null` or a missing key is an empty cell. With `--all` the header is fixed from the first 100 rows, and a later row\'s other keys are dropped with one line on stderr naming them. A single object prints as a two-line CSV. Values are written as they are: nothing is cut, and line breaks stay inside the quotes.\n\n```bash\nkenso campaigns list --limit 3\nkenso campaigns list --limit 3 -o json\nkenso campaigns list --limit 3 -o csv --fields id,name,status\nkenso contacts list --campaign-id 812 --all -o ids\n```\n\n## Shape the output\n\n- `--fields a,b.c` keeps only those fields (dots reach into nested objects).\n- `--query <JMESPath>` filters or reshapes in-process, so you need no `jq`. On a list it sees the whole list. There is no `--jq`: `--query` takes JMESPath, not jq syntax.\n- Neither applies to a batch summary, which always prints in full.\n- `threads list`, `contacts list` and `contacts search` print a short set of fields per row, in every format: a thread\'s id, channel, sender, subject, interest, read state, newest message time and preview, a contact\'s id, name, email, title, company and email validity, and a few more (the command\'s `--help` names them all). `--full` prints every field (`--full -o json` for a script that reads them all), `--fields` picks your own, and `--query` sees every field.\n- A thread list\'s `preview` is a one-line preview by default: the first 280 characters of the newest message\'s text (the API\'s `bodyFormat=snippet`), in every format. `--full`, or `--fields` that names `preview` or `htmlBody`, prints the whole message text, and `kenso threads list-messages --thread-id <id>` reads every message of a thread whole.\n- A contact list asks the API for only the fields it prints (the API\'s `fields`), so a page downloads what it shows. A thread list printed with `-o ids`, or with `--fields` that names neither `preview` nor `htmlBody`, asks for no message bodies (`bodyFormat=none`). `--full` and `--query` ask for every field, and `--param-fields` or `--body-format` sent by hand wins.\n\n```bash\nkenso campaigns list --fields id,name,status\nkenso campaigns list --all --query "[?status==\'active\'].id"\nkenso me get --query "length(features)"\nkenso threads list --folder inbox --fields id,subject,preview\nkenso threads list --folder inbox --full\n```\n\n## Lists and pages\n\nA list command prints one page. When there are more, it prints the command for the next page on stderr, for example `next: kenso tags list --limit 1 --cursor MQ`. `--all` follows every page and streams the items. `--limit` sets the page size and `--cursor` starts at a cursor.\n\n`accounts search`, `contacts search` and `people search` page the same way: one page with the `next:` command, or every page with `--all`. A search that asks for counts (`countBy` in `--data`) prints the whole answer instead: `data`, `pagination` and `counts`. Counts cover every match whatever the page, so ask for them on one page (`--limit 1`): `--all` with `countBy` is a usage error.\n\n```bash\nkenso tags list --limit 50\nkenso tags list --all\n```\n\n## Files: uploads and downloads\n\nA command whose API action takes a multipart upload takes `--file <path>`: the CLI reads the file and sends it in the form, with a content type from its extension (a `.png` goes as `image/png`), and the other flags as form fields. `--file <field>=<path>` names the form field, for a form with more than one file. An upload that also takes JSON, such as a logo from a URL instead of a file, sends JSON when you leave `--file` out.\n\nA command whose API action answers with a file (a CSV, an image, a ZIP) takes `--out <path>`: it saves the answer byte for byte (mode 0600) and prints `out`, `bytes` and `contentType`, so the file never passes through an agent\'s context. Without `--out`, a CSV prints as it came, and a binary file goes to stdout only when stdout is a pipe or a file: on a terminal it fails with `binary_output`, whose `next` adds `--out`.\n\n`kenso api` takes both, for any route: `--file` (repeat it for more files) sends multipart with the keys of a `--data` object as form fields, and `--out` saves any answer.\n\n```bash\nkenso saved-lists create-upload --saved-list-id 12 --file people.csv\nkenso workspaces replace-logo --workspace-id 42 --file ./logo.png\nkenso workspaces replace-logo --workspace-id 42 --source-url https://example.com/logo.png\nkenso attachments get-content --attachment-id att_123 --out ./invoice.pdf\nkenso api POST /v1/campaigns/812/email-sequence/images --file ./hero.png\nkenso api GET /v1/knowledge/exports/77/content --out knowledge.zip\n```\n\n## Live streams\n\n`kenso sync events` and `kenso onboarding-builds events` follow a live stream of server-sent events. They print one JSON line per event as it arrives, on a terminal too, with the event\'s name, its id when it has one, and its data:\n\n```json\n{"event":"hello","data":{"buildId":"obd_2x","status":"building","stage":"read","lastEventId":0}}\n{"event":"stage","id":"41","data":{"stage":"plan"}}\n{"event":"done","id":"42","data":{}}\n```\n\nA stream has no time limit while events arrive. The server ends each connection after 15 minutes with a `bye` event; the command then connects again at once, and after a dropped connection or 60 s without even a keepalive, after a second. A connection that brought nothing but `hello` and `bye` (a server that is restarting) backs off 1, 2, 4 ... 30 s. Once events carry an id (`onboarding-builds events`), it sends the last whole event\'s id as `Last-Event-ID`, so no event is lost or printed twice. A refusal (401, 403, 404) ends it at once; eight failed or empty connects in a row end it with the last error.\n\nIt runs until Ctrl-C (exit 130; every line printed is whole), or until one of these:\n\n| Flag | Ends the command |\n|---|---|\n| `--until <event>` | After the first event with that name; several names are comma-separated: `--until done,error` |\n| `--max-events <n>` | After n events, `hello` and `bye` included |\n| `--once` | When the server closes the connection, instead of connecting again |\n\n```bash\nkenso onboarding-builds events --build-id obd_2x --until done,error\nkenso sync events --max-events 2 # hello, then the first poke\n```\n\n`--output`, `--fields` and `--query` do not apply to a stream. `--last-event-id` starts an onboarding build stream after that id.\n\n## Errors\n\nWhen stderr is not a terminal, an error is one JSON line on stderr:\n\n```json\n{"error":{"code":"unknown_flag","message":"Unknown flag --fiel for kenso contacts import.","field":"fiel","hint":"did you mean --file?","next":"kenso contacts import --help"}}\n```\n\n| Key | Always there | Meaning |\n|---|---|---|\n| `code` | yes | A stable snake_case code to branch on |\n| `message` | yes | One sentence for a person |\n| `field` | no | The flag or input field at fault |\n| `hint` | no | What to change |\n| `next` | no | The exact command to run next, such as `kenso auth login`, `kenso workspace list --search <name>` or the same command with `--yes` |\n| `httpStatus` | no | The API\'s HTTP status, when the API answered |\n| `requestId` | no | The API\'s request id: quote it when you contact Kenso support |\n\nOn a terminal the same error prints as text: `Error: <message>`, then `field:`, `hint:`, `next:` and `requestId:` lines. The key never appears in an error.\n\n### How API errors map\n\nThe CLI looks at the HTTP status first, then at the API\'s own `error.code`, which wins when present.\n\n| HTTP status | Default code | Exit |\n|---|---|---|\n| 400, 422 | `validation_failed` | 2 |\n| 401 | `unauthorized` (`next`: `kenso auth login`) | 3 |\n| 403 | `forbidden`: the key\'s user or role cannot do this in this workspace | 3 |\n| 404 | `not_found` | 4 |\n| 409 | `conflict` | 7 |\n| 429 | `rate_limited`, after the CLI waited and retried | 6 |\n| 5xx | `server_error`, after retries where they are safe | 8 |\n| anything else | `http_error` | 1 |\n\nTwo API codes change the exit code: `workspace_required` exits 2 with `"next":"kenso workspace list --search <name>"`, and `limit_reached` (the plan\'s or the campaign\'s lead limit) exits 6.\n\n### Errors from the CLI itself\n\n| Code | Exit | When |\n|---|---|---|\n| `usage_error` | 2 | A required flag or argument is missing, two flags conflict (`--yes` with `--dry-run`), or `--dry-run` on a command that has no dry run |\n| `read_only` | 2 | `--read-only` or `KENSO_READ_ONLY` is on and the command is not a read: nothing was sent. `next` (with `--read-only` only, on a command with a dry run) is the same command with `--dry-run`, which prints the plan and changes nothing |\n| `unknown_command` | 2 | No such command; `hint` suggests the closest one |\n| `unknown_flag`, `invalid_flag`, `invalid_flag_value`, `unexpected_argument` | 2 | A flag or argument the command does not take |\n| `invalid_query` | 2 | `--query` is not valid JMESPath |\n| `confirmation_required` | 2 | A delete, archive or remove ran without `--yes` where nobody can confirm: nothing was sent; `next` adds `--yes` |\n| `cancelled` | 2 | A person answered no to the confirmation: nothing was sent |\n| `file_unreadable` | 2 | An input file is missing, is a folder, cannot be opened, or cannot be parsed; the message names the line, such as `leads.csv line 3: a quote is not closed.` |\n| `config_invalid` | 2 | `~/.kenso/config.json` is not valid JSON: fix or delete it |\n| `feature_not_enabled` | 2 | Every action of the resource is a beta command your workspace has not enabled |\n| `invalid_key_format`, `key_required` | 2 | `auth login --with-key` read something that is not a Kenso key, or stdin is a terminal instead of a pipe |\n| `invalid_workspace_id` | 2 | `kenso workspace use` got an id that is not a positive whole number |\n| `unknown_topic` | 2 | `kenso docs` got a topic it does not have; `hint` lists the topics |\n| `file_unwritable` | 2 or 1 | An output file cannot be written: `--out` on `contacts export`, `kenso api` or a download command (2), `skill install` (1) |\n| `binary_output` | 2 | The answer is a binary file and stdout is a terminal: nothing was printed; `next` saves it with `--out` |\n| `no_api_key` | 3 | No key in `KENSO_API_KEY` or the profile (`next`: `kenso auth login`) |\n| `browser_login_unavailable`, `access_denied`, `login_expired` | 3 | Browser login is off, was denied, or timed out |\n| `run_not_found` | 4 | `kenso runs show` or `resume` got an unknown run id |\n| `docs_not_found` | 4 | `kenso docs reference` before the reference was generated (a source checkout without `pnpm build`) |\n| `run_in_progress`, `already_filled` | 7 | Another process is working on the run, or `studio fill` already ran with this file and these flags |\n| `local_changes` | 7 | `studio pull` would replace files that no earlier pull wrote or push sent, or that changed since; nothing was written, and `next` adds `--force` to replace them |\n| `job_timeout`, `job_failed`, `job_canceled` | 1 | `kenso jobs wait` (or a command that waits on a job) ran out of time, or the job failed or was canceled |\n| `mcp_tool_error` | 1 | `kenso mcp call`: the MCP tool answered with an error |\n| `unsafe_path` | 1 | `studio pull` refused a file path that is not a file of the Studio bundle layout (such as a dotfile, `opencode.json` or `CLAUDE.md`), would land outside `--dir`, or passes through a symbolic link, or a `samples/*.json` that does not hold a sample |\n| `network_error` | 8 | The API could not be reached after retries |\n| `upload_failed`, `download_failed` | 8 or 1 | A signed upload or download of a Studio file failed: 8 when storage was unreachable or answered 5xx, 1 on a 4xx (often an expired link: run the command again) |\n| `pull_incomplete` | 8 | `studio pull`: a file came back with neither text nor a download link |\n| `unexpected_response` | 1 or 8 | The API answered something the CLI could not read |\n| `unexpected_error` | 1 | A bug: run again with `--verbose` and report it |\n| `interrupted` | 130 | Ctrl-C |\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | OK, including a batch where every row succeeded or was skipped |\n| 1 | Unexpected error |\n| 2 | Usage or input error: a bad flag, a bad file, a validation error |\n| 3 | Auth: no key, an invalid, revoked or expired key, or HTTP 401 or 403 |\n| 4 | Not found |\n| 5 | Partial: the batch finished and some rows failed, were not found or were invalid. See `results.csv` |\n| 6 | Rate limited after retries, or a plan or campaign lead limit stopped the run (`limit_reached`) |\n| 7 | Conflict or invalid state (HTTP 409), or a run another process holds |\n| 8 | Server error after retries (5xx), or the API is unreachable |\n| 9 | Answer refused: a Kenso sandbox run stopped because an answer held a credential or something shaped like one |\n| 130 | Interrupted. A batch run can be resumed: see its `next` |\n\nSkipped rows (duplicates, blocklisted, already contacted) are not failures: a batch with only created, updated and skipped rows exits 0.\n\n## Flags\n\n- Command flags go after the command: `kenso contacts import --campaign 812`. Global flags can go anywhere.\n- A boolean flag takes `--flag`, `--no-flag`, `--flag=true` and `--flag=false`.\n- A flag that carries a secret (`--password`, `--api-key`, `--api-secret`, any `--\u2026-token` or `--\u2026-secret`) also takes `-` (read stdin), `@file` (read the file) or `env:NAME` (read that environment variable), so the value stays out of shell history: `printf \'%s\' "$FATHOM_KEY" | kenso fathom-connection connect --api-key -`. A value typed on the command line still works and prints one warning. A typed secret that itself starts with `@` is written `@@` (`--password @@Spring2026` sends `@Spring2026`); one that is exactly `-` or starts with `env:` has to come through `@file` or `env:NAME`. `-` refuses a terminal, an empty value is refused, and only one flag can read stdin. `--dry-run` shows a secret as `***`. With `--each`, the plan, its `next` and the run record keep `@file` or `env:NAME` as typed and `kenso runs resume` reads it again; a secret from stdin is refused there.\n- `--help` on any command prints its flags, arguments and examples. `kenso describe <resource> <action>` prints the same as JSON, with the body schema.\n\n## Effect, cost and read-only mode\n\nEvery command has an effect: `read` (changes nothing, charges nothing), `write` (changes workspace data, charges nothing the API contract declares, nothing leaves Kenso), `spend` (can charge credits), `send` (sends an email, a LinkedIn message, a call or an invitation, or starts or resumes sending) or `destructive` (deletes, archives, removes or merges). Command help prints `Effect: <effect>.` under the summary, and a command that charges adds a `Cost:` line in credits from your workspace\'s rate card.\n\n`kenso describe <resource> <action>` adds `effect` and `cost` to its JSON. `cost` is `null` for a command that does not charge, else `{"lines": [...], "rateCard": {"source": ..., "versions": [...]}}`: each line is the command\'s credit line with its `price` text, and `source` is `live`, `cache` or `bundled`. A command that charges something no rate-card row prices has `{"lines": [], "rateCard": null}`, with `text` saying what it charges when the command states it. `kenso describe` and `kenso describe <resource>` add `effect` to each row.\n\nA generated command that charges prints the same `cost` in its `--dry-run` plan, for the request it would send. A flag that turns off every charge says so: `kenso accounts create --skip-research --dry-run` prints `"cost": {"lines": [], "text": "not charged in credits (--skip-research: no research or committee run)", "rateCard": null}` and `"credits": {"needed": 0, "available": null, "sufficient": null}`, and reads nothing.\n\n`--read-only`, or `KENSO_READ_ONLY=1` in the environment, refuses every command whose effect is not `read` before it sends a request, with exit 2:\n\n```json\n{"error":{"code":"read_only","message":"kenso campaigns launch is a send command, and this session is read-only.","hint":"Read-only is on through --read-only: next prints the plan. Run the command again without --read-only to make the change.","next":"kenso --read-only campaigns launch --campaign-id 1 --dry-run"}}\n```\n\n`next` never makes the change: on a command with a dry run it is the same command with `--dry-run` and without `--yes`, which prints the plan. A command with no dry run gets no `next`, and its hint says to run it again without `--read-only`. A command with its own `--body-read-only` option (`kenso api-keys create`) gets no `next` either, and its hint names that option. When the variable turned read-only on, the hint reads `KENSO_READ_ONLY is set: unset it to run this command.` and there is no `next`, so an agent that runs `next` cannot loop. A POST that only reads, such as `kenso contacts search`, still runs; a GET that charges, such as `kenso search get-place`, is refused; a command with a dry run still prints its plan with `--dry-run`; `kenso api` has the effect of the route it calls, and on a route this CLI does not know only a `GET` runs.\n\n```bash\nKENSO_READ_ONLY=1 kenso contacts search --limit 1\nkenso --read-only describe email-finds create\n```\n\n## Beta commands\n\nCommands that need a workspace feature flag (CRM, Studio and others) are beta. Help and `kenso describe` hide the ones your workspace has not enabled and say how many they hid; `--all-commands` shows them. Calling a hidden command still works: Kenso decides. `kenso <resource>` on a resource whose every action is hidden answers `feature_not_enabled` (exit 2) and names the flags it needs.\n\n```bash\nkenso --help --all-commands\nkenso describe --all-commands\n```\n\n## What the CLI sends\n\nEvery API call carries `Authorization: Bearer <key>`, `Ken-Version: 1.1`, `X-Ken-Workspace-Id` (when a workspace is picked), `User-Agent: kenso-cli/<version> (node <version>; <platform>)` and `X-Ken-Client: Kenso CLI`. When a coding agent runs the CLI, `X-Ken-Client` names it (`Kenso CLI via Claude Code`) and writes carry `X-Ken-Actor: agent`, so Kenso\'s activity log shows who made a change.\n';
9785
9785
  }
9786
9786
  });
9787
9787
 
@@ -9789,7 +9789,7 @@ var init_output_and_errors = __esm({
9789
9789
  var README_default;
9790
9790
  var init_README = __esm({
9791
9791
  "docs/README.md"() {
9792
- README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the download against the release\'s `SHA256SUMS`, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | Nothing |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > Integrations > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
9792
+ README_default = '# Kenso CLI\n\nThe Kenso CLI (`kenso`) is the command line for Kenso. It does bulk work in your Kenso workspace from files: add thousands of leads to a campaign, update or clean them up, import accounts and people, and build Studio templates. It is made for coding agents (Claude Code, Codex, Cursor) and the people who drive them: JSON on stdout, fixed exit codes, a dry run before every bulk write, and runs you can resume.\n\nEvery canonical API operation a workspace member can call is also a command, such as `kenso campaigns list` or `kenso tags create`. So the CLI reaches what the Kenso MCP reaches, straight against `https://api.ken.so`. The legacy routes with no canonical successor, such as sequence images, AI variables or thread opens, have no command: reach them with `kenso api <METHOD> <path>`.\n\n## Install\n\nOn macOS or Linux, with or without Node, run the [install script](https://ken.so/install.sh): fetch it with `curl -fsSL` and pipe it to `sh`. It installs a standalone build that brings its own Node.js, checks the download against the release\'s `SHA256SUMS`, puts the CLI in `~/.local/share/kenso` and links `~/.local/bin/kenso`. Run it again to update.\n\nWith Homebrew, on macOS or Linux, the same standalone build:\n\n```bash\nbrew install ken-technology/tap/kenso\n```\n\n`brew upgrade kenso` updates it.\n\nWith Node 22 or newer, on any system, Windows included:\n\n```bash\nnpm i -g kenso\nkenso --version\n```\n\nTo run it once without installing, use `npx kenso --version`. On an older Node, kenso stops with one line that says so.\n\nEvery way to install:\n\n| Way | Systems | Needs |\n|---|---|---|\n| Install script, above | macOS, Linux (glibc) | Nothing |\n| Homebrew, above | macOS, Linux | Homebrew |\n| npm, above | Any | Node 22 or newer |\n| Standalone build: unpack it and put its `bin` folder on your PATH | macOS, Linux, Windows | Nothing |\n\nThe standalone builds are at `https://downloads.ken.so/desktop/cli/<version>/`, one per system: `kenso-<version>-darwin-arm64.tar.gz`, `darwin-x64`, `linux-arm64`, `linux-x64` and `kenso-<version>-windows-x64.zip`, with their `SHA256SUMS`. `https://downloads.ken.so/desktop/cli/latest.yml` names the newest version. The builds come out nightly and Homebrew follows them, so a command added that day reaches npm first.\n\n### Tab completion\n\nTab completes resources, actions and flags once you install the script for your shell. The script asks `kenso` for the candidates on each Tab, so it stays right as the CLI updates: install it once.\n\n```bash\n# zsh: add this line to ~/.zshrc\nsource <(kenso completion zsh)\n# bash: add this line to ~/.bashrc (on bash 3.2, the macOS default, use: eval "$(kenso completion bash)")\nsource <(kenso completion bash)\n# fish: save the script once\nkenso completion fish > ~/.config/fish/completions/kenso.fish\n```\n\n### Update notice\n\nWhen a newer version is out, `kenso` says so on stderr after the command\'s own output, at most once a week: `kenso 0.1.40 is out (you have 0.1.35): npm i -g kenso@latest`. It checks `registry.npmjs.org` at most once every 7 days and never delays a command by more than about a second. A standalone build checks `latest.yml` on `downloads.ken.so` instead and names its own update: the install script, or `brew upgrade kenso` when Homebrew installed it. It stays quiet in CI (`CI` set) and when stderr is not a terminal. Under a coding agent it asks nothing: it prints the line once per agent session, from the last check. Set `KENSO_NO_UPDATE_NOTIFIER=1` to turn it off.\n\n## 60-second quickstart\n\n1. Create an API key in app.ken.so at Settings > Integrations > API keys.\n2. Save the key, pick a workspace, then plan and apply a CSV import:\n\n```bash\necho $KEY | kenso auth login --with-key\nkenso workspace list --search acme\nkenso workspace use 1234\nkenso campaigns list --limit 5\nkenso contacts import --campaign 812 --file leads.csv --dry-run\nkenso contacts import --campaign 812 --file leads.csv --yes\n```\n\n`workspace list` and `workspace use` are only needed when your key reaches more than one workspace.\n\nThe dry run reads the file, maps the columns, checks every row, asks Kenso for a credit estimate, and writes nothing. It prints the plan, with the exact apply command in `next`:\n\n```json\n{"run":"r_tdi5cdnx","dryRun":true,"command":"contacts import","rows":4,"valid":2,"invalid":2,"chunks":1,"chunkSize":1000,"campaignId":812,"mapping":{"Email":"email","First Name":"firstName","Last Name":"lastName","Company":"companyName","Pain Point":"customVariables.pain_point"},"customVariableKeys":["pain_point"],"estimate":{"kind":"leads","totalMillicredits":2000,"availableMillicredits":500000,"sufficient":true},"credits":{"needed":2,"available":500,"sufficient":true},"next":"kenso contacts import --campaign 812 --file leads.csv --yes","plan":"/home/you/.kenso/runs/r_tdi5cdnx/plan.json","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv"}\n```\n\nThe apply sends the rows and prints one summary. Every input row has one line in `results.csv`:\n\n```json\n{"run":"r_tdi5cdnx","rows":4,"ok":0,"created":1,"updated":0,"skipped":{"duplicate":1},"failed":0,"notFound":0,"invalid":2,"changed":1,"results":"/home/you/.kenso/runs/r_tdi5cdnx/results.csv","resultsNdjson":"/home/you/.kenso/runs/r_tdi5cdnx/results.ndjson","invalidRows":"/home/you/.kenso/runs/r_tdi5cdnx/invalid.csv","resumed":false,"durationMs":1840,"campaignId":812,"notSendable":0}\n```\n\nThis run exits 5 because two rows were invalid: open `invalid.csv` to see why, fix those rows, and import them again. Running the same command again is safe: an email that is already in the campaign comes back `updated` or `skipped`, never as a second lead.\n\n## CLI or MCP\n\n- **Use the CLI for volume:** anything that starts from a file, anything over about 50 records, anything you may need to rerun or resume. Records never pass through the model\'s context: the agent passes a file path and reads a short summary.\n- **Use the MCP for conversation and single records:** look up a campaign, draft a reply, read a report. The MCP is at `https://mcp.ken.so/mcp`, signs in with OAuth and needs no install ([connection guide](https://ken.so/mcp)).\n- **Both use the same API and the same permissions.** `kenso mcp call` reaches MCP-only tools, such as skills, from the shell.\n\n## Docs\n\nEvery page is in the package and prints offline with `kenso docs <topic>`.\n\n| Page | Topic | What it covers |\n|---|---|---|\n| [Authentication](auth.md) | `auth` | API keys, browser login, profiles, workspaces, `doctor` |\n| [Leads](leads.md) | `leads` | Import, update, remove, pause, tag and export leads, with recipes |\n| [Batch runs](batch.md) | `batch` | Dry run and apply, run folders, results files, resume, rate limits, `--each` |\n| [Output and errors](output-and-errors.md) | `output-and-errors` | The output contract, error JSON, error codes, exit codes, live streams |\n| [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |\n| [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |\n| [Workflows (beta)](workflows.md) | `workflows` | Keep a workflow as a file: `kenso.json`, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap |\n| [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso\'s AI work with `kenso work run`, or pull and submit |\n| [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |\n| [Developer sandbox](sandbox.md) | `sandbox` | `kenso sandbox`: a workspace of your own where sends are simulated, its test key, the reserved test leads |\n| [Connect accounts](connect.md) | `connect` | `kenso connect`: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser |\n| [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |\n| Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |\n\n```bash\nkenso docs\nkenso docs leads\n```\n\nFor machine-readable help, run `kenso describe`: it prints every command, its flags and its body schema as JSON.\n';
9793
9793
  }
9794
9794
  });
9795
9795
 
@@ -9825,11 +9825,27 @@ var init_work = __esm({
9825
9825
  }
9826
9826
  });
9827
9827
 
9828
- // skill/kenso-cli/SKILL.md
9828
+ // docs/workflows.md
9829
+ var workflows_default;
9830
+ var init_workflows = __esm({
9831
+ "docs/workflows.md"() {
9832
+ workflows_default = '# Workflows (beta)\n\nA workflow is automation in Kenso: one trigger, a list of steps and limits. With the CLI you keep a workflow as a JSON file in your folder or repo: write it, check it, push it to the draft, test the draft, publish the version you tested, and run it on records with a credit cap and a results file.\n\nThe commands are beta: they show where your workspace has the `workflows` feature. Help hides them until your workspace has it; `kenso --help --all-commands` shows them. `kenso workflows test` and `kenso workflows run` also need `workflows_runtime`. Without it `test` stops with `runtime_off` (exit 4), "Workflows cannot run in this workspace yet.", with no retry, and a run that `kenso workflows run` starts stays `queued`, which `--wait` reports at its timeout.\n\n| Command | What it does |\n|---|---|\n| `workflows init [name]` | Write a new workflow file, blank or from a template, and a `kenso.json` |\n| `workflows pull <workflowId>` | Write a saved workflow\'s definition to a file and bind the file |\n| `workflows check <file>` | Validate the file and estimate one record; saves nothing |\n| `workflows push <file>` | Create the workflow or save the file to its draft; with `--publish`, publish it |\n| `workflows test <file>` | Run the saved draft once on one record |\n| `workflows diff <file>` | Compare the file with the published version or the draft |\n| `workflows schema` | Print a JSON Schema for workflow files, for editors |\n| `workflows run <file or id>` | Run the published workflow on ids or a CSV, estimate first |\n| `workflow-runs logs <runId>` | One row per step of a run: status, credits, error |\n\nThe other workflow commands are generated from the API, one per route: `kenso workflows publish`, `unpublish`, `get` and `list`, `kenso workflow-versions`, `kenso workflow-runs list`, `get`, `cancel`, `restart`, `retry` and `replay`, `kenso workflow-templates` and `kenso workflow-step-types`. `kenso <command> --help` shows their flags.\n\n## The file\n\nA workflow file is one JSON object in the `kenWorkflow: "1"` format, named `<name>.workflow.json`:\n\n```json\n{\n "kenWorkflow": "1",\n "name": "Qualify accounts",\n "description": "Scores each account against a simple ICP.",\n "trigger": { "type": "trigger.manual@1", "with": { "recordType": "account" } },\n "steps": [\n { "id": "qualify", "type": "ai.qualify@1", "with": { "criteria": "B2B SaaS, 50+ people", "tier": "cheap" } }\n ],\n "limits": { "creditsPerMonth": 100, "creditsPerRun": 5, "runsPerDay": 50, "atLimit": "ask" }\n}\n```\n\nThe format (trigger, steps, references, formulas, limits) is the `workflows` skill\'s `references/definition-format.md`. `kenso workflows schema` prints a JSON Schema (draft 2020-12) of the file with each step type\'s inputs, for an editor, offline; the server\'s validate stays the authority. `kenso workflow-step-types get` prints one step type\'s inputs and an example.\n\n```bash\nkenso workflows schema --out workflow.schema.json\nkenso workflow-step-types get --type ai.qualify@1\nkenso mcp call load_skill --args \'{"name":"workflows","reference":"references/definition-format.md"}\'\n```\n\n## kenso.json\n\n`kenso.json` binds workflow files to workflow ids and pins the folder\'s workspace. `init`, `pull` and `push` write it; you rarely edit it by hand.\n\n```json\n{\n "workspaceId": "3047",\n "profile": "client-a",\n "workflows": { "workflows/qualify.workflow.json": 412 }\n}\n```\n\n- All three keys are optional. `workspaceId` is a string of digits. `profile` is a profile name. `workflows` maps a path relative to `kenso.json` (forward slashes) to a workflow id. One file holds one workflow and one workflow is bound to one file: binding a second is `already_bound` (exit 7). Other keys are kept when the CLI rewrites the file.\n- The CLI looks for it from the current folder up to the first folder that holds `.git`; for a command given a file, from that file\'s folder.\n- The workspace is `--workspace`, else `KENSO_WORKSPACE_ID`, else `kenso.json`, else the profile\'s. The profile is `--profile`, else `KENSO_PROFILE`, else `kenso.json`, else the active profile. `kenso.json` never changes the API URL or the key.\n- A file command run in another workspace than the one `kenso.json` names stops with `workspace_mismatch` (exit 2): its workflow ids belong to that workspace.\n- It never holds a key or an API URL. A file with `apiKey`, `key`, `token`, a value starting with `kenso_`, or `apiUrl` is `folder_file_invalid` (exit 2), "kenso.json never holds a key or an API URL: remove <name>.", and nothing reads it. Invalid JSON, or a key of the wrong type, is the same error with the path and the key.\n- `kenso whoami` and `kenso auth status` print `workspaceSource` (`flag`, `env`, `folder`, `profile` or `none`) and, for `folder`, `folderFile`.\n\n```bash\nkenso whoami -o json\n```\n\n## The first run\n\nFrom a template to records:\n\n```bash\nkenso workflow-templates list\nkenso workflows init qualify --template <templateKey>\nkenso workflows push qualify.workflow.json\nkenso workflows check qualify.workflow.json --mode publish\nkenso workflows test qualify.workflow.json --record account:<accountId>\nkenso workflows push qualify.workflow.json --publish --expected-hash <definitionHash>\nkenso workflows run qualify.workflow.json --ids ids.txt --dry-run\nkenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --yes\n```\n\nFill the template\'s `<fill in: ...>` placeholders and set `limits` in the file before the first push. `check --mode publish` names everything publish would refuse, with a `fix` for each issue.\n\n## The commands\n\n### init\n\n```bash\nkenso workflows init qualify --template <templateKey> --dir workflows\n```\n\nWrites `<name>.workflow.json`: the template\'s definition with `--template`, else a blank definition with `trigger.manual@1` and no steps. Writes `kenso.json` with the resolved workspace when no folder file is found. It never replaces a file (`file_exists`, exit 7), sends no request without `--template`, and creates nothing in Kenso. Prints `{file, template, folderFile, folderFileCreated, workspaceId}`.\n\n### pull\n\n```bash\nkenso workflows pull 412 --out qualify.workflow.json\n```\n\nWrites the draft\'s definition (else the published one; `--published` takes the published one) to `--out` or `<slug of the name>.workflow.json`, with 2-space indents and a final newline, and binds the file in `kenso.json`. An existing file is replaced only when `kenso.json` binds it to this workflow (else `file_exists`, exit 7). When the workflow is bound to another file already, the new file is an unbound copy. Prints `{file, workflowId, draftVersion, draftHash, publishedHash, status}`.\n\n### check\n\n```bash\nkenso workflows check qualify.workflow.json --mode publish\n```\n\nSends the file as the definition to validate (saving nothing) and to the estimate for one record. Prints `{valid, issues, perRecord, draftHash, inSync, next}`: each issue has `path`, `code`, `message`, `fix` and `severity`; `perRecord` is `{expectedCredits, maxCredits}`; `draftHash` is the saved draft\'s hash, and `inSync` says whether the file equals that draft. Exit 0 when valid, 5 when not. `--mode draft` (the default) checks structure, schemas, references and formulas; `--mode publish` also checks limits, secrets and connected apps. An unbound file is `workflow_not_bound` (exit 2), "check needs a workflow id: a draft runs nothing and costs nothing.", with `next: kenso workflows push <file>`.\n\n### push\n\n```bash\nkenso workflows push qualify.workflow.json --note "Raise the size floor"\nkenso workflows push qualify.workflow.json --dry-run\n```\n\nAn unbound file creates the workflow and binds the file. A bound file is saved to the draft when it differs from it, on top of the draft version just read; an identical file saves nothing. Prints `{workflowId, saved, draftVersion, draftHash, published, status, next}`. `--dry-run` prints `wouldSend`: which of create, update and publish it would send. `--publish` publishes after the save, and `--expected-hash` goes with it (see The hash rule).\n\n### test\n\n```bash\nkenso workflows test qualify.workflow.json --record account:<accountId> --wait 50\n```\n\nRuns the saved draft once on one record: `--record <type:id>` (`person:812`; the types are `account`, `person`, `lead` and `place`), else the newest record of the trigger\'s type. `--wait` is the seconds the API waits for the run, 0 to 50 (50 by default). AI and data steps run for real and are charged; sends and CRM writes are simulated. A file that differs from the draft is refused (`draft_out_of_sync`, exit 7, `next: kenso workflows push <file>`). Prints `{testPassed, timedOut, definitionHash, publishPassRecorded, run: {id, status, creditsCharged}, hint, next}`; after a pass, `next` is the publish command with `--expected-hash <definitionHash>`. Exit 1 when the test did not pass.\n\n### diff\n\n```bash\nkenso workflows diff qualify.workflow.json --against draft\n```\n\nCompares the file with the published version (the default; the draft when nothing is published) or with the draft. Prints `{against, same, nameChanged, triggerChanged, limitsChanged, stepsAdded, stepsRemoved, stepsChanged}` with step ids. Exit 0 either way.\n\n### schema\n\n```bash\nkenso workflows schema --out workflow.schema.json\n```\n\nPrints, or writes to `--out`, the JSON Schema of a workflow file. It needs no sign-in and no network, and `--out` replaces only a schema it wrote.\n\n## The hash rule\n\n`definitionHash` is computed by the server for a saved draft and leaves `plain` out; the CLI never computes one. When the CLI compares a file with a saved definition, it compares them as JSON with keys sorted at every level: whitespace and key order never count.\n\n- Publish needs a passed test on the draft\'s hash. Without one the CLI stops with `test_required` (exit 7), "Publish needs a passed test on this exact draft.", and `next: kenso workflows test <file>`.\n- `--expected-hash <hash>` makes push compare the draft\'s hash after the save with the value. A mismatch is `hash_mismatch` (exit 7), "The draft\'s hash is <actual>, not <expected>.", and nothing is published; the saved draft stays. Pass the hash `kenso workflows test` printed.\n- Under a coding agent, `--publish` without `--expected-hash` is refused (`usage_error`, "an agent publishes only the version it tested: pass --expected-hash"). A person at a terminal may publish without it.\n- **The gap.** The publish route takes no hash, so a save that lands between the CLI\'s hash check and the publish call can be published. The server\'s `version_conflict` on a concurrent save and its rule that publish needs a passed test bound it.\n- A save that meets a newer draft is `version_conflict` (exit 7), "Someone saved this workflow since you read it.", with `next: kenso workflows diff <file> --against draft`.\n- A definition the server refuses on save or publish is `invalid_definition` (exit 5) with its issues (`path`, `code`, `message`); on a publish, `next` is `kenso workflows check <file> --mode publish`, which adds a `fix` to each.\n\n## Run on records\n\n```bash\nkenso accounts list --limit 50 -o ids > ids.txt\nkenso workflows run qualify.workflow.json --ids ids.txt --dry-run\nkenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --wait --out results.csv --yes\nkenso workflows run 412 --file people.csv --record-type person --dry-run\n```\n\n- **Target.** A number is a workflow id. A file must be bound in `kenso.json` and equal to the published version, else `unpublished_changes` (exit 7), "This file differs from the published version.", with `next` naming the push that publishes it (with `--expected-hash` when the saved draft holds the file). A workflow that is not live is `invalid_state` (exit 7) with `next: kenso workflows publish --workflow-id <id>`. Nothing publishes by itself.\n- **Record type** is the trigger\'s (`trigger.manual@1` takes its `with.recordType`); `--record-type` (`account`, `person`, `lead` or `place`) overrides it. A trigger that names no record type needs the flag (`not_runnable_on_records`, exit 2).\n- **Input.** `--ids` is one id per line (`-` reads stdin). `--file` is a CSV: with an `id` column, those ids; without one and with record type `person`, each row is matched or created as a person in chunks of 200, with the columns `kenso people import` accepts and no email finding. Any other record type without an `id` column is `ids_required` (exit 2), which names `kenso contacts import` or `kenso accounts import`. Duplicated ids run once. A saved list runs through a workflow whose trigger is `trigger.saved_list@1` or `trigger.csv@1`; `--list` is not a flag.\n- **Dry run.** `--dry-run`, and a run without `--yes`, estimate per chunk of up to 1,000 records, start nothing, and print `{dryRun, workflowId, records, recordType, credits: {needed, available, sufficient}, perRecord, expectedCredits, cap, next}`. `needed` is the estimate\'s maximum. A CSV without ids is estimated on its row count and creates no person.\n- **Confirmation.** Without `--yes`, a person at a terminal is asked once with the plan on screen. Under a coding agent the command prints the plan and stops, with `next` naming the same command with `--yes`.\n- **`--max-credits <n>`** is enforced by the CLI; the server is sent no cap. The ceiling per record is the definition\'s `limits.creditsPerRun` when set (`cap.kind: "hard"`), else the estimate\'s maximum per record (`cap.kind: "estimate"`). The CLI starts the first `floor(n / ceiling)` records and reports the rest as `not_started` with reason `over --max-credits`. The plan and the summary print `cap: {maxCredits, kind, perRecord, willStart, notStarted}`. A cap below one record\'s ceiling starts nothing: `cap_too_low` (exit 6), with `next` naming the smallest cap that starts one record. A workspace out of credits starts nothing either (`out_of_credits`, exit 6).\n- **`--wait`** follows each started run, up to 8 reads at a time, until it leaves `queued`, `running` and `waiting`, or `--timeout` (90s, 10m, 1h; default 30m) passes. A run still `waiting` at the timeout is reported as `waiting`. `--timeout` goes with `--wait`.\n- **`--out <results.csv>`** (needs `--wait`) writes one row per input record when the batch ends: `row, id, status, runId, runStatus, creditsCharged, missReason, error`, then one column per step id holding that step\'s output as compact JSON. The path is checked before the first request: its folder must exist, and an existing file is refused (`file_exists`, exit 7) unless it is this run\'s own.\n- **Summary.** One JSON object with `records`, `started`, `deduplicated`, `notStarted`, `succeeded`, `failed`, `waiting`, `missed` (reason to count), `creditsCharged` (`"pending"` without `--wait` or while runs are open), `cap`, `resultsCsv`, `appUrl` (the workflow\'s page in the app) and `next`, and the same counts on one stderr line. With `--wait`, a run that failed makes `next` its `kenso workflow-runs logs <runId>`.\n\n## The run folder\n\nEach applied run writes a run folder (`~/.kenso/runs/<id>`) that records every chunk\'s response, as every batch command does: see [Batch runs](batch.md). `kenso runs resume <runId>` never resends a chunk it has an answer for. A chunk that was sent and has no recorded answer is not resent either: resume stops with `chunk_outcome_unknown` (exit 5), the chunk\'s first and last row, and `next: kenso workflow-runs list --workflow-id <id> --created-after <chunk start time>`, so you can see what started.\n\n```bash\nkenso runs resume <runId>\nkenso workflow-runs list --workflow-id 412 --created-after 2026-11-21T10:00:00Z\n```\n\n## Read a run\n\n```bash\nkenso workflow-runs logs <runId>\nkenso workflow-runs logs <runId> --step qualify --full\n```\n\nOne row per step run in start order: `{nodeId, stepType, status, attempt, startedAt, endedAt, ms, credits, error}`, NDJSON when piped. `--step` keeps one node; `--full` adds each step\'s `input`, `output` and `attempts`. A header line on stderr gives the run\'s status, workflow, record and the credits it charged, and `needs attention: <reason>` when one is set. A failed run ends with `next: kenso workflow-runs retry --run-id <id> --dry-run`.\n\n## Step outputs are kept 7 days\n\nA succeeded run\'s step outputs are dropped 7 days after it finishes, unless the workflow keeps success details. `--out` writes them when the batch ends, so run with `--wait --out` when you need the results later.\n\n## Exit codes\n\n| Exit | When |\n|---|---|\n| 0 | Done. For `run`, every record started and, with `--wait`, none failed |\n| 1 | `test`: the test did not pass |\n| 2 | Usage: `workflow_not_bound`, `folder_file_invalid`, `workspace_mismatch`, `not_runnable_on_records`, `ids_required`, or `--publish` without `--expected-hash` under a coding agent |\n| 4 | `test`: `runtime_off`, the workspace cannot run workflows yet |\n| 5 | `check` found the file not valid, the server refused a definition (`invalid_definition`), `run` has records that failed, were not found or were not started, or resume met `chunk_outcome_unknown` |\n| 6 | `run`: the cap started nothing (`cap_too_low`), or the workspace is out of credits |\n| 7 | A conflict: `file_exists`, `already_bound`, `draft_out_of_sync`, `hash_mismatch`, `test_required`, `version_conflict`, `unpublished_changes`, `invalid_state`, or an existing `--out` file |\n\nEvery error is one JSON line on stderr with `code`, `message`, `hint` and `next`: see [Output and errors](output-and-errors.md).\n';
9833
+ }
9834
+ });
9835
+
9836
+ // skill/kenso/SKILL.md
9829
9837
  var SKILL_default;
9830
9838
  var init_SKILL = __esm({
9839
+ "skill/kenso/SKILL.md"() {
9840
+ SKILL_default = '---\nname: kenso\ndescription: "Use for any outbound work in Kenso: leads, lists, campaigns, sequences, replies, accounts, signals, workflows, Studio, sending setup, reporting. Routes to the Kenso skill for the job and sets the rules for workspace, spend, sends and the final reply."\n---\n\n# Kenso: start here\n\nThis skill comes first for any work in Kenso. It sends you to the skill for the job and sets the rules every other Kenso skill follows: the workspace, spend, sends and the final reply. When another skill says "the spend rules", it means section 5 below.\n\n## 1. First\n\n```bash\nkenso doctor\nkenso whoami\nkenso workspace list\nkenso credits balance\n```\n\n- `kenso doctor` checks the CLI, the key, the skills and the MCP. When a check fails, run its `next` before anything else.\n- `kenso whoami` shows the workspace this folder and key use (`activeWorkspace`, with its `id` and `name`) and where it comes from (`workspaceSource`); `kenso workspace list` lists every workspace the key reaches. Before any change, tell the person: "I will work in <name> (<id>)."\n- `kenso credits balance` shows the credits `available`. Read it before you plan anything that charges.\n\n## 2. The loop\n\n```bash\nkenso discover "find work emails for a list of people"\nkenso describe email-finds create\n```\n\n1. `kenso discover` with the request in plain words finds the command, doc, skill or workflow step for it, offline. Each hit has its `effect` (read, write, spend, send or destructive), its cost line and the `describe` command to run next.\n2. `kenso describe <resource> <action>` prints the command\'s flags, body, `effect` and `cost` as JSON.\n3. Run it with `--dry-run` and read the plan: what it would send and, for paid work, `credits` with `needed`, `available` and `sufficient`.\n4. Run it for real only as the rules below allow, with the plan\'s `next`.\n\nWhile you only look around, set `KENSO_READ_ONLY=1`: any command that is not a read is then refused before it sends anything, and a `--dry-run` still prints its plan.\n\n## 3. Which skill\n\nLoad a skill with `kenso skill show` and its name, for example `kenso skill show workflows`, or with `load_skill` through the Kenso MCP. `kenso skill list` shows the ones this workspace can use.\n\n| Need | Skill |\n|---|---|\n| Count my market, size it and build the list | `tam-builder` |\n| People-search filters for a campaign | `ken-search` |\n| Build a campaign from an ICP and an offer, to launch-ready | `create-campaign` |\n| Why a campaign is up or down; my best and worst campaign | `campaign-diagnosis` |\n| Fix the email that is not working in a live campaign | `campaign-improvement` |\n| Go through replies, draft answers, offer meeting times | `reply-handling` |\n| What needs my attention: what failed, stalled or came out wrong, and what to fix first | `kenso-triage` |\n| My Today queue: the touches due today, to draft, snooze or skip | `today-review` |\n| Bounces up or sends dropped | `deliverability-guard` |\n| Sending setup: inboxes, domains, LinkedIn accounts, the link host | `delivery-setup` |\n| Connect my own sending domains | `connect-domains` |\n| Review or order sending domains | `domain-selection` |\n| Inbox limits, display names, signatures, reply forwarding | `inbox-configuration` |\n| How many domains and inboxes I need | `infra-planning` |\n| Set up a new workspace | `setup-workspace` |\n| Sign up from the agent, with no workspace yet | `onboarding-signup` |\n| Company, offer and voice files in Knowledge | `knowledge-setup` |\n| Edit the skills in Knowledge > Skills | `skill-editor` |\n| Target accounts: add, research, map who buys, plan touches | `accounts` |\n| A one-page brief on an account before a call | `account-brief` |\n| Hiring, funding, job changes, website visits or replies that start outreach | `signals` |\n| Outreach around a conference or trade show | `event-outbound` |\n| A job opening turned into a candidate campaign | `role-intake` |\n| Someone\'s social profiles and recent posts | `social-data` |\n| Build, test and run a workflow, as a file or in the app | `workflows` |\n| Build or edit a Studio template | `studio-template` |\n| Fill a Studio page for an account or a candidate | `studio-asset` |\n| Prep for a call, then follow it up | `meeting-prep-and-followup` |\n| A MEDDIC summary of a call | `meddic-summary` |\n| The objections raised on a call | `objection-log` |\n| The next-steps email after a call | `next-step-email` |\n| The handoff to the AE after a call | `handoff-to-ae` |\n| Open deals by stage, and the stuck ones | `pipeline-review` |\n| The weekly or monthly results report | `report` |\n| The person asks for the start interview | `kenso-start` |\n\n**CLI or MCP.** Use the CLI for work from a file, or on more than about 50 records: imports, updates, exports and workflow runs. The kenso-cli skill has those commands; `kenso agent setup` installs it beside this one. For one record or a question, the MCP is fine.\n\n**What to offer.** Look first:\n\n```bash\nkenso campaigns list --limit 5\n```\n\nA workspace with campaigns: offer "Diagnose my best and worst campaign" (`campaign-diagnosis`) and "Triage today\'s replies" (`reply-handling`). A new workspace: offer the starter menu.\n\n1. Count my market: how many companies and people match my ICP?\n2. Check my sending setup and tell me what to fix before I launch.\n3. Draft a campaign for my company from my website and show it to me before anything is sent.\n4. Tell me what you want to get done.\n\nThey lead to `tam-builder`, `delivery-setup` and `create-campaign`; for the fourth, find the skill in the table or run `kenso discover` with the person\'s words.\n\n## 4. Workspace\n\nName the workspace before the first change, and again whenever it changes. A yes that does not name the workspace is not a yes: ask again, with its name. Under a coding agent, every command that is not a read prints `workspace: <id> (<source>)` on stderr: stop when it is not the workspace the person approved. A `kenso.json` in a folder holds that folder\'s workspace.\n\n## 5. Spend\n\nThese rules hold in every Kenso skill.\n\n- A bounded request ("find emails for these 200 people") covers that scope and nothing wider. An open one ("find me leads") needs a row count and a budget from the person first.\n- Sample first. When a paid step covers more than 25 records, or the estimate\'s `credits.needed` is over 10, run 3 to 5 records first, show the result and the projected cost of the rest, and ask before the rest. These four numbers are thresholds of this contract, not prices.\n- Prices come from a `--dry-run`, `kenso credits quote` or `kenso credits rate-card`, never from memory or from a skill.\n- `Effect: write.` in a command\'s help is not proof that it is free: not every route that charges is marked. The dry run or `kenso credits quote` is the authority.\n- Ask once, with one approval block, and wait for the yes:\n\n```text\nPlan: <what will run>\nRecords: <how many, and from where>\nEstimate: <needed> of <available> available credits (from the dry run)\nCap: --max-credits <the cap you will set>\nReply yes to run it.\n```\n\n- On `kenso workflows run`, always set `--max-credits` to the cap in the approval block.\n- Out of credits (`sufficient: false` in the plan, or a run that stops because the credits ran out): stop, show what finished, and give the billing link, https://app.ken.so/<workspace id>/settings/billing. Never retry in a loop.\n\n```bash\nkenso credits quote --kind leads --count 200\nkenso credits rate-card --action email_found\n```\n\n## 6. Sends\n\nSends, launches, CRM writes and schedule changes need a yes that names the campaign or the record set ("launch campaign 812", "update these 40 deals in the CRM"). A yes to a plan is not a yes to send. A delete, archive or remove runs with `--yes` only after the person said yes to that delete.\n\n## 7. Workflows, signals and tools\n\n- A **workflow** is a saved set of steps that runs on each record (an account, a person, a lead), started by hand, on a schedule or by a signal. The `workflows` skill builds one; its file loop is `kenso skill show workflows --reference files.md`.\n- A **signal** is an event that starts a workflow: hiring, funding, a job change, a website visit, a reply. `kenso signals types` lists them; the `signals` skill watches for them.\n- A **tool** is one command you run yourself (`kenso discover` finds it) or one MCP operation.\n\nThe first run of a workflow template is five commands: `init --template`, `push`, `test`, `push --publish --expected-hash` with the hash `test` printed, and `run`. Check the file after every edit, and dry-run the run before the paid one:\n\n```bash\nkenso workflow-templates list\nkenso workflows init qualify --template <templateKey>\nkenso workflows push qualify.workflow.json\nkenso workflows check qualify.workflow.json --mode publish\nkenso workflows test qualify.workflow.json --record account:<accountId>\nkenso workflows push qualify.workflow.json --publish --expected-hash <definitionHash>\nkenso workflows run qualify.workflow.json --ids ids.txt --max-credits <cap> --dry-run\nkenso workflows run qualify.workflow.json --ids ids.txt --max-credits <cap> --wait --out results.csv --yes\n```\n\n## 8. Your own agent plan: kenso work\n\nWhere your workspace has it, `kenso work` runs Kenso AI steps on your own Claude or Codex plan at 0 Kenso AI credits. Check with `kenso work status`: it lists what waits for your agent, and answers `not_found` when the workspace does not have it yet. When most of an estimate is AI steps, name this to the person as an option before they approve.\n\n```bash\nkenso work status\n```\n\n## 9. The final reply\n\nEnd every job with this reply, in this order:\n\n```text\nOutcome: <what ran, on how many records, what it produced>\nMisses: <count and reason for each kind of miss, or none>\nLinks: <the app page> and <the results file>\nCredits spent: <from the run summary\'s creditsCharged, or kenso credits usage --run <runId>>\nNext: <the one next step you recommend>\n```\n\n## No Kenso account yet\n\nThese steps run on the Kenso MCP server, which signs in with a Kenso account. If the user has none, send them to https://app.ken.so/get-started to create one, then sign in when the agent asks.\n';
9841
+ }
9842
+ });
9843
+
9844
+ // skill/kenso-cli/SKILL.md
9845
+ var SKILL_default2;
9846
+ var init_SKILL2 = __esm({
9831
9847
  "skill/kenso-cli/SKILL.md"() {
9832
- SKILL_default = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\nkenso logs tail --status 4xx,5xx --since 10m # stream the workspace\'s failed API calls, one line each; Ctrl-C stops (exit 4 = not on for the workspace yet)\nkenso connect inbox --provider google # also calendar, crm, github, linkedin ...: hand the printed link to the person (only they can sign in), it waits and prints the connection\nkenso onboarding-builds events --build-id obd_2x --until done,error # live streams: one JSON line per event, reconnects itself\n```\n\nCharges: `accounts import` per new account, `studio fill` per page (again for ids from another file): show the estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso workflows brief` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then `kenso auth login` (the person approves in the browser) and `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > Integrations > API keys.\n';
9848
+ SKILL_default2 = '---\nname: kenso-cli\ndescription: The Kenso CLI (kenso) for work from a file (of any size, even a few ids) or over about 50 records - import, update, remove (delete), pause, tag or export leads, import CRM accounts and people, edit Studio templates as local files and fill them, run an API operation per file row, resume an interrupted run, write the Kenso AI work a workspace gave to its own coding agent (My agent, with kenso work run, or work pull and submit with subagents), sign in with a key from a variable (pipe it to kenso auth login --with-key, no check first). For records listed in the message (under about 50), one record or a question, use the Kenso MCP.\n---\n\n1. Every write runs first with `--dry-run`; apply with the plan\'s `next` (a delete, archive or remove applies with `--yes`). `--yes` at once only to continue an interrupted run or apply what the person confirmed. A command with no dry run refuses `--dry-run` (exit 2, nothing ran): read its `--help`, then run it without.\n2. Many rows: one command on the file as it is (`--file`, `--ids`, `--each`). Run kenso only: no python, awk or shell tests, not even on a file or variable.\n3. Any output\'s `next` is the command to run; errors are JSON on stderr. `--force` only with the person\'s OK.\n4. Ids are flags: `--campaign-id 812` (or `--campaign 812`, the same flag). `--workspace <id>`; by name `kenso workspace list --search acme`. `--json` is `-o json`; `--query` takes JMESPath (there is no `--jq`). Other commands: `kenso --help`; `kenso api <METHOD> <path>` only when none fits.\n\n```bash\nkenso contacts import --campaign 812 --file leads.csv --dry-run # skips leads already in; --map \'{"Pain": "customVariables.pain_point", "Notes": null}\'; over 200 MB --server-import\nkenso contacts update --file edits.csv --match id --dry-run # also one lead; or --match email --campaign 812\nkenso contacts remove --ids ids.txt --dry-run # also pause, resume, restore; over 1,000: --confirm <count>\nkenso contacts remove --where \'{"campaignIds": [812], "filters": [{"conditions": {"field": "ContactCompany.Name", "operator": 2, "value": "acme"}}]}\' --dry-run # also pause, resume; 2 = contains; no search first\nkenso contacts tag --tag 31 --ids ids.txt --dry-run # tag, restore: --ids only, so first kenso contacts list --campaign-id 812 --all -o ids > ids.txt\nkenso contact-imports create --source campaign --source-campaign-id 10601 --campaign-id 812 --dry-run # copy another campaign\'s leads in\nkenso contacts export --campaign 812 --out leads.csv # a segment: kenso contact-exports create --segment-id 55\nkenso runs resume <runId> # an interrupted run; terminal lost: kenso runs list finds it. A changed file is a new run\nkenso accounts import --file accounts.csv --dry-run # companies; a file of people: kenso people import --file people.csv\nkenso studio push 12 --dir ./tpl # to preview local edits push first (draft; live needs --publish), then studio preview 12\nkenso studio fill 12 --accounts ids.txt --dry-run # or --campaign 10546 --contacts leads.csv\nkenso opportunities update --each rows.csv --dry-run # any API command on a file of rows (CSV or JSONL; keys fill flags and body). One record: kenso campaigns update --campaign-id 812 --name Q4 --dry-run\nkenso mcp call list_skills # only to list Ken\'s skills\nkenso logs tail --status 4xx,5xx --since 10m # stream the workspace\'s failed API calls, one line each; Ctrl-C stops (exit 4 = not on for the workspace yet)\nkenso connect inbox --provider google # also calendar, crm, github, linkedin ...: hand the printed link to the person (only they can sign in), it waits and prints the connection\nkenso onboarding-builds events --build-id obd_2x --until done,error # live streams: one JSON line per event, reconnects itself\n```\n\nCharges: follow the kenso skill\'s spend rules; every dry run prints the credit estimate. `pinned_by_user`: with the person\'s OK, rerun with `--overwrite-pinned`. Workflows: `kenso docs workflows` first; secrets only as `{{secrets.NAME}}`. Key: `KENSO_API_KEY`, or pipe a variable, no check: `printf \'%s\' "$KEY" | kenso auth login --with-key`; never in a flag, output or file.\n\n## Work (beta): My agent\n\nA workspace can set a kind of Kenso AI work (personalization, qualification, segmentation, rewriting, meeting brief, call brief, workflow prompt) to My agent in Settings > AI work: then it waits for the person\'s own coding agent, at 0 Kenso AI credits. The `kenso work` commands take no `--dry-run`. Never read the items\' text into the chat: the files carry it.\n\n```bash\nkenso work status # what waits, per kind\nkenso work run --agent claude # does it all: claims, runs headless agents, submits; stops when the queue is empty. Other agents need --allow-unconfined; exit 6 = the plan\'s usage limit\nkenso work pull --files 4 --per-file 10 # by hand: prints the work file paths, never the items\nkenso work submit <dir>/*.answers.json # pull\'s next; exit 5 = some answers rejected (see each <claimId>.results.json)\nkenso work release <claimId> # give back work you will not finish\n```\n\nBy hand in a chat: run `kenso work pull`, then give each work file to its own subagent with only its path ("Read this work file and write its answers file as its rules say"), then run pull\'s `next`. More: `kenso docs work`.\n\n## Setup\n\n`kenso` missing: `curl -fsSL https://ken.so/install.sh | sh` (macOS or Linux, no Node needed) or `npm i -g kenso` (Node 22 or newer), or run a command as `npx -y kenso@latest <command>`. Then `kenso auth login` (the person approves in the browser) and `kenso doctor`. `kenso agent setup -y` installs this skill and the Kenso MCP server (`https://mcp.ken.so/mcp`) for the agent; the person signs in to the MCP once in the agent.\n\n## No Kenso account yet\n\nThe CLI signs in with a Kenso API key. If the user has no Kenso account, send them to https://app.ken.so/get-started to create one, then create a key in Kenso at Settings > Integrations > API keys.\n';
9833
9849
  }
9834
9850
  });
9835
9851
 
@@ -9837,9 +9853,10 @@ var init_SKILL = __esm({
9837
9853
  var embedded_exports = {};
9838
9854
  __export(embedded_exports, {
9839
9855
  DOCS: () => DOCS,
9840
- SKILL: () => SKILL
9856
+ SKILL: () => SKILL,
9857
+ SKILLS: () => SKILLS
9841
9858
  });
9842
- var DOCS, SKILL;
9859
+ var DOCS, SKILL, SKILLS;
9843
9860
  var init_embedded = __esm({
9844
9861
  "src/commands/docs/embedded.ts"() {
9845
9862
  "use strict";
@@ -9855,7 +9872,9 @@ var init_embedded = __esm({
9855
9872
  init_studio();
9856
9873
  init_webhooks();
9857
9874
  init_work();
9875
+ init_workflows();
9858
9876
  init_SKILL();
9877
+ init_SKILL2();
9859
9878
  DOCS = {
9860
9879
  "README.md": README_default,
9861
9880
  "auth.md": auth_default,
@@ -9864,67 +9883,32 @@ var init_embedded = __esm({
9864
9883
  "output-and-errors.md": output_and_errors_default,
9865
9884
  "crm.md": crm_default,
9866
9885
  "studio.md": studio_default,
9886
+ "workflows.md": workflows_default,
9867
9887
  "work.md": work_default,
9868
9888
  "webhooks.md": webhooks_default,
9869
9889
  "sandbox.md": sandbox_default,
9870
9890
  "connect.md": connect_default,
9871
9891
  "agents.md": agents_default
9872
9892
  };
9873
- SKILL = SKILL_default;
9874
- }
9875
- });
9876
-
9877
- // src/commands/docs/content.ts
9878
- import { readFileSync as readFileSync10 } from "node:fs";
9879
- function readOptional(url) {
9880
- try {
9881
- return readFileSync10(url, "utf8");
9882
- } catch {
9883
- return void 0;
9884
- }
9885
- }
9886
- async function topicText(topic) {
9887
- if (!fromSource && topic.file !== "reference.md") return (await Promise.resolve().then(() => (init_embedded(), embedded_exports))).DOCS[topic.file];
9888
- return readOptional(new URL(`docs/${topic.file}`, root));
9889
- }
9890
- async function skillText() {
9891
- if (!fromSource) return (await Promise.resolve().then(() => (init_embedded(), embedded_exports))).SKILL;
9892
- return readFileSync10(new URL("skill/kenso-cli/SKILL.md", root), "utf8");
9893
- }
9894
- var TOPICS, fromSource, root;
9895
- var init_content = __esm({
9896
- "src/commands/docs/content.ts"() {
9897
- "use strict";
9898
- TOPICS = [
9899
- { topic: "readme", file: "README.md", title: "Kenso CLI", description: "What it is, install, a 60-second quickstart, CLI or MCP" },
9900
- { topic: "auth", file: "auth.md", title: "Authentication", description: "API keys, browser login, profiles, workspaces, doctor" },
9901
- { topic: "leads", file: "leads.md", title: "Leads", description: "Import, update, remove, pause, tag and export leads, with recipes" },
9902
- { topic: "batch", file: "batch.md", title: "Batch runs", description: "Dry run and apply, run folders, results files, resume, rate limits, --each" },
9903
- { topic: "output-and-errors", file: "output-and-errors.md", title: "Output and errors", description: "The output contract, error JSON, error codes, exit codes, live streams" },
9904
- { topic: "crm", file: "crm.md", title: "CRM (beta)", description: "Accounts, people, opportunities and CRM sync" },
9905
- { topic: "studio", file: "studio.md", title: "Studio (beta)", description: "Pull, push, validate, preview and fill templates" },
9906
- { topic: "work", file: "work.md", title: "Agent work (beta)", description: "My agent: your own coding agent writes Kenso AI work with kenso work run, or pull and submit" },
9907
- { topic: "webhooks", file: "webhooks.md", title: "Webhooks", description: "Build a webhook handler locally: kenso webhooks listen --forward-to, trigger, the signature" },
9908
- { topic: "sandbox", file: "sandbox.md", title: "Developer sandbox", description: "kenso sandbox: a workspace of your own where sends are simulated, its test key, the reserved test leads" },
9909
- { topic: "connect", file: "connect.md", title: "Connect accounts", description: "kenso connect: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser" },
9910
- { topic: "agents", file: "agents.md", title: "Coding agents", description: "kenso agent setup for Claude Code, Codex, Cursor, Gemini CLI and OpenCode, the Agent Skill, environment variables, sandboxes" },
9911
- { topic: "reference", file: "reference.md", title: "Command reference", description: "Every command with its flags, generated from the CLI at build time" }
9912
- ];
9913
- fromSource = import.meta.url.endsWith(".ts");
9914
- root = new URL(fromSource ? "../../../" : "../", import.meta.url);
9893
+ SKILL = SKILL_default2;
9894
+ SKILLS = { "kenso-cli": SKILL_default2, kenso: SKILL_default };
9915
9895
  }
9916
9896
  });
9917
9897
 
9918
9898
  // src/commands/skill/bundled.ts
9899
+ import { readFileSync as readFileSync10 } from "node:fs";
9919
9900
  async function bundledSkillText(name) {
9920
- return name === "kenso-cli" ? skillText() : void 0;
9901
+ if (!BUNDLED_SKILLS.includes(name)) return void 0;
9902
+ if (!fromSource) return (await Promise.resolve().then(() => (init_embedded(), embedded_exports))).SKILLS[name];
9903
+ return readFileSync10(new URL(`skill/${name}/SKILL.md`, root), "utf8");
9921
9904
  }
9922
- var BUNDLED_SKILLS;
9905
+ var BUNDLED_SKILLS, fromSource, root;
9923
9906
  var init_bundled = __esm({
9924
9907
  "src/commands/skill/bundled.ts"() {
9925
9908
  "use strict";
9926
- init_content();
9927
- BUNDLED_SKILLS = ["kenso-cli"];
9909
+ BUNDLED_SKILLS = ["kenso-cli", "kenso"];
9910
+ fromSource = import.meta.url.endsWith(".ts");
9911
+ root = new URL(fromSource ? "../../../" : "../", import.meta.url);
9928
9912
  }
9929
9913
  });
9930
9914
 
@@ -10004,7 +9988,11 @@ var init_shipped = __esm({
10004
9988
  "2fc2b2771c36b0ce462cdaab4933b9ee294274cd32324b7decb3abd1164a2d89",
10005
9989
  "8e79d18098e6ed3b79c3bce771a46180b50e9ed1b741e64ffcb301601282eb12",
10006
9990
  "fcac2e80b3d818394465a491bad232025d1c201515ef7fb778e4aa51669b3e61",
10007
- "42fa3f163ab9aa70260040b443830c57dc7926e935a557c40896038e8817b088"
9991
+ "42fa3f163ab9aa70260040b443830c57dc7926e935a557c40896038e8817b088",
9992
+ "b34e186f56f36b509bffa0dea2ee78b09e91654b90a659d6665563df4fa88f76"
9993
+ ],
9994
+ kenso: [
9995
+ "6fb333a826726d51ba2ea3927745f843343490c8aa9098e5da682d24172323f7"
10008
9996
  ]
10009
9997
  };
10010
9998
  }
@@ -14853,6 +14841,44 @@ var init_discover_synonyms = __esm({
14853
14841
  }
14854
14842
  });
14855
14843
 
14844
+ // src/commands/docs/content.ts
14845
+ import { readFileSync as readFileSync15 } from "node:fs";
14846
+ function readOptional(url) {
14847
+ try {
14848
+ return readFileSync15(url, "utf8");
14849
+ } catch {
14850
+ return void 0;
14851
+ }
14852
+ }
14853
+ async function topicText(topic) {
14854
+ if (!fromSource2 && topic.file !== "reference.md") return (await Promise.resolve().then(() => (init_embedded(), embedded_exports))).DOCS[topic.file];
14855
+ return readOptional(new URL(`docs/${topic.file}`, root2));
14856
+ }
14857
+ var TOPICS, fromSource2, root2;
14858
+ var init_content = __esm({
14859
+ "src/commands/docs/content.ts"() {
14860
+ "use strict";
14861
+ TOPICS = [
14862
+ { topic: "readme", file: "README.md", title: "Kenso CLI", description: "What it is, install, a 60-second quickstart, CLI or MCP" },
14863
+ { topic: "auth", file: "auth.md", title: "Authentication", description: "API keys, browser login, profiles, workspaces, doctor" },
14864
+ { topic: "leads", file: "leads.md", title: "Leads", description: "Import, update, remove, pause, tag and export leads, with recipes" },
14865
+ { topic: "batch", file: "batch.md", title: "Batch runs", description: "Dry run and apply, run folders, results files, resume, rate limits, --each" },
14866
+ { topic: "output-and-errors", file: "output-and-errors.md", title: "Output and errors", description: "The output contract, error JSON, error codes, exit codes, live streams" },
14867
+ { topic: "crm", file: "crm.md", title: "CRM (beta)", description: "Accounts, people, opportunities and CRM sync" },
14868
+ { topic: "studio", file: "studio.md", title: "Studio (beta)", description: "Pull, push, validate, preview and fill templates" },
14869
+ { topic: "workflows", file: "workflows.md", title: "Workflows (beta)", description: "Keep a workflow as a file: kenso.json, init, pull, check, push, test, publish, and run it on ids or a CSV with a credit cap" },
14870
+ { topic: "work", file: "work.md", title: "Agent work (beta)", description: "My agent: your own coding agent writes Kenso AI work with kenso work run, or pull and submit" },
14871
+ { topic: "webhooks", file: "webhooks.md", title: "Webhooks", description: "Build a webhook handler locally: kenso webhooks listen --forward-to, trigger, the signature" },
14872
+ { topic: "sandbox", file: "sandbox.md", title: "Developer sandbox", description: "kenso sandbox: a workspace of your own where sends are simulated, its test key, the reserved test leads" },
14873
+ { topic: "connect", file: "connect.md", title: "Connect accounts", description: "kenso connect: an inbox, calendar, CRM, GitHub or other OAuth account, signed in by the person in a browser" },
14874
+ { topic: "agents", file: "agents.md", title: "Coding agents", description: "kenso agent setup for Claude Code, Codex, Cursor, Gemini CLI and OpenCode, the Agent Skill, environment variables, sandboxes" },
14875
+ { topic: "reference", file: "reference.md", title: "Command reference", description: "Every command with its flags, generated from the CLI at build time" }
14876
+ ];
14877
+ fromSource2 = import.meta.url.endsWith(".ts");
14878
+ root2 = new URL(fromSource2 ? "../../../" : "../", import.meta.url);
14879
+ }
14880
+ });
14881
+
14856
14882
  // src/commands/discover/discover.ts
14857
14883
  var discover_exports = {};
14858
14884
  __export(discover_exports, {
@@ -17294,7 +17320,7 @@ var show_exports2 = {};
17294
17320
  __export(show_exports2, {
17295
17321
  default: () => show_default2
17296
17322
  });
17297
- import { existsSync as existsSync8, readFileSync as readFileSync15 } from "node:fs";
17323
+ import { existsSync as existsSync8, readFileSync as readFileSync16 } from "node:fs";
17298
17324
  import { join as join18 } from "node:path";
17299
17325
  var FILES, command52, show_default2;
17300
17326
  var init_show2 = __esm({
@@ -17330,7 +17356,7 @@ var init_show2 = __esm({
17330
17356
  let summary;
17331
17357
  if (files.summary) {
17332
17358
  try {
17333
- summary = JSON.parse(readFileSync15(files.summary, "utf8"));
17359
+ summary = JSON.parse(readFileSync16(files.summary, "utf8"));
17334
17360
  } catch {
17335
17361
  summary = void 0;
17336
17362
  }
@@ -18126,14 +18152,14 @@ function sampleContentOk(bundlePath, content) {
18126
18152
  }
18127
18153
  }
18128
18154
  async function readFolder(dir3, skipped = []) {
18129
- const root2 = await existingDir(dir3);
18155
+ const root3 = await existingDir(dir3);
18130
18156
  const files = [];
18131
18157
  const walk = async (folder) => {
18132
18158
  const entries2 = await readdir2(folder, { withFileTypes: true });
18133
18159
  for (const entry of entries2) {
18134
18160
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
18135
18161
  const abs = join19(folder, entry.name);
18136
- const path = relative(root2, abs).split(sep).join("/");
18162
+ const path = relative(root3, abs).split(sep).join("/");
18137
18163
  if (entry.isDirectory()) {
18138
18164
  if (path === "assets" || path.startsWith("assets/") || path === "samples") await walk(abs);
18139
18165
  else skipped.push(`${path}/`);
@@ -18152,22 +18178,22 @@ async function readFolder(dir3, skipped = []) {
18152
18178
  }
18153
18179
  }
18154
18180
  };
18155
- await walk(root2);
18181
+ await walk(root3);
18156
18182
  skipped.sort();
18157
18183
  return files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
18158
18184
  }
18159
- function safeJoin(root2, bundlePath) {
18185
+ function safeJoin(root3, bundlePath) {
18160
18186
  const segments = bundlePath.split("/");
18161
18187
  const bad = !inBundleLayout(bundlePath) || isAbsolute(bundlePath) || bundlePath.includes("\\") || bundlePath.includes("\0");
18162
- const target2 = resolve12(root2, ...segments);
18163
- if (bad || !target2.startsWith(root2.endsWith(sep) ? root2 : root2 + sep)) {
18164
- throw unsafePath(bundlePath, `it is not a file of a Studio bundle (${LAYOUT}) inside ${root2}`);
18188
+ const target2 = resolve12(root3, ...segments);
18189
+ if (bad || !target2.startsWith(root3.endsWith(sep) ? root3 : root3 + sep)) {
18190
+ throw unsafePath(bundlePath, `it is not a file of a Studio bundle (${LAYOUT}) inside ${root3}`);
18165
18191
  }
18166
18192
  return target2;
18167
18193
  }
18168
- async function existingFileNoLinks(root2, target2, bundlePath) {
18169
- const parts2 = relative(root2, target2).split(sep);
18170
- let at = root2;
18194
+ async function existingFileNoLinks(root3, target2, bundlePath) {
18195
+ const parts2 = relative(root3, target2).split(sep);
18196
+ let at = root3;
18171
18197
  for (const [i, part] of parts2.entries()) {
18172
18198
  at = join19(at, part);
18173
18199
  const info = await lstat(at).catch(() => void 0);
@@ -18180,19 +18206,19 @@ async function existingFileNoLinks(root2, target2, bundlePath) {
18180
18206
  }
18181
18207
  return false;
18182
18208
  }
18183
- async function readPullState(root2) {
18209
+ async function readPullState(root3) {
18184
18210
  try {
18185
- const files = JSON.parse(await readFile10(join19(root2, PULL_STATE), "utf8"))?.files;
18211
+ const files = JSON.parse(await readFile10(join19(root3, PULL_STATE), "utf8"))?.files;
18186
18212
  if (typeof files !== "object" || files === null) return {};
18187
18213
  return Object.fromEntries(Object.entries(files).filter((entry) => typeof entry[1] === "string"));
18188
18214
  } catch {
18189
18215
  return {};
18190
18216
  }
18191
18217
  }
18192
- async function recordPullState(root2, entries2) {
18193
- const path = join19(root2, PULL_STATE);
18194
- await existingFileNoLinks(root2, path, PULL_STATE);
18195
- const files = { ...await readPullState(root2), ...Object.fromEntries(entries2) };
18218
+ async function recordPullState(root3, entries2) {
18219
+ const path = join19(root3, PULL_STATE);
18220
+ await existingFileNoLinks(root3, path, PULL_STATE);
18221
+ const files = { ...await readPullState(root3), ...Object.fromEntries(entries2) };
18196
18222
  await writeFile4(path, `${JSON.stringify({ files }, null, 2)}
18197
18223
  `);
18198
18224
  }
@@ -19528,7 +19554,7 @@ var init_views = __esm({
19528
19554
 
19529
19555
  // src/commands/webhooks/local.ts
19530
19556
  import { createHmac, randomBytes as randomBytes2 } from "node:crypto";
19531
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync16, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
19557
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync17, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
19532
19558
  import { join as join22 } from "node:path";
19533
19559
  function webhooksDir(env) {
19534
19560
  const dir3 = join22(configDir(env), "webhooks");
@@ -19541,7 +19567,7 @@ function signingSecretPath(env) {
19541
19567
  function signingSecret(env) {
19542
19568
  const file = signingSecretPath(env);
19543
19569
  try {
19544
- const saved = readFileSync16(file, "utf8").trim();
19570
+ const saved = readFileSync17(file, "utf8").trim();
19545
19571
  if (/^whsec_[A-Za-z0-9+/]{32,}={0,2}$/.test(saved)) return saved;
19546
19572
  } catch {
19547
19573
  }
@@ -19595,7 +19621,7 @@ function writeListenerState(env, workspaceId, state2) {
19595
19621
  }
19596
19622
  function readListenerState(env, workspaceId) {
19597
19623
  try {
19598
- const state2 = JSON.parse(readFileSync16(statePath(env, workspaceId), "utf8"));
19624
+ const state2 = JSON.parse(readFileSync17(statePath(env, workspaceId), "utf8"));
19599
19625
  return typeof state2.url === "string" && typeof state2.token === "string" ? state2 : void 0;
19600
19626
  } catch {
19601
19627
  return void 0;
@@ -19930,7 +19956,7 @@ var init_status3 = __esm({
19930
19956
  });
19931
19957
 
19932
19958
  // src/work/files.ts
19933
- import { closeSync as closeSync2, constants, fchmodSync, fstatSync, lstatSync, openSync as openSync2, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "node:fs";
19959
+ import { closeSync as closeSync2, constants, fchmodSync, fstatSync, lstatSync, openSync as openSync2, readFileSync as readFileSync18, writeFileSync as writeFileSync9 } from "node:fs";
19934
19960
  import { join as join23 } from "node:path";
19935
19961
  function agentName(value) {
19936
19962
  if (typeof value !== "string") return void 0;
@@ -19968,7 +19994,7 @@ function readRegularFile(path, what) {
19968
19994
  const stat4 = fstatSync(fd);
19969
19995
  if (!stat4.isFile()) return notPlain;
19970
19996
  if (stat4.size > MAX_ANSWERS_FILE_BYTES) return { ok: false, error: `the ${what} is too large` };
19971
- return readFileSync17(fd, "utf8");
19997
+ return readFileSync18(fd, "utf8");
19972
19998
  } finally {
19973
19999
  closeSync2(fd);
19974
20000
  }
@@ -20055,7 +20081,7 @@ var init_files = __esm({
20055
20081
 
20056
20082
  // src/work/agent-user.ts
20057
20083
  import { execFile, spawnSync as spawnSync2 } from "node:child_process";
20058
- import { readFileSync as readFileSync18 } from "node:fs";
20084
+ import { readFileSync as readFileSync19 } from "node:fs";
20059
20085
  import { isAbsolute as isAbsolute2 } from "node:path";
20060
20086
  function sudoArgs(user, command90, args, keep = [], set2 = {}) {
20061
20087
  const assignments = Object.entries(set2).map(([name, value]) => `${name}=${value}`);
@@ -20112,7 +20138,7 @@ function ids(status, field) {
20112
20138
  }
20113
20139
  function sudoGids(groupFile) {
20114
20140
  const gids = /* @__PURE__ */ new Set([0]);
20115
- for (const line of readFileSync18(groupFile, "utf8").split("\n")) {
20141
+ for (const line of readFileSync19(groupFile, "utf8").split("\n")) {
20116
20142
  const [group, , gid] = line.split(":");
20117
20143
  if (group !== void 0 && SUDO_GROUPS.has(group) && /^\d+$/.test(gid ?? "")) gids.add(Number(gid));
20118
20144
  }
@@ -20212,12 +20238,12 @@ var init_folder3 = __esm({
20212
20238
  return this.making;
20213
20239
  }
20214
20240
  async make() {
20215
- const root2 = runsRoot(this.ctx.env);
20241
+ const root3 = runsRoot(this.ctx.env);
20216
20242
  const makeDir = (path) => this.shared ? ensureDir(path, SHARED_DIR_MODE) : ensurePrivateDir2(path);
20217
20243
  let dir3;
20218
20244
  if (this.outDir === void 0) {
20219
- dir3 = join24(root2, this.runId);
20220
- if (!this.shared) ensurePrivateDir2(root2);
20245
+ dir3 = join24(root3, this.runId);
20246
+ if (!this.shared) ensurePrivateDir2(root3);
20221
20247
  makeDir(dir3);
20222
20248
  } else {
20223
20249
  dir3 = resolve16(this.outDir);
@@ -20231,10 +20257,10 @@ var init_folder3 = __esm({
20231
20257
  makeDir(dir3);
20232
20258
  for (const name of ["results.ndjson", "summary.json"]) await unlink3(join24(dir3, name)).catch(() => void 0);
20233
20259
  try {
20234
- if (!this.shared) ensurePrivateDir2(root2);
20235
- await symlink2(dir3, join24(root2, this.runId), "junction");
20260
+ if (!this.shared) ensurePrivateDir2(root3);
20261
+ await symlink2(dir3, join24(root3, this.runId), "junction");
20236
20262
  } catch (err) {
20237
- this.ctx.output.warn(`Could not link ${dir3} into ${root2} (${err.message}): kenso runs will not list this run.`);
20263
+ this.ctx.output.warn(`Could not link ${dir3} into ${root3} (${err.message}): kenso runs will not list this run.`);
20238
20264
  }
20239
20265
  }
20240
20266
  this.dir = dir3;
@@ -21925,12 +21951,12 @@ async function readRunToken(ctx) {
21925
21951
  return token;
21926
21952
  }
21927
21953
  function requireSharedRunsDir(ctx, out) {
21928
- const root2 = ctx.env.KENSO_RUNS_DIR?.trim();
21929
- if (!root2) {
21954
+ const root3 = ctx.env.KENSO_RUNS_DIR?.trim();
21955
+ if (!root3) {
21930
21956
  throw usageError("--agent-user needs KENSO_RUNS_DIR: the job folders go there, where the agent user's group can reach them.", { field: "agent-user" });
21931
21957
  }
21932
- if (out !== void 0 && !resolve18(out).startsWith(resolve18(root2) + sep2)) {
21933
- throw usageError(`--out must be inside KENSO_RUNS_DIR (${root2}) with --agent-user.`, { field: "out" });
21958
+ if (out !== void 0 && !resolve18(out).startsWith(resolve18(root3) + sep2)) {
21959
+ throw usageError(`--out must be inside KENSO_RUNS_DIR (${root3}) with --agent-user.`, { field: "out" });
21934
21960
  }
21935
21961
  }
21936
21962
  function agentToolsFlag(flags, allowWeb) {
@@ -22416,7 +22442,7 @@ var init_work2 = __esm({
22416
22442
  });
22417
22443
 
22418
22444
  // src/commands/workflows/files.ts
22419
- import { mkdirSync as mkdirSync7, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "node:fs";
22445
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync20, writeFileSync as writeFileSync11 } from "node:fs";
22420
22446
  import { basename as basename7, dirname as dirname6, join as join30, relative as relative2, resolve as resolve19, sep as sep3 } from "node:path";
22421
22447
  function shownPath(path) {
22422
22448
  return relative2(process.cwd(), path).split(sep3).join("/");
@@ -22425,7 +22451,7 @@ function readWorkflowFile(file) {
22425
22451
  const path = resolve19(file);
22426
22452
  let text4;
22427
22453
  try {
22428
- text4 = readFileSync19(path, "utf8");
22454
+ text4 = readFileSync20(path, "utf8");
22429
22455
  } catch (err) {
22430
22456
  if (err.code !== "ENOENT") throw err;
22431
22457
  throw new KensoError({ code: "file_not_found", message: `${file} does not exist.`, exitCode: ExitCode.Usage, field: "file" });
@@ -23316,10 +23342,10 @@ __export(schema_exports, {
23316
23342
  default: () => schema_default,
23317
23343
  workflowFileSchema: () => workflowFileSchema
23318
23344
  });
23319
- import { existsSync as existsSync15, readFileSync as readFileSync20, writeFileSync as writeFileSync12 } from "node:fs";
23345
+ import { existsSync as existsSync15, readFileSync as readFileSync21, writeFileSync as writeFileSync12 } from "node:fs";
23320
23346
  function isOwnSchema(file) {
23321
23347
  try {
23322
- return JSON.parse(readFileSync20(file, "utf8"))?.$id === SCHEMA_ID;
23348
+ return JSON.parse(readFileSync21(file, "utf8"))?.$id === SCHEMA_ID;
23323
23349
  } catch {
23324
23350
  return false;
23325
23351
  }
@@ -23599,12 +23625,12 @@ var init_run_input = __esm({
23599
23625
  });
23600
23626
 
23601
23627
  // src/commands/workflows/run-start.ts
23602
- import { readFileSync as readFileSync21 } from "node:fs";
23628
+ import { readFileSync as readFileSync22 } from "node:fs";
23603
23629
  import { unlink as unlink4 } from "node:fs/promises";
23604
23630
  import { join as join32 } from "node:path";
23605
23631
  function readJournal(file) {
23606
23632
  try {
23607
- return JSON.parse(readFileSync21(file, "utf8"));
23633
+ return JSON.parse(readFileSync22(file, "utf8"));
23608
23634
  } catch {
23609
23635
  return void 0;
23610
23636
  }
@@ -23738,7 +23764,7 @@ var init_run_start = __esm({
23738
23764
 
23739
23765
  // src/commands/workflows/run-results.ts
23740
23766
  import { createHash as createHash13 } from "node:crypto";
23741
- import { existsSync as existsSync16, readFileSync as readFileSync22 } from "node:fs";
23767
+ import { existsSync as existsSync16, readFileSync as readFileSync23 } from "node:fs";
23742
23768
  import { readFile as readFile13 } from "node:fs/promises";
23743
23769
  import { dirname as dirname7, join as join33, resolve as resolve22 } from "node:path";
23744
23770
  function sha2565(content) {
@@ -23747,7 +23773,7 @@ function sha2565(content) {
23747
23773
  async function isOwnResultsFile(path, env) {
23748
23774
  let hash;
23749
23775
  try {
23750
- hash = sha2565(readFileSync22(path));
23776
+ hash = sha2565(readFileSync23(path));
23751
23777
  } catch {
23752
23778
  return false;
23753
23779
  }
@@ -24215,7 +24241,7 @@ var init_run_actions = __esm({
24215
24241
 
24216
24242
  // src/commands/workflows/index.ts
24217
24243
  var actions36;
24218
- var init_workflows = __esm({
24244
+ var init_workflows2 = __esm({
24219
24245
  "src/commands/workflows/index.ts"() {
24220
24246
  "use strict";
24221
24247
  init_file_actions();
@@ -24530,7 +24556,7 @@ var init_registry = __esm({
24530
24556
  init_webhooks2();
24531
24557
  init_work2();
24532
24558
  init_workflow_runs();
24533
- init_workflows();
24559
+ init_workflows2();
24534
24560
  init_workspace();
24535
24561
  handWritten = {
24536
24562
  accounts: actions,
@@ -25068,7 +25094,7 @@ var init_pre_run = __esm({
25068
25094
  });
25069
25095
 
25070
25096
  // src/core/update-notice.ts
25071
- import { mkdirSync as mkdirSync8, readFileSync as readFileSync23, realpathSync as realpathSync2, renameSync as renameSync8, writeFileSync as writeFileSync13 } from "node:fs";
25097
+ import { mkdirSync as mkdirSync8, readFileSync as readFileSync24, realpathSync as realpathSync2, renameSync as renameSync8, writeFileSync as writeFileSync13 } from "node:fs";
25072
25098
  import { dirname as dirname8, join as join35, sep as sep4 } from "node:path";
25073
25099
  function installKind(script = process.argv[1], execPath = process.execPath, platform = process.platform) {
25074
25100
  try {
@@ -25088,7 +25114,7 @@ function updateCommand(install, platform) {
25088
25114
  }
25089
25115
  function readCheck(file) {
25090
25116
  try {
25091
- const parsed2 = JSON.parse(readFileSync23(file, "utf8"));
25117
+ const parsed2 = JSON.parse(readFileSync24(file, "utf8"));
25092
25118
  if (typeof parsed2?.checkedAt !== "string") return void 0;
25093
25119
  return { checkedAt: parsed2.checkedAt, ...typeof parsed2.latest === "string" ? { latest: parsed2.latest } : {} };
25094
25120
  } catch {