How alessandropcostabr/commercial-reasoner works
Commercial Reasoner is a stateless sales-reasoning service intended to work behind Hermes and the LATE integrator. LATE submits a turn and verified facts to /reason; the engine generates a reply, classifies commitments, checks monetary claims, then builds and signs an event for optional webhook delivery. The repository also includes a fact-extraction memory library, a persona/skill layer, and two documented alternative memory deployment stacks. The README describes their roles, but sampled source does not establish runtime wiring from Hermes to either stack. The graph reflects that limit rather than treating the alternatives as a connected dual-backend feature.
Main entry points: reasoning.py Turn reasoning · extract.py Turn fact extraction · gate.py Response gate · numeric_guard.py Numeric checks
Components 21
Reasoning service
- HTTP API
src/commercial_reasoner/service/app.py - Turn reasoning
src/commercial_reasoner/service/reasoning.py - LLM generator
src/commercial_reasoner/service/llm.py - Commitment classifier
src/commercial_reasoner/service/commitment.py - Event contract
src/commercial_reasoner/service/contract.py
Fact and safety memory
- Memory API
src/commercial_reasoner/memory/__init__.py - Turn fact extraction
src/commercial_reasoner/memory/extract.py - Rule extraction
src/commercial_reasoner/memory/rule_extractor.py - LLM candidate filter
src/commercial_reasoner/memory/llm_extractor.py - Fact assembler
src/commercial_reasoner/memory/assembler.py - Canonical facts
src/commercial_reasoner/memory/canonical_facts.py - Response gate
src/commercial_reasoner/memory/gate.py - Numeric checks
src/commercial_reasoner/memory/numeric_guard.py - Memory types
src/commercial_reasoner/memory/types.py
Sales persona
- Alma persona
hermes-alma/SOUL.md - Sales skill
hermes-alma/skills/vendas/SKILL.md
Gateway and memory deployments
- Hermes gateway
- claude-mem stack
docker - Honcho stack
docker-honcho-distribuido
Other components
- LATE integrator
- OpenAI-compatible LLM
Connections 31
- LATE integrator → HTTP API: submits turn
README.md - HTTP API → Turn reasoning: processes request
src/commercial_reasoner/service/app.py - HTTP API → Event contract: validates and signs
src/commercial_reasoner/service/app.py - Turn reasoning → LLM generator: selects generator
src/commercial_reasoner/service/app.py - Turn reasoning → Commitment classifier: classifies commitment
src/commercial_reasoner/service/reasoning.py - Turn reasoning → Canonical facts: builds facts
src/commercial_reasoner/service/reasoning.py - Turn reasoning → Response gate: checks reply
src/commercial_reasoner/service/reasoning.py - Turn reasoning → Event contract: builds envelope
src/commercial_reasoner/service/reasoning.py - LLM generator → OpenAI-compatible LLM: requests completion
README.md - LLM generator → Alma persona: loads persona
src/commercial_reasoner/service/llm.py - Event contract → LATE integrator: posts signed event
- Memory API → Turn fact extraction: exports extraction
src/commercial_reasoner/memory/__init__.py - Memory API → Canonical facts: exports conversion
src/commercial_reasoner/memory/__init__.py - Memory API → Response gate: exports check
src/commercial_reasoner/memory/__init__.py - Turn fact extraction → Numeric checks: checks agent quote
src/commercial_reasoner/memory/extract.py - Turn fact extraction → Rule extraction: extracts signals
src/commercial_reasoner/memory/extract.py - Turn fact extraction → LLM candidate filter: filters weak signals
src/commercial_reasoner/memory/extract.py - Turn fact extraction → Fact assembler: assembles result
src/commercial_reasoner/memory/extract.py - Rule extraction → Numeric checks: extracts numbers
src/commercial_reasoner/memory/rule_extractor.py - LLM candidate filter → Memory types: returns candidates
src/commercial_reasoner/memory/llm_extractor.py - Fact assembler → Numeric checks: uses numeric checks
src/commercial_reasoner/memory/assembler.py - Fact assembler → Memory types: builds facts
src/commercial_reasoner/memory/assembler.py - Canonical facts → Memory types: creates canonical facts
src/commercial_reasoner/memory/canonical_facts.py - Response gate → Numeric checks: checks numeric claims
src/commercial_reasoner/memory/gate.py - Response gate → Memory types: returns verdict
src/commercial_reasoner/memory/gate.py - Hermes gateway → LATE integrator: routes conversations
README.md - Hermes gateway → claude-mem stack
- Hermes gateway → Honcho stack
- Hermes gateway → Sales skill
- LATE integrator → claude-mem stack
- LATE integrator → Honcho stack