Skip to content

feat: add Claude native grilling adapter - #10

Merged
kossoy merged 1 commit into
mainfrom
issue-2-claude-adapter
Aug 31, 2026
Merged

kossoy merged 1 commit into
mainfrom
issue-2-claude-adapter

Conversation

@kossoy

@kossoy kossoy commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • serialize immutable frontier chunks to the exact Claude Code AskUserQuestion schema and four-question limit
  • support explicit single-select and multi-select questions while preserving comma-separated answers, custom Other text, free-form response text, and annotation notes
  • keep shared-understanding confirmation separate from ExitPlanMode plan approval
  • provide truthful text fallback when AskUserQuestion is absent or denied, including mid-snapshot denial guidance
  • generate a linked grill-me and grilling Claude bundle with retained upstream MIT attribution
  • enforce Claude runtime invocation visibility: disable-model-invocation: true on the user-only wrapper and user-invocable: false on the model-only primitive
  • add deterministic generation, Claude-specific validation, and adapter/generation fixtures

Verification

  • ./scripts/verify-outcome.sh — 38 tests passed
  • python3 -m unittest tests.test_claude_adapter tests.test_claude_generation -v — 16 Claude tests passed
  • python3 scripts/generate_claude_skills.py --check — passed
  • python3 scripts/validate_claude_skills.py harnesses/claude — passed
  • python3 -m compileall -q dev_workflow scripts tests — passed
  • git diff --check — passed

The Codex skill-creator quick validator is intentionally not a Claude gate: it rejects the Claude Code-only disable-model-invocation and user-invocable keys. The Claude-specific validator requires those runtime keys so validation cannot weaken actual harness behavior.

Scope

Claude Code adapter only. Shared contract and Codex paths are unchanged. No installation, delivery, or runtime mutation.

Closes #2


Note

Low Risk
New Claude-only module and generated artifacts; shared grilling contract and Codex paths are untouched, with heavy test coverage around serialization and bundle checks.

Overview
Adds a Claude Code–only path that maps the shared grilling interview contract onto AskUserQuestion, without changing the canonical grilling model or existing Codex harness.

dev_workflow/claude.py introduces capability detection (native vs text fallback), four-question chunking, strict payload validation for the native schema, response normalization (multi-select, Other/free-form, annotations), explicit fallback copy when the tool is missing or denied, and a shared-understanding confirmation flow that is separate from plan execution approval.

dev_workflow/generated_claude.py plus harnesses/claude/ ship a linked grill-me (user-only, disable-model-invocation) and grilling (model-only, user-invocable: false) bundle with upstream MIT attribution in bundle.json. scripts/generate_claude_skills.py and scripts/validate_claude_skills.py keep the bundle byte-deterministic and enforce Claude-specific frontmatter that generic validators would reject.

Unit tests cover adapter behavior and generation/validation gates.

Reviewed by Cursor Bugbot for commit a08a597. Bugbot is set up for automated code reviews on this repo. Configure here.

Greptile Summary

Adds a Claude Code grilling adapter and a deterministic paired skill bundle for native interview flows.

A reproduced failure remains: when a user selects a predefined option and supplies annotation notes, the adapter stores the combined text as a custom answer instead of retaining the selected option identity. This affects downstream logic that distinguishes known decisions from custom responses.

Checks disproved concerns that single-question Other responses lose free-form text or notes, ambiguous multi-question free-form responses are accepted, partial snapshot commits expose dependent decisions, or the generated bundle is stale, invalid, or nondeterministic. The focused Claude adapter and generation tests completed successfully.

Confidence Score: 4/5

Not ready to merge until annotated selected options retain their known-option identity when committed.

The affected behavior was reproduced through the public normalization and snapshot-commit flow with captured execution output. The remaining exercised response-handling, snapshot atomicity, bundle validation, and deterministic generation behaviors completed as expected.

Files Needing Attention: dev_workflow/claude.py and dev_workflow/grilling.py need coordinated handling of annotation text and known-option matching.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for a posted P1 finding and attached a set of artifacts showing runtime checks, bundle generation checks, unit tests, and end-to-end review outputs.
  • T-Rex produced a second proof for another posted P1 finding, with no artifacts uploaded for this proof.
  • T-Rex performed general contract validation, confirming how the Claude adapter handles annotation text, ensuring bundle and validator behavior align with expectations, and disproving several ambiguous or partial-snapshot scenarios with no blocked constraints.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Annotated selected answers are committed as custom choices

    • Bug
      • When Claude returns a recognized selected option together with annotation notes, normalization appends the note to the answer string. DesignTree.commit_snapshot compares the entire decorated string against option labels, so it records the selected answer as a custom answer rather than the chosen option.
    • Cause
      • normalize_native_response preserves annotations by concatenating them into the canonical string at line 225, but commit_snapshot only recognizes an exact option label after removing the recommendation suffix.
    • Fix
      • Preserve selected option identity separately from annotation text (for example, return structured normalized answers), or make commit_snapshot recognize and separate the annotation suffix before option matching while retaining the note.

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
dev_workflow/claude.py:225
**Annotation notes turn selected options into custom answers**

When Claude returns a recognized option together with annotation notes, normalization appends the notes to the answer string. `DesignTree.commit_snapshot` then compares that decorated value to the option labels and marks it `custom=True`, so downstream interview logic loses the fact that the user chose a defined option. Preserve the option identity separately from annotation text, or strip and retain the annotation before known-option matching.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat: add Claude native grilling adapter" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Comment thread dev_workflow/claude.py
)
elif freeform and len(questions) == 1:
answer = _append_distinct(answer, freeform)
answer = _append_distinct(answer, notes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Annotation notes turn selected options into custom answers

When Claude returns a recognized option together with annotation notes, normalization appends the notes to the answer string. DesignTree.commit_snapshot then compares that decorated value to the option labels and marks it custom=True, so downstream interview logic loses the fact that the user chose a defined option. Preserve the option identity separately from annotation text, or strip and retain the annotation before known-option matching.

Artifacts

Review-authored Claude adapter runtime check source

  • Python source that exercises Other/free-form preservation, ambiguity rejection, annotation handling, and atomic snapshot commits; it is the exact executed review check.

Claude adapter runtime check output

  • Captured output from the adapter review check showing preserved Other text, ambiguity rejection, the annotated-selection custom classification, and rejected partial commit; it demonstrates the P1 defect and the passing atomicity behavior.

Review-authored Claude bundle generation check source

  • Python source that runs freshness and validator commands then compares two generated bundles byte-for-byte; it is the exact executed review check.

Claude bundle generation and validator output

  • Captured output showing the committed bundle is current, the Claude validator passes, and two generated bundles are byte-identical; it disproves the bundle hypotheses.

Claude PR unit-test output

  • Captured output for the focused Claude adapter and generation test modules, with 16 tests passing; it confirms the focused suite executed successfully.

Base revision Claude feature inventory

  • Captured base-revision tree query showing no Claude adapter or Claude generated-bundle paths existed at the compared base; it establishes the before condition.

New Claude implementation end-to-end review output

  • Captured combined execution of the review-authored adapter and bundle checks against the PR revision; it shows the after behavior and the identified classification defect.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: dev_workflow/claude.py
Line: 225

Comment:
**Annotation notes turn selected options into custom answers**

When Claude returns a recognized option together with annotation notes, normalization appends the notes to the answer string. `DesignTree.commit_snapshot` then compares that decorated value to the option labels and marks it `custom=True`, so downstream interview logic loses the fact that the user chose a defined option. Preserve the option identity separately from annotation text, or strip and retain the annotation before known-option matching.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a08a597. Configure here.

Comment thread dev_workflow/claude.py
def _append_distinct(value: str, addition: str | None) -> str:
if addition is None or addition == value or addition in value:
return value
return f"{value} — {addition}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substring check drops user notes

Medium Severity

_append_distinct treats a note or free-form response as already present when it is only a substring of the selected answer, so normalize_native_response drops that user-authored text instead of appending it.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a08a597. Configure here.

Comment thread dev_workflow/claude.py
)
elif freeform and len(questions) == 1:
answer = _append_distinct(answer, freeform)
answer = _append_distinct(answer, notes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-select keeps Other sentinel

Medium Severity

normalize_native_response recognizes Other only when the entire answer is a sentinel, so a comma-separated multi-select value that includes Other keeps the sentinel and never substitutes the custom response or notes for that choice.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a08a597. Configure here.

Comment thread dev_workflow/claude.py
return ConfirmationResult(ConfirmationDisposition.CONFIRMED)
if canonical == "Reopen":
return ConfirmationResult(ConfirmationDisposition.REOPEN)
return ConfirmationResult(ConfirmationDisposition.EXTEND, concern=answer)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes block interview confirmation

Medium Severity

resolve_confirmation accepts only an exact Confirmed label after stripping a recommended suffix, so a confirmation that normalize_native_response enriched with annotation notes or free-form text is treated as EXTEND and the interview does not finish.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a08a597. Configure here.

@kossoy
kossoy merged commit 2aab838 into main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the Claude Code native questionnaire adapter

1 participant