Agent skill

Conc Anal

by goodboy in goodboy/tractor

Concurrency analysis for tractor's trio-based async primitives.

AGPL-3.0Auto-check passedDevelopment

Install Conc Anal

skills CLI
$ npx skills add goodboy/tractor --skill conc-anal -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install goodboy/tractor conc-anal --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/goodboy/tractor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/conc-anal .claude/skills/conc-anal && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
conc-anal
GitHub stars
310
Token cost
~2.4k tokens
SKILL.md length
984 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Concurrency analysis for tractor's trio-based async primitives.

  • Works in 7 steps: Identify the target → Inventory shared mutable state → Map checkpoint boundaries → …
  • Tasks that involve Async programming
  • SKILL.md covers 0. Identify the target, 1. Inventory shared mutable…, 2. Map checkpoint boundaries and 3. Trace concurrent task…, plus 4 more sections
  • Calls pytest

What it does

Conc Anal is an agent skill from goodboy/tractor. Concurrency analysis for tractor's trio-based async primitives. Trace task scheduling across checkpoint boundaries, identify race windows in shared mutable state, and verify synchronization correctness. Invoke on code segments the user points at, OR proactively when reviewing/writing concurrent cache, lock, or multi-task acm code.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Async programming. The repository describes itself as: distributed structured concurrency. The licence is AGPL-3.0.

When your agent uses it

  • Tasks that involve Async programming

Example prompts

  • “/conc-anal”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Task

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Identify the target
  2. Inventory shared mutable state
  3. Map checkpoint boundaries
  4. Trace concurrent task schedules
  5. Classify the bug
  6. Propose fixes
  7. Output format

What it can do on your machine

Read from SKILL.md and the folder at commit 0c52f27. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Task

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Conc Anal loads about 2.4k tokens when it runs. Until then it costs about 86 tokens; SKILL.md has 984 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~86
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from goodboy/tractor at commit 0c52f27, republished under its AGPL-3.0 licence (© goodboy). 984 words, ~2,373 tokens.

Download SKILL.mdSave it as .claude/skills/conc-anal/SKILL.md (or your agent's skills folder).
name
conc-anal
description
Concurrency analysis for tractor's trio-based async primitives. Trace task scheduling across checkpoint boundaries, identify race windows in shared mutable state, and verify synchronization correctness. Invoke on code segments the user points at, OR proactively when reviewing/writing concurrent cache, lock, or multi-task acm code.
allowed-tools
Read, Grep, Glob, Task
argument-hint
[file:line-range or function name]

Perform a structured concurrency analysis on the target code. This skill should be invoked:

  • On demand: user points at a code segment (file:lines, function name, or pastes a snippet)
  • Proactively: when writing or reviewing code that touches shared mutable state across trio tasks — especially _Cache, locks, events, or multi-task @acm lifecycle management

0. Identify the target

If the user provides a file:line-range or function name, read that code. If not explicitly provided, identify the relevant concurrent code from context (e.g. the current diff, a failing test, or the function under discussion).

1. Inventory shared mutable state

List every piece of state that is accessed by multiple tasks. For each, note:

  • What: the variable/dict/attr (e.g. _Cache.values, _Cache.resources, _Cache.users)
  • Scope: class-level, module-level, or closure-captured
  • Writers: which tasks/code-paths mutate it
  • Readers: which tasks/code-paths read it
  • Guarded by: which lock/event/ordering protects it (or "UNGUARDED" if none)

Format as a table:

| State               | Writers         | Readers         | Guard          |
|---------------------|-----------------|-----------------|----------------|
| _Cache.values       | run_ctx, moc¹   | moc             | ctx_key lock   |
| _Cache.resources    | run_ctx, moc    | moc, run_ctx    | UNGUARDED      |

¹ moc = maybe_open_context

2. Map checkpoint boundaries

For each code path through the target, mark every checkpoint — any await expression where trio can switch to another task. Use line numbers:

L325: await lock.acquire()        ← CHECKPOINT
L395: await service_tn.start(...) ← CHECKPOINT
L411: lock.release()              ← (not a checkpoint, but changes lock state)
L414: yield (False, yielded)      ← SUSPEND (caller runs)
L485: no_more_users.set()         ← (wakes run_ctx, no switch yet)

Key trio scheduling rules to apply:

  • Event.set() makes waiters ready but does NOT switch immediately
  • lock.release() is not a checkpoint
  • await sleep(0) IS a checkpoint
  • Code in finally blocks CAN have checkpoints (unlike asyncio)
  • await inside except blocks can be trio.Cancelled-masked

3. Trace concurrent task schedules

Write out the interleaved execution trace for the problematic scenario. Number each step and tag which task executes it:

[Task A]  1. acquires lock
[Task A]  2. cache miss → allocates resources
[Task A]  3. releases lock
[Task A]  4. yields to caller
[Task A]  5. caller exits → finally runs
[Task A]  6. users-- → 0, sets no_more_users
[Task A]  7. pops lock from _Cache.locks
[run_ctx] 8. wakes from no_more_users.wait()
[run_ctx] 9. values.pop(ctx_key)
[run_ctx] 10. acm __aexit__ → CHECKPOINT
[Task B]  11. creates NEW lock (old one popped)
[Task B]  12. acquires immediately
[Task B]  13. values[ctx_key] → KeyError
[Task B]  14. resources[ctx_key] → STILL EXISTS
[Task B]  15. 💥 RuntimeError

Identify the race window: the range of steps where state is inconsistent. In the example above, steps 9–10 are the window (values gone, resources still alive).

4. Classify the bug

Categorize what kind of concurrency issue this is:

  • TOCTOU (time-of-check-to-time-of-use): state changes between a check and the action based on it
  • Stale reference: a task holds a reference to state that another task has invalidated
  • Lifetime mismatch: a synchronization primitive (lock, event) has a shorter lifetime than the state it's supposed to protect
  • Missing guard: shared state is accessed without any synchronization
  • Atomicity gap: two operations that should be atomic have a checkpoint between them

5. Propose fixes

For each proposed fix, provide:

  • Sketch: pseudocode or diff showing the change
  • How it closes the window: which step(s) from the trace it eliminates or reorders
  • Tradeoffs: complexity, perf, new edge cases, impact on other code paths
  • Risk: what could go wrong (deadlocks, new races, cancellation issues)

Rate each fix: [simple|moderate|complex] impl effort.

6. Output format

Structure the full analysis as:

markdown
## Concurrency analysis: `<target>`

### Shared state
<table from step 1>

### Checkpoints
<list from step 2>

### Race trace
<interleaved trace from step 3>

### Classification
<bug type from step 4>

### Fixes
<proposals from step 5>

Tractor-specific patterns to watch

These are known problem areas in tractor's concurrency model. Flag them when encountered:

_Cache lock vs run_ctx lifetime

The _Cache.locks entry is managed by maybe_open_context callers, but run_ctx runs in service_tn — a different task tree. Lock pop/release in the caller's finally does NOT wait for run_ctx to finish tearing down. Any state that run_ctx cleans up in its finally (e.g. resources.pop()) is vulnerable to re-entry races after the lock is popped.

values.pop() → acm __aexit__ → resources.pop() gap

In _Cache.run_ctx, the inner finally pops values, then the acm's __aexit__ runs (which has checkpoints), then the outer finally pops resources. This creates a window where values is gone but resources still exists — a classic atomicity gap.

Global vs per-key counters

_Cache.users as a single int (pre-fix) meant that users of different ctx_keys inflated each other's counts, preventing teardown when one key's users hit zero. Always verify that per-key state (users, locks) is actually keyed on ctx_key and not on fid or some broader key.

Show full SKILL.md (409 more words)Show less
Event.set() wakes but doesn't switch

trio.Event.set() makes waiting tasks ready but the current task continues executing until its next checkpoint. Code between .set() and the next await runs atomically from the scheduler's perspective. Use this to your advantage (or watch for bugs where code assumes the woken task runs immediately).

except block checkpoint masking

await expressions inside except handlers can be masked by trio.Cancelled. If a finally block runs from an except and contains lock.release(), the release happens — but any await after it in the same except may be swallowed. This is why maybe_open_context's cache-miss path does lock.release() in a finally inside the except KeyError.

Cancellation in finally

Unlike asyncio, trio allows checkpoints in finally blocks. This means finally cleanup that does await can itself be cancelled (e.g. by nursery shutdown). Watch for cleanup code that assumes it will run to completion.

Unbounded waits in cleanup paths

Any await <event>.wait() in a teardown path is a latent deadlock unless the event's setter is GUARANTEED to fire. If the setter depends on external state (peer disconnects, child process exit, subsequent task completion) that itself depends on the current task's progress, you have a mutual wait.

Rule: bound every await X.wait() in cleanup paths with trio.move_on_after() unless you can prove the setter is unconditionally reachable from the state at the await site. Concrete recent example: ipc_server.wait_for_no_more_peers() in async_main's finally (see ai/conc-anal/subint_forkserver_test_cancellation_leak_issue.md "probe iteration 3") — it was unbounded, and when one peer-handler was stuck the wait-for-no-more- peers event never fired, deadlocking the whole actor-tree teardown cascade.

The capture-pipe-fill hang pattern (grep this first)

When investigating any hang in the test suite especially under fork-based backends, first check whether the hang reproduces under pytest -s (--capture=no). If -s makes it go away you're not looking at a trio concurrency bug — you're looking at a Linux pipe-buffer fill.

Mechanism: pytest replaces fds 1,2 with pipe write-ends. Fork-child subactors inherit those fds. High-volume error-log tracebacks (cancel cascade spew) fill the 64KB pipe buffer. Child write() blocks. Child can't exit. Parent's waitpid/pidfd wait blocks. Deadlock cascades up the tree.

Pre-existing guards in tests/conftest.py encode this knowledge — grep these BEFORE blaming concurrency:

python
# tests/conftest.py:258
if loglevel in ('trace', 'debug'):
    # XXX: too much logging will lock up the subproc (smh)
    loglevel: str = 'info'

# tests/conftest.py:316
# can lock up on the `_io.BufferedReader` and hang..
stderr: str = proc.stderr.read().decode()

Full post-mortem + ai/conc-anal/subint_forkserver_test_cancellation_leak_issue.md for the canonical reproduction. Cost several investigation sessions before catching it — because the capture-pipe symptom was masked by deeper cascade-deadlocks. Once the cascades were fixed, the tree tore down enough to generate pipe-filling log volume → capture-pipe finally surfaced. Grep-note for future-self: if a multi-subproc tractor test hangs, pytest -s first, conc-anal second.

© goodboy, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/conc-anal of goodboy/tractor.

Open the folder on GitHubat commit 0c52f27

Compare with similar skills

Conc Anal next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Conc Anal compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Conc Anal this skillgoodboy/tractor310—~2.4kAutomated safety check: PassAGPL-3.0
YugabyteDB ASH Instrumentationyugabyte/yugabyte-db11k—~4.5kAutomated safety check: PassCustom licence
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.5kAutomated safety check: PassApache-2.0
Golang Patternsantoniopaya22/go-rest-template1729 repos~3.5kAutomated safety check: PassNone
Rust Async Patternsdiodeme/Gold-Band14310 repos~3.1kAutomated safety check: PassAGPL-3.0
Swift Concurrencyhenrypldev/react-native-nitro-mlx1003 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • YugabyteDB ASH Instrumentation

    yugabyte/yugabyte-db

    Procedure for adding or changing YugabyteDB Active Session History wait states in TServer and DocDB C++ code, including the macro to use for sync and async paths.

    11k GitHub stars~4.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Golang Patterns

    antoniopaya22/go-rest-template

    Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.

    172 GitHub starsUsed in 9 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 10 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Swift Concurrency

    henrypldev/react-native-nitro-mlx

    Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…

    100 GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Rust Engineer

    farm-fe/farm

    Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions.

    5.6k GitHub starsUsed in 1 repo~1.5k tokens
    DevelopmentAuto-check passed

Categories

Questions about Conc Anal

What does Conc Anal do?

Concurrency analysis for tractor's trio-based async primitives. Conc Anal is an agent skill from goodboy/tractor. Concurrency analysis for tractor's trio-based async primitives.

When should I use Conc Anal?

Conc Anal fits situations like: tasks that involve Async programming.

How do I install Conc Anal in Claude Code?

Run `npx skills add goodboy/tractor --skill conc-anal -a claude-code`. Or copy the skill folder (.claude/skills/conc-anal in goodboy/tractor) into .claude/skills/conc-anal in your project. Claude Code loads it when a task matches its description.

How do I install Conc Anal in Codex?

Run `npx skills add goodboy/tractor --skill conc-anal -a codex`. Or copy the skill folder (.claude/skills/conc-anal in goodboy/tractor) into .agents/skills/conc-anal in your project. Codex loads it when a task matches its description.

Can I use Conc Anal in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add goodboy/tractor --skill conc-anal -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/conc-anal, .gemini/skills/conc-anal, .github/skills/conc-anal and .opencode/skills/conc-anal in your project.

What does Conc Anal need to run?

Going by SKILL.md and its folder, Conc Anal needs the command-line tools its instructions call (pytest). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Grep, Glob, Task.

Does Conc Anal access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Conc Anal safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Conc Anal use?

Conc Anal is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Conc Anal use?

About 2.4k tokens (SKILL.md is roughly 9.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Conc Anal?

Skills that share tags, products or a category with Conc Anal: YugabyteDB ASH Instrumentation (yugabyte/yugabyte-db, 11k stars), Mirage VFS Adapter Authoring (strukto-ai/mirage, 3.7k stars), Golang Patterns (antoniopaya22/go-rest-template, 172 stars) and Rust Async Patterns (diodeme/Gold-Band, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Conc Anal?

goodboy (a GitHub user) maintains it in goodboy/tractor, which has 310 GitHub stars. The repository was last updated on October 8, 2026.

Source: goodboy/tractor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.