Development Workflow
On this page
Day-to-day commands and conventions for working on Polyant. Read Getting Started first if you have not yet run the project locally.
Prerequisites
- Node.js 24 (the active LTS, named in
.nvmrc) - npm 11 (ships with Node 24)
- Docker + Docker Compose (for PostgreSQL with pgvector)
- A POSIX-style shell (bash, zsh, fish)
Optional but recommended:
- An OpenAI or Anthropic API key (the engine needs at least one for LLM calls)
- An IDE with TypeScript support (VS Code, Cursor, etc.)
Setup
git clone https://github.com/polyant-ai/polyant.git
cd polyant
cp .env.example .env # then edit secrets
npm install # installs all workspaces
docker compose up -d # starts postgres on :5432
npm run db:migrate # schema (no agent is seeded)Run
All commands work from the monorepo root.
# Engine (NestJS) - OpenAI-compatible + management API on :4000
npm run dev
# alias:
npm run dev:engine
# Admin panel (Next.js) on :3000
npm run dev:webPer-workspace commands use -w:
npm run dev -w @polyant/engine
npm run build -w @polyant/webTest
npm run test:unit # vitest unit tests (engine)
npm run test:integration # database-backed integration tests
npm test # tests in every workspace
npm run typecheck # tsc --noEmit on all workspaces
npm run lint # eslint on all workspacesCI runs typecheck + lint + test on every PR. Run them locally before
pushing.
Database
Drizzle ORM manages schema. Migrations live in
packages/engine/src/database/migrations/.
npm run db:generate # generate a migration from schema diff
npm run db:migrate # apply pending migrations
npm run db:studio # open Drizzle Studio GUINote:
npx drizzle-kit generatedoes not work in this repo because of an ESM incompatibility. Usenpm run db:generate(which calls drizzle-kit viatsx) or write incremental migrations by hand. See CLAUDE.md → “drizzle-kit with ESM” caveat.
Adding a new tool
Tools are discovered at boot by scanning a directory.
- Create
packages/engine/src/agents/tools/<your-tool>.tool.ts. export default defineTool({ name, description, parameters, execute }), importingdefineToolfrom@polyant-ai/plugin-sdk. This is the only shape the loader recognises - a file with any other default export is skipped with a console warning, and the tool silently does not exist.- Restart the engine -
loadAllTools()auto-discovers the file. - Enable the tool on an agent from its Tools section (or
PATCH /api/instances/:slug/tools).
For canonical, in-tree examples see any *.tool.ts file under
packages/engine/src/agents/tools/. The full walkthrough, including the
strict-mode schema rules and the runtime context, is in
Add a Tool.
Adding a new skill
Skills live in the skills + skill_versions DB tables - never on disk.
- Through the UI: admin panel → Skills → New skill, then attach it to an agent from its Skills section.
- Through the API:
POST /api/organizations/:orgSlug/skillsto create it, thenPATCH /api/instances/:slug/skillsto enable it on an agent. That second call takes the complete set of enabled skill names, not a delta. - Either way the skill also has to be assigned to the agent’s workspace before the runtime will serve it - see What a workspace may draw on.
See Skill Frontmatter for the SKILL.md format (frontmatter + body).
Branching and commits
- Branch off
main:feat/<short-name>,fix/<short-name>, etc. - One logical change per commit.
- Conventional Commits format:
feat(engine): add Discord channel adapter fix(web): correct sidebar collapse on mobile docs: add deployment recipe for Fly.io - Sign off every commit with the DCO (
git commit -s). See CONTRIBUTING.md .
Pull request
- Push your branch and open a PR against
main. - The PR template asks for: summary, motivation, test plan.
- Make sure CI passes (
typecheck,lint,test). - Keep PRs focused - under ~400 lines of diff is easier to review.
- Address review feedback in new commits (no force-pushes during review).
- A maintainer will squash-merge once approved.
Where to look next
- Architecture - system design and pipeline overview.
- Glossary - terminology cheat sheet.
- CLAUDE.md - exhaustive conventions and caveats.
- CONTRIBUTING.md - DCO, code of conduct, review process.