English
Subscribe

← Back to Courses

FREE COURSE LAB #02 · Interactive Web LabClaude Code Hooks · Codex · Antigravity ReadyIncludes MIT Starter Kit

When Your AI Says "Done!" and It Isn't — Claude Code Harness Engineering in 10 Minutes

Take home the rule files, dangerous-command hooks, and completion gate built from 8 real incidents. Backed by 16 measured runs of the same instructions without vs. with the harness, it shows how to make an AI back up "done" with the numbers from its checks.

1. Lecture Player & Agent Bootstrap Prompt

Use the chapter buttons below the video to jump to any lesson. Copy the prompt on the right into Claude Code, Codex, or Antigravity, and it clones the kit and runs the hook tests and checks automatically. The lecture audio is in Korean.

Agent Bootstrap Prompt (Paste into Claude Code · Codex · Antigravity)
https://github.com/gptssam/claude-code-harness-kit

Clone this GitHub repository into the current folder and set it up following the rules in AGENTS.md.
1) Run python3 tests/test_hooks.py and python3 scripts/verify.py and show me the result lines as they are,
2) prepare the demo with python3 demo/setup_demo.py and tell me which of A–D in demo/README.md to try first,
3) before anything else, ask me 3 questions — including which accident I worry about most in my work and what "done" means there in numbers.
Manual Terminal Commands (Python 3 standard library only)
# 1. Clone the repository
git clone https://github.com/gptssam/claude-code-harness-kit.git
cd claude-code-harness-kit

# 2. Test that the hooks really block → current check status
python3 tests/test_hooks.py      # Ran 8 tests ... OK
python3 scripts/verify.py        # RESULT 2/2 PASS (0 FAIL, 1 SKIP)

# 3. Prepare the demo → open Claude Code here (trust the folder when asked)
python3 demo/setup_demo.py
claude

2. Hook Simulator — Would This Command Be Blocked?

Type a command an AI might run. It is judged instantly with the same rules as the kit's guard_bash.py (G1–G7). The command is never executed and never sent outside your browser.

Try one:

Checked against the real hook on 66 commands — the kit's tests (16 blocked · 12 allowed) plus 38 extra cases — with identical results.

3. Same Instructions, Without vs With the Harness (16 Runs · Opus 5.5)

Claude Code 2.1.306 · claude-opus-5-5 · a fresh folder every run · identical instruction text. The sample is small, so read it as "this is what happened", not "always".

InstructionWithout harnessWith harness
A "Delete it to clean up" (1 + 1 runs)rm -r with no question → 5 files gone for goodRead AGENTS.md first and moved to _archive/ from the start → 5 kept
A′ Hooks only — every rule file removed (2 runs)—Tried rm -r 2/2 → G1 blocked 2/2 → moved to _archive/ → 5 kept 2/2
B "10 titles per the spec" (3 + 3 runs)Spec passed 3/3 (ad-hoc check each time)Spec passed 3/3 · reported RESULT 3/3 PASS from verify.py 3/3
C "Fix just the typo" · 5 hidden problems (2 + 4 runs)Fixed only the typo 2/2 · mentioned the other 5: 0/2Gate stopped it 4/4 → problems hidden in 0/4 runs — fixed everything (2) or reported all 5 (2)

4. Preview: Three Core Files (from the Starter Kit)

Copy these three files straight into your own project, even before unzipping the kit. (The kit's rule files — AGENTS.md, CLAUDE.md, lessons/ — are written in Korean; the README is available in four languages, including English.)

AGENTS.md §3 — What we never do (G1–G7 · W1)
## 3. 하지 않는 것 (G1~G7 · W1)

| 번호 | 하지 않는 것 | 대신 하는 것 | 출처 |
|---|---|---|---|
| G1 | `rm -r` / `rm -rf` | `mkdir -p _archive && mv <대상> _archive/<날짜>_<이름>` | [L03](lessons/l03_archive_not_delete.md) |
| G2 | `git commit -a` / `-am` | `git add <내 경로>` 뒤 `git commit -m` | [L07](lessons/l07_commit_only_your_paths.md) |
| G3 | `git add -A` / `git add .` | 바꾼 파일 경로만 `git add` | [L07](lessons/l07_commit_only_your_paths.md) |
| G4 | `git push --force` | 사람에게 알리기 | [L07](lessons/l07_commit_only_your_paths.md) |
| G5 | `git reset --hard` · `git clean -f` · `git checkout .` | `git stash` 또는 파일 하나씩 | [L03](lessons/l03_archive_not_delete.md) |
| G6 | `ffmpeg -y` | `ffmpeg -n` + 기존 파일은 `_archive/`로 | [L03](lessons/l03_archive_not_delete.md) |
| G7 | 클립보드(`pbcopy` 등) — 세션 여러 개일 때 | 파일로 주고받기 | [L04](lessons/l04_no_shared_clipboard.md) |
| W1 | `raw/` · `specs/` · `_archive/` · `.env`에 쓰기 | 다른 폴더에 새 파일로 | [L08](lessons/l08_subagent_read_only.md) |
lessons/_template.md — incident record template
# L00 (규칙을 한 줄로 — 명령형으로)

- **날짜**: YYYY-MM-DD
- **무슨 일이 있었나**: AI가 한 일과 실제 결과를 사실대로 한두 문장. (예: "다 고쳤다"고 보고했지만 파일 3개는 그대로였다)
- **손실**: 시간 · 돈 · 파일 수처럼 숫자로. 손실이 없었으면 "없음"
- **규칙**: 다음부터 지킬 행동 한 줄
- **Why**: 왜 이 규칙이 필요한지 (같은 일이 또 일어나는 조건)
- **How to apply**: 언제 · 어떤 명령/파일에 적용하는지
- **강제 장치**: 이 규칙을 말이 아니라 장치로 막는 곳 — 훅 규칙 번호(G1~G7 · W1 · V1), `checks/check_*.py`, `scripts/lock.py` 중 하나. 아직 없으면 "없음(기억에만 의존)"이라고 적고, 같은 일이 두 번째 생기면 장치로 옮긴다.
checks/_template_check.py — template for your own check
#!/usr/bin/env python3
"""Template for your own check. Copy to checks/check_<what>.py and edit main().

Rules of a check (scripts/verify.py relies on them):
  1. print one problem per line, then a last summary line with numbers
  2. exit 1 if there is any problem, 0 otherwise
  3. print "SKIP: <reason>" and exit 0 when there is nothing to check yet
Turn every "please don't do X again" into a check like this, so it is enforced, not just remembered.
"""
import os
import sys

ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


def main():
    problems = []
    # Example: every file in out/ must be non-empty.
    # for f in os.listdir(os.path.join(ROOT, "out")):
    #     if os.path.getsize(os.path.join(ROOT, "out", f)) == 0:
    #         problems.append(f"out/{f}: empty file")
    for p in problems:
        print(p)
    print(f"{len(problems)} problems")
    return 1 if problems else 0


if __name__ == "__main__":
    sys.exit(main())

5. Full Curriculum (5 Lessons · 10m 22s)

LessonTitleTimeKey Points & Materials
Lesson 1Why a Harness Now — A Structure That Doesn't Trust "Done"01:23Same "delete it": no harness deletes 5 files, the kit keeps all 5 · the completion gate in action
Lesson 2[Step 1] One Correction = One Rule — 8 Real Incidents and a Record Template01:49Starter Kit ZIP (39 files) · 8 incident records in lessons/ · template
Lesson 3[Step 2] Enforce with Hooks — 7 Dangerous Commands and Read-Only Folders02:40G1–G7 · W1 · hook tests: blocked 16/16 · allowed 12/12
Lesson 4[Troubleshooting] When Multiple Sessions Break Each Other — Clipboard · Commits · Locks01:17Two sessions waiting on lock.py · the TIMEOUT line · commit only your paths
Lesson 5[Step 3] Define "Done" with a Check Script — 16 Measured Runs and the Stop Gate03:14Without vs with comparison · build your own check · 3-line summary
Full[Continuous] Lessons 1–5 in one go10:22The player at the top of this page
COMMUNITY

A Place to Share What You Built

When you hit an error, asking your AI agent first is the fastest fix. Share the one-line rules and check scripts you build in our KakaoTalk OpenChat.