Spaces:
Sleeping
Sleeping
docs: rule on the Task 14 findings - the Tier 1 bootstrap circularity
Browse filesTier 1 needs a confirmed holding; holdings discover looked only at Tier 1; on a
fresh database that promotes nobody, ever. The integration test hid it by
hardcoding the exact value the real pipeline cannot produce. Discovery now
starts at Tier 2, which only needs declared equity exposure, and the README
explains why score --final runs twice. The test now replays the CLI's own
_score_inputs and asserts Tier 1 opens only after a holding is confirmed. Also
corrects CLAUDE.md: demo build does call the app's shared LangGraph agent.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016XzekHxqiXutBW4gw3Arsx
docs/superpowers/plans/2026-08-29-prospection-buyside.md
CHANGED
|
@@ -4606,7 +4606,12 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
| 4606 |
|
| 4607 |
holdings_p = sub.add_parser("holdings").add_subparsers(dest="action", required=True)
|
| 4608 |
discover = holdings_p.add_parser("discover")
|
| 4609 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4610 |
discover.set_defaults(func=_cmd_holdings_discover)
|
| 4611 |
confirm = holdings_p.add_parser("confirm")
|
| 4612 |
confirm.add_argument("holding_id", type=int)
|
|
@@ -4687,7 +4692,6 @@ from pathlib import Path
|
|
| 4687 |
import pytest
|
| 4688 |
|
| 4689 |
from prospection import cli, scoring
|
| 4690 |
-
from prospection.demo import build_demo as demo_module
|
| 4691 |
from prospection.enrich import registry, waterfall
|
| 4692 |
from prospection.enrich.pattern import PatternProvider
|
| 4693 |
from prospection.outreach import compose as compose_module
|
|
@@ -4725,19 +4729,38 @@ def test_universe_to_tier_runs_end_to_end_with_no_paid_provider(tmp_path):
|
|
| 4725 |
for record in waterfall.run_waterfall(account, [provider]):
|
| 4726 |
db.upsert_contact(record.as_row(account["id"]))
|
| 4727 |
|
| 4728 |
-
|
| 4729 |
-
|
| 4730 |
-
|
| 4731 |
-
|
| 4732 |
-
|
| 4733 |
-
|
| 4734 |
-
|
| 4735 |
-
|
| 4736 |
-
|
| 4737 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4738 |
|
| 4739 |
-
|
| 4740 |
-
assert
|
|
|
|
| 4741 |
|
| 4742 |
|
| 4743 |
def test_no_paid_provider_is_enabled_by_default():
|
|
@@ -4751,8 +4774,14 @@ def test_cli_report_is_reachable_after_a_bare_init(capsys):
|
|
| 4751 |
|
| 4752 |
def test_no_module_can_send_mail():
|
| 4753 |
"""Aucun module ne doit importer smtplib : la sortie terminale est un fichier."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4754 |
offenders = [
|
| 4755 |
-
path for path in
|
| 4756 |
if "smtplib" in path.read_text(encoding="utf-8")
|
| 4757 |
]
|
| 4758 |
assert offenders == []
|
|
@@ -4812,9 +4841,10 @@ python -m prospection.cli universe refresh # CSV AMF + SIREN → comptes
|
|
| 4812 |
python -m prospection.cli signals scan # signaux d'intention
|
| 4813 |
python -m prospection.cli score # passe 1 → 60 comptes enrichissables
|
| 4814 |
python -m prospection.cli contacts enrich # waterfall, gratuit par défaut
|
| 4815 |
-
python -m prospection.cli score --final #
|
| 4816 |
-
python -m prospection.cli holdings discover
|
| 4817 |
python -m prospection.cli holdings confirm <id> # votre revue, obligatoire
|
|
|
|
| 4818 |
python -m prospection.cli demo build --tier 1 # ingest → brief → PDF
|
| 4819 |
python -m prospection.cli campaign draft --tier 1
|
| 4820 |
python -m prospection.cli campaign review
|
|
@@ -4826,6 +4856,18 @@ python -m prospection.cli report
|
|
| 4826 |
**Rien n'est envoyé.** `campaign export` écrit des fichiers `.eml` que vous
|
| 4827 |
ouvrez et expédiez depuis votre propre messagerie.
|
| 4828 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4829 |
## Coût
|
| 4830 |
|
| 4831 |
Tout tourne gratuitement : `pattern` déduit les adresses et vérifie
|
|
@@ -4889,8 +4931,10 @@ Ajouter à `CLAUDE.md`, après la section « Data directory » :
|
|
| 4889 |
|
| 4890 |
`prospection/` est un sous-système commercial autonome : registre AMF open data
|
| 4891 |
→ scoring ICP → enrichissement de contacts → démo fail-closed → brouillons
|
| 4892 |
-
`.eml`. Il **n'envoie jamais d'email**
|
| 4893 |
-
|
|
|
|
|
|
|
| 4894 |
```
|
| 4895 |
|
| 4896 |
Ajouter à `.gitignore` :
|
|
|
|
| 4606 |
|
| 4607 |
holdings_p = sub.add_parser("holdings").add_subparsers(dest="action", required=True)
|
| 4608 |
discover = holdings_p.add_parser("discover")
|
| 4609 |
+
# Défaut à 2, pas à 1, et c'est le nœud de l'amorçage : le Tier 1 exige une
|
| 4610 |
+
# position confirmée, or on ne peut confirmer que ce qu'on a découvert. Sur
|
| 4611 |
+
# une base vierge le Tier 1 est vide, donc découvrir « --tier 1 » ne trouve
|
| 4612 |
+
# rien et personne n'est jamais promu. Le Tier 2 ne demande, lui, qu'une
|
| 4613 |
+
# poche actions : c'est là que la chaîne démarre.
|
| 4614 |
+
discover.add_argument("--tier", type=int, default=2)
|
| 4615 |
discover.set_defaults(func=_cmd_holdings_discover)
|
| 4616 |
confirm = holdings_p.add_parser("confirm")
|
| 4617 |
confirm.add_argument("holding_id", type=int)
|
|
|
|
| 4692 |
import pytest
|
| 4693 |
|
| 4694 |
from prospection import cli, scoring
|
|
|
|
| 4695 |
from prospection.enrich import registry, waterfall
|
| 4696 |
from prospection.enrich.pattern import PatternProvider
|
| 4697 |
from prospection.outreach import compose as compose_module
|
|
|
|
| 4729 |
for record in waterfall.run_waterfall(account, [provider]):
|
| 4730 |
db.upsert_contact(record.as_row(account["id"]))
|
| 4731 |
|
| 4732 |
+
def _tiers() -> dict[int, int]:
|
| 4733 |
+
"""Rejoue exactement ce que fait la CLI, `_score_inputs` compris."""
|
| 4734 |
+
results = []
|
| 4735 |
+
for account in db.list_accounts():
|
| 4736 |
+
equity, overlap, _signals = cli._score_inputs(account)
|
| 4737 |
+
base = scoring.score_pass1(account, has_equity_funds=equity,
|
| 4738 |
+
has_edgar_overlap=overlap,
|
| 4739 |
+
signals=[{"type": "job_posting"}])
|
| 4740 |
+
contacts = db.list_contacts(account["id"])
|
| 4741 |
+
results.append((account["id"], scoring.score_pass2(base, contacts), contacts))
|
| 4742 |
+
return scoring.assign_final(results)
|
| 4743 |
+
|
| 4744 |
+
# Avant toute confirmation : des comptes travaillables, mais pas de Tier 1.
|
| 4745 |
+
# `has_edgar_overlap` se lit dans les positions confirmées, et il n'y en a
|
| 4746 |
+
# aucune. Coder cette valeur en dur ici masquerait précisément le point que
|
| 4747 |
+
# ce test doit établir.
|
| 4748 |
+
before = _tiers()
|
| 4749 |
+
assert 2 in before.values(), "des comptes doivent être travaillables dès la première passe"
|
| 4750 |
+
assert 1 not in before.values(), "le Tier 1 ne s'ouvre pas sans position confirmée"
|
| 4751 |
+
|
| 4752 |
+
# L'amorçage : on découvre et on confirme sur un compte de Tier 2.
|
| 4753 |
+
workable = next(a for a in db.list_accounts() if before[a["id"]] == 2)
|
| 4754 |
+
holding_id = db.upsert_holding({
|
| 4755 |
+
"account_id": workable["id"], "fund_name": "Fonds Actions Internationales",
|
| 4756 |
+
"raw_label": "Microsoft Corp", "ticker": "MSFT", "weight_pct": 5.4,
|
| 4757 |
+
"as_of": "2026-07-31", "source_url": "https://x.fr/r.pdf",
|
| 4758 |
+
"confidence": "probable", "retrieved_at": "2026-08-29T09:00:00"})
|
| 4759 |
+
db.confirm_holding(holding_id, "2026-08-29T09:00:00")
|
| 4760 |
|
| 4761 |
+
after = _tiers()
|
| 4762 |
+
assert after[workable["id"]] == 1, (
|
| 4763 |
+
"une position confirmée doit ouvrir le Tier 1, sans aucun provider payant")
|
| 4764 |
|
| 4765 |
|
| 4766 |
def test_no_paid_provider_is_enabled_by_default():
|
|
|
|
| 4774 |
|
| 4775 |
def test_no_module_can_send_mail():
|
| 4776 |
"""Aucun module ne doit importer smtplib : la sortie terminale est un fichier."""
|
| 4777 |
+
# Ancré sur __file__ et non sur le répertoire courant : `Path("prospection")`
|
| 4778 |
+
# relatif renvoie une liste vide quand le chemin n'existe pas, si bien que
|
| 4779 |
+
# lancé d'ailleurs ce test passerait sans avoir rien inspecté — un garde-fou
|
| 4780 |
+
# qui s'ouvre en silence, sur la seule chose que tout le dossier refuse.
|
| 4781 |
+
package = Path(__file__).resolve().parent.parent / "prospection"
|
| 4782 |
+
assert package.is_dir(), f"paquet introuvable : {package}"
|
| 4783 |
offenders = [
|
| 4784 |
+
path for path in package.rglob("*.py")
|
| 4785 |
if "smtplib" in path.read_text(encoding="utf-8")
|
| 4786 |
]
|
| 4787 |
assert offenders == []
|
|
|
|
| 4841 |
python -m prospection.cli signals scan # signaux d'intention
|
| 4842 |
python -m prospection.cli score # passe 1 → 60 comptes enrichissables
|
| 4843 |
python -m prospection.cli contacts enrich # waterfall, gratuit par défaut
|
| 4844 |
+
python -m prospection.cli score --final # Tier 2 peuplé ; Tier 1 encore vide
|
| 4845 |
+
python -m prospection.cli holdings discover # sur le Tier 2 — voir « Amorçage »
|
| 4846 |
python -m prospection.cli holdings confirm <id> # votre revue, obligatoire
|
| 4847 |
+
python -m prospection.cli score --final # une position confirmée ouvre le Tier 1
|
| 4848 |
python -m prospection.cli demo build --tier 1 # ingest → brief → PDF
|
| 4849 |
python -m prospection.cli campaign draft --tier 1
|
| 4850 |
python -m prospection.cli campaign review
|
|
|
|
| 4856 |
**Rien n'est envoyé.** `campaign export` écrit des fichiers `.eml` que vous
|
| 4857 |
ouvrez et expédiez depuis votre propre messagerie.
|
| 4858 |
|
| 4859 |
+
### Amorçage : pourquoi `score --final` tourne deux fois
|
| 4860 |
+
|
| 4861 |
+
Le Tier 1 exige un recouvrement avec un émetteur ingérable, et ce recouvrement
|
| 4862 |
+
se lit dans les positions **confirmées** — donc validées à la main. Mais on ne
|
| 4863 |
+
confirme que ce qu'on a d'abord découvert. Sur une base vierge, découvrir
|
| 4864 |
+
uniquement dans le Tier 1 ne trouverait rien et personne ne serait jamais promu.
|
| 4865 |
+
|
| 4866 |
+
Le Tier 2 rompt le cercle : il ne demande qu'une poche actions déclarée, donc il
|
| 4867 |
+
se peuple dès la première passe. On y découvre les reportings, on confirme, puis
|
| 4868 |
+
on rescore — et les comptes dont une position est confirmée montent en Tier 1.
|
| 4869 |
+
C'est pour cela que `holdings discover` vise le Tier 2 par défaut.
|
| 4870 |
+
|
| 4871 |
## Coût
|
| 4872 |
|
| 4873 |
Tout tourne gratuitement : `pattern` déduit les adresses et vérifie
|
|
|
|
| 4931 |
|
| 4932 |
`prospection/` est un sous-système commercial autonome : registre AMF open data
|
| 4933 |
→ scoring ICP → enrichissement de contacts → démo fail-closed → brouillons
|
| 4934 |
+
`.eml`. Il **n'envoie jamais d'email**. Il ne dépend pas de `app.py` ni de
|
| 4935 |
+
Streamlit, mais `demo build` appelle `agent.graph.run_brief` — le même agent
|
| 4936 |
+
LangGraph que le runtime de l'app, avec les mêmes appels modèle et le même
|
| 4937 |
+
schéma de brief. Base : `data/prospects.db`. Voir `prospection/README.md`.
|
| 4938 |
```
|
| 4939 |
|
| 4940 |
Ajouter à `.gitignore` :
|