feat: add gt mol attach-from-mail command (gt-h6eq.7)

Allows agents to self-pin work from mail messages. The command:
1. Reads a mail message by ID
2. Extracts molecule ID from the body (attached_molecule:, molecule_id:, etc.)
3. Attaches the molecule to the agent's pinned bead (hook)
4. Marks the mail as read

Includes unit tests for the molecule ID extraction logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-23 11:34:22 -08:00
parent 8be2146a48
commit 00c64a075c
3 changed files with 251 additions and 0 deletions

View File

@@ -197,6 +197,30 @@ Example:
RunE: runMoleculeAttachment,
}
var moleculeAttachFromMailCmd = &cobra.Command{
Use: "attach-from-mail <mail-id>",
Short: "Attach a molecule from a mail message",
Long: `Attach a molecule to the current agent's hook from a mail message.
This command reads a mail message, extracts the molecule ID from the body,
and attaches it to the agent's pinned bead (hook).
The mail body should contain an "attached_molecule:" field with the molecule ID.
Usage: gt mol attach-from-mail <mail-id>
Behavior:
1. Read mail body for attached_molecule field
2. Attach molecule to agent's hook
3. Mark mail as read
4. Return control for execution
Example:
gt mol attach-from-mail msg-abc123`,
Args: cobra.ExactArgs(1),
RunE: runMoleculeAttachFromMail,
}
var moleculeStatusCmd = &cobra.Command{
Use: "status [target]",
Short: "Show what's on an agent's hook",
@@ -350,6 +374,7 @@ func init() {
moleculeCmd.AddCommand(moleculeAttachCmd)
moleculeCmd.AddCommand(moleculeDetachCmd)
moleculeCmd.AddCommand(moleculeAttachmentCmd)
moleculeCmd.AddCommand(moleculeAttachFromMailCmd)
rootCmd.AddCommand(moleculeCmd)
}