feat(ai-autopilot): the loop (#113)#118
Merged
Merged
Conversation
The agent declares a semantic LoopEvent (a change kind) and the matching prompt chain fires: major-change runs review + code-quality + security, ui-flow runs QA + UX. Loop.handle(event) resolves the chain from LoopRules (defineRule / defaultLoopRules as the built-in policy) and runs each LoopPrompt (definePrompt) for its passes with fresh context every pass; matches() is the pure preview, watch(stream) handles a stream fire-and-report. Design calls on the open questions: the trigger is agent-declared, not a heuristic; both modes ship (handle awaits; continueOnError:false is a blocking gate). Consults the decisions ledger via ctx.ledger; references the prompts library (#111) by id. Child #113 of the AI-framework epic (#110).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #113. Child of the AI-framework epic #110; builds on the decisions ledger (#117).
What
The event-to-prompt-chain policy, the web-app orchestration layer generic harnesses lack. The agent declares a semantic change and the right prompts fire:
defineRuleyour ownkind => [prompt ids]Loop.handle(event)resolves the chain from the rules and runs it;matches(event)is the pure preview;watch(stream)handles a stream fire-and-report.defaultLoopRules()is the built-in policy as data. Prompts (definePrompt) run for theirpasseswith fresh context every pass (Rom's finding), and each gets the decisions ledger onctx.ledger.Design calls (the issue's two open questions)
LoopEvent { kind }the worker emits. Deterministic, and the agent is what knows intent. A classifier (supervisor-event => LoopEvent) can sit in front later.handle()awaits the chain;continueOnError: falsemakes it a blocking gate (a failing prompt stops the chain). Fire-and-report viawatch(stream)orlaunchAutopilot. (v1 gates on execution failure; gating on a review's verdict waits for prompts to return one, Built-in prompts library (review, quality, security, refactor, UX, QA, knowledge base) #111.)The prompt bodies are #111, registered under the ids
defaultLoopRules()references. This wires cleanly to #116 (bootstrap's full-fledged loop reuses the fresh-context passes).Verification
major-changeevent fires review (2 fresh passes) => code-quality => security in order,ui-flowfires qa => ux, an unrelated event matches nothing, and every prompt sees the ledger.