Open source · MIT开源 · MIT 许可

Every inbound lead. One queue. A human decides. 每一条线索,都进同一个队列。由人来决定。

Lead Pulse Guard watches Facebook comments, Lead Ads forms and mailboxes, drafts the answer with an LLM, and waits for someone to approve it. Nothing reaches a customer automatically. Lead Pulse Guard 监控 Facebook 评论、广告线索表单和邮箱,用大模型起草回复,然后等人工确认。没有任何内容会自动发给客户。

3inbound channels线索入口
2fallback pollers兜底轮询
0auto-published replies自动发布的回复
01 — Why this exists01 — 为什么做这个

Three ways automated replies go wrong自动回复会出错的三种方式

All three are handled structurally here — by code that refuses to act, not by asking the model nicely. 下面三种情况在这里都是靠结构解决的 —— 由代码直接拒绝执行,而不是在提示词里请求模型「请勿」。

LOOP死循环

The machine loop机器回环

Your bot replies to a comment. That reply arrives as a new webhook event. The bot answers itself. Forever. 机器人回复了一条评论,这条回复又以新事件的形式回到 webhook,机器人于是回复自己,如此循环。

Structural fix结构性修复 Identity check — if the commenter is one of your own Pages, the event is never eligible. 身份校验 —— 评论者若是自家主页,该事件直接不具备回复资格。
LOOP死循环

The politeness loop礼貌死循环

A customer says "thanks". The bot answers. They say "ok". It answers again. Nobody is being helped, and the thread never ends. 客户说声「谢谢」,机器人回一句;客户再说「好的」,机器人再回一句。谁的问题都没被解决,话头也停不下来。

Structural fix结构性修复 Closing-phrase filter — whole-message matching, with questions always winning. 收尾语过滤 —— 整句匹配而非包含匹配,且问句永远优先。
FABRICATION编造

Confident fabrication一本正经地编

Asked about a spec it does not know, the model produces a plausible number. That number is now public, and attributed to your company. 被问到一个它并不知道的参数时,模型会给出一个看起来很合理的数字。这个数字现在就挂在公开评论区,署着你公司的名字。

Structural fix结构性修复 Knowledge-base gating — if the fact is not in the approved KB, the model defers to a human. 知识库门禁 —— 不在已确认事实库里的内容,模型只能转交人工。
02 — Architecture02 — 架构

Three entrances, one approval surface三个入口,一个审批出口

Every channel converges on the same card: the original message, the model's draft, and a person who can send, edit or ignore it. 所有渠道最终汇到同一张卡片:原始消息、模型草稿,以及一个可以「发送 / 改后发送 / 忽略」的人。

Facebook comments 评论feed webhook
→
Gatewayverify · tag · dedupe
→
WorkerKB · LLM · draft
→
Human人工send / edit / ignore
→
Graph APIpublishes as the Page以主页身份发布
read-only, zero outbound calls只读,零出站调用 nothing publishes without a click没有点击就不会发布 handoff is a file, not a network call交接靠文件,不走网络
Entrance入口 Delivery投递方式 Silent failure mode静默失效方式
Page comments主页评论 webhook · feed Our own replies return as new events自家回复被当成新事件送回来
Lead Ads forms广告线索表单 webhook · leadgen The event never arrives at all事件根本不投递
Mailbox邮箱 IMAP poll · read-only None, as long as the poll runs只要轮询在跑,就不会漏
We measured a day when five Lead Ads submissions arrived and only two produced a webhook event. No error, no log line, no retry — a broken feed and a quiet day look identical from the receiving end. 我们实测过一天:进来 5 条广告线索,只有 2 条产生了 webhook 事件。没有报错,没有日志,也没有重试 —— 从接收端看,链路断了和今天没人来是一样的。 — why there is a second, independent read path— 这就是为什么还要有一条独立的读取路径

So the lead poller and the comment poller run alongside the webhooks. The pollers do not re-implement the decision logic: the comment poller re-signs each comment as a webhook and feeds it back to the gateway, so "should we reply to this" exists in exactly one place. Worst case moves from never to ten minutes. 所以除了 webhook,还有线索轮询和评论轮询在跑。轮询器不复制判断逻辑:评论轮询会把评论重新签名、当成一条 webhook 送回网关,于是「这条该不该回」在全系统只有一份实现。最坏情况从「永远收不到」变成「最多晚十分钟」。

03 — What's inside03 — 包含什么

Built around refusing to act核心设计是「拒绝执行」

Everything below is in the repository and covered by the reasoning in the docs. 以下每一项都在仓库里,设计理由写在 docs 中。

⌘

Signature checked against raw bytes对原始请求体验签

X-Hub-Signature-256 checked against the bytes as received, with a timing-safe compare. Invalid requests get 403 and are not logged. 对收到的原始字节计算 X-Hub-Signature-256,并用定时安全比较。签名不对的请求返回 403,且不记录内容。

⛔

The gateway cannot call out网关没有任何出站能力

It holds no downstream credential. Compromising it gets an attacker a write to a spool file, nothing more. 它不持有任何下游凭据。即使被攻破,攻击者最多也只能往一个 spool 文件里写一行字。

📄

A file, not a queue用文件,而不是消息队列

The handoff is an append-only JSONL spool. No broker to operate, and every event is replayable. 交接是一个只追加的 JSONL 文件。没有中间件要运维,每一条事件都能重放。

📚

Per-page knowledge gating按主页隔离的知识库

Each Page loads its own confirmed facts and a do-not-state list. Empty KB means the model may state nothing specific. 每个主页加载各自的「已确认事实」和「禁止表述」清单。知识库为空时,模型不得作出任何具体陈述。

🔍

The output grades itself输出自带检查项

Output is strict JSON with answers_question and invented_specifics flags, so a bad draft is visible before a human reads it. 输出是严格 JSON,带 answers_question 和 invented_specifics 两个自检字段,草稿有问题在人工读到之前就能看出来。

⚡

Answer the click first先应答,再执行

Chat callbacks return immediately and publish in a background thread — the timeout that makes people click twice and post twice. 卡片回调立刻应答,发帖放到后台线程 —— 超时会让人再点一次,然后就发了两遍。

🔒

Atomic dedupe across both paths两条路径共用原子占位

Webhook and poller race on the same activity ID; whichever arrives first claims it, the other becomes a no-op. webhook 和轮询会争抢同一个活动 ID,先到的占位,后到的自动变成空操作。

✉️

Mail is never marked as read邮件只读打开

Every fetch uses BODY.PEEK. Nothing is marked read, moved or deleted, and the first run establishes a baseline instead of backfilling history. 全部用 BODY.PEEK 取信,不标已读、不移动、不删除;首次运行只建基线,不倒灌历史邮件。

04 — Services04 — 服务

Want it running on your Pages without building it yourself?想直接用在你的主页上,不用自己搭?

The code is free and stays free. What you can buy is the part that takes weeks: wiring it to a real Meta app, keeping it alive, and knowing what to do when Meta changes something without telling you. 代码是免费的,也会一直是。你能买的是最花时间的那部分:接上真实的 Meta 应用、让它一直活着,以及 Meta 哪天悄悄改了东西时知道怎么修。

01

Setup部署上线

One-time. We configure everything up to the first real conversation. 一次性交付。一直配到第一条真实对话跑通为止。

  • Meta app, webhook, TLS, both subscription levelsMeta 应用、webhook、TLS,两个层级的订阅
  • Chat bot and approval cards in your workspace你常用的群里配好机器人与审核卡片
  • Mailbox intake, read-only邮箱接入,只读不改动邮件
  • Knowledge base seeded from your existing material用你现有资料整理出第一版知识库
Done means验收标准 a real comment and a real lead have both reached your chat. 一条真实评论、一条真实线索,都进过你的群。
02

Hosted托管运维

Monthly. You do not touch the server, and you do not hear about an expired token from a customer. 按月。你不用碰服务器,也不会等客户告诉你,才发现令牌过期了。

  • Server, uptime, backups, upgrades服务器、可用性、备份、升级
  • Daily reconciliation of leads against Meta线索每日与 Meta 对账
  • Token and delivery monitoring, with alerts令牌与投递监控,异常告警
  • Model routing and cost control模型路由与成本控制
We watch for我们盯的是 the two things that fail without an error: delivery and expiry. 两种「不报错就失效」的情况:投递和过期。
03

Custom定制开发

Scoped project. For setups that are not one Page and one language. 按项目。适用于不是一个主页、一种语言就够的场景。

  • Multi-page, multi-brand routing多主页、多品牌路由
  • Knowledge-base audit — what must never be said知识库审计 —— 哪些话绝对不能对外说
  • Approval flow into Feishu, WeCom or Slack审批流接入飞书、企业微信或 Slack
  • Migration from an existing auto-reply setup从现有自动回复方案迁移
Typical lead time大致周期 2–3 weeks from kickoff, depending on how ready your product facts are. 开工后 2–3 周,取决于你的产品资料准备到什么程度。

How it is priced怎么收费

Fixed scope, quoted before anything starts. Hosting is a flat monthly fee. No per-message charges — your cost should not grow just because a post went viral. 固定范围,开工前给报价。托管是固定月费。不按消息条数收费 —— 一条内容火了不该让你多付钱。

  • Quote before work, not after先报价后开工,不是做完再谈
  • You own the deployment and the credentials部署和凭据都归你
  • Cancel hosting any month; take the setup with you托管随时可停,已部署的东西你可以直接拿走

When we will tell you not to buy this什么情况下我们会劝你别买

Three cases where automation makes things worse, and we say so before taking money: 有三种情况,自动化只会让事情更糟。这三种我们会在收钱之前说清楚:

  • Fewer than a handful of inquiries a day — answering by hand is faster than approving cards一天只有零星几条询盘 —— 人工回比点卡片快
  • Nobody can spend ten minutes a day on the queue — that turns "sometimes unanswered" into "systematically unanswered"没人能每天花十分钟看队列 —— 那会把「偶尔漏回」变成「系统性地不回」
  • Product facts are not written down yet — the model can only be as safe as your knowledge base产品参数还没落到纸面上 —— 模型的安全边界就等于你知识库的质量
05 — Quick start05 — 快速开始

Run it with dry-run on by default默认就是演练模式

With AIW_POST_ENABLED=false the Send button reports a simulated send and nothing reaches Facebook. Flip it only after a few drafts have come through. AIW_POST_ENABLED=false 时,点「发送」只会提示「模拟发送」,不会有任何内容发到 Facebook。先看几条草稿,再考虑打开。

# 1. clone and configure
git clone https://github.com/<you>/lead-pulse-guard.git
cd lead-pulse-guard
cp .env.example .env

# 2. gateway (verify → tag → dedupe → spool)
docker compose up -d gateway

# 3. worker (spool → KB → LLM → approval card)
python3 -m venv venv && ./venv/bin/pip install -r requirements.txt
AIW_POST_ENABLED=false ./venv/bin/python -m worker.main
Note注意 Subscribe to feed and leadgen at both levels — app-level and page-level. Page-level alone looks correct and delivers nothing. feed 和 leadgen 必须在两个层级都订阅:App 级和主页级。只配主页级看起来是对的,但什么都不会投递。

Tell us how inquiries reach you today说说你现在每天收到多少条询盘

Two sentences is enough: what you sell, roughly how many inquiries a day, and where they arrive. We will tell you whether this is worth automating — including when the answer is no. 两句话就够:你卖什么、一天大概几条询盘、从哪几个入口进来。我们会告诉你值不值得上自动化 —— 包括答案是「不值得」的时候。

Write to us写信给我们

yangke821118@gmail.com · replies usually within one business day yangke821118@gmail.com · 通常一个工作日内回复