This repository contains the Agent Control plugin for OpenClaw. It is a TypeScript ESM project that ships source files directly; there is no separate build step in normal development.
Run the full local verification stack before finishing non-trivial changes:
npm run lint
npm run typecheck
npm testWhen the change affects tests, coverage, or CI behavior, also run:
npm run coverageCoverage output is written to coverage/, including coverage/lcov.info for Codecov-compatible uploads.
- Prefer behavioral tests over implementation-detail tests.
- Write test names as concise behavioral summaries.
- Express Given/When/Then structure as code comments inside the test body.
- Make each Given/When/Then comment descriptive. Do not use placeholder comments like
// Given,// When, or// Thenby themselves. - Use Vitest for unit and integration-style tests.
- Assert externally visible outcomes first: return values, registered hooks, emitted logs, blocked tool calls, resolved context, and client calls.
- Mock boundary dependencies such as
agent-control, session/context helpers, and runtime-loading edges when needed, but keep the assertions focused on plugin behavior. - When adding a new branch in plugin logic, add or update tests in the corresponding
test/*.test.tsfile.
Examples of the preferred naming style:
it("defaults to warn", () => { ... })it("blocks the tool call when fail-closed sync fails", async () => { ... })
Examples of the preferred comment style:
// Given no logging configuration is provided// When the effective log level is resolved// Then warn mode is selected by default
- Keep imports ESM-compatible and include the
.tssuffix for local TypeScript imports, matching the current codebase style. - This repo uses
oxlintfor linting andtsc --noEmitfor semantic typechecking.npm run lintis not a substitute fornpm run typecheck. - Preserve the plugin's quiet default behavior. New logs should fit the existing
logLevelmodel:warn: warnings, errors, and block eventsinfo: important lifecycle eventsdebug: verbose diagnostics
Keep these files aligned when config shape or documented behavior changes:
src/types.tsopenclaw.plugin.jsonREADME.md- relevant tests under
test/
If a change affects CI expectations or coverage behavior, also update:
.github/workflows/lint.ymlpackage.jsonvitest.config.ts
The main GitHub Actions workflow is .github/workflows/lint.yml. Changes to scripts or coverage generation should keep local commands and CI steps in sync.