@zeyos/client 0.3.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +31 -1
  3. package/agents/README.md +2 -0
  4. package/agents/shared/zeyos-entity-map.md +5 -1
  5. package/agents/shared/zeyos-entity-reference.md +89 -33
  6. package/docs/03-cli/02-commands.md +28 -0
  7. package/docs/06-okf/01-overview.md +70 -0
  8. package/docs/06-okf/02-producing-and-consuming.md +46 -0
  9. package/docs/06-okf/03-keeping-fresh.md +53 -0
  10. package/docs/06-okf/04-loops.md +58 -0
  11. package/docs/06-okf/_category_.json +9 -0
  12. package/okf/concepts/counting-and-sums.md +10 -0
  13. package/okf/concepts/dates-unix-seconds.md +12 -0
  14. package/okf/concepts/enums.md +14 -0
  15. package/okf/concepts/filters-vs-filter.md +14 -0
  16. package/okf/concepts/index.md +8 -0
  17. package/okf/concepts/operationid-vocabulary.md +17 -0
  18. package/okf/concepts/visibility-column.md +13 -0
  19. package/okf/entities/accounts.md +82 -0
  20. package/okf/entities/actionsteps.md +84 -0
  21. package/okf/entities/addresses.md +50 -0
  22. package/okf/entities/applicationassets.md +43 -0
  23. package/okf/entities/applications.md +62 -0
  24. package/okf/entities/appointments.md +79 -0
  25. package/okf/entities/associations.md +41 -0
  26. package/okf/entities/binfiles.md +32 -0
  27. package/okf/entities/campaigns.md +66 -0
  28. package/okf/entities/categories.md +55 -0
  29. package/okf/entities/channels.md +54 -0
  30. package/okf/entities/comments.md +44 -0
  31. package/okf/entities/components.md +46 -0
  32. package/okf/entities/contacts.md +96 -0
  33. package/okf/entities/contacts2contacts.md +42 -0
  34. package/okf/entities/contracts.md +83 -0
  35. package/okf/entities/couponcodes.md +58 -0
  36. package/okf/entities/coupons.md +69 -0
  37. package/okf/entities/customfields.md +59 -0
  38. package/okf/entities/davservers.md +74 -0
  39. package/okf/entities/devices.md +65 -0
  40. package/okf/entities/documents.md +76 -0
  41. package/okf/entities/dunning.md +82 -0
  42. package/okf/entities/dunning2transactions.md +46 -0
  43. package/okf/entities/entities2channels.md +42 -0
  44. package/okf/entities/events.md +57 -0
  45. package/okf/entities/feedservers.md +67 -0
  46. package/okf/entities/files.md +50 -0
  47. package/okf/entities/follows.md +40 -0
  48. package/okf/entities/forks.md +54 -0
  49. package/okf/entities/groups.md +48 -0
  50. package/okf/entities/groups2users.md +44 -0
  51. package/okf/entities/index.md +93 -0
  52. package/okf/entities/invitations.md +53 -0
  53. package/okf/entities/items.md +95 -0
  54. package/okf/entities/ledgers.md +56 -0
  55. package/okf/entities/likes.md +40 -0
  56. package/okf/entities/links.md +70 -0
  57. package/okf/entities/mailinglists.md +67 -0
  58. package/okf/entities/mailingrecipients.md +45 -0
  59. package/okf/entities/mailservers.md +77 -0
  60. package/okf/entities/messagereads.md +40 -0
  61. package/okf/entities/messages.md +104 -0
  62. package/okf/entities/notes.md +73 -0
  63. package/okf/entities/objects.md +70 -0
  64. package/okf/entities/opportunities.md +87 -0
  65. package/okf/entities/participants.md +52 -0
  66. package/okf/entities/payments.md +76 -0
  67. package/okf/entities/permissions.md +46 -0
  68. package/okf/entities/pricelists.md +70 -0
  69. package/okf/entities/pricelists2accounts.md +46 -0
  70. package/okf/entities/prices.md +49 -0
  71. package/okf/entities/projects.md +72 -0
  72. package/okf/entities/records.md +75 -0
  73. package/okf/entities/relateditems.md +43 -0
  74. package/okf/entities/resources.md +55 -0
  75. package/okf/entities/services.md +64 -0
  76. package/okf/entities/stocktransactions.md +72 -0
  77. package/okf/entities/storages.md +56 -0
  78. package/okf/entities/suppliers.md +51 -0
  79. package/okf/entities/tasks.md +86 -0
  80. package/okf/entities/tickets.md +86 -0
  81. package/okf/entities/transactions.md +118 -0
  82. package/okf/entities/users.md +66 -0
  83. package/okf/entities/weblets.md +66 -0
  84. package/okf/index.md +11 -0
  85. package/okf/log.md +4 -0
  86. package/okf/metrics/cash-received.md +10 -0
  87. package/okf/metrics/index.md +6 -0
  88. package/okf/metrics/invoiced-net-revenue.md +16 -0
  89. package/okf/metrics/open-customers.md +14 -0
  90. package/okf/metrics/overdue-receivables.md +12 -0
  91. package/okf/playbooks/customer-360.md +12 -0
  92. package/okf/playbooks/index.md +5 -0
  93. package/okf/playbooks/revenue-this-year.md +19 -0
  94. package/okf/playbooks/ticket-work-packet.md +11 -0
  95. package/package.json +9 -2
  96. package/scripts/data/okf-curation.mjs +258 -0
  97. package/scripts/generate-client.mjs +4 -275
  98. package/scripts/generate-okf.mjs +241 -0
  99. package/scripts/lib/okf.mjs +272 -0
  100. package/scripts/lib/spec-model.mjs +325 -0
  101. package/src/index.js +4 -0
  102. package/src/runtime/okf.js +237 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  Notable changes to `@zeyos/client` and `@zeyos/cli`. This project follows
4
4
  [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## 0.4.0
7
+
8
+ ### Open Knowledge Format (OKF)
9
+ - **New OKF bundle** under [`okf/`](okf/): a conformant [Open Knowledge Format v0.1](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md) description of the ZeyOS data model — one Markdown concept per API-backed entity (schema, foreign keys, enums, indexes, and the real operationIds), plus curated metrics, playbooks, and cross-cutting query concepts. Generated from the OpenAPI/dbref specs into **managed blocks** so structural content stays in sync while curated `# Notes` are preserved across regeneration. Ships in the npm package.
10
+ - **Canonical schema source**: the previously hand-maintained operationId table in `agents/shared/zeyos-entity-reference.md` is now generated from the bundle, so the skill pack and the data model can't drift apart. Skills stay the task-facing layer; OKF is the reference layer.
11
+ - **Freshness**: `npm run generate` regenerates the bundle alongside the client; a `source_snapshot` hash and an auto-appended `okf/log.md` schema-diff track changes when the ZeyOS schema/API is updated, and `npm run okf:check` is a CI drift + conformance gate.
12
+
13
+ ### `@zeyos/client`
14
+ - New OKF exports: `buildOkf()` (synthesize a conformant bundle from the client's schema — pure, browser-safe), `loadOkfBundle(dir)` (read a bundle, Node), `validateOkfBundle`/`validateOkfFiles` (OKF v0.1 conformance), `conceptIdForResource`, and `OKF_VERSION`.
15
+
16
+ ### `@zeyos/cli` (`zeyos`)
17
+ - New `okf` command: `zeyos okf list | show <concept> | check | export [--out] | build [--out]` to browse, print, validate, vendor, or synthesize the OKF bundle.
18
+
19
+ ### Agent skills & tooling
20
+ - The improvement loop gains a `--context skills|okf|both` axis (`run.mjs`/`loop.mjs`) to measure whether OKF-as-context lifts agent accuracy, and a new `okf:refine` loop (`refine-okf.mjs`) that drafts → validates against the schema → judges → applies improvements to a concept's curated notes (never the generated managed block).
21
+
6
22
  ## 0.3.0
7
23
 
8
24
  ### `@zeyos/client`
package/README.md CHANGED
@@ -203,6 +203,7 @@ zeyos <command> [options] [args…]
203
203
  | `resources` | List resource types the CLI exposes | `zeyos resources --json` |
204
204
  | `describe <resource>` | Show a resource's fields, types and enums | `zeyos describe ticket` |
205
205
  | `skills <list\|show\|install>` | Manage bundled coding-agent skills | `zeyos skills install --target claude --global` |
206
+ | `okf <list\|show\|check\|export\|build>` | Work with the OKF knowledge bundle | `zeyos okf show tickets` |
206
207
 
207
208
  **Global options** (work on every command): `--json`, `--yaml`, `--no-color`, `-h/--help`, `-v/--version`.
208
209
 
@@ -405,6 +406,33 @@ See [Agent Workflows](./docs/04-agent-workflows/00-coding-agents.md): [quickstar
405
406
 
406
407
  ---
407
408
 
409
+ ## Open Knowledge Format (OKF)
410
+
411
+ The client ships a conformant [**Open Knowledge Format**](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
412
+ bundle under [`okf/`](./okf/) — a portable, Git-native Markdown description of the ZeyOS data
413
+ model (one concept per API-backed entity: schema, foreign keys, enums, indexes, operationIds)
414
+ plus curated metrics, playbooks, and query concepts. Agents and tools read it as a shared
415
+ knowledge layer, independent of this client.
416
+
417
+ ```bash
418
+ zeyos okf list # browse concepts
419
+ zeyos okf show tickets # print a concept (schema + curated notes)
420
+ zeyos okf check # validate OKF v0.1 conformance
421
+ zeyos okf export --out ./okf # vendor the bundle into your project
422
+ ```
423
+
424
+ ```js
425
+ import { buildOkf, loadOkfBundle, validateOkfBundle } from '@zeyos/client';
426
+ const files = buildOkf(); // synthesize from the client schema
427
+ const bundle = await loadOkfBundle('node_modules/@zeyos/client/okf');
428
+ ```
429
+
430
+ The bundle is **generated** from the OpenAPI/dbref specs into managed blocks, with curated
431
+ prose preserved across regeneration, and it is **canonical** for structural facts (the shared
432
+ skill references derive from it). It is regenerated by `npm run generate` and gated by
433
+ `npm run okf:check`. See the [OKF docs](./docs/06-okf/01-overview.md) for the bundle layout,
434
+ the spec-refresh runbook, and how it ties into the [skill-improvement loops](./docs/06-okf/04-loops.md).
435
+
408
436
  ## Sample apps
409
437
 
410
438
  Three runnable, dependency-free browser demos live in [`samples/`](./samples/):
@@ -423,9 +451,10 @@ Each can be served as static files from the repository root; see the linked docs
423
451
  - [`cli/`](./cli/) — the `@zeyos/cli` command-line tool.
424
452
  - [`docs/`](./docs/) — the authoritative documentation (Docusaurus).
425
453
  - [`agents/`](./agents/) — repo-local ZeyOS agent skills and query playbooks.
454
+ - [`okf/`](./okf/) — the [Open Knowledge Format](./docs/06-okf/01-overview.md) bundle: a portable, Git-native Markdown description of the ZeyOS data model (canonical for structural facts).
426
455
  - [`openapi/`](./openapi/) — the OpenAPI specifications and DB schema reference.
427
456
  - [`samples/`](./samples/) — the sample browser applications.
428
- - [`scripts/`](./scripts/) — client generation (`generate-client.mjs`) and the test runner.
457
+ - [`scripts/`](./scripts/) — client + OKF generation (`generate-client.mjs`, `generate-okf.mjs`) and the test runner.
429
458
 
430
459
  ---
431
460
 
@@ -439,6 +468,7 @@ Each can be served as static files from the repository root; see the linked docs
439
468
  | **Agent Workflows** | CLI-first agent orientation, JSON recipes, escalation | [docs/04-agent-workflows](./docs/04-agent-workflows/00-coding-agents.md) |
440
469
  | **Sample Apps** | Kanban, CRM, Dashboard walkthroughs | [docs/04-sample-apps](./docs/04-sample-apps/01-kanban.md) |
441
470
  | **Tutorials** | Architecture guide, build-your-own frontend, server-side integration | [docs/05-tutorials](./docs/05-tutorials/00-application-developers.md) |
471
+ | **Open Knowledge Format** | The OKF knowledge bundle: overview, producing/consuming, keeping it fresh, refinement loops | [docs/06-okf](./docs/06-okf/01-overview.md) |
442
472
  | **Agent Skills** | What the bundled skills do and how they're organized | [agents/README.md](./agents/README.md) |
443
473
 
444
474
  ---
package/agents/README.md CHANGED
@@ -5,6 +5,8 @@ This folder contains a repo-local skill pack for coding agents that use ZeyOS as
5
5
  The source-backed model reference lives in [`shared/zeyos-entity-reference.md`](./shared/zeyos-entity-reference.md) and is derived from [`openapi/dbref.json`](../openapi/dbref.json) and [`openapi/api.json`](../openapi/api.json).
6
6
  Cross-platform modeling guidance lives in [`shared/business-app-benchmarks.md`](./shared/business-app-benchmarks.md).
7
7
 
8
+ The **canonical** per-entity schema (columns, types, enums, foreign keys, indexes, operationIds) now lives in the [Open Knowledge Format bundle](../okf/entities/index.md) under [`okf/`](../okf/), generated from the same specs; the shared reference's operationId table is generated from it. Cross-cutting query rules and footguns are in [`okf/concepts/`](../okf/concepts/index.md). When a schema fact in a shared reference and in `okf/` disagree, `okf/` wins.
9
+
8
10
  ## Structure
9
11
 
10
12
  - `shared/` contains cross-domain query rules and entity relationships, including
@@ -2,7 +2,11 @@
2
2
 
3
3
  Use this file when a question spans more than one business area.
4
4
 
5
- This is the high-level relationship map. For the source-backed inventory, read [zeyos-entity-reference.md](./zeyos-entity-reference.md), which is derived from [../../openapi/dbref.json](../../openapi/dbref.json) and [../../openapi/api.json](../../openapi/api.json).
5
+ This is the high-level relationship map (curated). For the per-entity schema columns, enums,
6
+ foreign keys, indexes, and operationIds — read the canonical [`okf/entities/`](../../okf/entities/index.md)
7
+ concepts; for cross-cutting query rules read [`okf/concepts/`](../../okf/concepts/index.md). The
8
+ source-backed inventory and the generated operationId table live in
9
+ [zeyos-entity-reference.md](./zeyos-entity-reference.md), derived from [../../openapi/dbref.json](../../openapi/dbref.json) and [../../openapi/api.json](../../openapi/api.json).
6
10
 
7
11
  The names below are dbref/DB-table nouns used to describe relationships. They are **not** the
8
12
  `@zeyos/client` operationIds. Several diverge (e.g. `dunning` -> `listDunningNotices`,
@@ -14,6 +14,13 @@ Current source snapshot:
14
14
 
15
15
  Use this file when you need to understand what an entity is for before building a query plan.
16
16
 
17
+ > **Canonical schema lives in the OKF bundle.** Per-entity columns, types, enums, foreign keys,
18
+ > indexes (incl. the GIN/partial indexes behind the `filters` footgun), and operationIds are
19
+ > generated into [`okf/entities/`](../../okf/entities/index.md) from the specs, and cross-cutting
20
+ > rules into [`okf/concepts/`](../../okf/concepts/index.md). This reference keeps the curated
21
+ > narrative (entity families, query priorities, use-case clusters); the operationId table below is
22
+ > generated from the same source. When schema facts here and in `okf/` ever disagree, `okf/` wins.
23
+
17
24
  ## Source Note: `filter` vs `filters`
18
25
 
19
26
  Do not treat the spelling as universally settled.
@@ -58,39 +65,88 @@ Entities that follow the regular rule directly (lowercase noun, single English w
58
65
 
59
66
  `*` = read-only entity: only `list*`, `get*`, and `exists*` exist (no create/update/delete).
60
67
 
61
- ### Exceptions (verify these the noun does NOT map naively)
62
-
63
- Every operationId below was verified to exist in `src/generated/operations.js`. Junction tables
64
- (`X2Y`) become `XToY` (CamelCase, with the **left** side often re-pluralized). Some entities are
65
- renamed entirely (`dunning` -> `DunningNotice`), and several are compound words that must keep their
66
- internal capitalization (e.g. `MailingLists`, not `Mailinglists`).
67
-
68
- | dbref noun | list | get | create | update | delete | exists | Notes |
69
- |------------|------|-----|--------|--------|--------|--------|-------|
70
- | `actionsteps` | `listActionSteps` | `getActionStep` | `createActionStep` | `updateActionStep` | `deleteActionStep` | `existsActionStep` | Compound `ActionStep` |
71
- | `applicationassets` | `listApplicationAssets` | `getApplicationAsset` | — | — | — | `existsApplicationAsset` | Read-only; compound |
72
- | `binfiles` | `listBinFiles` | | | | | | **List-only.** `BinFiles` |
73
- | `categories` | `listCategorys` | `getCategory` | `createCategory` | `updateCategory` | `deleteCategory` | `existsCategory` | List op is `listCategorys` (sic — no irregular plural); singular ops use `Category` |
74
- | `contacts2contacts` | `listContactsToContacts` | `getContactToContact` | `createContactToContact` | `updateContactToContact` | `deleteContactToContact` | `existsContactToContact` | Junction `X2Y` -> `XToY` |
75
- | `couponcodes` | `listCouponCodes` | `getCouponCode` | `createCouponCode` | `updateCouponCode` | `deleteCouponCode` | `existsCouponCode` | Compound `CouponCode` |
76
- | `customfields` | `listCustomFields` | `getCustomField` | | | | `existsCustomField` | Read-only; compound |
77
- | `davservers` | `listDAVServers` | `getDAVServer` | `createDAVServer` | `updateDAVServer` | `deleteDAVServer` | `existsDAVServer` | Acronym uppercased: `DAVServer` |
78
- | `dunning` | `listDunningNotices` | `getDunningNotice` | `createDunningNotice` | `updateDunningNotice` | `deleteDunningNotice` | `existsDunningNotice` | Entity is **`DunningNotice`**, not `Dunning` |
79
- | `dunning2transactions` | `listDunningToTransactions` | `getDunningToTransaction` | `createDunningToTransaction` | `updateDunningToTransaction` | `deleteDunningToTransaction` | `existsDunningToTransaction` | Junction `dunning2transactions` -> `DunningToTransaction(s)` |
80
- | `entities2channels` | `listEntitiesToChannels` | `getEntityToChannel` | `createEntityToChannel` | `updateEntityToChannel` | `deleteEntityToChannel` | `existsEntityToChannel` | Junction; singular re-singularized to `EntityToChannel` |
81
- | `feedservers` | `listFeedServers` | `getFeedServer` | `createFeedServer` | `updateFeedServer` | `deleteFeedServer` | `existsFeedServer` | Compound `FeedServer` |
82
- | `groups2users` | `listGroupsToUsers` | `getGroupToUser` | — | — | — | `existsGroupToUser` | Read-only junction `X2Y` -> `XToY` |
83
- | `mailinglists` | `listMailingLists` | `getMailingList` | `createMailingList` | `updateMailingList` | `deleteMailingList` | `existsMailingList` | Compound `MailingList` |
84
- | `mailingrecipients` | `listMailingRecipients` | `getMailingRecipient` | `createMailingRecipient` | `updateMailingRecipient` | `deleteMailingRecipient` | `existsMailingRecipients` | Compound; **exists op is plural** `existsMailingRecipients` (sic) |
85
- | `mailservers` | `listMailServers` | `getMailServer` | `createMailServer` | `updateMailServer` | `deleteMailServer` | `existsMailServer` | Compound `MailServer` |
86
- | `messagereads` | `listMessageReads` | `getMessageRead` | `createMessageRead` | `updateMessageRead` | `deleteMessageRead` | `existsMessageRead` | Compound `MessageRead` |
87
- | `pricelists` | `listPriceLists` | `getPriceList` | `createPriceList` | `updatePriceList` | `deletePriceList` | `existsPriceList` | Compound `PriceList` |
88
- | `pricelists2accounts` | `listPriceListsToAccounts` | `getPriceListToAccount` | `createPriceListToAccount` | `updatePriceListToAccount` | `deletePriceListToAccount` | `existsPriceListToAccount` | Junction; compound on both sides |
89
- | `relateditems` | `listRelatedItems` | `getRelatedItem` | `createRelatedItem` | `updateRelatedItem` | `deleteRelatedItem` | `existsRelatedItem` | Compound `RelatedItem` |
90
- | `stocktransactions` | `listStockTransactions` | `getStockTransaction` | `createStockTransaction` | `updateStockTransaction` | `deleteStockTransaction` | `existsStockTransaction` | Compound `StockTransaction` |
91
-
92
- When in doubt, look up the operationId in `src/generated/operations.js` (or `openapi/api.json`) rather
93
- than constructing it from the noun.
68
+ ### The authoritative table (generated from `openapi/api.json`)
69
+
70
+ The full `list`/`get`/`create`/`update`/`delete`/`exists` operationId for **every** API-backed
71
+ entity is generated below and kept in sync with the specs by `scripts/generate-okf.mjs`. The
72
+ tricky cases all appear with their real operationIds: junction tables (`X2Y` `XToY`, often
73
+ re-pluralizing the left side), renamed entities (`dunning` `DunningNotice`), compounds that
74
+ keep internal capitalization (`MailingLists`, not `Mailinglists`), and quirks like `listCategorys`
75
+ (sic) or the plural `existsMailingRecipients`. A `—` means the operation does not exist
76
+ (read-only or list-only entity). Per-entity schema, enums, and foreign keys live in the matching
77
+ [`okf/entities/<name>.md`](../../okf/entities/index.md) concept, which is the canonical source.
78
+
79
+ <!-- okf:generated:startrewritten by scripts/generate-okf.mjs; do not edit by hand -->
80
+ | Entity | Concept | list | get | create | update | delete | exists |
81
+ |---|---|---|---|---|---|---|---|
82
+ | `accounts` | [↗](../../okf/entities/accounts.md) | `listAccounts` | `getAccount` | `createAccount` | `updateAccount` | `deleteAccount` | `existsAccount` |
83
+ | `actionsteps` | [↗](../../okf/entities/actionsteps.md) | `listActionSteps` | `getActionStep` | `createActionStep` | `updateActionStep` | `deleteActionStep` | `existsActionStep` |
84
+ | `addresses` | [↗](../../okf/entities/addresses.md) | `listAddresses` | `getAddress` | `createAddress` | `updateAddress` | `deleteAddress` | `existsAddress` |
85
+ | `applicationassets` | [↗](../../okf/entities/applicationassets.md) | `listApplicationAssets` | `getApplicationAsset` | | | | `existsApplicationAsset` |
86
+ | `applications` | [↗](../../okf/entities/applications.md) | `listApplications` | `getApplication` | | | | `existsApplication` |
87
+ | `appointments` | [↗](../../okf/entities/appointments.md) | `listAppointments` | `getAppointment` | `createAppointment` | `updateAppointment` | `deleteAppointment` | `existsAppointment` |
88
+ | `associations` | [↗](../../okf/entities/associations.md) | `listAssociations` | `getAssociation` | `createAssociation` | `updateAssociation` | `deleteAssociation` | `existsAssociation` |
89
+ | `binfiles` | [↗](../../okf/entities/binfiles.md) | `listBinFiles` | — | — | — | | |
90
+ | `campaigns` | [↗](../../okf/entities/campaigns.md) | `listCampaigns` | `getCampaign` | `createCampaign` | `updateCampaign` | `deleteCampaign` | `existsCampaign` |
91
+ | `categories` | [↗](../../okf/entities/categories.md) | `listCategorys` | `getCategory` | `createCategory` | `updateCategory` | `deleteCategory` | `existsCategory` |
92
+ | `channels` | [↗](../../okf/entities/channels.md) | `listChannels` | `getChannel` | `createChannel` | `updateChannel` | `deleteChannel` | `existsChannel` |
93
+ | `comments` | [↗](../../okf/entities/comments.md) | `listComments` | `getComment` | `createComment` | `updateComment` | `deleteComment` | `existsComment` |
94
+ | `components` | [↗](../../okf/entities/components.md) | `listComponents` | `getComponent` | `createComponent` | `updateComponent` | `deleteComponent` | `existsComponent` |
95
+ | `contacts` | [↗](../../okf/entities/contacts.md) | `listContacts` | `getContact` | `createContact` | `updateContact` | `deleteContact` | `existsContact` |
96
+ | `contacts2contacts` | [↗](../../okf/entities/contacts2contacts.md) | `listContactsToContacts` | `getContactToContact` | `createContactToContact` | `updateContactToContact` | `deleteContactToContact` | `existsContactToContact` |
97
+ | `contracts` | [↗](../../okf/entities/contracts.md) | `listContracts` | `getContract` | `createContract` | `updateContract` | `deleteContract` | `existsContract` |
98
+ | `couponcodes` | [↗](../../okf/entities/couponcodes.md) | `listCouponCodes` | `getCouponCode` | `createCouponCode` | `updateCouponCode` | `deleteCouponCode` | `existsCouponCode` |
99
+ | `coupons` | [↗](../../okf/entities/coupons.md) | `listCoupons` | `getCoupon` | `createCoupon` | `updateCoupon` | `deleteCoupon` | `existsCoupon` |
100
+ | `customfields` | [↗](../../okf/entities/customfields.md) | `listCustomFields` | `getCustomField` | — | — | — | `existsCustomField` |
101
+ | `davservers` | [↗](../../okf/entities/davservers.md) | `listDAVServers` | `getDAVServer` | `createDAVServer` | `updateDAVServer` | `deleteDAVServer` | `existsDAVServer` |
102
+ | `devices` | [↗](../../okf/entities/devices.md) | `listDevices` | `getDevice` | `createDevice` | `updateDevice` | `deleteDevice` | `existsDevice` |
103
+ | `documents` | [↗](../../okf/entities/documents.md) | `listDocuments` | `getDocument` | `createDocument` | `updateDocument` | `deleteDocument` | `existsDocument` |
104
+ | `dunning` | [↗](../../okf/entities/dunning.md) | `listDunningNotices` | `getDunningNotice` | `createDunningNotice` | `updateDunningNotice` | `deleteDunningNotice` | `existsDunningNotice` |
105
+ | `dunning2transactions` | [↗](../../okf/entities/dunning2transactions.md) | `listDunningToTransactions` | `getDunningToTransaction` | `createDunningToTransaction` | `updateDunningToTransaction` | `deleteDunningToTransaction` | `existsDunningToTransaction` |
106
+ | `entities2channels` | [↗](../../okf/entities/entities2channels.md) | `listEntitiesToChannels` | `getEntityToChannel` | `createEntityToChannel` | `updateEntityToChannel` | `deleteEntityToChannel` | `existsEntityToChannel` |
107
+ | `events` | [↗](../../okf/entities/events.md) | `listEvents` | `getEvent` | `createEvent` | `updateEvent` | `deleteEvent` | `existsEvent` |
108
+ | `feedservers` | [↗](../../okf/entities/feedservers.md) | `listFeedServers` | `getFeedServer` | `createFeedServer` | `updateFeedServer` | `deleteFeedServer` | `existsFeedServer` |
109
+ | `files` | [↗](../../okf/entities/files.md) | `listFiles` | `getFile` | `createFile` | `updateFile` | `deleteFile` | `existsFile` |
110
+ | `follows` | [↗](../../okf/entities/follows.md) | `listFollows` | `getFollow` | `createFollow` | `updateFollow` | `deleteFollow` | `existsFollow` |
111
+ | `forks` | [↗](../../okf/entities/forks.md) | `listForks` | `getFork` | — | — | — | `existsFork` |
112
+ | `groups` | [↗](../../okf/entities/groups.md) | `listGroups` | `getGroup` | — | — | — | `existsGroup` |
113
+ | `groups2users` | [↗](../../okf/entities/groups2users.md) | `listGroupsToUsers` | `getGroupToUser` | — | — | — | `existsGroupToUser` |
114
+ | `invitations` | [↗](../../okf/entities/invitations.md) | `listInvitations` | `getInvitation` | `createInvitation` | `updateInvitation` | `deleteInvitation` | `existsInvitation` |
115
+ | `items` | [↗](../../okf/entities/items.md) | `listItems` | `getItem` | `createItem` | `updateItem` | `deleteItem` | `existsItem` |
116
+ | `ledgers` | [↗](../../okf/entities/ledgers.md) | `listLedgers` | `getLedger` | `createLedger` | `updateLedger` | `deleteLedger` | `existsLedger` |
117
+ | `likes` | [↗](../../okf/entities/likes.md) | `listLikes` | `getLike` | `createLike` | `updateLike` | `deleteLike` | `existsLike` |
118
+ | `links` | [↗](../../okf/entities/links.md) | `listLinks` | `getLink` | `createLink` | `updateLink` | `deleteLink` | `existsLink` |
119
+ | `mailinglists` | [↗](../../okf/entities/mailinglists.md) | `listMailingLists` | `getMailingList` | `createMailingList` | `updateMailingList` | `deleteMailingList` | `existsMailingList` |
120
+ | `mailingrecipients` | [↗](../../okf/entities/mailingrecipients.md) | `listMailingRecipients` | `getMailingRecipient` | `createMailingRecipient` | `updateMailingRecipient` | `deleteMailingRecipient` | `existsMailingRecipients` |
121
+ | `mailservers` | [↗](../../okf/entities/mailservers.md) | `listMailServers` | `getMailServer` | `createMailServer` | `updateMailServer` | `deleteMailServer` | `existsMailServer` |
122
+ | `messagereads` | [↗](../../okf/entities/messagereads.md) | `listMessageReads` | `getMessageRead` | `createMessageRead` | `updateMessageRead` | `deleteMessageRead` | `existsMessageRead` |
123
+ | `messages` | [↗](../../okf/entities/messages.md) | `listMessages` | `getMessage` | `createMessage` | `updateMessage` | `deleteMessage` | `existsMessage` |
124
+ | `notes` | [↗](../../okf/entities/notes.md) | `listNotes` | `getNote` | `createNote` | `updateNote` | `deleteNote` | `existsNote` |
125
+ | `objects` | [↗](../../okf/entities/objects.md) | `listObjects` | `getObject` | `createObject` | `updateObject` | `deleteObject` | `existsObject` |
126
+ | `opportunities` | [↗](../../okf/entities/opportunities.md) | `listOpportunities` | `getOpportunity` | `createOpportunity` | `updateOpportunity` | `deleteOpportunity` | `existsOpportunity` |
127
+ | `participants` | [↗](../../okf/entities/participants.md) | `listParticipants` | `getParticipant` | `createParticipant` | `updateParticipant` | `deleteParticipant` | `existsParticipant` |
128
+ | `payments` | [↗](../../okf/entities/payments.md) | `listPayments` | `getPayment` | `createPayment` | `updatePayment` | `deletePayment` | `existsPayment` |
129
+ | `permissions` | [↗](../../okf/entities/permissions.md) | `listPermissions` | `getPermission` | — | — | — | `existsPermission` |
130
+ | `pricelists` | [↗](../../okf/entities/pricelists.md) | `listPriceLists` | `getPriceList` | `createPriceList` | `updatePriceList` | `deletePriceList` | `existsPriceList` |
131
+ | `pricelists2accounts` | [↗](../../okf/entities/pricelists2accounts.md) | `listPriceListsToAccounts` | `getPriceListToAccount` | `createPriceListToAccount` | `updatePriceListToAccount` | `deletePriceListToAccount` | `existsPriceListToAccount` |
132
+ | `prices` | [↗](../../okf/entities/prices.md) | `listPrices` | `getPrice` | `createPrice` | `updatePrice` | `deletePrice` | `existsPrice` |
133
+ | `projects` | [↗](../../okf/entities/projects.md) | `listProjects` | `getProject` | `createProject` | `updateProject` | `deleteProject` | `existsProject` |
134
+ | `records` | [↗](../../okf/entities/records.md) | `listRecords` | `getRecord` | `createRecord` | `updateRecord` | `deleteRecord` | `existsRecord` |
135
+ | `relateditems` | [↗](../../okf/entities/relateditems.md) | `listRelatedItems` | `getRelatedItem` | `createRelatedItem` | `updateRelatedItem` | `deleteRelatedItem` | `existsRelatedItem` |
136
+ | `resources` | [↗](../../okf/entities/resources.md) | `listResources` | `getResource` | — | — | — | `existsResource` |
137
+ | `services` | [↗](../../okf/entities/services.md) | `listServices` | `getService` | — | — | — | `existsService` |
138
+ | `stocktransactions` | [↗](../../okf/entities/stocktransactions.md) | `listStockTransactions` | `getStockTransaction` | `createStockTransaction` | `updateStockTransaction` | `deleteStockTransaction` | `existsStockTransaction` |
139
+ | `storages` | [↗](../../okf/entities/storages.md) | `listStorages` | `getStorage` | `createStorage` | `updateStorage` | `deleteStorage` | `existsStorage` |
140
+ | `suppliers` | [↗](../../okf/entities/suppliers.md) | `listSuppliers` | `getSupplier` | `createSupplier` | `updateSupplier` | `deleteSupplier` | `existsSupplier` |
141
+ | `tasks` | [↗](../../okf/entities/tasks.md) | `listTasks` | `getTask` | `createTask` | `updateTask` | `deleteTask` | `existsTask` |
142
+ | `tickets` | [↗](../../okf/entities/tickets.md) | `listTickets` | `getTicket` | `createTicket` | `updateTicket` | `deleteTicket` | `existsTicket` |
143
+ | `transactions` | [↗](../../okf/entities/transactions.md) | `listTransactions` | `getTransaction` | `createTransaction` | `updateTransaction` | `deleteTransaction` | `existsTransaction` |
144
+ | `users` | [↗](../../okf/entities/users.md) | `listUsers` | `getUser` | — | — | — | `existsUser` |
145
+ | `weblets` | [↗](../../okf/entities/weblets.md) | `listWeblets` | `getWeblet` | — | — | — | `existsWeblet` |
146
+ <!-- okf:generated:end -->
147
+
148
+ When in doubt, read the entity's OKF concept (linked above) or look the operationId up in
149
+ `openapi/api.json` rather than constructing it from the noun.
94
150
 
95
151
  ## API-Backed Entities
96
152
 
@@ -481,6 +481,34 @@ Skills are copied into `<dir>/<name>/`, with the shared reference files installe
481
481
 
482
482
  ---
483
483
 
484
+ ## okf
485
+
486
+ Work with the [Open Knowledge Format](../06-okf/01-overview.md) bundle that ships with the
487
+ client — a portable Markdown description of the ZeyOS data model (one concept per
488
+ API-backed entity) plus curated metrics, playbooks, and query concepts.
489
+
490
+ ```bash
491
+ zeyos okf list # list concepts (type, id, title); --json for automation
492
+ zeyos okf show tickets # print a concept (bare resource name, or entities/tickets)
493
+ zeyos okf check # validate OKF v0.1 conformance (exit non-zero on error)
494
+ zeyos okf export --out ./okf # copy the shipped bundle into a directory
495
+ zeyos okf build --out ./okf # synthesize a bundle from the client's schema
496
+ ```
497
+
498
+ | Subcommand | What it does |
499
+ |-----------|--------------|
500
+ | `list` | List the concepts in the bundle (`--json`/`--yaml` supported). |
501
+ | `show <concept>` | Print one concept doc. Accepts a bare resource (`tickets`) or full id (`entities/tickets`). |
502
+ | `check` | Validate the bundle for OKF v0.1 conformance; exits non-zero on any error (CI-friendly). |
503
+ | `export` | Copy the shipped `okf/` bundle into `--out` (default `./okf`); `--force` to overwrite. |
504
+ | `build` | Synthesize a structural bundle from the client's schema into `--out` (default `./okf`). |
505
+
506
+ Options: `--dir <path>` reads from an explicit bundle directory (`list`/`show`/`check`);
507
+ `--out <path>` is the write target (`build`/`export`); `--force` overwrites an existing
508
+ target. `export` ships the rich curated bundle; `build` is the lighter runtime projection.
509
+
510
+ ---
511
+
484
512
  ## Command Aliases
485
513
 
486
514
  | Alias | Equivalent |
@@ -0,0 +1,70 @@
1
+ # OKF Overview
2
+
3
+ The **Open Knowledge Format (OKF v0.1)** is Google's minimal, vendor-neutral spec for
4
+ sharing the metadata and curated context that surrounds data: a directory of Markdown
5
+ files, each with YAML frontmatter whose only required field is `type`, optional `index.md`
6
+ and `log.md`, and Markdown cross-links that turn the directory into a knowledge graph.
7
+ Producers emit a bundle; consumers (coding agents, viewers, search) read it.
8
+
9
+ `@zeyos/client` ships a conformant OKF bundle under [`okf/`](https://github.com/zeyos/client/tree/main/okf)
10
+ that describes the ZeyOS data model, and tooling to produce, consume, validate, and refine it.
11
+
12
+ ## Why OKF fits ZeyOS
13
+
14
+ The client already derives a compact schema from the OpenAPI/dbref specs. OKF turns that —
15
+ plus the curated business knowledge that used to live only in the skill pack — into a
16
+ portable knowledge layer any agent or tool can read, independent of this client.
17
+
18
+ The bundle is **canonical** for ZeyOS structural facts: the hand-maintained
19
+ `agents/shared/zeyos-entity-reference.md` operationId table is now generated from the same
20
+ source, so the skills and the OKF bundle can't drift apart.
21
+
22
+ ## Bundle layout
23
+
24
+ ```
25
+ okf/
26
+ index.md # root listing; frontmatter: okf_version, source_snapshot
27
+ log.md # schema-change history (auto-appended on real changes)
28
+ entities/ # one concept per API-backed entity — type: ZeyOS Entity
29
+ index.md
30
+ accounts.md tickets.md transactions.md …
31
+ metrics/ # business metric definitions — type: Metric
32
+ playbooks/ # step-by-step query workflows — type: Playbook
33
+ concepts/ # cross-cutting rules / footguns — type: Reference
34
+ ```
35
+
36
+ Each entity concept carries a **Schema** table (column, type, nullability, default, index,
37
+ foreign key), **Foreign Keys** (cross-linked to the target entity), **Enums** (parsed from
38
+ the schema), **Indexes** (including the GIN/partial indexes behind the `filters` footgun),
39
+ and **Operations** (the real `@zeyos/client` operationIds, read straight from `api.json`).
40
+
41
+ ## Generated vs curated: managed blocks
42
+
43
+ Each entity concept mixes auto-generated structure with curated prose. The generated region
44
+ is fenced by HTML-comment markers:
45
+
46
+ ```markdown
47
+ <!-- okf:generated:start — rewritten by scripts/generate-okf.mjs; do not edit by hand -->
48
+ # Schema
49
+
50
+ <!-- okf:generated:end -->
51
+
52
+ # Notes
53
+ Curated guidance — preserved across every regeneration.
54
+ ```
55
+
56
+ The producer rewrites **only** the region between the markers. Curated `# Notes`/`# Metrics`
57
+ prose (added by a human or the refinement loop) is preserved verbatim, so regenerating after
58
+ a schema change never clobbers curation. See [Keeping OKF fresh](./03-keeping-fresh.md).
59
+
60
+ ## Relationship to the skill pack
61
+
62
+ Two projections of one knowledge core:
63
+
64
+ - **Skills** (`agents/`) stay the task/runner-facing layer: the operating contract, "act,
65
+ don't plan", and safety.
66
+ - **OKF** (`okf/`) is the reference layer: the entity schema-of-record plus the metric,
67
+ playbook, and concept catalog.
68
+
69
+ Skills point into `okf/`; when a schema fact in a shared reference and in `okf/` ever
70
+ disagree, `okf/` wins.
@@ -0,0 +1,46 @@
1
+ # Producing & Consuming OKF
2
+
3
+ ## CLI
4
+
5
+ ```bash
6
+ zeyos okf list # list concepts (type, id, title); --json for automation
7
+ zeyos okf show tickets # print a concept (bare resource name or entities/tickets)
8
+ zeyos okf check # validate the bundle for OKF v0.1 conformance (exit non-zero on error)
9
+ zeyos okf export --out ./okf # copy the shipped bundle into a directory
10
+ zeyos okf build --out ./okf # synthesize a bundle from the client's schema
11
+ ```
12
+
13
+ `export` copies the rich shipped bundle (with curated metrics/playbooks/notes). `build`
14
+ synthesizes a structural bundle from the client's introspection surface — useful where the
15
+ shipped files aren't present, or to diff against a live instance.
16
+
17
+ ## JavaScript client
18
+
19
+ The OKF surface is exported from `@zeyos/client`:
20
+
21
+ ```js
22
+ import { buildOkf, loadOkfBundle, validateOkfBundle, validateOkfFiles, OKF_VERSION } from '@zeyos/client';
23
+
24
+ // Synthesize a conformant bundle from the client's generated schema (pure; browser-safe).
25
+ const files = buildOkf(); // { 'entities/tickets.md': '…', … }
26
+ const { valid, errors } = validateOkfFiles(files);
27
+
28
+ // Load the shipped (or any) bundle from disk (Node only).
29
+ const bundle = await loadOkfBundle('node_modules/@zeyos/client/okf');
30
+ bundle.version; // '0.1'
31
+ bundle.concepts['entities/tickets'].frontmatter // { type: 'ZeyOS Entity', title: 'Tickets', … }
32
+
33
+ // Validate a directory or an in-memory file map.
34
+ await validateOkfBundle('okf');
35
+ ```
36
+
37
+ - `buildOkf({ schema?, services? })` — pure producer; defaults to the generated `SCHEMA`/`SERVICES`.
38
+ - `loadOkfBundle(dir)` — Node-only reader (lazy `fs`), returns `{ version, files, concepts }`.
39
+ - `validateOkfBundle(dirOrFiles)` / `validateOkfFiles(files)` — v0.1 conformance check.
40
+
41
+ ## Build-time producer
42
+
43
+ In this repo, `npm run okf:build` (or `npm run generate`, which runs it alongside the client
44
+ codegen) emits the rich bundle from `openapi/{api,dbref}.json` plus the curated content in
45
+ `scripts/data/okf-curation.mjs`. It also injects the generated operationId table into
46
+ `agents/shared/zeyos-entity-reference.md`. Validate with `npm run okf:check`.
@@ -0,0 +1,53 @@
1
+ # Keeping OKF Fresh
2
+
3
+ The OKF bundle is generated from the OpenAPI/dbref snapshots in `openapi/`. When ZeyOS
4
+ updates its database model or API, those specs are re-exported and the bundle is
5
+ regenerated. The design keeps that safe and observable.
6
+
7
+ ## What protects curation
8
+
9
+ 1. **Deterministic generation.** `npm run generate` runs the OKF producer alongside the
10
+ client codegen. Re-running with unchanged specs produces **no diff** (no timestamp churn).
11
+ 2. **Managed blocks.** Only the fenced `okf:generated` region of each entity concept is
12
+ rewritten; curated `# Notes`/`# Metrics` prose is spliced back unchanged. See the
13
+ [overview](./01-overview.md#generated-vs-curated-managed-blocks).
14
+ 3. **`source_snapshot`.** The root `index.md` frontmatter carries a content hash of the
15
+ schema. When the specs change, the hash changes — a staleness signal for consumers and
16
+ the drift gate.
17
+ 4. **`log.md` schema diff.** The producer diffs the new schema against the last snapshot and
18
+ appends a dated entry (added/removed fields, changed enums, new foreign keys) — an
19
+ OKF-native, human- and agent-readable record of *what changed when the model updated*.
20
+
21
+ ## The spec-refresh runbook
22
+
23
+ ```bash
24
+ # 1. Replace the snapshots with the newly exported specs
25
+ # openapi/api.json, openapi/dbref.json
26
+
27
+ # 2. Regenerate the client and the OKF bundle
28
+ npm run generate
29
+
30
+ # 3. Review the diff and the changelog
31
+ git diff okf/ agents/shared/zeyos-entity-reference.md
32
+ cat okf/log.md # newest dated entry summarizes the schema changes
33
+
34
+ # 4. Validate conformance + the drift gate
35
+ npm run okf:check
36
+
37
+ # 5. (Optional) enrich weak concepts — see ./04-loops.md
38
+ npm run okf:refine -- --concept entities/<changed-entity>
39
+
40
+ # 6. Commit
41
+ git add okf agents/shared src/generated && git commit -m "Refresh schema + OKF"
42
+ ```
43
+
44
+ ## The drift gate (CI)
45
+
46
+ `npm run okf:check` runs `test/okf.test.js`, which regenerates the bundle and asserts the
47
+ committed content matches a fresh regen. It fails the build when:
48
+
49
+ - the specs changed but `okf/` wasn't regenerated and committed;
50
+ - someone hand-edited a generated region;
51
+ - a concept is non-conformant, an API-backed entity lacks a concept, or a structural
52
+ cross-link is broken;
53
+ - the shared reference's generated operationId table fell out of sync.
@@ -0,0 +1,58 @@
1
+ # Refining with Loops
2
+
3
+ OKF and the skill pack are refined with the same loop machinery the agent protocol already
4
+ uses — a measurement loop and a refinement loop that close on each other.
5
+
6
+ ## Measure: OKF as agent context
7
+
8
+ The agent protocol (`npm run test:agent-protocol`) drives a real coding agent through
9
+ business scenarios against a live demo instance and verifies each outcome independently. A
10
+ `--context` axis chooses which knowledge the agent is pointed at:
11
+
12
+ ```bash
13
+ # Skills only (default), OKF only, or both
14
+ npm run test:agent-protocol -- --context okf --scenario b03-billing-transaction-count
15
+ npm run test:agent-protocol -- --context both --layer b
16
+ ```
17
+
18
+ The bundle is exposed to the agent as `ZEYOS_OKF_ROOT` (mirroring `ZEYOS_SKILL_ROOT`). The
19
+ loop runner sweeps the axis and reports per-context pass rates, so you can see whether
20
+ OKF-as-context lifts accuracy and which concepts correlate with failures:
21
+
22
+ ```bash
23
+ npm run test:agent-loop -- --context skills,okf,both --read-only --agents opencode
24
+ ```
25
+
26
+ The scorecard tells you which **skill** and which **OKF concept** to improve.
27
+
28
+ ## Refine: generate → validate → judge → apply
29
+
30
+ `npm run okf:refine` improves a concept's **curated** guidance (never the generated block):
31
+
32
+ ```bash
33
+ # Target a concept directly, or derive weak concepts from a run's scorecard
34
+ npm run okf:refine -- --concept entities/tickets
35
+ npm run okf:refine -- --scorecard test/agent-protocol/results/<run>/scorecard.json
36
+ npm run okf:refine -- --concept entities/transactions --apply # write the accepted revision
37
+ ```
38
+
39
+ Each target goes through:
40
+
41
+ 1. **Generate** — a proposer model drafts improved curated notes from the current concept.
42
+ 2. **Validate** — any field the proposal references must exist on the entity (checked
43
+ against the client schema), so the model can't invent columns or enums.
44
+ 3. **Judge** — a held-out judge model (`agentProtocol.judgeModel`, reusing `judge.mjs`)
45
+ approves only if the revision is more accurate and useful and contradicts no schema fact.
46
+ 4. **Apply** — with `--apply`, the accepted notes replace the curated tail; the generated
47
+ managed block is never touched. Without `--apply`, proposals are written for review.
48
+
49
+ ## The closed loop
50
+
51
+ ```
52
+ specs + curation ──▶ okf/ ──▶ agent-protocol (--context okf) ──▶ scorecard
53
+ ▲ │
54
+ └──────────── okf:refine (curated notes) ◀─────────────────┘
55
+ ```
56
+
57
+ Drive it self-paced with the Claude Code `/loop` skill: *measure → pick the weakest concept
58
+ → refine → re-measure*, until pass rates plateau.
@@ -0,0 +1,9 @@
1
+ {
2
+ "label": "Open Knowledge Format (OKF)",
3
+ "position": 7,
4
+ "collapsed": false,
5
+ "link": {
6
+ "type": "generated-index",
7
+ "description": "The ZeyOS knowledge bundle in Google's Open Knowledge Format — a portable, Git-native Markdown description of the data model that agents and tools consume, how to produce and keep it fresh, and how it ties into the skill-improvement loops."
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ ---
2
+ type: Reference
3
+ title: Counting and summing
4
+ description: "Count server-side; there is no server-side SUM."
5
+ tags: [query]
6
+ ---
7
+
8
+ **Counts.** Use `zeyos count <resource>` (CLI) or `count: true` on the list call (client). Never `list` + array length: `zeyos list` defaults to `--limit 50`, so you get the page size, not the total (the only `--json` truncation signal is a stderr "Showing X–Y of TOTAL" hint).
9
+
10
+ **Sums.** There is no server-side SUM. `list` the matching rows with the numeric field at a high `--limit` (up to 10000) and add them up client-side.
@@ -0,0 +1,12 @@
1
+ ---
2
+ type: Reference
3
+ title: Dates are Unix seconds
4
+ description: "All ZeyOS timestamps are Unix seconds; pick the indexed date field."
5
+ tags: [query]
6
+ ---
7
+
8
+ All ZeyOS dates are Unix timestamps in **seconds** (not milliseconds).
9
+
10
+ - `date` — business-effective date (invoice date, message date). Use for period reporting. Indexed.
11
+ - `lastmodified` — recent-change tracking.
12
+ - `creationdate` — often **unindexed**; filtering a time window on it (or other unindexed date columns) can return **HTTP 503**. Prefer the indexed `date` field for windows.
@@ -0,0 +1,14 @@
1
+ ---
2
+ type: Reference
3
+ title: Common enums
4
+ description: "Priority and ticket status enum values."
5
+ tags: [reference]
6
+ ---
7
+
8
+ Each entity concept's **Enums** section carries that entity's enums (parsed from the schema). The most-used:
9
+
10
+ **Priority** (tickets/tasks): `0`=LOWEST, `1`=LOW, `2`=MEDIUM, `3`=HIGH, `4`=HIGHEST.
11
+
12
+ **Ticket status**: `0`=NOT_STARTED, `1`=AWAITING_ACCEPTANCE, `2`=ACCEPTED, `3`=REJECTED, `4`=ACTIVE, `5`=INACTIVE, `6`=FEEDBACK_REQUIRED, `7`=TESTING, `8`=CANCELLED, `9`=COMPLETED, `10`=FAILED, `11`=BOOKED. Closed = IN [9, 11].
13
+
14
+ **Account type**: `0`=PROSPECT, `1`=CUSTOMER, `2`=SUPPLIER, `3`=CUSTOMERANDSUPPLIER, `4`=COMPETITOR, `5`=EMPLOYEE.
@@ -0,0 +1,14 @@
1
+ ---
2
+ type: Reference
3
+ title: filters vs filter (the FK/GIN footgun)
4
+ description: "Use `filters` (plural) so foreign-key fields match via their GIN/partial indexes."
5
+ tags: [query]
6
+ ---
7
+
8
+ The OpenAPI spec documents the list body field as `filter` (singular), but **`filters` (plural)** is what reliably matches GIN-indexed / partial-indexed foreign-key fields (`account`, `project`, `ticket` on related resources).
9
+
10
+ - `@zeyos/client`: use `filters`.
11
+ - `zeyos` CLI: pass `--filter '{…}'` — it serializes to `filters` internally.
12
+ - Raw REST: the spec says `filter`; verify against the target instance.
13
+
14
+ `client.schema.validate()` flags a top-level `filter` on list/count ops and suggests `filters`. Only filter on columns the resource actually has — an unknown column 400s with no hint which field was wrong (run `zeyos describe <resource>` first).
@@ -0,0 +1,8 @@
1
+ # Concepts
2
+
3
+ * [Common enums](enums.md) - Priority and ticket status enum values.
4
+ * [Counting and summing](counting-and-sums.md) - Count server-side; there is no server-side SUM.
5
+ * [Dates are Unix seconds](dates-unix-seconds.md) - All ZeyOS timestamps are Unix seconds; pick the indexed date field.
6
+ * [filters vs filter (the FK/GIN footgun)](filters-vs-filter.md) - Use `filters` (plural) so foreign-key fields match via their GIN/partial indexes.
7
+ * [operationId ≠ table noun](operationid-vocabulary.md) - REST operationIds are CamelCase compounds; several diverge from the dbref noun.
8
+ * [visibility: 0 (only where the column exists)](visibility-column.md) - visibility:0 hides archived rows — but only resources that have the column.