harness-evolver 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ description: |
4
4
  Use this agent to analyze harness architecture and recommend optimal multi-agent topology.
5
5
  Reads code analysis signals, traces, and scores to produce a migration plan.
6
6
  tools: Read, Write, Bash, Grep, Glob
7
+ color: blue
7
8
  ---
8
9
 
9
10
  ## Bootstrap
@@ -4,6 +4,7 @@ description: |
4
4
  Use this agent to assess eval quality, detect eval gaming, and propose stricter evaluation.
5
5
  Triggered when scores converge suspiciously fast or on user request.
6
6
  tools: Read, Write, Bash, Grep, Glob
7
+ color: red
7
8
  ---
8
9
 
9
10
  ## Bootstrap
@@ -4,6 +4,7 @@ description: |
4
4
  Use this agent when the evolve skill needs to propose a new harness candidate.
5
5
  Navigates the .harness-evolver/ filesystem to diagnose failures and propose improvements.
6
6
  tools: Read, Write, Edit, Bash, Glob, Grep
7
+ color: green
7
8
  permissionMode: acceptEdits
8
9
  ---
9
10
 
@@ -12,6 +13,24 @@ permissionMode: acceptEdits
12
13
  If your prompt contains a `<files_to_read>` block, you MUST use the Read tool to load
13
14
  every file listed there before performing any other actions. These files are your context.
14
15
 
16
+ ## Context7 — Enrich Your Knowledge
17
+
18
+ You have access to Context7 MCP tools (`resolve-library-id` and `get-library-docs`) for looking up **current, version-specific documentation** of any library.
19
+
20
+ **USE CONTEXT7 PROACTIVELY whenever you:**
21
+ - Are about to write code that uses a library API (LangGraph, LangChain, OpenAI, etc.)
22
+ - Are unsure about the correct method signature, parameters, or patterns
23
+ - Want to check if a better approach exists in the latest version
24
+ - See an error in traces that might be caused by using a deprecated API
25
+
26
+ **How to use:**
27
+ 1. `resolve-library-id` with the library name (e.g., "langchain", "langgraph")
28
+ 2. `get-library-docs` with a specific query (e.g., "StateGraph conditional edges", "ChatGoogleGenerativeAI streaming")
29
+
30
+ **Do NOT skip this.** Your training data may be outdated. Context7 gives you the current docs. Even if you're confident about an API, a quick check takes seconds and prevents proposing deprecated patterns.
31
+
32
+ If Context7 is not available, proceed with model knowledge but note in `proposal.md`: "API not verified against current docs."
33
+
15
34
  ## Return Protocol
16
35
 
17
36
  When done, end your response with:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-evolver",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Meta-Harness-style autonomous harness optimization for Claude Code",
5
5
  "author": "Raphael Valdetaro",
6
6
  "license": "MIT",
@@ -34,39 +34,19 @@ For each iteration:
34
34
  python3 -c "import json; s=json.load(open('.harness-evolver/summary.json')); print(f'v{s[\"iterations\"]+1:03d}')"
35
35
  ```
36
36
 
37
- ### 1.5. Gather Diagnostic Context (LangSmith + Context7)
37
+ ### 1.5. Gather LangSmith Traces (MANDATORY after every evaluation)
38
38
 
39
- **This step is MANDATORY before every propose.** The orchestrator gathers data so the proposer receives it as files.
39
+ **Run these commands unconditionally after EVERY evaluation** (including baseline). If langsmith-cli is not installed or there are no runs, the commands fail silently that's fine. But you MUST attempt them.
40
40
 
41
- **LangSmith (if enabled):**
42
-
43
- Check if LangSmith is enabled and langsmith-cli is available:
44
41
  ```bash
45
- cat .harness-evolver/config.json | python3 -c "import sys,json; print(json.load(sys.stdin).get('eval',{}).get('langsmith',{}).get('enabled',False))"
46
- which langsmith-cli 2>/dev/null
47
- ```
42
+ langsmith-cli --json runs list --project harness-evolver-{last_evaluated_version} --failed --fields id,name,error,inputs --limit 10 > .harness-evolver/langsmith_diagnosis.json 2>/dev/null || echo "[]" > .harness-evolver/langsmith_diagnosis.json
48
43
 
49
- If BOTH are true AND at least one iteration has run, gather LangSmith data:
50
- ```bash
51
- langsmith-cli --json runs list --project harness-evolver-{best_version} --failed --fields id,name,error,inputs --limit 10 > .harness-evolver/langsmith_diagnosis.json 2>/dev/null || echo "[]" > .harness-evolver/langsmith_diagnosis.json
52
-
53
- langsmith-cli --json runs stats --project harness-evolver-{best_version} > .harness-evolver/langsmith_stats.json 2>/dev/null || echo "{}" > .harness-evolver/langsmith_stats.json
54
- ```
55
-
56
- **Context7 (if available):**
57
-
58
- Check `config.json` field `stack.detected`. For each detected library, use the Context7 MCP tools to fetch relevant documentation:
59
-
60
- ```
61
- For each library in stack.detected:
62
- 1. resolve-library-id with the context7_id
63
- 2. get-library-docs with a query relevant to the current failure modes
64
- 3. Save output to .harness-evolver/context7_docs.md (append each library's docs)
44
+ langsmith-cli --json runs stats --project harness-evolver-{last_evaluated_version} > .harness-evolver/langsmith_stats.json 2>/dev/null || echo "{}" > .harness-evolver/langsmith_stats.json
65
45
  ```
66
46
 
67
- This runs ONCE per iteration, not per library. Focus on the library most relevant to the current failures.
47
+ For the first iteration, use `baseline` as the version. For subsequent iterations, use the latest evaluated version.
68
48
 
69
- If Context7 MCP is not available, skip silently.
49
+ These files are included in the proposer's `<files_to_read>` so it has real trace data for diagnosis.
70
50
 
71
51
  ### 2. Propose
72
52
 
package/tools/init.py CHANGED
@@ -298,10 +298,26 @@ def main():
298
298
  print(" Recommendation: install langsmith-cli for rich trace analysis:")
299
299
  print(" uv tool install langsmith-cli && langsmith-cli auth login")
300
300
 
301
- # Detect stack
302
- stack = _detect_stack(args.harness)
301
+ # Detect stack — try original harness first, then baseline copy, then scan entire source dir
302
+ stack = _detect_stack(os.path.abspath(args.harness))
303
+ if not stack:
304
+ stack = _detect_stack(os.path.join(base, "baseline", "harness.py"))
305
+ if not stack:
306
+ # Scan the original directory for any .py files with known imports
307
+ harness_dir = os.path.dirname(os.path.abspath(args.harness))
308
+ detect_stack_py = os.path.join(os.path.dirname(__file__), "detect_stack.py")
309
+ if os.path.exists(detect_stack_py):
310
+ try:
311
+ r = subprocess.run(
312
+ ["python3", detect_stack_py, harness_dir],
313
+ capture_output=True, text=True, timeout=30,
314
+ )
315
+ if r.returncode == 0 and r.stdout.strip():
316
+ stack = json.loads(r.stdout)
317
+ except Exception:
318
+ pass
303
319
  config["stack"] = {
304
- "detected": stack,
320
+ "detected": stack if stack else {},
305
321
  "documentation_hint": "use context7",
306
322
  "auto_detected": True,
307
323
  }