| name | validate-build |
| description | Validate a completed package against its spec. Checks patterns, types, exports, dependencies, and test coverage after building a package. |
| disable-model-invocation | true |
| argument-hint | <package-name> |
Validate Package: $ARGUMENTS
Run this checklist after building a package to ensure it conforms to the spec and project patterns.
1. Structure Check
Verify the package directory matches the spec's Package Structure section:
find packages/$ARGUMENTS/src -type f -name "*.ts" | sort
Compare the output against the file list in the spec. Every file listed in the spec must exist.
2. Dependency Check
Read packages/$ARGUMENTS/package.json and verify:
3. Pattern Compliance
Search the package source for anti-patterns:
grep -rn "throw new" packages/$ARGUMENTS/src/ || echo "✅ No throw"
grep -rn "^interface " packages/$ARGUMENTS/src/ | grep -v "Input\b" || echo "✅ No plain interfaces (note: interface is acceptable for strategy input types like ReactiveInput, PlanExecuteInput, etc. that carry Effect types)"
grep -rn "let " packages/$ARGUMENTS/src/ || echo "✅ No let declarations"
grep -rn "new Error" packages/$ARGUMENTS/src/ || echo "✅ No new Error"
grep -rn "await " packages/$ARGUMENTS/src/ || echo "✅ No raw await"
grep -rn "Promise<" packages/$ARGUMENTS/src/ | grep -v "runPromise\|test" || echo "✅ No raw Promises"
grep -rn "Schema.Struct" packages/$ARGUMENTS/src/ && echo "✅ Uses Schema.Struct"
grep -rn "Data.TaggedError" packages/$ARGUMENTS/src/ && echo "✅ Uses Data.TaggedError"
grep -rn "Context.Tag" packages/$ARGUMENTS/src/ && echo "✅ Uses Context.Tag"
grep -rn "Layer.effect\|Layer.scoped" packages/$ARGUMENTS/src/ && echo "✅ Uses Layer.effect/scoped"
grep -rn "Ref.make\|Ref.get\|Ref.update" packages/$ARGUMENTS/src/ && echo "✅ Uses Ref for state"
4. Kernel Extension Compliance (if package touches reasoning/kernel)
If changes are in packages/reasoning/src/kernel/, run:
grep -n "export const.*Phase" packages/reasoning/src/kernel/capabilities/ -r
grep -n "export const.*Guard\b" packages/reasoning/src/kernel/capabilities/act/guard.ts
grep -n "metaToolRegistry" packages/reasoning/src/kernel/ -r
FAIL if:
- A new phase function has a signature other than
(state: KernelState, context: KernelContext) => Effect<KernelState, never, LLMService>
- A guard returns anything other than
{ allow: true } or { block: true; reason: string }
kernel-runner.ts main loop was modified to add per-turn logic (use phases instead)
context-engine.ts dead sections (buildDynamicContext, buildStaticContext) were modified or re-enabled
Dead code areas — never touch:
buildDynamicContext / buildStaticContext in context-engine.ts (~560 LOC, disabled behind flag)
context-engine.ts dead text-assembly functions (~690 LOC total)
5. Service Verification
For every service in the package, verify:
6. Runtime Factory Check
Verify src/runtime.ts:
7. Index.ts Exports
Verify src/index.ts exports:
8. Test Coverage
Verify tests exist and pass:
bun test packages/$ARGUMENTS
Check:
9. TypeScript Compilation & Build
bun run --filter "@reactive-agents/$ARGUMENTS" typecheck
cd packages/$ARGUMENTS && bun run build
Both must complete with zero errors.
10. Dist Output Verification
After building, verify that dist/ contains the expected output:
ls packages/$ARGUMENTS/dist/
Check:
11. Spec Fidelity
Read through the spec one final time and verify:
12. Integration Points
If this package is consumed by others:
Report
After completing all checks, summarize:
- Number of checks passed / total
- Any issues found with specific file paths and line numbers
- Recommended fixes for any failures