agentleFS
Kilo-OrgKilo-Org/kilo/AGENTS.md

kilo

AGENTS.md203 starsChanged 10 months agoMITArchived repositoryView on GitHub

Kilo CLI is an open source AI coding agent that generates code from natural language, automates tasks, and supports 500+ AI models. Turborepo + Bun workspaces. The packages you'll work with most: Other packages (desktop/, containers/, extensions/) are for desktop app, Docker containers, and editor extensions. We don't like let statements, especially combined with if/else statements. Prefer const. Prefer early returns or using an iife to avoid else statements. Never leave a catch blo

  • 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

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

18 rules. About 0 are common, 8 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    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
  1. Distinctive:

    ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.

    line 5
  2. Distinctive:

    Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.

    line 8
  3. Very specific:

    SDK regen: After changing server endpoints in packages/opencode/src/server/, run ./script/generate.ts from root to regenerate …

    line 17
  4. Distinctive:

    Keep things in one function unless composable or reusable

    line 39
  5. Very specific:

    Avoid unnecessary destructuring.

    line 40
  6. Very specific:

    Avoid try/catch where possible

    line 41
  7. Very specific:

    Avoid using the any type

    line 42
  8. Distinctive:

    Prefer single word variable names where possible

    line 43
  9. Very specific:

    Use Bun APIs when possible, like Bun.file()

    line 44
  10. Very specific:

    Prefer early returns or using an iife to avoid else statements.

    line 69
  11. Very specific:

    Never leave a catch block empty.

    line 91
  12. Distinctive:

    Should the error be handled explicitly?

    line 94
  13. Distinctive:

    Only use multiple words if you cannot.

    line 118
  14. Very specific:

    Prefer kilocode directories: - Place Kilo-specific code in dedicated directories whenever possible:

    line 149
  15. Distinctive:

    Minimize changes to shared files: - When you must modify files that exist in upstream opencode, keep changes as small and isolated as …

    line 154
  16. Very specific:

    Use kilocode_change markers: - When modifying shared code, mark your changes with kilocode_change comments so they can be easily …

    line 156
  17. Very specific:

    Do not use these markers in files within directories with kilo in the name

    line 157
  18. Distinctive:

    Avoid restructuring upstream code: - Don't refactor or reorganize code that comes from opencode unless absolutely necessary.

    line 159

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

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

AGENTS.md

Kilo CLI is an open source AI coding agent that generates code from natural language, automates tasks, and supports 500+ AI models.

  • ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
  • The default branch in this repo is dev.
  • Local main ref may not exist; use dev or origin/dev for diffs.
  • Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.
  • You may be running in a git worktree. All changes must be made in your current working directory — never modify files in the main repo checkout.

Build and Dev

  • Dev: bun run dev (runs from root) or bun run --cwd packages/opencode --conditions=browser src/index.ts
  • Typecheck: bun turbo typecheck (uses tsgo, not tsc)
  • Test: bun test from packages/opencode/ (NOT from root -- root blocks tests)
  • Single test: bun test test/tool/tool.test.ts from packages/opencode/
  • SDK regen: After changing server endpoints in packages/opencode/src/server/, run ./script/generate.ts from root to regenerate packages/sdk/js/

Monorepo Structure

Turborepo + Bun workspaces. The packages you'll work with most:

PackageNamePurpose
packages/opencode/@kilocode/cliCore CLI -- agents, tools, sessions, server, TUI. This is where most work happens.
packages/sdk/js/@kilocode/sdkAuto-generated TypeScript SDK (client for the server API). Do not edit src/gen/ by hand.
packages/kilo-vscode/@kilocode/kilo-vscodeVS Code extension with SolidJS webview UI. See its own AGENTS.md for details.
packages/kilo-gateway/@kilocode/kilo-gatewayKilo auth, provider routing, API integration
packages/kilo-telemetry/@kilocode/kilo-telemetryPostHog analytics + OpenTelemetry
packages/kilo-i18n/@kilocode/kilo-i18nInternationalization / translations
packages/app/@opencode-ai/appWeb/TUI frontend (SolidJS + Vite)
packages/util/@opencode-ai/utilShared utilities (error, path, retry, slug, etc.)
packages/plugin/@kilocode/pluginPlugin/tool interface definitions

Other packages (desktop/, containers/, extensions/) are for desktop app, Docker containers, and editor extensions.

Style Guide

  • Keep things in one function unless composable or reusable
  • Avoid unnecessary destructuring. Instead of const { a, b } = obj, use obj.a and obj.b to preserve context
  • Avoid try/catch where possible
  • Avoid using the any type
  • Prefer single word variable names where possible
  • Use Bun APIs when possible, like Bun.file()
  • Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity

Avoid let statements

We don't like let statements, especially combined with if/else statements. Prefer const.

Good:

const foo = condition ? 1 : 2

Bad:

let foo

if (condition) foo = 1
else foo = 2

Avoid else statements

Prefer early returns or using an iife to avoid else statements.

Good:

function foo() {
  if (condition) return 1
  return 2
}

Bad:

function foo() {
  if (condition) return 1
  else return 2
}

No empty catch blocks

Never leave a catch block empty. An empty catch silently swallows errors and hides bugs. If you're tempted to write one, ask yourself:

  1. Is the try/catch even needed? (prefer removing it)
  2. Should the error be handled explicitly? (recover, retry, rethrow)
  3. At minimum, log it so failures are visible

Good:

try {
  await save(data)
} catch (err) {
  log.error("save failed", { err })
}

Bad:

try {
  await save(data)
} catch {}

Prefer single word naming

Try your best to find a single word name for your variables, functions, etc. Only use multiple words if you cannot.

Good:

const foo = 1
const bar = 2
const baz = 3

Bad:

const fooBar = 1
const barBaz = 2
const bazFoo = 3

Testing

You MUST avoid using mocks as much as possible. Tests MUST test actual implementation, do not duplicate logic into a test.

Fork Merge Process

Kilo CLI is a fork of opencode.

Minimizing Merge Conflicts

We regularly merge upstream changes from opencode. To minimize merge conflicts and keep the sync process smooth:

  1. Prefer kilocode directories - Place Kilo-specific code in dedicated directories whenever possible:
    • packages/opencode/src/kilocode/ - Kilo-specific source code
    • packages/opencode/test/kilocode/ - Kilo-specific tests
    • packages/kilo-gateway/ - The Kilo Gateway package
  2. Minimize changes to shared files - When you must modify files that exist in upstream opencode, keep changes as small and isolated as possible.
  3. Use kilocode_change markers - When modifying shared code, mark your changes with kilocode_change comments so they can be easily identified during merges. Do not use these markers in files within directories with kilo in the name
  4. Avoid restructuring upstream code - Don't refactor or reorganize code that comes from opencode unless absolutely necessary.

The goal is to keep our diff from upstream as small as possible, making regular merges straightforward and reducing the risk of conflicts.

Kilocode Change Markers

To minimize merge conflicts when syncing with upstream, mark Kilo Code-specific changes in shared code with kilocode_change comments.

Single line:

const value = 42 // kilocode_change

Multi-line:

// kilocode_change start
const foo = 1
const bar = 2
// kilocode_change end

New files:

// kilocode_change - new file

When markers are NOT needed

Code in these paths is Kilo Code-specific and does NOT need kilocode_change markers:

  • packages/opencode/src/kilocode/ - All files in this directory
  • packages/opencode/test/kilocode/ - All test files for kilocode
  • Any other path containing kilocode in filename or directory name

These paths are entirely Kilo Code additions and won't conflict with upstream.

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.