Rules for AI assistants

← Rules for AI assistants

Ashterix

docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api

en/docs/api/json-rpc-bundle/developers/ai.md new file +51 āˆ’0

1 + # Rules for AI assistants
2 +
3 + Claude Code, Codex, Cursor, Copilot and other assistants write better code when they know the rules for working with a library. We have prepared instruction files that plug into your project alongside your existing rules — without replacing your `AGENTS.md` or `CLAUDE.md`.
4 +
5 + ## Files
6 +
7 + | File | What for | Download |
8 + | --- | --- | --- |
9 + | `json-rpc-bundle.md` | Projects that expose an API via JsonRpcBundle: how the agent should work with the library, rules for procedures, parameters, results, errors, caching, API versions and groups, events, known pitfalls, verifying the result | <a href="/assets/ai/json-rpc-bundle/json-rpc-bundle.md" download="json-rpc-bundle.md">json-rpc-bundle.md</a> |
10 + | `json-rpc-bundle-extensions.md` | Bundle extension packages: the entry point via `RpcExecutor`, tokens, groups and versions, routes, compile-time constraints, package requirements | <a href="/assets/ai/json-rpc-bundle/json-rpc-bundle-extensions.md" download="json-rpc-bundle-extensions.md">json-rpc-bundle-extensions.md</a> |
11 + | `ufo-code-style.md` | Optional: the UFO-Tech team's code style — for projects that adopt it | <a href="/assets/ai/json-rpc-bundle/ufo-code-style.md" download="ufo-code-style.md">ufo-code-style.md</a> |
12 +
13 + The files are in English: assistants follow English instructions more reliably. The rules are written for bundle version **10.4**.
14 +
15 + ## How to connect
16 +
17 + Put the file in your repository, for example in `docs/ai/`:
18 +
19 + ```bash
20 + mkdir -p docs/ai
21 + curl -o docs/ai/json-rpc-bundle.md https://ufo-tech.space/assets/ai/json-rpc-bundle/json-rpc-bundle.md
22 + ```
23 +
24 + and add a reference to it in the instruction file your project already has:
25 +
26 + | Assistant | What to add |
27 + | --- | --- |
28 + | Codex, Cursor, Zed and others supporting [AGENTS.md](https://agents.md) | a line in your `AGENTS.md`: `When working with JSON-RPC procedures, follow docs/ai/json-rpc-bundle.md.` |
29 + | Claude Code | a line `@docs/ai/json-rpc-bundle.md` (import) in your `CLAUDE.md` |
30 + | GitHub Copilot | a file `.github/instructions/json-rpc-bundle.instructions.md` with the rules' content and `applyTo` for the procedures directory |
31 + | Cursor (project rules) | a file `.cursor/rules/json-rpc-bundle.mdc` with the rules' content |
32 +
33 + Your existing rules remain primary: the bundle's file does not override your project's style or architecture, it only describes how to work with the library.
34 +
35 + ## What is inside
36 +
37 + **How the agent should work** — at the beginning of the file:
38 +
39 + * the source of truth is the installed bundle code in `vendor/` and the release notes in `vendor/ufo-tech/json-rpc-bundle/releases/`, not the model's memory;
40 + * check the installed version; do not invent classes, attributes, options; report any contradiction between the rules and the code;
41 + * do not change public RPC contracts without need (breaking changes mean a new API version) and do not refactor outside the task.
42 +
43 + **Library rules** — briefly, with links to the documentation instead of explanations: thin procedures, DTOs and declarative validation, result format, errors, caching, API versions and groups, events.
44 +
45 + **Known pitfalls of 10.4** — deprecated attributes and events, `#[RPC\DTOCollection]` on a method, `ttl` for `#[RPC\Lock]`, event specifics for Messenger and HTTP errors (see [Open issues](/docs/api/json-rpc-bundle/developers/known_issues/open)).
46 +
47 + **Check before finishing** — tests, a call of the changed method, the schema in `GET /rpc`.
48 +
49 + :::info subtitle="Why this is not documentation"
50 + The file intentionally does not explain how the mechanisms work — that is what the documentation it links to is for. This keeps the instructions short and prevents them from turning into a second copy of the documentation that will drift away from the first over time.
51 + :::