---
library: "bootstrap"
slug: "SocraticLoop"
name: "SocraticLoop"
ref: "SocraticLoop#ffaa"
hash: "sema:SocraticLoop#mh:SHA-256:ffaac4d5ca573af32ba28028ed642e7aec6b54a3a2e197e50e336cee6c2aaa3c"
type: "Reasoning"
layer: "Mind"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/SocraticLoop"
---

# SocraticLoop

Clarification before generation

Mind · Reasoning

## Mechanism

Ambiguity detection loop. If Confidence([Prompt](https://semahash.org/vocabularies/bootstrap/patterns/Prompt.md)) < Threshold, [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) pauses execution to query the user. [Loop](https://semahash.org/vocabularies/bootstrap/patterns/Loop.md) continues until intent is disambiguated or max_questions reached. It engages the user in a [Dialectic](https://semahash.org/vocabularies/bootstrap/patterns/Dialectic.md) exchange to progressively narrow the ambiguity space.

## Invariants

- Each question names the specific ambiguity it is asked to resolve.
- The [Loop](https://semahash.org/vocabularies/bootstrap/patterns/Loop.md) halts when confidence exceeds `ambiguity_threshold` or questions reach `max_questions`, and which one ended it is recorded.

## Parameters

- ambiguity_threshold: type=Float, range=[0.0, 1.0], description=Confidence below which the agent asks a clarifying question instead of acting
- max_questions: type=Integer, range=[1, 3], description=Maximum clarification questions before the agent must proceed

## Preconditions

- Ambiguity detected
- User prompt received

## Postconditions

- Either intent is disambiguated, or the bound was reached and the remaining ambiguities are stated with the best-guess fallback

## Failure modes

- Premature stop: a vague answer is accepted and the ambiguity treated as resolved.
- Budget spent without resolution: `max_questions` reached having clarified nothing.
- Clarification the user cannot give: the question is well-aimed and unanswerable.

## Where this came from

—

## Builds on

- [Prompt](https://semahash.org/vocabularies/bootstrap/patterns/Prompt.md) (references)
- [Loop](https://semahash.org/vocabularies/bootstrap/patterns/Loop.md) (references)
- [Dialectic](https://semahash.org/vocabularies/bootstrap/patterns/Dialectic.md) (references)
- [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) (references)

## Used by

- [PolymorphicSolver](https://semahash.org/vocabularies/bootstrap/patterns/PolymorphicSolver.md) (composes_with)
- [RigorousSolver](https://semahash.org/vocabularies/bootstrap/patterns/RigorousSolver.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: SocraticLoop#ffaa
- Hash: sema:SocraticLoop#mh:SHA-256:ffaac4d5ca573af32ba28028ed642e7aec6b54a3a2e197e50e336cee6c2aaa3c

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/SocraticLoop
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/SocraticLoop.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
