File size: 2,452 Bytes
101858b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
license: mit
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
library_name: transformers
tags:
  - code
  - qwen
  - guidance
  - sidecar
  - orchestration
---

# Qwen Coder Guidance Sidecar

This bundle describes a lightweight local coding guidance component for larger model orchestration. It is upload-ready as a Hugging Face model/runtime adapter package. It does not include training data.

It uses `Qwen/Qwen2.5-Coder-1.5B-Instruct` as a fast sidecar that returns compact JSON guidance instead of final user-facing prose. The larger model can call it before or during implementation to get route decisions, repo facts, patch constraints, risks, and tests.

## Output Contract

```json
{
  "route": "plan|patch|critique|test|fix",
  "confidence": 0.0,
  "useful_context": ["short facts the outer model should keep"],
  "plan": ["ordered implementation steps"],
  "patch_rules": ["constraints for the patch"],
  "risks": ["likely bugs or failure modes"],
  "tests": ["commands or cases to run"],
  "next_action": "one concise next action"
}
```

## Runtime

- Default model: `Qwen/Qwen2.5-Coder-1.5B-Instruct`
- Included local model path: `base_model/`
- Recommended inference: 4-bit NF4, bf16 compute, CUDA
- Cache behavior: disk cache by request hash
- Memory behavior: unload after call by default
- Package entrypoint: `guidance_sidecar.GuidanceEngine`
- Deterministic tools: route hint, context stats, risk scan, test suggestions, patch rules, simple calculations, Python syntax probe

## Use

Run directly from the uploaded/downloaded folder:

```bash
python run_guidance.py --task "Plan a safe config-loader refactor" --context "Python package with tests."
```

Or use the included modeling wrapper:

```python
from modeling_guidance_sidecar import GuidanceSidecar

guide = GuidanceSidecar("./qwen-coder-guidance-sidecar")
result = guide("Refactor the config loader safely", context="Python package with tests.")
```

The repo also includes the full `guidance_sidecar/` runtime package, so it can be used without installing the source project separately.

## Larger-Model Route

1. Outer model gathers repo context.
2. Sidecar runs deterministic tools and Qwen guidance.
3. Sidecar returns compact JSON with `tool_signals`.
4. Outer model treats that JSON as internal control data.
5. Outer model patches code, runs tests, and may call sidecar again for critique/fix routing.

The sidecar is designed to help a larger model, not replace it.