Remove 8 hosted platform packages that are not needed for the CLI-focused fork: - infra/ (SST infrastructure) - packages/console/ (console web app + backend) - packages/enterprise/ (enterprise/teams platform) - packages/web/ (Astro documentation site) - packages/slack/ (Slack integration) - packages/function/ (API workers) - packages/docs/ (static docs) - packages/identity/ (brand assets) Update upstream merge configuration to prevent these packages from being re-added during future merges from opencode upstream: - Add all deleted folders/files to skipFiles in config.ts - Add Vouch-related files to skip list (VOUCHED.md, vouch workflows) - Update transform-package-json.ts to preserve Kilo's workspace config - Remove slack/web references from transform lists Update supporting files: - Remove console/* and slack from package.json workspaces - Remove sst and @aws-sdk/client-s3 dependencies - Update AGENTS.md package references - Clean .prettierignore of deleted package references - Add logs/.gitignore to keep folder empty Result: 310,297 lines deleted, 11 npm packages removed, typecheck passing
5.9 KiB
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
mainref may not exist; usedevororigin/devfor diffs. - Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.
Build and Dev
- Dev:
bun run dev(runs from root) orbun run --cwd packages/opencode --conditions=browser src/index.ts - Typecheck:
bun turbo typecheck(usestsgo, nottsc) - Test:
bun testfrompackages/opencode/(NOT from root -- root blocks tests) - Single test:
bun test test/tool/tool.test.tsfrompackages/opencode/ - SDK regen: After changing server endpoints in
packages/opencode/src/server/, run./script/generate.tsfrom root to regeneratepackages/sdk/js/
Monorepo Structure
Turborepo + Bun workspaces. The packages you'll work with most:
| Package | Name | Purpose |
|---|---|---|
packages/opencode/ |
@kilocode/cli |
Core CLI -- agents, tools, sessions, server, TUI. This is where most work happens. |
packages/sdk/js/ |
@kilocode/sdk |
Auto-generated TypeScript SDK (client for the server API). Do not edit src/gen/ by hand. |
packages/kilo-gateway/ |
@kilocode/kilo-gateway |
Kilo auth, provider routing, API integration |
packages/kilo-telemetry/ |
@kilocode/kilo-telemetry |
PostHog analytics + OpenTelemetry |
packages/kilo-i18n/ |
@kilocode/kilo-i18n |
Internationalization / translations |
packages/app/ |
@opencode-ai/app |
Web/TUI frontend (SolidJS + Vite) |
packages/util/ |
@opencode-ai/util |
Shared utilities (error, path, retry, slug, etc.) |
packages/plugin/ |
@kilocode/plugin |
Plugin/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, useobj.aandobj.bto preserve context - Avoid
try/catchwhere possible - Avoid using the
anytype - 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
}
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:
-
Prefer
kilocodedirectories - Place Kilo-specific code in dedicated directories whenever possible:packages/opencode/src/kilocode/- Kilo-specific source codepackages/opencode/test/kilocode/- Kilo-specific testspackages/kilo-gateway/- The Kilo Gateway package
-
Minimize changes to shared files - When you must modify files that exist in upstream opencode, keep changes as small and isolated as possible.
-
Use
kilocode_changemarkers - When modifying shared code, mark your changes withkilocode_changecomments so they can be easily identified during merges. -
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 directorypackages/opencode/test/kilocode/- All test files for kilocode- Any other path containing
kilocodein filename or directory name
These paths are entirely Kilo Code additions and won't conflict with upstream.