Scope of this record
AIB10 was shut down on November 26. The server is gone and the code remains in the repository. This post records the order in which that code did its work. The screens are covered in Features and Screens and the server setup in Infrastructure.
The backend was a single FastAPI app made of 27 top-level Python modules and 489 tests. There were no outside users in the 80 days after launch, so the design below was never validated by real use.
What happens in one search
Query entered (2+ characters)
→ Cache check (same query, 30 minutes)
→ Quota check (per-plan daily searches → Naver total → Gemini total)
→ Naver news search (10 latest, titles and links only)
→ Gemini summary (10 titles as input)
→ Sentiment labeling (Gemini first, self-trained model on failure)
→ 5 related keywords and company-name candidates (one Gemini call)
→ Listed-company matching → response, cache write
At first the service fetched article bodies from publishers' pages and summarized those. On September 7 body collection was removed and only titles were used. There were two reasons. Collecting publishers' full text without permission as input to a paid product was not safe on copyright grounds. The cost gap was also large. The body-based summary input was about 12,000 tokens, while 10 titles come to about 600. The cost of one search fell from 8.1 won to under 1 won. The failure path where publishers blocked collection and the summary broke went away as well.
For sentiment, Gemini receives the 10 titles in one batch and sorts them into positive, negative, and neutral. If the call fails or hits the daily cap, the self-trained model labels them instead. The response carries which of the two did the labeling. The screen reads that value and shows Gemini in normal operation, and "fallback" only on the alternate path. Before September 8 the search screen used only the self-trained model while labeling it a fallback. That wording was untrue and was fixed when the paths were aligned.
If a later step fails, the search count already deducted is refunded, so that a search that returned nothing is not counted as usage. The date at deduction time is remembered and the refund is applied to that date. This prevents the refund for a slow request that crosses midnight from landing on the next day's record. The search route is a synchronous function. External calls and model inference run in the thread pool, so one request cannot stall the whole server.
Why there were five layers of limits
External API cost scales with the number of searches. Mechanisms of different kinds were stacked so that if one layer fails the next still holds.
| Layer | Value | What it stops |
|---|---|---|
| Screen | Rejects under 2 characters, locks the button after a search | Accidental repeated searches |
| Cache | Same query for 30 minutes, capped at 500 entries | Repeated calls for the same question |
| Rate limit | 6 per minute per IP | Script-like bursts |
| Per-plan daily quota | Anonymous 20, Free 30, Pro 300, Team 2,000 | Heavy use by one person |
| Service-wide totals | Naver 20,000, Gemini summaries 200, sentiment labeling 2,000 | The ceiling on daily cost |
Usage is written to the usage_daily table in the DB, per account or per IP. It started as an in-process counter, which reset to 0 on every restart. The accounting day follows Korean time. The quota check and increment happen in a single SQL statement, so concurrent requests cannot exceed the cap. The Naver total of 20,000 is 80% of the free allowance of 25,000. The labeling cap is kept separate from the summary cap so that labeling does not eat into the summary budget.
Login mail has limits too. At most 5 messages a day go to the same address, and at most 5 requests an hour are accepted from the same IP. In November an automated scanner called the login API and mail went out to an arbitrary address. These limits bounded the number of sends but did not prevent the send itself.
Watch: collection and spike detection
Watch collects registered keywords on a set interval and builds a sentiment time series. It uses the same collection and labeling steps as search. The difference is that it keeps the results.
Keyword registered
→ Scheduler looks up due watches every 60 seconds
→ Titles and links collected per source
→ Deduplicated by link, only new articles kept
→ Per-article sentiment labeling
→ Written to watch_runs · watch_articles
→ Spike detection → alert
→ Daily briefing at the chosen hour
The next run time lives in the watches.next_run_at column. Because the schedule is not held in memory, it survives a process restart. No separate scheduler library was used. This structure is safe only on the assumption of a single server. Running more instances would need run claiming, and that work was not done.
Article bodies are not stored. The watch_articles table has no body column, and a test enforces that. What is stored is the title, link, sentiment label, and source.
Spikes are judged against a baseline of up to the 10 most recent runs.
| Item | Criterion |
|---|---|
| Judgment withheld | Fewer than 3 past runs |
| Mention spike | 3 or more new articles and at least 2x the usual |
| Rising negative sentiment | Negative share of 50% or more and at least 25 points above the usual |
| Alert interval | Once per 6 hours per watch |
Runs with zero articles are recorded in the series too. Averaging without the quiet stretches inflates the baseline and misses real spikes. Negative share is compared only between runs labeled by the same model. On the same 118 titles Gemini rated 23% negative and the self-trained model 55%. Mixing the two would fire alerts merely because the labeling model changed, with public opinion unchanged. Right after the labeling source changes, the negative-sentiment judgment is withheld and only the mention judgment runs.
Sources were split into adapters. Naver news, YouTube channel RSS, publisher RSS, and GDELT for overseas news all return results in the same Article shape. The steps after collection do not know where an article came from. A source with no configuration drops out quietly, and one source failing does not block the rest. In production only Naver was enabled, because the sentiment model had not yet been checked on YouTube titles. YouTube data cannot be kept beyond 30 days, so raw articles and daily aggregates were stored separately. The sentiment trend remains after the raw rows are deleted.
Search demand and forecasting
What Watch looked at was article counts and tone. Both are supply-side measures. Naver DataLab's search-trend figures were collected once a day to add a demand axis. Values are stored per keyword. If several people register the same keyword, there is still one call. DataLab values are relative, with the maximum of the queried period set to 100. So keywords are not compared with each other. Only the latest 7 days and the 7 days before are compared for the same keyword.
Mention forecasts use Holt exponential smoothing with a damped trend, out to 7 days ahead. They use the past 14 days, and with fewer than 4 observations no trend is estimated. In that case the last value is carried forward. A forecast is recorded when it is made and never edited. Once the target date has passed, the actual value is filled in and the forecast is scored automatically.
| Rule | Reason |
|---|---|
| Forecast values and intervals are never changed once written | If they could be revised with later information the scorecard would mean nothing |
| The actual value is frozen at scoring time | Recomputing after raw data has aged out would give a wrong result |
| Only forecasts registered before the target date are scored | Forecasts registered after the fact cannot leak into the score |
| Days with no collection are not scored | A day with zero articles and a day that was not measured are different things |
The scorecard carries the direction hit rate, mean absolute error, and coverage of the 80% prediction interval. On early data the interval coverage was 0.30. The ideal is near 0.8, so the intervals were too narrow. That value was allowed to go out in the report as it was. The dashboard shows only the nearest single forecast and past scores. Drawing a seven-day curve would look more precise than it is. The rule of recording first and scoring later came from the market analysis project run earlier.
Delivering briefings and reports
Three things are sent. Spike alerts go out right after the judgment. The daily briefing goes out every day at the hour the user chose. Period reports go out on Mondays for the weekly and on the 1st for the monthly. Period reports cover only completed periods such as last week or last month. Including a period still in progress would make the numbers disagree with the next issue. Period boundaries are computed in Korean time. When the previous period's value is 0, no rate of change is written and the item is marked as new.
The delivery channels are email, Telegram, and webhook. Telegram was open on every plan. It is the alternate path when mail is blocked, so it was not put behind a paid tier. Webhooks were limited to the Team plan. If one channel fails, the others still send, and the item is recorded as sent if at least one succeeds. Requiring every channel to succeed would resend the same alert by mail repeatedly whenever a single webhook was dead. A webhook address is checked to be a public https address both when it is registered and when it is used.
When a briefing fails to send, it is retried up to 3 times a day at 30-minute intervals. Every message carries an unsubscribe link and the unsubscribe headers that mail clients use. Unsubscribing takes effect only on a POST request, because some mail clients and security scanners open links in advance. A GET request shows only a confirmation screen.
Listed-company display
This feature shows the name and ticker code of listed companies that the articles in a search result cover. Gemini produces company-name candidates in the same call that extracts related keywords. A candidate is kept only when it exactly matches one of the 2,759 entries in the KRX listed-company list. Next, the name is checked to actually appear in the article titles or summary. Up to 3 of what remains are shown.
Partial matching was not used. A partial match on "Hanwha" also catches Hanwha Solutions and Hanwha Aerospace. The choice was to allow misses and block showing the wrong company. Prices, percentage moves, and outlooks are not shown. The feature was also never made exclusive to paid plans. Under the Capital Markets Act, the test for an unregistered investment advisory business is receiving direct payment for investment advice. Since one line in the plan definition file could change the service's regulatory status, the reason for the prohibition was written into the code.
The listed-company list goes stale over time. When it is wrong, no error appears on screen. So the list carries its creation date, and a warning is logged once it is more than 90 days old. The monthly automatic refresh is rejected if the result has fewer than 2,000 rows or shrinks below 90% of the existing list. This prevents an empty list from being committed as is when KRX returns an error page.
Login and connecting the extension
Login works without a password, by clicking a link received by mail. The link is valid for 15 minutes and a session lasts 30 days. Only SHA-256 hashes of login tokens and session tokens are stored. The login link is never included in an API response. If someone could log in without access to the mailbox, it would not be authentication.
The Chrome extension does not use the session cookie and receives an extension-only token. The extension's origin differs from the web's, so using cookies would require allowing cross-site sending. That would weaken request-forgery protection for the whole web app because of one extension. The token is valid for 90 days and is sent in a request header. It is kept in per-device storage. In synced storage it would be copied to other devices without the user knowing. Users can disconnect just the extension from the dashboard.
Account deletion
Deletion runs only when the user types their own email address exactly. The server checks the same value again. Data tied to the account is deleted explicitly, table by table. There are reasons it was not all left to foreign-key cascades. A cascade does not report what was deleted or how many rows. Some data, such as login tokens and usage records, is not tied by a foreign key at all. Tests check both deleting too little and deleting another person's data.
The audit record keeps only the deletion time, the account number, and row counts per table. The email address is not written. After deletion completes, one confirmation message is sent to that address. It is the only way the account owner can learn of a deletion they did not request.
Data structure
Storage is a single SQLite file with 16 tables.
| Group | Tables |
|---|---|
| Accounts | users, login_tokens, sessions, extension_tokens |
| Collection | watches, watch_runs, watch_articles, search_trends |
| Judgment and forecasting | alerts, forecasts |
| Delivery | digests, reports |
| User-saved | bookmarks, waitlist |
| Operations | usage_daily, job_runs |
job_runs records whether the once-a-day jobs have run. Kept in memory, the day's jobs would run again on every restart and spend the external API allowance one more time. Watch run records are kept for 120 days and forecast records for 400. Forecast records are the only basis for the scorecard, so they are kept longer.
The criterion repeated across the design
Key point
The same criterion was used across several features: failures should not pass quietly. The listed-company list rejects a refresh that shrinks sharply. Forecast scores are published even when they are bad. Sentiment labels record the model that produced them. Screen wording was matched to the actual processing path.
That said, this design ended without users. No outside user ever received a spike alert. Whether the design held up in real use was never confirmed.