moon-ide
AGENTS.md9 starsChanged 2 months agoMITView on GitHub
This file is read by AI coding agents (Cursor, Claude Code, opencode, etc.) when working in this repo. Humans read it too.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
Always read specs/ before changing anything non-trivial.
- Distinctive: line 14
If a spec is wrong or incomplete and you fix the underlying code, update the spec in the same change.
- Distinctive: line 16
Keep specs short, opinionated, and current.
- Very specific: line 37
Test: bun run test (vitest run for JS/Svelte + cargo test --workspace).
- Distinctive: line 49
Don't pad phases with "nice-to-have" features just because other IDEs have them.
- Distinctive: line 52
When in doubt, ask the human reviewer rather than expanding scope.
- Distinctive: line 65
When the final roadmap phase lands and we declare a stable surface, this rule flips: schema changes get explicit migration paths.
- Very specific: line 78
Prefer the latest stable version (look up via cargo search, npm view <pkg> version).
- Very specific: line 79
Add to [workspace.dependencies] for shared Rust deps.
- Distinctive: line 81
Document significant adds in the relevant spec.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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
This file is read by AI coding agents (Cursor, Claude Code, opencode, etc.) when working in this repo. Humans read it too.
Read-before-touching
- Always read specs/ before changing anything non-trivial. Specs describe intent; code is the implementation.
- Skim specs/architecture.md and specs/protocol.md first.
- Phased plan lives in specs/roadmap.md.
- Architecture decisions are in specs/decisions/ (numbered ADR-style).
Update-as-you-go
- If a spec is wrong or incomplete and you fix the underlying code, update the spec in the same change.
- New non-trivial decisions get a new ADR in
specs/decisions/NNNN-short-title.md. Don't rewrite old ADRs; supersede them with a new one. ADRs and roadmap entries stay as terse as specs do — context, decision, rejected alternatives — not a play-by-play of the implementation. - Keep specs short, opinionated, and current. They are not aspirational marketing.
- Specs record contracts and intent: wire shapes, schemas, invariants, behavior the user can observe, and the why behind non-obvious decisions (including rejected alternatives). They do not narrate the implementation — no lock orders, no function-by-function walkthroughs, no event-choreography play-by-plays, no Svelte/Rust internals that
git log -pand code comments already cover. Litmus test: if the paragraph would have to change after a behavior-preserving refactor, it belongs in the code, not the spec. When detail matters, link the file or test plan instead of inlining it. - Test plans are outdated. Don't create new ones and don't modify existing ones — the historical files in
specs/test-plans/are left in place as a record but are no longer maintained. Record intent in ADRs and roadmap entries instead (terse — context, decision, alternatives); a clear commit body +git log -pcovers everything else.
House rules
- Early return is preferred over nested conditionals.
- No global try/catch in HTTP-style endpoints or Tauri commands; let an error middleware /
tauri::Resultboundary handle it. - MB/kB use 1000-multiples, not 1024.
- Comments explain non-obvious intent only, never narrate what the code does.
- No emoji in code, docs, or commit messages unless explicitly asked.
- No one-line
if/else/for/whilewithout braces — always use a block. Enforced byoxlint'scurlyrule for JS/TS; Rust gets the same treatment by reviewer taste. - Tabs, not spaces for indentation in every file we author. Editor display width is in
.editorconfig. See ADR 0004. - Match existing code style. Don't do drive-by whole-file reformats just because you opened the file — that's review-noise and makes
git blameworse. - No pre-existing warnings or actionable suggestions. If
cargo build,cargo clippy,vite build,tsgo,svelte-fast-check,oxlint, the Svelte MCP autofixer, or any other tool we use prints a warning or a concrete suggestion (e.g. "this$effectshould be$derived", "thisbind:thiscould be an attachment"), treat it as a bug and fix it — even on lines you didn't touch, even if it isn't your fault, and even if it isn't what you were asked to do. The repo stays clean. The only exception is when the fix genuinely needs a wider refactor than the current change can absorb; in that case, suppress it locally with a comment explaining why, or open a follow-up note in the relevant spec.
Tooling
- Format:
bun run fmt(oxfmt + prettier-svelte) andcargo fmt --all. - Lint:
bun run lint(oxlint, type-aware) andcargo clippy --all-targets -- -D warnings. - Type-check:
bun run check(tsgo --noEmit+svelte-fast-check). - Test:
bun run test(vitest runfor JS/Svelte +cargo test --workspace). Do not usebun test— Bun's built-in runner doesn't compile Svelte's$staterunes and trips on*.svelte.tsmodules. Use the script. - Full details and rationale: ADR 0004 — code style.
- The IDE has to be able to develop itself. See ADR 0005 — bootstrap.
Phased delivery
This project is built in numbered phases (see specs/roadmap.md). Stop at the end of each phase and wait for human review before starting the next. The completion checklist at the bottom of each phase in the roadmap is the gate; do not auto-proceed even if every box is ticked.
Scope discipline
Moon IDE serves one specific team. It is not a generic product, and the roadmap is not a wishlist.
- Don't pad phases with "nice-to-have" features just because other IDEs have them. If a feature isn't actively requested or blocking real work, leave it out — the team will surface real needs through testing and feedback.
- Hardcode first, configure later. If the team needs exactly one keybinding / one theme / one shortcut, hardcode it. Add user configuration when there's a second concrete need, not preemptively.
- Speculative ideas belong in prose ("later we might want X") in the relevant spec, not as checklist items in a phase. A checklist item is a commitment.
- When in doubt, ask the human reviewer rather than expanding scope.
The bootstrap exception
If moon-ide's own source tree contains a file of some format, supporting that format is bootstrap, not speculation — see ADR 0005. Concretely: the moon-ide repo has Cargo.lock, bun.lock, .editorconfig, .npmrc, etc., so syntax highlighting, formatting, and any tooling those files imply are in scope by default. Likewise for any language toolchain we use to develop moon-ide itself (Rust, TypeScript, Svelte). The "is anyone asking?" test still applies for everything else.
No premature migrations
Until the roadmap's last phase ships, there is no "user installed base" worth keeping compatible with. Schemas (persisted app state, the JSON-RPC protocol, the per-workspace state directory, the coder session JSONL header) can be renamed, restructured, or deleted freely. Don't write migration code, aliases, or backward-compat shims for these — the cost is dead code that hides the real schema. Acceptable failure modes when a schema changes:
- The dev (whoever's running moon-ide on their machine) loses their last session / open tabs / persisted app state once. They reopen the folder; life goes on.
- A best-effort
tracing::warn!on a parse failure is fine; falling back to defaults is fine; crashing on startup is not.
When the final roadmap phase lands and we declare a stable surface, this rule flips: schema changes get explicit migration paths. Until then, optimize for cleanliness of the current schema.
Cross-cutting invariants
These are enforced by reviewers and CI; breaking them is a real bug:
- The UI never directly calls git, LSP, fs, the coder / any LLM, or the terminal. Everything goes through the workspace core.
- Anything that does I/O on the workspace must go through the active
WorkspaceHostso it works the same locally and inside a devcontainer. - Container port forwarding is explicit — never auto-forward all listening ports.
crates/moon-protocol/is the single source of truth for the JSON-RPC schema. UI types (in TS) are generated/synced from it; do not hand-edit divergent copies.
Adding a dependency
- Prefer the latest stable version (look up via
cargo search,npm view <pkg> version). - Add to
[workspace.dependencies]for shared Rust deps; only add to a crate's own[dependencies]if it's truly local. - For frontend: prefer small, focused packages over framework lock-in.
- Document significant adds in the relevant spec.
Commit/PR hygiene
- Commits should be atomic and tell a story; no "wip" or "fix" alone.
- A change that touches both Rust and TS for the same feature lands in one commit.
- Reference the spec/ADR you're implementing in the commit body when relevant.
- Commits no longer ship with test plans (see "Test plans are outdated" above).
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.

