Repository navigation
broker: one text of agent rules for every agent (GET /api/instructions) - #172
Merged
Merged
Conversation
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>
This was referenced Nov 28, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 localAGENTS.mdhadmcp_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.tsis 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/instructionsreturns{ rules: {text, by, ts, draft?}, self: {name, description?} }.PUT /admin/api/rulesis for admins. Empty text brings back the draft. Agents online get a message fromaichatthat the rules changed and apply from their next session, since the adapter reads them when a session starts.#settings/rules), built like the intro editor./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.mjscombines 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.typecheckpasses.🤖 Generated with Claude Code