Ai agents research methodology

From rjmurillo/ai-agents · View interactive version

Ai agents research methodology is an AI agent skill from the GitHub repository rjmurillo/ai-agents. How a hunch becomes an accepted result in this repo. Covers the evidence bar, hypothesis-predicts-numbers discipline, and the idea lifecycle from contradiction log through probe, eval baseline, ADR debate, calibrated gate, and post-ship monitoring. Use when you say `how do I prove this idea`, `run t

How to use this skill

Skill file

AI Agents Research Methodology

<!-- vendor-portability: contributor-facing knowledge pack for the rjmurillo/ai-agents repo itself; intentionally references upstream paths because its audience is repo contributors, not plugin consumers. Declared paths: .agents/governance/FAILURE-MODES.md, .project-toolkit/architecture/ADR-069-context-corpus-is-the-product.md, .project-toolkit/retrospective, .project-toolkit/retrospective/2026-05-10-pr-1989-recursive-failure.md, .project-toolkit/retrospective/2026-06-02-pr-2205-customer-wedge-incident.md, scripts/eval/eval-prompt-change.py, scripts/validation/check_citation_freshness.py -->

This repo runs on verification-based governance: labels like "MANDATORY" or

"NON-NEGOTIABLE" are insufficient, every requirement needs a verification

mechanism. The same standard applies to ideas. An idea is not accepted because it sounds

right, because a model agreed with it, or because a retro asserted it. It is

accepted when it survives the lifecycle below and leaves an inspectable

artifact at every stage.

This skill is the discipline. For the specific probe recipes, use

ai-agents-empirical-probe-toolkit. For the three open research programs, use

ai-agents-research-frontier. For the archive of past settled results, use

ai-agents-failure-archaeology.

Triggers

The Evidence Bar

A result is accepted here when ONE mechanism explains ALL observations,

including the negative ones, and the explanation survives adversarial

refutation. Partial explanations that cover only the confirming observations

are hypotheses, not results.

The cautionary tale is the recursive-failure PR. Mitigation M1 was built on a root-cause claim

inherited from a retro RCA that nobody re-verified: the RCA said pagination was

missing, but get_unresolved_review_threads.py already paginated correctly

(.project-toolkit/retrospective/2026-05-10-pr-1989-recursive-failure.md:20). Five

commits were spent building on the false premise. The mechanism-check that

would have caught it costs one file read.

Map each claim type to the adversarial machinery that already exists. Do not

invent a new review ritual; route into these:

| Claim type | Adversarial mechanism | How to invoke |

|---|---|---|

| Architectural decision (ADR) | adr-review 6-agent debate (architect, critic, independent-thinker, security, analyst, high-level-advisor) until consensus, 10 rounds max | Auto-fires on any ADR-*.md create/edit (AGENTS.md:13, "ADR review: debate log required"); or /adr-review path |

| A single decision's reasoning | decision-critic skill | Say Poke holes in this decision or Validate my thinking on ... |

| Contrarian read of a plan | independent-thinker or critic agent (.claude/agents/) | Task tool with that subagent_type |

| Strategic build/buy/defer | buy-vs-build-framework (Quick tier: 1-2 hours) | Required gate for new capabilities, see Phase 3 |

| "Why does this constraint exist" | chestertons-fence | Before proposing removal of anything settled |

| Behavioral claim about a prompt or rule | Eval harness (ADR-057) | See Predict Numbers Before Running |

| Prose claims in the write-up | prose-self-check, doc-accuracy | Before emitting the artifact |

Predict Numbers Before Running

Write the predicted outcome down BEFORE running the measurement. A prediction

made after seeing the data is a description, not a test. Concretely:

  1. State the hypothesis and the number it predicts (pass-rate delta,

activation score, firing rate) in the session log or spike note.

  1. Validate the setup with zero spend first:

```bash

uv run python scripts/eval/eval-prompt-change.py \

--prompt templates/agents/analyst.shared.md \

--scenarios tests/evals/analyst-scenarios.json \

--base-ref main --dry-run

```

(Both paths exist in-tree; there is no per-skill scenario fixture for every

prompt. Substitute your own prompt path and a real tests/evals/*.json

fixture; ls tests/evals/ lists what is available.)

--dry-run validates inputs and makes no API calls

(scripts/eval/eval-prompt-change.py:962, Validate inputs, no API calls).

It is the only no-spend path; there is no --mock.

  1. Run the real eval, compare against the written prediction, and record both

in the write-up. A miss is a finding, not an embarrassment.

  1. Grade the result before you act on it. A run too small to separate signal

from noise is inconclusive, not a preference. Report the sample size and an

interval or margin with every comparison. A directional delta alone does not

promote an ADR or justify a model pin: rerun it to confirm. ADR-111 rule 2

sets the bar for agent pins (delta, paired bootstrap interval, at least 8

shared fixtures).

Available instruments (all under scripts/eval/, verified 2026-07-03):

eval-prompt-change.py (before/after scenario judgment per ADR-057),

eval-agent-vs-baseline.py (agent prompt vs fixed baseline),

eval-rule-activation.py (does a .claude/rules/*.md file actually change

behavior: baseline vs description-only vs full-body, judged on activation,

citation, behavior). Interpretation guidance lives in

ai-agents-diagnostics-toolkit.

Process

The lifecycle. Every stage produces an artifact; every transition has a gate.

Skipping a stage is how the recursive-failure PR happened.

Phase 1: Hunch, Then Search, Then Contradiction Log

Before building anything, search: this codebase, Serena memories

(memory-search), ADRs, then external docs

(the programming-advisor skill's references/search-before-building.md). Most

hunches die here because the answer already exists; that is a cheap success.

If your first-principles position contradicts the conventional answer (an ADR,

a memory, a canonical pattern), log it before proceeding: Serena memory named

decision-<short-slug> with five fields: question, conventional answer with

citation, first-principles position, evidence, decision. The log is what stops

the next agent from silently reverting your result.

Phase 2: Spike With an Empirical Probe

Turn the hunch into a falsifiable claim and probe it. Rules of the probe

(recipes and worked examples in ai-agents-empirical-probe-toolkit):

the comfortable default environment.

wrong-by-omission docs (customer wedge and payload-format retros in .project-toolkit/retrospective/).

Phase 3: Capability Gate and Eval Baseline

If the idea adds a new capability (Context, module, scanner, validator,

pipeline component), it must pass the buy-vs-build gate BEFORE any spec work.

AGENTS.md:13 lists "new cap buy-vs-build" among the skills a new capability

must pass. Run buy-vs-build-framework at Quick tier (1-2 hours: Core vs

Context, simple TCO, go/no-go).

Then establish the eval baseline using the Predict Numbers discipline above.

An idea with no measurable baseline is a prune candidate; skipping this

phase is what makes it one.

Phase 4: ADR and Debate

If the result changes architecture, policy, or a public contract, write the

ADR with adr-generator. Saving the file fires adr-review automatically:

six agents debate in structured rounds until consensus or 10 rounds. Do not

route around the debate by encoding the decision in a rule file or skill

instead; governance changes need human approval, an ADR, consensus, and a

cited failure mode. Route the change itself through

ai-agents-change-control.

Beware historical trap: ADR numbers have collided. Verify content, not number,

when citing.

Phase 5: Ship as a Gate or Skill, With Calibration

A result becomes enforcement (a hook, a validator, a CI gate) or capability (a

skill via SkillForge). Any threshold-based detector must ship with a

calibration table. The rule, from the recursive-failure retro ("Process Change 3",

.project-toolkit/retrospective/2026-05-10-pr-1989-recursive-failure.md:149-157): show

the threshold, a sample of real PRs measured against it, and the expected

firing rate. "A detector that cannot fire on the last 5 PRs in the repo is not

calibrated." The origin: M4 shipped with threshold 6 in a repo whose busiest

PR had 4 file edits; it could never fire (retro lines 72-73).

Also run the new guard on its own branch before merging. Recursive-failure M5 was a

pre-push guard that was never executed on the branch that shipped it.

Phase 6: Monitor

Enforcement decays. The push guards used to emit EVENT= telemetry lines

(stderr, via push_guard_base.py) that a maturity-tier skill aggregated into

tiers (Budding, Growing, Mature, Proficient, Inert, Harmful) to tell you

whether a gate earned its keep. That emitter, every guard built on it, and the

classifier skill itself were deleted under ADR-084: there is no

producer and no consumer today. The underlying principle still applies to

whatever gate you add next: an Inert gate is a prune candidate for the same

reason as an unbaselined idea. If you build a new detector, ship its own

telemetry and monitoring alongside it; measurement tooling for the surviving

instruments lives in ai-agents-diagnostics-toolkit.

Phase 7: Adopt, or Retire With a Record

Both outcomes are results. Adoption means the artifact set is complete: probe

memory, eval numbers, ADR (if governance), calibrated gate, monitoring hook.

Retirement gets recorded, never silenced. The exemplar is the fail-open wrapper proposal: a

launcher-level fail-open wrapper was proposed, evaluated, and REJECTED as a

silent-failure anti-pattern; the rejection is recorded with rationale in the customer wedge retro decision table

(.project-toolkit/retrospective/2026-06-02-pr-2205-customer-wedge-incident.md:297 and :393) and <!-- citation-freshness: ignore -- historical retro citation; the range predates the context diet -->

the binding principle lives in the repo-local ai-agents-generation-and-release skill's references/rule-generated-artifacts.md. Because

the rejection was written down, nobody re-proposes it. An unrecorded rejection

is a future duplicate proposal.

Lifecycle at a Glance

| Stage | Artifact | Gate to next stage | Who/what approves |

|---|---|---|---|

| 1. Hunch | decision-<slug> Serena memory (contradiction log) | Search done; contradiction logged if any | Self-serve |

| 2. Spike | Probe script + decision memory with version/date | Negative control passed; claim falsifiable | Self-serve, peers via memory |

| 3. Baseline | Buy-vs-build Quick verdict + written prediction + eval numbers | Go verdict; baseline exists | buy-vs-build-framework output; user for spend |

| 4. ADR | ADR-*.md + debate log | adr-review consensus (max 10 rounds) + human approval | 6-agent debate + user |

| 5. Ship | Gate/skill + calibration table + tests | ai-agents-change-control ladder (pre_pr.py, CI, plugin version-field gate if plugin tree) | CI gates + review |

| 6. Monitor | Detector-specific telemetry and tier report | Tier not Inert/Harmful | Periodic report from whatever the detector ships |

| 7. Adopt/retire | Retro or rejection record | n/a (terminal) | Documented either way |

Where Good Ideas Historically Came From

richest vein; ai-agents-failure-archaeology indexes the major ones.

Retro-cited short SHAs do not resolve locally even with full history present

(~1471 commits as of 2026-07-03), so retros and memories, not git log,

are the archaeology surface.

reflect skill captures them with confidence levels.

Five-Whys evidence; the guard framework, pre_pr.py, and the anchoring

contract all trace to specific incidents.

agree against the user's direction, that is signal, not a mandate. Per

.claude/rules/builder-ethos.md (User Sovereignty):

The rule: When you and another model agree on something that changes the user's stated direction, present the recommendation, explain why you both think it is better, state what context you might be missing, and ask. Never act.

Writing Up Results

Route write-ups through the documents of record (ai-agents-docs-of-record

for templates and house style). Non-negotiables for research prose:

status: accepted (as of 2026-11-20), but its effect is not established; citing it as proven is a defect.

.agents/governance/FAILURE-MODES.md; one round-cap PR paid 7 fix commits for

paraphrases).

Anti-Patterns

| Anti-pattern | Real instance | Correct move |

|---|---|---|

| Building on an unverified RCA | Recursive-failure M1: "missing pagination" premise was false; the script already paginated | Re-verify the mechanism against source before building on it |

| Shipping an uncalibrated threshold | Recursive-failure M4: threshold 6, repo max 4, could never fire | Calibration table against last 5 merged PRs, in the PR description |

| Guard never run on its own branch | Recursive-failure M5 pre-push guard | Execute the guard on the shipping branch before merge |

| Prediction written after the run | Any post-hoc "as expected" | Prediction in session log BEFORE the eval command |

| Adopting on model consensus | Rejected repeatedly per builder-ethos | Present, state missing context, ask the user |

| Silent retirement | The failure the fail-open wrapper rejection record prevents | Record rejections with rationale where the next proposer will search |

| Routing around the debate | Encoding policy in a rule to dodge adr-review | ADR + debate + human approval for governance changes |

| Trusting vendor docs over probes | Customer wedge first fix assumed an env var by analogy; shipped 3 new defects | Empirical probe with negative control (ai-agents-empirical-probe-toolkit) |

Verification

Before calling an idea "an accepted result," confirm:

Provenance and Maintenance

Verified 2026-07-03 against the working tree. Re-verify before relying on

volatile facts:

| Fact | Source | Re-verify |

|---|---|---|

| Recursive-failure false premise, calibration rule, M4 numbers | .project-toolkit/retrospective/2026-05-10-pr-1989-recursive-failure.md:20 (misdiagnosed root cause); the same retro's lines 72 to 73 give the M4 numbers and lines 149 to 157 state the calibration rule | grep -n "calibrat" .project-toolkit/retrospective/2026-05-10-pr-1989-recursive-failure.md |

| Fail-open wrapper rejection record | .project-toolkit/retrospective/2026-06-02-pr-2205-customer-wedge-incident.md:297 and :393 (addressed-by-prevention) | grep -n 2230 .project-toolkit/retrospective/2026-06-02-pr-2205-customer-wedge-incident.md |

| adr-review debate log required | AGENTS.md:14 (ADR review: debate log required); .claude/skills/adr-review/SKILL.md | grep -n "debate" .claude/skills/adr-review/SKILL.md |

| buy-vs-build gate for new capabilities | AGENTS.md:14 (new cap buy-vs-build) | grep -n "buy-vs-build" AGENTS.md |

| buy-vs-build Quick tier ends in a Go/No-go | .claude/skills/buy-vs-build-framework/SKILL.md:92 (Go/No-go) | verified directly against the cited line; no command needed that would read a sibling skill's directory <!-- citation-freshness: ignore -- symlinked shipped skill; tracked at src/claude/skills/buy-vs-build-framework/SKILL.md --> |

| eval scripts and --dry-run | scripts/eval/eval-prompt-change.py:962 (Validate inputs, no API calls); scripts/eval/ listing | ls scripts/eval/ && grep -n "dry-run" scripts/eval/eval-prompt-change.py |

| Contradiction log format | .claude/skills/memory-gate/references/contradiction-log.md | grep -n "decision-" .claude/skills/memory-gate/references/contradiction-log.md |

| ADR-069 accepted, effect not established | .project-toolkit/architecture/ADR-069-context-corpus-is-the-product.md:3 (status: accepted) | head -5 .project-toolkit/architecture/ADR-069-context-corpus-is-the-product.md |

| Retro corpus size | .project-toolkit/retrospective/ | ( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-failure-archaeology/scripts/corpus_index.py --repo .; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 ) (retro_files; exits 1 while INDEX.md covers 11 of 241 retros at 42e409325, so read the JSON, not the exit code) |

Uncertainty flag: the EVENT= telemetry consumer pipeline was never fully

mapped before it was retired (noted in ai-agents-research-frontier). The

emitter, push_guard_base.py, was verified present 2026-07-03 (mirrored under

src/copilot-cli/hooks/PreToolUse/) and was deleted from both trees under

ADR-084, along with the tier-classifier skill that consumed its

output; nothing in this repo produces or reads that telemetry today.

Scripts

Run ( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/ai-agents-research-methodology/scripts/instruments.py --repo . list; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 ) to see every linked instrument and whether its file exists. It lists the retro counter above, the file:line claim check (bootstrap_mine.py claims), scripts/validation/check_citation_freshness.py (citations on added lines), its sibling citation_reverse_pass.py (unchanged citations into files the branch changed; run it before you push a branch that moves, renames, or deletes a cited file), and the drift check. It answers presence only; whether a cited line still says what this skill claims is for reverify.json.

Machine-checkable facts live in reverify.json. Run the drift check after any edit:

( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/skill-bootstrap/scripts/bootstrap_drift.py check --repo . --skills-root .claude/skills --name ai-agents-research-methodology --require; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.