diff --git a/CLAUDE.md b/CLAUDE.md index 411fe049..4af80188 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -107,7 +107,7 @@ How work proceeds in any repo, unless that repo's `AGENTS.md` says otherwise. **Link, don't inline — and keep the link bare.** A mechanism identical across call sites or repos is documented once in the canonical source and pointed at with a one-line bare link; N copies drift, whether they are comments or READMEs. Don't summarize what's behind the link or restate the identifier's own name. -**A pointer is not a definition.** A definition the reader needs to follow the code — what a unit counts, what a term means, what invariant a cache rests on — sits at the code in one line. A pointer to it (`see AGENTS.md §11`) is the one comment form that cannot be checked against the code beside it, so it rots invisibly. A pointer carrying rationale — a rejected alternative, the premise behind a standing choice — is correct and stays. +**A pointer is not a definition.** A definition the reader needs to follow the code — what a unit counts, what a term means, what invariant a cache rests on — sits at the code in one line. A pointer to it (`see AGENTS.md §11`) cannot be checked against the code beside it, so it rots invisibly. A pointer carrying rationale — a rejected alternative, the premise behind a standing choice — is correct and stays. ### Comments diff --git a/bin/loop-claude b/bin/loop-claude index 6d06abc1..0e9b54d4 100755 --- a/bin/loop-claude +++ b/bin/loop-claude @@ -25,9 +25,7 @@ boundary, once the new file answers --help. Claude Code internals this rests on, observed on 2.1.282: - The transcript is ~/.claude/projects/*/.jsonl, one JSON object per line. A / folder and .superseded-*/ and .orphaned-*.jsonl siblings belong to the same session. -- Claude Code writes "user" entries of its own: isMeta ones, tool_result lists, strings starting with - "<" ( and its kind) and text parts starting with "[Request interrupted". A typed human - turn is any other "user" entry. +- Claude Code writes "user" entries of its own into the transcript; typed() tells a human's from them. - An "assistant" entry, in the transcript and in --output-format stream-json, carries message.content parts of type "text" (text) and "tool_use" (name, input); stream-json ends with a "result" event. - `claude -p --output-format json --json-schema` returns the verdict under "structured_output". @@ -174,7 +172,11 @@ def render(entries): return "\n\n".join(lines) -def typed(content): +def typed(entry): + """A human turn: a "user" entry, not isMeta, whose message.content is a string not starting with "<" ( and its kind) or one or more text parts, none starting with "[Request interrupted".""" + if entry.get("type") != "user" or entry.get("isMeta"): + return False + content = entry.get("message", {}).get("content") if isinstance(content, str): return not content.startswith("<") parts = content if isinstance(content, list) else [] @@ -182,7 +184,7 @@ def typed(content): def human_turns(entries): - return sum(1 for entry in entries if entry.get("type") == "user" and not entry.get("isMeta") and typed(entry.get("message", {}).get("content"))) + return sum(1 for entry in entries if typed(entry)) def make_private(folder): diff --git a/todo.md b/todo.md index 4fad0218..0e772dcd 100644 --- a/todo.md +++ b/todo.md @@ -4,7 +4,6 @@ Ordered by how many seats of the 2026-09-25 scoring panel (`docs/decisions.md`) named the place; each is one chunk. -- Define a human turn at `typed` in one line and name what it tests, today the definition sits in the docstring 150 lines above. - Place `larv-review`'s Re-entry section after the passes it cites, today five forward references before §0. - State the fits-in-your-head thresholds once in `agents/systems-architect.md`, cited by heading, today echoed at seven places and cited as "step 4" by number at nine; fold the Quality Bar into the sections it restates. - Say why the worker failed when `claude` exits 0 without a result event, today `run_worker` returns `{}` for that and for a non-zero exit and prints nothing.