Avoiding being a Meat Proxy with Claude Code Mods

I'm very much not a fan of people being meat proxies and pasting AI-generated output to each other, least of all me.

It's super frustrating to read it, and feels wasteful of my time, as well as anyone else in the conversation, who are having to unpack the verbose text for what is actually being communicated.

That rant aside, sometimes I want to copy some text from an LLM, or sometimes you do need to reply to someone based on what an LLM has given you - sometimes it's passive aggressive, but sometimes it's actually needed - although I'd still recommend some edits + rewords.

As someone who's very careful about attributing my use of LLM-derived code, as well as on this blog, I'm also very conscious of the source of the text I share in chat messages, so want to make sure I attribute the model that's come up with the words I'm parroting.

This results in me writing something like:

Via Claude Sonnet 5.5:

```markdown
{... response from agent goes here ...}
```

I've ended up repeating this one too many time recently that I decided to look at how I could automate this.

I didn't really want to introduce a new /copy-with-model skill, and require that my muscle memory changing, as I wanted to be able to continue /copying if possible. I remember hearing about Claude Code's Mods system which was recently added, and wondered if this may help out here.

It turns out, yes, it's fairly straightforward to create a Mod to intercept the /copy and add extra info into it πŸ‘πŸΌ

import type { Register } from "claude-code";

export const register: Register = (on) => {
  on("command.run", { command: "copy" }, async ($, e) => {
    const arg = e.args.trim();
    const n = arg === "" ? 1 : Number(arg);
    if (!Number.isInteger(n) || n < 1) {
      return { text: `Usage: /copy [N] where N is 1 (latest), 2, 3, … Got: ${arg}` };
    }

    const messages = await $.session.messages();
    const replies = messages.filter((m) => m.role === "assistant" && m.text !== "");
    const reply = replies.at(-n);
    if (reply === undefined) {
      return { text: `No assistant response #${n} to copy.` };
    }

    const model = await $.session.model();
    const lines = [
      "Via `" + model + "`:",
      "",
      "`````markdown",
      reply.text,
      "`````",
    ];
    const text = lines.join("\n");

    const copied = await $.ui.copy({ text });

    return {
      text: copied.isCopied
        ? `Copied response #${n} with model info (\`${model}\`).`
        : `Copy failed: ${copied.reason}`,
    };
  });
};

This way, I now get that resulting output automagically inserted every time I do a /copy, which is much better!

Written by Jamie Tanna's profile image Jamie Tanna on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #ai #llm #claude-code.

πŸ€– Content in this blog post includes code derived from the following LLMs:

PurposeModelNotes
Codeclaude:sonnet-5.5Generated the bulk of the Mod
Editorial supportNo usage
Prose (verbatim or edited)No usage
Images, visualisation, data and/or metricsNo usage

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.