# Discovery Step for Auto-Improvement

Reads focus files and returns testable code surfaces as a JSON list, without changing code.

- Repository: https://github.com/kirodotdev/KiroCrew (4711 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add kirodotdev/KiroCrew --skill ai-discover -g -a claude-code -y`
Codex: `npx skills add kirodotdev/KiroCrew --skill ai-discover -g -a codex -y`
Cursor: `npx skills add kirodotdev/KiroCrew --skill ai-discover -g -a cursor -y`
Gemini CLI: `npx skills add kirodotdev/KiroCrew --skill ai-discover -g -a gemini-cli -y`

## Description

Read-only discovery step of the auto-improvement loop. One bounded agent turn per cycle reads the focus files (Read/Grep/Glob only, no shell, no subagents) and replies with a JSON array of testable surfaces {file, line, symbol, rule, message, hypothesis}; the spine authors fixes and verifies them. Discovery only, no code changes and no verification happen here.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# ai-discover, the discovery step of the auto-improvement loop

This skill drives Phase A (discovery) of an auto-improvement cycle. It is
**discovery only**: it never applies a change, never runs the keep-or-revert A/B,
and never decides whether a finding is kept or drafted as a pull request. Those
are the spine's **deterministic Python** gate / keeper / pipeline, which no model
can argue past. That separation is the point, the measurement is the product.

## How discovery actually runs

The spine runs discovery as ONE bounded agent turn per cycle
(`spine/agent_discovery.py` `discover_surfaces_via_agent`), not a fan-out. Do
NOT spawn subagents: the turn must end with the JSON array itself, and children
spawned from an unattended runner orphan and hang the run (see the
`SessionAgentRunner` notes in `spine/agent_runner.py`).

- Tools are Read, Grep and Glob only. There is no shell and no edit: discovery
  is read-only by capability, so you cannot run a profiler or write a test here.
- Read the priority slice you are given, stop after 2-3 solid findings or the
  read budget, and reply with ONLY a JSON array (at most the stated limit) of
  `{file, line, symbol, rule, message, hypothesis}`, `rule` is `AGENT`, or
  `COVERAGE` for a coverage gap. Reply `[]` when nothing is testable. The final
  reply IS the output; there is no separate artifact file.
- The same surface shape feeds both tracks. On the bug track the profile names
  the reproducing test path and `author_bug_fix` later writes the RED test and
  the fix in an isolated worktree; on the perf track `author_perf_fix` writes the
  edit. The spine dedups by `(kind, basename::symbol)` locus, then gates
  (RED -> GREEN -> STAYGREEN for bugs, serial pinned A/B for perf).

## Reporting a candidate honestly

The rest: https://github.com/kirodotdev/KiroCrew/blob/HEAD/src/kiro_crew/apps/builtins/auto_improvement/skills/ai-discover/SKILL.md
