跳到正文
DEV Community· Sungsoo Youn·· 2 小時前AI 評分43

Claude Code Agent 的訪客估算一夜由 95 跌至 7,改變的只有計算方式

My Visitor Count Fell From 95 to 7 Overnight. Only the Counting Had Changed.

AI 導讀

作者將訪客估算由按15項商品的最低瀏覽數扣減,改為按商品帳本逐項扣減,數字在10月12日由95跌至7。修正後,各商品的負數按零計,合計至少17,帳本多計的10另行列出;完整測試套件3,355項全數通過。

正文

A field note from the autonomous Claude Code agent I run every day on one Windows PC. The numbers come from its own ledgers, not from memory.

Free to read first: a PDF sample of the book behind this setup — its first 3 chapters: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

I sell the Korean edition of my book on one store as 15 products: the main book, a bundle, a free sample, 11 single chapters and one more product. Every evening my agent saves the store's visit count for each product over the last 7 days. A meter then estimates how many of those visits came from people other than me.

Why the meter has to subtract me

My agent opens these product pages itself. A morning check opens every product once a day. Other jobs open the main book, the bundle and the free sample more often. The store counts all of it.

Until October 11 the meter used a floor. It took the lowest count among the 15 products as my own visits and subtracted it from every product. On October 11 that gave 95 visitors out of 215 visits.

On October 5 I had started a ledger that writes down every time my agent opens a product page. Its first full day was October 6. On October 12 it covered the whole 7-day window for the first time, the meter switched to subtracting the ledger product by product, and the number dropped to 7.

What the products showed

Split by product, seven came out at 0. Five were positive: 4, 5, 3, 3 and 2. Three were negative. The main book had 20 visits in the store's count and 28 in my ledger, so it came out at minus 8. The other two were minus 1 each.

Added together, the negative 10 cancelled most of the positive 17.

The negatives had two causes. The snapshot is taken in the 18:40 run, but the ledger kept going after it: the 19:00 report opened the main book and the free sample again. And for the main book, my ledger records more opens than the store seems to count.

A negative number for one product only says that product had no other visitors. It cannot take visitors away from a different product.

The fix

Each product now counts as at least zero, so the total is a lower bound: 17, not 7. The 10 that my ledger counted above the store's count is shown on its own line.

The evening run now also writes down my ledger total at the moment it saves the snapshot, so later visits no longer leak into it. That field starts on October 13.

I wrote 8 new tests first, and 7 of them failed against the old code. The fix changed how the snapshot is saved and the three places that read it: the meter, the experiment judge and the evening report. My auditor rejected the first pass because the judge was covered only by a test that searched its source text. I added a test that runs it. The full suite ran 3,355 tests, all passing.

What the fix showed

On October 12 the store counted 209 visits. At least 17 came from someone else, at least about 2.4 a day. On the same snapshot, the old floor method would have said 104.

My ledger also recorded 74 opens on October 12 against 21 a day from October 6 to October 10. That day my agent's work sessions had checked the public pages many extra times. Those opens stay in the 7-day window until October 18. My weekly traffic goal is 240. If the count passes 240 this week, much of the rise may be me.

The rules

  • When a number falls on the day the counting method changes, check the count first. Split it by part before believing it.
  • A negative part means zero, not a debt to collect from the other parts.
  • Take what you subtract at the same moment as the thing you subtract it from.
  • Find out how much of a metric is you before you try to move it. My own checks alone can move my traffic goal.

Where this comes from. Every post here comes from one setup I run daily: a CLAUDE.md, memory files the agent reads before it touches anything, and a separate auditor agent that returns PASS or FAIL. The first 3 chapters of the book that walks through it are free as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

The full edition is 11 chapters plus 4 ready-to-use templates (CLAUDE.md starter, memory files, auditor checklist, measurement guide) and a hands-on section for every chapter, $19 as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code

Questions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.

來源:DEV Community · dev.to