anomaly-investigation

Use when there is a known, observed anomaly in your data (e.g., sudden metric jump or drop, outliers, unexpected values) and you need to diagnose the root cause. The method generates candidate causes and tests them against the data one by one, eliminating options falsified by the data and narrowing candidates until a single cause remains that is not falsified and has passed forward-confirmation tests. The output is an investigation log that documents the confirmed root cause and the evidence used to rule out other possibilities. Not for open-ended exploration of datasets without a specific anomaly or for validating claims against external sources.

Last repository push
GitHub Stars
185
Forks
21
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "anomaly-investigation" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ab0f81be59f3ec8347bc3e887a379107b81c070b45bb3f28e3370f1719acb276. Verify the upstream source and version against https://github.com/gaasher/Agent-Loop-Skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Use when there is a known, observed anomaly in your data (e.g., sudden metric jump or drop, outliers, unexpected values) and you need to diagnose the root cause. The method generates candidate causes and tests them against the data one by one, eliminating options falsified by the data and narrowing candidates until a single cause remains that is not falsified and has passed forward-confirmation tests. The output is an investigation log that documents the confirmed root cause and the evidence used to rule out other possibilities. Not for open-ended exploration of datasets without a specific anomaly or for validating claims against external sources.

0 Downloads

Introduction source: third_party · gaasher · 0.1.0 Reference

SkillPi interpretation

Tasks
A **form → test → eliminate → confirm** loop — root-cause analysis as a search. The artifact is an investigation log; the feedback signal is the count of **live candidate explanations**, driven down toward a single cause that is **confirmed**, not merely consistent. Each iteration you test one candidate against the data and drop the ones the data refutes, narrowing the field until one survives.
Audience
Use this when an anomaly is already in hand — you know roughly what looks wrong and want the cause diagnosed by elimination against the data. Default to a broad initial slate of mutually distinguishable causes, then test the one that splits the field fastest; if the anomaly is vague, your first job is to make it precise (iteration 0). Not for open-ended exploration of a dataset with no anomaly to chase (use data-analysis), and not for verifying an external claim against the literature (use claim-verify).
Software, accounts and paid services
Resolve bindings interactively. If `loop.run.yaml` exists in the working dir, load it, confirm the values in one line, and skip to the loop. Otherwise: on Claude Code (the `AskUserQuestion` tool is available) infer a likely value for each binding and present it as the recommended option; on other hosts ask each as a quoted plain-text prompt. Then write `loop.run.yaml` (format: `examples/run.example.yaml`) and confirm the values before creating any other files. | binding | meaning | default | how to infer | |---|---|---|---| | `<dataset>` | data (or logs) to investigate; read-only ground truth | — | scan the working dir for a data/log file | | `<anomaly>` | what looks wrong: the metric, where
Limits and differences
**Confirm, don't just fit.** The root cause must survive an honest refutation attempt *and* pass a positive confirming test; "consistent with the data" is not enough, since several stories usually are. **Test against the data, not intuition** — every elimination and the final confirmation is backed by a computation you ran, recorded in `<log>`. **Keep candidates distinguishable** and prefer the test that splits the field fastest, so the live count falls; do not chase one pet theory while leaving alternatives untested. **Only read `<dataset>`** — never modify it, because it is the ground truth every test is checked against. The sandbox is self-contained (no `../` escapes). Do not pause the lo
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: anomaly-investigation
description: >
  Use when the user has a known, already-observed anomaly in their data — a metric spike or drop, an
  outlier, an unexpected number — and wants its root cause diagnosed, not guessed. Forms a slate of
  candidate causes, tests each against the data, and eliminates the ones the data refutes, narrowing
  the live candidates until exactly one survives refutation and passes a positive confirming test. The
  result is an investigation log with the confirmed root cause and the evidence that ruled out the
  alternatives. Not for open-ended discovery over a dataset with no specific anomaly in hand (that is
  data-analysis), and not for checking an external claim against sources (that is claim-verify) — this
  is reactive diagnosis of one anomaly you already know about.
compatibility: Requires Python 3.9+
metadata:
  version: "0.1.0"

Anomaly Investigation Loop

A form → test → eliminate → confirm loop — root-cause analysis as a search. The artifact is an investigation log; the feedback signal is the count of live candidate explanations, driven down toward a single cause that is confirmed, not merely consistent. Each iteration you test one candidate against the data and drop the ones the data refutes, narrowing the field until one survives.

The discipline this enforces: a cause is "root" only when it both survives an honest attempt to refute it and makes a positive prediction that checks out (e.g. "if this is the cause, removing it restores normal" — and it does). A story that merely could explain the anomaly is a hypothesis, not a finding.

When to use

Use this when an anomaly is already in hand — you know roughly what looks wrong and want the cause diagnosed by elimination against the data. Default to a broad initial slate of mutually distinguishable causes, then test the one that splits the field fastest; if the anomaly is vague, your first job is to make it precise (iteration 0). Not for open-ended exploration of a dataset with no anomaly to chase (use data-analysis), and not for verifying an external claim against the literature (use claim-verify).

Setup

Resolve bindings interactively. If loop.run.yaml exists in the working dir, load it, confirm the values in one line, and skip to the loop. Otherwise: on Claude Code (the AskUserQuestion tool is available) infer a likely value for each binding and present it as the recommended option; on other hosts ask each as a quoted plain-text prompt. Then write loop.run.yaml (format: examples/run.example.yaml) and confirm the values before creating any other files.

binding meaning default how to infer
<dataset> data (or logs) to investigate; read-only ground truth — scan the working dir for a data/log file
<anomaly> what looks wrong: the metric, where/when, and how big the deviation is — ask the user; make precise in iter 0
<analysis_cmd> interpreter that runs analysis snippets in the user's env python3 pyproject.toml/.venv/uv in the working dir
<log> output investigation log <sandbox_root>/investigation.md —
<sandbox_root> where snippets + ledger live ./sandbox —
<budget> max iterations 8 —

Analysis snippets run in the user's environment via <analysis_cmd>, so they may use whatever the user has installed. Keep helper code stdlib-first (csv, statistics): if a snippet needs pandas/numpy, probe with try/except ImportError and degrade to a stdlib path, or offer a consented uv pip install "pandas==<ver>" — never assume the package is installed.

The loop

Copy this checklist and tick items off:

  • [ ] Iteration 0 — characterize the anomaly precisely; form an initial slate of candidate causes in <log>.
  • [ ] Pick a candidate to test (the one whose test most cleanly splits the remaining field).
  • [ ] Test it: write <sandbox_root>/iter<N>/test.py, run with <analysis_cmd>, redirect to out.txt.
  • [ ] Eliminate (data refutes it → drop from the live set) or advance (data supports it → keep it live).
  • [ ] Confirm the survivor: when one candidate leads, run a positive test only it predicts, after a refutation attempt.
  • [ ] Append a ledger row; stop when one cause is confirmed or at <budget>.

Iteration 0 — characterize. Quantify the anomaly precisely: write and run a snippet that pins down what deviated, where/when, and how big the deviation is against the normal baseline (the same metric on surrounding periods/segments). Then form an initial slate of candidate causes — mutually distinguishable explanations, broad enough to contain the truth (a real change, a composition/mix shift, a data-quality bug, a measurement change, seasonality, an outlier segment). List them in <log> as the live candidates. Record nothing as confirmed yet.

Then, until stop (one confirmed cause, or budget):

  1. Pick a candidate to test. Ideally the one whose test most cleanly splits the remaining field, so each iteration removes as many live candidates as possible.
  2. Test it. Write <sandbox_root>/iter<N>/test.py that computes the thing that would refute or support it (slice by segment/source/time, recompute the metric, compare distributions). Run it with <analysis_cmd>, redirecting output to <sandbox_root>/iter<N>/out.txt (never flood your context).
  3. Eliminate or advance.
    • Data refutes it → mark it eliminated in <log> with the evidence; drop it from the live set.
    • Data supports it → keep it live, and if it is now the leading candidate run a confirming test: a positive prediction it uniquely makes (e.g. "remove / seasonally-adjust the suspected factor → the anomaly disappears"). Also try to refute it — a leading candidate that survives a genuine refutation attempt and passes its confirming test is the root cause.
  4. Log one ledger row and continue, narrowing the live set.

Observational equivalence. Two mechanistically different candidates can make identical predictions in the data you have (e.g. a bot flood and a pipeline double-count both look like "sessions spike, conversions flat" in daily aggregates). When that happens you cannot separate them here — do not pick one arbitrarily. Report them as a single confirmed cause at the resolution of the available data, and name the additional data that would distinguish them (finer-grained logs, raw event records, an upstream check). Distinguish, too, the mechanism (how the metric moved) from the root cause (why the inputs were wrong) — confirming the mechanism is progress, but is not the cause.

Ledger

<sandbox_root>/ledger.tsv, tab-separated, never commas in the text. Header:

iter    candidate_tested    verdict live_candidates

verdict ∈ {characterize, refuted, supported, confirmed}. Example:

iter    candidate_tested    verdict live_candidates
0   characterize anomaly + slate    characterize    5
1   real drop across all segments   refuted 4
2   one segment's conversions fell  refuted 3
3   one source's sessions inflated  supported   2
4   removing that source restores normal    confirmed   1

Report the confirmed root cause with its confirming evidence, the alternatives and how each was ruled out, and — if you stop without a single confirmed cause — the remaining live candidates and the test that would separate them.

Constraints

  • Confirm, don't just fit. The root cause must survive an honest refutation attempt and pass a positive confirming test; "consistent with the data" is not enough, since several stories usually are.
  • Test against the data, not intuition — every elimination and the final confirmation is backed by a computation you ran, recorded in <log>.
  • Keep candidates distinguishable and prefer the test that splits the field fastest, so the live count falls; do not chase one pet theory while leaving alternatives untested.
  • Only read <dataset> — never modify it, because it is the ground truth every test is checked against. The sandbox is self-contained (no ../ escapes).
  • Do not pause the loop to ask whether to continue; run until a cause is confirmed or the budget is hit.

Stops

  • Confirmed — exactly one candidate survived refutation and passed a positive confirming test.
  • Budget — <budget> iterations reached without a single confirmed cause; report the live set.

Current listing version

0.1.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 针对已知数据异常的根因诊断,解决明确业务痛点
  • 采用科学证伪方法,避免主观猜测
  • 适用于数据分析、运维、产品等多个高频场景
Trigger Precision95/100

Highlights

  • 触发条件清晰:已知异常 + 需要根因诊断
  • 边界明确:排除开放式探索和外部主张验证
  • description 位置正确且内容完整
Structure and Standards92/100

Areas to improve

  • 缺少 When to Use 独立章节 Reported severity: Minor

    When to Use 内容已融入主体,但未作为独立章节呈现

    Recommendation: 建议将 When to Use 提取为独立章节,提升可读性

Highlights

  • 执行流程清晰:Setup → Iteration 0 → Loop → Stops
  • 包含详细的 ledger.tsv 示例
  • frontmatter 完整,单文件长度适中
Execution Reliability85/100

Areas to improve

  • 未明确处理 uv pip install 失败场景 Reported severity: Minor

    在需要安装 pandas/numpy 时,未说明 uv pip install 失败后的处理策略

    Recommendation: 建议补充安装失败时的降级方案或错误提示

Highlights

  • 工具来源明确,Python 3.9+ 要求清晰
  • stdlib-first 策略,ImportError 降级处理
  • 仅读取数据,无不可逆操作风险
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 57

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Resolve bindings interactively. If `loop.run.yaml` exists in the working dir, load it, confirm the values in one line, and skip to the loop. Otherwise: on Claude Code (the `AskUserQuestion` tool is available) infer a likely value for each binding and present it as the recommended option; on other hosts ask each as a quoted plain-text prompt. Then write `loop.run.yaml` (format: `examples/run.example.yaml`) and confirm the values before creating any other files. | binding | meaning | default | how to infer | |---|---|---|---| | `<dataset>` | data (or logs) to investigate; read-only ground truth | — | scan the working dir for a data/log file | | `<anomaly>` | what looks wrong: the metric, where

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.