# Shark Autotune

> Analyse shark timing history and recommend optimal SHARK_LOOP_TIMEOUT and SHARK_MAX_LOOPS settings

- **Type:** Skill
- **Install:** `agentstack add skill-keugenek-shark-shark-autotune`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [keugenek](https://agentstack.voostack.com/s/keugenek)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [keugenek](https://github.com/keugenek)
- **Source:** https://github.com/keugenek/shark/tree/main/commands/shark-autotune

## Install

```sh
agentstack add skill-keugenek-shark-shark-autotune
```

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

## About

# Shark Autotune

Analyse recorded shark timing data and recommend optimal settings.

## Instructions

1. Read `$SKILL_DIR/../state/timings.jsonl` — each line is a JSON object:
   ```json
   {"ts":1710000000,"loop":1,"elapsed_s":12.3,"timeout_s":25,"result":"ok|timeout|done","task_hash":"abc123"}
   ```

2. If the file doesn't exist or is empty, report "No timing data yet. Run tasks with /shark first to collect data."

3. Compute and report:
   - **Total runs** (unique task_hash values) and **total loops**
   - **Median turn time** (p50) and **p95 turn time**
   - **Timeout rate** — % of turns with result "timeout"
   - **Loops to completion** — median and max (count loops per task_hash that has a "done" entry)
   - **Wasted headroom** — sum of (timeout_s - elapsed_s) for result "ok" turns
   - **Optimal timeout** — p95 turn time + 3s buffer, rounded up to nearest 5s
   - **Optimal max_loops** — p95 loops-to-completion + 2

4. Show recommendations:
   ```
   Current:     SHARK_LOOP_TIMEOUT=25  SHARK_MAX_LOOPS=50
   Recommended: SHARK_LOOP_TIMEOUT=N   SHARK_MAX_LOOPS=M

   Rationale:
   - p95 turn time is Xs, so timeout of Ns covers 95% with buffer
   - p95 completion is N loops, so max_loops of M gives safe margin
   - Timeout rate is X% — [>15%: consider splitting tasks | healthy]
   - Wasted headroom: Xs total
   ```

5. If timeout rate > 30%: "Consider breaking tasks into smaller steps."
6. If median turn time < 5s: "Most turns complete fast. Consider lowering timeout."

## Source & license

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

- **Author:** [keugenek](https://github.com/keugenek)
- **Source:** [keugenek/shark](https://github.com/keugenek/shark)
- **License:** Apache-2.0

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-keugenek-shark-shark-autotune
- Seller: https://agentstack.voostack.com/s/keugenek
- 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%.
