qcoder 0.2.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.
Files changed (135) hide show
  1. qcoder-0.4.0a1/CHANGELOG.md +70 -0
  2. qcoder-0.4.0a1/PKG-INFO +185 -0
  3. qcoder-0.4.0a1/README.md +155 -0
  4. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/docs/architecture.md +8 -1
  5. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/pyproject.toml +3 -1
  6. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/__init__.py +1 -1
  7. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/cli.py +26 -2
  8. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/bundle.py +28 -5
  9. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/markdown.py +34 -0
  10. qcoder-0.4.0a1/src/qcoder/engines/feature_extraction/adapters/cirq_intake.py +54 -0
  11. qcoder-0.4.0a1/src/qcoder/engines/feature_extraction/adapters/pennylane_intake.py +86 -0
  12. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/qiskit_intake.py +17 -2
  13. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/guidance/resource.py +15 -34
  14. qcoder-0.4.0a1/src/qcoder/engines/guidance/structural_scores.py +98 -0
  15. qcoder-0.4.0a1/src/qcoder/engines/profiles/__init__.py +5 -0
  16. qcoder-0.4.0a1/src/qcoder/engines/profiles/feature_profiles_v0.py +272 -0
  17. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/bundle.py +29 -0
  18. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/markdown.py +10 -0
  19. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/analyze.py +10 -2
  20. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/context.py +7 -1
  21. qcoder-0.4.0a1/src/qcoder.egg-info/PKG-INFO +185 -0
  22. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/SOURCES.txt +9 -0
  23. qcoder-0.4.0a1/src/qcoder.egg-info/requires.txt +10 -0
  24. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_analyze_pipeline.py +13 -0
  25. qcoder-0.4.0a1/tests/test_cirq_intake.py +97 -0
  26. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_cli_context_review.py +45 -0
  27. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_cli_help.py +33 -0
  28. qcoder-0.4.0a1/tests/test_context_bundle.py +260 -0
  29. qcoder-0.4.0a1/tests/test_examples_smoke.py +95 -0
  30. qcoder-0.4.0a1/tests/test_feature_profiles.py +135 -0
  31. qcoder-0.4.0a1/tests/test_pennylane_intake.py +105 -0
  32. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_qiskit_intake.py +41 -0
  33. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_review_bundle.py +49 -0
  34. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_review_qiskit_counts.py +5 -0
  35. qcoder-0.2.0a1/CHANGELOG.md +0 -28
  36. qcoder-0.2.0a1/PKG-INFO +0 -106
  37. qcoder-0.2.0a1/README.md +0 -80
  38. qcoder-0.2.0a1/src/qcoder.egg-info/PKG-INFO +0 -106
  39. qcoder-0.2.0a1/src/qcoder.egg-info/requires.txt +0 -4
  40. qcoder-0.2.0a1/tests/test_context_bundle.py +0 -123
  41. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/LICENSE +0 -0
  42. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/MANIFEST.in +0 -0
  43. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/NOTICE +0 -0
  44. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/setup.cfg +0 -0
  45. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/__main__.py +0 -0
  46. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/__init__.py +0 -0
  47. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/context.py +0 -0
  48. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/__init__.py +0 -0
  49. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/adjoint_eligibility.py +0 -0
  50. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/qasm2/mirror_build.py +0 -0
  51. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/run_config.py +0 -0
  52. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/core/schema.py +0 -0
  53. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/context/__init__.py +0 -0
  54. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/adapters/__init__.py +0 -0
  55. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/extractor.py +0 -0
  56. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/compute_v0.py +0 -0
  57. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/glossary_v0.py +0 -0
  58. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/features/schema_v0.py +0 -0
  59. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/ir.py +0 -0
  60. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/labeling.py +0 -0
  61. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/parsers/__init__.py +0 -0
  62. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/qasm2_regex_parser.py +0 -0
  63. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/cut_profile.py +0 -0
  64. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/depth.py +0 -0
  65. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/entangling_layers.py +0 -0
  66. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/gate_set_stats.py +0 -0
  67. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/interaction_graph.py +0 -0
  68. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/interaction_graph_metrics.py +0 -0
  69. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/feature_extraction/reps/spans.py +0 -0
  70. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/guidance/__init__.py +0 -0
  71. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/__init__.py +0 -0
  72. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/artifact.py +0 -0
  73. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/engine.py +0 -0
  74. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/models.py +0 -0
  75. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/policy.py +0 -0
  76. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/prediction_model/schema_alignment.py +0 -0
  77. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/quantumness/__init__.py +0 -0
  78. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/quantumness/scorer.py +0 -0
  79. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/__init__.py +0 -0
  80. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/counts_v0.py +0 -0
  81. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/engines/review/qiskit_counts.py +0 -0
  82. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/batch.py +0 -0
  83. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/pipelines/review.py +0 -0
  84. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/analyze.py +0 -0
  85. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/analyze_shot_scaling.py +0 -0
  86. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/batch.py +0 -0
  87. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/generate_corpus.py +0 -0
  88. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/harness.py +0 -0
  89. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/inspect_corpus_features.py +0 -0
  90. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/join_runs_features.py +0 -0
  91. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/mirror.py +0 -0
  92. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/predict_baseline.py +0 -0
  93. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/qr_dll_bootstrap.py +0 -0
  94. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runner.py +0 -0
  95. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/__init__.py +0 -0
  96. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/__init__.py +0 -0
  97. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/__init__.py +0 -0
  98. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/harness.py +0 -0
  99. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/mirror.py +0 -0
  100. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/runners/quantum_rings/v12/runner.py +0 -0
  101. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/train_baseline_models.py +0 -0
  102. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder/tools/validate_baseline.py +0 -0
  103. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/dependency_links.txt +0 -0
  104. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/entry_points.txt +0 -0
  105. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/src/qcoder.egg-info/top_level.txt +0 -0
  106. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/__init__.py +0 -0
  107. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_adjoint_eligibility.py +0 -0
  108. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_analyze_prediction_integration.py +0 -0
  109. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_analyze_shot_scaling.py +0 -0
  110. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_batch_pipeline.py +0 -0
  111. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_cli_batch_nested_discovery.py +0 -0
  112. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_cut_profile.py +0 -0
  113. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_entangling_layers.py +0 -0
  114. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_feature_glossary.py +0 -0
  115. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_gate_set_stats.py +0 -0
  116. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_generate_corpus.py +0 -0
  117. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_harness_schema_labels.py +0 -0
  118. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_inspect_corpus_features.py +0 -0
  119. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_interaction_graph_metrics.py +0 -0
  120. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_join_runs_features.py +0 -0
  121. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_mirror_build.py +0 -0
  122. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_parse_qasm2_text.py +0 -0
  123. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_predict_baseline.py +0 -0
  124. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_prediction_artifact_io.py +0 -0
  125. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_prediction_fidelity_curve.py +0 -0
  126. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_prediction_policy.py +0 -0
  127. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_prediction_schema_alignment.py +0 -0
  128. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_quantumness_scorer.py +0 -0
  129. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_resource_guidance.py +0 -0
  130. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_review_counts_v0.py +0 -0
  131. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_schema_stability.py +0 -0
  132. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_smoke.py +0 -0
  133. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_temporal_spans.py +0 -0
  134. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_train_baseline_models.py +0 -0
  135. {qcoder-0.2.0a1 → qcoder-0.4.0a1}/tests/test_validate_baseline.py +0 -0
@@ -0,0 +1,70 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on common practice for pre-1.0 semantic versioning: **`MAJOR.MINOR.PATCH`** with **`aN`** for alpha prereleases.
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
+
31
+ ## 0.3.0a1 (alpha)
32
+
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.
34
+
35
+ ### Added
36
+
37
+ - **`qcoder[cirq]`** — optional **Cirq** `Circuit` intake via OpenQASM 2 export (`cirq.qasm`) into the same canonical extractor used for `.qasm` files.
38
+ - **`qcoder[pennylane]`** — optional **PennyLane** intake (`QNode`, and **`QuantumScript`** where the installed version exposes it) via OpenQASM 2 export into the same canonical extractor used for `.qasm` files.
39
+
40
+ ### Changed
41
+
42
+ - **Adapter error handling** — Qiskit intake wraps **`qiskit.qasm2.dumps`** failures and QASM-parse failures at the adapter boundary in actionable **`RuntimeError`** messages aligned with Cirq and PennyLane adapters.
43
+
44
+ ### Unchanged / scope
45
+
46
+ - **Canonical feature schema** — same version, field order, and feature vector layout as **`0.2.0a1`** (`schema_v0`/compute path).
47
+ - **Intake semantics** — Qiskit, Cirq, and PennyLane adapters are **structure/export intake only**: no transpiler upload, execution, simulator/hardware runs, telemetry, LLM calls, retrieval, or embeddings inside qCoder for these flows.
48
+
49
+ ## 0.2.0a1 (alpha)
50
+
51
+ Local-only deterministic CLI tooling for quantum circuit analysis and LLM-ready workflow artifacts.
52
+
53
+ ### Added
54
+
55
+ - **CLI help fixes** — consistent subcommands and help text (`analyze`, `batch`, `context`, `review`).
56
+ - **`feature_map`** — derived `name → value` view alongside canonical nested `features` in machine-readable analyze output for readability.
57
+ - **`--guidance`** — optional heuristic resource guidance on `qcoder analyze` and `qcoder batch` for shot budgets and simulator / MPS starting points (deterministic from structure only; non-guaranteed).
58
+ - **`qcoder context`** — preflight artifacts as **Markdown + JSON** (optional `--guidance`, optional **`--full-features`** glossary appendix).
59
+ - **`qcoder review`** — post-execution artifacts as **Markdown + JSON** from user-supplied counts; optional linkage to preflight JSON.
60
+ - **`qcoder.counts.v0`** counts schema and **`qiskit_counts`** normalization into the same deterministic review pipeline.
61
+ - **Feature glossary** — short deterministic definitions aligned with schema v0 feature names; surfaced in context bundles and **`--full-features`** appendix.
62
+ - **Conservative `shots_total` handling** — when declared `shots_total` disagrees with `sum(counts)`, review-derived probabilities use the observed sum, with explicit **`shots_total_match` check**, warning text, and `declared_shots_total` / `shots_total_basis` fields.
63
+
64
+ ### Behaviour
65
+
66
+ - **Local-only** — no LLM calls, no telemetry, no network, no retrieval or embeddings, no simulator or hardware execution within these CLI flows. Artifacts are files for you to attach or paste into tools of your choice.
67
+
68
+ ### Unchanged
69
+
70
+ - Canonical circuit feature schema (version, order, and vector layout in `features`) is unchanged for this release.
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: qcoder
3
+ Version: 0.4.0a1
4
+ Summary: Quantum circuit analysis and structured feature extraction tools.
5
+ Author-email: Quantum Ready Solutions <support@qcoder.ai>
6
+ Maintainer-email: Quantum Ready Solutions <support@qcoder.ai>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://qcoder.ai
9
+ Project-URL: Documentation, https://qcoder.ai/manual/
10
+ Project-URL: Repository, https://github.com/QuantumReadySolutions/qCoder
11
+ Project-URL: Issues, https://github.com/QuantumReadySolutions/qCoder/issues
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ License-File: NOTICE
22
+ Requires-Dist: numpy
23
+ Provides-Extra: qiskit
24
+ Requires-Dist: qiskit>=1.0; extra == "qiskit"
25
+ Provides-Extra: cirq
26
+ Requires-Dist: cirq-core>=1.4; extra == "cirq"
27
+ Provides-Extra: pennylane
28
+ Requires-Dist: pennylane>=0.44; extra == "pennylane"
29
+ Dynamic: license-file
30
+
31
+ # qCoder
32
+
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
+
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).
38
+
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).
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
+
113
+ ## What qCoder analyzes
114
+
115
+ qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
116
+
117
+ ## Package layout (supported public surface)
118
+
119
+ For **this release**, treat the **supported surface** as:
120
+
121
+ - **`qcoder analyze`** — single-circuit extraction (human or `--json`).
122
+ - **`qcoder batch`** — directory batch to **JSONL**.
123
+ - **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
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.
126
+ - **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
127
+ - **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
128
+ - **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
129
+ - **`qcoder[cirq]`** — optional Cirq `Circuit` intake into the **same extractor** as OpenQASM.
130
+ - **`qcoder[pennylane]`** — optional PennyLane circuit intake into the **same extractor** as OpenQASM.
131
+ - **Documented feature output** — see [qcoder.ai — Feature reference](https://qcoder.ai/manual/feature-reference/) and `engines/feature_extraction/features/schema_v0.py`; JSON carries a **`schema_version`** alongside named fields.
132
+
133
+ Other modules under **`src/qcoder`** may exist for prototyping (extra tooling or engines outside the commands above). Unless documented here, **`docs/`**, or **qcoder.ai**, they do **not** share the same stability expectations as the commands and artifact formats listed above.
134
+
135
+ Brief notes live in **`docs/architecture.md`**.
136
+
137
+ ## Install (optional extras)
138
+
139
+ ```bash
140
+ pip install "qcoder[qiskit]"
141
+ pip install "qcoder[cirq]"
142
+ pip install "qcoder[pennylane]"
143
+ ```
144
+
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`**).
146
+
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.
148
+
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.
152
+
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.
154
+
155
+ ## CLI reference (other commands)
156
+
157
+ ```bash
158
+ qcoder analyze path/to/circuit.qasm
159
+ qcoder analyze path/to/circuit.qasm --json
160
+ qcoder analyze path/to/circuit.qasm --json --guidance
161
+ qcoder analyze path/to/circuit.qasm --json --profiles
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
164
+ qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
165
+ qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
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
167
+ ```
168
+
169
+ **Batch:** JSONL records are written to **`--out`**. Status lines (for example record counts) may go to **stderr**, so prefer **`--out`** over shell stdout redirection for the JSONL stream.
170
+
171
+ ## Develop / test (from a clone)
172
+
173
+ If you use **pyenv**, select the intended Python before creating the venv (for example `pyenv local 3.11.x` or `pyenv shell 3.11.x`) so `python -m venv` uses that interpreter.
174
+
175
+ ```bash
176
+ python -m venv .venv
177
+ source .venv/bin/activate
178
+ pip install -e ".[qiskit]"
179
+ pip install pytest
180
+ pytest -q
181
+ ```
182
+
183
+ ## License
184
+
185
+ Licensed under the **Apache License 2.0**. See `LICENSE` and `NOTICE`.
@@ -0,0 +1,155 @@
1
+ # qCoder
2
+
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
+
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).
8
+
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).
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
+
83
+ ## What qCoder analyzes
84
+
85
+ qCoder summarizes **circuit structure** from OpenQASM (and optional framework export paths). Pair its JSON with **your** run data whenever you need **execution evidence**.
86
+
87
+ ## Package layout (supported public surface)
88
+
89
+ For **this release**, treat the **supported surface** as:
90
+
91
+ - **`qcoder analyze`** — single-circuit extraction (human or `--json`).
92
+ - **`qcoder batch`** — directory batch to **JSONL**.
93
+ - **Optional `--guidance`** on `analyze` / `batch` — deterministic heuristic starting points (shots and simulator/MPS settings) derived from circuit structure.
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.
96
+ - **`qcoder review`** — deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
97
+ - **Counts intake normalization** — `qcoder.counts.v0` and `qiskit_counts` normalization into the same deterministic review path.
98
+ - **`qcoder[qiskit]`** — optional `QuantumCircuit` intake into the **same extractor** as OpenQASM.
99
+ - **`qcoder[cirq]`** — optional Cirq `Circuit` intake into the **same extractor** as OpenQASM.
100
+ - **`qcoder[pennylane]`** — optional PennyLane circuit intake into the **same extractor** as OpenQASM.
101
+ - **Documented feature output** — see [qcoder.ai — Feature reference](https://qcoder.ai/manual/feature-reference/) and `engines/feature_extraction/features/schema_v0.py`; JSON carries a **`schema_version`** alongside named fields.
102
+
103
+ Other modules under **`src/qcoder`** may exist for prototyping (extra tooling or engines outside the commands above). Unless documented here, **`docs/`**, or **qcoder.ai**, they do **not** share the same stability expectations as the commands and artifact formats listed above.
104
+
105
+ Brief notes live in **`docs/architecture.md`**.
106
+
107
+ ## Install (optional extras)
108
+
109
+ ```bash
110
+ pip install "qcoder[qiskit]"
111
+ pip install "qcoder[cirq]"
112
+ pip install "qcoder[pennylane]"
113
+ ```
114
+
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`**).
116
+
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.
118
+
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.
122
+
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.
124
+
125
+ ## CLI reference (other commands)
126
+
127
+ ```bash
128
+ qcoder analyze path/to/circuit.qasm
129
+ qcoder analyze path/to/circuit.qasm --json
130
+ qcoder analyze path/to/circuit.qasm --json --guidance
131
+ qcoder analyze path/to/circuit.qasm --json --profiles
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
134
+ qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm"
135
+ qcoder batch circuits --out batch.features.jsonl --pattern "*.qasm" --guidance
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
137
+ ```
138
+
139
+ **Batch:** JSONL records are written to **`--out`**. Status lines (for example record counts) may go to **stderr**, so prefer **`--out`** over shell stdout redirection for the JSONL stream.
140
+
141
+ ## Develop / test (from a clone)
142
+
143
+ If you use **pyenv**, select the intended Python before creating the venv (for example `pyenv local 3.11.x` or `pyenv shell 3.11.x`) so `python -m venv` uses that interpreter.
144
+
145
+ ```bash
146
+ python -m venv .venv
147
+ source .venv/bin/activate
148
+ pip install -e ".[qiskit]"
149
+ pip install pytest
150
+ pytest -q
151
+ ```
152
+
153
+ ## License
154
+
155
+ Licensed under the **Apache License 2.0**. See `LICENSE` and `NOTICE`.
@@ -4,6 +4,8 @@
4
4
 
5
5
  - Primary path: **OpenQASM / QASM** text analyzed on the developer machine.
6
6
  - Optional path: **`qcoder[qiskit]`** can ingest **Qiskit `QuantumCircuit`** objects into the **same extractor** as OpenQASM.
7
+ - Optional path: **`qcoder[cirq]`** can ingest **Cirq `Circuit`** objects into the **same extractor** as OpenQASM.
8
+ - Optional path: **`qcoder[pennylane]`** can ingest **PennyLane circuits** into the **same extractor** as OpenQASM.
7
9
 
8
10
  The field glossary is defined in **`src/qcoder/engines/feature_extraction/features/schema_v0.py`** (`FEATURE_NAMES_V0`). The [qcoder.ai manual — Feature reference](https://qcoder.ai/manual/feature-reference/) summarizes each field name.
9
11
 
@@ -11,13 +13,18 @@ The supported product surface described in **`README.md`** (**Package layout**)
11
13
 
12
14
  - **`qcoder analyze`** and **`qcoder batch`** for deterministic structural extraction output.
13
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`.
14
17
  - **`qcoder context`** for deterministic preflight artifacts (**JSON + Markdown**), with optional `--full-features` glossary appendix.
15
18
  - **`qcoder review`** for deterministic post-run review artifacts (**JSON + Markdown**) from user-provided counts.
16
19
  - Counts normalization from **`qcoder.counts.v0`** and **`qiskit_counts`** into one deterministic review path.
17
- - Optional **`qcoder[qiskit]`** ingestion into the same extractor as OpenQASM.
20
+ - Optional **`qcoder[qiskit]`**, **`qcoder[cirq]`**, and **`qcoder[pennylane]`** ingestion into the same extractor as OpenQASM.
18
21
 
19
22
  The canonical circuit feature schema remains the existing `features` payload (`schema_version`, `feature_names`, `features`) produced by extraction. Guidance/context/review outputs are additive artifact layers and do not change canonical feature schema/version/order.
20
23
 
21
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.
22
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
+
23
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.
29
+
30
+ Optional framework adapters perform conversion/intake only; they do not execute circuits, simulators, or hardware.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qcoder"
7
- version = "0.2.0a1"
7
+ version = "0.4.0a1"
8
8
  description = "Quantum circuit analysis and structured feature extraction tools."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -28,6 +28,8 @@ dependencies = ["numpy"]
28
28
 
29
29
  [project.optional-dependencies]
30
30
  qiskit = ["qiskit>=1.0"]
31
+ cirq = ["cirq-core>=1.4"]
32
+ pennylane = ["pennylane>=0.44"]
31
33
 
32
34
  [project.urls]
33
35
  Homepage = "https://qcoder.ai"
@@ -1,3 +1,3 @@
1
1
  __all__ = []
2
- __version__ = "0.2.0a1"
2
+ __version__ = "0.4.0a1"
3
3
  file = __file__
@@ -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(json.dumps(report.to_json_dict(include_guidance=args.guidance), indent=2, sort_keys=True))
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": "deterministic_analysis_plus_optional_guidance",
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", {})