qcoder 0.3.0a1__tar.gz → 0.4.0a1__tar.gz
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.
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/CHANGELOG.md +24 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/PKG-INFO +87 -28
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/README.md +86 -27
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/docs/architecture.md +3 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/pyproject.toml +1 -1
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/__init__.py +1 -1
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/cli.py +26 -2
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/bundle.py +28 -5
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/markdown.py +34 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/guidance/resource.py +15 -34
- qcoder-0.4.0a1/src/qcoder/engines/guidance/structural_scores.py +98 -0
- qcoder-0.4.0a1/src/qcoder/engines/profiles/__init__.py +5 -0
- qcoder-0.4.0a1/src/qcoder/engines/profiles/feature_profiles_v0.py +272 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/bundle.py +29 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/markdown.py +10 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/analyze.py +10 -2
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/context.py +7 -1
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/PKG-INFO +87 -28
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/SOURCES.txt +5 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_analyze_pipeline.py +13 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_cli_context_review.py +45 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_cli_help.py +33 -0
- qcoder-0.4.0a1/tests/test_context_bundle.py +260 -0
- qcoder-0.4.0a1/tests/test_examples_smoke.py +95 -0
- qcoder-0.4.0a1/tests/test_feature_profiles.py +135 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_review_bundle.py +49 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_review_qiskit_counts.py +5 -0
- qcoder-0.3.0a1/tests/test_context_bundle.py +0 -123
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/LICENSE +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/MANIFEST.in +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/NOTICE +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/setup.cfg +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/__main__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/context.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/adjoint_eligibility.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/mirror_build.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/run_config.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/core/schema.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/cirq_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/pennylane_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/qiskit_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/extractor.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/compute_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/glossary_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/schema_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/ir.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/labeling.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/parsers/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/qasm2_regex_parser.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/cut_profile.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/depth.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/entangling_layers.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/gate_set_stats.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/interaction_graph.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/interaction_graph_metrics.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/spans.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/guidance/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/artifact.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/engine.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/models.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/policy.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/schema_alignment.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/quantumness/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/quantumness/scorer.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/counts_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/qiskit_counts.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/batch.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/review.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/analyze.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/analyze_shot_scaling.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/batch.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/generate_corpus.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/harness.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/inspect_corpus_features.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/join_runs_features.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/mirror.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/predict_baseline.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/qr_dll_bootstrap.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runner.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/harness.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/mirror.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/runner.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/train_baseline_models.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/validate_baseline.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/dependency_links.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/entry_points.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/requires.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/top_level.txt +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/__init__.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_adjoint_eligibility.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_analyze_prediction_integration.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_analyze_shot_scaling.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_batch_pipeline.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_cirq_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_cli_batch_nested_discovery.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_cut_profile.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_entangling_layers.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_feature_glossary.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_gate_set_stats.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_generate_corpus.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_harness_schema_labels.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_inspect_corpus_features.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_interaction_graph_metrics.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_join_runs_features.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_mirror_build.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_parse_qasm2_text.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_pennylane_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_predict_baseline.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_prediction_artifact_io.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_prediction_fidelity_curve.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_prediction_policy.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_prediction_schema_alignment.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_qiskit_intake.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_quantumness_scorer.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_resource_guidance.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_review_counts_v0.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_schema_stability.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_smoke.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_temporal_spans.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_train_baseline_models.py +0 -0
- {qcoder-0.3.0a1 → qcoder-0.4.0a1}/tests/test_validate_baseline.py +0 -0
|
@@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on common practice for pre-1.0 semantic versioning: **`MAJOR.MINOR.PATCH`** with **`aN`** for alpha prereleases.
|
|
6
6
|
|
|
7
|
+
## 0.4.0a1 (alpha)
|
|
8
|
+
|
|
9
|
+
qCoder **0.4.0a1** adds opt-in derived **feature profiles**, mixed-width **review** checks, and a **5‑minute preflight→review** path.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`--profiles`** on **`qcoder analyze --json`** and **`qcoder context`** — deterministic derived **`feature_profiles`** from **`feature_map`**, emitted with **`feature_profiles_schema_version: "0.1"`** and **`basis: "deterministic_formula_from_feature_map"`**; **`not_guarantees: true`**.
|
|
14
|
+
- **`bitstring_width_consistency`** check in **`qcoder review`** — warns when observed bitstring key lengths disagree; derived metrics still use observed counts (also covers **`qcoder`** and **`qiskit_counts`** normalization paths).
|
|
15
|
+
|
|
16
|
+
### Improved
|
|
17
|
+
|
|
18
|
+
- **README — First 5 minutes** — quick install → Bell QASM → **`qcoder context --guidance --profiles`** → **`qcoder review`** with sample counts.
|
|
19
|
+
- **`examples/`** — Bell OpenQASM, illustrative counts fixture, copy-paste workflow docs, and optional **Qiskit / Cirq / PennyLane** export scripts (structure/export only).
|
|
20
|
+
- **Profile label polish** — `connected_small_graph` for tiny circuits instead of misleading `connected_high_density`; **`statevector_scale`** tier key (replacing `circuit_width`); **`llm_summary_profile`** rendered as short sub-bullets in preflight Markdown.
|
|
21
|
+
- **Execution review Markdown** — explicit that counts are user-provided and qCoder did not execute the circuit; **Assumptions and Limits** section when present.
|
|
22
|
+
|
|
23
|
+
### Unchanged / scope
|
|
24
|
+
|
|
25
|
+
- **Canonical feature schema** — same version, field order, and feature vector layout as **`0.3.0a1`** (`schema_v0`/compute path); profiles are additive only and do not alter canonical **`features`**.
|
|
26
|
+
|
|
27
|
+
### Local-only boundaries
|
|
28
|
+
|
|
29
|
+
- No LLM calls, telemetry, uploads, retrieval, or embeddings; no simulator or hardware execution, transpilation, or runtime execution in these CLI flows. Artifacts are local files under your control.
|
|
30
|
+
|
|
7
31
|
## 0.3.0a1 (alpha)
|
|
8
32
|
|
|
9
33
|
Optional Cirq and PennyLane intake alongside the existing Qiskit adapter. All adapters follow the same structural rules: framework object → OpenQASM 2 text → qCoder's shared parser pipeline.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qcoder
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0a1
|
|
4
4
|
Summary: Quantum circuit analysis and structured feature extraction tools.
|
|
5
5
|
Author-email: Quantum Ready Solutions <support@qcoder.ai>
|
|
6
6
|
Maintainer-email: Quantum Ready Solutions <support@qcoder.ai>
|
|
@@ -30,15 +30,89 @@ Dynamic: license-file
|
|
|
30
30
|
|
|
31
31
|
# qCoder
|
|
32
32
|
|
|
33
|
-
**qCoder** helps
|
|
33
|
+
**qCoder** helps you **plan and review quantum circuit runs** using **local, deterministic artifacts** (JSON and Markdown): preflight context from circuit **structure**, then post-run review from **counts you provide**. It does **not** call an LLM, send telemetry, upload data, run a simulator or hardware, perform retrieval, or create embeddings.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Stable structural **feature vectors** (`schema_version`, `feature_names`, `features`) and a readable **`feature_map`** sit underneath; they power the guidance and profile layers but are not the whole story for day-one use.
|
|
36
|
+
|
|
37
|
+
**CLI:** **`qcoder analyze`**, **`qcoder batch`**, **`qcoder context`**, **`qcoder review`**. Optional **`qcoder[qiskit]`**, **`qcoder[cirq]`**, **`qcoder[pennylane]`** — Python-only **structure/export intake** into the same extractor as OpenQASM (no simulator or hardware execution inside qCoder).
|
|
36
38
|
|
|
37
39
|
**Company / legal:** Quantum Ready Solutions. **Product docs:** [qcoder.ai](https://qcoder.ai) · [manual](https://qcoder.ai/manual/). **Source:** [github.com/QuantumReadySolutions/qCoder](https://github.com/QuantumReadySolutions/qCoder). **Support:** [support@qcoder.ai](mailto:support@qcoder.ai).
|
|
38
40
|
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## First 5 minutes: preflight → review
|
|
44
|
+
|
|
45
|
+
**1. Install** (Python **3.11+**; runtime dependency **NumPy**):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install qcoder
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Pre-release lines on PyPI may look like **`0.4.0a1`**.
|
|
52
|
+
|
|
53
|
+
**2. Create a small Bell circuit** as `bell.qasm` (OpenQASM 2), or use the copy in **[`examples/circuits/bell.qasm`](examples/circuits/bell.qasm)** from a clone:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
OPENQASM 2.0;
|
|
57
|
+
include "qelib1.inc";
|
|
58
|
+
qreg q[2];
|
|
59
|
+
creg c[2];
|
|
60
|
+
h q[0];
|
|
61
|
+
cx q[0],q[1];
|
|
62
|
+
measure q[0] -> c[0];
|
|
63
|
+
measure q[1] -> c[1];
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**3. Build preflight context** (heuristic resource guidance + optional structural taxonomy profiles):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
qcoder context bell.qasm \
|
|
70
|
+
--out-json preflight.context.json \
|
|
71
|
+
--out-md preflight.context.md \
|
|
72
|
+
--guidance --profiles
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
From the repo root you can instead run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
qcoder context examples/circuits/bell.qasm \
|
|
79
|
+
--out-json preflight.context.json \
|
|
80
|
+
--out-md preflight.context.md \
|
|
81
|
+
--guidance --profiles
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**4. Review with sample counts** (illustrative counts only—not produced by qCoder). From a **clone**, use the fixture **[`examples/fixtures/bell_counts_qiskit.json`](examples/fixtures/bell_counts_qiskit.json)**:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
qcoder review \
|
|
88
|
+
--counts-json examples/fixtures/bell_counts_qiskit.json \
|
|
89
|
+
--format qiskit_counts \
|
|
90
|
+
--preflight-json preflight.context.json \
|
|
91
|
+
--out-json execution.review.json \
|
|
92
|
+
--out-md execution.review.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you only have **`pip install`** and no **`examples/`** tree, write the same payload to a file and pass that path:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
printf '%s\n' '{"00": 5, "11": 3}' > counts.json
|
|
99
|
+
qcoder review \
|
|
100
|
+
--counts-json counts.json \
|
|
101
|
+
--format qiskit_counts \
|
|
102
|
+
--preflight-json preflight.context.json \
|
|
103
|
+
--out-json execution.review.json \
|
|
104
|
+
--out-md execution.review.md
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In real use, **`counts.json`** comes from **your** simulator or hardware pipeline; qCoder only reads the file you pass in.
|
|
108
|
+
|
|
109
|
+
**Examples:** **[`examples/README.md`](examples/README.md)** (Bell QASM + illustrative counts for clones).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
39
113
|
## What qCoder analyzes
|
|
40
114
|
|
|
41
|
-
qCoder summarizes **circuit structure** from
|
|
115
|
+
qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
|
|
42
116
|
|
|
43
117
|
## Package layout (supported public surface)
|
|
44
118
|
|
|
@@ -47,7 +121,8 @@ For **this release**, treat the **supported surface** as:
|
|
|
47
121
|
- **`qcoder analyze`** — single-circuit extraction (human or `--json`).
|
|
48
122
|
- **`qcoder batch`** — directory batch to **JSONL**.
|
|
49
123
|
- **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
|
|
50
|
-
- **`qcoder context`** — deterministic
|
|
124
|
+
- **Optional `--profiles`** on **`qcoder context`** and on **`qcoder analyze --json`** — deterministic derived structural taxonomy from `feature_map` (additive, non-canonical). For **`analyze`**, use **`--json --profiles`** together.
|
|
125
|
+
- **`qcoder context`** — deterministic preflight context artifacts (**JSON + Markdown**), including optional `--guidance`, optional **`--profiles`**, and optional **`--full-features`** glossary appendix.
|
|
51
126
|
- **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
52
127
|
- **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
|
|
53
128
|
- **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
|
|
@@ -59,49 +134,33 @@ Other modules under **`src/qcoder`** may exist for prototyping (extra tooling or
|
|
|
59
134
|
|
|
60
135
|
Brief notes live in **`docs/architecture.md`**.
|
|
61
136
|
|
|
62
|
-
## Install
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
pip install qcoder
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Pre-release lines on PyPI use segments such as **`0.3.0a1`**.
|
|
69
|
-
|
|
70
|
-
Optional Qiskit adapter:
|
|
137
|
+
## Install (optional extras)
|
|
71
138
|
|
|
72
139
|
```bash
|
|
73
140
|
pip install "qcoder[qiskit]"
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Optional Cirq adapter:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
141
|
pip install "qcoder[cirq]"
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Optional PennyLane adapter:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
142
|
pip install "qcoder[pennylane]"
|
|
86
143
|
```
|
|
87
144
|
|
|
88
|
-
Requires **Python 3.11+**. Runtime dependency: **NumPy**.
|
|
89
|
-
|
|
90
145
|
Machine-readable JSON from **`qcoder analyze --json`** includes a derived **`feature_map`** object (`name → value`) for easier reading. The canonical circuit feature bundle remains the nested **`features`** object (`schema_version`, **`feature_names`**, **`features`**).
|
|
91
146
|
|
|
92
147
|
Optional **`--guidance`** adds heuristic shot-count and simulator/MPS starting-point suggestions derived from structural features. These suggestions are transparent, non-guaranteed starting points only; qCoder performs no backend execution and includes no telemetry/upload in this flow.
|
|
93
148
|
|
|
94
|
-
|
|
149
|
+
Optional **`--profiles`** adds deterministic **`feature_profiles`** derived from `feature_map` for compact structural taxonomy. This is an additive interpretation layer with its own schema version and does not modify canonical `features` (`schema_version`, `feature_names`, `features`).
|
|
150
|
+
|
|
151
|
+
`qcoder context` and `qcoder review` generate deterministic local artifacts (JSON + Markdown) intended for user-controlled planning/review workflows. "LLM-ready/RAG-ready" in this project means users can attach or paste these artifacts manually; qCoder itself performs no retrieval, embeddings, network calls, or telemetry/upload in this flow.
|
|
95
152
|
|
|
96
153
|
The optional Qiskit, Cirq, and PennyLane adapters are structure/export intake paths only. qCoder does not execute simulators or hardware backends in these flows.
|
|
97
154
|
|
|
98
|
-
## CLI
|
|
155
|
+
## CLI reference (other commands)
|
|
99
156
|
|
|
100
157
|
```bash
|
|
101
158
|
qcoder analyze path/to/circuit.qasm
|
|
102
159
|
qcoder analyze path/to/circuit.qasm --json
|
|
103
160
|
qcoder analyze path/to/circuit.qasm --json --guidance
|
|
161
|
+
qcoder analyze path/to/circuit.qasm --json --profiles
|
|
104
162
|
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --guidance
|
|
163
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --profiles
|
|
105
164
|
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
|
|
106
165
|
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
|
|
107
166
|
qcoder review --counts-json counts.json --format qiskit_counts --preflight-json preflight.context.json --out-json execution.review.json --out-md execution.review.md
|
|
@@ -1,14 +1,88 @@
|
|
|
1
1
|
# qCoder
|
|
2
2
|
|
|
3
|
-
**qCoder** helps
|
|
3
|
+
**qCoder** helps you **plan and review quantum circuit runs** using **local, deterministic artifacts** (JSON and Markdown): preflight context from circuit **structure**, then post-run review from **counts you provide**. It does **not** call an LLM, send telemetry, upload data, run a simulator or hardware, perform retrieval, or create embeddings.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Stable structural **feature vectors** (`schema_version`, `feature_names`, `features`) and a readable **`feature_map`** sit underneath; they power the guidance and profile layers but are not the whole story for day-one use.
|
|
6
|
+
|
|
7
|
+
**CLI:** **`qcoder analyze`**, **`qcoder batch`**, **`qcoder context`**, **`qcoder review`**. Optional **`qcoder[qiskit]`**, **`qcoder[cirq]`**, **`qcoder[pennylane]`** — Python-only **structure/export intake** into the same extractor as OpenQASM (no simulator or hardware execution inside qCoder).
|
|
6
8
|
|
|
7
9
|
**Company / legal:** Quantum Ready Solutions. **Product docs:** [qcoder.ai](https://qcoder.ai) · [manual](https://qcoder.ai/manual/). **Source:** [github.com/QuantumReadySolutions/qCoder](https://github.com/QuantumReadySolutions/qCoder). **Support:** [support@qcoder.ai](mailto:support@qcoder.ai).
|
|
8
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## First 5 minutes: preflight → review
|
|
14
|
+
|
|
15
|
+
**1. Install** (Python **3.11+**; runtime dependency **NumPy**):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install qcoder
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Pre-release lines on PyPI may look like **`0.4.0a1`**.
|
|
22
|
+
|
|
23
|
+
**2. Create a small Bell circuit** as `bell.qasm` (OpenQASM 2), or use the copy in **[`examples/circuits/bell.qasm`](examples/circuits/bell.qasm)** from a clone:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
OPENQASM 2.0;
|
|
27
|
+
include "qelib1.inc";
|
|
28
|
+
qreg q[2];
|
|
29
|
+
creg c[2];
|
|
30
|
+
h q[0];
|
|
31
|
+
cx q[0],q[1];
|
|
32
|
+
measure q[0] -> c[0];
|
|
33
|
+
measure q[1] -> c[1];
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**3. Build preflight context** (heuristic resource guidance + optional structural taxonomy profiles):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
qcoder context bell.qasm \
|
|
40
|
+
--out-json preflight.context.json \
|
|
41
|
+
--out-md preflight.context.md \
|
|
42
|
+
--guidance --profiles
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
From the repo root you can instead run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
qcoder context examples/circuits/bell.qasm \
|
|
49
|
+
--out-json preflight.context.json \
|
|
50
|
+
--out-md preflight.context.md \
|
|
51
|
+
--guidance --profiles
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**4. Review with sample counts** (illustrative counts only—not produced by qCoder). From a **clone**, use the fixture **[`examples/fixtures/bell_counts_qiskit.json`](examples/fixtures/bell_counts_qiskit.json)**:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
qcoder review \
|
|
58
|
+
--counts-json examples/fixtures/bell_counts_qiskit.json \
|
|
59
|
+
--format qiskit_counts \
|
|
60
|
+
--preflight-json preflight.context.json \
|
|
61
|
+
--out-json execution.review.json \
|
|
62
|
+
--out-md execution.review.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If you only have **`pip install`** and no **`examples/`** tree, write the same payload to a file and pass that path:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
printf '%s\n' '{"00": 5, "11": 3}' > counts.json
|
|
69
|
+
qcoder review \
|
|
70
|
+
--counts-json counts.json \
|
|
71
|
+
--format qiskit_counts \
|
|
72
|
+
--preflight-json preflight.context.json \
|
|
73
|
+
--out-json execution.review.json \
|
|
74
|
+
--out-md execution.review.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
In real use, **`counts.json`** comes from **your** simulator or hardware pipeline; qCoder only reads the file you pass in.
|
|
78
|
+
|
|
79
|
+
**Examples:** **[`examples/README.md`](examples/README.md)** (Bell QASM + illustrative counts for clones).
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
9
83
|
## What qCoder analyzes
|
|
10
84
|
|
|
11
|
-
qCoder summarizes **circuit structure** from
|
|
85
|
+
qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
|
|
12
86
|
|
|
13
87
|
## Package layout (supported public surface)
|
|
14
88
|
|
|
@@ -17,7 +91,8 @@ For **this release**, treat the **supported surface** as:
|
|
|
17
91
|
- **`qcoder analyze`** — single-circuit extraction (human or `--json`).
|
|
18
92
|
- **`qcoder batch`** — directory batch to **JSONL**.
|
|
19
93
|
- **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
|
|
20
|
-
- **`qcoder context`** — deterministic
|
|
94
|
+
- **Optional `--profiles`** on **`qcoder context`** and on **`qcoder analyze --json`** — deterministic derived structural taxonomy from `feature_map` (additive, non-canonical). For **`analyze`**, use **`--json --profiles`** together.
|
|
95
|
+
- **`qcoder context`** — deterministic preflight context artifacts (**JSON + Markdown**), including optional `--guidance`, optional **`--profiles`**, and optional **`--full-features`** glossary appendix.
|
|
21
96
|
- **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
22
97
|
- **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
|
|
23
98
|
- **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
|
|
@@ -29,49 +104,33 @@ Other modules under **`src/qcoder`** may exist for prototyping (extra tooling or
|
|
|
29
104
|
|
|
30
105
|
Brief notes live in **`docs/architecture.md`**.
|
|
31
106
|
|
|
32
|
-
## Install
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
pip install qcoder
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Pre-release lines on PyPI use segments such as **`0.3.0a1`**.
|
|
39
|
-
|
|
40
|
-
Optional Qiskit adapter:
|
|
107
|
+
## Install (optional extras)
|
|
41
108
|
|
|
42
109
|
```bash
|
|
43
110
|
pip install "qcoder[qiskit]"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Optional Cirq adapter:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
111
|
pip install "qcoder[cirq]"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Optional PennyLane adapter:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
112
|
pip install "qcoder[pennylane]"
|
|
56
113
|
```
|
|
57
114
|
|
|
58
|
-
Requires **Python 3.11+**. Runtime dependency: **NumPy**.
|
|
59
|
-
|
|
60
115
|
Machine-readable JSON from **`qcoder analyze --json`** includes a derived **`feature_map`** object (`name → value`) for easier reading. The canonical circuit feature bundle remains the nested **`features`** object (`schema_version`, **`feature_names`**, **`features`**).
|
|
61
116
|
|
|
62
117
|
Optional **`--guidance`** adds heuristic shot-count and simulator/MPS starting-point suggestions derived from structural features. These suggestions are transparent, non-guaranteed starting points only; qCoder performs no backend execution and includes no telemetry/upload in this flow.
|
|
63
118
|
|
|
64
|
-
|
|
119
|
+
Optional **`--profiles`** adds deterministic **`feature_profiles`** derived from `feature_map` for compact structural taxonomy. This is an additive interpretation layer with its own schema version and does not modify canonical `features` (`schema_version`, `feature_names`, `features`).
|
|
120
|
+
|
|
121
|
+
`qcoder context` and `qcoder review` generate deterministic local artifacts (JSON + Markdown) intended for user-controlled planning/review workflows. "LLM-ready/RAG-ready" in this project means users can attach or paste these artifacts manually; qCoder itself performs no retrieval, embeddings, network calls, or telemetry/upload in this flow.
|
|
65
122
|
|
|
66
123
|
The optional Qiskit, Cirq, and PennyLane adapters are structure/export intake paths only. qCoder does not execute simulators or hardware backends in these flows.
|
|
67
124
|
|
|
68
|
-
## CLI
|
|
125
|
+
## CLI reference (other commands)
|
|
69
126
|
|
|
70
127
|
```bash
|
|
71
128
|
qcoder analyze path/to/circuit.qasm
|
|
72
129
|
qcoder analyze path/to/circuit.qasm --json
|
|
73
130
|
qcoder analyze path/to/circuit.qasm --json --guidance
|
|
131
|
+
qcoder analyze path/to/circuit.qasm --json --profiles
|
|
74
132
|
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --guidance
|
|
133
|
+
qcoder context path/to/circuit.qasm --out-json preflight.context.json --out-md preflight.context.md --profiles
|
|
75
134
|
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
|
|
76
135
|
qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
|
|
77
136
|
qcoder review --counts-json counts.json --format qiskit_counts --preflight-json preflight.context.json --out-json execution.review.json --out-md execution.review.md
|
|
@@ -13,6 +13,7 @@ The supported product surface described in **`README.md`** (**Package layout**)
|
|
|
13
13
|
|
|
14
14
|
- **`qcoder analyze`** and **`qcoder batch`** for deterministic structural extraction output.
|
|
15
15
|
- Optional **`--guidance`** for deterministic heuristic starting points derived from `feature_map`.
|
|
16
|
+
- Optional **`--profiles`** on `analyze` / `context` for deterministic derived structural taxonomy from `feature_map`.
|
|
16
17
|
- **`qcoder context`** for deterministic preflight artifacts (**JSON + Markdown**), with optional `--full-features` glossary appendix.
|
|
17
18
|
- **`qcoder review`** for deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
|
|
18
19
|
- Counts normalization from **`qcoder.counts.v0`** and **`qiskit_counts`** into one deterministic review path.
|
|
@@ -22,6 +23,8 @@ The canonical circuit feature schema remains the existing `features` payload (`s
|
|
|
22
23
|
|
|
23
24
|
When requested via CLI flags, qCoder may emit an additional top-level `guidance` block built deterministically from `feature_map`. This guidance is outside the canonical feature schema (`features`) and is intended as transparent heuristic starting points rather than execution-validated recommendations.
|
|
24
25
|
|
|
26
|
+
qCoder may also emit an optional top-level `feature_profiles` block derived deterministically from `feature_map`. `feature_profiles` is additive, separately versioned (`feature_profiles_schema_version`), and does not alter canonical `features` schema/version/order.
|
|
27
|
+
|
|
25
28
|
The `context` and `review` commands generate deterministic local artifacts (Markdown/JSON) for user-controlled planning and post-run analysis workflows. "LLM-ready/RAG-ready" in this context means users can attach/paste artifacts manually; qCoder itself makes no LLM calls and performs no retrieval, embeddings, network calls, telemetry upload, or database writes. qCoder also does not execute simulators or hardware backends in these flows.
|
|
26
29
|
|
|
27
30
|
Optional framework adapters perform conversion/intake only; they do not execute circuits, simulators, or hardware.
|
|
@@ -30,10 +30,22 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
30
30
|
p.add_argument("--threshold", type=float, default=None, help="Optional threshold/bond-dim conditioning value")
|
|
31
31
|
p.add_argument("--mirror-artifacts-dir", default=None, metavar="DIR", help="If set, write mirror QASM to DIR and add adjoint_supported/adjoint_reason/mirror_qasm_ref to output")
|
|
32
32
|
p.add_argument("--guidance", action="store_true", help="Include heuristic resource guidance (shots and simulator/MPS starting points)")
|
|
33
|
+
p.add_argument(
|
|
34
|
+
"--profiles",
|
|
35
|
+
action="store_true",
|
|
36
|
+
help="Include derived feature_profiles in JSON output (requires --json for analyze)",
|
|
37
|
+
)
|
|
33
38
|
|
|
34
39
|
p.add_argument("--json", action="store_true", help="Emit machine-readable JSON")
|
|
35
40
|
args = p.parse_args(argv)
|
|
36
41
|
|
|
42
|
+
if args.profiles and not args.json:
|
|
43
|
+
print(
|
|
44
|
+
"qcoder: --profiles is currently emitted only with --json for analyze; use --json --profiles.",
|
|
45
|
+
file=sys.stderr,
|
|
46
|
+
)
|
|
47
|
+
return 2
|
|
48
|
+
|
|
37
49
|
report = analyze_qasm(
|
|
38
50
|
args.qasm,
|
|
39
51
|
circuit_id=args.circuit_id,
|
|
@@ -45,7 +57,13 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
45
57
|
)
|
|
46
58
|
|
|
47
59
|
if args.json:
|
|
48
|
-
print(
|
|
60
|
+
print(
|
|
61
|
+
json.dumps(
|
|
62
|
+
report.to_json_dict(include_guidance=args.guidance, include_profiles=args.profiles),
|
|
63
|
+
indent=2,
|
|
64
|
+
sort_keys=True,
|
|
65
|
+
)
|
|
66
|
+
)
|
|
49
67
|
return 0
|
|
50
68
|
|
|
51
69
|
ex = report.example
|
|
@@ -62,7 +80,7 @@ def _cmd_analyze(argv: list[str]) -> int:
|
|
|
62
80
|
print(f"schema: {fv.schema_version}")
|
|
63
81
|
print(f"n_features: {len(fv.features)}")
|
|
64
82
|
if args.guidance:
|
|
65
|
-
out = report.to_json_dict(include_guidance=True)
|
|
83
|
+
out = report.to_json_dict(include_guidance=True, include_profiles=args.profiles)
|
|
66
84
|
guidance = out.get("guidance", {})
|
|
67
85
|
shot = guidance.get("shot_guidance", {})
|
|
68
86
|
sim = guidance.get("simulation_guidance", {})
|
|
@@ -122,6 +140,11 @@ def _cmd_context(argv: list[str]) -> int:
|
|
|
122
140
|
p.add_argument("--id", dest="circuit_id", default=None, help="Optional circuit id")
|
|
123
141
|
p.add_argument("--name", dest="circuit_name", default=None, help="Optional circuit name")
|
|
124
142
|
p.add_argument("--guidance", action="store_true", help="Include heuristic resource guidance in context artifacts")
|
|
143
|
+
p.add_argument(
|
|
144
|
+
"--profiles",
|
|
145
|
+
action="store_true",
|
|
146
|
+
help="Include deterministic derived feature profiles in context artifacts",
|
|
147
|
+
)
|
|
125
148
|
p.add_argument(
|
|
126
149
|
"--full-features",
|
|
127
150
|
action="store_true",
|
|
@@ -134,6 +157,7 @@ def _cmd_context(argv: list[str]) -> int:
|
|
|
134
157
|
out_json=args.out_json,
|
|
135
158
|
out_md=args.out_md,
|
|
136
159
|
include_guidance=args.guidance,
|
|
160
|
+
include_profiles=args.profiles,
|
|
137
161
|
include_full_features=args.full_features,
|
|
138
162
|
circuit_id=args.circuit_id,
|
|
139
163
|
circuit_name=args.circuit_name,
|
|
@@ -22,11 +22,26 @@ def qasm_sha256(path: str) -> str:
|
|
|
22
22
|
return hashlib.sha256(data).hexdigest()
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def context_bundle_basis(analysis: dict[str, Any]) -> str:
|
|
26
|
+
"""Human-readable bundle basis from which optional blocks are included."""
|
|
27
|
+
has_g = "guidance" in analysis
|
|
28
|
+
has_p = "feature_profiles" in analysis
|
|
29
|
+
if has_g and has_p:
|
|
30
|
+
return "deterministic_analysis_plus_guidance_and_profiles"
|
|
31
|
+
if has_g:
|
|
32
|
+
return "deterministic_analysis_plus_guidance"
|
|
33
|
+
if has_p:
|
|
34
|
+
return "deterministic_analysis_plus_profiles"
|
|
35
|
+
return "deterministic_analysis"
|
|
36
|
+
|
|
37
|
+
|
|
25
38
|
def analysis_fingerprint(analysis: dict[str, Any]) -> str:
|
|
26
39
|
canonical = {
|
|
27
40
|
"features": analysis.get("features", {}),
|
|
28
41
|
"feature_map": analysis.get("feature_map", {}),
|
|
29
42
|
}
|
|
43
|
+
if "feature_profiles" in analysis:
|
|
44
|
+
canonical["feature_profiles"] = analysis.get("feature_profiles", {})
|
|
30
45
|
raw = json.dumps(canonical, sort_keys=True, separators=(",", ":")).encode("utf-8")
|
|
31
46
|
return hashlib.sha256(raw).hexdigest()
|
|
32
47
|
|
|
@@ -58,11 +73,22 @@ def build_context_bundle(
|
|
|
58
73
|
}
|
|
59
74
|
if "guidance" in analysis:
|
|
60
75
|
analysis_block["guidance"] = analysis["guidance"]
|
|
76
|
+
if "feature_profiles" in analysis:
|
|
77
|
+
analysis_block["feature_profiles"] = analysis["feature_profiles"]
|
|
78
|
+
|
|
79
|
+
llm_limits = [
|
|
80
|
+
"Do not interpret this artifact as simulator or hardware execution evidence.",
|
|
81
|
+
"Guidance is heuristic and non-guaranteed when present.",
|
|
82
|
+
]
|
|
83
|
+
if "feature_profiles" in analysis:
|
|
84
|
+
llm_limits.append(
|
|
85
|
+
"Feature profiles are deterministic structural taxonomy, not execution evidence."
|
|
86
|
+
)
|
|
61
87
|
|
|
62
88
|
return {
|
|
63
89
|
"context_bundle_schema_version": "0.1",
|
|
64
90
|
"artifact_type": "qcoder.preflight_context",
|
|
65
|
-
"basis":
|
|
91
|
+
"basis": context_bundle_basis(analysis),
|
|
66
92
|
"generated_utc": generated_utc or utc_now_iso(),
|
|
67
93
|
"qcoder_version": qcoder_version,
|
|
68
94
|
"circuit": circuit,
|
|
@@ -77,10 +103,7 @@ def build_context_bundle(
|
|
|
77
103
|
],
|
|
78
104
|
"llm_use": {
|
|
79
105
|
"intended_use": "Attach or paste this artifact for AI-assisted circuit planning.",
|
|
80
|
-
"limits":
|
|
81
|
-
"Do not interpret this artifact as simulator or hardware execution evidence.",
|
|
82
|
-
"Guidance is heuristic and non-guaranteed when present.",
|
|
83
|
-
],
|
|
106
|
+
"limits": llm_limits,
|
|
84
107
|
},
|
|
85
108
|
}
|
|
86
109
|
|
|
@@ -19,6 +19,7 @@ def render_context_markdown(bundle: dict[str, Any]) -> str:
|
|
|
19
19
|
feature_names = list(features_obj.get("feature_names") or [])
|
|
20
20
|
feature_values = list(features_obj.get("features") or [])
|
|
21
21
|
guidance = analysis.get("guidance")
|
|
22
|
+
feature_profiles = analysis.get("feature_profiles")
|
|
22
23
|
lines: list[str] = []
|
|
23
24
|
|
|
24
25
|
lines.append("# qCoder Preflight Context")
|
|
@@ -52,6 +53,39 @@ def render_context_markdown(bundle: dict[str, Any]) -> str:
|
|
|
52
53
|
else:
|
|
53
54
|
lines.append(f"- {key}: `{_fmt_num(feature_map.get(key))}`")
|
|
54
55
|
lines.append("")
|
|
56
|
+
if feature_profiles is not None:
|
|
57
|
+
profiles = feature_profiles.get("profiles", {})
|
|
58
|
+
lines.append("## Derived feature profiles")
|
|
59
|
+
lines.append(
|
|
60
|
+
"- Deterministic structural taxonomy derived from `feature_map`; not execution evidence."
|
|
61
|
+
)
|
|
62
|
+
lines.append(
|
|
63
|
+
"- Additive interpretation layer only; canonical `features` remains the source-of-truth vector."
|
|
64
|
+
)
|
|
65
|
+
ordered = [
|
|
66
|
+
"size_profile",
|
|
67
|
+
"sampling_profile",
|
|
68
|
+
"entanglement_profile",
|
|
69
|
+
"topology_profile",
|
|
70
|
+
"locality_profile",
|
|
71
|
+
"simulation_pressure_profile",
|
|
72
|
+
"llm_summary_profile",
|
|
73
|
+
]
|
|
74
|
+
for key in ordered:
|
|
75
|
+
prof = profiles.get(key, {})
|
|
76
|
+
if key == "llm_summary_profile":
|
|
77
|
+
summary_lines = prof.get("lines", [])
|
|
78
|
+
lines.append(f"- {key}:")
|
|
79
|
+
for summary_line in summary_lines:
|
|
80
|
+
lines.append(f" - {summary_line}")
|
|
81
|
+
continue
|
|
82
|
+
tiers = prof.get("tiers", {})
|
|
83
|
+
tier_keys = sorted(tiers.keys())
|
|
84
|
+
tier_str = ", ".join(f"{k}={tiers[k]}" for k in tier_keys)
|
|
85
|
+
labels = prof.get("labels", [])
|
|
86
|
+
labels_str = ", ".join(str(x) for x in labels)
|
|
87
|
+
lines.append(f"- {key}: tiers=`{tier_str}` labels=`{labels_str}`")
|
|
88
|
+
lines.append("")
|
|
55
89
|
if guidance is not None:
|
|
56
90
|
shot = guidance.get("shot_guidance", {})
|
|
57
91
|
sim = guidance.get("simulation_guidance", {})
|