Architecture-aware repo-to-context scaffold for Qwen3 and Qwen3.6
Project description
qwen3-repo
Architecture-aware repo-to-context scaffold for Qwen3 and Qwen3.6. Ingests a GitHub repository into a dependency-ordered context pack, runs an agentic coding loop via any OpenAI-compatible endpoint, and includes NL2Repo / SWE-bench evaluation runners.
Why ordering matters
Qwen3.6's hybrid architecture (Gated DeltaNet + Gated Attention) processes three out of four layers with linear attention and a fixed-size recurrent state. Placing definitions before their dependents should help the recurrent state accumulate core types and interfaces before call sites reference them.
Standard Qwen3 models use full attention and can look back to any position, so ordering matters less -- but dependency-aware packing still avoids wasting context on low-value files and keeps related code together.
Qwen's NL2Repo evaluations (score: 36.2) were run via Claude Code (temp=1.0, top_p=0.95, max_turns=900). This scaffold provides an open-source alternative with architecture-aware context formatting.
Installation
pip install qwen3-repo
Quick start
Ingest a repository
from qwen3_repo import ingest_repo
# Works with any supported Qwen3 or Qwen3.6 model
context_pack, files, budget = ingest_repo(
"https://github.com/user/repo",
model="Qwen3-32B",
)
print(f"{len(files)} files, ~{budget.pack_budget:,} token budget")
Rank files by importance
from qwen3_repo import rank_files
from qwen3_repo.ingester import discover_files
from pathlib import Path
files = discover_files(Path("/path/to/repo"))
ranked = rank_files(files)
for r in ranked[:10]:
print(f"{r.score:.2f} {r.path}")
Detect vision encoder needs
from qwen3_repo import detect_vision_needs
from pathlib import Path
# Vision encoder is only relevant for Qwen3.6 (Qwen3 has no vision)
result = detect_vision_needs(Path("/path/to/repo"))
print(result["recommendation"])
# "Consider --language-model-only. Frees ~6 GB KV cache (~100K-150K additional tokens)."
Run the agentic scaffold
# Start a vLLM server first:
# vllm serve Qwen/Qwen3-32B --port 8000
python -m qwen3_repo.scaffold \
--repo-path /path/to/repo \
--task "Fix the failing test in test_auth.py" \
--max-turns 900 \
--temperature 1.0 \
--top-p 0.95
Run NL2Repo evaluation
python -m qwen3_repo.eval.nl2repo \
--tasks nl2repo_tasks.json \
--api-url http://localhost:8000/v1 \
--model Qwen/Qwen3.6-27B \
--output-dir nl2repo_results
Compare Claude Code vs qwen3-repo
python -m qwen3_repo.bench_compare \
--tasks comparison_tasks.json \
--repo-path /path/to/repo \
--markdown
Context ordering strategy
- Role-based grouping: CONFIG -> TYPE_DEF -> CORE_LIB -> UTILITY -> FEATURE -> TEST -> DOC -> BUILD
- Dependency-aware ordering: Topological sort within each group (Kahn's algorithm, importance as tiebreaker)
- Budget trimming: Lowest-importance files dropped first; tests and docs trimmed before core code
Importance scoring signals
| Signal | Weight | Description |
|---|---|---|
| Centrality | 3.0 | How many files import this file (log-scaled) |
| Role weight | 2.0 | TYPE_DEF > CONFIG > CORE_LIB > FEATURE > TEST > DOC |
| Recency | 1.5 | Exponentially decayed git last-modified (30-day half-life) |
| Coverage | 1.0 | Whether corresponding test files exist |
| Structural | 0.8 | Directory depth (root > deep nesting) |
| Size efficiency | 0.5 | Information density (tokens/byte) |
Vision encoder decision (Qwen3.6 only)
Qwen3 models have no vision encoder. For Qwen3.6:
| Repo contents | Vision encoder | Reason |
|---|---|---|
| No images | Disabled (--language-model-only) |
Frees ~6 GB KV cache |
| Design mockups/screenshots | Enabled | Model needs to see design intent |
| SVG diagrams | Enabled | Vision helps with SVG understanding |
| Canvas/WebGL code | Enabled | Vision helps understand visual output |
| Only icons/favicons | Disabled | Low relevance, not worth KV cost |
Supported models
Qwen3 (standard transformer, full attention)
| Model | Context |
|---|---|
| Qwen3-235B-A22B | 32K native, 128K extended |
| Qwen3-32B | 32K native, 128K extended |
| Qwen3-30B-A3B | 32K native, 128K extended |
| Qwen3-14B | 32K native, 128K extended |
| Qwen3-8B | 32K native, 128K extended |
| Qwen3-4B | 32K native |
| Qwen3-1.7B | 32K native |
| Qwen3-0.6B | 32K native |
Qwen3.6 (hybrid Gated DeltaNet + Gated Attention)
| Model | Layers | Layout | Context |
|---|---|---|---|
| Qwen3.6-27B | 64 | 16 x (3 x GDN + 1 x GA) | 262K native, 1M extended |
| Qwen3.6-35B-A3B | 40 | 10 x (3 x GDN + 1 x GA), MoE | 262K native |
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qwen3_repo-0.1.0.tar.gz.
File metadata
- Download URL: qwen3_repo-0.1.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
947e5e54a89119180cfe4ff16392db57bfd326b9286a9e3531844791b47f46de
|
|
| MD5 |
2922d2564c9d46465c6e166f55294cb2
|
|
| BLAKE2b-256 |
d6e1943fb5206deafe2cd3189dc1690b635ea2f0f5f9de206b387d1db02f147c
|
Provenance
The following attestation bundles were made for qwen3_repo-0.1.0.tar.gz:
Publisher:
publish.yml on ArkaD171717/Qwen3-Repo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwen3_repo-0.1.0.tar.gz -
Subject digest:
947e5e54a89119180cfe4ff16392db57bfd326b9286a9e3531844791b47f46de - Sigstore transparency entry: 1402469024
- Sigstore integration time:
-
Permalink:
ArkaD171717/Qwen3-Repo@fbc80fc7c3760537e7f095802af6b3bb2dfaf9cb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ArkaD171717
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fbc80fc7c3760537e7f095802af6b3bb2dfaf9cb -
Trigger Event:
push
-
Statement type:
File details
Details for the file qwen3_repo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qwen3_repo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
faccb081260ea00e0c6ded8a0a31eda50e58ec0d356f04b1950783c79333c3f5
|
|
| MD5 |
2772db6737c0cf0268726ba9e32609ae
|
|
| BLAKE2b-256 |
e67a36538d0619dff3b8ef1c1e61dd2aabe1de88ad887432cd5b5e03e151a994
|
Provenance
The following attestation bundles were made for qwen3_repo-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ArkaD171717/Qwen3-Repo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwen3_repo-0.1.0-py3-none-any.whl -
Subject digest:
faccb081260ea00e0c6ded8a0a31eda50e58ec0d356f04b1950783c79333c3f5 - Sigstore transparency entry: 1402469091
- Sigstore integration time:
-
Permalink:
ArkaD171717/Qwen3-Repo@fbc80fc7c3760537e7f095802af6b3bb2dfaf9cb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ArkaD171717
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fbc80fc7c3760537e7f095802af6b3bb2dfaf9cb -
Trigger Event:
push
-
Statement type: