Repository navigation
Proposal: rules as a portable plugin component #100
cardene777
started this conversation in
Ideas
Replies: 1 comment
|
The companion proposal on the hook events each client version supports is now posted as #101. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A companion proposal covers the hook events each client version supports: a separate Discussion in this category, linked in a comment below.
Discussion-first proposal per CONTRIBUTING.md. Related threads: #47 proposes a plugin-level orientation file, which describes the plugin, while this proposal covers rules loaded in every session; #35 asks for path-scoped rules on the roadmap.
Summary
Many plugins need always-on instructions next to their skills: coding conventions, safety rules, or the steps a team follows.
The specification leaves rules outside the format "until their formats converge".
This proposal suggests that the content has already converged on plain Markdown, and that only the place each client loads it from differs.
It proposes a small
rules/component and two client requirements, and offers one placement pattern that was run on three clients.Problem
A plugin that ships skills and MCP servers portably still has no portable way to ship the instructions that go with them.
Each client reads always-on instructions from its own place:
~/.claude/CLAUDE.md, and every Markdown file in~/.claude/rules/~/.codex/AGENTS.md~/.copilot/copilot-instructions.mdAGENTS.mdat the repository root, read by Codex and others, and by Claude Code through@AGENTS.mdinCLAUDE.mdSo a plugin author either keeps one copy per client or asks users to paste the text by hand.
Pasted text cannot be told apart from the user's own lines, so disabling or uninstalling the plugin leaves its rules behind, still loaded.
Who hits it
Why it belongs in the portable specification
The content is the same in every client: Markdown read as instructions for the whole session.
What a client cannot decide alone is where a plugin keeps its rules and what enabling and removing them guarantees, since a plugin is written once for every client.
Placement inside each client can stay client policy.
Proposed shape
rules/directory at the plugin root holding*.mdfiles, one rule per file, the file name being the rule name.A placement pattern for clients that read one instructions file
A client that reads instructions from one file can still meet the removal requirement exactly:
A client that reads a folder of rule files, like Claude Code's
~/.claude/rules/, can place one link per rule and remove the links it recorded.Evidence
agent-shared (definition) places one folder of skills, rules, and hooks into several clients and takes them out again.
Its rules placement is the pattern above, run on these clients and versions:
~/.claude/rules/~/.codex/AGENTS.md~/.copilot/copilot-instructions.mdAGENTS.mdIts tests check that the lines outside a block keep their bytes, that removing a source takes out only its block, also after the source folder is deleted, and that a file left holding nothing is removed.
Who would adopt it
rules/directory as a source.AGENTS.md-style files could load an enabled plugin'srules/*.mdwith a small change; we cannot speak for client vendors and would like to hear from them.Open questions
applyToor Cursor's glob rules, which this proposal leaves out of a first version.This proposal was prepared with an AI coding agent and reviewed by me.
All reactions