/mypos-legal-copilot:reply-and-close <TICKET-KEY> [--dry-run]from mypos-legal-copilot
After the lawyer has sent the reply from Outlook -- verify the sent email, file it + new documents to SharePoint via the n8n Legal Copilot workflow, capture lawyer edits as feedback, and transition the ticket to Done.
Ships in mypos-legal-copilot. Installing the plugin adds it to Claude Code.
The Copilot never sends email itself. /triage may have left an AI draft in the lawyer's Outlook Drafts folder (subject starts [AI DRAFT {ticket_key}]), but sending is always the lawyer's act. (The one automatic email, the intake-form invite, is sent by the n8n workflow at triage; see /triage Step 4b item 4. It counts as a touch below.) The flow is therefore lawyer-sends-first:
fb47470f-f5c2-44bc-8182-f2a22f059adbVAKq9Bra0RA0SdCOmyPOS Legal/Claude skills memory/Copilot/_knowledge/legal_copilot_memory.md (never the old private myPOS Legal 1/ copy)$ARGUMENTS:
<TICKET-KEY> (required) -- e.g., LEGAL-4321--dry-run (optional) -- show what would happen without filing or transitioningmcp__atlassian__getJiraIssue for the ticket with comments. Locate the most recent ## AI Triage comment and extract:
Draft Response section (this is the AI draft baseline for the edit diff)human_review_required state, and the SharePoint folder URLIf no AI Triage comment exists, tell the user to run /triage {key} first and stop.
Ask (skip if the user already said so in the invocation):
Has the reply for {ticket_key} been sent from Outlook?
(a) Yes -- sent from my mailbox
(b) Yes -- sent from the shared legal mailbox
(c) Not yet
If (c): stop. This command only runs after the reply is sent.
outlook_email_search with:
folderName: Sent Items (plus mailboxOwnerEmail if (b) in Step 2)query: the ticket key, else the ticket summary keywordsafterDateTime: last 7 daysThen read_resource on the best match to get the full body, subject, recipients, and sent timestamp.
If nothing is found: ask the user to either paste the sent text (accepted as the source of truth, noted as manual paste in the filing) or correct the mailbox/search terms. Do not proceed on guesswork.
If multiple matches: pick the most recent, show its subject + first line + timestamp, and confirm with the user.
Compare the sent body against the AI draft from Step 1:
| Comparison | Disposition |
|---|---|
| Identical | No edits captured. Continue. |
| Whitespace/formatting only | No edits captured. Continue. |
| Material changes | Capture as feedback in Step 6. |
Count the touches on this matter (definition in knowledge/two-touch-rule.md: a message from Legal to the requester that delivers the answer or asks them for something; acknowledgements and Copilot-only Jira comments do not count):
outlook_email_search on Sent Items (and the shared legal mailbox if (b) in Step 2) with the ticket key or summary keywords, afterDateTime = the ticket's created date. Count each distinct message once, including the reply found in Step 3. - The automatic intake invite: if the ticket carries the label intake:form-sent or an Intake-Invite: sent comment, count exactly one touch for it (the email went out from the Legal mailbox, not from the lawyer's Sent Items). The form answers then arrive as a comment on this same ticket, so both touches are counted here.knowledge/team-routing.md) that ask the requester something or give them the answer. Intake-Invite: and Intake-Form: comments are system comments, not lawyer comments, whoever authored them.Read two_touch_eligible from the ticket's path:* label (path:full_track = not eligible; no path:* label = triaged before 0.5.0, treat as not eligible). Record touches = N. If the ticket is eligible and N > 2, set two_touch_breached = true and note in one line why (e.g. "requester sent the contract only after the second ask"). The lawyer can correct the count in Step 5.
Show the lawyer:
About to file and close {ticket_key}.
Sent email found: {subject} -- {sent timestamp}
To: {recipient list}
Body preview: {first 300 chars}
New documents to file: {count}
Material edits vs AI draft: {yes/no}
Touches with requester: {N}{if two_touch_eligible: " (two-touch ticket" + (if two_touch_breached: ", BREACHED: " + reason) + ")"}
Confirm? (y / n / show-full-body / touches=<N> to correct the count)
If --dry-run, print the above and stop. Otherwise wait for explicit y.
Risk gate: if the AI Triage comment says human_review_required or shows risk flags, additionally require an existing Jira comment from the lawyer containing approved for send or risk reviewed. If absent, refuse to close and say exactly which comment to add.
Invoke the sharepoint-filer skill (n8n-backed) with:
ticket_key, ticket_summary, matter_type (from the AI Triage comment)files:
final_email. Raw MIME is not retrievable through the connector, so render what read_resource returned (headers: from/to/cc/date/subject, then the body) as a single .html string and pass it in text_documents (content_text, mime_type: text/html); no base64 needed. Name it {TICKET-KEY}_{tag}_{YYYY-MM-DD}_final.html./triage ran, handled per sharepoint-filer Step 3 item 4: signature / inline images skipped (image files only), real attachments up to 6 MB raw inline in documents, documents_from_jira only above 6 MB, at most 10 documents per call. Skip ones already listed in the case folder (check via sharepoint_search scoped to the case folder name).memory_notes -- a brief markdown block:
touches: {N}, and if two_touch_breached, two_touch_breached: {reason} (the board sweep's pattern detection reads these)### Lawyer feedback block from Step 7 if edits were materialtriage_metadata -- passed through from the AI Triage commentIf the case folder ends up with 0 files although documents were sent, say so; the filer retries once with documents only (sharepoint-filer Step 6). If the workflow still returns success: false, HALT before transitioning the ticket. Surface the error and let the lawyer retry. The audit trail must be complete on SharePoint before the ticket closes. An attachment listed in attachments_not_filed does not block the close.
Capture the returned sharepoint_folder_url, documents_filed[].sharepoint_url, memory_file_url and attachments_not_filed for Step 8.
If material edits were detected in Step 4, make sure the memory_notes block includes:
### Lawyer feedback ({ticket_key})
**Skill used:** {legal-triage-* skill, from AI Triage comment}
**AI draft excerpt:** "{first material-changed sentence as written by AI}"
**Lawyer changed to:** "{first material-changed sentence as sent}"
**Category:** {best guess: factual correction | tone | scope | jurisdiction-specific | other}
**Captured by:** /reply-and-close
The n8n workflow appends this to the shared memory file under the case entry. The next /triage-board run reads it back and surfaces emerging patterns. This gap (AI draft vs. what the lawyer actually sent) is the highest-signal training data we have.
Post a final comment on the ticket:
**Reply sent (by lawyer) and ticket closed**
Sent to: {recipient list} on {sent timestamp}
Filed to SharePoint: [{matter_type}/{ticket_key}/]({sharepoint_folder_url})
- Final email: [{final.html}]({sharepoint_url_of_final_email})
- {N} new attachments (if any)
{if attachments_not_filed: "- Attachments not filed: {filename} ({reason}), ..."}
{if material edits: "Lawyer-edited draft -- {summary of edits} -- captured to memory file."}
Memory file: [legal_copilot_memory.md]({memory_file_url})
*Closed by Legal Copilot via n8n workflow VAKq9Bra0RA0SdCO.*
Then set the touch labels: read the current labels, merge in touches:{N} (plus two-touch-breached when two_touch_breached), and write them back with one call to the Atlassian tool whose suffix is editJiraIssue. Never drop existing labels.
Then transition to Done (match Atlassian tools by suffix; the newer connector has no getTransitionsForJiraIssue):
getTransitionsForJiraIssue exists, use it to find the Done transition ID. Otherwise pass the transition by name (Done) to the tool in step 2.transitionJiraIssue to apply it.Filed and closed {ticket_key}:
Sent by lawyer: {timestamp} to {recipient list}
Filed to SharePoint: {sharepoint_folder_url} (final email + {N} new attachments)
Touches with requester: {touches}{if two_touch_breached: " -- two-touch target missed (" + reason + ")"}
Memory file updated: {memory_file_url}
Jira: transitioned to Done
{if edits captured: "Lawyer edits captured ({category}) -- will improve future drafts after the next /triage-board run"}
outlook_send_mail, outlook_send_draft or outlook_forward_mail, even though the connector exposes them.y confirmation in Step 5 (unless --dry-run, which changes nothing).human_review_required or risk-flagged ticket without the lawyer's approved for send / risk reviewed Jira comment.success: false, do not transition.myPOS Legal 1/ (trailing " 1").What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
7 commands in this plugin
/file-to-sharepoint/file-to-sharepointFile a ticket's attachments + latest AI draft directly to SharePoint via the n8n Legal Copilot workflow, and append a memory entry. Returns the live SharePoint URLs for the case folder and every uploaded file./legal-report/legal-reportGenerate an on-demand legal team productivity and overdue-tickets report. Pulls from Jira, prompts for off-Jira hours per lawyer, files a .docx to SharePoint./setup-copilotGenerated from the plugin's indexed repository (mypostech/mps-legal-legalcopilot-ai) — no native marketplace selected
npx claudepluginhub p/mypostech-mypos-legal-copilot