|
| 1 | +# flashpaste — agent guide |
| 2 | + |
| 3 | +Working rules for agents (Claude, Codex, etc.) editing this repository. |
| 4 | + |
| 5 | +## Versioning + releases — non-negotiable |
| 6 | + |
| 7 | +**Every push that bumps a version MUST be accompanied by a matching GitHub release.** Pushing a commit titled `v1.X` without a release is a defect. |
| 8 | + |
| 9 | +Workflow for any version bump: |
| 10 | + |
| 11 | +1. **Bump in this order:** |
| 12 | + - `README.md` — if a version string appears in the tagline or quick-start |
| 13 | + - `bin/tmux-paste-dispatch.sh` header `WORKING VERSION: v1.X — <date>` comment |
| 14 | + - Any other file with a `v1.X` literal — search with `git grep '^# WORKING VERSION'` and `git grep -F 'v1.'` |
| 15 | + |
| 16 | +2. **Commit message format:** |
| 17 | + ``` |
| 18 | + v1.X: <one-line summary> |
| 19 | +
|
| 20 | + <multi-paragraph body explaining what changed and why, |
| 21 | + matching the style of v1.10–v1.14 in the existing history> |
| 22 | +
|
| 23 | + Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
| 24 | + ``` |
| 25 | + Use `git log --pretty=fuller` to confirm the trailer is preserved. |
| 26 | + |
| 27 | +3. **Tag + push:** |
| 28 | + ```bash |
| 29 | + git tag -a v1.X -m "v1.X: <one-line summary>" |
| 30 | + git push origin main |
| 31 | + git push origin v1.X |
| 32 | + ``` |
| 33 | + |
| 34 | +4. **Create the GitHub release immediately after pushing:** |
| 35 | + ```bash |
| 36 | + gh release create v1.X \ |
| 37 | + --title "v1.X: <one-line summary>" \ |
| 38 | + --notes "$(git log -1 --pretty=%B v1.X | tail -n +3)" |
| 39 | + ``` |
| 40 | + The `tail -n +3` skips the title line + blank line so the body is the multi-paragraph description. |
| 41 | + - If this is a **breaking** change, add `--latest=true` and prepend a `### Breaking` block to the notes. |
| 42 | + - If experimental / not ready for general use, add `--prerelease`. |
| 43 | + |
| 44 | +5. **Verify** with `gh release view v1.X` and `gh release list --limit 5`. The new release MUST appear in the list before considering the bump complete. |
| 45 | + |
| 46 | +## Version-number policy |
| 47 | + |
| 48 | +- **Patch (`v1.X.Y`)** — bash-only fixes, doc changes, .desktop tweaks, install.sh hygiene. |
| 49 | +- **Minor (`v1.X`)** — new bash scripts, new systemd units, new env knobs. |
| 50 | +- **Major (`v2.X`)** — reserved for the daemon (`flashpasted`) becoming the default path and the bash dispatcher becoming a fallback only. As of v1.15 the daemon is opt-in; do not cut v2.0 until the dispatcher mode-flag flips by default. |
| 51 | + |
| 52 | +## Where work lives |
| 53 | + |
| 54 | +``` |
| 55 | +bin/ bash hot path (canonical, always works) |
| 56 | +rs/ Rust workspace — flashpaste-{common,dispatch,trigger,shoot} + flashpasted |
| 57 | +share/applications/ NoDisplay .desktop files for surfaceless Wayland clients |
| 58 | +systemd/ user units (clipboard-janitor, screenshot-watcher, flashpasted) |
| 59 | +examples/ config snippets for tmux + kitty |
| 60 | +``` |
| 61 | + |
| 62 | +When you touch the Rust code, never break the bash fallback. The trigger binary execs the bash dispatcher when the daemon is absent; the dispatch binary forks the bash dispatcher when the fast-path bails. Both fallbacks must keep working. |
| 63 | + |
| 64 | +## Four hard-won facts the code must preserve |
| 65 | + |
| 66 | +Stamped into `bin/tmux-paste-dispatch.sh`'s edit log; restated here so agents don't accidentally regress them: |
| 67 | + |
| 68 | +1. **`kitty @ send-text` is the only transport** that triggers Claude Code's image-paste handler. `tmux send-keys -t pane C-v` writes the byte but the handler doesn't fire. |
| 69 | +2. **`tmux bind -n C-v` recurses** when `\026` arrives via kitty send-text. `tmux unbind -n C-v` before send-text, rebind ~100ms later via `setsid -f sh -c 'sleep 0.1; tmux bind ...'` (detached so it survives parent exit). |
| 70 | +3. **Wayland-authoritative `has_image` policy.** Trust Wayland if it answers; only fall back to X11 when Wayland is fully silent. mutter's X11↔Wayland bridge is sticky and X11 keeps advertising stale `image/png` after fresh text copies — trusting it produces the obs #6881 "GitHub URL → [Image #9]" bug. |
| 71 | +4. **GNOME PrtScr saves but doesn't copy.** Auto-pickup loads `~/Pictures/Screenshots/<latest>.png` into the clipboard if ≤30s old and clipboard text is empty. |
| 72 | + |
| 73 | +If your change might affect any of these, add a regression test (or a manual test plan) to the commit body. |
| 74 | + |
| 75 | +## Build + test commands |
| 76 | + |
| 77 | +```bash |
| 78 | +# Bash syntax check |
| 79 | +bash -n bin/*.sh install.sh bootstrap.sh |
| 80 | + |
| 81 | +# Rust workspace |
| 82 | +cargo build --release --manifest-path rs/Cargo.toml |
| 83 | +cargo fmt --manifest-path rs/Cargo.toml --check |
| 84 | +cargo clippy --release --manifest-path rs/Cargo.toml -- -D warnings |
| 85 | + |
| 86 | +# Doctor |
| 87 | +bash bin/flashpaste-doctor.sh |
| 88 | +``` |
| 89 | + |
| 90 | +Do NOT run `cargo build` or `cargo update` without user approval — they hit crates.io. |
| 91 | + |
| 92 | +## Memory-lane reminder |
| 93 | + |
| 94 | +Per `/home/deadpool/.claude/CLAUDE.md`, three memory systems coexist on this machine. For flashpaste work, default to the file-based memory under `~/.claude-accounts/account2/projects/-home-deadpool/memory/`. Do not write project notes to claude-mem or Colony. |
| 95 | + |
| 96 | +## Parallel-agent workflow |
| 97 | + |
| 98 | +When dispatching multiple agents: |
| 99 | +- Each agent owns disjoint file paths (no cross-edits). |
| 100 | +- Pre-create shared scaffolding (e.g. `rs/Cargo.toml` workspace root) before dispatching so agents don't race on it. |
| 101 | +- Agents that need types/wire-formats from sibling crates should duplicate small helpers inline rather than depend across in-flight crates. Refactor to a shared crate after all agents land. |
| 102 | +- After agents return, run the sanity sweep: `bash -n` on every script, `cargo metadata --offline --no-deps` on the workspace. |
| 103 | + |
| 104 | +## Release notes voice |
| 105 | + |
| 106 | +Match the existing v1.10–v1.14 voice: |
| 107 | +- Lead with what the change does. |
| 108 | +- One paragraph per concern, no bullets unless it's a list of bug-fixes. |
| 109 | +- Cite specific commit hashes / log timestamps / observation IDs when relevant. |
| 110 | +- End with the side-effects the user will see ("janitor restarted; live preload script symlinked…"). |
| 111 | +- Co-Authored-By trailer for any AI-assisted change. |
0 commit comments