agentleFS
lehcodelehcode/claudelegate/AGENTS.md

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.

  • In this repository2 other files it gives its agents.

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
  1. Very specific:

    EventCollector handles non-JSON: If the stream emits non-JSON lines they fall through to raw[] and text falls back to raw.join("\n").

    line 46
  2. Very specific:

    buildArgs drops --fork: if there is no session_id and continueLast is false.

    line 48

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.md and AGENTS.md); skipped with a warning when vale is missing; packages are fetched with vale 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:

FileRole
index.tsMCP server (stdio): delegate, delegate_async, task_result, task_list, task_cancel, list_models, list_sessions
config.tsResolve opencode binary path, env-based defaults, bool/int helpers
models.tsModel listing (cached 5 min), loose-name → provider/model resolution, aggregator priority
opencode.tsSpawn opencode run --format json, fold JSON event stream into EventCollector
delegate.tsBuild args, git-diff changed-files detection, format outcome
tasks.tsIn-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 with toStartWith("ERR:").
  • EventCollector handles non-JSON. If the stream emits non-JSON lines they fall through to raw[] and text falls back to raw.join("\n").
  • buildArgs drops --fork if there is no session_id and continueLast is false. The test asserts the --fork flag 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.json has no test framework deps.

CLI & Plugin

  • Slash command (commands/opencode.md) wraps the delegate skill: /opencode <model> -- <task>
  • Claude Code plugin: install via /plugin marketplace add lehcode/claudelegate

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.