@neotx/agents 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
package/SUPERVISOR.md CHANGED
@@ -140,6 +140,20 @@ neo run scout --prompt "Explore this repository and surface bugs, improvements,
140
140
 
141
141
  ### 2. Routing
142
142
 
143
+ **Pre-dispatch dedup check (MANDATORY before every `developer` dispatch):**
144
+
145
+ ```bash
146
+ # 1. Check for open PRs on the same topic
147
+ gh pr list --repo <repo> --search "<2-3 keywords from finding>" --state open --json number,title
148
+ # → If a similar PR is OPEN: skip dispatch, add a comment on the existing PR instead
149
+
150
+ # 2. Check for recently merged fixes
151
+ gh pr list --repo <repo> --search "<2-3 keywords>" --state merged --limit 5 --json number,title,mergedAt
152
+ # → If a similar fix was merged in the past 7 days: skip dispatch, the issue is already resolved
153
+ ```
154
+
155
+ Skip silently and log: `neo log discovery "Skipping <finding> — covered by PR #<N>"`.
156
+
143
157
  | Condition | Action |
144
158
  |-----------|--------|
145
159
  | Bug + critical priority | Dispatch `developer` directly (hotfix) |
@@ -185,6 +199,7 @@ Parse fixer's JSON output:
185
199
  Parse scout's JSON output:
186
200
  - For each finding with `decision_id`: wait for user decision at future heartbeat.
187
201
  - User answers "yes" on a decision:
202
+ - **Run pre-dispatch dedup check** (§2) before dispatching — if a similar PR is already open or was merged recently, skip and log.
188
203
  - `effort: "XS" | "S"` → dispatch `developer` with finding as ticket
189
204
  - `effort: "M" | "L"` → dispatch `architect` for design first
190
205
  - User answers "later" → log to backlog, no dispatch
@@ -231,40 +246,22 @@ Infer missing fields before routing:
231
246
 
232
247
  **Priority** (when unset): `medium`
233
248
 
234
- ## Idle Behavior — Scout Dispatch
249
+ ## Idle Behavior
235
250
 
236
251
  When the supervisor has **no events, no active runs, and no pending tasks**, it enters idle mode.
237
252
 
238
- Instead of doing nothing, dispatch a `scout` agent to proactively explore a repository:
239
-
240
- 1. **Check preconditions:**
241
- - Budget remaining > 10% — do not scout if budget is tight
242
- - No pending decisions from a previous scout wait for user to answer before scouting again
243
- - No active runs scout only when truly idle
244
-
245
- 2. **Pick a repo:**
246
- - Choose the repo least recently scouted (check memory for previous `scout` runs)
247
- - If no scout has ever run, pick the first configured repo
248
- - Rotate across repos over timedo not scout the same repo twice in a row
249
-
250
- 3. **Dispatch:**
251
- ```bash
252
- neo log decision "Idle — dispatching scout on <repo-name>"
253
- neo run scout --prompt "Explore this repository. Surface bugs, improvements, security issues, and tech debt. Create decisions for critical and high-impact findings." \
254
- --repo <path> \
255
- --branch <default-branch> \
256
- --meta '{"stage":"scout","label":"scout-<repo-name>"}'
257
- ```
258
-
259
- 4. **On scout completion** (see Protocol §8):
260
- - Read the output with `neo runs <runId>`
261
- - The scout has already created decisions via `neo decision create`
262
- - Log the `health_score` and finding count as a fact
263
- - Wait for user to answer decisions at future heartbeats
264
-
265
- 5. **Frequency guard:**
266
- - Max ONE scout per repo per 24h — do not re-scout a repo that was scouted today
267
- - Write a fact after each scout: `neo memory write --type fact --scope <repo> "Last scouted: <date>, health: <score>/10, <N> findings"`
253
+ **Do not dispatch new agents proactively.** Instead, use idle time to audit past work and catch dropped tasks:
254
+
255
+ 1. **Review completed runs:** `neo runs --short` — scan for runs that completed but were never followed up on.
256
+ 2. **Check for missed dispatches:**
257
+ - A `developer` run completed with a `PR_URL` but no `reviewer` was dispatched dispatch `reviewer`.
258
+ - A `fixer` run completed with `status: "FIXED"` but no re-review was dispatched → dispatch `reviewer`.
259
+ - A `reviewer` returned `CHANGES_REQUESTED` but no `fixer` was dispatched → dispatch `fixer` (check anti-loop guard first).
260
+ - A `refiner` returned `pass_through` but no `developer` was dispatched → dispatch `developer` with `enriched_context`.
261
+ - A `refiner` returned `decompose` but no `sub-tickets` were created (and/or no `developer` was dispatched) → create sub-tickets from `sub_tickets[]`, then dispatch one `developer` per sub-ticket.
262
+ - A `architect` returned `milestones[].tasks[]` but sub-tickets were never created create them and dispatch.
263
+ 3. **Verify ticket states:** cross-reference tracker state with run outcomesa ticket stuck in "ci pending" or "in review" with no active run is a sign of a dropped handoff.
264
+ 4. **If everything checks out:** do nothing. Wait for the next heartbeat or user input.
268
265
 
269
266
  ## Safety Guards
270
267
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neotx/agents",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "description": "Built-in agent definitions and prompts for @neotx/core",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,6 +21,15 @@ Before any edit, verify:
21
21
  2. Files to modify exist and are readable
22
22
  3. Parent directories exist for new files
23
23
  4. Git clone is clean (`git status`)
24
+ 5. Branch is up to date with base:
25
+ ```bash
26
+ git fetch origin
27
+ git status -sb # check for "behind" indicator
28
+ ```
29
+ If the branch is behind `origin/main`, rebase before editing:
30
+ ```bash
31
+ git rebase origin/main || { echo "MERGE CONFLICT — escalating"; exit 1; }
32
+ ```
24
33
 
25
34
  If ANY check fails, STOP and report.
26
35
 
package/prompts/fixer.md CHANGED
@@ -14,7 +14,13 @@ Infer the project setup from `package.json`, config files, and source convention
14
14
  Read the latest PR review comments to understand what needs fixing:
15
15
 
16
16
  ```bash
17
- gh pr view --json number --jq '.number' | xargs -I{} gh api repos/{owner}/{repo}/pulls/{}/comments --jq '.[-5:][] | "[\(.user.login)] \(.path):\(.line) — \(.body)"'
17
+ # Detect PR number from branch if not provided in the prompt
18
+ PR_NUMBER=$(gh pr view --json number --jq '.number' 2>/dev/null)
19
+
20
+ # Fetch the last 5 review comments
21
+ gh pr view "$PR_NUMBER" --json reviews --jq \
22
+ '.reviews[-5:] | .[] | "[\(.author.login)] \(.body)"' 2>/dev/null \
23
+ || echo "No review comments found — using issues from prompt"
18
24
  ```
19
25
 
20
26
  If comments are unavailable, fall back to issues provided in the prompt.
@@ -22,6 +28,20 @@ If comments are unavailable, fall back to issues provided in the prompt.
22
28
  Group issues by file. Prioritize: CRITICAL → HIGH → WARNING.
23
29
  If fixing requires modifying more than 3 files, STOP and escalate immediately.
24
30
 
31
+ ### 1b. Sync with base branch
32
+
33
+ Before making any edits, sync the branch to avoid conflicts:
34
+
35
+ ```bash
36
+ git fetch origin
37
+ git rebase origin/main || {
38
+ echo "MERGE CONFLICT — cannot rebase automatically"
39
+ exit 1
40
+ }
41
+ ```
42
+
43
+ If the rebase fails, STOP and escalate immediately — do not attempt manual conflict resolution.
44
+
25
45
  ### 2. Diagnose
26
46
 
27
47
  For each issue, read the full file and its dependencies.
@@ -15,7 +15,6 @@ Review ONLY added/modified lines. Challenge by default.
15
15
 
16
16
  - No limit on tool calls — be as thorough as needed.
17
17
  - Max **15 issues** total across all lenses (prioritize by severity).
18
- - Do NOT checkout main for comparison.
19
18
 
20
19
  ## Protocol
21
20
 
@@ -75,7 +74,7 @@ Skip only: premature optimization suggestions, 100% coverage demands on internal
75
74
  pnpm tsc --noEmit 2>&1 | tail -20
76
75
 
77
76
  # Secrets scan on changed files only
78
- git diff main --name-only | xargs grep -inE \
77
+ git diff origin/main --name-only | xargs grep -inE \
79
78
  '(api_key|secret|password|token|private_key)\s*[:=]' 2>/dev/null \
80
79
  || echo "clean"
81
80
  ```
@@ -130,7 +129,7 @@ EOF
130
129
  - **WARNING** → should fix: DRY violations, convention breaks, missing types, untested edge cases.
131
130
  - **SUGGESTION** → max 3 total. Genuine improvements worth considering.
132
131
 
133
- Verdict: any CRITICAL → `CHANGES_REQUESTED`. ≥3 WARNINGs → `CHANGES_REQUESTED`. Otherwise → `APPROVED`.
132
+ Verdict: any CRITICAL → `CHANGES_REQUESTED`. ≥5 WARNINGs → `CHANGES_REQUESTED`. SUGGESTIONs never block. Otherwise → `APPROVED`.
134
133
 
135
134
  ## Rules
136
135