Rules for any AI coding agent (Claude Code, Codex, etc.) working in web-agent.
- Make surgical fixes. Do not add new lines of code unless necessary.
- When changing or removing a feature, remove all related stale code in the same pass.
- Strive to write less code, not more.
- Ask clarifying questions if intent is unclear.
- Default to editing existing files; do not create new files when extending an existing module works.
- Never add comments that describe what code does — only why, and only when non-obvious.
For architecture context (runtime layout, IPC protocol, storage layers), read docs/ARCHITECTURE.md. Use English canonical docs unless the user requests a locale (docs/zh-CN/, docs/es/, docs/ar/).
Key entry points:
src/main.tsx— React root.src/core/orchestrator.ts— central agent lifecycle.src/agent/adapter.ts— bridges browser UI to the embedded Node-in-browser agent runtime.src/agent/runtime/turn.ts— main LLM loop.src/agent/runtime/tools/registry.ts— built-in + capability tool loading.
The src/agent/runtime tree is excluded from tsc (see tsconfig.json). Edits there are not type-checked at build time; rely on tests and runtime checks.
npx tsc -b --noEmitclean.npm testpasses.npm run buildsucceeds; no new oversized chunks.- For UI changes, smoke the affected panel in
npm run devonce.
Single-service SPA — only one process needed: npm run dev (Vite + embed-runtime watcher via concurrently). No Docker, databases, or external services required for development.
- Type checking requires a pre-built embed runtime. Run
npm run build:embed-runtimebeforenpx tsc -b --noEmitif you haven't started the dev server yet. The dev server builds it automatically on start. - Unit tests (
npm test) also build the embed runtime first; no extra steps needed. - No linter configured — there is no ESLint/Prettier/Biome. Type checking (
tsc) is the primary static analysis tool. - Playwright E2E (
npm run test:browser) requiresTESTING_OPENROUTER_API_KEYin.env.localand installed browsers (npx playwright install chromium). Skip unless you have an API key. - Directus skill E2E (
tests/skill-directus-crud.spec.ts) also needsTESTING_DIRECTUS_TOKEN(and optionallyTESTING_DIRECTUS_URL). Skips when Directus is unreachable via/api/proxy. - Dev server serves at
http://localhost:5173. LLM interactions require an API key configured per-profile in the UI (OpenRouter, Ollama, or custom provider). - Standard commands are documented in
package.jsonscripts and README "Development" section.