npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@divance/rrr

v0.4.0

Published

rrr: run AI agents, record their runs and handoffs, fire pops

Readme

rrr

Runs AI agents, records each run and its handoff on an rrrrr server, and fires pops (side effects) from the handoff.

npm i -g @divance/rrr
rrr login                       # sign in through the browser; the hosted server is the default
cd your-repo
rrr init                        # writes .rrr/ at the git root: one example agent, one example pop, pop.yaml, rrr.yaml
rrr docs                        # the config manual: every file and field (give it to the agent editing .rrr/)
# edit .rrr/ ...
rrr check                       # every problem as `file:field: problem — fix`; exit 1 while any remain
rrr run example --origin <ref>  # or --chain <ch_id> to continue a chain
rrr repo setup                  # team admins: the repo's RRR_RUNNER_KEY Actions secret, via gh; again after pops' secrets change

rrr finds .rrr/ at the git root above the current directory; --config / RRR_CONFIG point at a config elsewhere. RRR_SERVER / --server point at another server. rrr login signs in through the browser (--team <slug> binds the login to a team; rrr team list / rrr team use <slug> switch, rrr logout signs out). A team admin makes CI keys with rrr key create <name> [--secret NAME]... (printed once; also key list / key revoke <id>). RRR_RUNNER_KEY overrides the saved login. In CI, pass a runner key only as RRR_RUNNER_KEY and don't rrr login (no credentials file). The agent works in the repo checkout (the git root) with an env allowlist: it may read and write the repo, but not .rrr/ (its pops run later with secrets). So .rrr/ must be a real directory with no symlinks in it or on the way to it inside the repo (rrr uses the config by its real path, resolved once), and TMPDIR must be outside the repo and the config; rrr refuses to run or fire pops otherwise. Read and sandboxed Bash are denied .env* files anywhere in the repo, ~/.config/rrr and your shell startup files (~/.bashrc, ~/.bash_profile, ~/.bash_login, ~/.profile, ~/.zshrc, ~/.zshenv, ~/.zprofile, ~/.zlogin). Bash runs only in Claude's sandbox (where it can't start, e.g. Linux without bubblewrap, Bash is refused), without RRR_RUNNER_KEY, ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or CLAUDE_CODE_OAUTH_TOKEN. Other variables your shell rc exports still reach Bash. MCP servers in run.yaml run outside the sandbox with your file access (trusted config). The real boundary is a container (design). The CLI is one bundled file (dist/rrr.js); it needs Node 22+ and Claude Code on PATH (rrr run checks claude --version before it starts the run).

rrr run exit codes (the first that applies; rrr pop fire / pop retry use 0, 3, 4 and 1):

| Code | Meaning | | --- | --- | | 0 | finished (done or blocked), recorded, every pop ok | | 2 | the run crashed: agent failed, timed out (default 30m), was cancelled, or left no valid handoff | | 3 | a pop failed | | 4 | the server did not get it all: events, the end of the run, or the receipts | | 1 | anything else, before the run starts: config, flags, login, Claude Code missing, server unreachable |

--json prints only {run_id, chain_id, state, decision, cancelled, receipts} on stdout at the end. rrr --version.

Cancel: the first SIGINT/SIGTERM stops the agent (the run is recorded as crashed, *:crashed pops fire; once its end is on the way to the server it stays as sent, but no success pop starts) and rrr exits 2; a second one, or 7s after the first, cuts server calls and kills running pops, so rrr is gone before GitHub Actions' SIGKILL. The agent and pops are killed if rrr itself dies, even by SIGKILL. A run whose end never reached the server is crashed by the server 10 minutes after its timeout.

GitHub Actions

One run per job, on a fresh runner, in the repo checkout (config in its .rrr/; the agent works in the checkout):

on:
  workflow_dispatch: { inputs: { agent: { required: true }, origin: { required: true } } }
  repository_dispatch: { types: [rrr] } # client_payload: {agent, origin}
jobs:
  run:
    runs-on: ubuntu-latest
    timeout-minutes: 45 # above the agent's timeout (default 30m) plus pops
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22 }
      - run: sudo apt-get update && sudo apt-get install -y bubblewrap socat && sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 # Claude's Bash sandbox (Ubuntu 24.04 blocks bubblewrap's namespaces otherwise)
      - run: npm i -g @anthropic-ai/[email protected] @divance/[email protected]
      - run: exec rrr run "$AGENT" --origin "$ORIGIN" --json # exec: rrr itself gets the cancel signals, not bash
        env:
          AGENT: ${{ inputs.agent || github.event.client_payload.agent }}
          ORIGIN: ${{ inputs.origin || github.event.client_payload.origin }}
          CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # or ANTHROPIC_API_KEY
          RRR_RUNNER_KEY: ${{ secrets.RRR_RUNNER_KEY }}
          RRR_SERVER: https://rrrrr.me-4de.workers.dev # with RRR_RUNNER_KEY set, no credentials file is read

rrr repo setup sets RRR_RUNNER_KEY and checks the Claude secret. RRR_RUNNER_KEY and CLAUDE_CODE_OAUTH_TOKEN (from claude setup-token, uses your Claude subscription) are Actions secrets; an ANTHROPIC_API_KEY works instead. Never rrr login in CI. Inputs go through env, not ${{ }} inside run:, so they can't inject shell.

PR chat

A code-review agent posts numbered findings on a PR; a person replies @bot fix 1,3 or asks @bot a question; a chat agent answers, or starts the code-change agent, which pushes to the PR's branch. The config is examples/pr-chat/.rrr. Start code-review from a pull_request job like the one above: exec rrr run code-review --origin "$PR_URL", with the GH_TOKEN and permissions below, CHAT_TRIGGER: ${{ vars.CHAT_TRIGGER || '@bot' }} (the review comment names it), in the same concurrency group (rrr-pr-<PR number>). Every reply carries a hidden <!-- rrr:chain=ch_… -->, so the next comment continues the same chain:

on:
  issue_comment: { types: [created] }
env:
  GH_TOKEN: ${{ github.token }} # the agents read the PR and the pops post with it; it expires with the job
  REPO: ${{ github.repository }}
  PR: ${{ github.event.issue.number }}
jobs:
  gate:
    # Cheap gate, before a runner starts: a PR comment with the trigger (repo variable CHAT_TRIGGER, default @bot),
    # from a member or collaborator.
    if: >-
      github.event.issue.pull_request && contains(github.event.comment.body, vars.CHAT_TRIGGER || '@bot') &&
      contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
    runs-on: ubuntu-latest
    outputs:
      write: ${{ steps.permission.outputs.write }}
    steps:
      - id: permission # members and collaborators include read and triage: only write access may make the bot push
        run: |
          permission=$(gh api "repos/$REPO/collaborators/$LOGIN/permission" --jq .permission || true) # a failed lookup = no write
          if [[ "$permission" =~ ^(admin|maintain|write)$ ]]; then echo write=true >> "$GITHUB_OUTPUT"; fi
        env:
          LOGIN: ${{ github.event.comment.user.login }}
  chat:
    needs: gate
    if: needs.gate.outputs.write == 'true'
    runs-on: ubuntu-latest
    timeout-minutes: 60 # the chat agent, then the code-change agent it may start (30m), and pops
    concurrency: # one at a time per PR, never cancelled mid-push
      group: rrr-pr-${{ github.event.issue.number }}
      cancel-in-progress: false
      queue: max # the default keeps one pending run and drops the rest: every comment gets its turn
    permissions: { contents: write, pull-requests: write }
    steps:
      - id: pr
        run: gh api "repos/$REPO/pulls/$PR" --jq '"ref=\(.head.ref)\nfork=\(.head.repo.full_name != .base.repo.full_name)"' >> "$GITHUB_OUTPUT"
      # Never check out a fork's code in a job that holds secrets: a fork PR gets the default branch instead.
      - uses: actions/checkout@v4
        with: { ref: "${{ steps.pr.outputs.fork == 'false' && steps.pr.outputs.ref || '' }}" }
      - uses: actions/setup-node@v4
        with: { node-version: 22 }
      - run: sudo apt-get update && sudo apt-get install -y bubblewrap socat && sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
      - run: npm i -g @anthropic-ai/[email protected] @divance/[email protected]
      - run: |
          comments=$(gh api --paginate "repos/$REPO/issues/$PR/comments" --jq '.[] | select(.user.login == "github-actions[bot]") | .body')
          chain=$(grep -o 'rrr:chain=ch_[0-9a-z]\{10\}' <<<"$comments" | tail -n 1 | cut -d= -f2)
          if [[ -n "$chain" ]]; then target=(--chain "$chain"); else target=(--origin "$PR_URL"); fi
          input=$(jq '{comment: .comment.body, author: .comment.user.login, url: .comment.html_url}' "$GITHUB_EVENT_PATH")
          exec rrr run chat "${target[@]}" --input - --json <<<"$input"
        env:
          PR_URL: ${{ github.event.issue.html_url }}
          CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          RRR_RUNNER_KEY: ${{ secrets.RRR_RUNNER_KEY }}
          RRR_SERVER: https://rrrrr.me-4de.workers.dev

issue_comment runs the default branch's workflow with the repo's secrets, whoever opened the PR (a "pwn request" if it ran their code): the gate only lets people with write access in (admin, maintain or write on the repo), and a fork PR's code is never checked out (the code-change agent reports it can't push to a fork). The chat agent's act_with is a schema enum: a comment can start only the agents listed there. run-agent starts the code-change agent with rrr run, so its meta.yaml has runner_key: true (no other pop gets RRR_RUNNER_KEY). The bot's replies come from github-actions[bot], which can't trigger workflows (no loops); for the same reason the code-change agent's pushes don't run CI on the PR: check out with a PAT or App token (actions/checkout token:) if they should.

Where credentials live: what rrr needs to run (RRR_RUNNER_KEY, Claude's login such as CLAUDE_CODE_OAUTH_TOKEN) goes in rrr's own env (in CI, the CI's secrets); what pops need goes in rrr's secret store, listed in meta.yaml. Server secrets only ever reach pops, never Claude.

Design: https://github.com/divanc/rrrrr/blob/main/docs/design.md