brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
quality-loopUse this workflow recipe when a draft, plan, proposal, or other deliverable should be independently reviewed and revised until it satisfies explicit quality criteria.
Independent GitHub snapshot · Automated classification · Original documentation governs
Turn the user's request into a temporary, request-specific workflow. Preserve the user's subject, constraints, and desired output rather than replacing them with a fixed example.
approved: required booleanfeedback: required array containing only changes that must be madeapproved is true and feedback is
empty. If the fields disagree, the feedback wins.Keep the loop explicit and bounded; the request supplies the actual content and criteria.
review_schema = {
"type": "object",
"properties": {
"approved": {"type": "boolean"},
"feedback": {"type": "array", "items": {"type": "string"}},
},
"required": ["approved", "feedback"],
"additionalProperties": False,
}
draft = await agent(request, instruction="Write the first draft.", tools=[])
previous_feedback = []
for attempt in range(1, 4):
review = await agent(
{
"request": request,
"draft": draft["text"],
"previous_feedback": previous_feedback,
},
instruction=(
"Review against the requested criteria. If the user did not provide "
"factual values such as dates, URLs, or contacts, clear placeholders "
"are acceptable: do not reject solely because they are not concrete "
"and do not ask the writer to invent facts. Check that placeholders "
"are clear and required fields or steps are complete."
),
schema=review_schema,
tools=[],
)
decision = review["structured"]
approved = decision["approved"] and not decision["feedback"]
if approved or attempt == 3 or not decision["feedback"]:
break
previous_feedback = decision["feedback"]
draft = await agent(
{"draft": draft["text"], "feedback": previous_feedback},
instruction="Revise the draft using every required change.",
tools=[],
)
return {
"draft": draft["text"],
"approved": approved,
"reviews": attempt,
"remaining_feedback": decision["feedback"],
}
On the third rejected review, return the latest reviewed draft and feedback; do not create a fourth, unreviewed revision. Adapt the role instructions and inputs to the current request rather than copying this shape as a fixed task.
structured object.