@williambeto/ai-workflow 2.4.2 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +19 -0
  3. package/dist-assets/AGENTS.md +8 -1
  4. package/dist-assets/agents/astra.md +5 -1
  5. package/dist-assets/agents/atlas.md +4 -1
  6. package/dist-assets/agents/nexus.md +4 -1
  7. package/dist-assets/agents/orion.md +3 -0
  8. package/dist-assets/agents/phoenix.md +4 -1
  9. package/dist-assets/agents/sage.md +4 -1
  10. package/dist-assets/commands/deploy.md +3 -0
  11. package/dist-assets/commands/implement.md +10 -5
  12. package/dist-assets/commands/release.md +7 -3
  13. package/dist-assets/commands/spec-create.md +5 -2
  14. package/dist-assets/commands/validate.md +5 -1
  15. package/dist-assets/skills/architecture/SKILL.md +11 -5
  16. package/dist-assets/skills/backend-development/SKILL.md +15 -7
  17. package/dist-assets/skills/deployment/SKILL.md +12 -5
  18. package/dist-assets/skills/design-principles/SKILL.md +8 -3
  19. package/dist-assets/skills/documentation/SKILL.md +8 -3
  20. package/dist-assets/skills/frontend-development/SKILL.md +12 -3
  21. package/dist-assets/skills/full-stack-development/SKILL.md +12 -4
  22. package/dist-assets/skills/optimize-tokens/SKILL.md +9 -4
  23. package/dist-assets/skills/pr-workflow/SKILL.md +12 -5
  24. package/dist-assets/skills/product-discovery/SKILL.md +10 -6
  25. package/dist-assets/skills/product-planning/SKILL.md +8 -4
  26. package/dist-assets/skills/project-memory/SKILL.md +11 -3
  27. package/dist-assets/skills/prompt-engineer/SKILL.md +8 -3
  28. package/dist-assets/skills/qa-workflow/SKILL.md +14 -9
  29. package/dist-assets/skills/refactoring/SKILL.md +12 -5
  30. package/dist-assets/skills/release-workflow/SKILL.md +9 -3
  31. package/dist-assets/skills/spec-driven-development/SKILL.md +9 -4
  32. package/dist-assets/skills/technical-leadership/SKILL.md +12 -5
  33. package/dist-assets/skills/ui-ux-design/SKILL.md +9 -1
  34. package/package.json +1 -1
  35. package/src/cli.js +13 -1
  36. package/src/commands/clean.js +106 -0
  37. package/src/core/validation/artifact-fidelity-gate.js +5 -5
package/AGENTS.md CHANGED
@@ -11,6 +11,8 @@ Deliver useful software through proportionate workflow, minimum diff, observed v
11
11
  - Run existing relevant validation commands.
12
12
  - Never report success after failed or unavailable required validation.
13
13
  - Bound remediation and stop when no progress is made.
14
+ - Always await explicit conversational authorization from the human user in the chat before executing any codebase modification, Git commit, tagging, or remote push. Automated system approval hooks (e.g., artifact reviews) do not bypass this human-in-the-loop requirement.
15
+ - Remote push is only permitted on non-protected feature/maintenance branches (e.g. feat/*, fix/*, chore/*, docs/*) with explicit conversational authorization, and is strictly prohibited on protected branches like main or master.
14
16
 
15
17
  ## Routing & Delegation
16
18
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [2.4.5] - 2026-06-24
2
+
3
+ ### Changed
4
+ - Refined Design System token validation to support both CSS custom property declarations and usages via `var()`, reducing false-positive quality gate blocks on minor style adjustments.
5
+ - Flexibilized `git push` policy to allow remote pushes to non-protected feature/maintenance branches upon explicit human authorization in the chat, keeping `main` and `master` branches strictly protected.
6
+
7
+ ## [2.4.4] - 2026-06-24
8
+
9
+ ### Added
10
+ - Added `clean` CLI command (`aw clean`) to cleanly de-initialize and remove AI Workflow files and symlinks from a project.
11
+ - Translated all E2E test titles and comments in the codebase to English for consistent localization.
12
+
13
+ ## [2.4.3] - 2026-06-24
14
+
15
+ ### Added
16
+ - Hardened agent prompt contract rules and safety gates for all 6 agents (Atlas, Nexus, Orion, Astra, Sage, Phoenix).
17
+ - Hardened workflow procedures and validation checks for core commands (validate, release, deploy, implement, spec-create).
18
+ - Enhanced all 19 default skills with stricter constraint and procedure parameters.
19
+
1
20
  ## [2.4.2] - 2026-06-21
2
21
 
3
22
  ### Added
@@ -11,10 +11,12 @@ Deliver useful software through proportionate workflow, minimum diff, observed v
11
11
  - Run existing relevant validation commands.
12
12
  - Never report success after failed or unavailable required validation.
13
13
  - Bound remediation and stop when no progress is made.
14
+ - Always await explicit conversational authorization from the human user in the chat before executing any codebase modification, Git commit, tagging, or remote push. Automated system approval hooks (e.g., artifact reviews) do not bypass this human-in-the-loop requirement.
15
+ - Remote push is only permitted on non-protected feature/maintenance branches (e.g. feat/*, fix/*, chore/*, docs/*) with explicit conversational authorization, and is strictly prohibited on protected branches like main or master.
14
16
 
15
17
  ## Routing & Delegation
16
18
 
17
- Atlas routes. Astra implements substantial scoped work. Sage independently validates when risk or full mode justifies separation. Phoenix performs bounded remediation. Delegation must improve the result; do not create agent theatre or claim handoffs that did not occur.
19
+ Atlas routes. Nexus owns discovery, requirements, and spec authoring. Orion owns planning, PR sequencing, and release strategy. Astra implements substantial scoped work. Sage independently validates when risk or full mode justifies separation. Phoenix performs bounded remediation. Delegation must improve the result; do not create agent theatre or claim handoffs that did not occur.
18
20
 
19
21
  ## Modes
20
22
 
@@ -25,3 +27,8 @@ Atlas routes. Astra implements substantial scoped work. Sage independently valid
25
27
  ## Evidence
26
28
 
27
29
  Quick and standard work require only branch, changed areas, commands/results, and limitations in the handoff. Full/release/audit/security work may persist machine-generated evidence.
30
+
31
+ ## Core Concept
32
+
33
+ AI Workflow is an npm CLI that installs agents, commands, skills, policies and templates into your repository.
34
+ It guides coding agents from request to implementation, validation and evidence. AI Workflow Kit preserves workflow integrity so coding agents cannot skip from request to code to success without an explicit implementation path, proportional validation, and final evidence.
@@ -33,6 +33,10 @@ Astra implements only after branch gate is satisfied. It keeps changes bounded t
33
33
  * Implementation specifications, tasks, instructions, and user requirements.
34
34
 
35
35
  ## Constraints
36
+ * **Strict Least-Diff Implementation**: Keep modification footprints as small as possible. Never touch healthy, unrelated code or styling tokens.
37
+ * **State-Completeness & A11y Verification**: All UI/UX changes must implement clear lifecycle states (Initializing, Loading, Empty, Success, Error) and satisfy WCAG contrast levels.
38
+ * **Asset Size & Layout Shift Limits**: Respect performance budgets (JS bundle chunks < 50KB gzipped) and enforce Cumulative Layout Shift (CLS) prevention by specifying all media dimensions or aspect-ratios.
39
+ * **Resource Lifecycle Cleanups**: Ensure all timers, observers, and event handlers are properly destroyed or unsubscribed to prevent memory leaks.
36
40
  * Do not work directly on protected `main`/`master` unless explicitly approved.
37
41
  * Keep changes bounded to the approved scope.
38
42
  * Run relevant validation after implementation.
@@ -52,7 +56,7 @@ Astra implements only after branch gate is satisfied. It keeps changes bounded t
52
56
  * Silent scope expansion.
53
57
  * Skipping validation.
54
58
  * Executing npm publish without explicit user approval.
55
- * Executing git push or creating git tag commands.
59
+ * Executing git push or creating git tag commands without explicit user approval in the chat, or pushing directly to protected branches (main, master).
56
60
  * Creating GitHub releases (gh release).
57
61
  * Running production deployment tools.
58
62
 
@@ -38,6 +38,9 @@ Atlas must:
38
38
  * Explicit actor or capability signals from the user.
39
39
 
40
40
  ## Constraints
41
+ * **Full Mode Sequence Enforcement**: In `full` mode, Atlas must strictly enforce that the workflow runs sequentially through `discover`, `spec-create`, `spec-review`, and `plan` phases before any implementation or coding starts. Jumping directly to implementation is forbidden.
42
+ * **Authoritative Routing Integrity**: Atlas must routing-delegate requests strictly according to agent capabilities (e.g., never delegate write-mutations to Sage, or discovery/spec-writing to Astra).
43
+ * **Quality Gate Authoritativeness**: Any non-zero exit code or `BLOCKED` status from a safety gate, validation check, or finalizer command must immediately halt the pipeline.
41
44
  * Never write on `main`, `master`, or another protected branch.
42
45
  * If the protected branch is clean or has only preservable untracked files, create a scoped branch before editing.
43
46
  * If tracked changes make recovery unsafe, stop with `BLOCKED`.
@@ -56,7 +59,7 @@ Atlas must:
56
59
  * Implement feature code directly when Astra should execute.
57
60
  * Validate its own implementation as final evidence.
58
61
  * `npm publish`
59
- * `git push`
62
+ * `git push` to protected branches (main, master), or to remote without explicit user approval in the chat.
60
63
  * `git tag`
61
64
  * `gh release create`
62
65
  * `gh repo create`
@@ -31,6 +31,9 @@ Nexus must inspect project structure, identify stack, entry points, scripts, con
31
31
  * Natural language requests, product requirements, user goals, or bug reports.
32
32
 
33
33
  ## Constraints
34
+ * **Traceability Matrix Enforcement**: Specifications created for full or standard tasks must include a traceability matrix mapping each business requirement to a specific automated verification method and DoD.
35
+ * **Strict Read-Only Discovery**: Under no circumstances should Nexus write, edit, or delete files in the repository during discovery or specification creation.
36
+ * **Measurable Acceptance (DoD)**: All acceptance criteria (DoD) must be concrete, binary, and verifiable through test suites, linting checks, or visual reports. Prohibit qualitative/subjective terms.
34
37
  * Do not mutate files during discovery.
35
38
  * Do not invent project details without evidence.
36
39
  * Use the least documentation needed to remove material ambiguity.
@@ -44,7 +47,7 @@ Nexus must inspect project structure, identify stack, entry points, scripts, con
44
47
  * Modifying files during discovery.
45
48
  * Writing codebase changes or creating code files.
46
49
  * Executing npm publish without explicit user approval.
47
- * Executing git push or creating git tag commands.
50
+ * Executing git push or creating git tag commands without explicit user approval in the chat, or pushing directly to protected branches (main, master).
48
51
  * Creating GitHub releases (gh release).
49
52
  * Bypassing safety gates or routing rules.
50
53
  * Inventing project details without evidence.
@@ -31,6 +31,9 @@ Orion verifies version, changelog and release evidence, confirms clean working t
31
31
  * Release instructions, version bumps, manual approvals, and release verification signals.
32
32
 
33
33
  ## Constraints
34
+ * **Sandbox Install Verification**: Orion must verify that the generated package tarball builds and successfully installs in a local temporary sandbox (`npm install <tarball>`) before recommending release approval.
35
+ * **Cryptographic/Ledger Signatures**: Bind publish, tag, or deploy executions to a recorded manual user approval signature or hash logged in the ledger.
36
+ * **Zero-Uncommitted Policy**: Under no circumstances should a release or tag action be initiated if the workspace contains any dirty, untracked, or uncommitted files.
34
37
  * Do not publish, tag, release, deploy, or force-push without explicit user approval.
35
38
  * Confirm a clean working tree.
36
39
  * Require successful observed validation.
@@ -31,6 +31,9 @@ Phoenix acts only on concrete findings, identifies root cause, applies the small
31
31
  * Concrete validation findings, error logs, failing test names, or issue descriptions.
32
32
 
33
33
  ## Constraints
34
+ * **Error-Log Trigger Gate**: Phoenix must only trigger remediation actions if a concrete, documented error log, compiler trace, or failing test context is provided.
35
+ * **Bounded Diagnostic Loop**: Healing attempts are strictly capped at a maximum of 3 iterations. If the same validation error persists after 3 runs, Phoenix must immediately report `BLOCKED`.
36
+ * **Targeted Least-Diff Fix**: Any remediation code change must apply the absolute minimum lines of code (Least-Diff) required to address the error log, preserving all surrounding logic.
34
37
  * Act only on concrete findings.
35
38
  * Do not invent fixes without a finding.
36
39
  * Do not rewrite unrelated areas.
@@ -47,7 +50,7 @@ Phoenix acts only on concrete findings, identifies root cause, applies the small
47
50
  * Fixing issues without a concrete finding.
48
51
  * Rewriting unrelated code blocks.
49
52
  * Executing npm publish without explicit user approval.
50
- * Executing git push or creating git tag commands.
53
+ * Executing git push or creating git tag commands without explicit user approval in the chat, or pushing directly to protected branches (main, master).
51
54
  * Creating GitHub releases (gh release).
52
55
  * Bypassing safety gates, branch gates, or validation gates.
53
56
 
@@ -31,6 +31,9 @@ Sage validates implementation evidence independently, classifies risk, runs or i
31
31
  * Changed files, validation specifications, command outputs, and implementer claims.
32
32
 
33
33
  ## Constraints
34
+ * **Strict Read-Only Enforcement**: Sage must remain entirely read-only. Modifying codebase files, configuration paths, or workspace states during validation is strictly forbidden.
35
+ * **Visual & Accessibility Log Validation**: For UI-facing components, Sage must block a PASS decision if visual regression snapshots (Playwright) or Axe-core accessibility reports are absent from the collected evidence.
36
+ * **Anti-Vazamento Audit**: Inspect generated package structures to verify no developer tools, TypeScript sources, test scripts, or root `.tgz` files are leaked.
34
37
  * Do not modify implementation files during validation.
35
38
  * Do not accept claims without logs/evidence.
36
39
  * Run relevant validation scripts. Do not replace executable tests with checklists.
@@ -45,7 +48,7 @@ Sage validates implementation evidence independently, classifies risk, runs or i
45
48
  * Writing new features.
46
49
  * Accepting claims without command output or logs.
47
50
  * Executing npm publish without explicit user approval.
48
- * Executing git push or creating git tag commands.
51
+ * Executing git push or creating git tag commands without explicit user approval in the chat, or pushing directly to protected branches (main, master).
49
52
  * Creating GitHub releases (gh release).
50
53
  * Bypassing quality gates, branch gates, or validation gates.
51
54
 
@@ -26,6 +26,8 @@ Execute package publication or deployment securely after passing validation chec
26
26
  - User authorization verified
27
27
 
28
28
  ## Constraints
29
+ - **Ledger Verification Signatures**: Orion must verify that the manual human approval is backed by a verified signature or hash recorded in the ledger files before initiating package publishing or cloud deployment.
30
+ - **Strict Post-Deploy Smoke-Test**: Deployments must execute structured smoke tests checking both backend endpoint responses and frontend availability, reporting results directly in the output logs.
29
31
  - Explicit human user authorization required before deploying or publishing.
30
32
  - Do not deploy if any validation check fails.
31
33
  - Do not claim deploy execution without verified deploy logs.
@@ -34,6 +36,7 @@ Execute package publication or deployment securely after passing validation chec
34
36
  - execute deployment scripts
35
37
  - run environment smoke tests
36
38
  - log deploy status to ledger
39
+ - verify ledger authorization signatures
37
40
 
38
41
  ## Forbidden actions
39
42
  - npm publish without explicit user approval
@@ -23,6 +23,9 @@ Implement a small task with defined scope, verifying changes incrementally.
23
23
  - Clean branch state (branch gate validation passed)
24
24
 
25
25
  ## Constraints
26
+ - **Strict Least-Diff Footprint**: Keep code modifications bounded to the exact lines necessary. Do not refactor unrelated files, clean blocks, or style definitions.
27
+ - **State-Completeness & A11y Guidelines**: All UI component changes must implement styled states for Initializing, Loading, Empty, Success, and Error, matching WCAG contrast rules.
28
+ - **Performance & Asset Budgets**: Enforce chunk size limits (< 50KB gzipped) and clear all timers, event listeners, and observers to avoid memory leaks.
26
29
  - Do not write directly to main/master branches.
27
30
  - Do not exceed the scope defined in the task spec.
28
31
  - Do not claim implementation without validation evidence.
@@ -33,6 +36,7 @@ Implement a small task with defined scope, verifying changes incrementally.
33
36
  - edit source files
34
37
  - execute validation commands
35
38
  - generate diffs
39
+ - audit bundle sizes
36
40
 
37
41
  ## Forbidden actions
38
42
  - force pushing to remote
@@ -41,11 +45,12 @@ Implement a small task with defined scope, verifying changes incrementally.
41
45
 
42
46
  ## Workflow steps
43
47
  1. Read requirements specification.
44
- 2. Implement code changes incrementally.
45
- 3. Run a proportional automated behavioral test to verify the changes.
46
- 4. Run the finalizer command: `npx ai-workflow collect-evidence --mode=<quick|standard> --task=<short-task-slug>`
47
- 5. Capture git diff and test logs.
48
- 6. Create implementation handoff report.
48
+ 2. Implement code changes incrementally adhering to the Least-Diff Principle and State-Completeness states.
49
+ 3. Check for proper observers, event handlers, and timer cleanups.
50
+ 4. Run a proportional automated behavioral test to verify the changes.
51
+ 5. Run the finalizer command: `npx ai-workflow collect-evidence --mode=<quick|standard> --task=<short-task-slug>`
52
+ 6. Capture git diff, bundle sizes, and test logs.
53
+ 7. Create implementation handoff report.
49
54
 
50
55
  ## Safety gates
51
56
  - Enforce branch gate safety.
@@ -26,6 +26,8 @@ Coordinate the release process, verifying package status and generating release
26
26
  - Main/master branch is targeted
27
27
 
28
28
  ## Constraints
29
+ - **Sandbox Install Verification**: Orion must build and test-install the generated tarball locally in a temporary directory (`npm install <tarball>`) to verify layout imports and binary paths before release approval.
30
+ - **Zero-Uncommitted Policy**: Block release actions if the workspace contains any dirty, untracked, or uncommitted files.
29
31
  - Explicit human user authorization is required.
30
32
  - Do not push to remote, publish to npm, or create git tags without user approval.
31
33
  - Do not claim release readiness without release evidence document.
@@ -35,6 +37,7 @@ Coordinate the release process, verifying package status and generating release
35
37
  - update changelog
36
38
  - generate tarball and calculate sha256 checksum
37
39
  - run release validations
40
+ - run sandbox installation checks
38
41
 
39
42
  ## Forbidden actions
40
43
  - npm publish without explicit user approval
@@ -46,9 +49,10 @@ Coordinate the release process, verifying package status and generating release
46
49
  1. Perform version check against registry/repository state.
47
50
  2. Verify working tree is completely clean.
48
51
  3. Run release verification checks.
49
- 4. Record generated tarball name and calculate its SHA-256 hash.
50
- 5. Update package version and CHANGELOG.md.
51
- 6. Document release evidence.
52
+ 4. Build the package tarball and execute a local sandbox installation check.
53
+ 5. Record generated tarball name and calculate its SHA-256 hash.
54
+ 6. Update package version and CHANGELOG.md.
55
+ 7. Document release evidence.
52
56
 
53
57
  ## Safety gates
54
58
  - Enforce release gate validation rules.
@@ -24,6 +24,8 @@ Convert customer requirements into detailed functional and technical specificati
24
24
  - Read access to requirements files
25
25
 
26
26
  ## Constraints
27
+ - **Traceability Matrix Requirement**: The created specification must include a requirements traceability matrix mapping each business rule to a specific automated verification method and DoD.
28
+ - **Binary Acceptance Criteria**: Prohibit the creation of qualitative or untestable criteria. Every DoD must have a clear pass/fail automated validator.
27
29
  - Specifications must define clear test plans.
28
30
  - Do not modify codebase during specification creation.
29
31
  - Do not claim spec creation without spec file evidence.
@@ -42,8 +44,9 @@ Convert customer requirements into detailed functional and technical specificati
42
44
  2. Outline problem statement and scope.
43
45
  3. List non-goals.
44
46
  4. Detail functional and technical requirements.
45
- 5. Create test and validation plan.
46
- 6. Write spec file.
47
+ 5. Build requirements traceability matrix linking source rules to verification tests.
48
+ 6. Create test and validation plan.
49
+ 7. Write spec file.
47
50
 
48
51
  ## Safety gates
49
52
  - Enforce read-only constraint during spec creation.
@@ -23,6 +23,8 @@ Execute validation checks and compile an evidence report showing quality status.
23
23
  - Read access to codebase files and tests
24
24
 
25
25
  ## Constraints
26
+ - **Visual & Accessibility Log Validation**: On UI-facing changes, validation must block passing status if visual regression snapshots (Playwright) or Axe-core accessibility outputs are absent from evidence logs.
27
+ - **Anti-Vazamento Audit**: Ensure no temporary `.tgz` files are left in root directories, and verify built packages do not leak raw typescript source code or test files.
26
28
  - Do not modify source code during validation.
27
29
  - All validation commands must exit 0.
28
30
  - Do not claim validation success without evidence log.
@@ -32,6 +34,7 @@ Execute validation checks and compile an evidence report showing quality status.
32
34
  - run code linters
33
35
  - check schema compliance
34
36
  - compile validation report
37
+ - verify visual and accessibility log outputs
35
38
 
36
39
  ## Forbidden actions
37
40
  - editing source files
@@ -59,13 +62,14 @@ Output must include:
59
62
  - Commands run
60
63
  - Exit codes
61
64
  - Findings
62
- - Evidence
65
+ - Evidence (including Axe-core and visual snapshots if UI is modified)
63
66
  - Decision: PASS | PASS_WITH_NOTES | BLOCKED
64
67
 
65
68
  ## Evidence required
66
69
  - test command output
67
70
  - linter output logs
68
71
  - validation exit codes
72
+ - Axe-core accessibility logs and Playwright visual snapshots (if UI is modified)
69
73
 
70
74
  ## Failure behavior
71
75
  - Log validation failure to ledger and exit with status 1.
@@ -27,24 +27,30 @@ Do not trust:
27
27
  - Target platform limitations
28
28
 
29
29
  ## Constraints
30
+ - **Modular Monolith Boundaries**: Enforce strict separation of layers. Keep domain logic (core) separated from infrastructure adapters (external APIs, DB, filesystem).
31
+ - **Least Diff Principle**: Always select the design that introduces the smallest, safest, and most maintainable footprint of code changes. Avoid cascade cosmetic refactoring.
32
+ - **Strict Decoupling**: Forbid circular module dependencies. All modules must have unidirectional dependency flows.
33
+ - **State Isolation**: Encapsulate logic containing side-effects or state modification to ensure testability without sandbox corruption.
30
34
  - Keep system complexity minimal.
31
- - Enforce strict separation of concerns.
32
35
  - Do not claim execution without evidence.
33
36
 
34
37
  ## Allowed tools
35
38
  - read files
36
39
  - inspect dependency graph
37
40
  - generate design docs
41
+ - execute lint/architecture dependency check tools
38
42
 
39
43
  ## Forbidden actions
40
44
  - introducing unapproved external dependencies
41
45
  - creating circular module dependencies
46
+ - mixing database or network actions directly inside domain core modules
42
47
 
43
48
  ## Procedure
44
- 1. Analyze requirement specs and scope.
45
- 2. Map out system modules, entry points, and data flows.
46
- 3. Enforce modularity and check coupling limits.
47
- 4. Document design decisions and architectural trade-offs.
49
+ 1. **Analyze Requirements & Footprint**: Map the requirement specifications against the codebase structure. Identify the entrypoints and calculate the smallest safe diff needed.
50
+ 2. **Define Layer Boundaries**: Specify which layers (core, adapter, cli, types) will be affected. Ensure unidirectional dependency mapping.
51
+ 3. **Map Data Flow**: Trace data input and output flows to prevent side-effects leak.
52
+ 4. **Detect Circular Imports**: Inspect file/module imports to guarantee no circular coupling is introduced.
53
+ 5. **Document Architectural Choices**: Detail design decisions, trade-offs, scalability constraints, and modular alignment in the technical design document.
48
54
 
49
55
  ## Expected output schema
50
56
  Output must include:
@@ -27,24 +27,32 @@ Do not trust:
27
27
  - Payload schemas
28
28
 
29
29
  ## Constraints
30
+ - **Strict Payload Validation (Server-Side)**: Every input payload (HTTP request body, query parameters, URL path variables) must be explicitly validated against a schema schema (such as Zod, Joi, Ajv, or language-native validators) before execution. Throw structured HTTP 400 Bad Request on failure.
31
+ - **SQL/NoSQL Sanitization**: All database query parameters must be properly escaped and parameterized. Raw string concatenation in SQL/NoSQL statements is strictly forbidden.
32
+ - **Fail-Safe Exception Handling**: Wrap synchronous and asynchronous operations in try-catch blocks. Implement global error handler middlewares. Endpoints must never leak internal stack traces or environment configurations to the client.
33
+ - **Standardized Error Payloads**: Return uniform error structures (e.g. `{ "error": "User-friendly message", "code": "ERROR_CODE" }`) with correct HTTP status codes.
34
+ - **Data Protection (No Sensitive Leakage)**: Never log unmasked API tokens, database credentials, or PII (Personally Identifiable Information).
30
35
  - Maintain strict backward compatibility.
31
- - Ensure all inputs are validated on the server.
32
36
  - Do not claim execution without evidence.
33
37
 
34
38
  ## Allowed tools
35
39
  - edit backend code
36
40
  - execute backend test suites
37
41
  - inspect DB schemas
42
+ - execute security scanner/linter
38
43
 
39
44
  ## Forbidden actions
40
- - executing direct raw database queries without validation
41
- - exposing sensitive env keys in error messages
45
+ - executing raw concatenated database queries
46
+ - exposing sensitive env keys or system stack traces in error messages
47
+ - bypassing server-side validation for internal calls
42
48
 
43
49
  ## Procedure
44
- 1. Review database schema and routing configurations.
45
- 2. Implement backend logic with robust input validation.
46
- 3. Write comprehensive unit and integration tests.
47
- 4. Run validation suite and verify logic.
50
+ 1. **Analyze Schema & Payload**: Review database schema and define explicit validation schemas for the expected endpoint inputs.
51
+ 2. **Setup Global Error Gates**: Wrap the logic in try-catch layers and integrate with global error capture mechanisms.
52
+ 3. **Implement Query Parameterization**: Write secure database interactions ensuring no raw string concatenation is used.
53
+ 4. **Implement Validations**: Inject payload validators before executing domain logic.
54
+ 5. **Write Boundary Test Cases**: Add test suites covering invalid types, missing keys, boundary lengths, and SQL injection payloads.
55
+ 6. **Run Valitators**: Execute backend test suites and check test coverage metrics.
48
56
 
49
57
  ## Expected output schema
50
58
  Output must include:
@@ -27,24 +27,31 @@ Do not trust:
27
27
  - Staging parameters
28
28
 
29
29
  ## Constraints
30
+ - **Rollback Strategy Requirements**: Every deployment plan must include a defined, automated, and pre-verified rollback routine to recover from failures.
31
+ - **Post-Deploy Smoke Tests**: Mandatory end-to-end integration and smoke tests must run on the target staging/production environment immediately following deployment.
32
+ - **Target Parameter Validation**: Validate target environment configuration structures (ports, SSL certificates, schema availability) before beginning the deployment process.
33
+ - **Zero Secrets Leakage**: Never print or leak unmasked private keys, API secrets, or passwords into logs or deployment consoles.
30
34
  - Never deploy unvalidated code.
31
- - Ensure all env configurations match specs.
32
35
  - Do not claim execution without evidence.
33
36
 
34
37
  ## Allowed tools
35
38
  - check environment
36
39
  - run smoke tests
37
40
  - read config files
41
+ - execute deployment pipelines
42
+ - run rollback automation scripts
38
43
 
39
44
  ## Forbidden actions
40
45
  - deploying directly to production without staging validation
41
46
  - exposing private keys in logs
47
+ - bypassing rollback dry-run validations
42
48
 
43
49
  ## Procedure
44
- 1. Validate target environment config.
45
- 2. Run pre-deploy verification scripts.
46
- 3. Execute deployment sequence.
47
- 4. Run post-deploy smoke tests.
50
+ 1. **Pre-Deploy Auditing**: Validate configurations and confirm target environment availability.
51
+ 2. **Rollback Verification**: Verify the rollback automation script configuration and steps.
52
+ 3. **Execute Deployment**: Run the standard deployment pipeline steps.
53
+ 4. **Post-Deploy Smoke Testing**: Execute automated E2E api/smoke test suites against the newly deployed environment.
54
+ 5. **Verify and Mask Logs**: Check logs for successful outcome and verify no credentials have leaked.
48
55
 
49
56
  ## Expected output schema
50
57
  Output must include:
@@ -27,6 +27,8 @@ Do not trust:
27
27
  - Architectural constraint
28
28
 
29
29
  ## Constraints
30
+ - **Low Coupling & High Cohesion**: Enforce modular separations. Components must have a single, well-defined responsibility, and dependencies between modules must be mediated through clean abstractions or interfaces.
31
+ - **Dependency Inversion Enforcement**: Domain logic must never depend directly on infrastructure, database adapters, or external APIs; all such dependencies must be inverted and injected.
30
32
  - Do not over-engineer solutions.
31
33
  - Keep complexity minimal.
32
34
  - Do not claim execution without evidence.
@@ -35,15 +37,18 @@ Do not trust:
35
37
  - review code
36
38
  - design structure
37
39
  - suggest refactoring patterns
40
+ - audit dependency coupling
38
41
 
39
42
  ## Forbidden actions
40
43
  - violating DRY or SOLID principles without explicit documented reason
41
44
  - using complex patterns where simple logic is sufficient
45
+ - introducing cyclic package dependencies or direct architectural leaks between distinct layers
42
46
 
43
47
  ## Procedure
44
- 1. Review code structures for design smells.
45
- 2. Apply refactoring patterns to simplify.
46
- 3. Document design trade-offs.
48
+ 1. Review code structures for design smells, high coupling, or low cohesion.
49
+ 2. Verify dependency inversion patterns across infrastructure and domain layers.
50
+ 3. Apply refactoring patterns to simplify and decoupled components.
51
+ 4. Document design trade-offs.
47
52
 
48
53
  ## Expected output schema
49
54
  Output must include:
@@ -27,6 +27,8 @@ Do not trust:
27
27
  - target file paths
28
28
 
29
29
  ## Constraints
30
+ - **Canonical Reference Policy**: Keep documentation DRY. Refer to central policies, guidelines, and definitions (e.g., `AGENTS.md`, `SKILLS_COMMON_GOVERNANCE.md`) via links instead of duplicating dynamic content.
31
+ - **Strict Path Validation**: All internal links must use relative file paths or absolute `file:///` protocols that resolve correctly in standard environments. Never use broken local links or absolute web links to local targets.
30
32
  - Ensure all markdown links are valid.
31
33
  - Avoid all generic placeholders.
32
34
  - Do not claim execution without evidence.
@@ -35,16 +37,19 @@ Do not trust:
35
37
  - write markdown files
36
38
  - execute link validation commands
37
39
  - check formatting lint
40
+ - verify path references
38
41
 
39
42
  ## Forbidden actions
40
43
  - leaving incomplete placeholder pages
41
44
  - writing broken markdown syntax
45
+ - committing documentation referencing obsolete code, functions, or branches
46
+ - using unverified paths that fail in validation checks
42
47
 
43
48
  ## Procedure
44
- 1. Identify target audience and scope of documentation.
49
+ 1. Identify target audience, scope, and canonical reference opportunities.
45
50
  2. Write clear, structured markdown content.
46
- 3. Verify all file and external links are valid.
47
- 4. Run markdown lint validator.
51
+ 3. Verify all internal file paths and external links are valid.
52
+ 4. Run link and markdown lint validators to verify documentation health.
48
53
 
49
54
  ## Expected output schema
50
55
  Output must include:
@@ -27,6 +27,9 @@ Do not trust:
27
27
  - Mockup data
28
28
 
29
29
  ## Constraints
30
+ - **Bundle and Asset Size Limits**: Every component modification must respect performance budgets: individual bundle chunks should stay under 50KB gzipped, and static assets (images, web fonts) must be compressed and optimized.
31
+ - **Strict Reactivity & Cleanup**: Ensure clean lifecycle management. All timers, observers, event listeners, and subscriptions must be explicitly cleared or unsubscribed when a component unmounts to prevent memory leaks.
32
+ - **Explicit Error Boundaries**: Guard complex or dynamic sub-views with UI Error Boundaries to prevent a local runtime exception from crashing the entire application shell.
30
33
  - Follow accessibility (WCAG/ARIA) guidelines.
31
34
  - Support responsive layouts.
32
35
  - Deliver UI/frontend artifacts native to the detected or specified project stack (using framework-native or stack-native architectures like React, Vue, Nuxt, WordPress PHP, etc. rather than standalone HTML/JS files) unless explicitly specified otherwise.
@@ -36,16 +39,22 @@ Do not trust:
36
39
  - edit frontend code
37
40
  - execute visual tests
38
41
  - run linter
42
+ - audit bundle sizes
43
+ - inspect component lifecycle events
39
44
 
40
45
  ## Forbidden actions
41
46
  - using non-standard styling tokens
42
47
  - committing undocumented state logic
48
+ - deploying active components that lack cleanup logic for asynchronous events or event listeners
49
+ - ignoring Cumulative Layout Shift (CLS) by omitting image/iframe dimensions (`width`/`height` or aspect-ratio)
50
+ - using inline styling overrides that bypass CSS variables or global design system sheets
43
51
 
44
52
  ## Procedure
45
- 1. Analyze UI mockup and component hierarchy.
53
+ 1. Analyze UI mockup, component hierarchy, and target performance budgets.
46
54
  2. Implement components using strict design spacing tokens.
47
- 3. Add ARIA accessibility attributes.
48
- 4. Run frontend tests and verify visuals.
55
+ 3. Add ARIA accessibility attributes and wrap dynamic blocks in error boundary logic.
56
+ 4. Verify lifecycle cleanup patterns (destroy/unmount handlers).
57
+ 5. Run frontend tests, bundle size audits, and verify visuals.
49
58
 
50
59
  ## Expected output schema
51
60
  Output must include:
@@ -27,6 +27,9 @@ Do not trust:
27
27
  - UI mockup specifications
28
28
 
29
29
  ## Constraints
30
+ - **Dual-Layer Validation Contract**: Always validate request/response payloads at both the frontend (client-side interactive validation and UX feedback) and backend (controller-level schemas, DTOs, or database constraint checks) boundaries.
31
+ - **Database Migration Verification**: Any database schema change must be accompanied by an automated up/down migration script, verified locally against a clean database instance before applying UI changes.
32
+ - **API Version Compatibility**: Maintain backward compatibility for existing endpoints or use explicit version routing (e.g. `/api/v1/...`) to avoid breaking active client sessions during deployment transitions.
30
33
  - Ensure API consistency.
31
34
  - Maintain data validation on both client and server.
32
35
  - Do not claim execution without evidence.
@@ -35,16 +38,21 @@ Do not trust:
35
38
  - edit frontend/backend files
36
39
  - execute integration tests
37
40
  - validate schema files
41
+ - run database migrations dry-run
42
+ - trace API payloads
38
43
 
39
44
  ## Forbidden actions
40
45
  - committing client-side code without corresponding API updates
41
46
  - leaving endpoints unprotected
47
+ - deploying database changes without matching migration rollback strategies
48
+ - exposing internal database IDs or detailed raw server stack traces to the client
42
49
 
43
50
  ## Procedure
44
- 1. Define API contract between frontend and backend.
45
- 2. Implement backend database schema, API logic, and tests.
46
- 3. Implement frontend UI components consuming the API.
47
- 4. Run full-stack integration tests.
51
+ 1. Define API contract between frontend and backend (endpoints, payload schemas, authorization).
52
+ 2. Implement backend database schema, migration scripts, API logic, and validation tests.
53
+ 3. Execute dry-run migrations and verify rollback capability.
54
+ 4. Implement frontend UI components consuming the API with client-side validation mapping to API error structures.
55
+ 5. Run full-stack integration and end-to-end tests.
48
56
 
49
57
  ## Expected output schema
50
58
  Output must include:
@@ -27,6 +27,8 @@ Do not trust:
27
27
  - Log configurations
28
28
 
29
29
  ## Constraints
30
+ - **Minimal-Context Principle**: Always prioritize the removal of redundant logs, unused caches, and duplicate entries to maintain the leanest possible workspace context window.
31
+ - **Audit Ledger Preservation**: Never truncate, delete, or modify structural security files, signature records, or ledger transaction evidence.
30
32
  - Do not delete critical history or validation evidence.
31
33
  - Maintain safety log records.
32
34
  - Do not claim execution without evidence.
@@ -35,16 +37,19 @@ Do not trust:
35
37
  - analyze files
36
38
  - run cleanup commands
37
39
  - measure token usage
40
+ - estimate token budgets
38
41
 
39
42
  ## Forbidden actions
40
43
  - deleting active source code
41
44
  - truncating ledger evidence files
45
+ - ignoring predefined prompt token thresholds by introducing overly verbose code examples in instructions
42
46
 
43
47
  ## Procedure
44
- 1. Scan context files for redundant logs or temp files.
45
- 2. Identify large files that can be compacted or truncated.
46
- 3. Clean up build artifacts and caches.
47
- 4. Generate context compression report.
48
+ 1. Scan context files for redundant logs, temporary artifacts, and expired caches.
49
+ 2. Identify large markdown or specification files that can be split, optimized, or referenced externally.
50
+ 3. Run token counter estimates to ensure targets are within prompt size budgets.
51
+ 4. Clean up build artifacts and caches safely.
52
+ 5. Generate a context compression report detailing before and after token values.
48
53
 
49
54
  ## Expected output schema
50
55
  Output must include:
@@ -27,7 +27,10 @@ Do not trust:
27
27
  - Changed files list
28
28
 
29
29
  ## Constraints
30
- - Keep PRs small and highly focused.
30
+ - **Conventional Commits**: All commit messages must strictly adhere to the Conventional Commits specification (e.g. `feat(core): message`, `fix(cli): message`, `docs(skills): message`).
31
+ - **PR Size Limits (Incremental Delivery)**: Pull requests must be highly targeted and minimal. Changes exceeding a reasonable line-count limit (e.g., 500 lines of code) must be split into multiple scoped branches.
32
+ - **Dirty State Preservation**: Preserve unrelated local uncommitted files or dirty states. Never wipe unrelated local modifications during branch checkouts.
33
+ - **Task Traceability**: Reference the task slug or ticket ID in branch names and commit descriptions.
31
34
  - Never write directly to protected main/master branches.
32
35
  - Do not claim execution without evidence.
33
36
 
@@ -36,16 +39,20 @@ Do not trust:
36
39
  - commit files
37
40
  - run validation suite
38
41
  - generate handoff reports
42
+ - git diff and status tools
39
43
 
40
44
  ## Forbidden actions
41
45
  - merging pull requests with failing validations
42
46
  - force pushing to main/master
47
+ - committing unrelated changes to the same feature branch
48
+ - writing generic or opaque commit messages (e.g., "fix code", "update")
43
49
 
44
50
  ## Procedure
45
- 1. Create a scoped feature branch from main.
46
- 2. Apply changes incrementally in small commits.
47
- 3. Run validation scripts on the branch.
48
- 4. Produce handoff documentation summarizing the change.
51
+ 1. **Assess Git Working Tree**: Run `git status` to identify and protect any existing unrelated dirty work.
52
+ 2. **Branch Creation**: Create a scoped feature branch containing the task slug/ID from the clean head.
53
+ 3. **Incremental Staging & Commits**: Group edits logically. Write clear, Conventional Commit messages for each change.
54
+ 4. **Local Validation**: Run the branch validation pipelines before staging completion.
55
+ 5. **Handoff Generation**: Generate standard handoff ledgers detailing branch, changes, validations, and limitations.
49
56
 
50
57
  ## Expected output schema
51
58
  Output must include:
@@ -30,6 +30,8 @@ Do not trust:
30
30
  - Target framework parameters
31
31
 
32
32
  ## Constraints
33
+ - **Non-Destructive Execution**: Under no circumstances should discovery operations mutate, rewrite, or delete workspace files, permissions, or git tags. All file access must be strictly read-only.
34
+ - **Validation Routine Discovery**: Locate and map every local testing and validation command available. Verify their presence and executable health via safe dry-runs or status checks without writing changes.
33
35
  - Do not mutate files in discovery mode.
34
36
  - Do not bypass branch gate.
35
37
  - Do not claim execution without evidence.
@@ -40,6 +42,7 @@ Do not trust:
40
42
  - inspect package metadata
41
43
  - run safe validation commands
42
44
  - generate structured report
45
+ - query git status and logs
43
46
 
44
47
  ## Forbidden actions
45
48
  - git push
@@ -48,14 +51,15 @@ Do not trust:
48
51
  - gh release create
49
52
  - writing directly to main
50
53
  - editing files
54
+ - proposing solutions that bypass local safety gates or skip required validation checks
51
55
 
52
56
  ## Procedure
53
- 1. Inspect package.json and lock files to identify project type and stack.
54
- 2. Map key entry points, source directories, and configuration files.
55
- 3. Identify all package scripts and validation commands.
56
- 4. Check for existing documentation and generated files.
57
- 5. Audit code and configurations for risk areas and missing validation checks.
58
- 6. Synthesize findings into the discovery report.
57
+ 1. Inspect package.json, lock files, and build setups to identify project type and technical stack.
58
+ 2. Map key entry points, source directories, configuration folders, and dependency chains.
59
+ 3. Identify and document all package scripts, validation tools, and E2E testing commands.
60
+ 4. Check for existing technical documentation, policies, and generated configuration files.
61
+ 5. Audit codebase files for risks, outdated dependencies, and missing local verification gates.
62
+ 6. Synthesize discovery findings into the final project structure report.
59
63
 
60
64
  ## Expected output schema
61
65
  Output must include:
@@ -27,6 +27,8 @@ Do not trust:
27
27
  - Target milestone dates
28
28
 
29
29
  ## Constraints
30
+ - **Sprint Scope Containment**: Under no circumstances should unplanned feature requests or cosmetic modifications be injected into an active sprint backlog without formal impact analysis and stakeholder approval.
31
+ - **Explicit Definition of Done (DoD)**: Every planning requirement must specify an explicit, automated verification method (e.g., test cases, compliance script exit codes) before being cataloged as planned.
30
32
  - Maintain product scope boundaries.
31
33
  - Ensure all requirements have clear acceptance criteria.
32
34
  - Do not claim execution without evidence.
@@ -35,16 +37,18 @@ Do not trust:
35
37
  - read roadmap
36
38
  - create requirement files
37
39
  - define acceptance criteria
40
+ - construct prioritization matrices
38
41
 
39
42
  ## Forbidden actions
40
43
  - adding unapproved features to active Sprint scope
41
44
  - bypassing design guidelines
45
+ - declaring milestones without explicit validation gates
42
46
 
43
47
  ## Procedure
44
- 1. Review raw feedback and feature requests.
45
- 2. Formulate target requirements and milestones.
46
- 3. Categorize features by priority and impact.
47
- 4. Define acceptance criteria for requirements.
48
+ 1. Review raw user feedback, bug reports, and roadmap specifications.
49
+ 2. Construct feature priority matrices using defined impact and complexity scores.
50
+ 3. Formulate target requirements, milestone timelines, and dependency mappings.
51
+ 4. Define concrete acceptance criteria and verify their alignment with the project's Definition of Done (DoD).
48
52
 
49
53
  ## Expected output schema
50
54
  Output must include:
@@ -27,6 +27,9 @@ Do not trust:
27
27
  - Project memory request
28
28
 
29
29
  ## Constraints
30
+ - **Structured ADR Formatting**: Architecture Decision Records (ADRs) must follow a strict format (Context, Decision, Consequences, Status: Proposed/Accepted/Deprecated/Superseded).
31
+ - **Anti-Regression Correction Logging**: Record lessons learned from past failures, E2E errors, and quality gate rejections to prevent future agents from repeating them.
32
+ - **Discoverable Rules Enforcement**: Align memory additions with `.agents/config` or workspace rules files so future agents load this context at session start.
30
33
  - Never delete history of past corrections.
31
34
  - Keep memory entries concise and discoverable.
32
35
  - Do not claim execution without evidence.
@@ -35,15 +38,20 @@ Do not trust:
35
38
  - read/write memory files
36
39
  - update ADR logs
37
40
  - check formatting
41
+ - run schema linter
42
+ - search git history
38
43
 
39
44
  ## Forbidden actions
40
45
  - editing memory files with unverified details
41
46
  - force overwriting active config files
47
+ - omitting consequences or context from decision logs
42
48
 
43
49
  ## Procedure
44
- 1. Capture new project decision or lessons learned.
45
- 2. Update project-memory.md or configuration details.
46
- 3. Ensure guidelines are discoverable by future agents.
50
+ 1. **Analyze Decision/Incident**: Map the new architectural decision, correction, or lesson learned from recent tests/incidents.
51
+ 2. **Format as ADR**: Structure the decision in the standard ADR format.
52
+ 3. **Register Anti-Regression Context**: Log past failures and their corrections in the historical ledger.
53
+ 4. **Enforce Discoverability**: Reference or link the new rule/memory block inside the workspace rules (`AGENTS.md` or `.agents/config`).
54
+ 5. **Verify Formatting & Schemas**: Run schema linting tools to guarantee memory configuration integrity.
47
55
 
48
56
  ## Expected output schema
49
57
  Output must include:
@@ -27,6 +27,8 @@ Do not trust:
27
27
  - Execution transcript
28
28
 
29
29
  ## Constraints
30
+ - **Security & Injection Auditing**: All system instructions and custom prompt configurations must be audited against prompt injection vulnerabilities and instructions leakage before deployment.
31
+ - **Predictable Token Footprint**: Optimize instruction syntax to avoid boilerplate, maintaining crisp, actionable clauses (ideally under 500 lines or token budget limits) to preserve workspace context.
30
32
  - Maintain strict behavioral boundaries.
31
33
  - Ensure prompts are deterministic.
32
34
  - Do not claim execution without evidence.
@@ -35,15 +37,18 @@ Do not trust:
35
37
  - design prompts
36
38
  - review system instructions
37
39
  - analyze transcripts
40
+ - test prompt resilience
38
41
 
39
42
  ## Forbidden actions
40
43
  - altering core agent identities
41
44
  - injecting instructions that bypass safety gates
45
+ - introducing conflicting or overlapping constraints that cause agent non-determinism
42
46
 
43
47
  ## Procedure
44
- 1. Analyze prompt failure or improvement area.
45
- 2. Draft clear, structured system instructions.
46
- 3. Test prompt under multiple edge cases.
48
+ 1. Analyze prompt execution failures, non-deterministic behaviors, or improvement areas.
49
+ 2. Draft clear, structured system instructions containing specific constraints and allowed tools.
50
+ 3. Run resilience tests against potential prompt injection scenarios.
51
+ 4. Perform token economy checks to verify prompt length fits within limits.
47
52
 
48
53
  ## Expected output schema
49
54
  Output must include:
@@ -29,6 +29,10 @@ Do not trust:
29
29
  - Codebase paths
30
30
 
31
31
  ## Constraints
32
+ - **Visual & Accessibility (A11y) Gates**: If changes affect frontend UIs, automated visual regression (screenshots) and accessibility (Axe-core via Playwright) checks must be executed.
33
+ - **Mock Safety & Boundary Containment**: Forbid testing dependencies on active production environments or unmocked third-party APIs. Sandbox external calls using mock fixtures.
34
+ - **Coverage Maintenance**: Test coverage metrics must not decrease after the implementation of new features. Any new code block must be covered by unit or E2E tests.
35
+ - **Regression Testing**: Every bug fix or issue resolution must be accompanied by a failing test case that proves the fix is operational (regression test).
32
36
  - All validation commands must exit 0.
33
37
  - No manual test overrides allowed.
34
38
  - Do not claim execution without evidence.
@@ -38,20 +42,21 @@ Do not trust:
38
42
  - execute test suites
39
43
  - analyze coverage
40
44
  - run linter
45
+ - execute Axe-core accessibility scanners
46
+ - run visual screenshot tools
41
47
 
42
48
  ## Forbidden actions
43
- - git push
44
- - git tag
45
- - npm publish
46
49
  - bypassing quality gates
50
+ - using manual assertions as substitutes for automated test execution
51
+ - hardcoding local file system paths inside test assertions
47
52
 
48
53
  ## Procedure
49
- 1. Identify all changed files and classify risk level.
50
- 2. Determine appropriate test strategy (unit, E2E, integration).
51
- 3. Run relevant validation commands.
52
- 4. Capture command outputs, exit codes, and coverage metrics.
53
- 5. Document all findings and failures.
54
- 6. Evaluate overall quality against the quality gate.
54
+ 1. **Analyze Diff & Identify Risks**: Inspect the modified files, classify the risk level, and identify frontend vs backend boundaries.
55
+ 2. **Select Testing Strategy**: Choose the correct blend of unit tests, API integration tests, visual regression tests, and accessibility scans.
56
+ 3. **Inject Mock Fixtures**: Prepare mocks for any database, network, or external API interaction.
57
+ 4. **Execute Tests & Linters**: Run the appropriate linting, styling, and test runner commands.
58
+ 5. **Inspect Coverage & UI Outputs**: Analyze code coverage reports, visual diffs, and Axe-core accessibility violation reports.
59
+ 6. **Compile Validation Ledger**: Document exit codes, coverage deltas, screenshot locations, and final decision (PASS, PASS_WITH_NOTES, BLOCKED).
55
60
 
56
61
  ## Expected output schema
57
62
  Output must include:
@@ -29,6 +29,9 @@ Do not trust:
29
29
  - File paths
30
30
 
31
31
  ## Constraints
32
+ - **Least-Diff Principle**: Make the smallest possible code changes (minimum lines modified) to achieve the structural improvement or fix. Avoid refactoring unrelated code blocks or cosmetic changes.
33
+ - **Pre-Refactor Snapshot validation**: Execute a local baseline test run to verify the workspace is functional before applying any structural refactoring.
34
+ - **No Signature Mutation**: Do not alter public API structures, function signatures, exported types, or database schemas during refactoring unless explicitly required to resolve the issue.
32
35
  - Ensure all tests pass.
33
36
  - Do not introduce new features during refactoring or fixing.
34
37
  - Do not claim execution without evidence.
@@ -37,20 +40,24 @@ Do not trust:
37
40
  - edit code files
38
41
  - run validation commands
39
42
  - run linter
43
+ - profile performance impact
40
44
 
41
45
  ## Forbidden actions
42
46
  - git push
43
47
  - git tag
44
48
  - npm publish
45
49
  - editing files outside allowed scope
50
+ - applying speculative optimization patterns without performance profiles or profiling data
51
+ - modifying unrelated healthy components or styling variables
46
52
 
47
53
  ## Procedure
48
54
  1. Require a concrete finding or failing test before starting.
49
- 2. Investigate the root cause of the issue.
50
- 3. Design a bounded fix targeting only the affected area.
51
- 4. Apply the change to allowed files.
52
- 5. Run revalidation commands to verify the fix.
53
- 6. Limit remediation to a maximum of 3 attempts before blocking.
55
+ 2. Run a baseline execution of the validation/test suite.
56
+ 3. Investigate the root cause of the issue.
57
+ 4. Design a bounded fix using the Least-Diff Principle targeting only the affected area.
58
+ 5. Apply the change to allowed files.
59
+ 6. Run revalidation commands to verify the fix.
60
+ 7. Limit remediation to a maximum of 3 attempts before blocking.
54
61
 
55
62
  ## Expected output schema
56
63
  Output must include:
@@ -28,6 +28,9 @@ Do not trust:
28
28
  - Release parameters
29
29
 
30
30
  ## Constraints
31
+ - **NPM Package Verification Gate**: Before final release approval, the generated package tarball must be built, packaged, and verified locally by running installation tests (`npm install <tarball>`) in a temporary sandbox.
32
+ - **SemVer Conformity Check**: Enforce strict Semantic Versioning. Bumping of major, minor, or patch versions must directly correspond to API-breaking changes, new non-breaking features, or bug fixes, respectively.
33
+ - **Unlinked Draft Prevention**: Ensure that release tags or release attempts are linked only to commits that have successfully completed building and testing in the target branch.
31
34
  - Explicit user approval required.
32
35
  - Do not publish to npm, push to remote, or create tags without approval.
33
36
  - Do not claim execution without evidence.
@@ -37,20 +40,23 @@ Do not trust:
37
40
  - update version files
38
41
  - generate changelog
39
42
  - calculate sha256 checksum
43
+ - run sandbox installation checks
40
44
 
41
45
  ## Forbidden actions
42
46
  - npm publish without approval
43
47
  - git push without approval
44
48
  - git tag without approval
45
49
  - gh release create without approval
50
+ - publishing with local/untracked source file leaks or untested dependency variants
46
51
 
47
52
  ## Procedure
48
53
  1. Perform version check against remote/registry state.
49
54
  2. Ensure working tree is completely clean.
50
55
  3. Run full release verification suite.
51
- 4. Record tarball filename and compute its SHA-256 hash.
52
- 5. Update package version and CHANGELOG.md.
53
- 6. Document release evidence.
56
+ 4. Build the package tarball and execute a sandbox installation check.
57
+ 5. Record tarball filename and compute its SHA-256 hash.
58
+ 6. Update package version and CHANGELOG.md.
59
+ 7. Document release evidence.
54
60
 
55
61
  ## Expected output schema
56
62
  Output must include:
@@ -28,6 +28,8 @@ Do not trust:
28
28
  - Target specifications template
29
29
 
30
30
  ## Constraints
31
+ - **Atomic Verification Criteria**: Every acceptance criterion in the specification must map to a distinct, automated verification method (unit test, integration test, visual snapshot, or compilation validation). Avoid vague or qualitative assertions.
32
+ - **Traceability Matrix**: Every requirement must explicitly link back to a business goal or user request and point forward to its corresponding test case or validation check.
31
33
  - Specs must be testable.
32
34
  - Non-goals must be explicitly defined.
33
35
  - No code changes allowed in spec phase.
@@ -37,6 +39,7 @@ Do not trust:
37
39
  - read requirements
38
40
  - write specification files
39
41
  - validate schema compliance
42
+ - map requirements matrix
40
43
 
41
44
  ## Forbidden actions
42
45
  - git push
@@ -44,16 +47,18 @@ Do not trust:
44
47
  - npm publish
45
48
  - gh release create
46
49
  - modifying source code files
50
+ - creating ambiguous acceptance criteria (e.g., "should feel fast" or "should be easy to use")
47
51
 
48
52
  ## Procedure
49
53
  1. Read and analyze the requirement document.
50
54
  2. Define the problem statement and scope of work.
51
55
  3. List explicit non-goals to prevent scope creep.
52
56
  4. Formulate functional and technical requirements.
53
- 5. Create acceptance criteria for each requirement.
54
- 6. Design a validation and test plan.
55
- 7. Outline the implementation plan step-by-step.
56
- 8. Define verification evidence and PASS/BLOCKED criteria.
57
+ 5. Create acceptance criteria for each requirement, ensuring they are concrete and measurable.
58
+ 6. Design a validation and test plan specifying the automated tools to verify each requirement.
59
+ 7. Build a requirements traceability matrix mapping source requests to specification sections and verification methods.
60
+ 8. Outline the implementation plan step-by-step.
61
+ 9. Define verification evidence and PASS/BLOCKED criteria.
57
62
 
58
63
  ## Expected output schema
59
64
  Output must include:
@@ -27,6 +27,9 @@ Do not trust:
27
27
  - Stack criteria
28
28
 
29
29
  ## Constraints
30
+ - **Anti-Over-Engineering Principle**: Choose the simplest technology stack that solves the problem. Enforce the use of platform-native APIs (e.g. Node.js native fs/promises, crypto, fetch) instead of adding external dependencies whenever possible.
31
+ - **Strict Dependency Control**: Reject proposals that introduce redundant or overlapping npm packages (such as importing multiple utility, HTTP, or parser libraries).
32
+ - **Performance-Complexity Auditing**: Analyze the resource footprint (bundle size, startup latency, CPU overhead) of any library proposal before approval.
30
33
  - Ensure stack scalability.
31
34
  - Enforce strict maintainability guidelines.
32
35
  - Do not claim execution without evidence.
@@ -35,15 +38,19 @@ Do not trust:
35
38
  - review design proposals
36
39
  - run stack analysis
37
40
  - evaluate architectural trade-offs
41
+ - inspect package dependency graphs
42
+ - run bundle size analyzers
38
43
 
39
44
  ## Forbidden actions
40
- - adopting experimental tools without staging validation
41
- - introducing conflicting dependencies
45
+ - adopting experimental or unmaintained dependencies
46
+ - introducing redundant libraries that duplicate native capabilities
47
+ - approving designs without documented alternatives and trade-offs
42
48
 
43
49
  ## Procedure
44
- 1. Review architectural or design proposals.
45
- 2. Evaluate trade-offs (performance, cost, security).
46
- 3. Approve technical plan or recommend adjustments.
50
+ 1. **Verify Native Alternatives**: Assess if the requirement can be resolved using built-in runtime features.
51
+ 2. **Audit Dependencies**: Review the package graph to ensure no redundant or overlapping modules are introduced.
52
+ 3. **Evaluate Trade-offs**: Measure implementation speed and developer maintenance cost against runtime footprint and bundle size impact.
53
+ 4. **Approve and Document**: Deliver the final design approval along with a scalability assessment and architectural compromise details.
47
54
 
48
55
  ## Expected output schema
49
56
  Output must include:
@@ -27,6 +27,9 @@ Do not trust:
27
27
  - Design feedback
28
28
 
29
29
  ## Constraints
30
+ - **State-Completeness Enforcement**: Every interactive component and view must define styles and transitions for all execution states: Initializing, Loading, Empty, Error, and Success.
31
+ - **Strict Typography Ratio**: All text styles must use proportional line-heights matching their function: 1.1–1.25 for headings and titles, and 1.5–1.7 for body text and long-form descriptions.
32
+ - **Rigid 8px Layout Grid**: Spacing, margins, paddings, and structural sizing must align strictly to the 8px grid system (allowable steps: 4px for fine adjustments, 8px, 16px, 24px, 32px, 48px, 64px, 96px).
30
33
  - Follow strict contrast and accessibility (WCAG) guidelines.
31
34
  - Spacing must align with layout grids.
32
35
  - Do not claim execution without evidence.
@@ -35,15 +38,20 @@ Do not trust:
35
38
  - review layouts
36
39
  - verify visual styles
37
40
  - check accessibility contrast
41
+ - audit state completeness
42
+ - inspect typography line-heights
38
43
 
39
44
  ## Forbidden actions
40
45
  - using non-standard styling tokens
41
46
  - committing inconsistent layouts
47
+ - introducing components lacking complete lifecycle states (loading/error/empty)
48
+ - using arbitrary spacing or padding values outside the 8px grid
42
49
 
43
50
  ## Procedure
44
51
  1. Review wireframe or layout for design inconsistencies.
45
- 2. Align elements with standard typography and spacing tokens.
52
+ 2. Align elements with standard typography and spacing tokens, checking that line-heights match headings (1.1–1.25) or body (1.5–1.7) criteria.
46
53
  3. Validate contrast ratios and accessibility parameters.
54
+ 4. Verify that all lifecycle/feedback states (Initializing, Loading, Empty, Error, Success) are covered with consistent visual cues.
47
55
 
48
56
  ## Expected output schema
49
57
  Output must include:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williambeto/ai-workflow",
3
- "version": "2.4.2",
3
+ "version": "2.4.5",
4
4
  "description": "AI Workflow Kit — OpenCode-first software delivery workflow with agents, commands, skills, validation, and evidence",
5
5
  "license": "MIT",
6
6
  "author": "José Willams",
package/src/cli.js CHANGED
@@ -4,6 +4,7 @@ import { runDoctor } from "./commands/doctor.js";
4
4
  import { runCollectEvidence } from "./commands/collect-evidence.js";
5
5
  import { runMasterOrchestrator } from "./commands/run.js";
6
6
  import { runExecute } from "./commands/execute.js";
7
+ import { runClean } from "./commands/clean.js";
7
8
 
8
9
  function printHelp() {
9
10
  console.log(`ai-workflow
@@ -15,6 +16,7 @@ Usage:
15
16
  ai-workflow validate [--a11y] [--visual-dist=<path>] [--port=<port>]
16
17
  ai-workflow collect-evidence [--task=<slug>] [--mode=<quick|standard|full>] [--dry-run] [--visual-dist=<path>] [--port=<port>]
17
18
  ai-workflow doctor
19
+ ai-workflow clean [--yes] [--dry-run] [--purge-agents]
18
20
 
19
21
  Commands:
20
22
  execute Orchestrate execution of a natural request through the state machine
@@ -22,6 +24,7 @@ Commands:
22
24
  init Install AI workflow defaults (OpenCode). --profile=standard (default) or --profile=full (adds examples)
23
25
  collect-evidence Run observed project validation; persists EVIDENCE.json only for full mode
24
26
  doctor Verify local ai-workflow installation
27
+ clean De-initialize and remove AI Workflow files and symlinks from the project
25
28
  `);
26
29
  }
27
30
 
@@ -58,7 +61,8 @@ function parseFlags(args) {
58
61
  request: requestArg ? requestArg.replace("--request=", "") : undefined,
59
62
  visualDist: visualDistArg ? visualDistArg.replace("--visual-dist=", "") : undefined,
60
63
  port: portArg ? portArg.replace("--port=", "") : undefined,
61
- a11y: args.includes("--a11y")
64
+ a11y: args.includes("--a11y"),
65
+ purgeAgents: args.includes("--purge-agents") || args.includes("--purge")
62
66
  };
63
67
  }
64
68
 
@@ -139,5 +143,13 @@ export async function runCli(args) {
139
143
  return;
140
144
  }
141
145
 
146
+ if (command === "clean") {
147
+ await runClean({
148
+ cwd: process.cwd(),
149
+ ...parseFlags(args.slice(1))
150
+ });
151
+ return;
152
+ }
153
+
142
154
  throw new Error(`unknown command: ${command}`);
143
155
  }
@@ -0,0 +1,106 @@
1
+ import { existsSync, rmSync, lstatSync, unlinkSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import readline from "node:readline";
4
+
5
+ function askConfirmation(question) {
6
+ const rl = readline.createInterface({
7
+ input: process.stdin,
8
+ output: process.stdout
9
+ });
10
+ return new Promise((resolve) => {
11
+ rl.question(question, (answer) => {
12
+ rl.close();
13
+ resolve(answer.trim().toLowerCase());
14
+ });
15
+ });
16
+ }
17
+
18
+ function isSymlink(filePath) {
19
+ try {
20
+ return lstatSync(filePath).isSymbolicLink();
21
+ } catch (_) {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ export async function runClean({ cwd, yes = false, dryRun = false, purgeAgents = false }) {
27
+ const targets = [
28
+ ".ai-workflow",
29
+ "opencode.jsonc",
30
+ ".workflow-state.json",
31
+ "opencode"
32
+ ];
33
+
34
+ const hasAgents = existsSync(join(cwd, ".agents"));
35
+
36
+ // Check what actually exists
37
+ const existingTargets = targets
38
+ .map(name => join(cwd, name))
39
+ .filter(path => existsSync(path) || isSymlink(path));
40
+
41
+ if (existingTargets.length === 0 && (!hasAgents || !purgeAgents)) {
42
+ console.log("No AI Workflow configuration or files found in the current project.");
43
+ return;
44
+ }
45
+
46
+ console.log("\n[AI WORKFLOW] De-initialization");
47
+ console.log("===============================");
48
+
49
+ if (dryRun) {
50
+ console.log("[DRY RUN] The following items would be deleted:");
51
+ existingTargets.forEach(path => console.log(` - ${path}`));
52
+ if (hasAgents && purgeAgents) {
53
+ console.log(` - ${join(cwd, ".agents")} (customizations folder)`);
54
+ } else if (hasAgents) {
55
+ console.log(` - NOTE: ${join(cwd, ".agents")} exists but will NOT be deleted (run with --purge-agents to delete)`);
56
+ }
57
+ return;
58
+ }
59
+
60
+ // Interactive prompts if --yes / -y is not passed
61
+ if (!yes) {
62
+ if (!process.stdin.isTTY) {
63
+ console.log("Error: Non-interactive terminal detected. Run with --yes to bypass confirmation.");
64
+ if (process.env.NODE_ENV === "test") {
65
+ // Allow tests to bypass TTY block if they mock/stub process.stdin
66
+ } else {
67
+ process.exit(1);
68
+ }
69
+ }
70
+
71
+ const confirmDeinit = await askConfirmation("Are you sure you want to de-initialize AI Workflow from the project? [y/N] ");
72
+ if (confirmDeinit !== "y" && confirmDeinit !== "yes") {
73
+ console.log("Aborted.");
74
+ return;
75
+ }
76
+
77
+ if (hasAgents && !purgeAgents) {
78
+ const confirmPurge = await askConfirmation("A custom '.agents' folder was detected. Do you want to purge it (this deletes custom prompts/rules/skills)? [y/N] ");
79
+ if (confirmPurge === "y" || confirmPurge === "yes") {
80
+ purgeAgents = true;
81
+ }
82
+ }
83
+ }
84
+
85
+ // Add .agents if requested and exists
86
+ if (purgeAgents && hasAgents) {
87
+ existingTargets.push(join(cwd, ".agents"));
88
+ }
89
+
90
+ console.log("\nRemoving files...");
91
+ for (const target of existingTargets) {
92
+ try {
93
+ if (isSymlink(target)) {
94
+ unlinkSync(target);
95
+ console.log(`Deleted symlink: ${target}`);
96
+ } else {
97
+ rmSync(target, { recursive: true, force: true });
98
+ console.log(`Deleted directory/file: ${target}`);
99
+ }
100
+ } catch (error) {
101
+ console.error(`Failed to delete ${target}: ${error.message}`);
102
+ }
103
+ }
104
+
105
+ console.log("\nAI Workflow has been successfully removed from this project.");
106
+ }
@@ -392,19 +392,19 @@ export class ArtifactFidelityGate {
392
392
  }
393
393
  }
394
394
 
395
- // 1. Tokens CSS mínimos Check
395
+ // 1. Minimum CSS tokens check
396
396
  const hasRules = cssContentCombined.includes("{");
397
- const hasCssVars = /--[a-zA-Z0-9_-]+\s*:/g.test(cssContentCombined);
397
+ const hasCssVars = /(--[a-zA-Z0-9_-]+\s*:|var\(--[a-zA-Z0-9_-]+\))/g.test(cssContentCombined);
398
398
  if (hasRules && !hasCssVars) {
399
- violations.push("Fidelity Violation: Design System token mismatch. No CSS custom properties (variables) detected in changed UI stylesheets.");
399
+ violations.push("Fidelity Violation: Design System token mismatch. No CSS custom properties (variables) detected or used in changed UI stylesheets.");
400
400
  }
401
401
 
402
- // 2. Excesso de style="..."
402
+ // 2. Excessive style="..." inline styles check
403
403
  if (styleAttrsCount > 5) {
404
404
  violations.push(`Fidelity Violation: excessive inline styles detected (${styleAttrsCount} style="..." declarations). Use CSS classes or utility classes instead.`);
405
405
  }
406
406
 
407
- // 3. HTML principal tags semânticas básicas Check
407
+ // 3. Main HTML semantic tags check
408
408
  if (htmlContentCombined.length > 0) {
409
409
  const hasSemanticTags = /<(header|main|footer|nav|section)\b/i.test(htmlContentCombined);
410
410
  const hasH1 = /<h1\b/i.test(htmlContentCombined);