Inspiration
ClausePay was inspired by a very ordinary but expensive problem: companies often do the hard work of winning clients, delivering work and issuing invoices, then lose money because follow-up is slow, inconsistent or not grounded in the actual contract.
Unpaid B2B invoices are not always malicious. Sometimes the issue is missing context, a forgotten payment term, an unclear escalation path or nobody owning the collection workflow. We wanted to build an agent that does more than chat. ClausePay acts on the open web, reads source material, creates a recovery plan, records evidence and prepares real next steps for a human to approve.
The goal was to show what an autonomous revenue recovery agent could look like when it is source-grounded, auditable and commercially useful.
What ClausePay Does
ClausePay turns an overdue invoice into a 30-day recovery campaign.
The agent:
- Reads a synthetic invoice and contract.
- Extracts payment terms, late fee clauses and escalation language.
- Uses Tavily to research a real public company/domain for live web context.
- Uses Prometheux to reason over debtor, invoice, contract and risk entities.
- Writes campaign events, evidence, actions and trace links into ClickHouse.
- Generates human-approved collection emails rather than sending automatically.
- Creates a payment action with a test-mode payment link.
- Shows a dashboard with source-to-action traceability.
- Advances a 30-day campaign workflow with durable logs.
The demo debt is synthetic. Real public web research is used only to demonstrate source-grounded context gathering, not to claim that a real company owes money.
How We Built It
ClausePay is built as a full-stack TypeScript application.
The frontend is a React and Vite dashboard where a judge or operator can run a recovery campaign, inspect evidence, review generated actions and see the autonomous workflow timeline. The backend is an Express API that coordinates the recovery agent and integration adapters.
The agent pipeline works roughly like this:
- Parse the invoice and contract.
- Extract relevant contract clauses.
- Research debtor context using Tavily.
- Build an ontology-backed recovery view using Prometheux.
- Generate source-grounded collection actions.
- Persist all actions and evidence into ClickHouse.
- Produce approval-ready outputs for the dashboard.
- Advance the 30-day campaign workflow and append new ledger events.
We used ClickHouse as the audit ledger because the project needs fast, queryable records of what the agent saw, decided and produced. We used Tavily because the challenge required real open-web grounding. We used Prometheux to model the relationships between contracts, invoices, debtor context, risk and recovery actions.
A simple way to describe the agent’s decision-making is:
$$ RecoveryAction = f(ContractClauses, InvoiceState, WebEvidence, RiskContext) $$
Every generated action is linked back to the sources that justified it.
Sponsor Tools Used
Tavily
Tavily powers the live debtor research step. The agent searches the open web for public company and domain context, then stores source URLs and snippets as evidence. These sources are shown in the dashboard and linked into the action trace.
ClickHouse
ClickHouse is the project’s action ledger. ClausePay writes real campaign events, evidence rows, source-action trace rows and workflow steps into ClickHouse. This makes the demo auditable rather than just a UI simulation.
Prometheux
Prometheux is used for ontology reasoning. It helps structure the relationships between invoice, contract, debtor, risk and recovery action entities, giving the agent a more explainable decision layer.
Challenges We Faced
The hardest part was making the agent feel genuinely autonomous while keeping it safe. A collection agent should not blindly send emails or make aggressive claims. We solved this by allowing the agent to generate and orchestrate real recovery actions, but requiring human approval before outbound email.
Another challenge was traceability. It is easy to generate a convincing-looking collection email, but much harder to prove why each sentence exists. We built a source-to-action trace so the dashboard can show which contract clauses, invoice facts and Tavily sources informed each action.
We also had to separate real actions from safe demo boundaries. Tavily, Prometheux and ClickHouse run live. Payment links are test-mode. Notifications and outbound collection messages are approval-gated.
What We Learned
We learnt that autonomous agents become much more useful when they are designed around records, not just responses. The important question is not only “what did the agent say?” but also:
- What did it read?
- What source justified the action?
- What system recorded the decision?
- What happens next?
- Where does a human approve or stop the workflow?
We also learnt that sponsor tools work best when each one has a clear job. Tavily grounds the agent in the open web. Prometheux gives the agent structured reasoning. ClickHouse makes the workflow durable and auditable.
What We Are Proud Of
We are proud that ClausePay is not just a chatbot for invoices. It is an autonomous workflow that researches, reasons, records, generates and monitors recovery actions.
The strongest part of the project is the trace: a judge can see the source, the clause, the generated action and the ClickHouse record behind it.
What Is Next
Next, ClausePay could be extended with:
- Real accounting system integrations.
- Email inbox monitoring.
- Multi-language debtor communication.
- More advanced contract ingestion.
- CRM enrichment.
- Payment reconciliation.
- Stronger risk scoring.
- Team approval workflows.
The long-term vision is a contract-to-cash agent that helps businesses recover revenue without losing trust, context or control.
Built With
- api
- clickhouse
- cursor
- express.js
- lucide
- node.js
- react
- reactome
- search
- tavily
- typescript
- vadalog
- vite
Log in or sign up for Devpost to join the conversation.