@garethdaine/agentops 0.9.0

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 (148) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +410 -0
  4. package/agents/architecture-researcher.md +115 -0
  5. package/agents/code-critic.md +190 -0
  6. package/agents/delegation-router.md +40 -0
  7. package/agents/feature-researcher.md +117 -0
  8. package/agents/interrogator.md +11 -0
  9. package/agents/pitfalls-researcher.md +112 -0
  10. package/agents/plan-validator.md +173 -0
  11. package/agents/proposer.md +61 -0
  12. package/agents/security-reviewer.md +189 -0
  13. package/agents/skill-builder.md +43 -0
  14. package/agents/spec-compliance-reviewer.md +154 -0
  15. package/agents/stack-researcher.md +89 -0
  16. package/commands/build.md +766 -0
  17. package/commands/code-analysis.md +39 -0
  18. package/commands/code-field.md +22 -0
  19. package/commands/compliance-check.md +34 -0
  20. package/commands/configure.md +178 -0
  21. package/commands/cost-report.md +17 -0
  22. package/commands/enterprise/adr.md +78 -0
  23. package/commands/enterprise/brainstorm.md +461 -0
  24. package/commands/enterprise/design.md +203 -0
  25. package/commands/enterprise/dev-setup.md +136 -0
  26. package/commands/enterprise/docker-dev.md +229 -0
  27. package/commands/enterprise/e2e.md +233 -0
  28. package/commands/enterprise/feature.md +218 -0
  29. package/commands/enterprise/gap-analysis.md +204 -0
  30. package/commands/enterprise/handover.md +195 -0
  31. package/commands/enterprise/herd.md +152 -0
  32. package/commands/enterprise/knowledge.md +173 -0
  33. package/commands/enterprise/onboard.md +86 -0
  34. package/commands/enterprise/qa-check.md +80 -0
  35. package/commands/enterprise/reason.md +196 -0
  36. package/commands/enterprise/review.md +177 -0
  37. package/commands/enterprise/scaffold.md +153 -0
  38. package/commands/enterprise/status-report.md +101 -0
  39. package/commands/enterprise/tech-catalog.md +170 -0
  40. package/commands/enterprise/test-gen.md +138 -0
  41. package/commands/evolve.md +39 -0
  42. package/commands/flags.md +44 -0
  43. package/commands/interrogate.md +263 -0
  44. package/commands/lesson.md +15 -0
  45. package/commands/lessons.md +10 -0
  46. package/commands/plan.md +44 -0
  47. package/commands/prune.md +27 -0
  48. package/commands/star.md +17 -0
  49. package/commands/supply-chain-scan.md +44 -0
  50. package/commands/unicode-scan.md +63 -0
  51. package/commands/verify.md +41 -0
  52. package/commands/workflow.md +436 -0
  53. package/hooks/ai-guardrails.sh +114 -0
  54. package/hooks/audit-log.sh +26 -0
  55. package/hooks/auto-delegate.sh +45 -0
  56. package/hooks/auto-evolve.sh +22 -0
  57. package/hooks/auto-lesson.sh +26 -0
  58. package/hooks/auto-plan.sh +59 -0
  59. package/hooks/auto-test.sh +46 -0
  60. package/hooks/auto-verify.sh +30 -0
  61. package/hooks/budget-check.sh +24 -0
  62. package/hooks/code-field-preamble.sh +30 -0
  63. package/hooks/compliance-gate.sh +50 -0
  64. package/hooks/content-trust.sh +22 -0
  65. package/hooks/credential-redact.sh +23 -0
  66. package/hooks/delegation-trust.sh +15 -0
  67. package/hooks/detect-test-run.sh +19 -0
  68. package/hooks/enforcement-lib.sh +60 -0
  69. package/hooks/evolve-gate.sh +32 -0
  70. package/hooks/evolve-lib.sh +32 -0
  71. package/hooks/exfiltration-check.sh +67 -0
  72. package/hooks/failure-collector.sh +27 -0
  73. package/hooks/feature-flags.sh +67 -0
  74. package/hooks/file-provenance.sh +31 -0
  75. package/hooks/flag-utils.sh +36 -0
  76. package/hooks/hooks.json +145 -0
  77. package/hooks/injection-scan.sh +58 -0
  78. package/hooks/integrity-verify.sh +91 -0
  79. package/hooks/lessons-check.sh +17 -0
  80. package/hooks/lockfile-audit.sh +109 -0
  81. package/hooks/patterns-lib.sh +22 -0
  82. package/hooks/plan-gate.sh +18 -0
  83. package/hooks/redact-lib.sh +15 -0
  84. package/hooks/runtime-mode.sh +56 -0
  85. package/hooks/session-cleanup.sh +74 -0
  86. package/hooks/skill-validator.sh +28 -0
  87. package/hooks/standards-enforce.sh +106 -0
  88. package/hooks/star-gate.sh +93 -0
  89. package/hooks/star-preamble.sh +10 -0
  90. package/hooks/telemetry.sh +33 -0
  91. package/hooks/todo-prune.sh +84 -0
  92. package/hooks/unicode-firewall.sh +122 -0
  93. package/hooks/unicode-lib.sh +66 -0
  94. package/hooks/unicode-scan-session.sh +96 -0
  95. package/hooks/validate-command.sh +103 -0
  96. package/hooks/validate-env.sh +51 -0
  97. package/hooks/validate-path.sh +81 -0
  98. package/package.json +40 -0
  99. package/settings.json +6 -0
  100. package/templates/ai-config/tool-standards.md +56 -0
  101. package/templates/architecture/api-first.md +192 -0
  102. package/templates/architecture/auth-patterns.md +302 -0
  103. package/templates/architecture/caching-strategy.md +359 -0
  104. package/templates/architecture/database-patterns.md +347 -0
  105. package/templates/architecture/event-driven.md +252 -0
  106. package/templates/architecture/integration-patterns.md +185 -0
  107. package/templates/architecture/multi-tenancy.md +104 -0
  108. package/templates/architecture/service-boundaries.md +200 -0
  109. package/templates/build/brief-template.md +86 -0
  110. package/templates/build/summary-template.md +100 -0
  111. package/templates/build/task-plan-template.md +133 -0
  112. package/templates/communication/effort-estimate.md +54 -0
  113. package/templates/communication/incident-response.md +59 -0
  114. package/templates/communication/post-mortem.md +109 -0
  115. package/templates/communication/risk-register.md +43 -0
  116. package/templates/communication/sprint-demo-checklist.md +64 -0
  117. package/templates/communication/stakeholder-presentation-outline.md +84 -0
  118. package/templates/communication/technical-proposal.md +77 -0
  119. package/templates/delivery/deployment/deployment-checklist.md +49 -0
  120. package/templates/delivery/design/solution-design-checklist.md +37 -0
  121. package/templates/delivery/discovery/stakeholder-questions.md +33 -0
  122. package/templates/delivery/handover/knowledge-transfer-checklist.md +75 -0
  123. package/templates/delivery/handover/operational-runbook.md +117 -0
  124. package/templates/delivery/handover/support-escalation-matrix.md +56 -0
  125. package/templates/delivery/implementation/blocker-escalation-template.md +55 -0
  126. package/templates/delivery/implementation/sprint-planning-template.md +49 -0
  127. package/templates/delivery/implementation/task-decomposition-guide.md +59 -0
  128. package/templates/delivery/qa/test-plan-template.md +76 -0
  129. package/templates/delivery/qa/test-results-template.md +55 -0
  130. package/templates/delivery/qa/uat-signoff-template.md +44 -0
  131. package/templates/governance/codeowners.md +60 -0
  132. package/templates/integration/adapter-pattern.md +160 -0
  133. package/templates/scaffolds/env-validation.md +85 -0
  134. package/templates/scaffolds/error-handling.md +171 -0
  135. package/templates/scaffolds/graceful-shutdown.md +139 -0
  136. package/templates/scaffolds/health-check.md +109 -0
  137. package/templates/scaffolds/structured-logging.md +134 -0
  138. package/templates/standards/engineering-standards.md +413 -0
  139. package/templates/standards/standards-checklist.md +125 -0
  140. package/templates/tech-catalog.json +663 -0
  141. package/templates/utilities/project-detection.md +75 -0
  142. package/templates/utilities/requirements-collection.md +68 -0
  143. package/templates/utilities/template-rendering.md +81 -0
  144. package/templates/workflows/architecture-decision.md +90 -0
  145. package/templates/workflows/bug-investigation.md +83 -0
  146. package/templates/workflows/feature-implementation.md +80 -0
  147. package/templates/workflows/refactoring.md +83 -0
  148. package/templates/workflows/spike-exploration.md +82 -0
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: test-gen
3
+ description: Generate test suites based on code analysis with quality validation
4
+ ---
5
+
6
+ You are an AI test generation assistant. You analyse source code and generate comprehensive test suites that actually compile, run, and pass.
7
+
8
+ **Before starting, check the feature flag:**
9
+ Run: `source hooks/feature-flags.sh && agentops_enterprise_enabled "unified_review"` — if disabled, inform the user and stop.
10
+
11
+ The target for test generation is: $ARGUMENTS
12
+
13
+ If no arguments provided, auto-detect changed files via `git diff --name-only HEAD` and generate tests for those.
14
+
15
+ ---
16
+
17
+ ## Step 1: Analyse Target Code
18
+
19
+ 1. Identify the files to generate tests for
20
+ 2. Detect the testing framework in use:
21
+ - Check `package.json` for: jest, vitest, mocha, @testing-library/*, playwright, cypress
22
+ - Check for config files: `jest.config.*`, `vitest.config.*`, `playwright.config.*`
23
+ - If no framework detected, recommend vitest and ask the user to confirm
24
+ 3. Identify the test directory convention:
25
+ - Co-located tests (`*.test.ts` alongside source)
26
+ - Separate directory (`__tests__/`, `tests/`, `test/`)
27
+ 4. Read each target file and identify testable units
28
+
29
+ ---
30
+
31
+ ## Step 2: Identify Testable Units
32
+
33
+ For each source file, categorise testable elements:
34
+
35
+ ### Pure Functions & Utilities
36
+ - Input/output functions with no side effects
37
+ - Validation functions
38
+ - Transformation/mapping functions
39
+ - **Test type:** Unit tests
40
+
41
+ ### API Endpoints / Route Handlers
42
+ - Request/response handlers
43
+ - Middleware functions
44
+ - **Test type:** Integration tests (using supertest or similar)
45
+
46
+ ### React/Frontend Components (if applicable)
47
+ - Interactive components
48
+ - Components with state or effects
49
+ - **Test type:** Component tests (using @testing-library/react)
50
+
51
+ ### External API Adapters
52
+ - Functions that call external services
53
+ - Adapter/wrapper classes
54
+ - **Test type:** Contract tests (mock the external service, verify contract)
55
+
56
+ ---
57
+
58
+ ## Step 3: Generate Tests
59
+
60
+ For each testable unit, generate appropriate tests following these principles:
61
+
62
+ ### Test Structure
63
+ - Use `describe` blocks to group related tests
64
+ - Use clear, descriptive test names: `it('should return 404 when user not found')`
65
+ - Follow Arrange-Act-Assert pattern
66
+ - Test both success and failure paths
67
+ - Test edge cases (empty input, null, boundary values)
68
+
69
+ ### Test Quality Rules
70
+ - Every assertion must be meaningful (not just `expect(result).toBeDefined()`)
71
+ - Mock external dependencies, not internal logic
72
+ - Use factory functions for test data (not inline objects everywhere)
73
+ - Clean up after tests (close connections, restore mocks)
74
+ - Don't test implementation details — test behaviour
75
+
76
+ ### Coverage Targets
77
+ - Happy path: 100% of public functions
78
+ - Error paths: all thrown errors and error returns
79
+ - Edge cases: empty arrays, null values, boundary numbers
80
+ - Integration: all API endpoints with valid and invalid inputs
81
+
82
+ ---
83
+
84
+ ## Step 4: Verify Tests
85
+
86
+ After generating all test files:
87
+
88
+ 1. Run the test suite to verify all generated tests pass:
89
+ - `npm test` or `npx vitest run` or the appropriate test command
90
+ 2. If any tests fail:
91
+ - Read the error output
92
+ - Fix the failing tests
93
+ - Re-run to confirm
94
+ 3. Report results
95
+
96
+ ---
97
+
98
+ ## Step 5: Report
99
+
100
+ Present the test generation summary:
101
+
102
+ ```markdown
103
+ ## Test Generation Report
104
+
105
+ ### Files Analysed
106
+ | Source File | Testable Units | Tests Generated |
107
+ |------------|---------------|-----------------|
108
+ | src/services/user.ts | 5 functions | 12 tests |
109
+ | src/routes/api/users.ts | 3 endpoints | 9 tests |
110
+
111
+ ### Test Files Created
112
+ | Test File | Tests | Status |
113
+ |-----------|-------|--------|
114
+ | src/services/__tests__/user.test.ts | 12 | Passing |
115
+ | src/routes/api/__tests__/users.test.ts | 9 | Passing |
116
+
117
+ ### Coverage Summary
118
+ - Statements: X%
119
+ - Branches: X%
120
+ - Functions: X%
121
+ - Lines: X%
122
+
123
+ ### Test Types
124
+ - Unit tests: N
125
+ - Integration tests: N
126
+ - Component tests: N
127
+ - Contract tests: N
128
+ - **Total: N tests, all passing**
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Error Handling
134
+
135
+ - If the test framework isn't installed, inform the user and suggest installing it
136
+ - If generated tests fail, attempt to fix them (max 3 attempts per test file)
137
+ - If a test file can't be fixed, skip it and note in the report
138
+ - Never report "all tests passing" if any tests actually failed
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: evolve
3
+ description: Run the EvoSkill loop to discover and refine skills from execution failures
4
+ ---
5
+
6
+ Run the EvoSkill self-evolution loop. This analyzes recent failures, proposes skill improvements, builds them, and retains only the ones that improve performance.
7
+
8
+ ## Process
9
+
10
+ ### Step 1: Collect Failures
11
+ Read `.agentops/failures.jsonl` for recent execution failures (from PostToolUseFailure hook and task failures). If no failures exist, report that and stop.
12
+
13
+ ### Step 2: Load Feedback History
14
+ Read `.agentops/feedback-history.jsonl` for prior proposals, their outcomes, and score deltas. This prevents redundant proposals and enables the Proposer to learn from past iterations.
15
+
16
+ ### Step 3: Spawn Proposer Agent
17
+ For each failure cluster (group similar failures):
18
+ - Pass the execution trace, expected outcome, existing skills inventory, and feedback history to the Proposer agent
19
+ - The Proposer diagnoses root causes and outputs a skill proposal (create or edit)
20
+
21
+ ### Step 4: Spawn Skill-Builder Agent
22
+ For each accepted proposal:
23
+ - Pass the proposal to the Skill-Builder agent
24
+ - The Skill-Builder materializes it into a concrete SKILL.md + optional scripts
25
+ - Write the skill to `skills/{skill-name}/`
26
+
27
+ ### Step 5: Frontier Update
28
+ - Score the candidate skill set against a validation set (if available) or log for future evaluation
29
+ - If the candidate outscores the current weakest frontier member, add it
30
+ - If the frontier exceeds capacity k (default 5), remove the weakest
31
+ - Record the result in `.agentops/feedback-history.jsonl`
32
+
33
+ ### Step 6: Report
34
+ Output a summary: how many failures analyzed, proposals made, skills created/edited, frontier changes.
35
+
36
+ ### Step 7: Mark Completion
37
+ After the evolve loop completes (even if no skills were created), create the sentinel file `.agentops/evolve-ran` to signal that failures have been processed this session. This MUST be done by the skill — agents should NEVER manually create this file.
38
+
39
+ Arguments: $ARGUMENTS (optional: --max-iterations N, --frontier-size K, --dry-run)
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: flags
3
+ description: View or toggle AgentOps feature flags
4
+ ---
5
+
6
+ Read `.agentops/flags.json` in the project root. Display all flags in a table with current values. If the user provides a flag name and value as $ARGUMENTS, update it.
7
+
8
+ Available flags:
9
+ - `command_validation_enabled` (bool) — Validate Bash commands
10
+ - `path_validation_enabled` (bool) — Validate file paths
11
+ - `env_validation_enabled` (bool) — Validate env var assignments
12
+ - `injection_scan_enabled` (bool) — Scan for prompt injection
13
+ - `content_trust_enabled` (bool) — Tag external content as untrusted
14
+ - `exfiltration_detection_enabled` (bool) — Detect data exfiltration
15
+ - `credential_redaction_enabled` (bool) — Warn about credential exposure
16
+ - `plan_gate_enabled` (bool) — Require plan for multi-file changes
17
+ - `verification_gate_enabled` (bool) — Require all items checked before stop
18
+ - `test_gate_enabled` (bool) — Require tests to be run
19
+ - `star_preamble_enabled` (bool) — Inject STAR framework at session start
20
+ - `code_field_rules_enabled` (bool) — Inject Code Field methodology (confidence, verify, answer format) at session start
21
+ - `lessons_enabled` (bool) — Load and enforce lessons from tasks/lessons.md
22
+ - `llm_content_firewall_enabled` (bool) — LLM-based content injection detection
23
+ - `auto_plan_enabled` (bool) — Auto-generate STAR plan after 3+ file modifications
24
+ - `auto_test_enabled` (bool) — Auto-run tests after 3+ source code files modified
25
+ - `auto_lesson_enabled` (bool) — Auto-capture lessons after consecutive tool failures
26
+ - `auto_verify_enabled` (bool) — Auto-verify task completion before session stop
27
+ - `auto_evolve_enabled` (bool) — Auto-run EvoSkill loop if unprocessed failures exist at stop
28
+ - `auto_delegate_enabled` (bool) — Auto-delegate to code-critic and security-reviewer after 5+ source files modified
29
+ - `unicode_firewall_enabled` (bool) — Glassworm/Trojan Source defense: auto-strip on write, warn on read
30
+ - `integrity_verification_enabled` (bool) — SHA-256 manifest of agent-written files, verify on session start
31
+ - `lockfile_audit_enabled` (bool) — Scan lockfiles for Unicode anomalies and suspicious registries
32
+ - `enforcement_mode` ("advisory"|"blocking") — Advisory uses "ask", blocking uses "deny"
33
+
34
+ Enterprise extension flags:
35
+ - `enterprise_scaffold` (bool) — Enable project scaffolding system
36
+ - `ai_workflows` (bool) — Enable AI-first workflow commands
37
+ - `unified_review` (bool) — Enable unified code review system
38
+ - `architecture_guardrails` (bool) — Enable architecture pattern enforcement
39
+ - `delivery_lifecycle` (bool) — Enable delivery phase management
40
+ - `team_governance` (bool) — Enable team scalability features
41
+ - `client_comms` (bool) — Enable client communication templates
42
+ - `autonomy_level` ("guided"|"supervised"|"autonomous") — Configurable autonomy for workflow gates
43
+
44
+ If `.agentops/flags.json` doesn't exist, create it with all flags set to their defaults (all true, mode advisory, autonomy guided).
@@ -0,0 +1,263 @@
1
+ ---
2
+ name: interrogate
3
+ description: Requirements Interrogator - exhaustive questioning to eliminate all assumptions before planning
4
+ ---
5
+
6
+ # Requirements Interrogator
7
+
8
+ You are a ruthless requirements interrogator. You do not build, write code, design, or produce deliverables. You never suggest solutions. You simply ask exhaustive questions to interrogate the task until there is nothing left to assume before future planning and execution.
9
+
10
+ All interrogation artifacts are stored in `./docs/interrogation/{name}/` where `{name}` is a kebab-case slug you auto-generate from the brief (e.g., `migrate-user-auth`, `rebrand-marketing-site`, `quarterly-research-report`).
11
+
12
+ ## Storage
13
+
14
+ You will create and maintain three files during this process:
15
+
16
+ 1. `./docs/interrogation/{name}/brief.md` — The user's initial prompt/brief, captured verbatim at the start.
17
+ 2. `./docs/interrogation/{name}/interrogation.md` — Running log of every question asked and every answer given, organized by domain/concern area and round number.
18
+ 3. `./docs/interrogation/{name}/plan.md` — The generated plan from Phase 5, written only after the user confirms the summary is complete.
19
+
20
+ Create the directory and `brief.md` as soon as you have the brief. Update `interrogation.md` after each Q&A round. Do not create `plan.md` until Phase 5.
21
+
22
+ ## Phase 0: Scope & Brief
23
+
24
+ Before doing anything else, determine the scope of this interrogation.
25
+
26
+ Use the `AskUserQuestion` tool to ask:
27
+
28
+ > "What type of interrogation is this?"
29
+
30
+ With options:
31
+
32
+ - **New Initiative** — "I'm starting something new (feature, project, campaign, research, workflow, design, etc.) and want to interrogate requirements for it."
33
+ - **Existing / General** — "I want to interrogate an existing project, system, process, or a broad concern."
34
+
35
+ ### If the user selects New Initiative:
36
+
37
+ 1. Use `AskUserQuestion` to ask: *"Describe what you're building or doing. What is it, what should it achieve, and any context you already have."*
38
+ 2. Store this response verbatim as the **brief** in `./docs/interrogation/{name}/brief.md`.
39
+ 3. All subsequent interrogation is scoped to this initiative: its requirements, edge cases, interactions with existing systems/processes, constraints, and dependencies.
40
+
41
+ ### If the user selects Existing / General:
42
+
43
+ 1. Use `AskUserQuestion` to ask: *"Describe what you want to interrogate. What's the project, system, or concern, and what are you trying to clarify?"*
44
+ 2. Store this response verbatim as the **brief** in `./docs/interrogation/{name}/brief.md`.
45
+ 3. Proceed to Phase 1 with broad scope. Interrogation will cover the subject matter generally, plus any additional context the user provides.
46
+
47
+ ## Phase 1: Context Discovery
48
+
49
+ Before asking any questions, silently explore the available context to build understanding. Adapt your discovery to whatever is available:
50
+
51
+ ### If a codebase/project is present:
52
+
53
+ 1. Read `CLAUDE.md`, `README.md`, and any docs in the project root.
54
+ 2. Examine the project structure (key directories, config files, package manifests).
55
+ 3. Identify the tech stack, frameworks, and major dependencies.
56
+ 4. Map out core domains, modules, and architectural patterns.
57
+ 5. Review routes, API surfaces, or key interfaces.
58
+ 6. Check for existing task lists, roadmaps, TODOs, or plan files.
59
+ 7. Understand data flow, models, and integrations.
60
+
61
+ ### If documents, files, or data are available:
62
+
63
+ 1. Read any uploaded or referenced files.
64
+ 2. Identify structure, format, and content patterns.
65
+ 3. Note gaps, inconsistencies, or ambiguities.
66
+
67
+ ### If no project or files are present:
68
+
69
+ 1. Work solely from the brief and your general knowledge of the domain.
70
+ 2. Identify what categories of information you'll need to interrogate (audience, scope, constraints, dependencies, success criteria, etc.).
71
+
72
+ ### Build an internal picture of:
73
+
74
+ - **What exists:** Current state, systems, processes, or assets in play.
75
+ - **Core domains:** Major areas, components, workflows, or stakeholders involved.
76
+ - **Interfaces & touchpoints:** How this connects to other systems, people, or processes.
77
+ - **Data & information flow:** What information moves, where, and how.
78
+ - **Infrastructure & operations:** Tools, environments, integrations, schedules.
79
+ - **What is planned or in progress:** Staged work, TODOs, roadmap items.
80
+
81
+ If this is a **New Initiative** interrogation, pay special attention to whatever the initiative will touch, extend, or depend on.
82
+
83
+ **Do NOT output this discovery.** Use it only to inform your interrogation.
84
+
85
+ ## Phase 2: Interrogation
86
+
87
+ Using your discovery context, interrogate the user about every detail, decision, design, edge case, constraint, and dependency until zero assumptions remain.
88
+
89
+ Use the `AskUserQuestion` tool to ask your questions. Group questions by domain or concern area for clarity. Ask 3-7 questions at a time, wait for answers, then ask follow-up rounds.
90
+
91
+ After each round, append the questions and answers to `./docs/interrogation/{name}/interrogation.md` with the round number and domain heading.
92
+
93
+ ### Question categories to cover (adapt to the task type):
94
+
95
+ **For any task:**
96
+ - Goals & success criteria — What does "done" look like? How will success be measured?
97
+ - Scope & boundaries — What is explicitly in scope? What is explicitly out?
98
+ - Audience & stakeholders — Who is this for? Who needs to approve? Who is affected?
99
+ - Constraints — Time, budget, resources, tools, regulations, dependencies.
100
+ - Risks & edge cases — What could go wrong? What happens when it does?
101
+ - Dependencies — What must exist or happen first? What blocks this?
102
+ - Existing work — What has already been done? What can be reused?
103
+ - Open decisions — What hasn't been decided yet? Who decides?
104
+
105
+ **For technical/code tasks, also cover:**
106
+ - Architecture & patterns — How should it be structured? What patterns apply?
107
+ - Data models & flow — What data is involved? How does it move?
108
+ - APIs & interfaces — What contracts exist? What needs to be exposed?
109
+ - Auth, permissions, security — Who can do what? What's sensitive?
110
+ - Error handling & resilience — What fails? How is it recovered?
111
+ - Testing & validation — How is correctness proven?
112
+ - Migration & rollout — How does this get deployed? Backwards compatibility?
113
+ - Performance & scale — What are the load expectations?
114
+
115
+ **For workflow/process tasks, also cover:**
116
+ - Current process — What happens today? What are the pain points?
117
+ - Handoffs & responsibilities — Who does what, when?
118
+ - Tools & systems — What tools are used? What integrations exist?
119
+ - Exceptions & edge cases — What happens when the process breaks?
120
+ - Compliance & governance — What rules, approvals, or audit trails apply?
121
+
122
+ **For research/analysis tasks, also cover:**
123
+ - Research questions — What specifically needs to be answered?
124
+ - Sources & methodology — Where does information come from? How is it validated?
125
+ - Deliverable format — What does the output look like? Who reads it?
126
+ - Depth vs. breadth — How deep should analysis go? What's out of scope?
127
+
128
+ **For design/creative tasks, also cover:**
129
+ - Brand & style — What guidelines exist? What's the tone?
130
+ - Content & messaging — What needs to be communicated?
131
+ - Format & medium — What is the deliverable? Where does it live?
132
+ - Review & approval — Who signs off? What's the feedback process?
133
+
134
+ ### Interrogation rules:
135
+
136
+ - If an answer is vague, push back. *"Something modern"* is not a tech stack. *"Users can log in"* is not an auth model. *"It should be good"* is not a success criterion.
137
+ - If the user says "I don't know" or "TBD," record it as an open decision and move on — but flag it in the summary.
138
+ - When you think you're done, ask: *"What might I have missed? Is there anything you're unsure about that we haven't covered?"*
139
+ - You are probably not done after the first pass. Do at least 2-3 rounds.
140
+
141
+ **Do NOT generate any deliverables, code, documentation, or plans during this phase. Only ask questions.**
142
+
143
+ ## Phase 3: Summary
144
+
145
+ When you believe every assumption has been eliminated, present a complete structured summary of everything you've learned — from both your discovery and the user's answers.
146
+
147
+ Organize the summary by domain/concern area. Structure depends on task type:
148
+
149
+ ### For a New Initiative:
150
+ - **Purpose & goals** — What this is and why it exists.
151
+ - **Scope** — What's in, what's out.
152
+ - **Requirements** — Detailed, organized by domain.
153
+ - **Constraints & dependencies** — What limits or blocks this.
154
+ - **Edge cases & risks** — What could go wrong and how it's handled.
155
+ - **Open decisions** — What hasn't been resolved yet.
156
+ - **Success criteria** — How completion and quality are measured.
157
+
158
+ ### For General / Existing:
159
+ - **Current state** — What exists today.
160
+ - **Findings by domain** — Organized by concern area.
161
+ - **Gaps & ambiguities** — What's unclear or missing.
162
+ - **Open decisions** — What needs to be resolved.
163
+ - **Recommendations for next steps** — What should be interrogated further or decided.
164
+
165
+ Present this summary to the user and ask them to confirm nothing is missing.
166
+
167
+ ## Phase 4: Confirmation
168
+
169
+ Use `AskUserQuestion` to ask:
170
+
171
+ > "Is this summary complete? Is there anything missing, wrong, or that needs more detail?"
172
+
173
+ With options:
174
+
175
+ - **Complete** — "The summary is accurate and complete. Nothing is missing."
176
+ - **Needs changes** — "I have corrections or additions."
177
+
178
+ If the user selects **Needs changes**, return to Phase 2 for targeted follow-up questions on the gaps, then regenerate the summary.
179
+
180
+ Repeat until the user confirms the summary is complete.
181
+
182
+ ## Phase 5: Plan Generation
183
+
184
+ Once the user confirms the summary is complete, use `AskUserQuestion` to ask:
185
+
186
+ > "Ready to turn these findings into an actionable plan?"
187
+
188
+ With options:
189
+
190
+ - **Yes, generate the plan** — "Create a structured plan based on everything we've covered."
191
+ - **No, just keep the summary** — "I'll handle planning separately."
192
+
193
+ If the user agrees, generate a structured plan and write it to `./docs/interrogation/{name}/plan.md`.
194
+
195
+ The plan must include:
196
+
197
+ 1. **STAR Analysis Header**
198
+ - **Situation:** Current state — what exists, what doesn't, what constraints are in play.
199
+ - **Task:** Specific success criteria — what does "done" look like.
200
+ - **Action:** Concrete steps with file-level specificity — which files to create/modify and how.
201
+ - **Result:** How completion will be verified — tests, behavior, demonstration.
202
+
203
+ 2. **Objective** — One-sentence statement of what this achieves.
204
+
205
+ 3. **Implementation Sections** — Minimum 8 sections, organized by domain or phase:
206
+ - Each section has a clear deliverable
207
+ - Concrete, checkable tasks per section using `- [ ]` checkbox format
208
+ - File-level specificity (which files to create/modify)
209
+ - Dependency ordering between tasks
210
+ - Estimated complexity per task (S/M/L)
211
+
212
+ 4. **Dependencies & Sequencing** — What blocks what, critical path.
213
+
214
+ 5. **Open Decisions** — Flagged items that need resolution before or during execution.
215
+
216
+ 6. **Success Criteria** — How completion is verified.
217
+
218
+ 7. **Risks & Mitigations** — Known risks and how they're addressed.
219
+
220
+ Additionally, write a copy of the checkable task items to `tasks/todo.md` (creating the file and directory if needed) so it can be picked up by the `/workflow` execution command and compliance gates.
221
+
222
+ Present the plan to the user for review. Do not proceed to execution.
223
+
224
+ ## Rules
225
+
226
+ - Never assume. Never infer. Never fill gaps with "reasonable defaults."
227
+ - If an answer is vague, push back. Demand specifics.
228
+ - When you think you're done, you're probably not. Ask what you might have missed.
229
+ - The goal is not speed. The goal is zero assumptions.
230
+ - During Phases 0-4: do NOT produce deliverables, write code, generate documentation, or create plans. Only ask questions and summarize.
231
+ - Phase 5 only activates after the user explicitly confirms the summary is complete.
232
+ - Always use the `AskUserQuestion` tool to ask questions — never just print questions as plain text.
233
+ - Always store artifacts in `./docs/interrogation/{name}/` as specified.
234
+ - Update `interrogation.md` after every Q&A round, not just at the end.
235
+
236
+ ## Enterprise Extensions
237
+
238
+ When working on an enterprise delivery engagement, also interrogate these dimensions:
239
+
240
+ ### Stakeholder Questions
241
+ - Who are the end users? How many? What are their technical capabilities?
242
+ - Who is the project sponsor / decision maker?
243
+ - Who approves scope changes? What is the change request process?
244
+ - Are there existing systems this replaces or integrates with?
245
+
246
+ ### Scope Definition
247
+ - What is explicitly IN scope for this engagement?
248
+ - What is explicitly OUT of scope?
249
+ - What is deferred to a future phase?
250
+ - What are the hard constraints (budget, timeline, compliance)?
251
+
252
+ ### Assumption Logging
253
+ - Document every assumption explicitly in the interrogation log
254
+ - Tag assumptions as: [CONFIRMED] / [UNCONFIRMED] / [RISKY]
255
+ - Flag assumptions that could change the estimate if wrong
256
+
257
+ ### Risk Identification
258
+ - What could go wrong technically?
259
+ - What could go wrong from a business/stakeholder perspective?
260
+ - What external dependencies could fail or change?
261
+ - What compliance/regulatory constraints exist?
262
+
263
+ Arguments: $ARGUMENTS
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: lesson
3
+ description: Capture a lesson learned after a correction or mistake
4
+ ---
5
+
6
+ Append a new entry to `tasks/lessons.md` using this exact format:
7
+
8
+ ## Lesson: [Short title]
9
+ **Date:** [Today's date]
10
+ **Trigger:** [What went wrong or what the user corrected]
11
+ **Pattern:** [The underlying pattern that caused the issue]
12
+ **Rule:** [Concrete rule to prevent recurrence]
13
+ **Applies to:** [File types, tools, or contexts where this rule matters]
14
+
15
+ If `tasks/lessons.md` doesn't exist, create it with a `# Lessons Learned` header first. Arguments: $ARGUMENTS
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: lessons
3
+ description: View all captured lessons from tasks/lessons.md
4
+ ---
5
+
6
+ Read and display all lessons from `tasks/lessons.md`. Present them organized by date with their trigger, pattern, rule, and applicability scope.
7
+
8
+ If `tasks/lessons.md` doesn't exist, report that no lessons have been captured yet and suggest using `/lesson` to capture one.
9
+
10
+ Arguments: $ARGUMENTS
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: plan
3
+ description: Generate a STAR-based implementation plan with checkable tasks
4
+ ---
5
+
6
+ Generate a structured implementation plan for the current task.
7
+
8
+ ## Process
9
+
10
+ 1. **Analyze the task** — understand scope, constraints, existing code
11
+ 2. **Write STAR header:**
12
+ - **Situation:** Current state and constraints
13
+ - **Task:** Specific, measurable success criteria
14
+ - **Action:** Concrete steps with file-level specificity
15
+ - **Result:** Verification method (tests, behavior, acceptance criteria)
16
+ 3. **Break into checkable items** — each item is a concrete, completable unit of work
17
+ 4. **Order by dependency** — items that block others come first
18
+ 5. **Estimate complexity** — tag each item as S (small), M (medium), or L (large)
19
+ 6. **Write to `tasks/todo.md`** using checkbox format (`- [ ]`)
20
+
21
+ ## Output Format
22
+
23
+ ```markdown
24
+ # Plan: [Task Title]
25
+
26
+ ## STAR Analysis
27
+ - **Situation:** ...
28
+ - **Task:** ...
29
+ - **Action:** ...
30
+ - **Result:** ...
31
+
32
+ ## Implementation
33
+
34
+ ### Section 1: [Domain/Phase]
35
+ - [ ] [S] Task description (file: path/to/file)
36
+ - [ ] [M] Task description (file: path/to/file)
37
+
38
+ ### Section 2: [Domain/Phase]
39
+ - [ ] [L] Task description (files: path/a, path/b)
40
+ ```
41
+
42
+ Minimum 8 implementation sections. If `tasks/todo.md` already exists and has content, ask the user whether to append or replace.
43
+
44
+ Arguments: $ARGUMENTS
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: prune
3
+ description: Prune completed items from tasks/todo.md or archive it entirely
4
+ ---
5
+
6
+ Prune completed tasks from `tasks/todo.md`.
7
+
8
+ ## Process
9
+
10
+ 1. Read `tasks/todo.md`. If it doesn't exist or is empty, report that there's nothing to prune and stop.
11
+ 2. Categorize every checkbox item:
12
+ - **Completed:** `- [x]` items
13
+ - **Incomplete:** `- [ ]` items
14
+ 3. If there are no completed items, report "nothing to prune" and stop.
15
+ 4. Report what will be pruned — list the completed items so the user can see them before removal.
16
+ 5. **If all items are completed:**
17
+ - Archive the file to `tasks/archive/todo-{UTC timestamp}.md`
18
+ - Delete `tasks/todo.md`
19
+ - Report: archived and cleared, a fresh STAR plan is required for new work.
20
+ 6. **If some items are incomplete:**
21
+ - Remove all `- [x]` items
22
+ - Keep `- [ ]` items with their section headings
23
+ - Keep any non-checkbox content (e.g. STAR headers) that belongs to sections with remaining incomplete items
24
+ - Write the pruned result back to `tasks/todo.md`
25
+ - Report: how many items pruned, how many remain.
26
+
27
+ Arguments: $ARGUMENTS
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: star
3
+ description: Generate a STAR analysis for the current task
4
+ ---
5
+
6
+ Generate a STAR (Situation, Task, Action, Result) analysis for the current task or request:
7
+
8
+ 1. **Situation:** Describe the current state — what exists, what doesn't, relevant constraints and context.
9
+ 2. **Task:** Define specific success criteria — what does "done" look like? Be concrete and measurable.
10
+ 3. **Action:** List concrete steps with file-level specificity — which files to create, modify, or delete.
11
+ 4. **Result:** Describe how completion will be verified — tests to run, behavior to demonstrate, acceptance criteria.
12
+
13
+ Write the analysis to `tasks/todo.md` with checkable items (`- [ ]`) for each action step.
14
+
15
+ If `tasks/todo.md` already exists and has content, ask the user whether to append or replace.
16
+
17
+ Arguments: $ARGUMENTS
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: supply-chain-scan
3
+ description: Run all supply-chain defense scans — Unicode firewall, integrity verification, and lockfile audit
4
+ ---
5
+
6
+ Run all three supply-chain defense scans against the current project directory and present a unified report.
7
+
8
+ ## Procedure
9
+
10
+ Run these three scans sequentially using Bash, then compile the results:
11
+
12
+ ### 1. Unicode Scan
13
+ ```bash
14
+ "${CLAUDE_PLUGIN_ROOT}/hooks/unicode-scan-session.sh" <<< '{"hook_event":"SessionStart"}'
15
+ ```
16
+
17
+ ### 2. Integrity Verification
18
+ ```bash
19
+ "${CLAUDE_PLUGIN_ROOT}/hooks/integrity-verify.sh" <<< '{"hook_event":"SessionStart"}'
20
+ ```
21
+
22
+ ### 3. Lockfile Audit
23
+ ```bash
24
+ "${CLAUDE_PLUGIN_ROOT}/hooks/lockfile-audit.sh" <<< '{"hook_event":"SessionStart"}'
25
+ ```
26
+
27
+ Parse the JSON output from each hook (the `systemMessage` field) and present a unified report:
28
+
29
+ ```
30
+ ## Supply-Chain Defense Scan
31
+
32
+ | Check | Status | Details |
33
+ |-------|--------|---------|
34
+ | Unicode firewall | CLEAN / ⚠ FINDINGS | N file(s) flagged |
35
+ | Integrity verification | CLEAN / ⚠ MISMATCH | N file(s) changed |
36
+ | Lockfile audit | CLEAN / ⚠ FINDINGS | N finding(s) |
37
+
38
+ ### Details
39
+ [Include detail sections from any scan that reported findings]
40
+ ```
41
+
42
+ If all three scans are clean, report a single summary line confirming the project is clear.
43
+
44
+ If any scan has findings, ask the user what they'd like to do about each finding category using AskUserQuestion.