This repository contains a production-minded v1 for a UI/UX-focused coding agent built on LangChain. The current implementation is intentionally minimal but functional, with emphasis on safe repo editing.
The agent executes a bounded, iterative loop:
- Task analysis
- Repository inspection
- Code search
- Implementation planning
- Code editing
- Lint/test validation
- One optional revision if validation fails
- Final structured report
The final report includes an explicit execution_status field:
dry_run: proposed changes only; no files were written.applied: changes were written and remain persisted.rolled_back: changes were attempted but reverted after validation failure.no_changes: no changes were proposed or applied.
The report distinguishes attempted_changes from persisted_changes to avoid ambiguity.
- Dry-run mode that never writes files and returns proposed diffs only.
- Automatic rollback if validation fails after the final attempt.
- Canonical, repo-relative path normalization to avoid duplicate references.
- Prompt budgets for repo tree, search results, and file context.
- Structured task analysis and implementation plan
- Repo inspection and basic code search
- Safe, bounded file editing (full-file replacement, no AST rewriting)
- Optional lint/test execution
- Optional accessibility and preview validation hooks (command-based)
- UI/UX specialization with explicit design criteria
- Design guidance ingestion from repo files
- Frontend evaluation scaffolding (tasks and rubric)
- Single specialization (frontend UI/UX only)
- One revision max
- No advanced memory, retrieval index, or graph orchestration
- Preview hook is command-only; screenshot capture is not implemented yet
- Full-file replacement edits (no fine-grained patching)
Set environment variables to control the provider and runtime:
CODING_AGENT_LLM_PROVIDER(default:openai)CODING_AGENT_MODEL(required for OpenAI provider)CODING_AGENT_TEMPERATURE(default:0.2)CODING_AGENT_MAX_TOKENS(optional)CODING_AGENT_OPENAI_API_KEY(optional, can also useOPENAI_API_KEY)CODING_AGENT_OPENAI_BASE_URL(optional)CODING_AGENT_OPENAI_ORG(optional)CODING_AGENT_OPENAI_PROJECT(optional)CODING_AGENT_LINT_CMD(optional, e.g.npm run lint)CODING_AGENT_TEST_CMD(optional, e.g.npm test)CODING_AGENT_ACCESSIBILITY_CMDorCODING_AGENT_A11Y_CMD(optional, e.g.npm run a11y)CODING_AGENT_PREVIEW_CMD(optional, e.g.npm run preview:check)CODING_AGENT_PREVIEW_MODE(optional,commandorscreenshot, default:command)
The openai provider uses the OpenAI Responses API via the openai Python SDK and requires CODING_AGENT_MODEL plus an API key.
If you want to run without an API key, set CODING_AGENT_LLM_PROVIDER=mock to use a safe, deterministic mock model that never calls external APIs.
Repo scanning controls:
CODING_AGENT_REPO_MAX_DEPTH(default:3)CODING_AGENT_REPO_MAX_FILES(default:500)CODING_AGENT_SEARCH_MAX_RESULTS(default:50)CODING_AGENT_EDIT_MAX_FILES(default:6)CODING_AGENT_MAX_ITERATIONS(default:2)
Prompt budget controls:
CODING_AGENT_MAX_FILE_CONTEXT_CHARS_PER_FILE(default:6000)CODING_AGENT_MAX_TOTAL_FILE_CONTEXT_CHARS(default:18000)CODING_AGENT_MAX_REPO_TREE_CHARS(default:8000)CODING_AGENT_MAX_SEARCH_RESULT_CHARS(default:6000)
Use --dry-run to avoid any file writes. The agent will return diffs based on proposed edits without modifying the repository. Validation is skipped in dry-run mode.
If validation fails after the final attempt, the agent restores original file contents for all modified files. New files created during the run are deleted. The report will indicate execution_status = rolled_back and persisted_changes will be empty unless rollback fails.
attempted_changesare the diffs the agent tried to apply during the run.persisted_changesreflect the final repository state after rollback, if any.
Validation runs can include:
- Lint (
CODING_AGENT_LINT_CMD) - Tests (
CODING_AGENT_TEST_CMD) - Accessibility checks (
CODING_AGENT_ACCESSIBILITY_CMDorCODING_AGENT_A11Y_CMD) - Preview/UI inspection (
CODING_AGENT_PREVIEW_CMD)
Preview mode defaults to command. screenshot mode is defined but currently returns unsupported until a screenshot implementation is added.
Test coverage focuses on core execution safety and reporting semantics:
- AgentLoop execution statuses (
dry_run,applied,rolled_back,no_changes) - Rollback restores existing files and deletes newly created files
- Settings validation for invalid budgets and limits
- Path normalization and search deduplication
- Structured output content extraction
- Structured output retry behavior
- Prompt budget truncation markers
- Partial rollback failure semantics
pip install -e .[dev]
pytestIf present at the repository root, these files are loaded into context:
design_principles.mdux_checklist.mdcomponent_guidelines.md
export CODING_AGENT_LLM_PROVIDER=openai
export CODING_AGENT_MODEL=gpt-4o-mini
export CODING_AGENT_OPENAI_API_KEY=... # or use OPENAI_API_KEY
coding-agent --task "Improve the settings page layout" --repo /path/to/repo
coding-agent --task "Improve the settings page layout" --repo /path/to/repo --dry-runSome components remain stubs and raise NotImplementedError, including the evaluation harness. These are clearly labeled in code and ready for incremental implementation.