kiki
AGENTS.md53 starsChanged 14 days agoMITView on GitHub
Reply in the same language as the user. This is a TypeScript monorepo built for agent-assisted development. Keep the root AGENTS.md limited to hot-path rules: the project map, hard constraints, and workflow requirements — things every task needs to know.
- 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 31,700 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 repository12 other files it gives its agents.
- docs/AGENTS.mdAGENTS.md
- agent-core-devSkill
- agent-core-reviewSkill
- gen-changesetsSkill
- gen-docsSkill
- kiki-docs-catchupSkill
- kiki-docsSkill
- kiki-docs-writingSkill
- pre-changelogSkill
- sync-changelogSkill
- translate-docsSkill
- write-tuiSkill
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, 9 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
9
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
- Distinctive: line 11
Before making code changes, read the relevant code and the most recent constraints, and follow the nearest AGENTS.md in the directory tree.
- Distinctive: line 12
Keep changes focused. Do not slip in unrelated refactors along the way.
- Distinctive: line 13
When committing, do not add any co-author attribution, and do not reveal the identity of the agent in commit messages, PR descriptions, or …
- Very specific: line 47
Never merge upstream into apps/* or packages/*.
- Distinctive: line 64
Do not add too many new test files.
- Distinctive: line 65
When a test fails because of a user modification, default to fixing the test first.
- Very specific: line 66
Do not sacrifice code quality for external compatibility unless the user explicitly asks for it.
- Distinctive: line 79
Keep instruction updates focused and supported by code facts.
- Very specific: line 83
Prefer rg / rg --files when reading code.
- Distinctive: line 84
When designing changes, follow existing boundaries and local patterns first.
- Very specific: line 86
When creating a PR, the PR title must follow Conventional Commit style, e.g.
- Very specific: line 87
When an AI agent opens or updates a PR, fill in .github/pull_request_template.md — link the related issue or explain the problem, then …
- Distinctive: line 88
Do not submit vague AI-generated PR text.
- Very specific: line 89
After finishing a task and before submitting a PR, you must run the gen-changesets skill (see .agents/skills/gen-changesets/SKILL.md) and …
- Very specific: line 91
When generating a changeset, never decide on a major bump on your own — stop, explain, and get explicit user confirmation first.
- Very specific: line 92
Prefer importing via import ...
- Distinctive: line 93
Do not commit throwaway scratch or exploratory files.
- Very specific: line 96
Before committing or opening a PR, run git status and git diff --staged --stat and remove anything matching these patterns.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
Repository-level Agent Guide
Reply in the same language as the user.
This is a TypeScript monorepo built for agent-assisted development. Keep the root AGENTS.md limited to hot-path rules: the project map, hard constraints, and workflow requirements — things every task needs to know.
Working Principles
- Think from first principles. Start from real requirements, code facts, and verification results; if the goal is unclear, discuss it with the user first.
- Treat code, not documentation, as the source of truth for behavior. Implement and test functionality before catching prose up; early coding does not wait for documentation. Outside an explicit documentation task or catch-up stage, do not read ordinary Markdown just to understand the implementation. At a coherent candidate, classify the documentation impact and satisfy the applicable handoff or release boundary in
docs/AGENTS.md. - Before making code changes, read the relevant code and the most recent constraints, and follow the nearest
AGENTS.mdin the directory tree. - Keep changes focused. Do not slip in unrelated refactors along the way.
- When committing, do not add any co-author attribution, and do not reveal the identity of the agent in commit messages, PR descriptions, or any explanatory text.
Project Map
apps/kimi-code: the CLI / TUI application. It consumes@kiki/klient/@kiki/session-corefor client operations and@kiki/node-sdkfor host setup and SDK utilities; it must not depend directly on@kiki/agent-core-v2. When writing or modifying its terminal UI, use thewrite-tuiskill (.agents/skills/write-tui/SKILL.md).apps/kiki-gui: the shared browser and desktop GUI.apps/kimi-codebuilds it into the CLI package and serves it fromkiki web; for development, runpnpm dev:serverand point the GUI Vite server at it withKIKI_SERVER_URL. Default visual acceptance uses the headlessscripts/visual-proof.mjs; seeapps/kiki-gui/AGENTS.md.packages/agent-core-v2: the agent engine — the only one. (The historical v1packages/agent-corewas deleted; nothing in the repo may reintroduce it.) A DI × Scope design with threeLifecycleScopetiers (App/Session/Agent,src/app/scopes.ts), the L3 unit layer (Service/Fiber, collections, Features), and App-scopeISessionManager. Workspace resources live in leasedWorkspaceInstance/Programruntime generations, not a fourth DI scope. Seepackages/agent-core-v2/AGENTS.mdand use theagent-core-devskill (.agents/skills/agent-core-dev/SKILL.md) when developing here.packages/node-sdk: the public TypeScript SDK and harness.packages/kaos: the execution environment and file/process abstractions.packages/oauth: Kimi OAuth and managed auth utilities.packages/transcript: the isomorphic transcript rendering data layer — L1 agent-granular store, L2 idempotent operations, L3off/turn/block/deltasubscription granularity, L4 framework-free view registry, plus turn-cursor pagination. Pure TypeScript (browser-safe, no engine imports); the sole owner of the transcript contract types (src/contract/) and the op-batch sequencing contract. Seepackages/transcript/AGENTS.md.packages/kap-server: the Kiki server, backed by@kiki/agent-core-v2; exposes sessions over REST + WebSocket (/api+/api/ws), plus the/api/debug/*reflection RPC surface (--debug-endpoints, loopback bind + bearer auth). Seepackages/kap-server/AGENTS.md.packages/klient: the client SDK — a contract-driven facade over agent-core-v2 (global.*/session(id).*/agent(id).*, zod-validated); transport via subpath entry (@kiki/klient/http|ipc|memory, all return the sameKlient); also hosts the e2e suites. Seepackages/klient/AGENTS.md.packages/tree-sitter-bash: a pure-TypeScript bash parser (no runtime deps, no wasm);parse(source, { timeoutMs, maxNodes })runs under a deterministic budget and returns a discriminatedParseResult— callers must treat aborted/hasError trees as "cannot analyze" and degrade. Parser only, no safety judgments; see the package README's "Known differences" section.packages/lexical: dependency-free ASCII/CJK tokenization and Unicode literal normalization shared by Memory, history, search and legacy MiniDb APIs.packages/minidb: the legacy embedded document store retained during the storage migration; global search uses SQLite instead. Seepackages/minidb/AGENTS.md.
Environment Requirements
- Node.js:
>=24.22.1 <25 || >=26.12.1(from the rootpackage.jsonengines)..nvmrcis24.22.1, the 24 LTS pin used by nvm / fnm / mise and CI. Node.js 26 is accepted from26.12.1. Node.js 25 and Node.js 26 releases before26.12.1are rejected. - pnpm:
10.33.0(from the rootpackage.jsonpackageManager). pnpm installwill fail when the Node version is not satisfied, because.npmrcsetsengine-strict=true.
Monorepo Workspace Maintenance
pnpm-workspace.yamlis the source of truth for workspace membership, butflake.nixalso contains hardcodedworkspacePathsandworkspaceNameslists.- Whenever you add or remove a workspace package, you MUST update both
pnpm-workspace.yamlandflake.nix— for every package, including leaf / test / e2e packages that nothing depends on.pnpm-workspace.yamluses globs (packages/*,apps/*), so most packages land there automatically;flake.nixis fully manual and is where omissions happen.- Missing a path in
flake.nix'sworkspacePathswill silently drop files from the Nix build'ssrcfileset. - Missing a name in
flake.nix'sworkspaceNameswill breakpnpmConfigHookbecause dependencies for that workspace will not be fetched.
- The automated "Check flake.nix workspace sync" (
scripts/check-nix-workspace.mjs) verifies the full workspace in both directions: every package selected bypnpm-workspace.yamlmust appear in both flake.nix lists, and stale flake entries with no workspace package fail the check. Keep it green on every add/remove, but still update both files by hand in the same change — the check only runs in CI.
Upstream Synchronization
- Never merge upstream into
apps/*orpackages/*; receive selected upstream changes only through isolated cherry-picks or semantic ports. - Review upstream at every release tag or every four weeks, whichever comes first. Filter candidates by commit title and touched paths before reading full diffs.
- Review security/CVE fixes, provider protocol mismatches, and wire or persistence data-corruption fixes as soon as they appear rather than waiting for the regular review.
- Exclude UI changes, cloud features, secondary-model work, and runtime-to-DI/actor migrations in the first filter unless a separate Kiki decision explicitly reopens that area.
- Record every accepted, rejected, or deferred upstream commit in
handoffs/2026-08-31-kiki-parallel-campaigns/merge-log.mdusing the existing date / source / local HEAD / notes table format.
General Coding Rules
packages/agent-core-v2,packages/kap-server, andpackages/transcriptare comment-free zones: no line/block comments; the exceptions are JSDoc attached to exported symbols and load-bearing lint-suppression directives (oxlint-disable/eslint-disable), while other tooling directives (@ts-expect-error, …) stay banned. Enforced byscripts/check-no-comments.mjs, which runs as part ofpnpm lint.- For optional object properties, pass
undefineddirectly instead of using conditional spread.- YES:
{ user } - NO:
{ ...(user ? { user } : undefined) }
- YES:
- Optional object properties do not need to additionally allow
undefinedin the type.- YES:
interface Options { user?: User } - NO:
interface Options { user?: User | undefined }
- YES:
- Internal methods with only a single parameter should not be turned into options objects just for stylistic uniformity.
- Except for a package's
index.ts, otherindex.tsfiles should preferexport * from './module';. - Do not add too many new test files. Prefer adding tests to the existing test file of the corresponding component or module.
- When a test fails because of a user modification, default to fixing the test first; do not change the implementation to satisfy an old test unless the implementation truly has a bug.
- Do not sacrifice code quality for external compatibility unless the user explicitly asks for it. Breaking changes go through changesets and a
majorbump, gated by the rule below.
Experimental Features
- Product features are available by default, including new features. Use an experimental flag only for a real rollout or rollback boundary; do not add another master gate to an ordinary feature that already has its own configuration. A
default: falseneeds an explicit human requirement and its source, not a precaution about possible defects. Smoke-test and repair defects instead. - Availability does not authorize new external connections, plugin installation, or script execution. Preserve explicit user off choices, per-destination consent, and permission rules. Flag precedence remains per-flag env >
[experimental]config > truthy master env > registry default; a falsy master env is unset, not a global off command. - Flag definitions remain distributed: declare them in the owning domain through
registerFlagDefinitionat import time, then useIFlagService.enabled(id)(seepackages/agent-core-v2/docs/flag.md). Every built-in id also needs a Settings home, accurate application timing, and English/Chinese name and description inpackages/session-core; the distributed-registration regression insrc/settings/settings.test.tsmust stay green. Unknown-server fallback is for extensions, not missing built-in copy.
Where to Update Instructions
- Hard rules that affect almost every task: update the root
AGENTS.md. - Rules that only affect a specific directory: update the nearest sub-directory
AGENTS.md. - Project-map entries stay at 1–2 sentences; deep package docs live in the package's own
AGENTS.md. - Keep instruction updates focused and supported by code facts.
Workflow Requirements
- Prefer
rg/rg --fileswhen reading code. - When designing changes, follow existing boundaries and local patterns first.
- In public text and test data, replace real internal identifiers with neutral placeholders such as
example.com,example.test, andYOUR_API_KEY. Before opening a PR, ask a read-only agent to audit the diff for context-specific internal identifiers. - When creating a PR, the PR title must follow Conventional Commit style, e.g.
chore: remove legacy format commands. - When an AI agent opens or updates a PR, fill in
.github/pull_request_template.md— link the related issue or explain the problem, then describe what changed. Do not leave placeholder text or submit a generic summary of the diff. - Do not submit vague AI-generated PR text. The human author must understand the change well enough to explain the code, edge cases, and why the approach fits this repository.
- After finishing a task and before submitting a PR, you must run the
gen-changesetsskill (see.agents/skills/gen-changesets/SKILL.md) and generate a changeset under.changeset/according to its rules. - Changesets must strictly follow the rules in
.agents/skills/gen-changesets/SKILL.md: write one short user-facing sentence that states only what changed, and skip any change users cannot perceive. - When generating a changeset, never decide on a
majorbump on your own — stop, explain, and get explicit user confirmation first; default tominor, fall back topatch. See.agents/skills/gen-changesets/SKILL.md. - Prefer importing via
import ... from '#/...', which serves the same purpose asimport ... from '@/...'. - Do not commit throwaway scratch or exploratory files. Never stage:
- Agent working notes or handoff/summary documents (e.g.
HANDOVER-*.md,HANDOFF-*.md,handoff.md). - Throwaway UI/UX prototypes or design mockups (e.g.
*-designs.html,*-mockup.html,*-demo(s).html) at the repo root or under adesign/folder. The only tracked.htmlfiles should be Viteindex.htmlentrypoints. Before committing or opening a PR, rungit statusandgit diff --staged --statand remove anything matching these patterns. Put scratch work under.tmp/(gitignored) instead of the repo root or the source tree.
- Agent working notes or handoff/summary documents (e.g.
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.

