AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-228
  5. plan
  6. plan.md
plan.md(3.1 KB)· Apr 1, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks
  • Open Questions

Plan: Agent Quality Gate — Pre-PR Checks#

Summary#

Add a shared pre-commit quality gate that runs unit tests and lint before any agent-created commit is made. Implement using husky (a standard Node.js git-hooks manager) as a pre-commit hook, with override support via a new /agent skip-quality-gate directive, and pass the override flag through the phase-router invocation.

Files#

FileActionDescription
package.jsonmodifyAdd husky as devDependency; add prepare script to install husky hooks
.husky/pre-commitcreateHusky pre-commit hook: runs npm run lint && npm run test before each commit
src/directive/dto/directive.dto.tsmodifyAdd 'skip-quality-gate' to ALLOWED_DIRECTIVES
src/directive/directive.service.tsmodifyHandle skip-quality-gate directive: set flag on task, post confirmation comment
src/phase-router/phase-router.service.tsmodifyAdd skip-quality-gate to VALID_DIRECTIVES; pass quality-gate-override env var to Claude invocation
src/database/entities/task.entity.tsmodifyAdd qualityGateOverride boolean column (default false)
src/task-state/task-state.service.tsmodifyAdd method to set/get quality gate override flag
src/directive/directive.service.spec.tsmodifyAdd test for skip-quality-gate directive handling
src/phase-router/phase-router.service.spec.tsmodifyAdd test for quality gate override pass-through

Steps#

  1. Add skip-quality-gate directive — add to ALLOWED_DIRECTIVES in directive.dto.ts, add handling in DirectiveService.applyDirective() to set a qualityGateOverride flag on the task entity, and add to VALID_DIRECTIVES in phase-router.
  2. Add qualityGateOverride column to TaskEntity — boolean column defaulting to false. Add setter/getter in TaskStateService.
  3. Install husky and add pre-commit hook — add husky as a devDependency in package.json with a prepare script; create .husky/pre-commit that runs npm run lint && npm run test. This replaces the custom pre-pr-gate.sh approach with the idiomatic Node.js git-hooks solution.
  4. Wire override env var through phase-router invocation and write tests — in PhaseRouterService, when building the Claude invocation env for deliver phase, check task's qualityGateOverride flag and set QUALITY_GATE_OVERRIDE=1 if true. Write unit tests for skip-quality-gate directive handling and override env passthrough.

Verification#

  • npm run test passes with new directive and task entity tests
  • npm run lint passes with zero warnings
  • Manual: /agent skip-quality-gate sets override flag and posts confirmation comment
  • Husky pre-commit hook blocks commits when lint or tests fail

Risks#

  • Existing in-flight tasks lack the new column — mitigate with SQLite default value (false), no migration needed.

Open Questions#

  • Should skip-quality-gate be a one-time override (reset after use) or persist for the task lifetime? Recommend one-time (reset after deliver phase completes).
ContextPrd