@klok-integration/cli 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/assets/agents/AGENTS.application.md +1 -1
- package/assets/agents/AGENTS.datamodel.md +2 -2
- package/assets/agents/AGENTS.documentation.md +1 -1
- package/assets/agents/AGENTS.framework.md +1 -1
- package/assets/agents/AGENTS.integration.md +5 -1
- package/assets/agents/AGENTS.workspace.md +94 -18
- package/assets/agents/knowledge/README.md +77 -0
- package/assets/agents/knowledge/glossary.md +26 -0
- package/assets/agents/knowledge/kloker-identity.md +456 -0
- package/assets/agents/knowledge/platform-rules.md +152 -0
- package/assets/agents/knowledge/retired-patterns.txt +47 -0
- package/assets/agents/knowledge/roles/integration-architect.md +177 -0
- package/assets/agents/knowledge/roles/integration-developer.md +238 -0
- package/assets/agents/skills/klok-datamodel/SKILL.md +5 -6
- package/assets/agents/skills/klok-docs/SKILL.md +35 -15
- package/assets/agents/skills/klok-release/SKILL.md +8 -7
- package/assets/agents/skills/klok-route/SKILL.md +60 -10
- package/assets/agents/skills/klok-worktree/SKILL.md +1 -1
- package/dist/cli.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,8 +22,12 @@ klok # opens the terminal UI
|
|
|
22
22
|
|
|
23
23
|
Configuration lives in `~/.config/klok/config.json`. Every value can be overridden by an environment
|
|
24
24
|
variable: `KLOK_AGENT_URL`, `KLOK_TENANT`, `KLOK_DOMAIN`, `KLOK_DEV_URL`, `KLOK_KEYCLOAK_ISSUER`,
|
|
25
|
-
`KLOK_KEYCLOAK_CLIENT_ID`, `KLOK_GIT_URL`, `KLOK_GIT_LOCAL_WORKSPACE`. Run
|
|
26
|
-
what is set and where it comes from.
|
|
25
|
+
`KLOK_KEYCLOAK_CLIENT_ID`, `KLOK_GIT_URL`, `KLOK_GIT_LOCAL_WORKSPACE`, `KLOK_GIT_APIKEY`. Run
|
|
26
|
+
`klok config list` to see what is set and where it comes from.
|
|
27
|
+
|
|
28
|
+
The GitLab token can be stored with `klok config set klokApiKey` (a hidden prompt, so it stays out of the shell
|
|
29
|
+
history). It is shown as `****` everywhere unless you run `klok config get klokApiKey --reveal`, and the file
|
|
30
|
+
is kept at mode 0600.
|
|
27
31
|
|
|
28
32
|
Credentials are written to `~/.config/klok/credentials.json` with mode 0600.
|
|
29
33
|
|
|
@@ -40,8 +44,12 @@ Credentials are written to `~/.config/klok/credentials.json` with mode 0600.
|
|
|
40
44
|
| `klok agent tasks`, `klok agent open <taskId>`, `klok agent cancel <taskId>` | Work with tasks. |
|
|
41
45
|
| `klok agent answer <taskId> --question <qid> --text "..."` | Answer a clarification and continue. |
|
|
42
46
|
| `klok agent serve [--port 3091]` | Loopback MCP and A2A proxy for IDEs and other agents. |
|
|
43
|
-
| `klok agents init` | Write the Klok agent instructions and skills into a repository. |
|
|
47
|
+
| `klok agents init` | Write the Klok agent instructions, the platform skills and your tenant's skills into a repository, with a Claude Code hook that keeps them fresh. |
|
|
48
|
+
| `klok agents update [--check] [--global]` | Fetch what moved in the platform and tenant catalogs; `--check` exits 5 when something is outdated. |
|
|
49
|
+
| `klok agents status` | Per file and per catalog: current, outdated, missing or unreachable. |
|
|
44
50
|
| `klok bead list\|show\|report` | Progress beads in the current repository. |
|
|
51
|
+
| `klok docs read <doc-id>` | Print a documentation project's `llm.txt` from docs.klok.dev, read with your GitLab token and cached. |
|
|
52
|
+
| `klok docs id [path]` | The doc id of a repository path. |
|
|
45
53
|
| `klok docs publish` | Build this repository's znai documentation and upload it to the docs portal. |
|
|
46
54
|
| `klok docs build` | Build this repository's `klok-docs/` with znai the way its documentation project will, uploading nothing. |
|
|
47
55
|
| `klok solutions validate` | Check the descriptors of an integration solution registry against the descriptor contract. |
|
|
@@ -101,7 +109,12 @@ Cursor (`.cursor/mcp.json`):
|
|
|
101
109
|
Klok skills. `KLOK-AGENTS.md`, the klok rule files and the `klok-*` skills belong to Klok and are
|
|
102
110
|
replaced wholesale; every other file keeps its content and only has its single row created or replaced,
|
|
103
111
|
so an update can never duplicate text. Klok skills the CLI no longer ships are removed.
|
|
104
|
-
|
|
112
|
+
Your tenant's skills (`<tenant>-context` and one skill per documented repository) come from the tenant's private
|
|
113
|
+
catalog with your GitLab token (`KLOK_GIT_APIKEY`); they are installed, kept out of git, and refreshed by
|
|
114
|
+
`klok agents update`. `klok agents status` shows whether a repository is up to date with the catalogs.
|
|
115
|
+
After you install or update the CLI, the first interactive run tells you when the instructions you installed
|
|
116
|
+
with `klok agents init --global` or `--workspace` are older than the CLI, and prints the commands that update
|
|
117
|
+
them.
|
|
105
118
|
|
|
106
119
|
## Licence and support
|
|
107
120
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A Klok application (portal, docs portal, agent service or another container) that is built and deployed with the
|
|
4
4
|
platform pipelines: image to `repo.klok.dev`, deployment manifest in the manifests repository, secrets through
|
|
5
|
-
Vault. Read
|
|
5
|
+
Vault. Read `klok docs read klok-environment-build-ci-templates` for the release process and the
|
|
6
6
|
repository's own `README.md` and `docs/` for its architecture.
|
|
7
7
|
|
|
8
8
|
### Rules
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A Klok datamodel: an XSD (or JSON schema) under `schema-definition-xsd/`, converted by the pipeline to Avro and to
|
|
4
4
|
a generated Java project that is published as `dev.klok.<tenant>.datamodel:<name>-v<n>` and written into the
|
|
5
|
-
dependency catalog. Read
|
|
6
|
-
|
|
5
|
+
dependency catalog. Read `klok docs read klok-framework-klok-common` for naming and
|
|
6
|
+
`klok docs read klok-environment-build-ci-templates` for the pipeline.
|
|
7
7
|
|
|
8
8
|
### Rules
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## This repository: documentation project
|
|
2
2
|
|
|
3
3
|
A znai documentation project published to https://docs.klok.dev under the doc id in `klok-docs-sync.json`. Read
|
|
4
|
-
|
|
4
|
+
`klok docs read klok-environment-build-ci-templates` (documentation from a source repository) for how
|
|
5
5
|
content arrives here. There are two kinds, and they are edited differently:
|
|
6
6
|
|
|
7
7
|
* **The documentation project of a source repository** (`<tenant>/documentation/<group>/.../<repo>`, mirroring the
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Part of the Klok framework (klok-common, the broker client, the Quarkus extension, the gradle plugin or the CI
|
|
4
4
|
templates). Changes here reach every tenant, so read the library's `klok-docs/` and its published documentation
|
|
5
|
-
(`
|
|
5
|
+
(`klok docs read klok-framework-<repo>`) before changing behaviour.
|
|
6
6
|
|
|
7
7
|
### Rules
|
|
8
8
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A Klok integration on the Quarkus extension 2.0: one Camel route per class, each extending a framework pattern
|
|
4
4
|
(`KlokOnrampRoute`, `KlokProcessingRoute`, `KlokOfframpRoute`, their `Sync` variants, `KlokRestApi` and
|
|
5
5
|
`KlokRestApiHandlerRoute`, `KlokAsyncTaskWorkerRoute`, `KlokCustomRoute`) and implementing the capabilities it
|
|
6
|
-
needs. Read
|
|
6
|
+
needs. Read `klok docs read klok-framework-klok-quarkus-extension` before writing a route.
|
|
7
7
|
|
|
8
8
|
### Commands
|
|
9
9
|
|
|
@@ -20,6 +20,10 @@ needs. Read https://docs.klok.dev/klok-framework-klok-quarkus-extension/llm.txt
|
|
|
20
20
|
Configuration keys are `<RouteId>.<key>` with fallback to `<SolutionId>.<key>` and `klok.route-defaults.<key>`.
|
|
21
21
|
* Datamodels are the type parameters of the pattern class and come from the catalog bundles; never hand write DTOs
|
|
22
22
|
for something a datamodel project should own.
|
|
23
|
+
* A datamodel used in more than one flow gets a **topic purpose** per flow (`<Model>_<purpose>`, set with
|
|
24
|
+
`topicPurpose()` or `<RouteId>.topic.purpose`), agreed with the project on the other end and written in both
|
|
25
|
+
projects' `klok-docs/`. Never consume a shared topic and discard the other flows' messages. The `klok-route` skill
|
|
26
|
+
has the details.
|
|
23
27
|
* Errors: throw `Klok4XXException` for caller errors (no retry) and `Klok5XXException` or plain exceptions for
|
|
24
28
|
retryable failures; the framework retries, republishes to `_DLQ` and emits the failure event. Do not add
|
|
25
29
|
`onException` blocks unless the route owns the failure (`failureHandled()`).
|
|
@@ -8,23 +8,81 @@ otherwise yours. Do not copy rules into them.
|
|
|
8
8
|
|
|
9
9
|
## Read the documentation before guessing
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Before anything else, run `klok agents update --check`. Exit 5 means the installed skills are behind a catalog:
|
|
12
|
+
run `klok agents update` and read the refreshed files. Exit 0 means they are current, and any other code names
|
|
13
|
+
what went wrong (no token, no network); say so instead of guessing.
|
|
14
|
+
|
|
15
|
+
The platform documentation is published at https://docs.klok.dev, one documentation project per repository, each
|
|
16
|
+
exposing its whole content as one markdown file. Read it with klok-cli, which sends your GitLab token and caches
|
|
17
|
+
the answer:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
klok docs read <doc-id> # the markdown on stdout, one status line on stderr; --json adds fetchedAt
|
|
21
|
+
klok docs id [tenant/group/.../repo] # the doc id of a repository, this one by default
|
|
22
|
+
```
|
|
13
23
|
|
|
14
24
|
| Topic | Read |
|
|
15
25
|
|---|---|
|
|
16
|
-
| Platform principles, event driven design, naming, onboarding |
|
|
17
|
-
| Route framework (patterns, config, logging, errors, topics, tasks) |
|
|
18
|
-
| Naming conventions, message properties, CloudEvents |
|
|
19
|
-
| Broker client |
|
|
20
|
-
| Gradle plugin, versions, catalog |
|
|
21
|
-
| CI templates, release process, Vault roles |
|
|
22
|
-
| Developer rules: identity and access, Keycloak, Vault paths, certificates, infrastructure as code |
|
|
23
|
-
| How people use the platform: concepts, roles and access, workflow, operations |
|
|
24
|
-
| Infrastructure: stateful services, certificates, Ansible, Keycloak clients |
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
| Platform principles, event driven design, naming, onboarding | `klok docs read klok-integration-strategy-and-tactics` |
|
|
27
|
+
| Route framework (patterns, config, logging, errors, topics, tasks) | `klok docs read klok-framework-klok-quarkus-extension` |
|
|
28
|
+
| Naming conventions, message properties, CloudEvents | `klok docs read klok-framework-klok-common` |
|
|
29
|
+
| Broker client | `klok docs read klok-framework-klok-brokerclient-java` |
|
|
30
|
+
| Gradle plugin, versions, catalog | `klok docs read klok-framework-klok-gradle-plugin` |
|
|
31
|
+
| CI templates, release process, Vault roles | `klok docs read klok-environment-build-ci-templates` |
|
|
32
|
+
| Developer rules: identity and access, Keycloak, Vault paths, certificates, infrastructure as code | `klok docs read klok-framework-development-guide` |
|
|
33
|
+
| How people use the platform: concepts, roles and access, workflow, operations | `klok docs read klok-user-guide` |
|
|
34
|
+
| Infrastructure: stateful services, certificates, Ansible, Keycloak clients | `klok docs read klok-environment-klok-environment-setup` |
|
|
35
|
+
|
|
36
|
+
What the answers mean:
|
|
37
|
+
|
|
38
|
+
* **404**: the project is not published yet. Its hand written pages are in the repository's `klok-docs/` on
|
|
39
|
+
`main`, the source of the same site: `git -C <repo> fetch origin && git show origin/main:klok-docs/<page>.md`
|
|
40
|
+
(`toc-manifest.json` lists the pages). Read them there; nothing else is a substitute.
|
|
41
|
+
* **401 or 403** (no token, or your GitLab account is not a member of the tenant or domain): say so and ask for a
|
|
42
|
+
token or for access. Never guess what the page says, and never try another way in.
|
|
43
|
+
|
|
44
|
+
The `klok-docs` skill describes the lookup in detail. Cite the doc id you relied on, and the `fetchedAt` from
|
|
45
|
+
`klok docs read --json`, in your answer or merge request description.
|
|
46
|
+
|
|
47
|
+
## Tenant skills
|
|
48
|
+
|
|
49
|
+
Next to the platform skills (`klok-docs`, `klok-route`, `klok-datamodel`, `klok-release`, `klok-worktree`) the
|
|
50
|
+
skill directories hold your tenant's own skills, generated by KlokDocumentationEgress from every documentation
|
|
51
|
+
publish in the tenant and served from the tenant's private catalog:
|
|
52
|
+
|
|
53
|
+
* `<tenant>-context` is the router: what exists in the tenant (repositories, systems, datamodels, topics,
|
|
54
|
+
solutions), where it lives, and which skill to open for it. Start there. Its `data/` holds `projects.jsonl`,
|
|
55
|
+
`routes.jsonl`, `datamodels.jsonl`, `topics.jsonl` and `solutions.jsonl`.
|
|
56
|
+
* `<tenant>-<group>-…-<repo>` is one skill per documented repository (the name is its doc id): what the project
|
|
57
|
+
does, its routes, datamodels, topics, solution and configuration keys, with every fact as one JSON row in
|
|
58
|
+
`data/facts.jsonl` (`kind` first: `project`, `route`, `topic`, `datamodel`, `solution`, `config-key`, `doc-page`,
|
|
59
|
+
`component`).
|
|
60
|
+
* Search the facts instead of reading everything: `grep -i <term> .claude/skills/<skill>/data/facts.jsonl`, or
|
|
61
|
+
`jq -c 'select(.kind=="route")' .claude/skills/<skill>/data/facts.jsonl` (`.agents/skills/` for Codex, OpenCode
|
|
62
|
+
and Antigravity).
|
|
63
|
+
* They are installed, never committed: `klok agents update` refreshes them from the catalog and keeps them out of
|
|
64
|
+
git through `info/exclude`. Never edit them; a wrong fact is fixed in the repository's `klok-docs/` or code, and
|
|
65
|
+
the next documentation publish regenerates the skill.
|
|
66
|
+
|
|
67
|
+
## Klok knowledge
|
|
68
|
+
|
|
69
|
+
The folder `knowledge/` next to this file holds the platform knowledge that Klok's models and agents share. Read
|
|
70
|
+
it when a task touches the platform:
|
|
71
|
+
|
|
72
|
+
| File | Holds |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `knowledge/platform-rules.md` | the current platform rules: principles, naming, route ids and legs, topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL |
|
|
75
|
+
| `knowledge/glossary.md` | the Klok terms and what they mean |
|
|
76
|
+
| `knowledge/kloker-identity.md` | Kloker's identity and writing style |
|
|
77
|
+
| `knowledge/roles/` | the role handbooks of the Kloker role models |
|
|
78
|
+
| `knowledge/retired-patterns.txt` | conventions the platform no longer has, one pattern per line with the reason |
|
|
79
|
+
|
|
80
|
+
* Klok knowledge is edited **only** in klok-integration-agent, `packages/cli/assets/agents/knowledge/`. Every other
|
|
81
|
+
copy is generated and never edited: `knowledge/` next to an installed `KLOK-AGENTS.md`, the catalog's
|
|
82
|
+
`agents/knowledge/`, `build/generated/klok-knowledge/`, `generated/klok-knowledge/` and the copies in images.
|
|
83
|
+
* A prompt, persona or agent instruction that needs the glossary or the platform rules loads the knowledge block.
|
|
84
|
+
It never restates it.
|
|
85
|
+
* Text that matches a line of `retired-patterns.txt` teaches a rule the platform no longer has; fix it at its source.
|
|
28
86
|
|
|
29
87
|
## Git is the truth, everything must work by hand
|
|
30
88
|
|
|
@@ -106,7 +164,7 @@ step by step procedure; the contract every agent follows is:
|
|
|
106
164
|
layers, no layer cache, push from `main` only. Never use or propose a privileged runner, `docker:dind`, or a
|
|
107
165
|
relaxed seccomp or AppArmor profile. A Dockerfile copies dependencies, assets and application code as separate
|
|
108
166
|
`COPY` layers and sets owners with `COPY --chown`, never `RUN chown -R`, so that a build stores only what
|
|
109
|
-
changed. Read the *Container images* page of
|
|
167
|
+
changed. Read the *Container images* page of `klok docs read klok-environment-build-ci-templates`
|
|
110
168
|
before changing a Dockerfile or an image job.
|
|
111
169
|
* Vault (`vault.ipaas.se`) is changed by a human only. Agents may read to diagnose and must then propose the exact
|
|
112
170
|
command, including every existing field of the object.
|
|
@@ -121,6 +179,14 @@ step by step procedure; the contract every agent follows is:
|
|
|
121
179
|
* Never push to `main` of an existing repository, never force push, never merge. Work on a branch and open a
|
|
122
180
|
merge request that is ready for review; only a brand new repository gets its first commit on `main`. A draft
|
|
123
181
|
merge request is not the default, it is what you open when the work is knowingly unfinished, and you say why.
|
|
182
|
+
* **Never cancel a running job without a human's yes.** Cancelling, stopping, killing, deleting or force-restarting
|
|
183
|
+
anything that runs is never done on an agent's own judgement: a CI job or pipeline, a release, a deployment
|
|
184
|
+
rollout, a pod, a container, a broker consumer, a scheduled task. Describe what you see (job id, how long it has
|
|
185
|
+
run by the current time from `date -u`, never an assumed time, the last log lines with their timestamps, what
|
|
186
|
+
waits behind it), say what you propose and what it would break, and wait for an explicit yes. "It looks hung",
|
|
187
|
+
"it blocks the `main` lane" and "it can be retried" are reasons to ask at once, not to act: a release that waits
|
|
188
|
+
for Maven Central or npm can legitimately take half an hour. On 2026-09-29 an agent cancelled the Gradle
|
|
189
|
+
plugin's release while it correctly waited for Maven Central, because it misread the time.
|
|
124
190
|
|
|
125
191
|
## Logic lives in the Klok tools, not in the pipelines
|
|
126
192
|
|
|
@@ -146,7 +212,8 @@ step by step procedure; the contract every agent follows is:
|
|
|
146
212
|
and the solution key.
|
|
147
213
|
* Topics: `persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>]`, request/reply
|
|
148
214
|
`ReqRes_<Req>_<Res>_Request|_Response`, dead letters `<topic>_DLQ`. The datamodel major version is in the class
|
|
149
|
-
name (`CustomerV1`).
|
|
215
|
+
name (`CustomerV1`). The purpose is a flow that producer and consumer agree on, so one datamodel serves several
|
|
216
|
+
flows and each consumer reads only its own; it never contains `_`.
|
|
150
217
|
* Context properties: `klok-correlation-id`, `klok-invocation-id`, `klok-parent-invocation-id`, `klok-task-id`,
|
|
151
218
|
`klok-solution-id`, `klok-route-id`, `klok-tenant`, `klok-domain`, `klok-environment`; same spelling as HTTP
|
|
152
219
|
header, Pulsar property and CloudEvents extension, `klok.`-prefixed as MDC key.
|
|
@@ -159,7 +226,7 @@ step by step procedure; the contract every agent follows is:
|
|
|
159
226
|
## Broker access and tenant isolation
|
|
160
227
|
|
|
161
228
|
Read the *Broker Access And Tenant Isolation* page of
|
|
162
|
-
|
|
229
|
+
`klok docs read klok-framework-development-guide` before designing anything that touches broker
|
|
163
230
|
access, Keycloak broker clients or a service that serves several tenants.
|
|
164
231
|
|
|
165
232
|
* **The topic decides the tenant, never the message.** Pulsar does not tell a consumer who published; a `tenant`
|
|
@@ -223,6 +290,15 @@ Klok documentation has three levels, and a change is finished only when all thre
|
|
|
223
290
|
sections that fill `KLOK:GENERATED` regions. They are never edited by hand. A wrong generated page is fixed in
|
|
224
291
|
the egress or in the documentation generation settings in klok.dev.
|
|
225
292
|
|
|
293
|
+
**Prompts and agent instructions carry the same knowledge.** System prompts, section prompts, personas, tool
|
|
294
|
+
descriptions, these agent instructions and the skills teach platform rules to a model, and they load the shared
|
|
295
|
+
blocks from *Klok knowledge* above instead of restating them. The *Prompt Catalogue* in
|
|
296
|
+
the framework development guide (`klok docs read klok-framework-development-guide`) lists every place.
|
|
297
|
+
A change to a platform rule, the strategy, naming, the datamodel classes or the glossary checks the catalogue. It
|
|
298
|
+
updates every prompt that restates the change, or files an issue in the owning repository for each one it leaves. A
|
|
299
|
+
new prompt, persona, tool description or agent instruction is added to the catalogue in the same merge request.
|
|
300
|
+
Prompts never carry `/think` or `/no_think` tokens; the model name (`Kloker-nothink`, `Kloker`) is the only switch.
|
|
301
|
+
|
|
226
302
|
### Before the merge request
|
|
227
303
|
|
|
228
304
|
1. Update the repository's `klok-docs/` in the same merge request as the change — ideally in the same commit as
|
|
@@ -233,7 +309,7 @@ Klok documentation has three levels, and a change is finished only when all thre
|
|
|
233
309
|
cannot parse fails now instead of stopping the documentation project from publishing after the merge, where
|
|
234
310
|
nobody in this repository sees it.
|
|
235
311
|
3. Ask what a reader of the platform documentation would now find wrong: a renamed command, a new rule, a changed
|
|
236
|
-
default, a workflow with one more step. Read the affected pages (`
|
|
312
|
+
default, a workflow with one more step. Read the affected pages (`klok docs read <doc-id>`)
|
|
237
313
|
instead of guessing what they say.
|
|
238
314
|
4. Correct what you can judge yourself. A central page that is now plainly wrong is fixed in its own small merge
|
|
239
315
|
request against that documentation project, linked from the change. What you cannot judge is written down
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Klok knowledge
|
|
2
|
+
|
|
3
|
+
This folder is the single source of the platform knowledge that Klok teaches its models and agents: the glossary,
|
|
4
|
+
the platform rules, Kloker's identity and writing style, the role handbooks, and the list of retired conventions.
|
|
5
|
+
Every system prompt, agent instruction and tool that needs this knowledge loads these files. None of them keeps a
|
|
6
|
+
text of its own.
|
|
7
|
+
|
|
8
|
+
## Edit only here
|
|
9
|
+
|
|
10
|
+
* Klok knowledge is edited **only** in klok-integration-agent, `packages/cli/assets/agents/knowledge/`, through a
|
|
11
|
+
merge request like any other change.
|
|
12
|
+
* Everything else is a generated copy and is never edited: `knowledge/` next to an installed `KLOK-AGENTS.md`, the
|
|
13
|
+
catalog's `agents/knowledge/` and `klok-agents.zip`, `build/generated/klok-knowledge/` in a Java build,
|
|
14
|
+
`generated/klok-knowledge/` in klok.dev, and the copies inside images. A wrong copy is fixed here and refreshed.
|
|
15
|
+
* A prompt that needs the glossary or the platform rules loads the block. It never restates it, and it never
|
|
16
|
+
paraphrases a rule "to keep the prompt short".
|
|
17
|
+
* A change here is also a prompt change: check the *Prompt Catalogue* in the framework development guide
|
|
18
|
+
(`klok docs read klok-framework-development-guide`) and update it in the same piece of work.
|
|
19
|
+
|
|
20
|
+
## The files
|
|
21
|
+
|
|
22
|
+
| File | What it is | Composed into |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| `glossary.md` | the Klok terms and their meanings, with the rule never to guess a term | every Kloker prompt that explains or documents Klok, the documentation egress's sections |
|
|
25
|
+
| `platform-rules.md` | the current platform rules: principles, naming, route ids and legs, topics, datamodel classes, write narrow and consume wide, claim check, tasks, the ODL | the agent runner's doctrine, the role models, klok.dev's datamodel and planning helpers |
|
|
26
|
+
| `kloker-identity.md` | who Kloker is, and the Unslop writing style | every request to the models `Kloker` and `Kloker-nothink` |
|
|
27
|
+
| `roles/integration-architect.md`, `roles/integration-developer.md` | only what is specific to the role; the rules come from `platform-rules.md` | the role models `Kloker-Integration-Architect` and `Kloker-Integration-Developer` |
|
|
28
|
+
| `retired-patterns.txt` | conventions the platform no longer has, one pattern per line with the reason | tests that fail when a prompt teaches a retired rule |
|
|
29
|
+
|
|
30
|
+
**Blocks.** A block is a Markdown file in this folder other than `README.md`. Its name is its path under
|
|
31
|
+
`knowledge/` without `.md`: `glossary`, `platform-rules`, `kloker-identity`, `roles/integration-architect`,
|
|
32
|
+
`roles/integration-developer`. The Gradle plugin lists the block names in the `blocks=` line of
|
|
33
|
+
`klok-knowledge.properties`, which the build-time loader reads. So keep file names lowercase with hyphens, end a
|
|
34
|
+
block in `.md`, put role handbooks in `roles/`, and do not rename a block without updating every consumer that loads
|
|
35
|
+
it by name. `README.md` and `retired-patterns.txt` are not blocks.
|
|
36
|
+
|
|
37
|
+
A role model's system prompt is composed in this order: `kloker-identity.md`, `platform-rules.md`, `glossary.md`,
|
|
38
|
+
the role file. Plain `Kloker` gets `kloker-identity.md` only; framework knowledge is opt-in through the role models.
|
|
39
|
+
A shared block is always appended by the service, never part of a text a tenant can override, so a tenant override
|
|
40
|
+
can add to the knowledge but not drop it.
|
|
41
|
+
|
|
42
|
+
## Who loads it, and how
|
|
43
|
+
|
|
44
|
+
| Consumer | How it gets the files | When it reads them |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Coding agents in a repository | `klok agents init` (the CLI's bundled copy) and `./gradlew updateKlokAgents` (catalog `main`) write `knowledge/` next to `KLOK-AGENTS.md`: byte for byte copies of every file here, without a marker, so both installers give identical results | the agent reads the files `KLOK-AGENTS.md` points to |
|
|
47
|
+
| Coding agents in a home folder | `klok agents init --global` writes `~/.klok/agents/knowledge/` | same |
|
|
48
|
+
| The agent runner (agent.klok.dev) | the image copies `packages/cli/assets/agents` to `/app/assets/agents` (`KLOK_RUNNER_AGENT_ASSETS_DIR`) | `platform-rules.md` once, on first use, as the doctrine of every task; bead-implementation also seeds `knowledge/` into the sandbox |
|
|
49
|
+
| The dependency catalog | the `update_klok_agents_catalog` job on `main` copies the whole asset tree to `agents/knowledge/` and into `klok-agents.zip` | — |
|
|
50
|
+
| Java services: the Kloker gateway (klok-api-ai), klok-egress-ai, the documentation egress | planned: the Gradle plugin extracts `agents/knowledge/**` from the catalog into `build/generated/klok-knowledge/` on the classpath with a `klok-knowledge.properties` (catalog commit, `blocks=`), and `KlokKnowledge` in klok-common reads the blocks once at start | once, at start; never per request |
|
|
51
|
+
| klok.dev | planned: a prebuild step extracts the catalog's `agents/knowledge/**` into `generated/klok-knowledge/`, read once at module load | once, at start |
|
|
52
|
+
|
|
53
|
+
An installer replaces the files it ships wholesale and leaves any other file in the installed `knowledge/` alone. It
|
|
54
|
+
does not remove a file this folder no longer ships, so a renamed or retired block is deleted from an installed copy
|
|
55
|
+
by hand (or by the merge request that refreshes it).
|
|
56
|
+
|
|
57
|
+
No consumer fetches the knowledge at run time, and none reads a database for it, so an AI request costs no extra I/O.
|
|
58
|
+
Each build records the catalog commit it bundled.
|
|
59
|
+
|
|
60
|
+
## How an update spreads
|
|
61
|
+
|
|
62
|
+
1. A merge request changes a file here. Its pipeline runs the tests, including the check against
|
|
63
|
+
`retired-patterns.txt`.
|
|
64
|
+
2. After the merge, the `main` pipeline copies the assets into the dependency catalog (`agents/knowledge/`,
|
|
65
|
+
`klok-agents.zip`).
|
|
66
|
+
3. Consumers that build from the catalog pick up the new text on their next build. Starting those builds
|
|
67
|
+
automatically when this folder changes is planned (`klok knowledge propagate`).
|
|
68
|
+
4. The agent runner gets it with its next image, which is built from the same commit.
|
|
69
|
+
5. Developers get it with the next klok-cli release (`klok agents init`), or right away from the catalog with
|
|
70
|
+
`./gradlew updateKlokAgents`.
|
|
71
|
+
|
|
72
|
+
## retired-patterns.txt
|
|
73
|
+
|
|
74
|
+
One pattern per line: a regular expression in the syntax JavaScript and Java share, then ` # ` and the reason. A
|
|
75
|
+
leading `(?i)` makes the pattern case-insensitive; blank lines and lines starting with `#` are comments. When a rule
|
|
76
|
+
is retired, add its old form here in the same merge request that changes `platform-rules.md`, so every consumer's
|
|
77
|
+
test catches a copy that still teaches it.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Klok glossary
|
|
2
|
+
|
|
3
|
+
The sources you are given use Klok platform terms. Use these meanings, spell out an abbreviation only as written
|
|
4
|
+
here, and never guess the meaning of a Klok term that is neither in this list nor explained in the sources: write
|
|
5
|
+
it as the source does.
|
|
6
|
+
|
|
7
|
+
| Term | Meaning |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Klok | The integration platform the documented project runs on (iPaaS): Camel routes on Quarkus, an Apache Pulsar broker, datamodels, and the portal klok.dev |
|
|
10
|
+
| ODL | Operative Data Layer: the platform's store for datamodel objects, keyed by the object's datamodel type and an id, per tenant; routes write, read and search it (backed by OpenSearch) |
|
|
11
|
+
| Claim check | A large payload stored in the platform's object storage; the message carries only a reference to it (a `klokcc://` URI) instead of the bytes |
|
|
12
|
+
| Broker, topic | Apache Pulsar. A topic is named `persistent://<tenant>[_<env>]/<domain>/<Model>[_<purpose>]` and carries CloudEvents whose data is a datamodel |
|
|
13
|
+
| CloudEvent | The standard envelope of every broker message: id, type, source, time, and the datamodel as data |
|
|
14
|
+
| DLQ | Dead letter queue: `<topic>_DLQ`, where a message goes after its retries are exhausted |
|
|
15
|
+
| Tenant | An organisation on the platform, and its security boundary; every topic, ODL object and GitLab group belongs to one tenant |
|
|
16
|
+
| Domain | A business area inside a tenant. `common` is shared by the tenant's domains, `public` is open to anyone |
|
|
17
|
+
| Route, route id | One Camel route per Java class. Its id is `<TENANTSHORT><NNN><LEG><seq>_<Description>`, for example `KLK007T1_PublishKlokStandard`; the class name is the id |
|
|
18
|
+
| Leg | The letter in a route id: I ingress (onramp, brings data in), P processing, E egress (offramp, delivers data out), A API, S sub route, T timer |
|
|
19
|
+
| Solution | The business flow a set of routes implements; its id is the route id's prefix, for example `KLK007` |
|
|
20
|
+
| Correlation id | `klok-correlation-id`: follows one business flow across routes and messages |
|
|
21
|
+
| Task | Long-running work tracked by the platform (`KlokTaskV1` events, visible in klok.dev and the task API), for example an `ai.chat` task that asks Kloker for text |
|
|
22
|
+
| Datamodel | A versioned data contract; the major version is in the name (`CustomerV1`). Classes: public (A), common (B) and domain (C) are XSD in a Git project of their own with generated Java, Python and TypeScript; system (X) models one external system and may be plain Java classes. All four classes may travel on the broker |
|
|
23
|
+
| Dependency catalog | The file that pins every Klok library and datamodel version (`klok-libs.versions.toml`) |
|
|
24
|
+
| Kloker | Klok's own AI model, reached through the platform's AI gateway |
|
|
25
|
+
| klok.dev | The platform's web portal: projects, tenants, settings, the ODL and tasks |
|
|
26
|
+
| klok-docs | The folder in every repository with its hand-written documentation, published to docs.klok.dev |
|