Valor
Valor reads every message in a Telegram community, scores the contribution, and pays the best ones automatically in USDC on Base. No commands, no voting, no moderator reading a spreadsheet.
- Category
- Autonomous rewards agent
- Status
- deployed
- Role
- Founder · Product Engineer · AI Integration Lead
- Built with
- Next.js 16, React 19, TypeScript, Neon, Drizzle ORM, Auth.js, viem, Base, Upstash QStash, Gemini 2.5 Flash, Telegram Bot API
What it does
A serverless agent attached to a Telegram bot webhook. Each message passes a cheap filter, survivors are scored by Gemini against a structured schema, and high-scoring contributions trigger an automatic USDC transfer from that community's own treasury. Contributors claim through an HMAC-signed link.
The problem it addresses
The people who make a community worth joining are usually paid nothing for it. Manual reward programs need a moderator to read every message and a spreadsheet to track payouts, so most communities either skip rewards or run them inconsistently.
Key decisions
- Put pure-TypeScript filters in front of the model so 90% or more of messages never reach an AI call. If an agent reads every message in a group, cost control is the binding constraint, not quality.
- Return the Telegram webhook in under 50ms and move the AI and on-chain work into a signed background job. Telegram retries a slow webhook, which means paying twice for the same message.
- Derive each community's treasury wallet deterministically from a master key so one community's budget can never spend another's. The trade-off is custody: the server holds that key and signs every transfer.
Built with
Next.js 16, React 19, TypeScript, Neon, Drizzle ORM, Auth.js, viem, Base, Upstash QStash, Gemini 2.5 Flash, Telegram Bot API.
Known limitations
- This is a founder-built personal project, not a client deployment.
- The agent scores written contributions. It cannot judge anything that happens outside the text of a message.
- A wrong score moves real money. Tips are capped and every step is idempotent, but an on-chain transfer cannot be reversed.
- No financial advice, trading signals, or token recommendations are provided.
What this demonstrates
- In an agent that spends money, the gate in front of the model matters more than the model.
- Autonomous payments need idempotency, not retry logic. Assume every step runs twice and design so the second run costs nothing.
Demo video
No demo video yet. Explore the live demo or repository to see this project in action.
Why this exists
The people who make a community worth joining are usually the ones paid least for it. A contributor writes a genuinely useful answer. A moderator reads it, thinks that was good, and keeps scrolling. Nothing happens. The reward, if there is one, depends on whether a busy person happened to notice.
Every manual reward programme fails the same way. It needs a moderator to read every message and a spreadsheet to track payouts, and both of those stop happening the week the community gets busy. So rewards either never start, or they run for a fortnight and quietly stop.
Valor is an attempt to make the reward side of a community run without a human in the loop.
How it works
A community connects its own Telegram bot, funds a treasury with USDC on Base, and then stops thinking about it.
Every message in the group passes through a two-stage filter written in plain TypeScript. The filters are cheap and they are not clever. They are looking for the obvious cases where a model call would be wasted. Roughly nine messages in ten are dropped here, before any AI is involved. The survivors go to Gemini, which returns a structured score rather than prose, validated against a schema. When the score crosses the threshold, the agent transfers USDC to the contributor from that community's own treasury. Contributors claim through a signed link.
Two details in that pipeline are doing most of the work.
The first is that the webhook returns in under fifty milliseconds and the AI and on-chain work happen in a signed background job. Telegram retries a webhook that does not answer quickly, and a retry on a pipeline that pays money means paying twice for the same message. Separating the acknowledgement from the work is not an optimisation, it is a correctness requirement.
The second is idempotency. Every step assumes it will run more than once. A duplicate delivery has to cost nothing and send nothing.
The decision that shaped the product
The gate in front of the model.
It would be simpler to send every message to Gemini, and the scoring would be marginally better. It would also mean paying for a model call on greetings, on stickers, and on every message in a group of four thousand people. An agent that reads every message in a community has a cost curve that scales with chatter, which is the one thing communities produce without limit.
So the design pushed the cheap work earlier and the intelligence later. Cost control became the binding constraint, and the model only sees what survives it.
What it does not do
It scores written contributions. It cannot judge anything that happens outside the text of a message, and it will misread sarcasm, in-jokes, and languages it handles less well. A wrong score moves real money. Tips are capped and the pipeline is idempotent, but an on-chain transfer cannot be reversed, and no amount of care changes that.
There is no investment advice, no trading signals, and no token recommendations. Each community's treasury is its own address, derived deterministically from a master key the server holds, so one community's budget can never touch another's. That isolation is real. Custody is the part that is not: whoever holds the master key can sign a transfer out of any treasury, and in this build that is the server. Valor is scoped as a portfolio project rather than a production treasury.
What to take from this
Any agent that spends money needs three things before it needs a better model: a cheap filter in front of the expensive step, idempotency everywhere, and a hard cap on what a single automated decision can spend. Get those wrong and the model's accuracy stops mattering, because the failure mode is financial.