Skip to content

Decide external-model degrade strategy for constrained decoding (#10) - #16

Merged
vbergeron merged 1 commit into
mainfrom
claude/issue-10-qae127
Sep 4, 2026
Merged

vbergeron merged 1 commit into
mainfrom
claude/issue-10-qae127

Conversation

@vbergeron

Copy link
Copy Markdown
Owner

Adds docs/adr/0001-external-model-decoding-strategy.md, the written decision
issue #10 asked for.

Per call site:

  • Gate.label/1 (closed 3-word vocabulary) -> Option B: provider structured
    output / tool-use enum. A real guarantee, not best-effort, so no new
    degraded tier is needed there; falls back to classify_lexically/1 exactly
    as the local path does today.
  • Turn.extract/4 and Turn.query/4 (open-ended Prolog) -> Option A: strong
    system prompt + bounded validate-and-retry against the existing Clause
    parser (split/1, rejection/1). No provider primitive can constrain
    arbitrary Prolog, so this is the new "best-effort external,
    retry-validated" tier the issue anticipated.

Also decides where the retry loop lives (Turn/Gate, behind a new
Model.constrained?/0 capability query — not inside Model or a backend
module, keeping the #9 seam free of Prolog-specific logic), how the
weakened guarantee is surfaced (a syntax_guaranteed handshake field and a
new prolog_retry_exhausted error code, both additive per PROTOCOL.md's own
versioning rule), and what happens to the unqualified GBNF-guarantee claims
in README.md and Manifold.Clause's moduledoc.

No code changes: this is the design decision itself. Implementation is
follow-up work, as #10 specifies. README gets a one-paragraph pointer to the
ADR under "Status / next steps" so it's discoverable.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01J2hHjE9kH28XhE5Ksj7YES

Adds docs/adr/0001-external-model-decoding-strategy.md, the written decision
issue #10 asked for.

Per call site:
- Gate.label/1 (closed 3-word vocabulary) -> Option B: provider structured
  output / tool-use enum. A real guarantee, not best-effort, so no new
  degraded tier is needed there; falls back to classify_lexically/1 exactly
  as the local path does today.
- Turn.extract/4 and Turn.query/4 (open-ended Prolog) -> Option A: strong
  system prompt + bounded validate-and-retry against the existing Clause
  parser (split/1, rejection/1). No provider primitive can constrain
  arbitrary Prolog, so this is the new "best-effort external,
  retry-validated" tier the issue anticipated.

Also decides where the retry loop lives (Turn/Gate, behind a new
Model.constrained?/0 capability query — not inside Model or a backend
module, keeping the #9 seam free of Prolog-specific logic), how the
weakened guarantee is surfaced (a `syntax_guaranteed` handshake field and a
new `prolog_retry_exhausted` error code, both additive per PROTOCOL.md's own
versioning rule), and what happens to the unqualified GBNF-guarantee claims
in README.md and Manifold.Clause's moduledoc.

No code changes: this is the design decision itself. Implementation is
follow-up work, as #10 specifies. README gets a one-paragraph pointer to the
ADR under "Status / next steps" so it's discoverable.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J2hHjE9kH28XhE5Ksj7YES
@vbergeron
vbergeron merged commit f01d706 into main Sep 4, 2026
1 check 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.

2 participants