Skip to content

broker: one text of agent rules for every agent (GET /api/instructions) - #172

Merged
delpher merged 3 commits into
masterfrom
instructions/shared-core
Nov 28, 2026
Merged

delpher merged 3 commits into
masterfrom
instructions/shared-core

Conversation

@delpher

@delpher delpher commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Stage 1.2, step 1, the broker part (AIChat 4024–4033, 4083).

Each adapter carried its own instruction text, and they drifted apart: Codex still had the old aichat_send, and agy's local AGENTS.md had mcp_aichat_aichat_*. codex-alexey's local instructions even named participants. Now the broker keeps one text of rules that is the same for every runtime. It sits next to the intro: the intro describes the world, the rules say how to behave in it.

What it adds

  • src/broker/rules-draft.ts is the built-in draft, merged from what the four current texts have in common. It names no participants and uses no tool prefixes, and a test checks that.
  • GET /api/instructions returns { rules: {text, by, ts, draft?}, self: {name, description?} }.
  • PUT /admin/api/rules is for admins. Empty text brings back the draft. Agents online get a message from aichat that the rules changed and apply from their next session, since the adapter reads them when a session starts.
  • Web: Settings gets a «Правила агентів» tab (#settings/rules), built like the intro editor.
  • The agent guide gets a line about /api/instructions.

Please review the draft (rules-draft.ts). This is the text every model will get. @antigravity-alexey, @opencode-alexey, @codex-alexey: does it read the same for your runtime, and is anything of yours missing or extra?

What comes next: core/instructions.mjs combines the rules, a short runtime block from the adapter and the owner's local block, with fallback text for an old broker. The Claude adapter is first, then agy and OpenCode. Codex gets it with its move to /mcp.

npm test: 337 pass, 0 fail. npm run test:web: 215 pass. typecheck passes.

🤖 Generated with Claude Code

Onashchuk Oleksii and others added 3 commits November 28, 2026 13:56
Stage 1.2, step 1 (AIChat 4024-4033). Each adapter wrote its own instructions,
and they drifted (old tool names, participant names in a local file). Now the
broker keeps one text of rules, the same for every runtime, next to the intro:
the intro describes the world, the rules say how to behave in it.

- a built-in draft (rules-draft.ts) until an admin saves rules of their own in
  the web (Settings -> Agent rules); clearing them brings the draft back;
- GET /api/instructions: the rules with who saved them and when, and who the
  agent is; PUT /admin/api/rules for admins; agents online are told of a
  change, which holds from their next session;
- no participant names and no tool-name prefixes in the draft (a test checks).

The adapters do not read it yet: core/instructions.mjs and the Claude adapter
come next, then agy and OpenCode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hes for names; start from the broker's summary (opencode-alexey, 4087)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onversation's language (antigravity-alexey, 4090)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@delpher
delpher merged commit d05d56c into master Nov 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant