# Log Pattern Scan

> Scan Claude Code JSONL session transcript files for behavioral patterns — loops, errors, expensive turns, trial-and-error signatures. Returns structured findings for the improvement-analyst agent.

- **Type:** Skill
- **Install:** `agentstack add skill-gertsylvest-meta-team-log-pattern-scan`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [gertsylvest](https://agentstack.voostack.com/s/gertsylvest)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** https://github.com/gertsylvest/meta-team/tree/main/library/skills/log-pattern-scan

## Install

```sh
agentstack add skill-gertsylvest-meta-team-log-pattern-scan
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Log Pattern Scan

Scan one or more Claude Code JSONL session transcript files for behavioral inefficiency patterns.

## Instructions

Arguments are in `$ARGUMENTS`:
- First arg: path to a `.jsonl` file, or a project root path (scans all sessions for that project)
- Second arg (optional): scan type — `all` (default), `errors`, `loops`, `expensive`, `trialerror`, `summary`

If no arguments are provided, ask the user before proceeding.

When given a project root, the scan recurses into subagent **sidechains**
(`/subagents/agent-*.jsonl`, marked `isSidechain: true`) as well as the
top-level session transcripts. This matters: the orchestrator/main transcript records
only ~15% of tool activity — the bulk of tool calls, errors, and loops happen inside
subagents. Scanning only the top level can undercount errors by an order of magnitude.
Each finding is headed by its path relative to the project folder, so sidechain
findings are attributable to the agent that produced them.

### Run the scan

The scan script lives alongside this file. Run it directly:

```bash
bash "$(dirname "$0")/scan.sh"  
```

### Scan types

| Type | What it detects |
|---|---|
| `summary` | Total lines, tool calls, errors, token totals per session |
| `errors` | Tool calls that returned `is_error: true` |
| `loops` | Same tool called 3+ times consecutively, or same tool+input repeated 3+ times across the session |
| `expensive` | Turns with >2000 output tokens (`EXPENSIVE-OUTPUT`) or >10000 new cache tokens (`EXPENSIVE-CONTEXT`) |
| `trialerror` | 3+ edits to the same file (`CHURN`), 3+ identical bash commands (`REPEAT-CMD`), sessions >200 messages (`LONG SESSION`) |
| `all` | All of the above |

### Output prefixes

Each finding is prefixed for easy parsing:

| Prefix | Meaning |
|---|---|
| `ERROR` | Failed tool call |
| `LOOP` | Consecutive same-tool repetition |
| `REPEAT` | Same tool+input repeated across session |
| `EXPENSIVE-OUTPUT` | High output token turn |
| `EXPENSIVE-CONTEXT` | Large new context loaded in one turn |
| `CHURN` | Repeated edits to same file |
| `REPEAT-CMD` | Repeated identical bash command |
| `LONG SESSION` | Session exceeds 200 messages |
| `OK` | No issues found for that scan type |

### Return to caller

Return the full script output. The improvement-analyst agent will interpret the findings and write suggestions to the project's self-improvement log.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** [gertsylvest/meta-team](https://github.com/gertsylvest/meta-team)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-gertsylvest-meta-team-log-pattern-scan
- Seller: https://agentstack.voostack.com/s/gertsylvest
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
