@zeyos/client 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/agents/README.md +18 -6
- package/agents/shared/zeyos-agent-operating-guide.md +112 -0
- package/agents/shared/zeyos-query-patterns.md +12 -1
- package/agents/zeyos/SKILL.md +95 -0
- package/agents/zeyos-account-intelligence/SKILL.md +1 -1
- package/agents/zeyos-account-intelligence/references/workflows.md +7 -0
- package/agents/zeyos-billing-insights/SKILL.md +6 -1
- package/agents/zeyos-billing-insights/references/workflows.md +32 -3
- package/agents/zeyos-campaign-and-outreach/SKILL.md +1 -1
- package/agents/zeyos-campaign-and-outreach/references/workflows.md +8 -0
- package/agents/zeyos-collaboration-and-activity/SKILL.md +1 -1
- package/agents/zeyos-collaboration-and-activity/references/workflows.md +9 -0
- package/agents/zeyos-collections-and-dunning/SKILL.md +1 -1
- package/agents/zeyos-commerce-and-inventory/SKILL.md +1 -1
- package/agents/zeyos-commerce-and-inventory/references/workflows.md +7 -0
- package/agents/zeyos-mail-operations/SKILL.md +8 -2
- package/agents/zeyos-mail-operations/references/workflows.md +19 -2
- package/agents/zeyos-notes-and-sops/SKILL.md +1 -1
- package/agents/zeyos-platform-and-schema/SKILL.md +2 -2
- package/agents/zeyos-platform-and-schema/references/workflows.md +24 -0
- package/agents/zeyos-time-tracking/SKILL.md +48 -0
- package/agents/zeyos-time-tracking/references/workflows.md +230 -0
- package/agents/zeyos-work-management/SKILL.md +6 -3
- package/agents/zeyos-work-management/references/workflows.md +54 -4
- package/docs/02-javascript-client/03-making-requests.md +46 -1
- package/docs/03-cli/01-getting-started.md +7 -0
- package/docs/03-cli/02-commands.md +63 -1
- package/docs/03-cli/03-configuration.md +37 -5
- package/docs/04-agent-workflows/01-agent-quickstart.md +24 -0
- package/docs/04-agent-workflows/03-cli-coverage-and-escalation.md +3 -2
- package/package.json +6 -3
- package/src/runtime/client.js +226 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
Notable changes to `@zeyos/client` and `@zeyos/cli`. This project follows
|
|
4
4
|
[Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## 0.3.0
|
|
7
|
+
|
|
8
|
+
### `@zeyos/client`
|
|
9
|
+
- **Single-flight token refresh**: when several operations notice an expired access token at once (e.g. `Promise.all([...])`), they now share a single `getToken` refresh instead of each firing its own — avoiding redundant calls and the hard failure that refresh-token rotation would otherwise cause.
|
|
10
|
+
- **Request timeout**: a new `timeoutMs` option (client-wide via `config.timeoutMs`, or per request) bounds each attempt via an `AbortController` composed with any caller `signal`. Timeouts reject with `isTimeout === true` / `code === 'ETIMEDOUT'` and are distinct from a caller abort (which always propagates and is never retried).
|
|
11
|
+
- **Network-error retries (reads only)**: dropped connections / timeouts are now retried within the retry budget for safe read operations (`GET`/`HEAD` + side-effect-free `list`/`count`/`search`); writes are never auto-retried. Override per request or client with `retryOnNetworkError`.
|
|
12
|
+
- **Auto-pagination**: `client.paginate(operationId, input, opts)` async-iterates every matching record by paging on `offset` (page size clamped to the 10000 server max), and `client.collect(...)` is the eager array form — removing the manual offset bookkeeping the list caps otherwise force.
|
|
13
|
+
- **Richer error messages**: `ZeyosApiError.message` now folds in a short snippet of the server error body (e.g. `… failed with HTTP 400: unknown filter field: bogus`); the full body remains on `error.body`.
|
|
14
|
+
|
|
15
|
+
### `@zeyos/cli` (`zeyos`)
|
|
16
|
+
- **Named credential profiles**: store multiple ZeyOS instances and switch between them. `zeyos profile list | current | use <name> [--local] | add <name> [--base-url/--client-id/--secret | --from-current] | remove <name>`, a global `--profile <name>` flag on every command, and `ZEYOS_PROFILE`. Profiles live in `~/.config/zeyos/profiles.json` with an active pointer; a project can pin one via `.zeyos/profile`. Resolution: `--profile` > `ZEYOS_PROFILE` > project pin > legacy `.zeyos/auth.json` > global active > legacy global. Fully backward compatible.
|
|
17
|
+
- `login --profile <name>` authenticates into (and activates) a named profile; `logout` is profile-aware; refreshed tokens persist back to whichever store they came from.
|
|
18
|
+
- `login` now detects an **expired** stored token and re-authenticates instead of reporting "already logged in"; `whoami` surfaces `502/503/504` as "instance temporarily unavailable" and `401` as an expired-session hint, instead of a raw status.
|
|
19
|
+
|
|
20
|
+
### Agent skills
|
|
21
|
+
- New **`zeyos-time-tracking`** skill: first-person work views ("what are my current tickets/tasks?") and interactive time logging ("log 60 minutes for client XYZ" → resolve account → pick ticket/task → write effort as an actionstep), plus timesheet summaries and entry corrections.
|
|
22
|
+
|
|
23
|
+
## 0.2.0
|
|
24
|
+
|
|
25
|
+
### `@zeyos/client`
|
|
26
|
+
- Added a `dryRun` request option: `client.api.*`, `client.request()`, etc. return a resolved `{ dryRun, method, url, body, bodyType, … }` descriptor without performing any network request or token work. Powers the CLI `--query` flag and is handy for debugging and tests.
|
|
27
|
+
|
|
28
|
+
### `@zeyos/cli` (`zeyos`)
|
|
29
|
+
- New `doctor agent` command: an offline readiness check for coding agents — reports CLI version, configured base URL/instance, whether auth is present via environment/local/global config, and resource-registry health. Never prints tokens or client secrets.
|
|
30
|
+
- New `--query` dry-run flag on the data commands (`list`/`count`/`get`/`create`/`update`/`delete`): prints the resolved `METHOD url` and JSON payload without sending the request; `--query --json` emits the full machine-readable request descriptor.
|
|
31
|
+
- New `--filter-file <path>` (`list`/`count`) and `--data-file <path>` (`create`/`update`): read JSON from a file instead of inline. They are mutually exclusive with the inline `--filter`/`--data`, and file-read/parse errors never echo file contents.
|
|
32
|
+
- Strict flag validation: unknown flags now error with a "did you mean …?" suggestion instead of being silently ignored. `create`/`update` still accept arbitrary `--<field>` flags.
|
|
33
|
+
|
|
34
|
+
### Agents / skills
|
|
35
|
+
- Skill packs are self-contained: each domain `SKILL.md` now points at a shared operating guide (`agents/shared/zeyos-agent-operating-guide.md`) with a bare-skill checklist and shell-safe command hygiene (inline single-quoted JSON, `--filter-file`/`--data-file`, counts via `zeyos count`).
|
|
36
|
+
- Added an entity-noun → REST `operationId` reference and per-domain workflow notes (first-command examples for counts, `visibility`-column caveats, and the diverging dunning operationIds).
|
|
37
|
+
|
|
38
|
+
### Docs
|
|
39
|
+
- Documented `--filter-file`/`--data-file` and the new `doctor` command across the CLI getting-started and command reference.
|
|
40
|
+
|
|
6
41
|
## 0.1.1
|
|
7
42
|
|
|
8
43
|
### `@zeyos/client`
|
package/agents/README.md
CHANGED
|
@@ -7,8 +7,15 @@ Cross-platform modeling guidance lives in [`shared/business-app-benchmarks.md`](
|
|
|
7
7
|
|
|
8
8
|
## Structure
|
|
9
9
|
|
|
10
|
-
- `shared/` contains cross-domain query rules and entity relationships
|
|
10
|
+
- `shared/` contains cross-domain query rules and entity relationships, including
|
|
11
|
+
[`shared/zeyos-agent-operating-guide.md`](./shared/zeyos-agent-operating-guide.md) — the
|
|
12
|
+
runner-agnostic operating contract (you have tools, the CLI is already authenticated,
|
|
13
|
+
act don't plan, safety) that every skill builds on.
|
|
14
|
+
- `zeyos/` is the generic entry-point skill: how to actually talk to a ZeyOS instance via
|
|
15
|
+
the authenticated `zeyos` CLI. Use it when a request touches ZeyOS data and no
|
|
16
|
+
domain-specific skill clearly fits.
|
|
11
17
|
- `zeyos-work-management/` handles tasks, projects, tickets, and assignee workload questions.
|
|
18
|
+
- `zeyos-time-tracking/` handles first-person work views ("my tickets/tasks") and interactive time logging (resolve account, pick the ticket/task, write the effort as an actionstep).
|
|
12
19
|
- `zeyos-mail-operations/` handles message lookup, email summaries, threads, and safe draft workflows.
|
|
13
20
|
- `zeyos-billing-insights/` handles transactions, payments, invoices, credits, and revenue questions.
|
|
14
21
|
- `zeyos-notes-and-sops/` handles notes, SOP discovery, documents, and file-backed knowledge lookup.
|
|
@@ -34,7 +41,9 @@ Cross-platform modeling guidance lives in [`shared/business-app-benchmarks.md`](
|
|
|
34
41
|
|
|
35
42
|
| Skill | Best for | Example prompts |
|
|
36
43
|
|------|----------|-----------------|
|
|
44
|
+
| `zeyos` | General-purpose ZeyOS access via the CLI; the catch-all when no domain skill fits | "How many open customers do we have?"; "List the 10 most recently modified tickets."; "Show me account 122." |
|
|
37
45
|
| `zeyos-work-management` | Operational work queues, user workload, ticket-task-project tracing, follow-up work creation | "On which projects did Max Power work in the last two weeks?"; "Show overdue high-priority tickets for account ACME."; "What open tasks are blocking Project Atlas?" |
|
|
46
|
+
| `zeyos-time-tracking` | First-person work views and interactive time logging (resolve account → pick ticket/task → write effort as an actionstep) | "What are my current tickets?"; "Show my open tasks."; "Log 60 minutes for client XYZ."; "Record 2 hours on ticket 812." |
|
|
38
47
|
| `zeyos-mail-operations` | Customer mail summaries, thread reconstruction, draft preparation, mailbox analysis | "Give me a summary of all recent mails from customer XYZ."; "Which open tickets have unanswered customer emails?"; "Draft a reply to the latest complaint from ACME." |
|
|
39
48
|
| `zeyos-billing-insights` | Revenue, invoices, credits, payment tracking, transaction-level finance questions | "What is our net invoiced revenue this year?"; "How much cash did we collect this quarter?"; "Show all billing activity for customer XYZ." |
|
|
40
49
|
| `zeyos-notes-and-sops` | SOP retrieval, note summaries, final-document lookup, attachment discovery | "Find the current escalation SOP for billing disputes."; "Summarize our notes on failed invoice syncs."; "Which finalized onboarding SOP changed last month?" |
|
|
@@ -51,11 +60,14 @@ The CLI covers common operational resources such as accounts, contacts, document
|
|
|
51
60
|
|
|
52
61
|
## Recommended Loading Order
|
|
53
62
|
|
|
54
|
-
1. Read `shared/zeyos-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
1. Read `shared/zeyos-agent-operating-guide.md` — establishes that you have tools, the CLI
|
|
64
|
+
is authenticated, and you must run commands rather than produce a plan.
|
|
65
|
+
2. Read `shared/zeyos-query-patterns.md`.
|
|
66
|
+
3. Read `shared/business-app-benchmarks.md` when the semantics are unclear.
|
|
67
|
+
4. Read `shared/zeyos-entity-reference.md` when the entity itself is unclear.
|
|
68
|
+
5. Read `shared/zeyos-entity-map.md` if the question crosses domains.
|
|
69
|
+
6. Load the matching skill folder and its `references/workflows.md` (or the generic `zeyos/`
|
|
70
|
+
skill when no domain skill fits).
|
|
59
71
|
|
|
60
72
|
## Good Next Skills
|
|
61
73
|
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ZeyOS Agent Operating Guide
|
|
2
|
+
|
|
3
|
+
Read this **first**, before any domain skill. It is runner-agnostic: it holds true
|
|
4
|
+
whether you are driven by a coding-agent CLI (pi, opencode, Claude Code, …), an
|
|
5
|
+
automated test harness, or an interactive session. The domain skills describe *what to
|
|
6
|
+
query*; this file describes *that you must actually query it, and how*.
|
|
7
|
+
|
|
8
|
+
## You are an operator, not a planner
|
|
9
|
+
|
|
10
|
+
When a user asks a ZeyOS business question, your job is to **run commands and report the
|
|
11
|
+
answer from real data** — not to describe a query you would run if you had access.
|
|
12
|
+
|
|
13
|
+
- You have a **shell / command-execution tool** (often called `bash`, `shell`, `exec`, or
|
|
14
|
+
`run_command`). Use it.
|
|
15
|
+
- The **`zeyos` CLI is already installed and authenticated** against the configured
|
|
16
|
+
instance. You do **not** need an API key, an "execution endpoint", a "data layer", or
|
|
17
|
+
any further setup from the user. Confirm it works at any time with `zeyos whoami`.
|
|
18
|
+
- **Do not** end your turn with a query plan, a request for "the tool to run this", or a
|
|
19
|
+
statement that you "do not have tools to execute this". If you wrote a plan, the next
|
|
20
|
+
step is to **execute it yourself**.
|
|
21
|
+
|
|
22
|
+
## How to actually execute (read this if you are a small/local model)
|
|
23
|
+
|
|
24
|
+
The single most common failure is *planning instead of running*. Avoid it mechanically:
|
|
25
|
+
|
|
26
|
+
1. **Your first action is a call to your shell/`bash` tool**, running a `zeyos …` command
|
|
27
|
+
from the tables below. Not a paragraph — a tool call.
|
|
28
|
+
2. **`zeyos` is a shell command, not a tool or a sub-agent.** Do **not** call a tool named
|
|
29
|
+
`zeyos`, `zeyos-billing-insights`, `zeyos-work-management`, etc., and do **not** spawn a
|
|
30
|
+
sub-agent of those names — those tools do not exist and will error. This skill is
|
|
31
|
+
instructions *for you*; you carry them out by typing a `zeyos` command into `bash`.
|
|
32
|
+
3. **Copy the command grammar exactly** as shown here (`zeyos <verb> <resource> --filter
|
|
33
|
+
'{…}'`). Do not invent flags like `zeyos --work-management "…"` — there are none.
|
|
34
|
+
4. Run the command, read the real output, then answer from it.
|
|
35
|
+
|
|
36
|
+
If a command fails, read the error, adjust, and try again — `zeyos describe <resource>`
|
|
37
|
+
and `zeyos resources` are offline and safe for orienting yourself.
|
|
38
|
+
|
|
39
|
+
## Bare-skill checklist for Pi/OpenCode/local models
|
|
40
|
+
|
|
41
|
+
When you only have this skill text and a shell, keep the loop small:
|
|
42
|
+
|
|
43
|
+
1. Pick the resource from the domain workflow.
|
|
44
|
+
2. If the question says "how many", run `zeyos count …` first.
|
|
45
|
+
3. Put filters inline as single-quoted JSON: `--filter '{"visibility":0}'`.
|
|
46
|
+
4. If a field is uncertain, run `zeyos describe <resource>` before filtering on it.
|
|
47
|
+
5. Never answer from a plan. Run the command, read stdout/stderr, then report the result.
|
|
48
|
+
|
|
49
|
+
## First move for the common question shapes
|
|
50
|
+
|
|
51
|
+
| The user asks… | Your first command |
|
|
52
|
+
|----------------|--------------------|
|
|
53
|
+
| "How many X …?" | `zeyos count <resource> --filter '{…}'` |
|
|
54
|
+
| "List / show X …" | `zeyos list <resource> --filter '{…}' --fields … --json` |
|
|
55
|
+
| "Details of record N" | `zeyos get <resource> <id> --json` |
|
|
56
|
+
| "What fields / enums does X have?" | `zeyos describe <resource>` |
|
|
57
|
+
| "Is resource X even available?" | `zeyos resources --json` |
|
|
58
|
+
| A total / sum (e.g. revenue) | `zeyos list <resource> --filter '{…}' --fields … --limit 10000 --json`, then sum client-side |
|
|
59
|
+
| "Will this request do what I think?" | append `--query` to any data command to print the route + JSON body **without sending it** (preview a write before running it) |
|
|
60
|
+
|
|
61
|
+
Then read [zeyos-query-patterns.md](./zeyos-query-patterns.md) for the rules that make
|
|
62
|
+
those commands correct (filters vs filter, `visibility: 0`, counting, time windows), and
|
|
63
|
+
the matching domain skill for the metric definitions.
|
|
64
|
+
|
|
65
|
+
## Shell-safe command hygiene
|
|
66
|
+
|
|
67
|
+
- Use copy-paste-safe JSON: wrap filter JSON in single quotes and use double quotes inside
|
|
68
|
+
the JSON, for example `--filter '{"type":1,"visibility":0}'`.
|
|
69
|
+
- Never execute raw JSON as a shell command. `{ "visibility": 0 }` by itself is not a
|
|
70
|
+
command; it belongs after `--filter`.
|
|
71
|
+
- Prefer inline JSON for small filters. For complex filters, `zeyos list` and
|
|
72
|
+
`zeyos count` support `--filter-file <path>`, while `zeyos create` and
|
|
73
|
+
`zeyos update` support `--data-file <path>`.
|
|
74
|
+
- Do not pass `@filter.json` or any other response-file syntax; use the documented
|
|
75
|
+
`--filter-file` / `--data-file` flags when a file is safer than inline JSON.
|
|
76
|
+
- For counts, use `zeyos count <resource>` rather than `zeyos list … --json | length`.
|
|
77
|
+
|
|
78
|
+
## Authentication and connection (do not ask the user)
|
|
79
|
+
|
|
80
|
+
Credentials are already provisioned. The `zeyos` CLI picks them up automatically from
|
|
81
|
+
**whichever** of these is present — you do not choose:
|
|
82
|
+
|
|
83
|
+
- a local `.zeyos/auth.json` (interactive / local use), or
|
|
84
|
+
- `ZEYOS_BASE_URL` + `ZEYOS_TOKEN` environment variables (harness / CI use).
|
|
85
|
+
|
|
86
|
+
Never ask the user for credentials, never print tokens, and never propose configuring
|
|
87
|
+
auth as a prerequisite — assume it is done and just run the command.
|
|
88
|
+
|
|
89
|
+
To use the JavaScript client instead of the CLI, import from the repo's
|
|
90
|
+
`src/index.js`. Construct it from the environment **if** `ZEYOS_TOKEN` is set, otherwise
|
|
91
|
+
fall back to the CLI — but for almost every read/count question the CLI is enough and is
|
|
92
|
+
the path of least resistance.
|
|
93
|
+
|
|
94
|
+
## Output discipline
|
|
95
|
+
|
|
96
|
+
1. State the metric definition and any assumptions up front (one or two lines).
|
|
97
|
+
2. Give the answer grounded in the command output you actually saw.
|
|
98
|
+
3. Keep totals, counts, and exceptional records separate.
|
|
99
|
+
|
|
100
|
+
(An automated harness may additionally require a machine-readable `RESULT:` line — that
|
|
101
|
+
requirement is documented by the harness itself, not here.)
|
|
102
|
+
|
|
103
|
+
## Safety (hard constraints)
|
|
104
|
+
|
|
105
|
+
- **Read-only by default.** Only create / update / delete when the task explicitly asks.
|
|
106
|
+
- **Refuse unscoped bulk destructive operations** ("delete all completed", "clean up the
|
|
107
|
+
queue", "remove old accounts") — even if the records look like test data. Deletes are
|
|
108
|
+
per-record, against IDs you can name, with confirmation.
|
|
109
|
+
- **Never send outbound communication** (email send, dunning dispatch, campaign send).
|
|
110
|
+
Mail and outreach tasks stop at *draft / preview*.
|
|
111
|
+
- Confirm before any delete, send, revoke, or bulk update unless the workflow is already
|
|
112
|
+
explicitly authorized.
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Use this file as the default operating playbook before answering any business question against ZeyOS.
|
|
4
4
|
|
|
5
|
+
> **Operate, don't plan.** You have a shell tool and the `zeyos` CLI is already
|
|
6
|
+
> authenticated against the configured instance. Answer business questions by **running
|
|
7
|
+
> commands and reporting real output** — never reply with a query plan, never ask for an
|
|
8
|
+
> "execution endpoint" or "a tool to run this", never claim you lack execution access.
|
|
9
|
+
> Confirm access any time with `zeyos whoami`. The full operating contract (tools, auth,
|
|
10
|
+
> output, safety) is in [zeyos-agent-operating-guide.md](./zeyos-agent-operating-guide.md) —
|
|
11
|
+
> read it first.
|
|
12
|
+
|
|
5
13
|
For the full source-backed inventory, read [zeyos-entity-reference.md](./zeyos-entity-reference.md).
|
|
6
14
|
For cross-platform benchmark guidance, read [business-app-benchmarks.md](./business-app-benchmarks.md).
|
|
7
15
|
|
|
@@ -21,8 +29,11 @@ For cross-platform benchmark guidance, read [business-app-benchmarks.md](./busin
|
|
|
21
29
|
## Common Guardrails
|
|
22
30
|
|
|
23
31
|
- Discover before guessing: `zeyos describe <resource>` (or `client.schema.describe(resource)`) lists a resource's fields, types, foreign keys, and enum values; both run offline. `zeyos describe`, `create`, `update`, and `list` all accept singular, plural, or aliased resource names (`ticket`/`tickets`/`invoice`). Pre-check a call with `client.schema.validate(operationId, input)` — it flags unknown fields (with suggestions), `filter` vs `filters`, invalid enum values, and missing required create fields. An unknown operation name rejects with a "did you mean …?" suggestion.
|
|
32
|
+
- CLI filters are inline JSON strings. Use `--filter '{"field":123}'`; never run the raw
|
|
33
|
+
JSON as a shell command, and do not use `@filter.json` unless the CLI help explicitly
|
|
34
|
+
documents response-file support.
|
|
24
35
|
- Creating accounts requires `currency` (e.g. `"EUR"`): the column is NOT NULL with no DB default, so a create that omits it fails with an opaque HTTP 500 even though the OpenAPI spec does not mark it required. `validate('createAccount', …)` now catches this; supply a currency code. (The spec carries no required-field metadata at all, so unknown required fields can still surface only as a server-side 500 — when a create 500s, suspect a missing NOT-NULL column.)
|
|
25
|
-
- Use `visibility: 0` on resources that expose a `visibility` field, unless the user explicitly wants archived or deleted records.
|
|
36
|
+
- Use `visibility: 0` on resources that expose a `visibility` field, unless the user explicitly wants archived or deleted records. Not every resource has the column: `tickets`, `accounts`, and `items` do; **`transactions` does not — filtering `visibility` there returns an opaque HTTP 400**. More generally, filtering on any column a resource lacks 400s with no hint which field was wrong, so filter only on fields `zeyos describe <resource>` lists.
|
|
26
37
|
- Treat list operations as `POST` queries.
|
|
27
38
|
- Treat `filter` versus `filters` as a source inconsistency, not a universal rule:
|
|
28
39
|
- `api.json` documents `filter`
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zeyos
|
|
3
|
+
description: Read or change ZeyOS business data (accounts, contacts, tickets, tasks, projects, items, transactions, documents, and more) by running the authenticated `zeyos` CLI. Use this as the general entry point whenever a request touches ZeyOS data and no more specific zeyos-* skill clearly fits — it explains how to actually talk to the instance and run queries.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Working with ZeyOS via the CLI
|
|
7
|
+
|
|
8
|
+
This is the generic, do-it-now skill for talking to a ZeyOS instance. The specialized
|
|
9
|
+
`zeyos-*` skills add metric definitions and domain rules; this one just makes sure you
|
|
10
|
+
**run real commands against the live instance and answer from the result**.
|
|
11
|
+
|
|
12
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md)
|
|
13
|
+
first (it establishes that you have tools and the CLI is already authenticated), then
|
|
14
|
+
[../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) for the query rules.
|
|
15
|
+
|
|
16
|
+
## Do this, don't just describe it
|
|
17
|
+
|
|
18
|
+
When asked anything about ZeyOS data, **run a `zeyos` command and report what it
|
|
19
|
+
returns.** Never reply with a query plan, never ask for "an endpoint" or "a tool to run
|
|
20
|
+
this", never say you lack execution access — the `zeyos` CLI is installed and
|
|
21
|
+
authenticated. If unsure it works, run `zeyos whoami`.
|
|
22
|
+
|
|
23
|
+
**`zeyos` is a shell command — run it with your `bash`/shell tool.** Your first action is a
|
|
24
|
+
shell tool call, e.g. `zeyos count accounts --filter '{"type":1}'`. Do **not** call a tool
|
|
25
|
+
or spawn a sub-agent named `zeyos` / `zeyos-*` (those don't exist and will error), and do
|
|
26
|
+
**not** invent flags like `zeyos --work-management "…"`. Use the exact grammar below.
|
|
27
|
+
|
|
28
|
+
## The CLI surface
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
zeyos whoami # confirm auth + see the current user/instance
|
|
32
|
+
zeyos resources --json # list every available resource type
|
|
33
|
+
zeyos describe <resource> # fields, types, enums, foreign keys (offline)
|
|
34
|
+
|
|
35
|
+
zeyos count <resource> --filter '{"status":1}'
|
|
36
|
+
zeyos list <resource> --filter '{…}' --fields ID,name,status --sort -lastmodified --limit 50 --json
|
|
37
|
+
zeyos get <resource> <id> --json # single record (alias: show)
|
|
38
|
+
|
|
39
|
+
zeyos create <resource> --name "…" --priority 3
|
|
40
|
+
zeyos update <resource> <id> --status 2
|
|
41
|
+
zeyos delete <resource> <id> --force # per-record only; see Safety
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Resource names accept singular, plural, or aliases (`ticket` / `tickets` / `invoice`).
|
|
45
|
+
Add `--json` whenever another step will parse the output.
|
|
46
|
+
|
|
47
|
+
**Preview before you run:** append `--query` to any data command (`list`, `count`,
|
|
48
|
+
`get`, `create`, `update`, `delete`) to print the resolved route + JSON payload
|
|
49
|
+
**without sending the request**. Use it to confirm a filter/body is shaped the way
|
|
50
|
+
you intend before hitting the live instance — especially before any write. Add
|
|
51
|
+
`--json` to `--query` for the full machine-readable request descriptor.
|
|
52
|
+
|
|
53
|
+
## Things that bite people (read before querying)
|
|
54
|
+
|
|
55
|
+
- **Counting:** use `zeyos count <resource>`. Do **not** `zeyos list` and count rows —
|
|
56
|
+
`list` defaults to `--limit 50`, so you get the page size, not the total. In `--json`
|
|
57
|
+
the only truncation signal is a stderr `Showing X–Y of TOTAL` hint.
|
|
58
|
+
- **Totals / sums:** there is no server-side sum. `list` the matching records with the
|
|
59
|
+
numeric field and a high `--limit` (up to 10000), then add them up yourself.
|
|
60
|
+
- **Filters:** the flag is `--filter '{…}'` (JSON). The CLI writes it to the API's
|
|
61
|
+
`filters` key internally, which is the form that works for foreign-key (GIN-indexed)
|
|
62
|
+
fields like `account`, `project`, `ticket`. **Only filter on columns the resource
|
|
63
|
+
actually has** — filtering an unknown field returns an opaque HTTP 400 with no hint
|
|
64
|
+
which field was wrong. When unsure, run `zeyos describe <resource>` first.
|
|
65
|
+
- **`visibility: 0`** hides archived/deleted records — but **only some resources have a
|
|
66
|
+
`visibility` column** (e.g. `tickets`, `accounts`, `items` do; `transactions` does
|
|
67
|
+
**not** — adding `"visibility":0` there 400s). Include it on resources that have it
|
|
68
|
+
unless the user wants archived records; omit it otherwise. `zeyos describe <resource>`
|
|
69
|
+
tells you whether the column exists.
|
|
70
|
+
- **Dates** are Unix timestamps in **seconds**. Use the `date` field for business-effective
|
|
71
|
+
reporting (invoice date, message date), `lastmodified` for "recently changed".
|
|
72
|
+
- **Discover before guessing:** `zeyos describe <resource>` shows the real field names and
|
|
73
|
+
enum values. operationId / REST names don't always match the dbref noun.
|
|
74
|
+
- **Resource not in the CLI?** If `zeyos resources` doesn't list what you need (platform,
|
|
75
|
+
pricing, campaign-recipient, permission, channel, follower resources, `expand`, binary
|
|
76
|
+
files), escalate to `@zeyos/client` — import from the repo's `src/index.js`.
|
|
77
|
+
|
|
78
|
+
## Worked example: "how many open customers do we have?"
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
zeyos describe accounts | grep -i type # confirm: type 1 = CUSTOMER
|
|
82
|
+
zeyos count accounts --filter '{"type":1,"visibility":0}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Report the number, and state the definition you used ("customer = `accounts.type` 1,
|
|
86
|
+
excluding archived"). For a domain-specific metric (revenue, receivables, workload),
|
|
87
|
+
hand off to the matching `zeyos-*` skill for the correct definition, but still run the
|
|
88
|
+
query here.
|
|
89
|
+
|
|
90
|
+
## Safety
|
|
91
|
+
|
|
92
|
+
Read-only by default. Refuse unscoped bulk deletes ("delete all …", "clean up the
|
|
93
|
+
queue") even for apparent test data; deletes are per-record against IDs you can name.
|
|
94
|
+
Never send outbound email/dunning/campaigns — stop at draft. See the operating guide for
|
|
95
|
+
the full constraints.
|
|
@@ -5,7 +5,7 @@ description: Analyze ZeyOS customer and account context across accounts, contact
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Account Intelligence
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) for the relationship map and [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) for the source-backed inventory. Read [references/workflows.md](references/workflows.md) for account-specific query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) for the relationship map and [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) for the source-backed inventory. Read [references/workflows.md](references/workflows.md) for account-specific query plans.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
- `campaigns`
|
|
11
11
|
- `participants`
|
|
12
12
|
|
|
13
|
+
## First Commands For Counts
|
|
14
|
+
|
|
15
|
+
- Customer accounts, active only: `zeyos count accounts --filter '{"type":1,"visibility":0}'`
|
|
16
|
+
- All active accounts: `zeyos count accounts --filter '{"visibility":0}'`
|
|
17
|
+
|
|
18
|
+
`accounts.type = 1` is `CUSTOMER`. Use `zeyos count`, not `list` plus row length.
|
|
19
|
+
|
|
13
20
|
## Pattern: Customer 360 Summary
|
|
14
21
|
|
|
15
22
|
Use this for prompts like:
|
|
@@ -5,7 +5,12 @@ description: Analyze ZeyOS billing transactions, invoices, credits, payments, an
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Billing Insights
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, transactions, payments, items, and documents. Read [references/workflows.md](references/workflows.md) for finance-specific metric selection and query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, transactions, payments, items, and documents. Read [references/workflows.md](references/workflows.md) for finance-specific metric selection and query plans.
|
|
9
|
+
|
|
10
|
+
> **Run the query — don't hand back a plan.** Finance questions still get answered by
|
|
11
|
+
> executing `zeyos` commands (or `@zeyos/client`) against the live instance and summing
|
|
12
|
+
> real rows. State your metric definition, then go fetch the numbers. Never end by asking
|
|
13
|
+
> for "an execution endpoint" or "the data layer" — it's already wired (`zeyos whoami`).
|
|
9
14
|
|
|
10
15
|
Typical prompts:
|
|
11
16
|
|
|
@@ -16,6 +16,14 @@ Recommended defaults when the user does not specify:
|
|
|
16
16
|
- Subtract billing credits (`transactions.type = 4`) if the user asks for net revenue after credits.
|
|
17
17
|
- If the question is about reminders, notices, or overdue follow-up, switch to `dunning` and `dunning2transactions` instead of answering from revenue data alone. These dbref nouns diverge: call `listDunningNotices` (not `listDunning`) and `listDunningToTransactions` (not `listDunning2transactions`). See [../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid).
|
|
18
18
|
|
|
19
|
+
## First Commands For Counts
|
|
20
|
+
|
|
21
|
+
- All transactions: `zeyos count transactions`
|
|
22
|
+
- Billing invoices only: `zeyos count transactions --filter '{"type":3}'`
|
|
23
|
+
|
|
24
|
+
`transactions` has no `visibility` field. Do not add `"visibility":0` to transaction
|
|
25
|
+
filters.
|
|
26
|
+
|
|
19
27
|
## Important Status Caution
|
|
20
28
|
|
|
21
29
|
The transaction status enum is broad and instance behavior may differ. Do not hard-code business meaning beyond what the schema documents unless the instance conventions are known.
|
|
@@ -41,17 +49,38 @@ Recommended approach:
|
|
|
41
49
|
4. If credits matter, query billing credits separately and subtract them.
|
|
42
50
|
5. Sum the values client-side.
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
CLI example — do this, end to end ("what was last year's total revenue?"):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Current year is 2026, so "last calendar year" = 2025.
|
|
56
|
+
# ZeyOS dates are Unix seconds: 2025-01-01 = 1735689600, 2026-01-01 = 1767225600.
|
|
57
|
+
# NOTE: transactions has NO `visibility` column — adding "visibility":0 here 400s. Don't.
|
|
58
|
+
zeyos list transactions \
|
|
59
|
+
--filter '{"type":3,"date":{">=":1735689600,"<":1767225600}}' \
|
|
60
|
+
--fields ID,transactionnum,date,netamount,tax \
|
|
61
|
+
--limit 10000 --json \
|
|
62
|
+
| python3 -c 'import sys,json; rows=json.load(sys.stdin); print(sum(r.get("netamount",0) for r in rows.get("data",rows)))'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
There is no server-side SUM — you `list` the matching rows (high `--limit`) and add
|
|
66
|
+
`netamount` yourself. Use whatever summing tool you have (a shell pipe, the JS client,
|
|
67
|
+
etc.); the point is to **run it and report the figure**, not to describe the plan.
|
|
68
|
+
Filtering an unknown column (like `visibility` on `transactions`) returns an opaque
|
|
69
|
+
HTTP 400, so only filter on fields `zeyos describe transactions` actually lists.
|
|
70
|
+
|
|
71
|
+
Client example (use when you need `expand`, richer control, or to subtract credits in one pass):
|
|
45
72
|
|
|
46
73
|
```js
|
|
47
74
|
const invoices = await client.api.listTransactions({
|
|
48
75
|
fields: ['ID', 'transactionnum', 'date', 'type', 'status', 'netamount', 'tax', 'account', 'account.lastname'],
|
|
49
76
|
filters: {
|
|
50
77
|
type: 3,
|
|
51
|
-
|
|
78
|
+
// no visibility: transactions has no such column (would 400)
|
|
79
|
+
date: { '>=': yearStart, '<': yearEnd },
|
|
52
80
|
},
|
|
53
|
-
limit:
|
|
81
|
+
limit: 10000,
|
|
54
82
|
});
|
|
83
|
+
const total = invoices.reduce((s, r) => s + (r.netamount || 0), 0);
|
|
55
84
|
```
|
|
56
85
|
|
|
57
86
|
If the user actually wants cash basis, switch to `payments` and sum `amount` over the same date window.
|
|
@@ -5,7 +5,7 @@ description: Analyze ZeyOS campaigns, mailing lists, participants, outbound mail
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Campaign And Outreach
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses campaigns, mailing lists, participants, messages, and contacts. Read [references/workflows.md](references/workflows.md) for outreach-specific query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses campaigns, mailing lists, participants, messages, and contacts. Read [references/workflows.md](references/workflows.md) for outreach-specific query plans.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -14,6 +14,14 @@ These are dbref nouns, not operationIds. Several diverge: `mailinglists` -> `lis
|
|
|
14
14
|
[../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid)
|
|
15
15
|
before calling `@zeyos/client`.
|
|
16
16
|
|
|
17
|
+
## First Commands For Counts
|
|
18
|
+
|
|
19
|
+
- Active campaigns: `zeyos count campaigns --filter '{"visibility":0}'`
|
|
20
|
+
- All campaigns: `zeyos count campaigns`
|
|
21
|
+
- Participants in a campaign: `zeyos count participants --filter '{"campaign":123}'`
|
|
22
|
+
|
|
23
|
+
Replace `123` with the resolved campaign ID when the user gives a campaign name.
|
|
24
|
+
|
|
17
25
|
## Schema Shape To Respect
|
|
18
26
|
|
|
19
27
|
- A `participant` belongs either to a `campaign` or to a `mailinglist`.
|
|
@@ -5,7 +5,7 @@ description: Analyze ZeyOS record timelines, comments, followers, channels, file
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Collaboration And Activity
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/business-app-benchmarks.md](../shared/business-app-benchmarks.md) for the cross-platform semantic defaults. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the timeline must be correlated with work, mail, or knowledge entities. Read [references/workflows.md](references/workflows.md) for activity-specific query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/business-app-benchmarks.md](../shared/business-app-benchmarks.md) for the cross-platform semantic defaults. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the timeline must be correlated with work, mail, or knowledge entities. Read [references/workflows.md](references/workflows.md) for activity-specific query plans.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -16,6 +16,15 @@ These are dbref nouns, not operationIds. Note the junction `entities2channels` -
|
|
|
16
16
|
[../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid)
|
|
17
17
|
before calling `@zeyos/client`.
|
|
18
18
|
|
|
19
|
+
## First Commands For Counts
|
|
20
|
+
|
|
21
|
+
- All timeline events: `zeyos count events`
|
|
22
|
+
- Events for account ID 123: `zeyos count events --filter '{"entity":"accounts","index":123}'`
|
|
23
|
+
- Feed records for account ID 123: `zeyos count records --filter '{"entity":"accounts","index":123}'`
|
|
24
|
+
|
|
25
|
+
`events` and `records` use `entity` plus `index` indirection and have no `visibility`
|
|
26
|
+
field.
|
|
27
|
+
|
|
19
28
|
## Benchmark-Backed Default
|
|
20
29
|
|
|
21
30
|
Treat this layer like the record timeline or collaboration feed found in Salesforce, Odoo, and Dynamics:
|
|
@@ -5,7 +5,7 @@ description: Analyze ZeyOS overdue receivables, dunning notices, payment gaps, a
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Collections And Dunning
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, transactions, payments, and dunning. Read [references/workflows.md](references/workflows.md) for collections-specific query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, transactions, payments, and dunning. Read [references/workflows.md](references/workflows.md) for collections-specific query plans.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ description: Analyze ZeyOS items, pricing, price lists, supplier links, stock mo
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Commerce And Inventory
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) and [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) when the request crosses pricing, accounts, and stock. Read [references/workflows.md](references/workflows.md) for commerce-specific query plans.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) and [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) when the request crosses pricing, accounts, and stock. Read [references/workflows.md](references/workflows.md) for commerce-specific query plans.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -20,6 +20,13 @@ These are dbref nouns, not operationIds. Several diverge: `pricelists` -> `listP
|
|
|
20
20
|
[../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid)
|
|
21
21
|
before calling `@zeyos/client`.
|
|
22
22
|
|
|
23
|
+
## First Commands For Counts
|
|
24
|
+
|
|
25
|
+
- Active catalog items/products: `zeyos count items --filter '{"visibility":0}'`
|
|
26
|
+
- All catalog items/products: `zeyos count items`
|
|
27
|
+
|
|
28
|
+
Use `zeyos count` for item totals; `zeyos list` defaults to one page.
|
|
29
|
+
|
|
23
30
|
## Pattern: Effective Price For A Customer
|
|
24
31
|
|
|
25
32
|
Use this for prompts like:
|
|
@@ -5,7 +5,7 @@ description: Query, summarize, and draft ZeyOS email and message records. Use wh
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Mail Operations
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, contacts, tickets, and messages. Read [references/workflows.md](references/workflows.md) for mail-specific correlation patterns.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, contacts, tickets, and messages. Read [references/workflows.md](references/workflows.md) for mail-specific correlation patterns.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|
|
@@ -25,9 +25,15 @@ Typical prompts:
|
|
|
25
25
|
4. Pull message `text` only when you actually need a summary or draft context.
|
|
26
26
|
5. Group related mail using `reference`, `messageid`, and normalized subject.
|
|
27
27
|
6. If the request is about campaigns, mailing lists, participant coverage, or mailing performance, switch to `zeyos-campaign-and-outreach`.
|
|
28
|
-
7. Treat drafts as safe write
|
|
28
|
+
7. Treat textual drafts as safe. Treat message record creation/update as a write and sending or marking `mailbox=2` as high risk; require explicit confirmation plus verified sender context before any real mail mutation.
|
|
29
29
|
8. Escalate to `@zeyos/client` when you need binary content, MIME expansion, or richer message correlation than the CLI can express cleanly.
|
|
30
30
|
|
|
31
|
+
## Safety
|
|
32
|
+
|
|
33
|
+
- Never send email from an agent test or from a summary/draft request.
|
|
34
|
+
- Do not create or update message records unless the user explicitly asks for a real ZeyOS draft and the sender/mailserver context is known.
|
|
35
|
+
- For "draft a reply", produce reply text in the response and leave ZeyOS unchanged.
|
|
36
|
+
|
|
31
37
|
## Output Discipline
|
|
32
38
|
|
|
33
39
|
- Report the resolved customer identity and the email addresses used for matching.
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
- `0` = inbox
|
|
6
6
|
- `1` = drafts
|
|
7
7
|
- `2` = sent
|
|
8
|
+
- `3` = templates
|
|
9
|
+
- `4` = mailings
|
|
8
10
|
- `5` = archive
|
|
9
11
|
- `6` = trash
|
|
10
12
|
- `7` = junk
|
|
@@ -68,6 +70,17 @@ Recommended approach:
|
|
|
68
70
|
3. Use `reference` and `messageid` to confirm direct reply relationships.
|
|
69
71
|
4. Use subject matching only as a fallback.
|
|
70
72
|
|
|
73
|
+
CLI example:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
zeyos list messages \
|
|
77
|
+
--fields ID,date,mailbox,subject,sender_email,to_email,ticket,reference,messageid \
|
|
78
|
+
--filter '{"ticket":812}' \
|
|
79
|
+
--sort +date \
|
|
80
|
+
--limit 100 \
|
|
81
|
+
--json
|
|
82
|
+
```
|
|
83
|
+
|
|
71
84
|
## Pattern: Find Unanswered Customer Mail
|
|
72
85
|
|
|
73
86
|
Use this for prompts like:
|
|
@@ -80,9 +93,11 @@ Recommended approach:
|
|
|
80
93
|
1. Start from recent inbox messages (`mailbox = 0`).
|
|
81
94
|
2. Limit to customer identities you can resolve through contacts or linked tickets.
|
|
82
95
|
3. Group by thread using `reference`, `messageid`, and subject.
|
|
83
|
-
4. Look for a later sent message (`mailbox = 2`) in the same thread.
|
|
96
|
+
4. Look for a later sent message (`mailbox = 2`) in the same thread. The strongest match is `sent.reference == inbound.ID`; subject matching is only a fallback.
|
|
84
97
|
5. Report unresolved threads and their linked tickets if available.
|
|
85
98
|
|
|
99
|
+
For an operational count, use this exact definition unless the user specifies another one: inbox message (`mailbox = 0`) linked to an open ticket, with no later sent message (`mailbox = 2`) whose `reference` points back to that inbound message.
|
|
100
|
+
|
|
86
101
|
## Pattern: Draft A Reply
|
|
87
102
|
|
|
88
103
|
Use this for prompts like:
|
|
@@ -95,12 +110,14 @@ Recommended approach:
|
|
|
95
110
|
1. Summarize the relevant thread first.
|
|
96
111
|
2. Extract the action items, commitments, and unresolved questions.
|
|
97
112
|
3. Draft reply text separately from any ZeyOS mutation.
|
|
98
|
-
4. Create or update a draft message only if the user explicitly asks and the required sender context is known.
|
|
113
|
+
4. Create or update a draft message only if the user explicitly asks for a real ZeyOS draft and the required sender/mailserver context is known.
|
|
99
114
|
|
|
100
115
|
Important caveat:
|
|
101
116
|
|
|
102
117
|
- Creating a real draft may require more than subject and body. Inspect an existing draft or the instance-specific sending setup before writing message records.
|
|
118
|
+
- Do not set `messageid` when creating test/draft messages; the API may reject it even though list/get responses can expose the field.
|
|
103
119
|
- Never send email just because a user asked for a summary or a draft.
|
|
120
|
+
- In agent protocol tests, "draft" means text output only. Do not call `createMessage`, `updateMessage`, or any send/dispatch path unless the scenario explicitly asks for a real draft record.
|
|
104
121
|
|
|
105
122
|
## Common Failure Modes
|
|
106
123
|
|
|
@@ -5,7 +5,7 @@ description: Retrieve and summarize ZeyOS notes, SOPs, documents, and file-backe
|
|
|
5
5
|
|
|
6
6
|
# ZeyOS Notes And SOPs
|
|
7
7
|
|
|
8
|
-
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request spans notes, documents, files, and related business records. Read [references/workflows.md](references/workflows.md) for knowledge-retrieval patterns.
|
|
8
|
+
Read [../shared/zeyos-agent-operating-guide.md](../shared/zeyos-agent-operating-guide.md) and [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request spans notes, documents, files, and related business records. Read [references/workflows.md](references/workflows.md) for knowledge-retrieval patterns.
|
|
9
9
|
|
|
10
10
|
Typical prompts:
|
|
11
11
|
|