Skip to content

Requirements: quiz only — standalone quizzes, and a code quiz every reviewer can see ​

Phase 1 of 3 (requirements → design → tasks). Following the Kiro spec approach (https://kiro.dev/docs/specs/). The author declared requirements-approval skipped at phase-selection, so this file is iterated as review on the pull request that carries it.

The short version ​

The explainer feature (issue-488) writes a teaching page and a quiz. People take the quiz and skip the page, so this work item removes the page and keeps the quiz.

  • phase-selection offers one quiz row in place of explainer and its two experiment rows.
  • Each quiz is its own HTML page: published as its own artifact and committed to the branch, so a reviewer without access to the operator's artifact can still open it.
  • The author's checkbox gates exactly as today, before code generation and before review.
  • The code quiz carries the spec questions as Part 1 and the change as Part 2. The pull request description announces it near the top, with a table of who has taken it.
  • A reviewer says they took it by replying the-loop quiz-taken. That reply is shown and gates nothing.

Read closely: Requirement 7 and the Security considerations. Requirement 7 lets a person who is not an authorized user cause the-loop to edit a pull request description, which no keyword does today.

Introduction ​

Issue #557 cuts the explainer feature down to its quizzes. Three things were wrong with the feature as shipped:

  1. The prose was not read. The page's Background, Intuition and Code sections cost a node's worth of generation on every work item, and the quiz was the part people used. A question's why already teaches the concept at the moment the reader gets it wrong.
  2. Reviewers could not open the quiz. The page was a tab of the operator's private artifact or doc, so the people the code quiz would help most never saw it.
  3. Only the author was asked. The code quiz appeared as one "Start here" line in the briefing, and nothing showed whether any reviewer had taken it.

This work item keeps the two gates and their attribution rule (decision-143) unchanged. It changes what the agent writes, where the page lives, and how visible the code quiz is on the pull request.

Terms used below:

  • Quiz page: the standalone HTML page holding one quiz.
  • Quiz comment: the-loop's comment carrying the author's checkbox.
  • Banner: the marked block in a pull request description that announces the code quiz and holds the table.
  • Delivering pull request: a pull request recorded against the work item.

Requirements ​

Requirement 1 — phase-selection offers one quiz row ​

User story: As a work item's author, I want one row that says "quiz", so that the checklist names what I will actually be asked to do.

Acceptance criteria (EARS) ​

  1. WHEN the-loop renders the phase-selection checklist for the outer loop THEN the system SHALL show one setting row with the token quiz, ticked by default, and SHALL show no row with the token explainer, explainer-slides or explainer-flashcards.
  2. WHEN an authorized user freezes a selection with the quiz row unticked THEN the system SHALL declare the four quiz nodes skipped under the token quiz, with that user as the declarer, and SHALL say so in the confirmation comment.
  3. WHEN an authorized user freezes a selection with the quiz row ticked THEN the system SHALL walk all four quiz nodes and SHALL say in the confirmation comment that the quizzes are on.
  4. WHEN an operator runs the-loop graph skip <id> --node quiz THEN the system SHALL make the same declaration as criterion 2.
  5. WHEN a reply-borne checklist or a skip command names the token explainer THEN the system SHALL read it as quiz.
  6. WHEN a reply-borne checklist names explainer-slides or explainer-flashcards THEN the system SHALL treat the row as it treats any unknown row and SHALL freeze no experiment.
  7. The system SHALL NOT write the explainerExperiments field into a selection frozen after this change.
  8. The heading, default line, row text, "what this means" text and both confirmation lines of the row SHALL describe quizzes only: the author before code generation, and the author and reviewers before review.

Requirement 2 — the agent nodes write a quiz and no explainer ​

User story: As an operator, I want the agent to spend a node on questions rather than prose nobody reads, so that the quiz is better and the run is shorter.

Acceptance criteria (EARS) ​

  1. The outer loop SHALL keep four quiz nodes in the positions they hold today: an agent node that writes the spec quiz after design-approval, the human node spec-quiz before tasks-breakdown, an agent node that writes the code quiz after security-review, and the human node code-quiz before human-approval.
  2. The two agent nodes SHALL be named for what they write, a quiz, and no node, stage or skip token of the shipped graph SHALL carry the word explainer.
  3. WHEN an agent quiz node is the current node THEN its assignment SHALL name the command /the-loop:quiz, and the system SHALL ship no /the-loop:explain command.
  4. The page template SHALL be templates/quiz.html. It SHALL contain a quiz and its header only: no Background, Intuition or Code section, no explainer tab and no experiment tab. It SHALL stay self-contained, with no network request.
  5. WHEN the agent writes a question THEN its why SHALL explain the concept behind the correct answer and what the tempting wrong option misunderstands, not only which option is correct.
  6. The quiz rules SHALL be the ones in force today: behaviour over trivia, distractors that encode a real misunderstanding, comparable options, balanced answer positions fixed by the author of the quiz, and no leak of the answer before selection.
  7. WHEN the agent writes the spec quiz THEN it SHALL include no code-level detail unless design.md itself goes to that level.
  8. reference/explainer.md SHALL be replaced by a reference holding the quiz rules, the depth ladder, the two-part code quiz and publishing, and nothing about explainer sections, experiments or tabs.

Requirement 3 — the depth ladder sets the question count; micro passes without a quiz ​

User story: As an author of a typo fix, I want no quiz at all, so that a gate does not ask me to attest to an empty page.

Acceptance criteria (EARS) ​

  1. WHEN the agent classifies a quiz THEN it SHALL use the depth ladder by mental-model delta, never by line count: micro 0 questions, standard 3, deep 5. The spec quiz and Part 2 of the code quiz are classified separately.
  2. WHEN a quiz has no questions at all THEN the agent SHALL publish no page and SHALL write the record with depth micro.
  3. WHEN a quiz's record says depth micro THEN the system SHALL post no quiz comment, SHALL NOT wait for a tick at that quiz's human node, and SHALL record the bypass as micro, distinguishable in the event log and in the-loop check from an attested pass and from a declared skip.
  4. IF Part 2 of the code quiz is micro and Part 1 is present THEN the code quiz SHALL still be published with Part 1 only, and the code-quiz gate SHALL work as for any other code quiz.
  5. IF a quiz gate is entered with a micro record, because an authorized user declared the node before it skipped, THEN the gate SHALL post a box that says there is no quiz and SHALL wait for an authorized tick. Criterion 3 does not apply then: the work item is never left at a gate that nothing can answer.

Requirement 4 — the code quiz has two parts on one page ​

User story: As a reviewer who was not there for the spec, I want the spec questions on the same page as the change, so that I review the diff knowing what it is for.

Acceptance criteria (EARS) ​

  1. WHEN the agent writes the code quiz and the spec quiz had one or more questions THEN the page SHALL have Part 1: the spec, holding the spec quiz's questions, and Part 2: the change, holding code-level questions about the diff grounded in the spec.
  2. WHEN the spec files differ from the ones the spec quiz was written from THEN the agent SHALL regenerate Part 1 from the current spec.
  3. WHEN Part 1 is carried over unchanged THEN it SHALL open with the note "Author: you can skip this part if you took the spec quiz before code was generated.", and the page SHALL offer a control that jumps to Part 2.
  4. WHEN Part 1 was regenerated THEN its note SHALL say that the spec changed after the spec quiz and SHALL NOT tell the author to skip it.
  5. IF the spec quiz was skipped, was never offered, or was micro THEN the page SHALL omit Part 1 and its note and SHALL show Part 2 without a part heading.
  6. The author's tick and a reviewer's the-loop quiz-taken reply SHALL each cover the whole page. The system SHALL record no per-part attestation.

Requirement 5 — each quiz is published as its own page, in two places ​

User story: As a reviewer with repository access and no access to the operator's Claude account, I want to open the quiz from the branch, so that I can take it.

Acceptance criteria (EARS) ​

  1. WHEN the agent publishes a quiz THEN it SHALL commit the page to the work item's branch at docs/specs/<id>/quiz/spec-quiz.html or docs/specs/<id>/quiz/code-quiz.html and push it, on every harness.
  2. WHEN the agent has an artifact tool THEN it SHALL also publish the page as its own artifact, titled <id>: spec quiz or <id>: code quiz, one artifact per quiz, and SHALL republish a rewritten quiz to the same URL.
  3. The agent SHALL NOT publish a quiz as a tab of the spec-chain artifact or the spec-chain doc, whatever claudeArtifact and claudeDoc say.
  4. WHEN the agent commits a quiz page THEN it SHALL first run the evidence redaction pass over it (tokens, cookies, personal data, internal hostnames).
  5. WHEN the agent has no artifact tool THEN the committed file SHALL be the only publication, and the node SHALL pass with it.
  6. The records SHALL be evidence/spec-quiz.md and evidence/code-quiz.md. Each SHALL give the depth, the question count, the committed file's location and, when one exists, the artifact's URL. The code quiz record SHALL also say whether Part 1 is present, and whether it was carried over or regenerated.
  7. IF a record names no committed location for a quiz that has questions THEN the agent node SHALL block.
  8. WHEN the system posts a quiz comment THEN it SHALL give the artifact URL when the record has one, and the two existing one-line commands that open the committed file rendered in a local browser. The banner SHALL give the artifact URL when the record has one and the gh command, and stays short: the quiz comment on the same pull request carries both commands.
  9. WHEN the spec files change after the spec quiz's record was committed THEN the agent node SHALL block until the quiz is rewritten and its record committed again, as the spec explainer node does today.

Requirement 6 — the author's checkbox gates as it does today ​

User story: As an operator, I want the attestation gate left alone, so that this change cannot weaken who may answer it.

Acceptance criteria (EARS) ​

  1. WHEN spec-quiz is entered with a quiz that has questions THEN the system SHALL post one quiz comment with one checkbox on the work item, and tasks-breakdown SHALL NOT start until an authorized user ticks it.
  2. WHEN code-quiz is entered with a quiz that has questions THEN the system SHALL post one quiz comment with one checkbox on every delivering pull request (on the work item when there is none), and human-approval SHALL NOT be entered until an authorized user ticks one of them.
  3. The system SHALL read who ticked from the comment's edit history, and SHALL keep the gate waiting for an editor who is not authorized, who cannot be named, or whose history cannot be read. It SHALL record graph.quiz_refused for a refused tick.
  4. WHEN the spec files change after the spec quiz comment was posted THEN spec-quiz SHALL route back with the outcome stale, and a fresh quiz and a fresh comment SHALL follow.
  5. WHERE the ticket system cannot say who edited a comment (Jira) the system SHALL accept an authorized reply that carries the ticked line.
  6. The quiz comment SHALL ask the reader to take the quiz and SHALL NOT mention an explainer.
  7. The system SHALL record that the author attested and who, and SHALL record no score and no answer.

Requirement 7 — a reviewer says they took the code quiz with the-loop quiz-taken ​

User story: As a reviewer, I want one short reply that says I took the quiz, so that the author and the other reviewers can see it without me touching the author's checkbox.

Acceptance criteria (EARS) ​

  1. WHEN a person posts a comment on a delivering pull request that opens with the-loop quiz-taken, alone on its line, and that pull request has a code quiz comment THEN the system SHALL record that this person took the code quiz.
  2. The record SHALL be an event graph.quiz_taken carrying the work item, the node, the person's login and the role reviewer, and SHALL carry no score and no comment text.
  3. The system SHALL take the person's login from the ticket system's own account of who wrote the comment, never from the comment's text.
  4. The system SHALL record the reply whether or not the person is in routing.authorizedUsers.
  5. A the-loop quiz-taken reply SHALL NOT pass, block, re-route or re-open any gate, SHALL NOT tick or count as the author's checkbox, SHALL NOT start, resume or spawn a session, and SHALL NOT be delivered to a session as conversation.
  6. WHEN the same person replies the-loop quiz-taken again THEN the system SHALL keep one record for that person on that pull request.
  7. IF the comment is the-loop's own (it carries the loop-prevention marker) THEN the system SHALL record nothing.
  8. IF the reply arrives on a work item the-loop is running, or on a delivering pull request that has no code quiz comment THEN the system SHALL record nothing and SHALL acknowledge the reply the way it acknowledges any refused keyword. A reply on a thread that is neither is covered by abuse case 8: nothing at all.
  9. WHEN the keyword appears anywhere other than the start of a line of its own, or in a comment that opens lines with two different keywords THEN the system SHALL treat it as the existing keyword parser treats every keyword.
  10. The keyword SHALL be configurable and disableable where the other control keywords are (routing.control.keywords), with the default quiz-taken.

Requirement 8 — the pull request description announces the code quiz and shows who took it ​

User story: As a reviewer opening a pull request, I want the quiz and its status at the top, so that I take it before I read the diff.

Acceptance criteria (EARS) ​

  1. WHEN the code quiz comment is posted on a delivering pull request THEN the system SHALL make that pull request's description carry the banner: a marked block that says to take the code quiz before reviewing, says it is for the author and every reviewer, gives the ways to open it (Requirement 5.8), says how each role records it, and holds the table.
  2. The banner SHALL sit after the description's short version and before its guided tour. The briefing template SHALL carry the banner in that position and SHALL NOT carry the "Start here: the explainer" line.
  3. The table SHALL have one row per person, with the columns Who, Role and Quiz, and the rows SHALL be:
    • the author: the pull request's author until the checkbox is ticked, then the person who ticked it;
    • every person whose review is requested, and every person who has submitted a review;
    • every other person recorded under Requirement 7.
  4. The Quiz cell SHALL say taken for the author once an authorized tick passed the gate, and for a reviewer once Requirement 7 recorded them. Otherwise it SHALL say not yet.
  5. A person who would appear as both author and reviewer SHALL have one row, as author.
  6. WHEN the author's checkbox passes the gate, WHEN a reviewer is recorded under Requirement 7, and WHEN a review is requested, a request is removed or a review is submitted on the pull request THEN the system SHALL bring the table up to date.
  7. WHEN a review request is removed for a person who has neither submitted a review nor been recorded under Requirement 7 THEN the system SHALL remove that person's row.
  8. WHEN the system rewrites the banner THEN it SHALL replace only the text between the banner's two markers and SHALL leave every other byte of the description unchanged.
  9. IF the description holds no banner markers THEN the system SHALL insert the banner without altering any existing text.
  10. WHEN a code quiz is rewritten (a new round) THEN the system SHALL reset every taken in that pull request's table to not yet, because nobody has taken the new quiz.
  11. WHEN the work item declared the quiz nodes skipped, or the code quiz is micro with no page THEN the system SHALL add no banner, and the briefing SHALL carry none.
  12. The table update SHALL work on both ingresses, the webhook and the poller. On the poller it MAY lag by one polling cycle.

Requirement 9 — when the description cannot be edited, the banner moves ​

User story: As a reviewer on a pull request the-loop may not edit, I want the same announcement and table somewhere I will still see them.

Acceptance criteria (EARS) ​

  1. IF the system cannot update a pull request's description, or the description holds malformed banner markers (one without its pair, or more than one pair) THEN the system SHALL leave the description untouched and SHALL keep the table in one marked the-loop comment on that pull request, edited in place.
  2. WHILE the fallback is in use the reviewer briefing SHALL carry the banner text as its first block, pointing at that comment for the table.
  3. The fallback comment SHALL carry the loop-prevention marker, and an edit of it SHALL deliver nothing to a session.
  4. WHEN a description update fails THEN the system SHALL record the failure in the event log and SHALL NOT fail or block the code-quiz gate because of it.

Requirement 10 — work items that started before this change keep working ​

User story: As an operator with work items in flight, I want an upgrade to leave them walkable, so that no item is stranded at a node that no longer exists.

Acceptance criteria (EARS) ​

  1. WHEN a work item's frozen selection declared the token explainer skipped THEN the system SHALL resolve it as quiz skipped, and the-loop check SHALL report the four quiz nodes as skipped by declaration with the original declarer.
  2. WHEN a work item's frozen selection carries explainerExperiments THEN the system SHALL load it without error and SHALL produce no experiment.
  3. WHEN a work item's state names an agent node by its pre-change id, as its current node or in its history THEN the system SHALL resolve it to the node that replaced it, and the work item SHALL continue from there.
  4. WHEN a human quiz gate reads its record and finds only the pre-change record name (evidence/spec-explainer.md, evidence/explainer.md) THEN it SHALL read that record.
  5. A quiz comment posted before this change SHALL stay answerable: an authorized tick on it SHALL pass its gate.
  6. The system SHALL NOT rewrite a committed work-item-state.json, evidence record or spec file of a finished work item to the new names.

Requirement 11 — the documentation and the tests say what the graph does ​

User story: As someone reading the docs, I want them to describe quizzes, so that I am not told about a page that no longer exists.

Acceptance criteria (EARS) ​

  1. The skill, its references and templates, the command list, the README, the documentation site, the capability docs and the string catalog SHALL describe the quiz feature as it works after this change, and SHALL describe no explainer page, slides or flashcards as current behaviour.
  2. Human-facing text the-loop posts SHALL live in the string catalog and text sent to an agent SHALL live in a prompt file (issue-540).
  3. The event reference SHALL document graph.quiz_taken, and the control keyword reference SHALL document quiz-taken, including that it needs no authorization and gates nothing.
  4. The quiz-gates and happy-path end-to-end scenarios, the quiz tests and the selection tests SHALL cover the behaviour above, and the explainer-experiment tests SHALL be removed with the feature.
  5. A durable decision record SHALL say why the explainer page was removed and why a reviewer's reply is recorded without authorization.

Non-functional requirements ​

  • Idempotent table updates. Processing the same event twice, or two events in either order, SHALL leave the same table. The table is rebuilt from recorded state and the pull request's current reviewers, never patched from the event alone.
  • No lost description edits. A banner update SHALL NOT overwrite a description edit a person or the session made a moment earlier. Where the ticket system offers no atomic update, the system SHALL re-read the description immediately before writing, and a lost race SHALL be corrected by the next update.
  • Bounded size. The table SHALL show at most a fixed number of rows for people who were never requested and never reviewed, and SHALL summarise the rest in one line. design.md sets the number.
  • Accessibility. The quiz page SHALL keep the keyboard operation, focus order and contrast the current template passed in issue-488's accessibility check. The jump to Part 2 SHALL be a real link or button.
  • Observability. Every recorded reply, refused reply, banner write and failed banner write SHALL be an event in the event log.
  • Cost. A reviewer's reply SHALL cost no model tokens: the daemon handles it and no session is prompted.
  • Risk tier. The change touches .the-loop/manifest.yaml and the CLI config schema, both fixed sensitive paths, so its effective tier is 4: a named human signs off the security review.

Security considerations ​

Threat-model-lite, captured with the requirements (always required). See reference/security.md.

This change adds attack surface. Until now every control keyword was refused for anyone outside routing.authorizedUsers. the-loop quiz-taken is accepted from anyone who can comment on a delivering pull request, and it makes the-loop write to the pull request description under the operator's credentials.

  • Actors & trust:
    • Authorized users (routing.authorizedUsers): trusted to answer gates. Unchanged.
    • Any commenter on a delivering pull request: untrusted. On a public repository this is any GitHub account. New: they can be recorded as having taken the quiz.
    • Requested reviewers and review authors: untrusted identities supplied by the ticket system. Their logins are shown; nothing they write is.
    • The spec files, the diff and the ticket thread: untrusted text the agent reads while writing questions.
    • The agent session: writes the quiz page that is committed and published.
  • Trust boundaries & data:
    • An untrusted comment crosses into a daemon action (an event, and a description edit). The only data that crosses is the commenter's login, as the ticket system reports it, and the fact of the reply. No comment text crosses.
    • Untrusted spec, diff and ticket text crosses into an HTML page that a reviewer opens in a local browser from the branch. The page is rendered as text by a fixed engine.
    • The description is written with the operator's token. No new secret is stored or moved, and the quiz page must hold none (the redaction pass, Requirement 5.4).
  • Abuse cases (EARS):
    1. WHEN a person who is not an authorized user replies the-loop quiz-taken THEN the system SHALL NOT pass, advance or re-evaluate any gate, and the author's checkbox SHALL remain the only thing that answers code-quiz.
    2. WHEN a person who is not an authorized user ticks the author's checkbox THEN the system SHALL keep the gate waiting and record graph.quiz_refused, as today.
    3. WHEN a the-loop quiz-taken comment carries further text (markdown, HTML, a mention, a table row, a banner marker) THEN the system SHALL write none of that text to the description, the fallback comment, an event field, a prompt or a log line beyond what the existing comment handling already logs.
    4. WHEN many accounts reply the-loop quiz-taken on one pull request THEN the system SHALL keep the table within its bound (Non-functional requirements) and SHALL make at most one description write per recorded reply.
    5. WHEN a comment, a description or a review body contains text shaped like the banner markers or like a quiz comment's marker THEN the system SHALL NOT treat a comment it did not author as its own, and SHALL treat a description with malformed markers per Requirement 9.1 rather than guess which block to replace.
    6. WHEN a login the ticket system reports does not fit the login grammar THEN the system SHALL NOT write it into the description and SHALL record nothing for it.
    7. WHEN the spec, the diff or the ticket contains markup or script, including a literal </script> THEN the committed and published quiz page SHALL render it as text and SHALL execute none of it.
    8. WHEN a the-loop quiz-taken reply is posted on a pull request that is not recorded against any work item THEN the system SHALL record nothing and edit nothing.
    9. WHEN a reply is the-loop's own comment, or a webhook payload names a commenter the ticket system does not confirm THEN the system SHALL record nothing.
  • Fail closed:
    • A reply whose author cannot be named records nothing.
    • A description that cannot be read, or whose markers are malformed, is not written.
    • A pull request that cannot be tied to a work item with a posted code quiz gets no record and no edit.
    • A failed read of the edit history keeps the author's gate waiting, as today.
    • A table that cannot be built from recorded state is left as it was, never emptied.
  • Accepted limitation: taken is self-attested for reviewers exactly as it is for the author. A reviewer can reply without taking the quiz. The table shows who said so, and nothing depends on it.

Out of scope ​

  • Scoring, pass marks, or any reporting of answers.
  • Blocking a reviewer's approval, or human-approval, on a reviewer's quiz.
  • Sharing the operator's artifact with reviewers through Claude. The committed file is how a reviewer opens the quiz.
  • A reviewer flow for the spec quiz. It stays the author's, on the work item.
  • Requested teams as table rows. A team member appears when their own review is requested, when they submit a review, or when they reply.
  • Recording a reply on a pull request after it is merged or closed.
  • The contribution, ad-hoc and review loops, which have no quiz nodes.
  • Migrating the files of finished work items (Requirement 10.6).

Open questions ​

None blocks design. The issue left five points open or silent, and each has a reversible default taken here. Object on the pull request and the file changes.

  1. Names. The issue left node names to the implementer. Requirement 2.2 fixes only that they say "quiz"; design.md picks the ids. The command is /the-loop:quiz, with no /the-loop:explain alias, because an alias would keep the old word alive in the command list.
  2. A regenerated Part 1 does not tell the author to skip it (Requirement 4.4). The issue gives one note for every case. The author never saw regenerated questions, so telling them to skip would be wrong.
  3. Who the author row names (Requirement 8.3). The-loop opens pull requests under the operator's account, so the pull request's author is not always the person who ticks. The row shows the person who ticked once someone has.
  4. A reviewer who has reviewed keeps their row (Requirement 8.3). The ticket system drops a person from the requested list when they submit a review, so "requested reviewers" alone would delete a row at the moment it matters.
  5. A micro code change with spec questions still publishes (Requirement 3.4), so reviewers get Part 1.

Review comments ​

Appended by the-loop's record-feedback hook when a human gate approves with comments (issue-109). Append-only and attributed: an approval never silently discards a reviewer's suggestions, and the feedback travels with the document it concerns rather than living in a side-channel tracker.

Released under the MIT License.