Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/agent-skill-trigger-index/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
These skills are not captain-invocable; load them only at their precise triggers.

- `bootstrap-diagnostics` - load whenever the session-start digest's bootstrap or network-checks section prints an actionable diagnostic line (`MISSING:`, `MISSING_MANUAL:`, `PRESENTATION_UNAVAILABLE:`, `BACKEND_INVALID:`, `NEEDS_GH_AUTH`, `TANGLE:`, `STARTUP_MEMORY_BUDGET:`, `CREW_DISPATCH: invalid`, `FLEET_SYNC:`, `NETWORK_CHECKS:`, `HOME_SUMMARY:`, `BACKLOG_RECONCILE:`, `SECONDMATE_SYNC:`, `SECONDMATE_LIVENESS:`, `SECONDMATE_HANDOFF:`, `NUDGE_SECONDMATES:`, or `FMX:`), or when `BOOTSTRAP_INFO:` says an interrupted backlog cleanup may have left an endpoint or local copy; silence and other `BOOTSTRAP_INFO:` facts need no load.
- `diagnostic-reasoning` - load before scoping a reported bug and before acting on a diagnostic report.
- `diagnostic-reasoning` - load before scoping a reported bug and before acting on a diagnostic report, when the captain asks what agents keep getting wrong or for a repeat-mistake sweep, and when a second instance of an already-seen mistake class surfaces.
- `ask-user-authority` - load before deciding any ask-user finding.
- `quota-array-dispatch` - load before choosing among a matched crew-dispatch profile array from current quota-axi default TOON.
- `harness-adapters` - load before spawning or recovering a crewmate or secondmate, handling a trust dialog, sending a harness-specific skill invocation, interrupting or exiting an agent, resuming an exited agent, or verifying a new harness adapter.
Expand Down
43 changes: 41 additions & 2 deletions .agents/skills/diagnostic-reasoning/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: diagnostic-reasoning
description: >-
Agent-only procedure for diagnosing reported bugs.
Agent-only procedure for diagnosing reported bugs and recurring mistakes.
Use before scoping a reported bug and before acting on a diagnostic report.
Owns end-user-aligned reproduction, causal separation, divergent-path and history inspection, counterfactual testing, and disconfirming evidence.
Also use when the captain asks what agents keep getting wrong or for a repeat-mistake sweep, and when a second instance of an already-seen mistake class surfaces.
Owns end-user-aligned reproduction, causal separation, divergent-path and history inspection, counterfactual testing, disconfirming evidence, the strongest-guard-first remedy order, and the repeat-mistake sweep.
user-invocable: false
metadata:
internal: true
Expand Down Expand Up @@ -51,3 +52,41 @@ Before acting on the report, verify that its claimed cause explains the end-user
If a load-bearing element is missing, route a focused follow-up investigation instead of treating confidence or implementation detail as proof.
A diagnosis or implementation-ready recommendation is evidence, not authorization to change code.
Implementation still requires the captain's request or another existing lifecycle authority, and the reproduction should become the regression test when a fix is authorized.

## Recurring mistakes: strongest guard first

When one class of mistake recurs, a one-time fix or a new prose prohibition is the weakest remedy.
Prefer the strongest guard that makes the mistake impossible or loudly rejected, in this order:

1. **Architecture** - change the structure so the mistake cannot be expressed, such as one owner for a contract, one entry point, or removing the option.
2. **Types** - make the wrong shape fail validation, such as a schema, an enum, or a typed interface.
3. **Lint** - add a check whose error message names the fix, in the project's own lint owner.
4. **Behavioral test** - add an executable test that fails on the recorded mistake; the diagnostic reproduction becomes that regression test.
5. **Docs** - use only where no mechanical guard can express the rule, and place it through the `firstmate-coding-guidelines` knowledge-placement tree.

Choose the first rung that would have rejected a recorded instance of the mistake, and name that instance.
A guard that would not have caught a recorded instance is not a remedy.
When a guard already exists and missed the instance, the remedy is repairing that guard.
Stop at the first rung that works rather than stacking several.
Some judgments cannot be reduced to a deterministic check; say so and use the strongest rung that honestly applies.
This ladder only orders remedies, so the diagnosis-is-evidence rule above still holds and every remedy ships through a normal task following normal intake and the project's delivery mode.

## Repeat-mistake sweep

Run the sweep when the captain asks what agents keep getting wrong, or when you notice a second instance of a mistake class while handling other work.
Nothing schedules it automatically.
The sweep reads and files; it never fixes.

1. Read the evidence: `data/learnings.md` and `data/memory-archive.md`, the `state/*.status` events still on disk, scout reports under `data/<id>/report.md`, no-mistakes findings snapshots under `data/<id>/nm-*-findings.txt`, and failed CI runs and review findings on recent task PRs read through `gh-axi`.
2. Group instances into mistake classes by root cause, using the trigger, masking condition, and symptom separation above, not by matching wording.
3. Count evidence per class: list every instance with its source and date.
A class qualifies for a guard at two or more instances from different tasks.
4. For each qualifying class, pick the ladder rung, name the recorded instance it would have rejected, and name any existing guard that missed.
5. File each proposed guard as an ordinary backlog task following the configured-backend contract in [`docs/configuration.md`](../../../docs/configuration.md#required-tools-and-manual-mode), after checking the backlog for an existing item on the same class.
Use `bin/fm-tasks-axi.sh add` for tasks-axi homes and the documented manual path for manual homes.
Dispatch follows normal intake and the project's delivery mode.
Never fix inline, and never edit a project's `AGENTS.md` or `CLAUDE.md`; guidance for firstmate's own material goes through `firstmate-coding-guidelines`.
6. Report only qualifying classes with their evidence counts, chosen rungs, and filed task ids.
Keep nonqualifying classes out of the entire final response: do not name or describe them, even in exclusion notes or explanations of why they did not qualify.

A learnings entry records the gotcha until a guard lands; it is never the remedy for a class that qualified for one.
Loading