Transformer un rapport long (médical, contrôle technique auto, DPE immobilier) en résumé structuré : points clés, risques, recommandations, échéances — en quelques secondes.
Table of contents
What's in this pack
| File | Purpose |
|---|---|
README.md |
This file. Overview, quick-start, runnable agent. |
SOUL.md |
Mission, values, OODA loop, anti-patterns for the summarizer. |
PROMPTS.md |
Production-ready system prompts, one per report type. |
REPORT_TYPES.md |
Supported input formats (PDF/text) per report type. |
SPEC.md |
Technical spec: inputs, outputs, schema, thresholds. |
CHECKLIST.md |
Step-by-step deployment checklist. |
report-summarizer-v1.json |
Machine-readable pack manifest. |
agent.py |
Runnable agent: read a report, detect type, emit structured summary. |
requirements.txt |
Pip dependencies actually used by agent.py. |
deploy.sh |
Self-deploy: create venv + pip install -r requirements.txt. |
Target audience
- Cabinets médicaux & téléconsultation : digérer un compte-rendu d'examen en 30 secondes.
- Centres de contrôle technique automobile : restituer au client les défauts par criticité.
- Diagnostiqueurs immobiliers (DPE) : produire une synthèse client claire (classe, travaux).
- Tout agent A2A qui reçoit un rapport brut et doit en extraire une décision actionnable.
Agent architecture
Rapport brut (texte / markdown / PDF→texte)
│
▼
┌──────────────────┐
│ Détecteur de type│ → médical | controle_technique | dpe (heuristique mots-clés + override --type)
└────────┬─────────┘
│
▼
┌──────────────────────┐
│ Sélecteur de prompt │ → charge le prompt système adéquat (PROMPTS.md)
└────────┬─────────────┘
│
▼
┌──────────────────┐
│ Résumeur (LLM) │ → claude-sonnet-4-6, prompt caching ephemeral
└────────┬─────────┘
│
▼
Résumé structuré :
• points_cles[] • risques[]
• recommandations[] • echeances[]
│
▼
Émission Markdown OU JSON (--format)
Quick-start
- Copy all files to your agent workspace.
bash deploy.shto create the venv and install dependencies.export ANTHROPIC_API_KEY=sk-ant-...(sans clé : mode hors-ligne déterministe / stub).python agent.py --type dpe rapport.txtpour un résumé Markdown.- Read
SPEC.mdto wire the JSON output into your A2A pipeline.
Runnable agent
python agent.py --help # affiche l'aide, ne crash jamais
python agent.py --type dpe rapport.txt # résumé Markdown d'un DPE
python agent.py rapport_medical.txt # auto-détection du type
python agent.py --type controle_technique --format json ct.txt
echo "Compte-rendu IRM ..." | python agent.py --type medical - # lecture stdin
Sans ANTHROPIC_API_KEY, l'agent produit un résumé structuré déterministe (extraction
heuristique) — utile pour les tests CI et python agent.py --help.
Use a local model (Ollama)
The optional LLM step can also run on your own machine through Ollama, so no text leaves your server. No account and no API key.
ollama pull <model> # any chat model you like
export PACK_LLM=ollama # prefer Ollama even if a coding-agent CLI is installed
export PACK_OLLAMA_MODEL=<model> # optional: default is the first chat model the server lists
python3 -c "import llm_adapter; print(llm_adapter.detect())" # prints: ollama
PACK_OLLAMA_HOSTpoints to another server (defaulthttp://127.0.0.1:11434);OLLAMA_HOSTis also read whenPACK_LLM=ollama.PACK_OLLAMA_NUM_CTXsets the context size if your reports or prompts are long.- Without
PACK_LLM, a local Ollama server is used only when no Claude Code, Kimi Code or Codex CLI is found. - If the server is down or the model is missing, the pack keeps working in its deterministic mode.
- With
PACK_LLM=ollama(orPACK_LLM=off), the summarizer never falls back to a hosted API, even ifANTHROPIC_API_KEYis set.
Learning memory (local and private)
Every LLM call this pack makes is journaled in ./.pack_memory/ next to the code, so the pack can improve for you. Nothing is ever sent anywhere.
- What is kept: the task name, the masked input, the masked answer, status and latency. Keys, tokens, e-mails, phone numbers, IP addresses, card and IBAN numbers and personal paths are masked before writing; the system prompt is never stored.
- Teach it:
python3 pack_memory.py feedback last okconfirms a result,python3 pack_memory.py feedback last bad --fix "the right answer"corrects it. Confirmed and corrected runs are reused as validated examples when a similar input comes in. Unrated runs are never injected into a prompt. - Find similar cases:
python3 pack_memory.py similar "some text"andpython3 pack_memory.py clusters(groups of near-identical failures) work in plain Python, no model needed. Optional meaning-based matching uses an embedding model you already run locally:python3 pack_memory.py enable-semantic(Ollama on this machine only). - Share, only if you want:
python3 pack_memory.py exportwrites an anonymised summary (counts, statuses, size buckets, no text) for you to review. - Control:
PACK_MEMORY=0turns it off,PACK_MEMORY_STORE_TEXT=0keeps fingerprints only,python3 pack_memory.py purge --yeswipes it.
