본문 바로가기
C.W.K.
Stream
Lesson 03 of 05 · published

Tool Result는 dump 말고 summary

~24 min · tools, summaries, noise

Level 0Window Watcher
0 XP0/50 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

Tool이 context를 오염시킬 수 있어

20,000줄을 뱉는 tool은 기술적으로는 성공이지만 운영상으로는 해로워. 모형이 그 덩어리를 앞으로 오는 turn마다 짊어지고 가야 하고, 거기서 정작 해야 할 일이랑 자리를 다투거든. 긴 session은 tool 덩어리가 쌓이다가, 중요한 게 전부 tar -tvf 출력에 파묻혀.

일에 맞는 모양으로 돌려줘

좋은 tool은 일에 맞춰 다듬은 관찰을 돌려줘. 뭐가 바뀌었는지, 뭐가 실패했는지, 관련된 줄, 개수, 경로, 다음에 볼 것. 원본은 파일이나 log에 두고 필요할 때 필요한 만큼만 잘라 올려. 요약은 증거를 남겨야 해 — 줄 번호, 명령, 종료 코드. 그렇다고 홍수 전체를 앞으로 오는 turn마다 끌고 다닐 필요는 없고.

짧게가 두루뭉술하게는 아니야

요약은 모형이 그걸로 따져볼 수 있어야 해. 'Tests failed'는 너무 짧아. '2 failing tests in auth/session.spec.ts at lines 42 (expected 401 got 200) and 88 (timeout)' — 이 정도 밀도가 맞아.

거대한 tool 덩어리는 앞으로 오는 모든 turn에 물리는 context 세금이야.

Code

일에 맞는 모양의 tool 결과·yaml
tool_result:
  command: "npm test"
  exit_code: 1
  summary: "2 failing tests in auth/session.spec.ts"
  evidence:
    - "auth/session.spec.ts:42 expected 401 got 200"
    - "auth/session.spec.ts:88 timeout waiting for logout"
  raw_log_path: "/tmp/run-123.log"
시끄러운 tool에 씌우는 껍데기·python
def shape_test_output(raw_stdout: str) -> dict:
    failures = parse_failures(raw_stdout)
    return {
        "exit_code": last_exit_code(),
        "summary": f"{len(failures)} failing tests",
        "evidence": [f"{f.path}:{f.line} {f.message}" for f in failures[:10]],
        "raw_log_path": dump_raw_to_tmp(raw_stdout),
    }

External links

Exercise

시끄러운 명령 출력 하나를 골라서 요약 + 증거 + 원본 log pointer가 있는 모양으로 다시 써봐.
Hint
중요한 줄은 정확하게 남겨. 장식용으로 쏟아지는 건 버리고.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.