-
Notifications
You must be signed in to change notification settings - Fork 0
how to contribute patterns and conventions
The repo-wide rules live in AGENTS.md at the repository root; read it before contributing. This page summarizes the patterns that shape code across packages, plus the rules that are easy to trip over.
- TypeScript ESM throughout (
"type": "module"), strict typing, noanyunless absolutely necessary. - Never use inline imports: no
await import("./foo.js"), noimport("pkg").Typein type positions, no dynamic imports for types. Always standard top-level imports. - Biome (
biome.json) formats and lints;npm run checkrunsbiome check --write --error-on-warnings ., thentsgo --noEmit(the TypeScript native-preview compiler), then installer, browser-smoke, rendering, and web checks. It does not run tests. - Comments are for serious ambiguity only; don't pad code with commentary.
- Do not hardcode keybinding checks (
matchesKey(keyData, "ctrl+x")); all keybindings must be configurable, with defaults added toDEFAULT_EDITOR_KEYBINDINGSorDEFAULT_APP_KEYBINDINGS. - Never modify
packages/ai/src/models.generated.tsdirectly; updatepackages/ai/scripts/generate-models.tsand regenerate. - Never remove or downgrade code to fix type errors from outdated dependencies; upgrade the dependency instead. Dependency updates are subject to a 7-day minimum release age (
.npmrcmin-release-age=7); override only for urgent security patches withnpm install --min-release-age=0 <pkg>. - Never run
npm run dev,npm run build, ornpm testat the repo root as a validation step; usenpm run checkand run specific tests from the package root vianpx tsx ../../node_modules/vitest/dist/cli.js --run test/<file>.test.ts.
- Root is the npm workspace (
packages/*);web/is a separate pnpm workspace. Nevernpm installinsideweb/, and neverpnpm installat the repo root. -
web/serverlinks@earendil-works/*with pnpmlink:(notfile:) so nested agent deps resolve through the root npm tree. Do not addpackages/{ai,agent,tui,coding-agent}toweb/pnpm-workspace.yaml. - Browser code (
web/app/src,web/design) talks HTTP only: NDJSON + SSE. Never import@earendil-works/*from there.web/serveris the only web package that imports the agent packages. - When a change in
packages/coding-agenttouches the public surface the adapter consumes (createAgentSession,AgentSessionEvent,ExtensionUIContext,IpythonKernelProvisioner,SessionManager), updateweb/serverin the same change. Do not add web-specific exports to coding-agent. - The web contract lives in
web/protocol/src/chat-protocol.ts; schemas are zod inchat-protocol.zod.ts.
CONTEXT.md defines the agent language: clients interact through AgentConnection (with its extensions sub-interface), SessionView, afterReplace/ReplacedClientContext, and seedMessages. Avoid SessionManager (implementation), Session, Host, and the retired InteractiveModeLocalSessionHost. Process-local members (extension callbacks, getAbortSignal, getReadonlySessionManager, getSystemPromptSync, setup, withSession) must not be invented on the wire; daemon adapters throw AgentConnectionUnsupportedError.
Classify every daemon command, event, and response-shape change as backward-compatible, capability-gated, or incompatible:
- Optional features go behind a negotiated server capability; clients must check the capability before sending the command or depending on the event.
- Bump
DAEMON_PROTOCOL_VERSION(packages/coding-agent/src/modes/daemon/daemon-protocol.ts) for incompatible changes or when startup begins requiring behavior an older daemon cannot provide. - Update
DAEMON_SCHEMA_REVISION, the command/event compatibility maps, and both new-client/old-daemon and old-client/new-daemon tests for every wire change. - Optional daemon metadata and UI features must degrade locally; they must not prevent the agent, session attachment, or interactive startup from working.
- Never make a new daemon command part of startup without a protocol or capability gate.
- Vitest per package; run tests from the package root, not the repo root.
- For
packages/coding-agent/test/suite/, usetest/suite/harness.tsplus the faux provider. Do not use real provider APIs, real API keys, or paid tokens. - Put issue-specific regressions under
packages/coding-agent/test/suite/regressions/named<issue-number>-<short-slug>.test.ts. - If you create or modify a test file, you must run that file and iterate until it passes.
- Web tests run under
web/with vitest (pnpm --dir web test) and Playwright for e2e (test:e2einweb/app).
- Each package has its own
CHANGELOG.md; new entries always go under## [Unreleased]as flat past-tense bullets, one line each. Never modify released version sections. - Internal fixes cite the issue (
Fixed foo bar ([#123](https://github.com/PrimeIntellect-ai/prime-agent/issues/123))); external contributions cite PR and author. - Lockstep versioning: all packages share the same version.
npm run release:patchfor fixes and additions,npm run release:minorfor API breaking changes. No major releases.
Multiple agents may work in the same worktree. Only commit files you changed in this session; always git add <specific-file-paths>, never git add -A or git add .. Forbidden: git reset --hard, git checkout ., git clean -fd, git stash, git commit --no-verify. Push with git pull --rebase && git push; resolve conflicts only in your own files, and never force push. Include fixes #<number> or closes #<number> in commit messages when a related issue exists.
- Development workflow, the branch-to-merge cycle
- Testing, frameworks and how to run them
- Daemon protocol, the wire contract in detail
- Design decisions, rationale behind the seam and the fork