claude-code-config
AGENTS.md10 starsChanged 9 months agoMITView on GitHub
Orientation for coding agents working in this repo. Keep this handy; follow commands and conventions before editing.
- Reads credentials
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 33,398 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.
- CLAUDE.mdCLAUDE.md
- hooks/CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
32 rules. About 1 is common, 11 are distinctive, and 20 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
20
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 21
Run all tests (default short): pnpm test
- Very specific: line 22
Run all including long-running: pnpm test --filter-tags long-running
- Very specific: line 23
Run a single bats test by name: bats test/test.bats --filter "pattern"
- Very specific: line 24
Run a single bats test by tag: bats test/test.bats --filter-tags tagname
- Distinctive: line 37
Prefer explicit return types on exported functions.
- Very specific: line 38
Avoid any; use unknown or generics.
- Distinctive: line 39
Use interfaces for public contracts.
- Distinctive: line 40
Keep enums minimal; favor literal unions when possible.
- Very specific: line 41
Always await promises; handle rejections.
- Very specific: line 42
Use const over let where possible.
- Very specific: line 43
Keep functions small; extract helpers in src/lib when shared.
- Distinctive: line 50
Use named imports over namespace unless the module exports a single primary object.
- Distinctive: line 55
Do not fight Biome; align code to its output before committing.
- Distinctive: line 56
Keep comments scarce; explain *why*, not *what*.
- Very specific: line 66
Prefer typed errors or Error with clear messages.
- Distinctive: line 68
Use guard clauses; return early on invalid input.
- Very specific: line 70
When interacting with filesystem/network, handle ENOENT, timeouts, and auth failures gracefully.
- Very specific: line 75
Default store pulled from MXBAI_STORE or mgrep.
- Very specific: line 81
Write descriptive test names (@test "search returns results for valid query").
- Very specific: line 84
Keep fixtures in test/assets/.
- Very specific: line 92
Never commit secrets: API keys, .env, tokens, private keys.
- Distinctive: line 103
Read before writing: inspect relevant files (commands, libs) first.
- Very specific: line 104
Prefer existing helpers over new utilities.
- Distinctive: line 105
Keep changes minimal; avoid mixing refactors with features.
- Distinctive: line 106
After edits to TS/JS, expect hooks to run format/typecheck suggestions.
- Very specific: line 107
Run pnpm typecheck && pnpm format:check && pnpm test before handing off.
- Very specific: line 108
Avoid console.log spam; logging is intercepted.
- Distinctive: line 113
Keep binary assets out of repo unless required.
- Common: line 139
No secrets or debug logs; imports ordered.
- Very specific: line 144
When unsure, mirror existing patterns in src/commands/search.ts and src/lib/store.ts.
- Very specific: line 147
No Cursor rules detected (.cursor/ or .cursorrules missing).
- Very specific: line 148
No GitHub Copilot instructions found under .github/copilot-instructions.md.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 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
AGENTS GUIDE (Mixedbread mgrep)
Orientation for coding agents working in this repo. Keep this handy; follow commands and conventions before editing.
Project Snapshot
- Runtime: Node.js 18+ (CI uses 20/24)
- Language: TypeScript 5.x, ESM (
"type": "module",module: "NodeNext") - Package manager: pnpm (lockfile present)
- Lint/format: Biome (
biome.json), import organize on save - Tests: bats (Bash Automated Testing System)
- Dist:
tscoutputs todist/; CLI entrydist/index.js
How to Build/Test Fast
- Install deps:
pnpm install - Build:
pnpm build - Dev run CLI:
pnpm dev(compiles then runsdist/index.js) - Type check only:
pnpm typecheck - Lint/format fix:
pnpm format - Lint/format check (CI):
pnpm format:check - Lint only:
pnpm lint - Run all tests (default short):
pnpm test - Run all including long-running:
pnpm test --filter-tags long-running - Run a single bats test by name:
bats test/test.bats --filter "pattern" - Run a single bats test by tag:
bats test/test.bats --filter-tags tagname - CI pipeline order: format:check → test (long-running) → typecheck → build
Repo Conventions
- ESM everywhere: use
.jsextension in imports, even for TS files (import { foo } from "./lib/foo.js"). - Paths: prefer
node:pathutilities; avoid string concat for paths. - Logging:
src/lib/logger.tswires console to Winston; avoid new loggers unless necessary. - Git helpers live in
src/lib/git.ts; prefer them over custom git shells. - Commands live under
src/commands/; installers undersrc/install/; shared utils undersrc/lib/. - CLI wired in
src/index.tsvia Commander; add commands there when introducing new functionality.
TypeScript Style
strictmode on;noUnused*,noImplicitReturns,noFallthroughenforced.- Prefer explicit return types on exported functions.
- Avoid
any; useunknownor generics. Narrow early. - Use interfaces for public contracts; types acceptable for internal utility shapes.
- Keep enums minimal; favor literal unions when possible.
- Always await promises; handle rejections. Return typed results, not
Promise<void>unless appropriate. - Use
constoverletwhere possible; avoidvarentirely. - Keep functions small; extract helpers in
src/libwhen shared.
Imports & Ordering
- Node built-ins (
node:fs,node:path, etc.) - Third-party packages
- Internal absolute imports (rooted at
src/with./prefixes for ESM) - Relative siblings Use named imports over namespace unless the module exports a single primary object. Avoid default exports for new code.
Formatting & Biome
- Biome handles both linting and formatting; run
pnpm formatto auto-fix. - Config: 2-space indent, double quotes, import organize on.
- Do not fight Biome; align code to its output before committing.
- Keep comments scarce; explain why, not what.
Naming
- Files: kebab-case (
sync-helpers.ts). - Classes/Types/Interfaces: PascalCase (
SearchOptions). - Functions/variables: camelCase (
resolveStore). - Constants: UPPER_SNAKE_CASE (
DEFAULT_STORE). - CLI flags: kebab-case; environment variables: UPPER_SNAKE_CASE (
MXBAI_API_KEY).
Error Handling
- Prefer typed errors or
Errorwith clear messages; include action hints. - Wrap CLI entrypoints with user-friendly messaging; avoid raw stack traces to users unless in debug.
- Use guard clauses; return early on invalid input.
- Validate external input with
zodwhere practical. - When interacting with filesystem/network, handle
ENOENT, timeouts, and auth failures gracefully. - Log operational errors via console (wired to Winston) so they reach rotating logs.
CLI Behavior
- Commander is the source of truth; register options there.
- Default store pulled from
MXBAI_STOREormgrep; keep defaults minimal and quiet. - Background watcher respects
.gitignoreand.mgrepignore; maintain that contract when changing watch logic. - Preserve exit codes: non-zero on failure; zero on success.
Testing Practices
- Tests are bats in
test/test.bats; add new cases there. - Write descriptive test names (
@test "search returns results for valid query"). - Mark slow tests with tags (
# bats test_tags=long-running) so defaultpnpm testskips them. - For bug fixes, add a regression test; for features, cover happy path + edge.
- Keep fixtures in
test/assets/; reuse existing fixtures where possible.
Releases & CI Notes
- Release workflow tags
v*.*.*, verifies tag matchespackage.json, runs format:check,pnpm test --filter-tags long-running,pnpm build, thennpm publish --provenance. - Prepare script runs build on install; ensure build stays deterministic.
- Husky is declared but may need
npx husky initlocally if hooks are desired.
Security & Secrets
- Never commit secrets: API keys,
.env, tokens, private keys. - Auth options: device login via
mgrep loginorMXBAI_API_KEYenv for CI. - Respect size limits in watcher (defaults in README); do not silently broaden.
Local Tooling Guardrails
- Dev servers must run inside tmux; the dev command hook blocks non-tmux runs.
- Long commands in Bash prompt a tmux reminder; consider
tmux new -s dev. - Git pushes prompt for a quick review pause before continuing.
- MD/TXT creation is blocked unless the path is README/CLAUDE/AGENTS/CONTRIBUTING.
Workflow for Agents
- Read before writing: inspect relevant files (commands, libs) first.
- Prefer existing helpers over new utilities; search
src/lib. - Keep changes minimal; avoid mixing refactors with features.
- After edits to TS/JS, expect hooks to run format/typecheck suggestions.
- Run
pnpm typecheck && pnpm format:check && pnpm testbefore handing off. - Avoid
console.logspam; logging is intercepted. Remove debug logs before commit.
File/Path Expectations
- Generated output belongs in
dist/; do not edit generated files. - Respect
.gitignore,.mgrepignore, Biome include/exclude. - Keep binary assets out of repo unless required.
Documentation Touchpoints
- User-facing changes: update
README.md. - Contribution/process changes: update
CONTRIBUTING.md. - Architectural or agent-facing patterns: update this file.
Single-Test Quickstart (copy-paste)
# Short path: run one bats test matching a name
bats test/test.bats --filter "watch indexes"
# Run tagged slow test explicitly
bats test/test.bats --filter-tags long-runningTroubleshooting Cheatsheet
- Formatting diffs? run
pnpm format. - Type errors on imports? ensure
.jsextension and NodeNext module resolution. - Permissions on logs?
src/lib/logger.tswrites under~/.local/state/mgrep/logs; ensure writable or expect silent logger. - Device login loops?
mgrep logoutthenmgrep login; CI prefersMXBAI_API_KEY.
Pre-push sanity list
pnpm typecheckpnpm format:checkpnpm test(or targeted bats when iterating)- No secrets or debug logs; imports ordered; ESM extensions correct.
Contact
- Issues: https://github.com/mixedbread-ai/mgrep
- Community: Mixedbread Slack (see README)
- When unsure, mirror existing patterns in
src/commands/search.tsandsrc/lib/store.ts.
Cursor/Copilot Rules
- No Cursor rules detected (
.cursor/or.cursorrulesmissing). - No GitHub Copilot instructions found under
.github/copilot-instructions.md.
End of AGENTS.md
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.

