Paperclip מעיר בעצמו את הסוכן המשויך על כל הערת-משתמש ב-issue פתוח
(routes/issues.js: reason "issue_commented", mutation "comment"). הפלאגין דילג
על הניתוב רק כש-`reopened === true`, ולכן כל הוראת-יו"ר על issue פתוח
משויך-CEO הפעילה שתי ריצות-CEO במקביל (legal-ai #772; 2026-11-01 על CMPA-232:
3 ריצות כפולות, ~9$, רשומות chair_feedback כפולות).
הכלל עכשיו הוא מראה של `needs_ceo_run()` ב-legal-ai (comment-routing.ts):
issue פתוח + assignee-סוכן → הנייטיבי מכסה → אין invoke, יש marker.
סגור / משויך-אדם / לא-משויך → הנייטיבי מת → ניתוב כמו היום (#164/#454).
Closes#16
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ctx.http.fetch נחסם ע"י הגנת-SSRF של Paperclip כלפי 127.0.0.1:8001 (stale-case-reminder,
weekly-feedback-analysis); sync-case-status קיבל 401 על GET /api/cases (session-only) ועובר
לנתיב המינימלי /api/cases/status-index שנוסף ל-legal-ai (PR #1118).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
הסקריפט `scripts/int9-guard.mjs` כבר ב-`main` (PR #14) ורץ ידנית דרך
`npm run int9:guard`. הקובץ כאן הוא החיווט שלו ל-CI.
**אל תמזג לפני שיירשם runner ל-plugin-legal-ai.** ה-runner היחיד על nautilus
רשום בהיקף-repo ל-`legal-ai` בלבד (`action_runner.repo_id = 6`), ולכן job של
הריפו הזה לא נאסף לעולם — נמדד: ריצה 3200 / job 3250 ב-`queued` עם
`started_at: 1970-01-01`, בזמן שה-runner היה `busy: false` והריץ 7/7 שערים
של legal-ai. מיזוג עכשיו היה מייצר check תקוע-לנצח על **כל** PR עתידי בריפו.
ה-PR הזה הוא גם המדידה: ביום שיירשם runner הוא יהפוך לירוק מעצמו.
Refs ezer-mishpati/legal-ai#618
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ל-`issue.status` כותב לגיטימי אחד בפלאגין: הג'וב `sync-case-status`
(`ctx.jobs.register("sync-case-status", …)` ב-`src/worker.ts`). עד היום
האכיפה הייתה code-review בלבד — וזה בדיוק מה שאפשר את הבאג של legal-ai
#446 (flip-flop `done → in_progress`), כותב שני שנכנס בלי שאיש שם לב.
`scripts/int9-guard.mjs` — Node ESM חסר-תלויות. טוקנייזר תו-תו
(מחרוזות/תבניות עם `${}` מקונן/הערות/רגקס-ליטרלים) בונה מסכת "קוד רגיל",
ומעליה: כל `jobs.register("sync-case-status", …)` מגדיר **טווח-תווים מותר**
(איזון-סוגריים), וכל `issues.update(…)` שרשימת-הארגומנטים שלו מכילה את
המזהה `status` חייב לשבת בתוכו.
הגרעיניות היא טווח-קוד ולא רשימת-קבצים (הדפוס של `leak_guard.py` ב-legal-ai)
במכוון: הקריאה המותרת היחידה וכל קריאה עתידית אסורה יושבות באותו
`worker.ts`. הטווח נגזר מהמבנה האמיתי, ולכן שורד מעבר של הג'וב לקובץ אחר —
ושינוי שם-הג'וב מפיל את השער בקול במקום לפתוח חור שקט.
חריגה מכוונת: `// noqa: INT9 — <נימוק>`. `noqa: INT9` בלי נימוק הוא הפרה
בעצמו — אין השתקה שקטה. כשל-פענוח (סוגר שלא נסגר) מפיל את השער ולא נבלע.
`--self-test` מריץ 5 פיקסצ'רים (`scripts/fixtures/int9/`, מחוץ ל-`src/`
בכוונה) ומאמת ספירת-הפרות מדויקת — הוכחה שהשער נושך.
**ללא חיווט-CI.** ה-runner היחיד על nautilus רשום בהיקף-repo ל-`legal-ai`
בלבד (`action_runner.repo_id = 6`), ולכן job של הריפו הזה לא נאסף לעולם
(נמדד: ריצה 3200 / job 3250 תקוע ב-`queued`, `started_at: 1970-01-01`).
קובץ ה-workflow יושב ב-PR נפרד וחסום, כדי שלא ייכנס ל-`main` שער שמייצר
check תקוע-לנצח בכל PR עתידי. עד אז: `npm run int9:guard` /
`npm run int9:guard:self-test`.
מגבלה מוצהרת: תיל-מעידה סטטי, לא הוכחה — `issues.update(id, patch)` שבו
אובייקט-העדכון נבנה במקום אחר אינו נתפס.
Refs ezer-mishpati/legal-ai#618
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
מפת-התוויות העברית הקשיחה ב-onWebhook הייתה מקור-האמת השני לאותו enum
של סטטוסי-תיק, והספיקה לסטות: חסרו בה analyst_verified ו-research_complete
(שנוספו ל-case_status_model.py ב-30.6), והיו בה חמישה מפתחות מתים —
uploading, brainstorming, drafting, in_progress ו-qa_failed. #604 תיקן את
המפה הראשונה (CASE_STATUS_TO_ISSUE_STATUS); זו השנייה.
- statusLabels נמחקת; התווית נגזרת מ-GET /api/status-model דרך labelFor()
הקיימת — אותו SSOT שהג'וב sync-case-status כבר צורך (G2).
- resolveStatusLabel() חדשה ב-sync-target.ts (המודול הטהור): מרכיבה את
labelFor ומחזירה גם את **סיבת** הנפילה-לגולמי, כדי שההיגיון יהיה
בר-בדיקה — worker.ts אינו ניתן ל-import בטסט (runWorker ברמת-המודול).
- אין בליעה שקטה (כלל-הנדסה §6): סטטוס שנטען ואינו במודל → logger.warn עם
מספר-התיק והסטטוס; מודל שלא נטען כלל (כשל-רשת או LegalApi חסר) → שני
logger.error נבדלים. בכל המקרים התגובה עדיין מתפרסמת והערת-ה-CEO עדיין
נורית — תווית חסרה אינה מפילה webhook.
- oldStatus מתורגם אף הוא לתווית (היה מודפס כמפתח-אנגלית בתוך משפט עברי).
- legalApi עשה hoist ליד pluginCtx ומועבר מפורשות ל-handleCaseStatusWebhook
— אותו מופע, לא שני.
- AC2: הוסרו שתי רשימות-הסטטוסים הקשיחות הנוספות ב-worker.ts — ה-enum
המיושן ב-legal_case_update (חסם 8 סטטוסים חוקיים והתיר את in_progress
שאינו case.status; המניפסט כבר מגדיר את השדה כמחרוזת חופשית, והוולידציה
האמיתית היא server-side) והמנייה בתיאור legal_case_list.
Invariants: G2 (מקור-אמת אחד לתוויות, בשני הצרכנים) · G1 (נרמול-במקור —
הפלאגין מושך מה-SSOT במקום להחזיק העתק סטטי) · G12 (legal-ai לא נגע כלל;
אפס סמל ספציפי-Paperclip נכנס אליו) · X7 INV-INT9 (onWebhook עדיין אינו
כותב issue.status — המשבצת השמורה נשארת שמורה) · כלל-הנדסה §6.
tsc --noEmit נקי · biome check src/ נקי · node --test 39/39.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
הג'וב סיים עד כה בשורה אחת — `casesChecked` — שאינה מבחינה בין "אין מה
לעשות", "נדחה בכוונה" ו"נפל". 13,872 ריצות דיווחו בריאות ירוקה, ובפועל
היו בהן 389 כתיבות בלבד; האבחנה ב-#604 נבנתה על היעדר-ראיה.
כל ריצה פולטת מעתה: scanned · matched · written · declined{no_linked_issues,
no_writable_root, ambiguous_writable_roots, unknown_status, already_matching}.
הפליטה יושבת ב-`finally` וזורקת את השגיאה המקורית הלאה, כך שריצה שנפלה
נשארת `failed` ב-`plugin_job_runs` **וגם** נושאת את המונים שהספיקה לצבור.
שני משטחים קיימים וצורכים, שנמדדו:
- `ctx.logger.info` → stdout של pm2 — שם בוצע בפועל האבחון של #626/#637.
- `ctx.metrics.write` → `plugin_logs` (level='metric') — הטבלה שפאנל
"Recent Logs" בדף-הפלאגין מרנדר, וניתנת לשאילתת-SQL (AC4).
המונים בתוך מחרוזת-ההודעה ולא רק ב-meta, כי שני המשטחים מתעלמים מ-meta
בפועל (הפאנל מרנדר createdAt/level/message בלבד; ומ-pino נמדד ששדה
`{error:…}` נופל). נדרשה הרשאת `metrics.write` ב-manifest — זו הדרך
היחידה לכתוב ל-`plugin_logs`.
אפס שינוי בהתנהגות-הכתיבה: `sync-target.ts` לא נגע כלל, ובכלל זה
`NON_WRITABLE_STATUSES` (הכרעת-יו"ר, #626).
Closesezer-mishpati/legal-ai#617
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
הג'וב sync-case-status יכתוב מעתה גם על שורש-issue ב-in_review. blocked
ו-CLOSED_ISSUE_STATUSES (done/cancelled — הגנת #446) נותרים כפי שהם.
ההערה מעל הסט מתעדת את ההכרעה, את מחירה (issue ממתין-ליו"ר עשוי לרדת
מתור-הביקורת תוך 15 דק') ואת מסלול-החזרה.
Refs ezer-mishpati/legal-ai#626
שלושה כשלים בג'וב sync-case-status, שהשביתו אותו בשקט מאז 22.7:
1. המפה הקשיחה CASE_STATUS_TO_ISSUE_STATUS נותקה מ-case_status_model.py
(מקור-האמת בצד legal-ai): חסרו analyst_verified ו-research_complete
שנוספו ב-851a4fb, ונשארו בה 3 מפתחות מתים (uploading/brainstorming/drafting).
סטטוס חסר נפל ל-`continue` — בלי לוג ובלי שגיאה. כעת המיפוי נגזר מ-
GET /api/status-model דרך resolveIssueStatus/labelFor: terminal→done,
הסטטוס הראשון בסדר→todo, השאר→in_progress. סטטוס חדש בצד legal-ai לא
דורש עוד עריכה כאן (G2 — מקור-אמת אחד).
2. companies[0] בלבד — מתוך שתי החברות, אחת מעולם לא נסרקה (נמדד: 135 מול
67 issues מקושרי-תיק). כעת נסרקות כל החברות, וה-companyId של המועמד
שנבחר הוא זה שנכתב אליו — לא החברה הראשונה גורפת.
3. דילוג שקט על סטטוס לא-מוכר → ctx.logger.warn עם שם-הסטטוס ומספר-התיק.
אימות מול השרת החי: 0 סטיות מול המפה הישנה על כל 10 הסטטוסים שכיסתה,
+2 שכוסו לראשונה. סימולציה על הנתונים החיים: דילוג-שקט 3→0, שורות-לוג 3→6,
כתיבות בפועל 0→0 — כלומר אין נסיגה ל-flip-flop של #446.
לוגיקת בחירת-היעד (#446) לא שונתה: pickSyncTargetIssue, isWritableStatus,
CLOSED_ISSUE_STATUSES ו-NON_WRITABLE_STATUSES זהות; ל-SyncCandidate נוסף שדה
companyId בלבד (passthrough). 8 הטסטים הקיימים עוברים ללא שינוי באסרשנים,
+7 חדשים.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
הג'וב sync-case-status כתב על כל issue מקושר-לתיק שסטטוסו שונה מהיעד — השומר
היחיד היה 'issue.status !== targetStatus'. לכן הוא החזיר sub-tasks שנסגרו
(done) ל-in_progress, כפי שתועד ב-CMPA-140 / תיק 8125-09-24.
בחירת-היעד חולצה ל-src/sync-target.ts: נבחר שורש יחיד (parentId === null)
שאינו done/cancelled ואינו in_review/blocked; אפס או יותר-מאחד → לא נכתב
דבר, ונרשם לוג עם הסיבה. שני הקבועים מובחנים בכוונה — CLOSED_ISSUE_STATUSES
הוא ההגדרה היחידה של 'סגור' (מראה של legal-ai/web/paperclip_client.py:561),
ו-NON_WRITABLE_STATUSES הוא 'מצב בבעלות Paperclip/בהמתנה-לאדם': כתיבת
in_progress על issue ב-in_review מזמינה auto-block תוך דקה
(legal-ai/docs/paperclip-quirks.md §3) וגונבת אותו מתור-הביקורת של היו"ר.
הלולאה הכפולה הוחלפה במעבר אחד + קיבוץ למפת case_number→מועמדים; הקיבוץ
נדרש כדי לבחור 'השורש היחיד', וכתוצר-לוואי O(NxM)→O(M) קריאות state.get.
מבחן-רגרסיה (node --test, ללא תלויות חדשות) משחזר את 11 ה-issues שנמדדו
לתיק 8125-09-24 ומוכיח את הדלתא: הכלל הישן היה כותב על CMPA-140, החדש לא.
בבעלות ריפו זה בהחלטת פאנל — העברת הלוגיקה ל-legal-ai נפסלה כי היא מוסיפה
UPDATE ישיר ל-DB של Paperclip, בהפרת INV-INT4 (GAP-24/25).
plugin.json הצהיר 16 כלים ולא נקרא ע"י אף אחד: המניפסט האמיתי הוא
src/manifest.ts → dist/manifest.js, שנפתר דרך package.json →
paperclipPlugin.manifest. הפער ניכר בכך שהקובץ חסר את
legal_predecessor_context, שנוסף למניפסט האמיתי ב-b9906f6.
ה-16 השגוי הזה הוא מקור ה-"16 tools" ב-~/CLAUDE.md, בעוד שה-loader
רושם 9 — המספר שבמניפסט האמיתי ובמאניפסט השמור ב-DB.
אומת לפני המחיקה: אין הפניה לקובץ בקוד, בבנייה, או בקוד השרת.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
מיגרציה 0164_plugin_config_company_scope הפכה את config של פלאגינים
ל-company-scoped, ו-`ctx.config.get()` בלי companyId זורק
"company context is required" כשה-host לא יכול לגזור חברה מההקשר.
ב-setup() אין חברה בהגדרה, ולכן הקריאה שם הפילה את הפעלת הפלאגין כולו
בשדרוג מ-2026.609.0 (status=error, 0 כלים רשומים).
- setup() כבר לא קורא config; LegalApi מקבל resolver עצל במקום URL קבוע
(baseUrl שימש במקום אחד בלבד, ולכן 17 ה-tool handlers לא נגעו)
- resolveApiBase() פותר לפי הסדר: companyId מפורש → גזירת ה-host
מההקשר → סריקת החברות ב-CEO_AGENT_IDS → ברירת מחדל
- data handlers מעבירים params.companyId; jobs מתוזמנים חסרי חברה
(PluginJobContext לא כולל companyId) ולכן נשענים על הסריקה
- שדרוג @paperclipai/plugin-sdk ל-2026.722.0
מאומת: הפלאגין עולה עם אותה חתימת רישום כמו לפני השדרוג —
eventSubscriptions:2, jobs:4, webhooks:1, tools:9, בלי warnings.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ה-manifest.tools הוא המקור-הקובע לרישום/חשיפת כלים ב-Paperclip — ctx.tools.register
ב-worker.ts נותן רק את ה-handler. בלי הצהרה ב-manifest, הכלי לא נחשף (הלוגים הראו
toolCount=8, בלי legal_predecessor_context). מוסיף את ההצהרה → toolCount=9, הכלי חשוף.
אומת חי: reinstall+restart → logs מראים toolCount:9 + legal_predecessor_context רשום.
(המשך #220; משלים את PR #5.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
מוסיף כלי-plugin שהסוכן קורא בעת continuation כדי לראות מה ריצות קודמות על התיק
הסיקו (ה-summary של כל heartbeat), במקום לגלות-מחדש הקשר מאפס (blind heartbeat).
- legal-api.ts: getPredecessorForCase(caseNumber) → GET
/api/operations/cases/{case}/predecessor (endpoint שנוסף ב-legal-ai #410).
- worker.ts: רישום הכלי (case_number param) — מעצב digest קריא (agent·issue·when·
status + summary חתוך ל-600 תווים, newest-first).
ארכיטקטורה (ההכרעה מהדיון): הכלי חי ב-plugin — המעטפת המוצהרת שמותר לה לדבר גם
Paperclip וגם legal-ai web — ולא ב-mcp-server (הליבה נשארת עיוורת-פלטפורמה, G12).
זו הסיבה שזה plugin-tool ולא mcp→web seam.
בנייה: tsc + biome נקיים. פריסה (ידנית, pm2): npm run build → plugin install →
pm2 restart paperclip. המשך: הוראת-HEARTBEAT לקרוא בעת continuation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The sweep assumed listComments returns oldest-first and took
comments[length-1] as "the last comment". listComments actually returns
newest-first, so the sweep routed the OLDEST user comment instead of the
newest — and routed it whether or not an agent had already answered. Caught
live on CMPA-116: the sweep routed a stale 6-day-old "agent didn't activate"
gripe (already answered minutes later) instead of the chair's real pending
request ("I attached case law — go back to the precedent-researcher and check
the docs"), so the CEO correctly no-op'd and the real request stayed dropped.
Fix: order-independent. Compute the newest USER comment and newest AGENT
comment by createdAt; route only when the chair spoke last among real
participants (newest user > newest agent, or no agent comment), so an agent
reply — but NOT an automated system "draft ready" line — counts as handled.
Also fix the same latent array-order assumption in the event-handler body
fallback (reduce-by-createdAt instead of comments[length-1]).
Self-heals the stuck marker on CMPA-116 (newest-user id differs from the
wrongly-stamped one). Refs legal-ai #164.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The event-driven comment→CEO route (issue.comment.created) is best-effort:
a failed/coalesced/cancelled CEO invoke, or a comment that lands while an
agent is mid-run, can leave a chair comment unrouted with nothing to retry.
This is exactly how a chair comment on CMP-190 (2026-06-30) was silently
dropped — the host-native wake was cancelled (issue_execution_promoted /
assignee_changed) and no plugin route fired.
Adds a reconciliation sweep (route-pending-comments, every 2 min) that
re-routes any active issue whose LAST comment is the chair's (no agent reply
after it) and whose id ≠ the per-issue `last-routed-comment-id` marker.
Both the fast path and the sweep stamp the marker → idempotent, no
double-routing of healthy comments. "Last comment is user" precisely targets
the failure (chair commented, no agent response) and skips historically
answered comments, so first-run-after-deploy footprint is 0.
- worker.ts: extract shared routeCommentToCeo() + markCommentRouted();
event handler stamps marker (incl. the native-handles-it branch);
register route-pending-comments sweep with per-company/per-issue guards.
- manifest.ts: declare route-pending-comments job (*/2 * * * *).
Invariants: G12 (Paperclip touch only in the declared wrapper — plugin),
G2 (extends the existing route, no parallel path). Refs legal-ai #164.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When ctx.issues.listComments() throws, the previous catch silently
replaced commentBody with "(שגיאה בקריאת התגובה)" — causing CEO to
receive garbage text instead of an actionable instruction.
Now: falls back to payload.bodySnippet (always present in Paperclip
webhooks), logs a proper warning with the real error for diagnosis,
and if even bodySnippet is empty, sends a clear meta-instruction
telling CEO to read comments directly instead of corrupted content.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The `issue.comment.created` handler read `payload.issueId`, which the current
Paperclip host never sends — the issue id arrives in `event.entityId` and the
payload carries `commentId`/`bodySnippet`/`reopened` instead. So the handler
hit "missing issueId, skipping" on every user comment and the documented
"user comment → CEO" routing was silently dead.
Diagnosed on case 8124-09-24 (CMPA): a question commented on an analyst's
`done` sub-issue never reached the CEO. The plugin skipped; Paperclip's native
reopen-on-comment wake then targeted the sub-issue's assignee (the analyst) and
the queued CEO run was cancelled with `issue_assignee_changed`.
Fix:
- issueId from `event.entityId` (fallback `payload.issueId` for host-version skew).
- Resolve full comment body by matching `payload.commentId` in listComments
(payload only has a truncated `bodySnippet`); fall back to latest/snippet.
- Dedup guard: when the comment reopened an issue ALREADY assigned to the CEO,
the host's native wake covers it — skip to avoid double-running the CEO.
For issues owned by any other agent we still route to the CEO.
Invariants: upholds the "user comment routes through CEO" contract (CLAUDE.md);
touches only the platform-port shell (plugin), per G12/X15. No new parallel path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Plugin now mounts two React components inside Paperclip via the
SDK's UI slot mechanism. Both are read-only views over data the
plugin worker fetches from legal-ai on demand.
## Slots
* **LegalCaseTab** (type: detailTab, entityTypes: ["issue"])
Mounted as a "ערר" tab on every issue page. Shows case summary
(status / practice_area / appeal_subtype), legal_arguments
grouped by party (עוררים/ועדה/משיבה/מבקשי היתר), attached
precedents, and open missing_precedents.
* **LegalCasesWidget** (type: dashboardWidget)
Dashboard tile with case counts by status + 7-day activity.
## Worker handlers (ctx.data.register)
Five handlers added at the end of setup() — all read-only over the
existing legal-ai HTTP API, all wrapped in try/catch so a transient
failure shows a placeholder instead of crashing the host:
- legal-case-summary → /api/cases/{n}/details
- legal-case-arguments → /api/cases/{n}/legal-arguments
- legal-case-precedents → /api/cases/{n}/precedents
- legal-case-missing-precedents → /api/missing-precedents?case_number=&status=open
- legal-dashboard-stats → in-memory aggregation over /api/cases
case_number is resolved from plugin state (scopeKind=issue,
stateKey=legal-case-number) — populated by legal_case_create.
## Build pipeline
- esbuild.ui.config.mjs uses createPluginBundlerPresets from the SDK
to build src/ui/index.tsx → dist/ui/index.js (13.5kb, react +
@paperclipai/plugin-sdk/ui externalized)
- package.json: build = "build:worker" (tsc) + "build:ui" (esbuild)
- tsconfig.json: jsx=react-jsx, lib += DOM
- New deps: react@19, @types/react, esbuild
## Manifest
- capabilities += ui.detailTab.register, ui.dashboardWidget.register
- entrypoints.ui = "dist/ui"
- ui.slots declared with entityTypes (not "entities" — fixed against
PluginUiSlotDeclaration validator)
## Verified
- tsc + esbuild + biome clean
- Plugin re-installs (20 capabilities) and activates with worker
+ 8 tools + 3 jobs + 1 webhook + 2 event subs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two new event types accepted on the existing case-status webhook
(eventType discriminator added; legacy status_change still default):
* **missing_precedent_created** → ``ctx.issues.askUserQuestions``
with a single-choice question {upload | irrelevant | defer}.
continuationPolicy=wake_assignee_on_accept routes the chair's
answer straight back to the CEO heartbeat without an extra hop.
* **export_complete** → ``ctx.issues.documents.upsert`` with a
markdown "final-decision" doc that links back to the DOCX on
legal-ai. (The SDK's documents API stores text only — binary
attachment isn't natively supported here.)
Manifest: +issue.documents.write capability (issue.interactions.create
was already declared in the previous SDK upgrade).
Tested: plugin activates with all 18 capabilities, 8 tools + 3 jobs
+ 1 webhook + 2 event subs registered.
200-version bump from 2026.325.0 → 2026.525.0 (matches host).
**Why now**: host is already on 2026.525.0; staying on 325 was unnecessary
technical debt. Production logs showed real bugs ("missing, expired,
or unknown invocation scope") that newer SDK versions are known to
have fixed.
**Compatibility**:
- TS build clean with zero changes to worker.ts or legal-api.ts.
- apiVersion: 1 still the schema (no v2 yet).
- Plugin activated successfully — 8 tools + 3 jobs + 1 webhook + 2 event
subs all registered, worker reports "Legal AI plugin ready".
**Manifest gaps fixed**: added 3 capabilities that the worker actually
uses (one of them was the root cause of repeated host-side errors):
* `agents.invoke` — required by `ctx.agents.invoke()` calls (CEO wakeup
from event handlers + comment routing). Previously the plugin was
invoking agents without the declared capability, raising
"missing scope" errors on every issue.created event.
* `issue.comments.read` — required by `ctx.issues.listComments()`
calls in the comment routing path.
* `issue.interactions.create` — forward-looking capability for the
AskUserQuestion-like flows the SDK exposes via `createInteraction`.
**Backup**: full 5-layer snapshot at /tmp/plugin-legal-ai-backup-*.tar.gz
+ tag `pre-sdk-upgrade-2026-05-26` (pushed). Rollback: `git reset --hard
pre-sdk-upgrade-2026-05-26 && npm ci && npm run build && reinstall`.
Closes TaskMaster #26.
- stale-case-reminder: wrap http.fetch in try-catch so network errors
log and return instead of crashing the job silently
- weekly-feedback-analysis: wrap agents.invoke in try-catch so CEO
unavailability logs and returns instead of crashing the job
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>