mitsupi (Agent Stuff)

repository·main·Indexed 25 days ago

https://github.com/mitsuhiko/agent-stuff

A collection of reusable skills, extensions, prompt commands, and themes for the Pi Coding Agent, published as the mitsupi package (v1.6.0). It includes specialized tools for GitHub management, Google Workspace, web browsing, Python development with uv, and session control, as well as custom Pi themes and prompt commands like /discuss for iterative planning.

Tokens
19.4K
Snippets
64
Records
120
Agent score
84%

What's inside mitsupi

  1. Overview of Agent Stuff components

    main

    The mitsupi package exports several types of assets via its package.json manifest:

    • Extensions: Pi extensions (e.g., session control, file browsing, UI enhancements).
    • Skills: Agent skills (e.g., GitHub CLI usage, Google Workspace access, web searching).
    • Themes: Pi themes (e.g., dayowl.json, modern-dark.json, nightowl.json).
    • Commands: Prompt commands (e.g., /discuss).
  2. Use the GitHub Skill via `gh` CLI

    main

    The GitHub skill allows interaction with GitHub using the gh CLI. It supports managing issues, pull requests, CI runs, and performing advanced queries via the API.

    Important: Always specify the --repo owner/repo flag when you are not working within a local git directory, or use direct URLs to target specific repositories.

  3. Quickstart: Set up an isolated tmux session

    main

    To prevent interference with your personal tmux configuration, use an isolated socket. Create a dedicated socket directory, initialize a new session, and use the -S flag for all subsequent commands.

    Workflow:

    1. Create a socket directory (default: ${TMPDIR:-/tmp}/claude-tmux-sockets).
    2. Start a new detached session with a unique name.
    3. Send commands using send-keys.
    4. Capture output using capture-pane.
    5. Clean up with kill-session.
    SOCKET_DIR=${TMPDIR:-/tmp}/claude-tmux-sockets
    mkdir -p "$SOCKET_DIR"
    SOCKET="$SOCKET_DIR/claude.sock"
    SESSION=claude-python
    
    tmux -S "$SOCKET" new -d -s "$SESSION" -n shell
    tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'python3 -q' Enter
    tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
    tmux -S "$SOCKET" kill-session -t "$SESSION"
  4. Use Inline Script Metadata for dependencies

    main

    The recommended way to manage dependencies for standalone scripts is to declare them directly in the file using a PEP 723 compliant metadata block. This allows you to run the script with a simple uv run script.py command without manual environment setup.

    # /// script
    # requires-python = ">=3.12"
    # dependencies = [
    #   "requests<3",
    #   "rich",
    # ]
    # ///
    
    import requests
    from rich import print
  5. Execute Google Workspace API calls via `workspace.js`

    main

    All API interactions are performed using scripts/workspace.js exec. You must provide the --email flag to specify which account profile to use.

    Command Syntax

    node scripts/workspace.js exec --email <account@example.com> <<'JS'
    // Your JavaScript code here
    JS

    Available Global Objects in exec scripts

    • auth: The authorized OAuth client.
    • google: The googleapis root object.
    • workspace.accountEmail: The email address of the currently selected profile.
    • workspace.call(service, methodPath, params, {version}): Executes a specific API method.
    • workspace.service(service, {version}): Returns a service instance.
    • workspace.whoAmI(): Returns information about the current authenticated user.

    Optional CLI Flags

    • --timeout <ms>: Sets execution timeout (default 30000, max 300000).
    • --scopes s1,s2: Specifies required OAuth scopes.
    • --script 'return 42': Alternative way to pass a script string.
    node scripts/workspace.js exec --email user@example.com <<'JS'
    const me = await workspace.whoAmI();
    const files = await workspace.call('drive', 'files.list', {
      pageSize: 5,
      fields: 'files(id,name,mimeType)',
    });
    return { me, files: files.files };
    JS
  6. Use the update-changelog skill

    main

    The update-changelog skill updates the repository's changelog file (targeting CHANGELOG.md or CHANGELOG) with changes between the last release and the current version (typically main).

    Workflow:

    1. Determine baseline version: If not provided, use the most recent git tag via git describe --tags --abbrev=0.
    2. Find commits: Retrieve all commits since the baseline version using git log <baseline-version>..HEAD.
    3. Update the file: Append new changes to the "Unreleased" section. If no "Unreleased" section exists, create one at the top of the file following the existing style (e.g., ## Unreleased or ## [Unreleased]).
    # Get the baseline version (if not provided)
    git describe --tags --abbrev=0
    
    # Get all commits since the baseline version
    git log <baseline-version>..HEAD
  7. Send input safely to tmux panes

    main

    To avoid shell splitting and expansion issues, follow these patterns:

    • Literal sends: Use -l to send commands as literal text: tmux -L "$SOCKET" send-keys -t target -l -- "$cmd".
    • Quoting: Use single quotes or ANSI C quoting for inline commands: tmux ... send-keys -t target -- $'python3 -m http.server 8000'.
    • Control keys: Use standard tmux notation: C-c, C-d, C-z, Escape.
  8. Define customizable parameters in OpenSCAD

    main

    To make parameters discoverable by the extract-params.sh tool, use specific comment formats next to your variable definitions:

    • // [min:max] — numeric range
    • // [min:step:max] — numeric range with step
    • // [opt1, opt2, opt3] — dropdown options
    • // Description text — plain description
    // Customizable parameters
    wall_thickness = 2;        // [1:0.5:5] Wall thickness in mm
    width = 50;                // [20:100] Width in mm
    height = 30;               // [10:80] Height in mm
    rounded = true;            // Add rounded corners
  9. Generate a human-centric session summary

    main

    Use the --human-summary flag to analyze how a user interacted with an agent. This mode focuses on the human's experience rather than the agent's actions. It analyzes:

    • Initial goals
    • Re-prompting and steering frequency
    • Types of interventions (corrections, clarifications, frustration)
    • Instruction specificity (vague vs. specific)

    Note: This feature uses claude-haiku-4-5 via the pi -p command to process the transcript.

    node ~/.pi/agent/skills/pi-share/fetch-session.mjs <gist-id> --human-summary
  10. Use the Apple Mail Skill tool

    main
    The apple-mail.sh bash script allows for searching, reading, and extracting attachments from Apple Mail's local storage on macOS. It is a read-only tool and does not modify any mail data. It works by querying the Apple Mail SQLite envelope index and reading .emlx files from disk.
  11. Manage Pull Requests and CI Runs

    main

    Use the following gh commands to inspect Pull Requests and GitHub Actions workflow runs:

    • Check CI status on a PR: gh pr checks <pr-number> --repo owner/repo
    • List recent workflow runs: gh run list --repo owner/repo --limit <number>
    • View a specific run and its steps: gh run view <run-id> --repo owner/repo
    • View logs for failed steps only: gh run view <run-id> --repo owner/repo --log-failed
  12. Pre-cache MLX Whisper models

    main

    To avoid downloading models during transcription, you can pre-cache the default MLX Whisper models. The skill uses mlx-community/whisper-large-v3-turbo for fast/balanced modes and mlx-community/whisper-large-v3-mlx as a high-quality fallback.

    Run the following command from the skill directory to pre-cache or refresh these models:

    cd /Users/mitsuhiko/Development/agent-stuff/skills/audio-transcription
    ./precache-models.py