Improve default Document Description Updater prompt#2076
Conversation
Rewrite the seeded Document Description Updater action-template prompt to lead with the document's subject matter (the goods, services, rights, or obligations it concerns) and key parties, drop the "This document is …" lead-in, and stop restating the title. - Extract the prompt to DOCUMENT_DESCRIPTION_INSTRUCTIONS in template_seeds.py. - Add data migration agents/0017 to re-sync already-seeded databases (the seeder skips templates that already exist by name, so the literal edit does not reach them on its own).
Review: Improve default Document Description Updater promptThis PR rewrites the seeded prompt for the Document Description Updater action template — shifting from a type-first, multi-sentence description to a subject-matter-first single sentence — and pairs it with a data migration to propagate the change to already-seeded databases. The approach (extracted constant + idempotent migration) is well-structured and mirrors the pattern established by migration 0016. Two findings are worth addressing before merge. 1. Stale
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…trings - Update "Document Description Updater" template's description in template_seeds.py to match the new subject-first prompt behaviour: "Reads a newly added document and writes a one-sentence summary leading with its subject matter and key parties." - Extend migration 0017 to also patch the description field on already-seeded CorpusActionTemplate and AgentConfiguration rows (same idempotent pattern as task_instructions). - Inline both prompt strings as module-level constants in the migration (_TASK_INSTRUCTIONS, _UI_DESCRIPTION) rather than importing from template_seeds, so the migration is a self-contained frozen snapshot.
Code ReviewThis is a narrow, well-motivated change: the old prompt produced descriptions that led with type/title restatement; the new one leads with subject matter. The structural pattern — extract a named constant, update the 1. Misleading comment will cause the next prompt edit to silently skip production databasesFile: # Per-task prompt for the "Document Description Updater" template. Extracted to a
# named constant so the agents/0017 data migration can re-sync already-seeded
# databases (the seeder skips templates that already exist by name, so editing
# the literal below never reaches them on its own).The comment implies that migration 0017 imports and uses Suggested replacement: # Per-task prompt for the "Document Description Updater" template.
# This constant is the authoritative live value used by the seeder for fresh
# installs. Already-seeded databases receive prompt updates via data migrations
# (see agents/0017). If you change this constant, write a new data migration
# so existing databases are also updated.2. No test for the migration forward function — established pattern is being skippedFile:
Migration 0017 has non-trivial multi-model conditional logic (two models, two fields, four A test mirroring the 0015 pattern would take ~15 lines and would catch name drift, field coverage gaps, and idempotency regressions. 3. Changelog fragment omits the
|
What
Rewrites the seeded Document Description Updater action-template prompt so per-document one-liners lead with the document's subject matter instead of restating its type or title.
Why
The previous prompt asked for "what this document is about, its type (contract, memo, report, etc.), and the key parties," which produced descriptions like "This document is the Fourth Amendment to the Lease Agreement titled …" — the lead-in and title restatement carry little information.
Change
New prompt directs the agent to:
Example shift for the same document:
Files
opencontractserver/corpuses/template_seeds.py— prompt extracted toDOCUMENT_DESCRIPTION_INSTRUCTIONSand rewritten.opencontractserver/agents/migrations/0017_update_document_description_prompt.py— data migration that re-syncs already-seeded databases (the seeder skips templates that exist by name, mirroringagents/0016).changelog.d/document-description-prompt.changed.md.