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

kilocode

AGENTS.md27k starsChanged 4 months agoMITView on GitHub

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

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about Kilo-Org/kilocode

The biggest 5 of 69 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 69

Talked about on GitHub, Bluesky and Hacker News (69 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 17

12 more on Bluesky
  • 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

36 rules. About 0 are common, 13 are distinctive, and 23 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 23

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

    CLI build artifact size check: after bun run script/build.ts --single --skip-install in packages/opencode/, use du -h dist/*/*/bin/kilo …

    line 18
  4. Very specific:

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

    line 19
  5. Very specific:

    Source links: After adding or changing URLs in packages/kilo-vscode/, packages/kilo-vscode/webview-ui/, or packages/opencode/src/, run bun …

    line 21
  6. Very specific:

    Effect facade ratchet: Do not add runtime-backed Promise facades to shared packages/opencode/src Effect services.

    line 24
  7. Very specific:

    Never run root bun test; the root script prints do not run tests from root and exits with code 1.

    line 41
  8. Very specific:

    All products are clients of the CLI (packages/opencode/), which contains the AI agent runtime, HTTP server, and session management.

    line 45
  9. Very specific:

    When a task primarily touches packages/kilo-jetbrains/, read packages/kilo-jetbrains/AGENTS.md before planning or editing.

    line 60
  10. Very specific:

    Use conventional commit-style messages and PR titles: type(scope): summary.

    line 80
  11. Distinctive:

    Keep things in one function unless composable or reusable

    line 88
  12. Very specific:

    Avoid unnecessary destructuring.

    line 89
  13. Very specific:

    Avoid possibly out-of-bounds array access.

    line 90
  14. Very specific:

    Avoid try/catch where possible

    line 91
  15. Very specific:

    Avoid using the any type

    line 92
  16. Distinctive:

    Prefer single word variable names where possible

    line 93
  17. Very specific:

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

    line 94
  18. Very specific:

    Always use Promise.withResolvers<T>() to create deferred promises.

    line 96
  19. Very specific:

    Use ref == null to check for both null and undefined instead of ref === undefined || ref === null.

    line 97
  20. Very specific:

    Prefer const. Replace let + if/else assignment with a ternary or an IIFE.

    line 101
  21. Distinctive:

    Use single word names by default for new locals, params, and helper functions.

    line 107
  22. Distinctive:

    Do not introduce new camelCase compounds when a short single-word alternative is clear.

    line 109
  23. Distinctive:

    Before finishing edits, review touched lines and shorten newly introduced identifiers where possible.

    line 110
  24. Very specific:

    Prefer early returns (or an IIFE) over else.

    line 116
  25. Very specific:

    Never leave a catch block empty.

    line 120
  26. Distinctive:

    Should the error be handled explicitly?

    line 123
  27. Distinctive:

    Do not pad markdown table cells for column alignment.

    line 137
  28. Distinctive:

    Do not right-pad cells to line up columns:

    line 145
  29. Very specific:

    When creating or managing GitHub issues for the VS Code extension or JetBrains plugin via gh, load .kilo/skills/gh-issues/SKILL.md.

    line 171
  30. Very specific:

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

    line 183
  31. Distinctive:

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

    line 188
  32. Very specific:

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

    line 190
  33. Distinctive:

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

    line 191
  34. Distinctive:

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

    line 193
  35. Very specific:

    Mirror new config keys to the cloud schema: - When adding a kilocode_change key to Config.Info in packages/opencode/src/config/config.ts, …

    line 195
  36. Very specific:

    When editing shared upstream files, mark Kilo-specific lines with kilocode_change comments so future merges can find them.

    line 205

≈ “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 main.
  • 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
  • Dev with params: bun dev -- help
  • Extension: bun run extension (build + launch VS Code with the extension in dev mode). Pass --no-build to skip the build. When asked to run an isolated VS Code/Kilo environment, use the CLI scripts instead of interactive launch configs: bun run extension:isolated reuses .kilo-dev/, and bun run extension:isolated:clean clears .kilo-dev/ first. Pass an optional workspace path after --, for example bun run extension:isolated -- ../sample-project.
  • Typecheck: bun turbo typecheck (uses tsgo, not tsc). Includes the JetBrains plugin and requires Java 21; do not run java -version as a routine preflight. Only check Java when a Gradle/Java command fails with a Java-version or missing-Java error. If missing, install via SDKMAN: sdk install java 21-tem && sdk use java 21-tem. If SDKMAN is not installed, see https://sdkman.io/install.
  • Test: bun test from packages/opencode/ (NOT from root -- root blocks tests)
  • Single test: bun test ./test/tool/tool-define.test.ts from packages/opencode/
  • CLI build artifact size check: after bun run script/build.ts --single --skip-install in packages/opencode/, use du -h dist/*/*/bin/kilo (scoped package output lives under dist/@kilocode/)
  • SDK regen: After changing server endpoints in packages/opencode/src/server/, run ./script/generate.ts from root to regenerate packages/sdk/js/
  • Knip (unused exports): bun run knip from packages/kilo-vscode/. CI runs this — all exported types/functions must be imported somewhere. Remove or unexport unused exports before pushing.
  • Source links: After adding or changing URLs in packages/kilo-vscode/, packages/kilo-vscode/webview-ui/, or packages/opencode/src/, run bun run script/extract-source-links.ts from the repo root and commit the updated packages/kilo-docs/source-links.md. CI runs this check — the build fails if the file is stale.
  • kilocode_change check: bun run check-kilocode-change from packages/kilo-vscode/. CI runs this — kilocode_change is a marker for upstream merge conflicts and must not appear in packages/kilo-vscode/ or packages/kilo-ui/ (these are entirely Kilo Code additions). Remove the markers before pushing.
  • opencode annotation check: bun run script/check-opencode-annotations.ts --worktree from repo root when verifying local agent changes. CI runs bun run script/check-opencode-annotations.ts on PRs touching packages/opencode/ — every Kilo-specific change in shared opencode files must be annotated with kilocode_change markers. Exempt paths (no markers needed): packages/opencode/src/kilocode/, packages/opencode/test/kilocode/, and any path containing kilocode in the name.
  • Effect facade ratchet: Do not add runtime-backed Promise facades to shared packages/opencode/src Effect services; use service dependencies, AppRuntime, or Kilo-owned boundaries. Run bun run script/check-opencode-promise-facades.ts when touching service adapters.
  • workflow allowlist: bun run script/check-workflows.ts from repo root. CI runs this as part of the annotations workflow — any .yml / .yaml file added to or removed from .github/workflows/ must be reflected in the hardcoded list in script/check-workflows.ts. Prevents upstream-merged workflows from silently starting to run in our CI.
  • Backend/SDK programmatic testing: see TESTING.md for spawning the local main-branch backend (bun dev serve) and driving it via curl — use this instead of kilo serve (prod binary) when testing backend fixes.

Quality Checks

Before saying an implementation is ready, run the smallest relevant checks that can catch lint, typecheck, and test failures for the touched package. Do not rely on manual extension launch to discover build problems. Fix failures you introduced before the final response, or state exactly which check is still failing or could not be run.

AreaChecks
Root / cross-packagebun run lint, bun run typecheck
CLIFrom packages/opencode/: bun run typecheck, bun test or targeted bun test ./path/to/file.test.ts
VS Code extensionFrom packages/kilo-vscode/: bun run typecheck, bun run lint, bun run test:unit or bun run test
Extension build/packageFrom packages/kilo-vscode/: bun run compile or bun run package when touching build, packaging, SDK, or webview integration paths
JetBrains pluginFrom packages/kilo-jetbrains/: ./gradlew typecheck, ./gradlew test. Requires Java 21; do not run java -version as a routine preflight. Check Java only after a Java-version or missing-Java failure.
CI/local guardsRun affected guards documented above, such as bun run knip, bun run check-kilocode-change, bun run script/check-opencode-annotations.ts --worktree, or source link extraction

Never run root bun test; the root script prints do not run tests from root and exits with code 1. Use package-level tests instead.

Products

All products are clients of the CLI (packages/opencode/), which contains the AI agent runtime, HTTP server, and session management. Each client spawns or connects to a kilo serve process and communicates via HTTP + SSE using @kilocode/sdk.

ProductPackageDescription
Kilo CLIpackages/opencode/Core engine. TUI, kilo run, kilo serve. Fork of upstream OpenCode.
Kilo VS Code Extensionpackages/kilo-vscode/VS Code extension. Bundles the CLI binary, spawns kilo serve as a child process. Includes the Agent Manager — a multi-session orchestration panel with git worktree isolation.

Agent Manager refers to a feature inside packages/kilo-vscode/ (extension code in src/agent-manager/, webview in webview-ui/agent-manager/). It is not a standalone product. See the extension's AGENTS.md for details.

In each VS Code extension host, one KiloConnectionService is created for the sidebar, every Kilo editor tab, and Agent Manager; it lazily starts and reuses one current kilo serve backend at a time. Agent Manager worktree sessions pass a directory context to this shared backend rather than starting one per worktree. State captured by the active service layer, such as Snapshot trackState, is shared across those requests; only directory-keyed InstanceState data is isolated.

Extension-specific settings should live in the Kilo extension settings, not default VS Code settings, unless they are intentionally VS Code-wide. Experimental flags should follow existing flag patterns, not VS Code settings; they usually belong in the Kilo Experimental settings section.

Package Instructions

  • When a task primarily touches packages/kilo-jetbrains/, read packages/kilo-jetbrains/AGENTS.md before planning or editing. It holds hard restrictions, a shared-code reuse index, and a skill/command index; load the matching jetbrains-ui, jetbrains-session, jetbrains-arch, or jetbrains-dev skill (or the /release-jetbrains command) for detailed guidance.

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/kilo-codeVS Code extension with sidebar chat + Agent Manager. 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/kilo-ui/@kilocode/kilo-uiSolidJS component library shared by the extension webview and docs screenshot stories
packages/util/@opencode-ai/utilShared utilities (error, path, retry, slug, etc.)
packages/plugin/@kilocode/pluginPlugin/tool interface definitions

Commits and PR Titles

Use conventional commit-style messages and PR titles: type(scope): summary.

Valid types are feat, fix, docs, chore, refactor, and test. Scopes are optional; use the affected package or area when helpful, e.g. core, opencode, tui, app, desktop, sdk, or plugin.

Examples: fix(tui): simplify thinking toggle styling, docs: update contributing guide, chore(sdk): regenerate types.

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 possibly out-of-bounds array access. Instead of array[index] ?? {}, use array.at(index) ?? {}. Instead of array[array.length - 1], use array.at(-1)
  • 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
  • Always use Promise.withResolvers<T>() to create deferred promises; all supported runtimes provide it. Never capture resolve and reject from a new Promise executor in external variables or object properties.
  • Use ref == null to check for both null and undefined instead of ref === undefined || ref === null.

Avoid let statements

Prefer const. Replace let + if/else assignment with a ternary or an IIFE. Reassignment is the only legitimate reason to reach for let.

Naming Enforcement (Read This)

THIS RULE IS MANDATORY FOR AGENT WRITTEN CODE.

  • Use single word names by default for new locals, params, and helper functions.
  • Multi-word names are allowed only when a single word would be unclear or ambiguous.
  • Do not introduce new camelCase compounds when a short single-word alternative is clear.
  • Before finishing edits, review touched lines and shorten newly introduced identifiers where possible.
  • Good short names to prefer: pid, cfg, err, opts, dir, root, child, state, timeout.
  • Examples to avoid unless truly required: inputPID, existingClient, connectTimeout, workerPath.

Avoid else statements

Prefer early returns (or an IIFE) over else. After an if that returns/throws, the else is redundant.

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 via log.error("...", { err }) so failures are visible — never catch {} or catch (e) {} with no body.

Prefer single word naming

Default to a single-word name for variables, parameters, and helper functions. Reach for a multi-word name only when a single word would be genuinely ambiguous in context — not just because the longer name "reads nicer". The rule is about meaning, not character count: don't introduce camelCase compounds like inputPID, existingClient, connectTimeout, or workerPath when pid, client, timeout, or path is already clear from the surrounding code. See the "Naming Enforcement" section above for the preferred vocabulary.

Testing

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

Markdown Tables

Do not pad markdown table cells for column alignment. Use the compact form with single-space-padded content cells and a minimal separator row:

| Command | What it runs |
|---|---|
| `kilo serve` | The prod CLI on `$PATH`. |

Do not right-pad cells to line up columns:

| Command                       | What it runs             |
| ----------------------------- | ------------------------ |
| `kilo serve`                  | The prod CLI on `$PATH`. |

Padding makes every content change rewrite the entire table, which blows up diffs on untouched rows. Markdown files are excluded from prettier (see .prettierignore) so running the formatter won't re-pad them, and script/check-md-table-padding.ts enforces the rule in CI. Run bun run script/check-md-table-padding.ts --fix to auto-rewrite padded tables.

Commit Conventions

Conventional Commits with scopes matching packages: vscode, cli, agent-manager, sdk, ui, i18n, kilo-docs, gateway, telemetry, desktop. Omit scope when spanning multiple packages.

Changesets

User-facing changes (features, fixes, breaking changes) require a changeset file for release notes. Prefer one concise changeset per PR, grouping related changes when possible. Run bunx changeset add or manually create .changeset/<slug>.md. Use patch for bug fixes, minor for new features, major for breaking changes. See .changeset/README.md for details.

Changeset descriptions appear directly in release notes and are read by end users. Keep them concise and feature-oriented — describe what changed from the user's perspective, not implementation details. Write in imperative mood (e.g. "Support exporting conversations as markdown" not "Add a new export handler that serializes session messages to .md files").

Pull Requests

PR descriptions should explain what changed, why the change is needed, and the intent or constraints a reviewer cannot infer from the diff alone. Keep simple PRs brief, but give non-trivial changes enough context to stand on their own. Skip file-by-file inventories, test result summaries, and anything obvious from the code itself.

GitHub Issues

When creating or managing GitHub issues for the VS Code extension or JetBrains plugin via gh, load .kilo/skills/gh-issues/SKILL.md. It covers templates, project boards (VS Code Extension, Jetbrains Plugin), title conventions, and the gh auth refresh -s project recovery path.

Fork Merge Process

Kilo CLI is a fork of opencode.

Very important: when planning or coding, update shared files with OpenCode as last resort! Everything is shared code from OpenCode, except folders that contain kilo in the name or have a parent directory that contains kilo in the name. Example of kilo specific folders: packages/opencode/src/kilocode/ and packages/kilo-docs/. Always look for ways to implement your feature or fix in a way that minimizes changes to shared code.

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.
  5. Mirror new config keys to the cloud schema - When adding a kilocode_change key to Config.Info in packages/opencode/src/config/config.ts, also add the matching JSON Schema entry in apps/web/src/app/config.json/extras.ts in the cloud repo. See CLI Config Schema for the step-by-step.

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

Git conflict style

bun install sets merge.conflictStyle=zdiff3 repo-locally via script/setup-git.ts (wired into postinstall). Conflicts include the common ancestor between ||||||| and =======, which is what script/upstream/ and mergiraf rely on for structural resolution and what makes manual resolution on shared opencode files tractable. If you've overridden it in your user config, the repo-local setting takes precedence — don't override it back.

Kilocode Change Markers

When editing shared upstream files, mark Kilo-specific lines with kilocode_change comments so future merges can find them. The basic forms are:

  • Single line: const value = 42 // kilocode_change
  • Multi-line block: wrap with // kilocode_change start / // kilocode_change end
  • New file in a shared path: // kilocode_change - new file at the top
  • JSX/TSX: use {/* kilocode_change */} (and {/* kilocode_change start */} / end)

Markers are NOT needed in paths that contain kilocode in the name (e.g. packages/opencode/src/kilocode/, packages/opencode/test/kilocode/) — these are entirely Kilo Code additions and won't conflict with upstream.

For decision rules on when to keep changes inline vs. extract Kilo logic, marker placement guidance, and verification commands, load .kilo/skills/kilocode-merge-minimizer/SKILL.md.

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.