claudelegate
AGENTS.md4 starsChanged 14 days agoMITView on GitHub
CI (.github/workflows/ci.yml) runs these in order: install → verify. Tracked hooks live in hooks/. They run automatically on commit/push: Configure after clone: git config core.hooksPath hooks/ Claude Code plugin with a bundled MCP server (.claude-plugin/plugin.json mcpServers → dist/index.js, built from src/index.ts with bun run build; commit the bundle, CI checks it is current). Core modules: Tests mirror this structure: test/models.test.ts (resolution logic), test/opencode.test.ts (EventCollector + buildArgs), test/mcp-server.test.ts (spawns the server, checks tools/list). Fixtures are JSONL captured from real opencode run…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,843 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
EventCollectorhandles non-JSON: If the stream emits non-JSON lines they fall through to raw[] and text falls back to raw.join("\n"). - Very specific: line 48
buildArgsdrops--fork: if there is no session_id and continueLast is false.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions
Commands
bun install # install deps (uses bun.lock)
bun test # run unit tests (fixture-based, no services needed)
bun run typecheck # TypeScript strict check (bun check)
bun run lint # lint (eslint)
bun run fmt # format check (prettier)
bun run fmt:fix # auto-fix formatting (prettier)
bun run verify # typecheck + test + lint + format (all-in-one)CI (.github/workflows/ci.yml) runs these in order: install → verify.
Hooks
Tracked hooks live in hooks/. They run automatically on commit/push:
- pre-commit: Prettier check + ESLint on staged files only (fast). Skips docs-only changes. Vale on staged Markdown in the repo root and
docs/(skips.atl/,plan/,plans/,odd/,CHANGELOG.md,CLAUDE.mdandAGENTS.md); skipped with a warning whenvaleis missing; packages are fetched withvale sync. - pre-push: Full
npm run verify(typecheck, test, lint, format). Runs once per push.
Configure after clone: git config core.hooksPath hooks/
Architecture
Claude Code plugin with a bundled MCP server (.claude-plugin/plugin.json mcpServers → dist/index.js, built from src/index.ts with bun run build; commit the bundle, CI checks it is current). Core modules:
| File | Role |
index.ts | MCP server (stdio): delegate, delegate_async, task_result, task_list, task_cancel, list_models, list_sessions |
config.ts | Resolve opencode binary path, env-based defaults, bool/int helpers |
models.ts | Model listing (cached 5 min), loose-name → provider/model resolution, aggregator priority |
opencode.ts | Spawn opencode run --format json, fold JSON event stream into EventCollector |
delegate.ts | Build args, git-diff changed-files detection, format outcome |
tasks.ts | In-memory async task store (UUID keys, max 100 finished), prune oldest |
Tests mirror this structure: test/models.test.ts (resolution logic), test/opencode.test.ts
(EventCollector + buildArgs), test/mcp-server.test.ts (spawns the server, checks tools/list). Fixtures are JSONL captured from real opencode run sessions.
Gotchas
- Model resolution rejects ambiguity.
resolveModel("mimo", ...)returns an error (not a guess) when multiple models tie. Tests assert this withtoStartWith("ERR:"). EventCollectorhandles non-JSON. If the stream emits non-JSON lines they fall through toraw[]andtextfalls back toraw.join("\n").buildArgsdrops--forkif there is nosession_idandcontinueLastis false. The test asserts the--forkflag is absent when neither is set.- Config bools are case-insensitive:
"0","false","no","off"→false; everything else (including"") →true. - Tests use Bun's built-in
bun:test— do not switch to vitest or jest;package.jsonhas no test framework deps.
CLI & Plugin
- Slash command (
commands/opencode.md) wraps thedelegateskill:/opencode <model> -- <task> - Claude Code plugin: install via
/plugin marketplace add lehcode/claudelegate
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

