Define a human turn at typed, the entry it tests #42

Merged
lilleman merged 3 commits from typed-definition into main 2026-09-25 17:47:08 +02:00
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -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
+7 -5
View File
@@ -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/*/<session-id>.jsonl, one JSON object per line. A <session-id>/
folder and <session-id>.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
"<" (<command-name> 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 "<" (<command-name> 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):
-1
View File
@@ -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.