Story-1009: MatterChatAgent v1 prompt and tool wiring

Story 1009Epic 749๐Ÿ”— Chain of CustodyAgent Platform11 files ยท +886/โˆ’41

PR #23 ยท pramaan-io/pramaan-agents ยท merged 2026-06-03

How it flows

sequenceDiagram
  autonumber
  participant agent as MatterChatAgent v1
  participant harness as Strands harness
  participant db as Agents DB
  agent->>harness: load prompt v1
  agent->>harness: register 7 tool stubs
  harness->>harness: tools=[] replaced
  harness-->>db: sync prompt + schemas

tools/matter_chat_tools.py + db/prompt_registry_sync.py

Methodin โ†’ outwhat it does
search_documents(matter_id, query, limit) โ†’ dict[str, Any]finds documents inside a given matter
fetch_quote(matter_id, document_id, quote_id) โ†’ dict[str, Any]pulls the exact citation text for one quote
get_contradictions(matter_id, contradiction_id) โ†’ dict[str, Any]surfaces claim-versus-claim conflicts in the matter
sync_matter_chat_agent_v1(engine, firm_id, model_id, prompt_path) โ†’ Nonedeploys the v1 prompt and tool schemas into agents tables

What changed, file by file

Defines the seven MatterChatAgent v1 tool stubs for search, open, quote, events, claims, contradictions, entities that raise until PR ten-ten lands.

new methodsignature
tool(func) โ†’ F
_object_schema(properties, required) โ†’ JSONSchema
_array_of(item_schema) โ†’ JSONSchema
_not_implemented(tool_name) โ†’ NoReturn
search_documents(matter_id, query, limit) โ†’ dict[str, Any]
open_document(matter_id, document_id) โ†’ dict[str, Any]
fetch_quote(matter_id, document_id, quote_id) โ†’ dict[str, Any]
get_events(matter_id, limit) โ†’ dict[str, Any]
get_claims(matter_id, claim_id) โ†’ dict[str, Any]
get_contradictions(matter_id, contradiction_id) โ†’ dict[str, Any]
get_entities(matter_id, entity_type) โ†’ dict[str, Any]
New fields: UUID_SCHEMA : JSONSchemaQUOTE_ID_SCHEMA : JSONSchemaTEXT_SCHEMA : JSONSchemaCITATION_SCHEMA : JSONSchema

Deploy-time sync writing prompt v1 and tool registry schemas into the agents tables.

new methodsignature
sync_matter_chat_agent_v1(engine, firm_id, model_id, prompt_path) โ†’ None
_json_dump(value) โ†’ str
main(argv) โ†’ int

Runtime loader that reads the v1 prompt file and renders conversation history for the agent.

new methodsignature
load_matter_chat_prompt_v1(prompt_path) โ†’ str
_render_history(history) โ†’ str
_render_user_turn(message) โ†’ str

What this PR does NOT do

prompt pinned to v1
tools indexed cleanly
sync is deploy-time only
calling any tool raises NotImplementedError
bodies owned by PR ten-ten
guardrails owned by PR ten-eleven

Files changed (11)

Fileยฑ
docs/walkthroughs/story-1009-walkthrough.html+54
scripts/sync-matter-chat-agent-v1.py+13
src/pramaan_agents/agents/matter_chat_agent/prompt_v1.md โ˜…+74
src/pramaan_agents/db/prompt_registry_sync.py โ˜…+171
src/pramaan_agents/runtime/matter_chat_prompt.py+39 โˆ’38
src/pramaan_agents/runtime/strands_harness.py+2 โˆ’1
src/pramaan_agents/tools/__init__.py+5
src/pramaan_agents/tools/matter_chat_tools.py โ˜…+320
tests/test_context_builder.py+2 โˆ’1
tests/test_matter_chat_agent_wiring.py+190
tests/test_matter_chat_prompt.py+16 โˆ’1