← 제작기

누적 합계를 빼면 그날 숫자가 나왔다

Claude 빌딩은 Claude 세션을 3D 사무실 건물로 보여 주는 화면입니다. 세션 하나가 동물 직원 한 명이 되어, 읽기와 검색을 하면 자료실로, 편집을 하면 책상으로, 명령을 돌리면 서버실로 옮겨 다닙니다. 맥에서는 세션 기록을 실시간으로 읽어 움직이고, 10월 20일에는 이 사이트의 전체 작업 페이지에 사이트판을 올렸습니다.

사이트판을 만들며 지킨 선은 하나였습니다. 숫자는 공개하되, 무슨 일을 했는지 짐작하게 하는 이름과 특정한 날의 사용량은 새지 않게 하는 것입니다. 이름은 막을 자리가 처음부터 분명했고, 그날 사용량은 처음 설계에서 놓친 두 군데로 새고 있었습니다.

이름은 집 안에 두고 숫자만 내보낸다

실시간판은 사이트에 올리지 않았습니다. 세션 기록에는 대화 원문과 명령 전체가 들어 있고, 실시간판은 그중 세션 제목과 경로를 뗀 파일 이름, 명령 앞 두 낱말을 말풍선으로 띄웁니다. 혼자 보기에는 편하지만 바깥에 열면 어떤 프로젝트를 하는지가 그대로 읽힙니다. 지금도 이 맥 안과 사설망에서만 열고, 같은 와이파이의 누구나 볼 수 있는 집 와이파이 주소에도 열지 않습니다.

사이트판은 층을 사이트 카드로 바꿨습니다. 카드 한 장이 한 층이고, 카드는 지금 35장입니다. 층을 누르면 그 카드의 소개와 어제 하루의 숫자가 나옵니다. 화면이 읽는 숫자는 data/activity.json 하나이고, 카드 id 별 세션 수, 서브에이전트 수, 모델별 세션 수, 토큰, 일곱 갈래로 나눈 도구 횟수만 듭니다. 값으로 든 문자열은 날짜와 ISO 주가 전부입니다.

세션 기록의 폴더를 카드로 바꾸는 대응표는 사이트 밖, 빌딩 저장소에 두었습니다. 사이트 저장소의 파일은 전부 공개 주소로 서빙되는데, 대응표에는 폴더 이름이 그대로 적혀 있기 때문입니다. 대신 집계기가 사이트의 카드 목록과 대응표를 대조해 어긋나면 멈춥니다. 이 대조도 처음에는 34장 가운데 4장을 놓쳤는데, 카드 정의가 주석으로 시작하는 경우를 읽지 못해서였습니다.

누적의 차이가 그날 숫자였다

카드 가운데 셋은 업무와 이어진 도구라서, 어제 하루 숫자 대신 주 단위로만 보이게 정했습니다. 끝난 주의 합만 weekly 칸에 넣고 daily 칸에서는 뺐습니다. 처음 정한 것은 여기까지였습니다.

층을 누르면 함께 나오는 쌓인 합계가 문제였습니다. 누적은 매일 아침 새로 계산되므로, 오늘 받은 누적에서 어제 받은 누적을 빼면 그날 쓴 양이 그대로 나옵니다. 하루 숫자를 감춘 카드라도 누적이 매일 바뀌면 감춘 것이 아니었습니다. 그 셋의 누적은 totals.weekly 라는 칸으로 따로 떼어, 끝난 주의 일요일까지만 담기로 정했습니다. 주 중에는 누적이 그대로 있다가 주가 끝나면 한 주 몫이 한꺼번에 더해지고, 층을 누르면 "지난주 · 42주"처럼 기준 주가 같이 뜹니다.

뒤에 붙인 기능도 같은 식으로 따졌습니다. 모든 층 목록에 층마다 쌓인 토큰과 전체 대비 비율을 넣었는데, 분모는 이미 공개된 누적의 합입니다. 다른 공개 숫자와 빼고 나눠 봐도 새로 나오는 것이 없어서 그대로 올렸습니다.

기타 칸으로 새던 몫

업무 카드의 몫은 다른 길로도 새고 있었습니다. 집계기는 세션이 도구로 건드린 경로를 보고 카드를 정합니다. 세션 다수는 카드가 없는 상위 폴더에서 시작하고, 첫 경로가 잡히기 전에 한 일은 어느 카드에도 속하지 않아 기타로 세었습니다. 기타는 매일 숫자에 나오는 칸입니다.

업무 폴더를 건드린 세션 8개를 재 보니 셋이 그랬습니다. 첫 경로가 잡히기 전에 한 일이 각각 28회, 34회, 59회였고, 그 몫이 주 단위로 감춘 카드 대신 기타의 하루 숫자에 들어가 있었습니다. 지금은 세션이 처음 카드에 닿기 전의 몫을 기다렸다가 그 첫 카드로 셉니다. 끝까지 어느 카드에도 닿지 않은 세션만 기타로 남습니다.

두 번 막고, 일부러 틀려 본다

공개되는 파일은 두 곳에서 막습니다. 빌딩 저장소의 집계기가 허용한 칸만으로 파일을 만들고, 사이트 저장소의 검사기가 올리기 직전에 한 번 더 봅니다. 검사기는 정해진 칸만 받고, 값은 0 이상 정수와 날짜, ISO 주만, 카드 id 는 사이트 카드와 기타만 받습니다. 주 단위 카드가 daily 나 일반 누적에 나오거나, 아직 끝나지 않은 날이나 주가 들어 있어도 막습니다.

검사기가 정말 막는지는 틀린 파일을 일부러 넣어 봤습니다. 처음에는 세션 제목 칸, daily 에 나온 업무 카드, 누적에 나온 업무 카드, 숫자 자리에 든 경로 문자열, 저장소 이름으로 된 카드 id, 오늘 날짜 여섯 가지였습니다. totals.weekly 를 더한 뒤에는 그 칸에 든 일반 카드, 이번 주까지 담은 누적, 일반 누적에 든 업무 카드 세 가지를 더 넣었습니다. 아홉 가지 모두 잡혔고 검사기는 1 로 끝났습니다.

세는 쪽도 따로 확인했습니다. 집계기의 날짜별 토큰을 같은 순간 메시지 id 전체로 중복을 거른 독립 계산과 맞춰 보니 76일 모든 날이 같았습니다. 처음 대조에서는 0.17% 어긋났는데, 집계기가 아니라 하루씩 떼어 중복을 거른 대조 방식과 두 계산 사이에 쌓인 기록 때문이었습니다.

이 대조로도 보이지 않은 것이 있었습니다. 다른 앱에서 쓴 것도 다 들어가 있느냐고 제가 물었고, 세어 보니 Xcode 안의 Claude 는 세션 기록을 다른 폴더에 쌓아 통째로 빠져 있었습니다. 8월 10일부터 10월 2일까지 기록 142개, 토큰 2,053만으로 전체의 약 8%였습니다. 대조는 읽은 기록 안에서 맞는지를 볼 뿐, 읽지 않은 기록이 있는지는 알려 주지 않았습니다. 지금은 두 폴더를 함께 읽고, claude.ai 채팅과 클라우드 세션, 집 서버에서 돈 세션은 여전히 세지 않습니다.

매일 아침 파일 하나만 올린다

숫자는 매일 아침 6시 반에 맥이 스스로 갱신합니다. 집계기가 임시 폴더에 새 파일을 만들고, 검사기를 통과하고 내용이 바뀐 날에만 그 파일 하나를 커밋해 push 합니다.

공들인 쪽은 올리는 조건보다 멈추는 조건이었습니다. 사이트 저장소가 원격보다 앞서 있으면 건너뜁니다. 그 상태로 push 하면 숫자 파일 하나를 올리려다 제가 아직 올리지 않은 커밋까지 같이 나갑니다. 원격보다 뒤처져 있거나, main 브랜치가 아니거나, 숫자 파일에 커밋하지 않은 손댐이 있어도 건너뛰고, 까닭을 기록 파일에 한 줄로 남깁니다.

건너뛰는 길은 사이트 복제본 둘로 시험했습니다. 공개 전 커밋 하나를 얹은 복제본은 "앞 1"로 멈췄고, 세션 제목 칸을 섞어 내는 가짜 집계기를 붙인 쪽은 검사 실패로 멈춰 커밋이 생기지 않았습니다. 정해진 시각에 저절로 올라간 첫 회는 10월 21일 6시 30분 11초였고, 어긋남 0곳에 어제 숫자가 있는 카드 8장으로 기록됐습니다.

정리하면

  • 감춘 숫자도 다른 공개 숫자와 빼고 나누면 나올 수 있습니다. 하루 숫자를 감춘 카드의 누적은 끝난 주까지만 둡니다.
  • 경계에서 밀려난 몫은 기타 같은 공용 칸에 쌓입니다. 감춘 카드의 몫이 어디로 갔는지까지 셉니다.
  • 공개 파일은 만드는 쪽과 올리는 쪽에서 두 번 막고, 틀린 파일을 일부러 넣어 막히는 것까지 봅니다.
  • 자동 공개는 파일 하나만 올리고, 사람이 아직 올리지 않은 커밋이 있으면 멈춥니다.
  • 대조가 맞아도 읽지 않은 기록은 보이지 않습니다. 무엇을 읽고 있는지부터 셉니다.

Claude Building is a screen that shows Claude sessions as a 3D office building. Each session becomes one animal staff member, moving to the archive when it reads or searches, to a desk when it edits, and to the server room when it runs commands. On the Mac it moves by reading the session logs in real time, and on October 20 I put a site version on this site's All work page.

I held to one line while building the site version: publish the numbers, but let nothing leak of the names that hint at what was done, or of how much was used on any particular day. Where to block the names was clear from the start; the day's usage was leaking through two places the first design had missed.

Names stay at home; only numbers go out

The live version is not on the site. The session logs hold the full conversation text and every command, and the live version puts some of that in speech bubbles: the session title, file names with the path stripped, and the first two words of each command. That is handy for viewing alone, but opened to the outside it would show exactly which projects I am working on. It still opens only on this Mac and over the private network, and not even on the home Wi-Fi address, where anyone on the same Wi-Fi could see it.

The site version turns the floors into site cards. One card is one floor, and there are 35 cards now. Clicking a floor shows that card's description and yesterday's numbers. The only numbers the screen reads are in data/activity.json, which holds nothing but session counts, subagent counts, sessions per model, tokens, and tool counts split into seven kinds, per card id. The only strings it holds as values are dates and ISO weeks.

The table that maps session-log folders to cards lives outside the site, in the building repository. Every file in the site repository is served at a public address, and the table has folder names written in it as they are. Instead, the aggregator checks the site's card list against the table and stops if they disagree. Even this check missed 4 of 34 cards at first, because it could not read card definitions that start with a comment.

The difference in totals was the day's number

Three of the cards are tools tied to work, so I decided they would show only weekly numbers instead of yesterday's. Only a finished week's sum goes into the weekly slot, and they are left out of the daily slot. That was as far as the first decision went.

The problem was the running totals that appear alongside when you click a floor. The totals are recalculated every morning, so subtracting yesterday's totals from today's gives exactly how much was used that day. A card with its daily numbers hidden was not hidden at all if its total changed every day. I split the totals for those three into a separate slot, totals.weekly, which holds only up to the Sunday of the last finished week. During the week the total stays put; when the week ends, the whole week's share is added at once, and clicking the floor shows the reference week alongside, like "last week · week 42".

Features added later were weighed the same way. The all-floors list now shows each floor's accumulated tokens and its share of the whole, and the denominator is the sum of totals that are already public. Subtracting and dividing it against the other public numbers yields nothing new, so it went up as it was.

The share leaking into Other

The work cards' share was leaking another way, too. The aggregator decides a session's card from the paths its tools touch. Many sessions start in a parent folder that has no card, and work done before the first path was caught belonged to no card, so it was counted as Other. Other is a slot that shows up in the daily numbers.

Measuring the 8 sessions that touched work folders, three of them had this problem. The work done before the first path was caught came to 28, 34 and 59 actions respectively, and that share was going into Other's daily numbers instead of the weekly-only cards. Now the share from before a session first reaches a card is held back and counted toward that first card. Only sessions that never reach any card remain in Other.

Blocked twice, and wrong on purpose

The public file is blocked in two places. The aggregator in the building repository builds the file from allowed slots only, and the checker in the site repository looks once more right before it goes up. The checker accepts only the defined slots, values only as non-negative integers, dates and ISO weeks, and card ids only for site cards and Other. It also blocks a weekly-only card appearing in daily or in the regular totals, and a day or week that has not finished yet.

To see whether the checker really blocks, I fed it wrong files on purpose. At first there were six: a session-title slot, a work card in daily, a work card in the totals, a path string in place of a number, a card id named after a repository, and today's date. After adding totals.weekly, I added three more: a regular card in that slot, totals running through the current week, and a work card in the regular totals. All nine were caught, and the checker exited with 1.

The counting side was checked separately. Matching the aggregator's daily tokens against an independent calculation, taken at the same moment and de-duplicated by message id over the whole set, all 76 days were identical. The first comparison was off by 0.17%, and the cause was not the aggregator but a comparison method that de-duplicated one day at a time, plus logs that accumulated between the two calculations.

There was something even this comparison did not show. I asked whether usage from other apps was all included, and counting turned up that Claude inside Xcode stores its session logs in a different folder and was missing entirely. From August 10 to October 2 that was 142 logs and 20.53 million tokens, about 8% of the total. A comparison only shows whether things agree within the logs it read; it does not tell you whether there are logs it never read. Now both folders are read, and claude.ai chats, cloud sessions and sessions run on the home server are still not counted.

One file each morning

The Mac refreshes the numbers on its own at 6:30 every morning. The aggregator builds a new file in a temporary folder, and only on days when it passes the checker and its content has changed is that one file committed and pushed.

The effort went less into the conditions for publishing than into the conditions for stopping. If the site repository is ahead of the remote, the job skips. Pushing in that state would send out commits I had not published yet, along with the one numbers file. It also skips if the repository is behind the remote, if it is not on the main branch, or if the numbers file has uncommitted changes, and it leaves the reason as one line in a log file.

The skip paths were tested with two clones of the site. The clone with one unpublished commit on top stopped at "ahead 1", and the one wired to a fake aggregator that slips in a session-title slot stopped on a failed check, so no commit was made. The first run that went up on its own at the scheduled time was at 6:30:11 on October 21, recorded with 0 mismatches and 8 cards with numbers for yesterday.

In short

  • Hidden numbers can still come out when you subtract and divide them against other public numbers. The totals of cards whose daily numbers are hidden run only to the last finished week.
  • Shares pushed off a boundary pile up in shared slots like Other. Count where a hidden card's share went, too.
  • Block the public file twice, where it is made and where it is published, and feed it wrong files on purpose until you see them blocked.
  • Automatic publishing pushes one file only, and stops if there are commits a person has not published yet.
  • Even when the comparison agrees, logs you never read stay invisible. Start by counting what you are reading.