feat: restrain document naming to a subject-only prompt contract

Shira now supplies a subject, never a filename or numbering. The TEMPLATE / FREE-DOC
/ FOLDER guidance in prompt_builder instructs the model to pass title / documentSubject
as a short Hebrew subject (no date, case number, contact, extension or path separators),
and to keep the final filename of write_document_to_folder clean. Server-side enforcement
lives in SmartAssistant CaseFolderManager (rule N1).

Refs Task Master #10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 08:22:46 +00:00
parent 7f2f29ebc8
commit 89f4dd3399
2 changed files with 17 additions and 5 deletions
+14 -2
View File
@@ -116,12 +116,24 @@
"priority": "high",
"subtasks": [],
"updatedAt": "2026-05-26T13:50:11.559Z"
},
{
"id": "10",
"title": "feat: restrain LLM file naming to subject-only (prompt guidance)",
"description": "Shira supplies a subject only; the system names files and resolves duplicates.",
"details": "prompt_builder.py: TEMPLATE/FREE-DOC/FOLDER bullets instruct title/documentSubject as short Hebrew subject (no date/case#/contact/extension/slashes); write_document_to_folder final filename clean; create_subfolder/rename_item plain names. Server-side enforcement lives in SmartAssistant CaseFolderManager.",
"testStrategy": "",
"status": "in-progress",
"dependencies": [],
"priority": "medium",
"subtasks": [],
"updatedAt": "2026-06-03T07:31:11.691Z"
}
],
"metadata": {
"version": "1.0.0",
"lastModified": "2026-05-26T13:50:11.559Z",
"taskCount": 9,
"lastModified": "2026-06-03T07:31:11.692Z",
"taskCount": 10,
"completedCount": 6,
"tags": [
"master"
+3 -3
View File
@@ -80,9 +80,9 @@ TOOL_RULES_DEFAULT = (
"- NEVER tell the user 'no documents' without first running find_case_folder — the folder might just be mis-mapped.\n"
"- When user asks to summarize multiple documents or the entire case folder — use read_multiple_documents with all relevant file paths.\n"
"- When user asks to rename or organize files — use batch_rename_documents with an array of rename operations.\n"
"- TEMPLATE GENERATION: When user asks to generate/create a document from a template — use generate_from_template. The templateId comes from availableTemplates in your context.\n"
"- FREE DOCUMENT CREATION: When the user asks for a document AND availableTemplates contains no template that matches the requested document type, use create_document(title, body, recipient?). DO NOT say 'I can't create documents' — that tool exists. Compose the full text yourself in Hebrew, organized into paragraphs. Use '#' for the section heading, '- ' for bullets, '**bold**' for emphasis. For letters to authorities (ביטוח לאומי, בתי משפט, רשויות) set documentType='letter' and put the authority name in recipient. The document will be created as a Hebrew RTL DOCX, attached to the case, and copied to the case network folder. Only fall back to a plain note (add_note) if the user explicitly asks NOT to create a real document.\n"
"- FOLDER MANAGEMENT: You have full read/write access ONLY to the current case's network folder (paths are sandboxed). Use create_subfolder to create a new folder, rename_item to rename a file or folder, move_item to move a file between subfolders, write_document_to_folder for raw uploads. ALL paths are relative to the case root — never absolute, never with '..'.\n"
"- TEMPLATE GENERATION: When user asks to generate/create a document from a template — use generate_from_template. The templateId comes from availableTemplates in your context. Pass documentSubject as a short, concise Hebrew SUBJECT describing the document's content only — no date, no case number, no contact name, no file extension, no slashes. The system sanitizes the name and guarantees uniqueness automatically; never add a date or a number yourself.\n"
"- FREE DOCUMENT CREATION: When the user asks for a document AND availableTemplates contains no template that matches the requested document type, use create_document(title, body, recipient?). DO NOT say 'I can't create documents' — that tool exists. Compose the full text yourself in Hebrew, organized into paragraphs. Use '#' for the section heading, '- ' for bullets, '**bold**' for emphasis. For letters to authorities (ביטוח לאומי, בתי משפט, רשויות) set documentType='letter' and put the authority name in recipient. The document will be created as a Hebrew RTL DOCX, attached to the case, and copied to the case network folder. PASS 'title' AS A SHORT HEBREW SUBJECT ONLY — no date, no case number, no contact name, no '.docx', no path separators; the system names the file and resolves duplicates by itself. Only fall back to a plain note (add_note) if the user explicitly asks NOT to create a real document.\n"
"- FOLDER MANAGEMENT: You have full read/write access ONLY to the current case's network folder (paths are sandboxed). Use create_subfolder to create a new folder, rename_item to rename a file or folder, move_item to move a file between subfolders, write_document_to_folder for raw uploads. ALL paths are relative to the case root — never absolute, never with '..'. For write_document_to_folder, relPath may contain subfolders, but the final FILENAME should be a clean Hebrew subject + extension (e.g. 'התכתבויות/מכתב ללקוח.docx'); the system sanitizes the filename and resolves duplicates. For create_subfolder / rename_item, pass a plain Hebrew name with no slashes, no special characters and no numbering — the server sanitizes it.\n"
"- FILE DELETION: You are NOT permitted to physically delete files. When the user asks you to delete a file, ALWAYS call mark_document_for_deletion. This moves the file to a 'מסמכים למחיקה' subfolder with a 'למחיקה - ' prefix; the lawyer reviews and deletes manually. Explain this softly to the user: 'סימנתי את הקובץ למחיקה, הוא בתיקיית מסמכים למחיקה ומחכה לאישור שלך למחיקה הפיזית.' Never claim a file was deleted when in fact it was only marked.\n"
"- BILLING (חיוב/חשבונית): When user asks about billable activities, charges, or invoices — start with list_unbilled_activities for a case, or list_charges for charge status views. Show the user a summary BEFORE creating an invoice.\n"
"- BILLING — invoice creation: create_invoice_from_activities only creates a Draft. It does NOT auto-send to Green Invoice. Always show the user the draft amount and ask if they want to send it before calling send_invoice_to_green_invoice.\n"