quantum-reasoning-skill 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/Furox-Art/quantum-reasoning-skill/blob/main/benchmark/schemas/metadata.schema.json",
4
- "title": "Quantum Reasoning community benchmark metadata",
5
- "type": "object",
6
- "additionalProperties": true,
7
- "required": [
8
- "provider",
9
- "model",
10
- "run_date",
11
- "skill_version",
12
- "repetitions_per_case",
13
- "baseline",
14
- "skill",
15
- "failures_recorded"
16
- ],
17
- "properties": {
18
- "provider": {"type": "string", "minLength": 1},
19
- "model": {"type": "string", "minLength": 1},
20
- "model_version": {"type": ["string", "null"]},
21
- "run_date": {"type": "string", "format": "date"},
22
- "skill_version": {"type": "string", "minLength": 1},
23
- "skill_commit": {"type": ["string", "null"]},
24
- "cases_source": {"type": ["string", "null"]},
25
- "repetitions_per_case": {"type": "integer", "minimum": 1},
26
- "random_seed": {"type": ["integer", "string", "null"]},
27
- "hardware_runtime": {"type": ["string", "null"]},
28
- "failures_recorded": {"const": true},
29
- "baseline": {"$ref": "#/$defs/condition"},
30
- "skill": {"$ref": "#/$defs/condition"},
31
- "notes": {"type": ["string", "null"]}
32
- },
33
- "$defs": {
34
- "condition": {
35
- "type": "object",
36
- "additionalProperties": true,
37
- "required": [
38
- "instruction_config",
39
- "sampling",
40
- "tool_availability",
41
- "context_limit",
42
- "output_limit"
43
- ],
44
- "properties": {
45
- "instruction_config": {"type": "string", "minLength": 1},
46
- "sampling": {"type": "object"},
47
- "tool_availability": {"type": ["array", "object", "string"]},
48
- "context_limit": {"type": ["integer", "null"], "minimum": 1},
49
- "output_limit": {"type": ["integer", "null"], "minimum": 1}
50
- }
51
- }
52
- }
53
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/Furox-Art/quantum-reasoning-skill/blob/main/benchmark/schemas/result.schema.json",
4
- "title": "Quantum Reasoning benchmark result row",
5
- "type": "object",
6
- "additionalProperties": true,
7
- "required": ["case_id", "answer", "tokens", "tool_calls", "latency_ms"],
8
- "properties": {
9
- "case_id": {"type": "string", "minLength": 1},
10
- "answer": {},
11
- "tokens": {"type": "number", "minimum": 0},
12
- "tool_calls": {"type": "number", "minimum": 0},
13
- "latency_ms": {"type": "number", "minimum": 0},
14
- "status": {
15
- "type": "string",
16
- "enum": ["ok", "refusal", "timeout", "error"]
17
- },
18
- "branches_total": {"type": "number", "minimum": 0},
19
- "branches_distinct": {"type": "number", "minimum": 0},
20
- "revived_branches": {"type": "number", "minimum": 0},
21
- "recovered_errors": {"type": "number", "minimum": 0},
22
- "contradictions_found": {"type": "number", "minimum": 0},
23
- "contradictions_resolved": {"type": "number", "minimum": 0}
24
- }
25
- }
@@ -1,114 +0,0 @@
1
- """Validate reproducible community benchmark result bundles."""
2
- from __future__ import annotations
3
- import argparse, json, re
4
- from datetime import date
5
- from pathlib import Path
6
- import evaluate
7
-
8
- REQUIRED_FILES = {"metadata.json", "cases.jsonl", "baseline.jsonl", "skill.jsonl", "comparison.json", "README.md"}
9
- COND_FIELDS = {"instruction_config", "sampling", "tool_availability", "context_limit", "output_limit"}
10
- META_FIELDS = {"provider", "model", "run_date", "skill_version", "repetitions_per_case", "baseline", "skill", "failures_recorded"}
11
-
12
-
13
- def load_json(path: Path):
14
- try:
15
- return json.loads(path.read_text(encoding="utf-8"))
16
- except (OSError, json.JSONDecodeError) as exc:
17
- raise ValueError(f"{path}: invalid JSON: {exc}") from exc
18
-
19
-
20
- def validate_metadata(meta: dict) -> None:
21
- if not isinstance(meta, dict):
22
- raise ValueError("metadata.json must contain a JSON object")
23
- missing = META_FIELDS - set(meta)
24
- if missing:
25
- raise ValueError(f"metadata.json missing fields: {sorted(missing)}")
26
- for key in ("provider", "model", "skill_version"):
27
- if not isinstance(meta[key], str) or not meta[key].strip():
28
- raise ValueError(f"metadata.{key} must be a non-empty string")
29
- try:
30
- date.fromisoformat(meta["run_date"])
31
- except Exception as exc:
32
- raise ValueError("metadata.run_date must be YYYY-MM-DD") from exc
33
- if not isinstance(meta["repetitions_per_case"], int) or meta["repetitions_per_case"] < 1:
34
- raise ValueError("metadata.repetitions_per_case must be >= 1")
35
- if meta["failures_recorded"] is not True:
36
- raise ValueError("metadata.failures_recorded must be true")
37
- for name in ("baseline", "skill"):
38
- value = meta[name]
39
- if not isinstance(value, dict):
40
- raise ValueError(f"metadata.{name} must be an object")
41
- missing_cond = COND_FIELDS - set(value)
42
- if missing_cond:
43
- raise ValueError(f"metadata.{name} missing fields: {sorted(missing_cond)}")
44
- if not isinstance(value["instruction_config"], str) or not value["instruction_config"].strip():
45
- raise ValueError(f"metadata.{name}.instruction_config must be non-empty")
46
- if not isinstance(value["sampling"], dict):
47
- raise ValueError(f"metadata.{name}.sampling must be an object")
48
- for limit in ("context_limit", "output_limit"):
49
- v = value[limit]
50
- if v is not None and (not isinstance(v, int) or v < 1):
51
- raise ValueError(f"metadata.{name}.{limit} must be null or >= 1")
52
-
53
-
54
- def _case_map(cases):
55
- out = {}
56
- for case in cases:
57
- evaluate.validate_case(case)
58
- cid = str(case["id"])
59
- if cid in out:
60
- raise ValueError(f"duplicate case id: {cid}")
61
- out[cid] = case
62
- return out
63
-
64
-
65
- def validate_bundle(bundle: Path) -> None:
66
- missing = REQUIRED_FILES - {p.name for p in bundle.iterdir() if p.is_file()}
67
- if missing:
68
- raise ValueError(f"{bundle}: missing files: {sorted(missing)}")
69
- validate_metadata(load_json(bundle / "metadata.json"))
70
- cases = evaluate.read_jsonl(bundle / "cases.jsonl")
71
- case_by_id = _case_map(cases)
72
- baseline = evaluate.read_jsonl(bundle / "baseline.jsonl")
73
- skill = evaluate.read_jsonl(bundle / "skill.jsonl")
74
- for row in baseline + skill:
75
- evaluate.validate_result(row)
76
- for label, rows in (("baseline", baseline), ("skill", skill)):
77
- ids = [str(r["case_id"]) for r in rows]
78
- if len(ids) != len(set(ids)):
79
- raise ValueError(f"{bundle}: duplicate {label} case_id")
80
- if set(ids) != set(case_by_id):
81
- raise ValueError(f"{bundle}: {label} must contain exactly one row for every case")
82
- expected = {
83
- "skill": evaluate.summarize(cases, skill),
84
- "baseline": evaluate.summarize(cases, baseline),
85
- }
86
- expected["comparison"] = evaluate.compare(expected["baseline"], expected["skill"])
87
- submitted = load_json(bundle / "comparison.json")
88
- if submitted != expected:
89
- raise ValueError(f"{bundle}: comparison.json does not match evaluator recomputation")
90
- if not (bundle / "README.md").read_text(encoding="utf-8").strip():
91
- raise ValueError(f"{bundle}: README.md must not be empty")
92
-
93
-
94
- def main() -> int:
95
- parser = argparse.ArgumentParser()
96
- parser.add_argument("--root", type=Path, default=Path("benchmark/results/community"))
97
- parser.add_argument("--allow-empty", action="store_true")
98
- args = parser.parse_args()
99
- root = args.root
100
- if not root.exists():
101
- if args.allow_empty:
102
- return 0
103
- raise SystemExit(f"community benchmark root not found: {root}")
104
- bundles = sorted(p for p in root.iterdir() if p.is_dir())
105
- if not bundles and not args.allow_empty:
106
- raise SystemExit("no community benchmark bundles found")
107
- for bundle in bundles:
108
- validate_bundle(bundle)
109
- print(f"validated {bundle}")
110
- return 0
111
-
112
-
113
- if __name__ == "__main__":
114
- raise SystemExit(main())
@@ -1,44 +0,0 @@
1
- # Host compatibility
2
-
3
- Quantum Reasoning is model-agnostic, but not every host exposes the same controls. Compatibility is therefore defined by capabilities rather than by provider branding.
4
-
5
- ## Compatibility levels
6
-
7
- | Level | Required capabilities | What works |
8
- | --- | --- | --- |
9
- | Protocol-only | Host can persist or inject `SKILL.md` instructions | Multi-branch protocol, falsification rules, stopping/collapse policy |
10
- | Measurable | Protocol-only plus aggregate run telemetry | Benchmark result schema, diversity/revival/contradiction measurements |
11
- | Controller-assisted | Measurable plus a host-side loop that can call `reference/branch_controller.py` or equivalent logic | Deterministic scoring, state transitions, uncertainty-based width and collapse checks |
12
-
13
- A host is incompatible only when it cannot reliably apply the skill instructions, truncates/replaces them in a way that changes the protocol, or prevents the requested task/tool access.
14
-
15
- ## Required host contract
16
-
17
- A compatible integration should preserve these invariants:
18
-
19
- 1. `SKILL.md` is supplied as a persistent system/developer/skill instruction, not as untrusted task content.
20
- 2. The same task constraints and tool permissions apply to all candidate branches.
21
- 3. Tool observations are treated as evidence and are not fabricated.
22
- 4. Private chain-of-thought is not required or stored. Only aggregate control-plane telemetry may be emitted.
23
- 5. If numeric branch telemetry is unavailable, the host follows the qualitative protocol and omits unavailable measurements rather than inventing them.
24
- 6. Baseline-vs-skill benchmarks keep the model/version, tools, sampling and budget policy fixed.
25
-
26
- ## Integration patterns
27
-
28
- ### 1. Native skill directory
29
-
30
- If a host supports a skill/plugin directory, install the repository so that `SKILL.md` is the skill entry point and keep its YAML front matter intact.
31
-
32
- ### 2. Persistent instruction wrapper
33
-
34
- If the host has no native skill format, load the contents of `SKILL.md` into the persistent system/developer instruction layer before the user task. Do not prepend it to benchmark prompts only in the skill condition unless the baseline wrapper is otherwise identical.
35
-
36
- ### 3. Controller-assisted agent
37
-
38
- A host with an explicit agent loop can map observable aggregate branch measurements to `BranchMetrics` and use `reference/branch_controller.py` for ranking, state changes and collapse decisions. The reference controller does not generate hidden reasoning or call an LLM.
39
-
40
- See [`../examples/host-integration.md`](../examples/host-integration.md) for concrete generic examples.
41
-
42
- ## Provider/model claims
43
-
44
- This repository intentionally does not label specific commercial models as "supported" without a reproducible third-party run. Community results may document a provider/model combination under `benchmark/results/community/`, but those results are measurements from the submitter, not a permanent compatibility guarantee.
@@ -1,131 +0,0 @@
1
- # Measurement and branch-control specification
2
-
3
- This document turns the qualitative protocol in `SKILL.md` into an auditable reference policy. It does **not** claim that these constants are optimal or scientifically validated. They are initial defaults that must be calibrated against benchmark data.
4
-
5
- ## 1. Observable branch metrics
6
-
7
- Each branch is represented by normalized values in `[0, 1]`:
8
-
9
- - `evidence`: support from verified facts or observations
10
- - `verification`: strength of independent checks
11
- - `independence`: independence from other branches
12
- - `information_gain`: expected value of further work on the branch
13
- - `contradiction`: severity of conflict with verified facts
14
- - `unresolved_assumptions`: remaining unsupported assumptions
15
- - `normalized_cost`: relative compute/tool cost already consumed
16
- - `shared_assumption_ratio`: overlap in critical assumptions with the current leader
17
- - `semantic_similarity_to_leader`: redundancy signal for near-duplicate branches
18
-
19
- These values are control metadata. They must not require exposing private chain-of-thought.
20
-
21
- ## 2. Correlation penalty
22
-
23
- A branch should not receive full independence credit when it shares assumptions or is effectively a paraphrase of the leader.
24
-
25
- ```text
26
- correlation = max(shared_assumption_ratio, semantic_similarity_to_leader)
27
- effective_independence = independence * (1 - correlation)
28
- ```
29
-
30
- ## 3. Reference support score
31
-
32
- The reference implementation uses:
33
-
34
- ```text
35
- score = clamp01(
36
- 0.15
37
- + 0.25 * evidence
38
- + 0.25 * verification
39
- + 0.15 * effective_independence
40
- + 0.10 * information_gain
41
- - 0.15 * contradiction
42
- - 0.05 * unresolved_assumptions
43
- - 0.05 * normalized_cost
44
- )
45
- ```
46
-
47
- The weights are deliberately explicit so they can be benchmarked and changed. They are not hidden policy.
48
-
49
- ## 4. State transitions
50
-
51
- Reference defaults:
52
-
53
- - reject when `contradiction >= 0.85`
54
- - move to dormant when `score < 0.35`
55
- - otherwise keep active
56
-
57
- A dormant branch is revived when at least one material change occurs relative to its previous measurement:
58
-
59
- - evidence increases by `>= 0.15`, or
60
- - verification increases by `>= 0.25`, or
61
- - contradiction decreases by `>= 0.20`
62
-
63
- A rejected branch is not automatically revived by the reference controller. A caller may explicitly reopen it if the supposedly verified fact that caused rejection is itself invalidated.
64
-
65
- ## 5. Dynamic search width
66
-
67
- Uncertainty is estimated from the normalized Shannon entropy of surviving branch scores.
68
-
69
- Reference width policy:
70
-
71
- | uncertainty | branch range |
72
- |---|---:|
73
- | `< 0.25` | 2–3 |
74
- | `0.25–0.55` | 4–6 |
75
- | `>= 0.55` | 6–10 |
76
-
77
- This is a compute-allocation recommendation, not a requirement to generate the maximum branch count.
78
-
79
- ## 6. Collapse criteria
80
-
81
- The reference controller permits collapse only when all applicable checks pass:
82
-
83
- 1. leader score `>= 0.78`
84
- 2. leader verification `>= 0.75`
85
- 3. leader contradiction `<= 0.15`
86
- 4. if a runner-up exists, leader margin `>= 0.12`
87
- 5. no unresolved high-information alternative remains close enough to plausibly change the outcome
88
-
89
- If these checks fail, the system should continue verification, keep multiple surviving alternatives, or report unresolved alternatives rather than manufacture certainty.
90
-
91
- ## 7. Diversity diagnostic
92
-
93
- Given pairwise semantic similarities, a pair is treated as redundant when similarity is `>= 0.85` by default.
94
-
95
- ```text
96
- diversity_ratio = materially_distinct_pairs / all_measured_pairs
97
- ```
98
-
99
- This metric is intentionally simple. Embedding model choice, similarity calibration and domain effects must be reported by any experiment that uses it.
100
-
101
- ## 8. What must be calibrated
102
-
103
- Benchmarking should test at least:
104
-
105
- - score weights
106
- - contradiction rejection threshold
107
- - dormant threshold
108
- - revival deltas
109
- - collapse score and margin
110
- - semantic duplicate threshold
111
- - uncertainty-to-width mapping
112
-
113
- Calibration must use a development set separate from final held-out evaluation.
114
-
115
- ## 9. Failure modes to measure
116
-
117
- A serious evaluation should label and count:
118
-
119
- - early lock-in
120
- - duplicated branches
121
- - shared-assumption failure
122
- - false contradiction detection
123
- - failure to revive a correct dormant branch
124
- - excessive search after the answer is already established
125
- - premature collapse
126
- - tool-confirmation bias
127
- - accuracy gain that is explained only by substantially higher compute
128
-
129
- ## 10. Reproducibility rule
130
-
131
- Any reported improvement must include the baseline configuration and raw aggregate result files needed to reproduce the comparison. Do not publish only a selected percentage or a hand-picked example.
@@ -1,57 +0,0 @@
1
- # Host integration examples
2
-
3
- These examples describe integration shapes without depending on a specific provider.
4
-
5
- ## Native skill host
6
-
7
- Install the repository or copy `SKILL.md` into the host's skill directory. Preserve the YAML front matter and load the file as a persistent skill instruction.
8
-
9
- ## Persistent instruction host
10
-
11
- Conceptually, the host should build the request as:
12
-
13
- ```text
14
- persistent instructions:
15
- <contents of SKILL.md>
16
-
17
- task:
18
- <user request>
19
- ```
20
-
21
- Do not require the model to print private reasoning. The final answer may remain concise while the host records only observable aggregate telemetry.
22
-
23
- ## Controller-assisted host
24
-
25
- A host-side agent loop may use the optional reference controller:
26
-
27
- ```python
28
- from reference.branch_controller import Branch, BranchMetrics, collapse_decision
29
-
30
- branch = Branch(
31
- branch_id="candidate-a",
32
- metrics=BranchMetrics(
33
- evidence=0.8,
34
- verification=0.9,
35
- independence=0.7,
36
- information_gain=0.6,
37
- contradiction=0.1,
38
- unresolved_assumptions=0.2,
39
- normalized_cost=0.3,
40
- shared_assumption_ratio=0.1,
41
- semantic_similarity_to_leader=0.2,
42
- ),
43
- )
44
- ```
45
-
46
- The host supplies only measurements it can actually observe. Missing telemetry must not be guessed.
47
-
48
- ## Benchmark wrapper
49
-
50
- For an A/B benchmark, keep everything fixed except the presence of the skill:
51
-
52
- ```text
53
- baseline = normal persistent instructions + task
54
- skill = normal persistent instructions + SKILL.md + same task
55
- ```
56
-
57
- Use the same model/version, tools, sampling settings and budget policy for both conditions. See [`../benchmark/README.md`](../benchmark/README.md).
package/examples/usage.md DELETED
@@ -1,31 +0,0 @@
1
- # Usage examples
2
-
3
- The skill is designed to be invoked only when branching improves reliability.
4
-
5
- ## Scientific hypothesis
6
-
7
- ```text
8
- Use the quantum-reasoning skill. Keep several materially different mechanisms alive, identify what evidence would falsify each one, use available tools to test them, and collapse only after cross-comparison.
9
- ```
10
-
11
- ## Mathematics
12
-
13
- ```text
14
- Use the quantum-reasoning skill. Explore independent solution strategies, test edge cases and counterexamples, verify the strongest path, and return only the final derivation and important uncertainty.
15
- ```
16
-
17
- ## Debugging
18
-
19
- ```text
20
- Use the quantum-reasoning skill. Maintain multiple root-cause hypotheses, design the cheapest discriminating test for each, eliminate contradicted causes, revive alternatives if new evidence conflicts with the leader, then give the most supported diagnosis.
21
- ```
22
-
23
- ## Planning / architecture
24
-
25
- ```text
26
- Use the quantum-reasoning skill. Generate genuinely different architectures, compare assumptions and failure modes, allocate more analysis to unresolved high-impact choices, and synthesize the strongest design only after verification.
27
- ```
28
-
29
- ## Expected behavior
30
-
31
- The model should not print a large internal reasoning tree. It should use the branching protocol internally and return a concise result, the evidence that matters, remaining uncertainty, and genuinely unresolved alternatives when necessary.