agentleFS
delorenjdelorenj/ssbnk/AGENTS.md

ssbnk

AGENTS.md2 starsChanged 50 days agoMITView on GitHub

Core stack: - Watcher/API: Go (/watcher) — serves everything: assets, API, and the built UI - Management UI: Astro + React (/ui) — static build served by the watcher - Static hosting: Nginx (/web) — LEGACY, only in the packaged all-in-one image - Remote uploaders: Bash scripts on remote machines (/scripts) Full generated docs live in docs/ (start at docs/index.md).

  • Reads credentials
  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository5 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Ensure .env uses a real, existing host screenshot directory for SSBNK_SCREENSHOT_DIR.

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

ScreenShot Bank (ssbnk)

Project Overview

ssbnk is a self-hosted screenshot/screencast hosting service. It watches local folders, normalizes filenames, hosts assets, and exposes "latest" retrieval endpoints. Remote machines upload screenshots via the /upload API, and the URL is copied to the host clipboard automatically.

Core stack:

  • Watcher/API: Go (/watcher) — serves everything: assets, API, and the built UI
  • Management UI: Astro + React (/ui) — static build served by the watcher
  • Static hosting: Nginx (/web) — LEGACY, only in the packaged all-in-one image
  • Remote uploaders: Bash scripts on remote machines (/scripts)

Full generated docs live in docs/ (start at docs/index.md).

Core Components

1) Watcher (/watcher)

  • Watches screenshot and screencast directories via fsnotify.
  • Converts videos to GIF (ffmpeg) and stores metadata JSON in watcher-data/metadata/.
  • Copies URL to host clipboard on both local screenshots and remote uploads.
  • Writes last screenshot filename to /tmp/ssbnk/last-screenshot for paste-image support.
  • Endpoints (all served by the watcher on SSBNK_API_PORT, default 80):
    • /api/screenshots paginated JSON listing for the UI (limit/offset)
    • /latest metadata-driven lookup (302 redirect)
    • /hybrid metadata + filesystem fallback
    • /stateless filesystem-only lookup
    • /upload remote upload endpoint (requires X-Upload-Key header)
    • /health metadata/file consistency status
    • Hosted assets served root-level (/<file>.png), unknown paths fall through to the UI's index.html

2) Management UI (/ui)

  • Astro 6 + React 19 + TypeScript + Tailwind 4 + shadcn (on @base-ui/react).
  • Static build (npm run build → dist/); the watcher serves it from SSBNK_UI_DIR (default /ui). No separate UI server.
  • Single screen: ScreenshotGallery.tsx calling GET /api/screenshots. ui/ has its own .git (nested repo).

3) Web Server (/web) — LEGACY

  • Nginx configs from the retired 3-container architecture; only used inside the packaged all-in-one image (root Dockerfile, supervisord).
  • Proxies only /upload and /latest to the watcher on port 31243. The current compose.yml stack has no Nginx container.
  • web/html/ holds the live hosted assets.

4) Scripts (/scripts)

  • paste-image.sh: Ctrl+Shift+V shortcut handler. Sets image data on clipboard, simulates Ctrl+V via ydotool, restores original clipboard. Symlinked to ~/.local/bin/ssbnk-paste-image.
  • remote-screenshot-upload.sh: Uploader for remote machines. Uses inotifywait (Linux) or fswatch (macOS) to watch for new screenshots and POST them to the upload endpoint (with retries and event dedupe).
  • install-remote-client.sh: Interactive installer for remote machines — deps, ~/.config/ssbnk/remote.env, systemd user service (Linux) or launchd agent (macOS), guided macOS privacy (TCC) grant flow, end-to-end test.
  • cleanup.sh: Retention-based cleanup run by the ssbnk-cleanup container via cron.

5) Typer CLI (/cli)

  • Python Typer CLI (ssbnk) installed globally via uv tool at ~/.local/bin/ssbnk (and wrapped in .mise/scripts/ssbnk).
  • Commands:
    • ssbnk get: Resolves and prints the path of the most recent screenshot and automatically copies it to the Wayland clipboard via wl-copy.
    • ssbnk config: Inspects and prints active ssbnk configuration variables across environment variables, .env, and defaults (supports --plain, --json, and single-key lookup).

6) Remote Upload Services

Deployed on Tailnet machines to auto-upload screenshots:

  • tiny-chungus (Arch Linux): systemd user service at ~/.config/systemd/user/ssbnk-remote-upload.service
  • carries-macbook-air (macOS): launchd agent at ~/Library/LaunchAgents/sh.delo.sh.remote-upload.plist
  • Config on remote machines: ~/.config/ssbnk/remote.env (contains SSBNK_HOST, SSBNK_UPLOAD_KEY, SSBNK_SCREENSHOT_DIR)

Key Implementation Details

  • /tmp/ssbnk/last-screenshot contains just the filename (not a full path). The paste-image script resolves it relative to the project's web/html/ directory.
  • The watcher container mounts /home/delorenj/data/ssbnk/hosted as /data/hosted (hardcoded host paths in compose.yml). Container paths like /data/hosted/file.png don't exist on the host.
  • Clipboard access from the container works via the mounted Wayland socket (${XDG_RUNTIME_DIR} → /run/user/1000) + wl-copy; X11 socket as fallback. The watcher also has FIFO (/tmp/ssbnk-clipboard) and HTTP (localhost:9999) clipboard fallbacks with no host-side listeners anymore.
  • GNOME custom shortcuts don't inherit WAYLAND_DISPLAY or XDG_RUNTIME_DIR, so paste-image.sh sets these explicitly.
  • GNOME/Wayland doesn't support wtype (virtual-keyboard protocol). Use ydotool for input simulation instead.

Build and Run

# full stack
docker compose up -d

# rebuild watcher after changes
docker compose up -d --build ssbnk-watcher

# watcher only (local dev)
cd watcher && go run main.go

# ui
cd ui && npm install && npm run dev

Dev/Test Conventions

  • Go tests: cd watcher && go test ./... (or mise run test)
  • UI has no test script — npm run build is the smoke check
  • Hosted files: web/html/ (production: /home/delorenj/data/ssbnk/hosted)
  • Metadata: watcher-data/metadata/ (production: /home/delorenj/data/ssbnk/metadata)
  • Ensure .env uses a real, existing host screenshot directory for SSBNK_SCREENSHOT_DIR.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.