@everyai/cli 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,6 +23,19 @@ every tool call create_invoice \
23
23
  --json
24
24
  ```
25
25
 
26
+ ## Install as an agent plugin
27
+
28
+ The npm install remains the primary path. Agent plugins distribute the bundled `use-every` skill, which teaches the agent how to install and use the CLI.
29
+
30
+ In Claude Code:
31
+
32
+ ```text
33
+ /plugin marketplace add Every-AI-Inc/everyai-cli
34
+ /plugin install every@everyai-cli
35
+ ```
36
+
37
+ Codex's repo-scoped marketplace location is `.agents/plugins/marketplace.json`.
38
+
26
39
  ## Why a CLI (vs. adding the MCP server to each host)
27
40
 
28
41
  The CLI talks to the same Every MCP server (`admin-mcp.every.ai`) and inherits its full tool surface automatically — new tools appear with no CLI upgrade. What the CLI adds:
@@ -1,3 +1,7 @@
1
+ import { access } from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ import { createInterface } from 'node:readline/promises';
1
5
  import { environmentNameForBaseUrl, resolveBaseUrl } from '../lib/config.js';
2
6
  import { CliError } from '../lib/errors.js';
3
7
  import { ExitCode } from '../lib/exit-codes.js';
@@ -6,9 +10,112 @@ import { loginFlow } from '../lib/auth/flow.js';
6
10
  import { decodeJwtClaims } from '../lib/auth/jwt.js';
7
11
  import { createTokenStore, deleteTokenFromAllStores, getAuthStatus, getToken, resolveAuthTarget, } from '../lib/auth/tokens.js';
8
12
  import { fetchUserInfo } from '../lib/auth/userinfo.js';
9
- import { maybeShowSkillHint } from '../lib/hints.js';
13
+ import { maybeShowSkillHint, readHints, writeHints, } from '../lib/hints.js';
10
14
  import { emit } from '../lib/output.js';
15
+ import { installBundledSkill } from './skills.js';
11
16
  const WHOAMI_TIMEOUT_MS = 10_000;
17
+ const SKILL_OFFER_PROMPT = 'Teach your coding agent to use Every? Install the use-every skill: [1] Claude Code [2] Codex [3] Both [Enter=skip]';
18
+ async function pathExists(filePath) {
19
+ try {
20
+ await access(filePath);
21
+ return true;
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ const defaultSkillOfferFileSystem = {
28
+ pathExists,
29
+ readHints,
30
+ writeHints,
31
+ };
32
+ function hostPaths(cwd, homeDir) {
33
+ return {
34
+ claude: {
35
+ markers: [path.join(cwd, '.claude'), path.join(homeDir, '.claude')],
36
+ installed: [
37
+ path.join(cwd, '.claude', 'skills', 'use-every'),
38
+ path.join(homeDir, '.claude', 'skills', 'use-every'),
39
+ ],
40
+ },
41
+ codex: {
42
+ markers: [path.join(cwd, '.agents'), path.join(homeDir, '.codex')],
43
+ installed: [
44
+ path.join(cwd, '.agents', 'skills', 'use-every'),
45
+ path.join(homeDir, '.codex', 'skills', 'use-every'),
46
+ path.join(homeDir, '.agents', 'skills', 'use-every'),
47
+ ],
48
+ },
49
+ };
50
+ }
51
+ async function anyPathExists(fileSystem, paths) {
52
+ const matches = await Promise.all(paths.map((filePath) => fileSystem.pathExists(filePath)));
53
+ return matches.some(Boolean);
54
+ }
55
+ function targetsForAnswer(answer) {
56
+ if (answer === '1')
57
+ return ['claude'];
58
+ if (answer === '2')
59
+ return ['codex'];
60
+ if (answer === '3')
61
+ return ['claude', 'codex'];
62
+ return [];
63
+ }
64
+ function targetLabel(target) {
65
+ return target === 'claude' ? 'Claude Code' : 'Codex';
66
+ }
67
+ /** Best-effort interactive offer shown only after a browser login succeeds. */
68
+ export async function maybeOfferSkillAfterLogin(opts = {}) {
69
+ const input = opts.input ?? process.stdin;
70
+ const output = opts.output ?? process.stdout;
71
+ const errorOutput = opts.errorOutput ?? process.stderr;
72
+ if (opts.json ||
73
+ input.isTTY !== true ||
74
+ output.isTTY !== true ||
75
+ (opts.errorOutput === undefined && process.stderr.isTTY !== true))
76
+ return;
77
+ try {
78
+ const fileSystem = opts.fileSystem ?? defaultSkillOfferFileSystem;
79
+ const hints = await fileSystem.readHints();
80
+ if (hints.skill_offer_declined)
81
+ return;
82
+ const cwd = opts.cwd ?? process.cwd();
83
+ const paths = hostPaths(cwd, opts.homeDir ?? os.homedir());
84
+ const [claudeDetected, claudeInstalled, codexDetected, codexInstalled] = await Promise.all([
85
+ anyPathExists(fileSystem, paths.claude.markers),
86
+ anyPathExists(fileSystem, paths.claude.installed),
87
+ anyPathExists(fileSystem, paths.codex.markers),
88
+ anyPathExists(fileSystem, paths.codex.installed),
89
+ ]);
90
+ if (!(claudeDetected && !claudeInstalled) && !(codexDetected && !codexInstalled))
91
+ return;
92
+ const rl = createInterface({ input, output: errorOutput, terminal: false });
93
+ let answer;
94
+ try {
95
+ answer = (await rl.question(`${SKILL_OFFER_PROMPT}\n`)).trim();
96
+ }
97
+ finally {
98
+ rl.close();
99
+ }
100
+ if (answer === '') {
101
+ await fileSystem.writeHints({ ...hints, skill_offer_declined: true });
102
+ return;
103
+ }
104
+ const installSkill = opts.installSkill ?? ((target) => {
105
+ const installRoot = target === 'claude'
106
+ ? path.join(cwd, '.claude', 'skills')
107
+ : path.join(cwd, '.agents', 'skills');
108
+ return installBundledSkill(target, { dir: installRoot });
109
+ });
110
+ for (const target of targetsForAnswer(answer)) {
111
+ const installed = await installSkill(target);
112
+ output.write(`Installed use-every for ${targetLabel(target)} to ${installed.installed_to} — commit it to share with your team.\n`);
113
+ }
114
+ }
115
+ catch {
116
+ // An optional offer must never turn a successful login into a failure.
117
+ }
118
+ }
12
119
  function emitCommand(data, human, opts) {
13
120
  if (opts.json)
14
121
  emit(data, { json: true, staging: opts.staging });
@@ -130,6 +237,7 @@ export async function loginCommand(opts = {}) {
130
237
  every_token: false,
131
238
  };
132
239
  emitLogin(data, opts);
240
+ await maybeOfferSkillAfterLogin({ json: opts.json });
133
241
  }
134
242
  export async function logoutCommand(opts = {}) {
135
243
  const { environmentKey } = resolveAuthTarget({ staging: opts.staging });
@@ -46,7 +46,7 @@ export function conventionsBlock() {
46
46
  ' read: runs without confirmation',
47
47
  ' write: requires y/N interactively or --yes non-interactively',
48
48
  ' destructive: requires typed confirmation interactively or --yes --allow-destructive non-interactively',
49
- ' ai-mediated: treated as write-capable because it routes to Every AI',
49
+ ' ai-mediated: server-enforced read-only, but gated because it routes through Every AI; prefer deterministic tools',
50
50
  '',
51
51
  'Argument forms:',
52
52
  ' every tool call <name> --arg k=v --arg count=2',
@@ -1,4 +1,4 @@
1
- import { cp, mkdir, readdir, rm } from 'node:fs/promises';
1
+ import { cp, mkdir, readdir, rm, stat } from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
@@ -59,13 +59,58 @@ function emitCommand(data, human, opts) {
59
59
  else
60
60
  process.stdout.write(`${human}\n`);
61
61
  }
62
- function installHuman(target, files) {
62
+ async function pathIsDirectory(filePath) {
63
+ try {
64
+ return (await stat(filePath)).isDirectory();
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }
70
+ async function hostDetected(target) {
71
+ const cwd = process.cwd();
72
+ const home = os.homedir();
73
+ const candidates = target === 'claude'
74
+ ? [path.join(cwd, '.claude'), path.join(home, '.claude')]
75
+ : [path.join(cwd, '.agents'), path.join(home, '.codex')];
76
+ for (const candidate of candidates) {
77
+ if (await pathIsDirectory(candidate))
78
+ return true;
79
+ }
80
+ return false;
81
+ }
82
+ async function hostSkillInstalled(target) {
83
+ const cwd = process.cwd();
84
+ const home = os.homedir();
85
+ const candidates = target === 'claude'
86
+ ? [
87
+ path.join(cwd, '.claude', 'skills', SKILL_NAME),
88
+ path.join(home, '.claude', 'skills', SKILL_NAME),
89
+ ]
90
+ : [
91
+ path.join(cwd, '.agents', 'skills', SKILL_NAME),
92
+ path.join(home, '.codex', 'skills', SKILL_NAME),
93
+ path.join(home, '.agents', 'skills', SKILL_NAME),
94
+ ];
95
+ for (const candidate of candidates) {
96
+ if (await pathIsDirectory(candidate))
97
+ return true;
98
+ }
99
+ return false;
100
+ }
101
+ async function installHuman(target, files) {
63
102
  const lines = [`Installed ${SKILL_NAME} for ${target.target} to ${target.install_to}`];
64
103
  for (const file of files)
65
104
  lines.push(`- ${file}`);
105
+ const otherTarget = target.target === 'claude' ? 'codex' : 'claude';
106
+ if ((await hostDetected(otherTarget)) && !(await hostSkillInstalled(otherTarget))) {
107
+ const hostName = otherTarget === 'claude' ? 'Claude Code' : 'Codex';
108
+ lines.push(`${hostName} detected — also run: every skills install ${otherTarget}`);
109
+ }
110
+ lines.push('For a global install, use --dir <path>.');
66
111
  return lines.join('\n');
67
112
  }
68
- export async function skillsInstallCommand(target, opts = {}) {
113
+ export async function installBundledSkill(target, opts = {}) {
69
114
  assertTarget(target);
70
115
  const info = targetInfo(target, opts);
71
116
  const source = bundledSkillDir();
@@ -73,7 +118,13 @@ export async function skillsInstallCommand(target, opts = {}) {
73
118
  await mkdir(info.root, { recursive: true });
74
119
  await rm(info.install_to, { recursive: true, force: true });
75
120
  await cp(source, info.install_to, { recursive: true, force: true });
76
- emitCommand({ installed_to: info.install_to, files }, installHuman(info, files), opts);
121
+ return { installed_to: info.install_to, files };
122
+ }
123
+ export async function skillsInstallCommand(target, opts = {}) {
124
+ assertTarget(target);
125
+ const info = targetInfo(target, opts);
126
+ const result = await installBundledSkill(target, opts);
127
+ emitCommand(result, await installHuman(info, result.files), opts);
77
128
  }
78
129
  function listHuman(skills) {
79
130
  const lines = ['Available bundled skills:'];
@@ -26,18 +26,24 @@ export async function runFirstRunMenu(opts) {
26
26
  '',
27
27
  ].join('\n'));
28
28
  const rl = createInterface({ input: opts.input, output: opts.output });
29
+ let action = 'exit';
29
30
  try {
30
31
  const answer = (await rl.question('Choose [1]: ')).trim();
31
32
  if (answer === '' || answer === '1') {
32
- await opts.login();
33
- return;
33
+ action = 'login';
34
+ }
35
+ else if (answer === '2') {
36
+ action = 'help';
34
37
  }
35
- if (answer === '2')
36
- opts.showHelp();
37
38
  }
38
39
  finally {
39
40
  rl.close();
40
41
  }
42
+ // Login may open its own post-login prompt, so release stdin first.
43
+ if (action === 'login')
44
+ await opts.login();
45
+ else if (action === 'help')
46
+ opts.showHelp();
41
47
  }
42
48
  export async function runDefaultFirstRunMenu(params) {
43
49
  const baseUrl = resolveBaseUrl({ staging: params.staging });
package/dist/lib/hints.js CHANGED
@@ -1,7 +1,19 @@
1
1
  import { access, mkdir, readFile, rename, writeFile, chmod } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { getConfigDir } from './config.js';
4
- const SKILL_HINT = 'Tip: teach your coding agent this CLI — run: every skills install claude|codex (shown once)';
4
+ const GENERIC_SKILL_TARGET = 'claude|codex';
5
+ function skillHintTargetForEnv(env) {
6
+ if (env.CLAUDECODE !== undefined)
7
+ return 'claude';
8
+ if (Object.keys(env).some((key) => key.startsWith('CODEX_') && env[key] !== undefined)) {
9
+ return 'codex';
10
+ }
11
+ return GENERIC_SKILL_TARGET;
12
+ }
13
+ export function skillHintForEnv(env = process.env) {
14
+ const target = skillHintTargetForEnv(env);
15
+ return `Tip: teach your coding agent this CLI — run: every skills install ${target} (shown once)`;
16
+ }
5
17
  function hintsPath() {
6
18
  return path.join(getConfigDir(), 'hints.json');
7
19
  }
@@ -14,7 +26,7 @@ async function pathExists(filePath) {
14
26
  return false;
15
27
  }
16
28
  }
17
- async function readHints() {
29
+ export async function readHints() {
18
30
  try {
19
31
  const parsed = JSON.parse(await readFile(hintsPath(), 'utf8'));
20
32
  return parsed && typeof parsed === 'object' ? parsed : {};
@@ -26,7 +38,7 @@ async function readHints() {
26
38
  return {};
27
39
  }
28
40
  }
29
- async function writeHints(value) {
41
+ export async function writeHints(value) {
30
42
  const filePath = hintsPath();
31
43
  await mkdir(path.dirname(filePath), { recursive: true, mode: 0o700 });
32
44
  const tempPath = `${filePath}.${process.pid}.tmp`;
@@ -35,10 +47,16 @@ async function writeHints(value) {
35
47
  await rename(tempPath, filePath);
36
48
  await chmod(filePath, 0o600);
37
49
  }
38
- async function localSkillInstalled() {
50
+ async function localSkillInstalled(env = process.env) {
39
51
  const cwd = process.cwd();
40
- return ((await pathExists(path.join(cwd, '.claude', 'skills', 'use-every'))) ||
41
- (await pathExists(path.join(cwd, '.agents', 'skills', 'use-every'))));
52
+ const target = skillHintTargetForEnv(env);
53
+ const claudeInstalled = () => pathExists(path.join(cwd, '.claude', 'skills', 'use-every'));
54
+ const codexInstalled = () => pathExists(path.join(cwd, '.agents', 'skills', 'use-every'));
55
+ if (target === 'claude')
56
+ return claudeInstalled();
57
+ if (target === 'codex')
58
+ return codexInstalled();
59
+ return (await claudeInstalled()) || (await codexInstalled());
42
60
  }
43
61
  export async function maybeShowSkillHint() {
44
62
  try {
@@ -47,7 +65,7 @@ export async function maybeShowSkillHint() {
47
65
  return;
48
66
  if (await localSkillInstalled())
49
67
  return;
50
- process.stderr.write(`${SKILL_HINT}\n`);
68
+ process.stderr.write(`${skillHintForEnv()}\n`);
51
69
  await writeHints({ ...hints, skill_hint_shown: true });
52
70
  }
53
71
  catch {
@@ -20,14 +20,14 @@ function overrideClassification(name) {
20
20
  return {
21
21
  level: 'ai-mediated',
22
22
  source: 'override',
23
- reason: 'ask_assistant routes to a write-capable Every AI agent despite its read-only annotation.',
23
+ reason: 'ask_assistant is server-enforced read-only, but AI-mediated; prefer deterministic tools when available.',
24
24
  };
25
25
  }
26
- if (/^delete_|^void_/.test(name)) {
26
+ if (/^delete_|^void_|^cancel_/.test(name)) {
27
27
  return {
28
28
  level: 'destructive',
29
29
  source: 'override',
30
- reason: 'Tool name matches delete_/void_, which can remove or void account records.',
30
+ reason: 'Tool name matches delete_/void_/cancel_, which can remove, void, or cancel account records.',
31
31
  };
32
32
  }
33
33
  if (/^send_/.test(name)) {
@@ -44,6 +44,13 @@ function overrideClassification(name) {
44
44
  reason: 'record_payment changes financial records.',
45
45
  };
46
46
  }
47
+ if (name === 'run_recurring_invoice_now') {
48
+ return {
49
+ level: 'destructive',
50
+ source: 'override',
51
+ reason: 'Running a recurring invoice now may immediately send an invoice email.',
52
+ };
53
+ }
47
54
  return undefined;
48
55
  }
49
56
  export function classify(tool) {
@@ -69,9 +76,9 @@ export function classify(tool) {
69
76
  }
70
77
  if (openWorld) {
71
78
  return {
72
- level: 'destructive',
79
+ level: 'write',
73
80
  source: 'annotation',
74
- reason: 'Tool annotation marks it open-world and not read-only.',
81
+ reason: 'Tool annotation marks it open-world and not read-only; defaulting to write.',
75
82
  };
76
83
  }
77
84
  return {
@@ -87,7 +94,7 @@ function readOnlyDenial(level) {
87
94
  return `Denied by read-only mode (--read-only/EVERY_READ_ONLY=1): ${level} tools are not allowed.`;
88
95
  }
89
96
  function aiMediatedExplanation() {
90
- return "This tool sends your request to Every's AI agent, which can take actions on your account; it is not mechanically read-only.";
97
+ return "This tool is server-enforced read-only, but routes through Every's AI agent; prefer deterministic tools when available.";
91
98
  }
92
99
  export function requirementFor(level, { interactive, yes, allowDestructive, readOnlyMode }) {
93
100
  if (level === 'read')
@@ -101,9 +108,10 @@ export function requirementFor(level, { interactive, yes, allowDestructive, read
101
108
  if (interactive)
102
109
  return { allowed: true, prompt: 'confirm' };
103
110
  const prefix = level === 'ai-mediated' ? `${aiMediatedExplanation()} ` : '';
111
+ const action = level === 'ai-mediated' ? 'AI-mediated request' : 'write';
104
112
  return {
105
113
  allowed: false,
106
- denialMessage: `${prefix}Re-run with --yes to confirm this write.`,
114
+ denialMessage: `${prefix}Re-run with --yes to confirm this ${action}.`,
107
115
  };
108
116
  }
109
117
  if (yes && allowDestructive)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everyai/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "description": "The agent-agnostic command-line surface for Every AI.",
6
6
  "type": "module",
@@ -1,21 +1,28 @@
1
1
  ---
2
2
  name: use-every
3
- description: Drive the Every AI CLI (`every`) to manage the user's business — invoices, clients, contacts, proposals, deals, pipeline, payments. Use when the user asks to look up, create, update, or send any of those, or mentions their Every workspace.
3
+ description: Drive the Every AI CLI (`every`) to manage the user's service business — invoices, clients, contacts, proposals, deals, pipeline, payments, services, and bookings. Use when the user asks “who owes me money?”, wants a lead or deal follow-up, asks to look up, create, update, convert, or send a business record, or mentions their Every workspace.
4
4
  ---
5
5
 
6
6
  # Use Every
7
7
 
8
8
  ## Setup Check
9
9
 
10
- Run `every --version` first. If the CLI is missing, suggest `npm install -g @everyai/cli`. If any authenticated command exits `3`, tell the user to run `every login` (it opens their browser; you cannot complete it for them).
10
+ Run `every --version` first. If the CLI is missing, suggest `npm i -g @everyai/cli`. If any authenticated command exits `3`, tell the user to run `every login` (it opens their browser; you cannot complete it for them).
11
+
12
+ For headless use, accept `EVERY_TOKEN` from the environment instead of browser login. Never print, log, or persist the token.
11
13
 
12
14
  ## What Every Is
13
15
 
14
- Use Every as an SMB business-ops workspace for invoices, clients, contacts, proposals, deals, payments, and pipeline work.
16
+ Use Every as a service-business workspace for the sales pipeline, deals, contacts and clients, proposals, invoices, payments, services, and bookings. The authenticated CLI operates on one connected Every workspace at a time. If the user means a different business, tell them to switch accounts in Every.
17
+
18
+ ## Required Workflow
15
19
 
16
- Use the `every` CLI as authenticated access to the user's Every workspace from any coding agent shell. Assume the user must have run `every login` once before authenticated commands can work.
20
+ 1. Resolve records with list/view commands. Never guess an ID; use the exact ID returned in `[id: ...]`. If a name is ambiguous, show the candidates and ask.
21
+ 2. Before a write, state exactly what will be created or changed, including amounts and recipients.
22
+ 3. Get explicit approval before anything client-visible or financially consequential, including sends, deletes, voids, and recording payments.
23
+ 4. Execute with complete inputs, then echo the returned number, status, total, and `public_url`. Suggest the natural next step. Share only `public_url` links with clients, never internal IDs.
17
24
 
18
- ## Conventions
25
+ ## CLI Contract
19
26
 
20
27
  Always pass `--json`. Parse the envelope every time:
21
28
 
@@ -27,18 +34,15 @@ Always pass `--json`. Parse the envelope every time:
27
34
  Check process exit codes:
28
35
 
29
36
  - `0`: success.
37
+ - `1`: tool or generic error. Read the error message before deciding whether to retry.
30
38
  - `2`: usage error. Fix the command or arguments.
31
39
  - `3`: auth error. Tell the user to run `every login`.
32
- - `4`: permission or confirmation needed. Ask the user before adding confirmation flags.
40
+ - `4`: permission or confirmation needed. Ask before adding confirmation flags.
33
41
  - `5`: rate limited. Back off and retry later.
34
42
  - `6`: not found. Re-list records and verify the ID.
35
43
  - `7`: network error. Retry after checking connectivity.
36
44
 
37
- Never infer or guess IDs. List first, then act only with the exact ID shown in the result, such as `[id: ...]`.
38
-
39
- ## Discovery
40
-
41
- Use these commands to discover current tools and policy:
45
+ Use current tool schemas rather than assuming arguments:
42
46
 
43
47
  ```bash
44
48
  every docs
@@ -51,52 +55,157 @@ every policy explain <name> --json
51
55
 
52
56
  Run read tools freely.
53
57
 
54
- For WRITE tools, add `--yes` only when the human user explicitly asked for the change.
58
+ For WRITE tools, add `--yes` only when the human explicitly asked for the change.
55
59
 
56
- For DESTRUCTIVE tools, including sends, deletes, voids, and payments, add both `--yes` and `--allow-destructive` only when the human user explicitly asked for that external or irreversible action. Never add `--allow-destructive` unprompted.
60
+ For DESTRUCTIVE tools, including sends, deletes, voids, and payments, add both `--yes` and `--allow-destructive` only when the human explicitly asked for that external or irreversible action. Never add `--allow-destructive` unprompted.
57
61
 
58
- `every whoami --json` reports the authenticated user, org, environment, base URL, and tool count. Write results echo the target org so you can confirm the blast radius before trusting the result.
62
+ Use `every whoami --json` to verify the authenticated user, org, environment, base URL, and tool count. Write results echo the target org; confirm the blast radius before trusting them. In automation, prefer `--read-only` unless writes were requested.
59
63
 
60
- In automation, prefer `--read-only` unless writes were requested.
64
+ `ask_assistant` is a server-enforced read-only analytical fallback; prefer deterministic tools for actions.
61
65
 
62
- Treat `ask_assistant` as AI-mediated. It routes to Every's agent and can act on the account. Prefer deterministic tools. Do not use `ask_assistant` in read-only automation.
66
+ ## Domain Rules
63
67
 
64
- ## Canonical Workflows
68
+ ### Deal activity auto-tracking is creation-only
69
+
70
+ Creating a proposal, invoice, or booking automatically records activity on a matching deal when exactly one deal/client matches. After an Every creation command, never double-log that action:
71
+
72
+ ```bash
73
+ every invoice create --client-id <client_id> --amount 100 --yes --json
74
+ every tool call create_proposal --args proposal.json --yes --json
75
+ ```
76
+
77
+ Use `log_deal_activity` ONLY for a completed outside event the user reports, such as a call, meeting, or email/DM thread. Never use it for an action performed through Every tools:
78
+
79
+ ```bash
80
+ every deal list --search "Acme" --json
81
+ every tool call log_deal_activity --arg deal_id=<deal_id> --arg note="Call completed; client approved scope" --yes --json
82
+ ```
83
+
84
+ ### Won deals require completed client promotion
85
+
86
+ Pipeline stages are `lead`, `opportunity`, `won`, and `lost`:
87
+
88
+ ```bash
89
+ every deal move <deal_id> won --yes --json
90
+ ```
91
+
92
+ Moving to `won` requires completed client promotion. No CLI or chat tool can set that promotion. If the command returns a client-resolution error, tell the user to finish converting the contact to a client in the Every app, then retry the same command.
93
+
94
+ ### Invoice rates and tax
95
+
96
+ Treat `unit_price` as the per-unit rate, not the line total. The simple CLI's `--amount` maps to that per-unit rate:
97
+
98
+ ```bash
99
+ every invoice create --client-id <client_id> --description "Workshop" --quantity 3 --amount 100 --yes --json
100
+ every tool call create_invoice --arg client_id=<client_id> --arg line_items='[{"description":"Workshop","quantity":3,"unit_price":100}]' --yes --json
101
+ ```
102
+
103
+ Leave `sales_tax_applied` unset so the business default applies. Never add tax as a line item. When currency, tax, or timezone matters, read settings first with `every tool call business_settings --json`; let Every compute tax, numbering, due dates, and totals.
104
+
105
+ ### Proposal to invoice
106
+
107
+ Only issued or approved proposals convert. View the proposal first, use the conversion tool so the linkage is preserved, and never re-create the invoice manually:
108
+
109
+ ```bash
110
+ every tool call view_proposal --arg identifier=<proposal_id> --json
111
+ every tool call convert_proposal_to_invoice --arg proposal_id=<proposal_id> --yes --json
112
+ ```
65
113
 
66
- Review pipeline:
114
+ Conversion creates a linked DRAFT invoice. Review the returned invoice ID, then send only after the user approves:
67
115
 
68
116
  ```bash
69
- every deal list --json
70
- every tool call view_deal --arg deal_id=<id> --json
117
+ every tool call view_invoice --arg identifier=<invoice_id> --json
118
+ every invoice send <invoice_id> --yes --allow-destructive --json
71
119
  ```
72
120
 
73
- Move a deal:
121
+ ### Invoice re-sends
122
+
123
+ `send_invoice` re-sends the invoice email itself; it does not send custom reminder copy. For an overdue follow-up, confirm with the user, re-send the invoice, and give any custom message separately for the user to send:
124
+
125
+ ```bash
126
+ every invoice send <invoice_id> --yes --allow-destructive --json
127
+ ```
128
+
129
+ ### Gmail is draft-first
130
+
131
+ Prefer `draft_email` so the user can review recipients and copy. `send_email` sends immediately from the user's own mailbox; use it only after explicit approval with both destructive flags.
132
+
133
+ ### Calendar and booking ownership
134
+
135
+ Calendar tools operate on the user's personal calendar. Confirm attendees and timezone before creating; reschedules and cancellations can notify attendees according to `send_updates`, so state that effect before acting.
136
+
137
+ Booking create, reschedule, and cancel tools are owner-actions. Resolve the booking and check availability first, then confirm the customer-visible time change or cancellation before executing it.
138
+
139
+ ### Prospecting reads
140
+
141
+ Use `list_prospects`, `view_prospect`, and `network_summary` to research the user's network. Treat the returned personal and relationship context as private; these tools do not contact prospects.
142
+
143
+ ### Stored briefs and reports
144
+
145
+ `get_daily_brief` and `get_heartbeat_summary` read stored artifacts for the authenticated caller only; do not imply they regenerate or share a brief. Use `get_financial_report` for the server-computed financial view and preserve its reported period and currency.
146
+
147
+ ### Recurring invoices
148
+
149
+ List and inspect recurring invoices before changing their schedule or status. Creating, updating, pausing, and resuming are writes; `run_recurring_invoice_now` is destructive because it may auto-send an invoice email when that schedule is configured to send.
150
+
151
+ ### Complete money totals
152
+
153
+ For invoice counts or money totals, filter `overdue` and `issued` separately and paginate until every result is fetched. Never total one default page; it gives confidently wrong numbers. Use the full tool so you can increment `offset` by `limit` until a page returns fewer records than the limit:
74
154
 
75
155
  ```bash
76
- every deal move <id> <stage> --yes --json
156
+ every tool call list_invoices --arg payment_status=overdue --arg limit=100 --arg offset=0 --json
157
+ every tool call list_invoices --arg status=issued --arg limit=100 --arg offset=0 --json
77
158
  ```
78
159
 
79
- Invoice flow:
160
+ Repeat each command with offsets `100`, `200`, and so on until complete. Report the two filtered totals separately unless the user asks for a different calculation.
161
+
162
+ ## Canonical Workflows
163
+
164
+ Review the pipeline:
80
165
 
81
166
  ```bash
82
- every invoice list --status overdue --json
83
- every invoice create --client "Acme" --amount 100 --yes --json
84
- every invoice send <id> --yes --allow-destructive --json
167
+ every tool call get_pipeline_summary --json
168
+ every deal list --stage opportunity --json
169
+ every tool call view_deal --arg deal_id=<deal_id> --json
170
+ every deal move <deal_id> <stage> --yes --json
85
171
  ```
86
172
 
87
- For rich invoices with multiple line items, tax, dates, currency, or notes, use the full tool fallback:
173
+ Recommend follow-ups before moving anything. Log only outside events the user reports; creation of proposals, invoices, and bookings is already tracked.
174
+
175
+ Invoice flow: find who owes money:
88
176
 
89
177
  ```bash
90
- every tool call create_invoice --arg client_id=<id> --arg line_items='[{"description":"Work","quantity":1,"unit_price":100}]' --yes --json
178
+ every tool call list_invoices --arg payment_status=overdue --arg limit=100 --arg offset=0 --json
179
+ every tool call list_invoices --arg status=issued --arg limit=100 --arg offset=0 --json
180
+ every tool call view_invoice --arg identifier=<invoice_id> --json
91
181
  ```
92
182
 
93
- Contacts:
183
+ Paginate both filtered lists completely, then report client, invoice number, balance, due date, and totals. Offer to re-send an invoice after confirmation or record a payment only when the user reports it received.
184
+
185
+ Convert an accepted proposal:
94
186
 
95
187
  ```bash
96
- every contact list --search "acme" --json
188
+ every tool call view_proposal --arg identifier=<proposal_id> --json
189
+ every tool call convert_proposal_to_invoice --arg proposal_id=<proposal_id> --yes --json
190
+ every tool call view_invoice --arg identifier=<invoice_id> --json
191
+ every invoice send <invoice_id> --yes --allow-destructive --json
97
192
  ```
98
193
 
99
- ## Recovery And Debug
194
+ Stop if the proposal is not issued/approved. Review the linked draft and obtain approval before sending.
195
+
196
+ Intake a new lead:
197
+
198
+ ```bash
199
+ every contact list --search "person@example.com" --json
200
+ every tool call create_contact --args contact.json --yes --json
201
+ every tool call create_deal --args deal.json --yes --json
202
+ ```
203
+
204
+ Search contacts first because email deduplication is real. Create only missing records, then progress the deal as the relationship develops.
205
+
206
+ For a general activity snapshot, combine complete/paginated invoice reads with recent payments and expenses. Use the currency from `business_settings`; if any source is only a partial page, describe it as recent activity rather than a definitive cash position.
207
+
208
+ ## Recovery and Debugging
100
209
 
101
210
  Use these commands when auth, identity, or connectivity is unclear:
102
211
 
@@ -107,6 +216,4 @@ every ping --json
107
216
  every logout && every login
108
217
  ```
109
218
 
110
- ## Staging
111
-
112
219
  Use `--staging` only for Every's staging environment. Treat it as internal/testing only.