Lint Feedback Loop
chimera.core.loops.lint_feedback runs a linter after each agent turn and
feeds any errors back as context for the agent to fix. Inspired by Aider’s
lint-and-fix workflow where lint_edited feeds errors back as a
reflected_message.
Key Classes
Section titled “Key Classes”| Class | Description |
|---|---|
LintFeedbackLoop | Wraps an inner loop with post-turn linting and iterative fixing |
Quick Start
Section titled “Quick Start”from chimera.core.loops.lint_feedback import LintFeedbackLoop
loop = LintFeedbackLoop( linter="ruff", lint_args=["check", "--no-fix"], max_lint_rounds=3,)
result = loop.run(provider, tools, context, env)print(f"Lint rounds: {len(loop.lint_history)}")How It Works
Section titled “How It Works”- The inner loop runs the original task to completion.
- The configured linter runs on the workspace.
- If lint errors are found, the agent gets a new context with the errors and instructions to fix them without changing functionality.
- Steps 2-3 repeat up to
max_lint_roundstimes or until the linter reports no errors.
Custom Linter
Section titled “Custom Linter”Any linter that writes errors to stdout/stderr works:
# Use flake8 instead of ruffloop = LintFeedbackLoop(linter="flake8", lint_args=["--max-line-length=100"])
# Use eslint for JavaScript projectsloop = LintFeedbackLoop(linter="eslint", lint_args=["src/"])Inspecting Lint History
Section titled “Inspecting Lint History”After run() completes, lint_history contains the raw output from
each lint round:
for i, output in enumerate(loop.lint_history): if output.strip(): print(f"Round {i+1}: {len(output.splitlines())} lines of errors") else: print(f"Round {i+1}: clean")Import Reference
Section titled “Import Reference”from chimera.core.loops.lint_feedback import LintFeedbackLoopRelated
Section titled “Related”- Loops — overview of all loop types
- Retry Loop — retry wrapper with scoring
- Plan/Act Loop — two-phase plan then execute