Implement the following plan: Plan: Restructure Agent-Integration Skill for E2E-First…
- User
Implement the following plan:
Plan: Restructure Agent-Integration Skill for E2E-First TDD
Context
The agent-integration skill claims to be E2E-driven but interleaves unit test writing after each E2E tier ("After passing, write unit tests"). When the skill ran for the Kiro integration, it wrote unit tests during development but never ran E2E tests — so E2E tests fail when actually run. The fix enforces strict discipline: E2E tests drive development, unit tests are written last.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
Files to Modify
1.
.claude/skills/agent-integration/SKILL.md- Update YAML
descriptionto mention "E2E-first TDD, unit tests last" - Add
## Core Rule: E2E-First TDDsection (6 rules) after "Scope", before "Pipeline" - Rename "Phase 2: Write Tests" → "Phase 2: Write E2E Runner" — clarify: runner only, no unit tests
- Update Phase 3 description: "E2E-first, unit tests last" and explain the cycle
2.
.claude/skills/agent-integration/test-writer.md- Update header: "Create the E2E agent runner only — no unit tests, no new test scenarios"
- Delete Step 6 (Write E2E Test Scenarios) — existing
ForEachAgenttests are the spec; agent-specific scenarios discovered during implement phase - Restructure Step 7 → Step 6 (Verify): Remove "Do NOT run E2E tests"; replace with "runner compiles and registers, implement phase runs the tests"
- Replace Key Convention "Do NOT run E2E tests" → "E2E tests are run during the implement phase"
3.
.claude/skills/agent-integration/implementer.md(most critical)- Update subtitle: "strict E2E-first TDD. Unit tests written ONLY after all E2E tests pass."
- Add
## Core Principle: E2E-First TDDsection with 7 rules + "Do NOT write unit tests during Steps 4-12" - Steps 4-12: Remove ALL "After passing, write unit tests" blocks (7 occurrences in Steps 4-10). Add "Watch it fail" to each Cycle. Replace
mise run test→mise run fmt && mise run lint(no unit tests exist yet) - Insert new Step 13: Write Unit Tests — consolidated step with all test files (
hooks_test.go,lifecycle_test.go,types_test.go,transcript_test.go,${AGENT_PACKAGE}_test.go). Instruction to use real data from E2E artifacts as golden fixtures. - Renumber Step 13 → 14, Step 14 → 15
- Update Output section to reflect E2E-first flow
4. Plugin commands (minor)
.claude/plugins/agent-integration/commands/write-tests.md: description → "Create E2E agent runner (no unit tests)".claude/plugins/agent-integration/commands/implement.md: description → "E2E-first TDD — unit tests written last"
Verification
- Read each modified file to verify no remaining "write unit tests" in implementer Steps 4-12
- Verify no "Do NOT run E2E tests" in test-writer.md
- Check Step numbering in implementer.md is sequential (1-15)
- Verify consistency between SKILL.md phase descriptions and the actual phase file content
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/alisha/.claude/projects/-Users-alisha-Projects-wt-kiro-oneshot/09095c0f-c5ef-4aa7-b207-9612d3846e6f.jsonl
- Update YAML
Assistant
★ Insight ─────────────────────────────────────This plan restructures a skill definition to enforce E2E-first TDD discipline. The key insight: when a skill says "write unit tests after each step" but E2E tests are never actually run during development, you get unit tests that pass in isolation but don't validate real behavior. By deferring unit tests to the end and running E2E tests at each step, you ensure the integration actually works before locking down implementation details with unit tests.─────────────────────────────────────────────────Let me start by reading all the files that need to be modified to understand the current state.
Assistant
Now I have a clear understanding of all four files. Let me create tasks and work through the modifications.
Assistant
Starting with SKILL.md — updating the YAML description, adding the Core Rule section, and updating phase descriptions.
Assistant
Now update Phase 2 and Phase 3 descriptions:
Assistant
Now test-writer.md — update header, delete Step 6 (Write E2E Test Scenarios), restructure Step 7, and update key conventions.
Assistant
Now delete Step 6 (Write E2E Test Scenarios) entirely:
Assistant
Now restructure the Verify step content — remove "Do NOT run E2E tests" and update with the new approach:
Assistant
Now update the Key Conventions — replace the "Do NOT run E2E tests" line:
Assistant
Also update the Output section to remove mention of agent-specific test scenarios:
Assistant
Now the most critical file — implementer.md. This requires many changes. Let me work through them systematically.
First, update the subtitle:
Assistant
Add the Core Principle section after the Prerequisites:
Assistant
Now remove the "After passing, write unit tests" block from Step 4 and add "Watch it fail" + update the run command:
Assistant
Now Step 5 — remove the "After passing, write unit tests" block:
Assistant
Now Step 6 — remove the "After passing" unit test update:
Assistant
Now Step 7 — remove the "After passing" unit test block:
Assistant
Step 8 — remove unit test mention:
Assistant
Step 9 — remove unit test mention:
Assistant
Step 10 — remove unit test writing from optional interfaces:
Assistant
Step 11 — update the run command:
Assistant
Step 12 — update the run command:
Assistant
Now I need to insert the new Step 13 content (Write Unit Tests) and renumber the old Steps 13 and 14. Let me read the current state of the file to see what's there now:
Assistant
I can see the old "Step 13: Verify Registration" (which was renamed to "Write Unit Tests" by my earlier edit but still has the old content). I need to replace it with the actual unit test content, then renumber the remaining steps.
Assistant
Now update the Output section to reflect the E2E-first flow:
Assistant
Now update the plugin command descriptions:
Assistant
Now the verification step. Let me read all modified files to check for the four verification criteria.
Assistant
Now let me run the verification checks. Let me search for the specific patterns that should NOT exist:
Assistant
All verification checks pass:
-
No "write unit tests" in Steps 4-12 — The only mentions of "write unit tests" are in the Core Principle section (line 21, which says "Do NOT write unit tests during Steps 4-12") and in Step 13 (line 221-223, which is the consolidated unit test step). Steps 4-12 have no unit test instructions.
-
No "Do NOT run E2E tests" in test-writer.md — No matches found.
-
Sequential step numbering 1-15 — Steps are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15.
-
Let me verify consistency between SKILL.md phase descriptions and the actual phase files:
-
Assistant
Everything looks consistent. Let me also quickly verify the plugin command files:
Assistant
All changes are complete and verified. Here's a summary:
★ Insight ─────────────────────────────────────The restructuring enforces a key TDD principle: the test pyramid is built top-down during development, bottom-up for regression. E2E tests drive what you build (they define "working"), while unit tests lock in the implementation details afterward. Writing unit tests interleaved with E2E tiers created a false sense of coverage — the unit tests passed because they were written to match the implementation, not because they validated real behavior observed through E2E runs. By deferring unit tests to Step 13 and using E2E artifacts as golden fixtures, the unit tests now test against actually observed data rather than assumed data.─────────────────────────────────────────────────Changes Made
1.
.claude/skills/agent-integration/SKILL.md- Updated YAML description to mention "E2E-first TDD, unit tests written last"
- Added
## Core Rule: E2E-First TDDsection (6 rules) after Scope, before Pipeline - Renamed "Phase 2: Write Tests" → "Phase 2: Write E2E Runner" with updated description
- Updated Phase 3 description: "Implement (E2E-First, Unit Tests Last)"
2.
.claude/skills/agent-integration/test-writer.md- Updated header: "Create the E2E agent runner only — no unit tests, no new test scenarios"
- Deleted old Step 6 (Write E2E Test Scenarios) entirely
- Restructured Step 7 → Step 6 (Verify): Removed "Do NOT run E2E tests", replaced with "implement phase runs the tests"
- Updated Key Convention: "E2E tests are run during the implement phase"
- Updated Output section to reflect runner-only scope
3.
.claude/skills/agent-integration/implementer.md(most critical)- Updated subtitle to "strict E2E-first TDD"
- Added
## Core Principle: E2E-First TDDsection with 7 rules + bold "Do NOT write unit tests during Steps 4-12" - Removed all 7 "After passing, write unit tests" blocks from Steps 4-9
- Removed unit test writing from Step 10 (Optional Interfaces)
- Added "Watch it fail" to every E2E cycle
- Replaced
mise run test→mise run fmt && mise run lintin Steps 4-12 - Inserted new Step 13: Write Unit Tests with 5 test files and golden fixture guidance
- Renumbered: old Step 13 → Step 14, old Step 14 → Step 15
- Updated Output section to list E2E tiers first, then unit tests
4. Plugin commands
write-tests.md: description → "Create E2E agent runner (no unit tests)"implement.md: description → "E2E-first TDD — unit tests written last"
Verification
- No "write unit tests" references in implementer Steps 4-12
- No "Do NOT run E2E tests" in test-writer.md
- Steps numbered sequentially 1-15 in implementer.md
- SKILL.md phase descriptions match phase file content
- User
/exit exit
- Assistant· <synthetic>
No response requested.
- User
add section to .claude/skills/agent-integration/implementer.md after step 12 to run run all e2e tests for agent and verify they pass and fix any that fail the commadn should be mise run test:e2e --agent $AGENT_SLUG
Assistant
Now renumber the remaining steps (old 14 → 15, old 15 → 16):
Assistant
Now update the Core Principle section to reference the correct step numbers:
Assistant
Also update the SKILL.md reference to Step 13 for unit tests:
Assistant
Done. Added Step 13: Full E2E Suite Pass after Step 12 with
mise run test:e2e --agent $AGENT_SLUG, and renumbered all subsequent steps (13→14→15→16). Also updated all step number references in the Core Principle section and SKILL.md to match.- User
commit-commands:commit /commit-commands:commit
- User
Context
- Current git status: On branch alisha/kiro-oneshot Changes to be committed: (use "git restore --staged ..." to unstage) modified: .claude/plugins/agent-integration/commands/implement.md modified: .claude/plugins/agent-integration/commands/write-tests.md modified: .claude/skills/agent-integration/SKILL.md modified: .claude/skills/agent-integration/implementer.md modified: .claude/skills/agent-integration/test-writer.md
Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: .claude/skills/agent-integration/SKILL.md modified: .claude/skills/agent-integration/implementer.md
- Current git diff (staged and unstaged changes): diff --git a/.claude/plugins/agent-integration/commands/implement.md b/.claude/plugins/agent-integration/commands/implement.md index 191ff6e0..cad196e4 100644 --- a/.claude/plugins/agent-integration/commands/implement.md +++ b/.claude/plugins/agent-integration/commands/implement.md @@ -1,5 +1,5 @@
-description: "Build the agent Go package via TDD using research findings and E2E tests as spec" +description: "E2E-first Test driven develpoment — unit tests written last"
Implement Command
diff --git a/.claude/plugins/agent-integration/commands/write-tests.md b/.claude/plugins/agent-integration/commands/write-tests.md index 5f3e019e..54c347d0 100644 --- a/.claude/plugins/agent-integration/commands/write-tests.md +++ b/.claude/plugins/agent-integration/commands/write-tests.md @@ -1,5 +1,5 @@
-description: "Generate E2E test suite for a new agent integration" +description: "Create E2E agent runner (no unit tests)"
Write-Tests Command
diff --git a/.claude/skills/agent-integration/SKILL.md b/.claude/skills/agent-integration/SKILL.md index 4ea0b0a2..de1405c7 100644 --- a/.claude/skills/agent-integration/SKILL.md +++ b/.claude/skills/agent-integration/SKILL.md @@ -2,7 +2,8 @@ name: agent-integration description: > Run all three agent integration phases sequentially: research, write-tests,
- and implement. For individual phases, use /agent-integration:research,
- and implement using E2E-first TDD (unit tests written last).
- For individual phases, use /agent-integration:research,
/agent-integration:write-tests, or /agent-integration:implement.
Use when the user says "integrate agent", "add agent support", or wants
to run the full agent integration pipeline end-to-end.
@@ -41,6 +42,17 @@ This skill targets hook-capable agents — those that support lifecycle hook
(implementing
FileWatcher) require a different integration approach not covered here. Checkagent.gofor the current interface definitions.
+## Core Rule: E2E-First TDD + +This skill enforces strict E2E-first test-driven development. The rules: + +1. E2E tests are the spec. The existing
ForEachAgenttest scenarios define what "working" means. The agent runner makes those tests runnable for the new agent. +2. Run E2E tests at every step. Each implementation tier starts by running the E2E test and watching it fail. You implement until it passes. No exceptions. +3. Unit tests are written last. After all E2E tiers pass (Step 14), you write unit tests using real data collected from E2E runs as golden fixtures. +4. If you didn't watch it fail, you don't know if it tests the right thing. Never write a test you haven't seen fail first. +5. Minimum viable fix. At each E2E failure, implement only the code needed to fix that failure. Don't anticipate future tiers. +6./debug-e2eis your debugger. When an E2E test fails, use the artifact directory with/debug-e2ebefore guessing at fixes. +Pipeline
Run these three phases in order. Each phase builds on the previous phase's output. @@ -55,21 +67,21 @@ Read and follow the research procedure from `.claude/skills/agent-integration/re
Gate: If the verdict is INCOMPATIBLE, stop and discuss with the user before proceeding.
-### Phase 2: Write Tests +### Phase 2: Write E2E Runner
-Generate the E2E test suite using the one-pager for agent-specific information (binary name, CLI flags, interactive mode support). +Create the E2E agent runner so existing test scenarios can exercise the new agent. No unit tests are written in this phase — no new test scenarios either (existing
ForEachAgenttests are the spec).-Read and follow the write-tests procedure from
.claude/skills/agent-integration/test-writer.md. +Read and follow the procedure from.claude/skills/agent-integration/test-writer.md.-Expected output: E2E agent runner at
e2e/agents/$AGENT_SLUG.goand any agent-specific test scenarios. +Expected output: E2E agent runner ate2e/agents/$AGENT_SLUG.gothat compiles and registers with the test framework.-### Phase 3: Implement +### Phase 3: Implement (E2E-First, Unit Tests Last)
-Build the Go agent package using E2E-driven development. Reads internal Entire docs (agent-guide, checklist, interfaces) and uses the one-pager for all agent-specific details (hook format, transcript location, config structure). +Build the Go agent package using strict E2E-first TDD. E2E tests drive development at every step — run each tier, watch it fail, implement the minimum fix, repeat. Unit tests are written only after all E2E tiers pass, using real data from E2E runs as golden fixtures.
Read and follow the implement procedure from
.claude/skills/agent-integration/implementer.md.-Expected output: Complete agent package at
cmd/entire/cli/agent/$AGENT_PACKAGE/with all tests passing. +Expected output: Complete agent package atcmd/entire/cli/agent/$AGENT_PACKAGE/with all E2E tiers passing and unit tests locking in behavior.Note:
AGENT.mdis a living document — Phases 2 and 3 update it when they discover new information during testing or implementation.diff --git a/.claude/skills/agent-integration/implementer.md b/.claude/skills/agent-integration/implementer.md index d09d2c7d..bd840880 100644 --- a/.claude/skills/agent-integration/implementer.md +++ b/.claude/skills/agent-integration/implementer.md @@ -1,6 +1,6 @@
Implement Command
-Build the agent Go package using E2E-driven development. E2E tests are the primary spec — unit tests are written after each E2E test passes to lock in behavior. +Build the agent Go package using strict E2E-first TDD. Unit tests are written ONLY after all E2E tests pass.
Prerequisites
@@ -8,6 +8,18 @@ Build the agent Go package using E2E-driven development. E2E tests are the prima
- The E2E test runner already added (from
write-testscommand) - If no one-pager exists, read the agent's docs and ask the user about hook events, transcript format, and config
+## Core Principle: E2E-First TDD + +1. E2E tests are the spec. The existing
ForEachAgenttest scenarios define "working". You implement until they pass. +2. Watch it fail first. Every E2E tier starts by running the test and observing the failure. If you haven't seen the failure, you don't understand what needs fixing. +3. Minimum viable fix. At each failure, implement only the code needed to make that specific assertion pass. Don't anticipate future tiers. +4./debug-e2eis your debugger. When an E2E test fails, use the artifact directory with/debug-e2ebefore guessing at fixes. +5. No unit tests during Steps 4-13. Unit tests are written in Step 14 after all E2E tiers pass, using real data from E2E runs as golden fixtures. +6. Format and lint, don't unit test. Between E2E tiers, runmise run fmt && mise run lintto keep code clean. Nomise run testuntil Step 14. +7. If you didn't watch it fail, you don't know if it tests the right thing. + +Do NOT write unit tests during Steps 4-13. All test writing is consolidated in Step 14. +Procedure
Step 1: Read Implementation Guide
@@ -67,18 +79,13 @@ This test requires no agent prompts — it only exercises hooks, so it's the fas
Cycle:
-1. Run:
mise run test:e2e:$AGENT_SLUG TestHumanOnlyChangesAndCommits-2. Read the failure output carefully +1. Run:mise run test:e2e --agent $AGENT_SLUG TestHumanOnlyChangesAndCommits+2. Watch it fail — read the failure output carefully 3. If there are artifact dirs, use/debug-e2e {artifact-dir}to understand what happened 4. Implement the minimum code to fix the first failure 5. Repeat until the test passes-After passing, write unit tests:
--
hooks_test.go— TestInstallHooks(creates config, idempotent),UninstallHooks(removes hooks),AreHooksInstalled(detects presence). Use a temp directory to avoid touching real config. --lifecycle_test.go(initial) — TestParseHookEventfor the event types exercised so far. Include nil return for unknown hook names and malformed JSON input. Important: Test againstEventTypeconstants fromevent.go, not native hook names — the agent's native hook verbs (e.g., "stop") map to normalized EventTypes (e.g.,TurnEnd).-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 5: E2E Tier 2 —
TestSingleSessionManualCommit@@ -92,19 +99,13 @@ The foundational test. This exercises the full agent lifecycle: start session
Cycle:
-1. Run:
mise run test:e2e:$AGENT_SLUG TestSingleSessionManualCommit-2. Read the failure output carefully +1. Run:mise run test:e2e -agent $AGENT_SLUG TestSingleSessionManualCommit+2. Watch it fail — read the failure output carefully 3. Use/debug-e2e {artifact-dir}to understand what happened 4. Implement the minimum code to fix the first failure 5. Repeat until the test passes-After passing, write unit tests:
--
types_test.go— Test hook input struct parsing with actual JSON payloads fromAGENT.mdexamples or captured payloads. --lifecycle_test.go(complete) — TestParseHookEventfor all 4 event types. Use actual JSON payloads. Test everyEventTypemapping, nil returns for pass-through hooks, empty input, and malformed JSON. --transcript_test.go— TestReadTranscript,ChunkTranscript,ReassembleTranscriptwith sample data in the agent's native format. Test allTranscriptAnalyzermethods (fromagent.go) if implemented.-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 6: E2E Tier 2b —
TestCheckpointMetadataDeepValidation@@ -118,13 +119,12 @@ Validates transcript quality: JSONL validity, content hash correctness, prompt e
Cycle:
-1. Run:
mise run test:e2e:$AGENT_SLUG TestCheckpointMetadataDeepValidation-2. Use/debug-e2e {artifact-dir}on any failures — this test often exposes subtle transcript formatting bugs -3. Fix and repeat +1. Run:mise run test:e2e --agent $AGENT_SLUG TestCheckpointMetadataDeepValidation+2. Watch it fail — this test often exposes subtle transcript formatting bugs +3. Use/debug-e2e {artifact-dir}on any failures +4. Fix and repeat-After passing: Update
transcript_test.goif any edge cases were discovered.-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 7: E2E Tier 3 —
TestSingleSessionAgentCommitInTurn@@ -137,13 +137,11 @@ Agent creates files and commits them within a single prompt turn. Tests the in-t
Cycle:
-1. Run:
mise run test:e2e:$AGENT_SLUG TestSingleSessionAgentCommitInTurn-2. Use/debug-e2e {artifact-dir}on failures +1. Run:mise run test:e2e --agent $AGENT_SLUG TestSingleSessionAgentCommitInTurn+2. Watch it fail — use/debug-e2e {artifact-dir}on failures 3. Fix and repeat — if the agent doesn't support committing, skip this test-After passing: Add any new edge cases to existing unit tests if bugs were found.
-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 8: E2E Tier 4 — Multi-Session Tests
@@ -156,13 +154,13 @@ Run these tests to validate multi-session behavior: Cycle (for each test):
- Run:
mise run test:e2e:$AGENT_SLUG TestMultiSessionManualCommit-2. Use/debug-e2e {artifact-dir}on failures +2. Watch it fail — use/debug-e2e {artifact-dir}on failures - Fix and repeat
- Move to next test
-After all pass: These tests rarely need new agent code — they exercise the strategy layer. Update unit tests only if agent-specific bugs were found. +These tests rarely need new agent code — they exercise the strategy layer.
-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 9: E2E Tier 5 — File Operation Edge Cases
@@ -173,11 +171,9 @@ Run these tests for file operation correctness:
TestDeletedFilesCommitDeletion— Agent deletes a file, user commits the deletionTestMixedNewAndModifiedFiles— Agent both creates and modifies files
-Cycle: Same as above — run each test, use
/debug-e2eon failures, fix, repeat. +Cycle: Same as above — run each test, watch it fail, use/debug-e2eon failures, fix, repeat.-After all pass: Update unit tests if any transcript parsing or file-touched extraction bugs were discovered.
-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 10: Optional Interfaces
@@ -190,10 +186,9 @@ Read
cmd/entire/cli/agent/agent.gofor all optional interfaces. For each one t For each optional interface:- Implement the methods based on
AGENT.mdand reference implementation -2. Write unit tests for the new methods -3. Run relevant E2E tests to verify integration +2. Run relevant E2E tests to verify integration (e.g.,TestCheckpointMetadataDeepValidationfor transcript methods)
-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 11: E2E Tier 6 — Interactive and Rewind Tests
@@ -204,9 +199,9 @@ Run these if the agent supports interactive multi-step sessions:
TestRewindAfterCommit— Rewind to a checkpoint after committingTestRewindMultipleFiles— Rewind with multiple files changed
-Cycle: Same pattern — run,
/debug-e2eon failures, fix, repeat. +Cycle: Same pattern — run, watch it fail,/debug-e2eon failures, fix, repeat.-Run:
mise run fmt && mise run lint && mise run test+Run:mise run fmt && mise run lintStep 12: E2E Tier 7 — Complex Scenarios
@@ -219,11 +214,47 @@ Run the remaining edge case and stress tests:
TestSubagentCommitFlow— If the agent has subagent supportTestSingleSessionSubagentCommitInTurn— Subagent commits during a turn
-Cycle: Same pattern. Many of these require no new agent code — they exercise strategy-layer behavior. +Cycle: Same pattern — watch it fail, fix, repeat. Many of these require no new agent code — they exercise strategy-layer behavior. + +Run:
mise run fmt && mise run lint+ +### Step 13: Full E2E Suite Pass + +Run the complete E2E suite for the agent to catch any regressions or tests that were skipped in earlier tiers: + +bash +mise run test:e2e --agent $AGENT_SLUG ++ +This runs everyForEachAgenttest, not just the ones targeted in Steps 4-12. Fix any failures before proceeding — the same cycle applies: read the failure, use/debug-e2e {artifact-dir}, implement the minimum fix, re-run. + +All E2E tests must pass before writing unit tests. + +### Step 14: Write Unit Tests + +Now that all E2E tiers pass, write unit tests to lock in behavior. Use real data from E2E runs (captured JSON payloads, transcript snippets, config file contents) as golden fixtures. + +Test files to create: + +1.hooks_test.go— TestInstallHooks(creates config, idempotent),UninstallHooks(removes hooks),AreHooksInstalled(detects presence). Use a temp directory to avoid touching real config. + +2.lifecycle_test.go— TestParseHookEventfor all event types. Use actual JSON payloads from E2E artifacts orAGENT.mdexamples. Test everyEventTypemapping, nil returns for unknown hook names, pass-through hooks, empty input, and malformed JSON. Important: Test againstEventTypeconstants fromevent.go, not native hook names — the agent's native hook verbs (e.g., "stop") map to normalized EventTypes (e.g.,TurnEnd). + +3.types_test.go— Test hook input struct parsing with actual JSON payloads from E2E artifacts orAGENT.mdexamples. + +4.transcript_test.go— TestReadTranscript,ChunkTranscript,ReassembleTranscriptwith sample data in the agent's native format. Test allTranscriptAnalyzermethods (fromagent.go) if implemented. Use transcript snippets from E2E artifact directories as golden test data. + +5.${AGENT_PACKAGE}_test.go— Test agent constructor (New),Name(),AgentName(), and any other agent-level methods. Verify the agent satisfies all expected interfaces using compile-time checks (). + + + +- E2E artifact directories contain captured transcripts, hook payloads, and config files +- has example JSON payloads in the "Hook input" sections +- The agent's actual config file format from E2E test reposRun:
mise run fmt && mise run lint && mise run test-### Step 13: Verify Registration +### Step 15: Verify Registration
Verify that registration from Step 3 is correct and complete:
@@ -231,7 +262,7 @@ Verify that registration from Step 3 is correct and complete: 2. The blank import in
cmd/entire/cli/hooks_cmd.gois present 3. Run the full test suite:mise run test:ci-### Step 14: Final Validation +### Step 16: Final Validation
Run the complete validation:
@@ -275,7 +306,7 @@ Summarize what was implemented:
- Package directory and files created
- Interfaces implemented (core + optional)
- Hook names registered -- Test coverage (number of test functions, what they cover) +- E2E tiers passing (list which E2E tests pass) +- Unit test coverage (number of test functions, what they cover — written in Step 13)
- Any gaps or TODOs remaining -- E2E tests passing (list which ones pass)
- Commands to run full validation diff --git a/.claude/skills/agent-integration/test-writer.md b/.claude/skills/agent-integration/test-writer.md index a6f1cefd..219f2ea7 100644 --- a/.claude/skills/agent-integration/test-writer.md +++ b/.claude/skills/agent-integration/test-writer.md @@ -1,6 +1,6 @@
Write-Tests Command
-Generate the E2E test suite for a new agent integration. Uses the implementation one-pager (
AGENT.md) and the existing E2E test infrastructure. +Create the E2E agent runner only — no unit tests, no new test scenarios. The runner registers the agent with the E2E framework so existingForEachAgenttests can exercise it. Uses the implementation one-pager (AGENT.md) and the existing E2E test infrastructure.Prerequisites
@@ -170,64 +170,15 @@ Check if
testutil.SetupRepoine2e/testutil/repo.goneeds agent-specific conIf no special setup is needed, skip this step.
-### Step 6: Write E2E Test Scenarios +### Step 6: Verify
-Existing tests are agent-agnostic (they use
ForEachAgent), so they should already work with the new agent. Only create new test files if the agent has unique behaviors that existing scenarios don't cover.-Check if all existing scenarios work by reviewing: -- Does the agent support non-interactive prompt mode? (required for
RunPrompt) -- Does the agent create files when prompted? (required for basic workflow) -- Does the agent support git operations? (required for commit scenarios) -- Does the agent support interactive mode? (required for interactive tests — can return nil fromStartSession)-If the agent has unique behaviors, create new test files in
e2e/tests/:-```go -//go:build e2e
-package tests
-import (
- "context"
- "testing"
- "time"
- "github.com/entireio/cli/e2e/testutil" -)
-func TestAgentSpecificBehavior(t *testing.T) {
- testutil.ForEachAgent(t, 2*time.Minute, func(t *testing.T, s *testutil.RepoState, ctx context.Context) {
-
code
// Skip for agents that don't apply -
code
if s.Agent.Name() != "${agent-slug}" { -
code
t.Skip("only applies to ${agent-slug}") -
code
} -
code
// Use s.RunPrompt for non-interactive, s.StartSession for interactive -
code
_, err := s.RunPrompt(t, ctx, -
code
"create a file at hello.txt with 'hello world'. Do not ask for confirmation.") -
code
if err != nil { -
code
t.Fatalf("agent failed: %v", err) -
code
} -
code
testutil.AssertFileExists(t, s.Dir, "hello.txt") - }) -} -```
-See
e2e/README.mdfor the canonical reference on structure, debugging, and CI workflows.-### Step 7: Verify
-After writing the code: +After writing the runner code:
- Lint check:
mise run lint— ensure no lint errors -2. Compile check:go test -c -tags=e2e ./e2e/tests— compile-only with the build tag to verify the code compiles -3. List what to run: Print the exact E2E commands but do NOT run them (they cost money):
-
bash
- mise run test:e2e:${agent_slug} TestSingleSessionManualCommit
-
code
-4. Debug failures: If tests fail, use
/debug-e2e {artifact-dir}to diagnose — artifacts are auto-captured toe2e/artifacts/{timestamp}/-5. Add mise task: Remind the user to add atest:e2e:${agent_slug}task inmise.tomland update CI workflows +2. Compile check:go test -c -tags=e2e ./e2e/tests— compile-only with the build tag to verify the runner compiles and registers +3. Verify registration: The runner'sinit()callsRegister()and will be picked up byForEachAgentin existing tests +4. Add mise task: Remind the user to add atest:e2e:${agent_slug}task inmise.tomland update CI workflows +5. Next step: The implement phase will run E2E tests against this runner — that's where failures are diagnosed and fixedKey Conventions
@@ -242,16 +193,15 @@ After writing the code:
- Console logging: All operations through
s.RunPrompt,s.Git,s.Send,s.WaitForare automatically logged toconsole.log - Transient errors:
s.RunPromptauto-retries once on transient API errors viaIsTransientError - Interactive tests: Use
s.StartSession,s.Send,s.WaitFor— tmux pane is auto-captured in artifacts -- Run commands:mise run test:e2e:${slug} TestName— seee2e/README.mdfor all options -- Do NOT run E2E tests: They make real API calls. Only write the code and print commands. -- Debugging failures: If the user runs tests and they fail, use/debug-e2ewith the artifact directory to diagnose CLI-level issues (hooks, checkpoints, session phases, attribution) +- Run commands:mise run test:e2e --agent ${slug} TestName— seee2e/README.mdfor all options +- E2E tests are run during the implement phase: This phase only creates the runner. The implement phase runs E2E tests at each tier to drive development. +- Debugging failures: If tests fail during the implement phase, use/debug-e2ewith the artifact directory to diagnose CLI-level issues (hooks, checkpoints, session phases, attribution)
Output
Summarize what was created/modified:
- Files added or modified
-- New agent implementation details (how it invokes the agent, auth setup, concurrency gate)
-- Any agent-specific test scenarios added
-- Commands to run the tests (for user to execute manually)
-- If tests fail, suggest using
/debug-e2e {artifact-dir}for root cause analysis +- New agent runner details (how it invokes the agent, auth setup, concurrency gate) +- Confirmation that the runner compiles and registers with the E2E framework - Reminder to update
mise.tomland CI workflows +- Note that the implement phase will run E2E tests against this runner - Current branch: alisha/kiro-oneshot
- Recent commits: c38e2171 Add Kiro agent integration 3e70f85b Merge branch 'main' into alisha/kiro-oneshot 81ddee25 Merge pull request #544 from entireio/soph/release-0-4-8 65897b98 credits for cursor community pr 94e9f456 changelog for 0.4.8 0c6c9b57 Merge pull request #538 from entireio/gtrrz-victor/replace-fmt-with-log-inside-agent-hooks 659d8585 add err structued to logging abd10d34 Merge branch 'main' into gtrrz-victor/replace-fmt-with-log-inside-agent-hooks edc1d626 Merge pull request #542 from entireio/rwr/break-agent-import-loop dc9b86d3 Merge pull request #540 from entireio/fix/opencode-xdg-isolation
Your task
Based on the above changes, create a single git commit.
You have the capability to call multiple tools in a single response. Stage and create the commit using a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.