Skip to content

Commit 3e37084

Browse files
committed
feat(agent): enhance harness with milestone extraction, context tree, and self-verification
1 parent ebfb15c commit 3e37084

9 files changed

Lines changed: 402 additions & 322 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request: # runs on every PR
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ['3.10', '3.11', '3.12']
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }} # now this works
19+
- run: pip install -r requirements.txt
20+
- run: pytest

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ __pycache__/
55
*.pyc
66

77
prac.py
8-
**/__pycache__/
8+
**/__pycache__/
9+
sandbox/

‎agents/branch_agent.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
from dotenv import load_dotenv
55
load_dotenv()
66
llm= ChatGroq(
7-
model="qwen/qwen3-32b",
7+
model="llama-3.3-70b-versatile",
88
temperature=0.2,
99

10-
reasoning_format="parsed",
1110
timeout=None,
1211
max_retries=2,
1312
)
@@ -18,7 +17,7 @@
1817
only return one of these ["analyzer","builder"]
1918
"""
2019
query=input("enter...")
21-
chat=llm.with_structured_output(Branch)
20+
chat=llm.with_structured_output(Branch, method="json_mode")
2221
response=chat.invoke(
2322
[
2423
SystemMessage(content=SYSTEM_PROMPT),

‎agents/code_planner.py‎

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,48 @@
2727
)
2828
planner_agent = create_agent(
2929
model=model,
30-
tools=[ask_user,search_web,preview_changes,run_tests,git_diff,run_command,search_in_files,find_files,list_dir,delete_file,edit_file,overwrite_file,create_file,read_file],
30+
tools=[search_web, ask_user, search_in_files, find_files, list_dir, read_file],
3131
system_prompt="""
32-
You are an expert software architect and planner.
32+
You are a Principal Software Architect and Technical Planner.
3333
34-
Your job is to analyze the user's request and create a clear, beautiful implementation plan. Do NOT write code.
34+
Your objective is to analyze the user's project request and design a concise, robust, milestone-driven implementation plan.
35+
Do NOT write application code yourself. Focus on architecture, technology choices, dependencies, and clean separation of concerns.
36+
37+
# Planning Principles (CRITICAL FOR SUCCESS)
38+
39+
1. Cohesive Milestones over Fragmentation:
40+
- Group work into cohesive, logical milestones:
41+
* Simple apps (Tic-Tac-Toe, Todo, Calculator, widgets): 2 to 3 milestones.
42+
* Medium projects (CLI tools, small fullstack/CRUD apps): 3 to 4 milestones.
43+
* Large projects (multi-service, fullstack with Auth/DB/API): 4 to 6 milestones maximum.
44+
- Example structure for milestones:
45+
* Milestone 1: Project Setup & Dependencies (scaffold, configuration, exact dependencies)
46+
* Milestone 2: Core Architecture, Data Models & Components (state management, components, layout)
47+
* Milestone 3: Styling, Interactivity & Polish (styles, animations, edge-case UX)
48+
* Milestone 4: Verification & Build (run build command, lint/typecheck, confirm zero compilation errors)
49+
- NEVER create separate milestones for single files, single shell commands, or minor edits.
50+
51+
2. Explicit Scaffolding & Non-Interactive Commands:
52+
- Always specify exact, NON-INTERACTIVE terminal commands. The coding agent cannot respond to interactive prompts.
53+
- For Vite React: `npm create vite@latest . -- --template react` or `npx create-vite . --template react-ts`
54+
- Explicitly list every runtime dependency that must be installed: e.g. `npm install react react-dom lucide-react`
55+
- Warn the coder NEVER to launch blocking dev servers (e.g. `npm run dev`, `npm start`).
56+
57+
3. Working Directory Discipline:
58+
- Scaffolding should initialize directly inside the target directory (e.g. `create vite@latest .`), NOT create nested subdirectories unless explicitly requested.
59+
- Explicitly define the entry points: `index.html` -> `src/main.jsx` -> `src/App.jsx`.
3560
3661
# Formatting Rules
37-
You MUST format your output in rich Markdown so it is easy to read in a terminal:
38-
- Use `#` and `##` for section headers.
39-
- Use bullet points (`*` or `-`) for lists.
40-
- Use **bold text** to highlight important terms, file names, or module names.
41-
- Use `inline code formatting` for any variable names, paths, or shell commands.
42-
43-
# Task Breakdown
44-
Break the project into small, ordered tasks that can be implemented one at a time. For each task, create a clean subsection specifying:
45-
* **Objective:** What this task achieves.
46-
* **Files Affected:** Files/modules likely to be created or modified.
47-
* **Dependencies:** What must be done before this.
48-
* **Implementation Notes:** Brief, high-level guidelines.
49-
50-
Keep tasks independent and concise so a coding agent can execute them sequentially. Focus on architecture, data flow, APIs, edge cases, and project structure.
51-
52-
# Modern Web Development & Research
53-
The frontend ecosystem (Tailwind CSS, Next.js, Vite, React) evolves extremely fast. Do NOT rely purely on your internal knowledge for modern libraries, as you may hallucinate outdated configurations (e.g., confusing Tailwind v3 vs v4).
54-
**If a task involves configuring or debugging modern web tools, YOU MUST use the `search_web` tool or explicitly instruct the Coder Agent to research the official documentation first.**
55-
56-
Output ONLY the beautifully formatted Markdown plan.
62+
Format your plan in clean, readable Markdown:
63+
- Use `#` for the Plan Title, `##` for each Milestone (e.g., `## Task 1: Project Setup & Dependencies`).
64+
- Under each Milestone, clearly specify:
65+
* **Objective:** Clear description of the milestone goals.
66+
* **Exact Commands / Dependencies:** Exact CLI commands to run (non-interactive).
67+
* **Files Affected:** Specific file paths to create or modify.
68+
* **Key Architecture & Interfaces:** Component props, state variables, contracts.
69+
* **Verification Criteria:** How the coder should verify this milestone before proceeding.
70+
71+
Output ONLY the structured Markdown plan.
5772
"""
5873
)
5974

0 commit comments

Comments
 (0)