Benchmark evidence: not_assessed: this literature review establishes no benchmark result
⧉ Copy investigation prompt Investigation prompt Editable prompt
+
+
+## Decision History
+
+No decisions recorded yet.
+
## Sampler candidates
[Browse candidates and copy investigation prompts](https://pyautolabs.github.io/PyAutoInsight/#sampler-candidates)
diff --git a/decisions.yaml b/decisions.yaml
new file mode 100644
index 0000000..8d6dd08
--- /dev/null
+++ b/decisions.yaml
@@ -0,0 +1,2 @@
+# Human decisions only; see decisions/README.md for capture and record format.
+decisions: []
diff --git a/decisions/README.md b/decisions/README.md
new file mode 100644
index 0000000..6263c67
--- /dev/null
+++ b/decisions/README.md
@@ -0,0 +1,68 @@
+# Decision records
+
+Decision History is a flat, newest-first list below the dashboard's Results.
+It is not divided by repository, dataset or likelihood. Entries open readable
+GitHub Markdown pages in new tabs.
+
+## Capture a decision
+
+Say **"record this decision"**, or explicitly flag a key campaign decision,
+in the ongoing campaign conversation. Follow CHECKIN.md's decision capture
+procedure. A dedicated skill is not required: the check-in instructions are
+the entry point for both natural-language forms.
+
+Write one canonical `decisions/
.md` in the organ leading the campaign.
+Use the template below; do not index the template or an undecided draft.
+Add the same id, title, date and canonical URL to `decisions.yaml` in each
+relevant dashboard. Cross-dashboard entries link to the same page; never copy
+the decision prose. The date is the date the human made the decision, not the
+board refresh date. Quote it in YAML. IDs are stable lowercase kebab-case.
+
+The index has exactly one `decisions` list; each entry has `id`, `title`,
+`date` (YYYY-MM-DD string), and `url` pointing to
+`https://github.com/PyAutoLabs//blob/main/decisions/.md`.
+The owning organ is PyAutoPulse or PyAutoInsight. Its local record must exist
+and its heading and Date line must match the index. Publish the canonical
+record before adding a link from the other dashboard, then verify that link.
+Evidence references within the record should pin commits or immutable results.
+
+Keep old decisions visible. A changed choice gets a new dated record with a
+"Supersedes" link; add a "Superseded by" link to the old page without rewriting
+its original reasoning. Clarifying factual corrections are dated annotations.
+An agent's proposed interpretation is not a human decision. Cortex/project
+ledgers remain authoritative for scientific facts and human conclusions;
+these pages summarize and cite them. Recording does not implement the choice,
+submit compute, change defaults or certify scientific acceptance.
+
+## Record template (not a published decision)
+
+```markdown
+#
+
+Date: YYYY-MM-DD
+Decision maker:
+Decision source:
+
+## Campaign
+
+
+## Evidence
+
+
+## Options considered
+
+
+## Decision
+
+
+## Implications
+
+
+## Revisit conditions
+
+
+## History
+
+```
diff --git a/insight/board.py b/insight/board.py
index 3fcf05f..65fbb09 100644
--- a/insight/board.py
+++ b/insight/board.py
@@ -9,7 +9,7 @@
from datetime import UTC, datetime
from pathlib import Path
-from insight import ORGAN_ROOT, campaigns, candidates, setup_browser, summary
+from insight import ORGAN_ROOT, campaigns, candidates, decisions, setup_browser, summary
from insight.theme import CSS, JS, theme
PAGES_URL = "https://pyautolabs.github.io/PyAutoInsight/"
@@ -285,6 +285,7 @@ def render_html(views, now=None, campaign_data=None):
navigation=[
{"href": "#campaigns", "label": "Active campaigns"},
{"href": "#evidence", "label": "Inference Results"},
+ {"href": "#decision-history", "label": "Decision History"},
{"href": "#sampler-candidates", "label": "Sampler candidates"},
],
)
@@ -299,6 +300,7 @@ def render_html(views, now=None, campaign_data=None):
],
)
+ "".join(_detail(s, now) for s in views)
+ + decisions.render_html()
+ candidates.render(candidates.load())
+ ' '
+ "".join(setup_browser.render(s, now)[1] for s in views)
@@ -386,6 +388,7 @@ def render_markdown(views, now=None, campaign_data=None):
+ md(summary.comparison_refusals(s.doc, c) or c["protocol"])
)
out += ["", "", ""]
+ out += ["", decisions.markdown()]
out += [
"## Sampler candidates",
"",
diff --git a/insight/cli.py b/insight/cli.py
index d7390a1..1e09aa3 100644
--- a/insight/cli.py
+++ b/insight/cli.py
@@ -9,7 +9,7 @@
import sys
from pathlib import Path
-from insight import ORGAN_ROOT, board, campaigns, ingest, registry
+from insight import ORGAN_ROOT, board, campaigns, decisions, ingest, registry
from insight import summary as summary_mod
@@ -157,6 +157,12 @@ def _check_state(path: Path) -> list[str]:
def cmd_check(args) -> int:
problems = []
+ try:
+ decision_rows = decisions.load()
+ except ValueError as exc:
+ print(f"FAIL decisions: {exc}")
+ return 1
+
try:
campaign_data = campaigns.load()
campaigns.validate_migration()
@@ -211,6 +217,12 @@ def cmd_check(args) -> int:
problems.append("dashboard.md / dashboard.html missing")
print("FAIL dashboard: dashboard.md / dashboard.html missing — run `pyauto-insight board`")
else:
+ if (
+ decisions.marker(decision_rows) not in md.read_text()
+ or decisions.marker(decision_rows) not in page.read_text()
+ ):
+ problems.append("decision history stale — regenerate board")
+ print("FAIL decisions: dashboard does not match the decision index")
expected = campaigns.marker(campaign_data)
digest = board.input_marker(views, campaign_data)
if digest not in md.read_text() or digest not in page.read_text():
diff --git a/insight/decisions.py b/insight/decisions.py
new file mode 100644
index 0000000..611d8d8
--- /dev/null
+++ b/insight/decisions.py
@@ -0,0 +1,106 @@
+"""Flat links to human-authored campaign decisions; never infer conclusions."""
+
+import hashlib
+import html
+import json
+import re
+from datetime import date
+from pathlib import Path
+from urllib.parse import urlsplit
+
+import yaml
+
+from insight import ORGAN_ROOT
+
+REPO = "PyAutoInsight"
+
+
+def load(root: Path = ORGAN_ROOT) -> list[dict]:
+ """Validate the index and locally owned records; remote records stay links."""
+ try:
+ document = yaml.safe_load((root / "decisions.yaml").read_text())
+ except (OSError, yaml.YAMLError) as exc:
+ raise ValueError(f"Decision history: {exc}") from exc
+ if (
+ not isinstance(document, dict)
+ or set(document) != {"decisions"}
+ or not isinstance(document["decisions"], list)
+ ):
+ raise ValueError("Decision history requires a decisions list")
+ seen = set()
+ rows = []
+ for row in document["decisions"]:
+ if not isinstance(row, dict) or set(row) != {"id", "title", "date", "url"}:
+ raise ValueError("Decision requires id, title, date and url")
+ if any(
+ not isinstance(v, str) or not v.strip() or any(ord(c) < 32 for c in v)
+ for v in row.values()
+ ):
+ raise ValueError("Decision fields must be nonempty single-line strings; quote dates")
+ key = row["id"]
+ if not re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", key) or key in seen:
+ raise ValueError(f"Invalid or duplicate decision id: {key}")
+ seen.add(key)
+ if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", row["date"]):
+ raise ValueError("Decision date must be YYYY-MM-DD")
+ date.fromisoformat(row["date"])
+ url = urlsplit(row["url"])
+ match = re.fullmatch(
+ r"/PyAutoLabs/(PyAutoPulse|PyAutoInsight)/blob/main/decisions/([a-z0-9-]+)\.md",
+ url.path,
+ )
+ if (
+ url.scheme != "https"
+ or url.netloc != "github.com"
+ or url.query
+ or url.fragment
+ or not match
+ or match[2] != key
+ ):
+ raise ValueError(
+ "Decision URL must link to its canonical GitHub decisions/
.md record"
+ )
+ if match[1] == REPO:
+ path = root / "decisions" / f"{key}.md"
+ if not path.is_file():
+ raise ValueError(f"Missing decision record: {path}")
+ content = path.read_text()
+ if (
+ not content.startswith(f"# {row['title']}\n")
+ or f"Date: {row['date']}\n" not in content
+ ):
+ raise ValueError(f"Decision title/date differ from index: {key}")
+ rows.append(dict(row))
+ return sorted(rows, key=lambda row: (row["date"], row["id"]), reverse=True)
+
+
+def marker(rows):
+ digest = hashlib.sha256(json.dumps(rows, sort_keys=True).encode()).hexdigest()
+ return f""
+
+
+def render_html(rows=None):
+ rows = load() if rows is None else rows
+ links = "".join(
+ f''
+ f"{html.escape(row['title'])} "
+ for row in rows
+ )
+ return (
+ marker(rows)
+ + 'Decision History '
+ + (links or "No decisions recorded yet.
")
+ + " "
+ )
+
+
+def markdown(rows=None):
+ rows = load() if rows is None else rows
+ # HTML anchors also work in GitHub Markdown and safely escape arbitrary titles.
+ links = [
+ f'- {html.escape(row["title"])} '
+ for row in rows
+ ]
+ return "\n".join(
+ [marker(rows), "## Decision History", "", *(links or ["No decisions recorded yet."]), ""]
+ )
diff --git a/tests/browser_setup.py b/tests/browser_setup.py
index 7c836ca..a8cdfa5 100644
--- a/tests/browser_setup.py
+++ b/tests/browser_setup.py
@@ -5,6 +5,7 @@
import tempfile
from copy import deepcopy
from pathlib import Path
+from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
@@ -126,6 +127,33 @@ def main():
assert fallback.locator("#inference-pages").is_visible()
fallback.locator(".setup-page>summary").first.click()
assert fallback.locator(".setup-page h1").first.is_visible()
+ with patch(
+ "insight.decisions.load",
+ return_value=[
+ {
+ "id": "solver",
+ "title": "NNLS Solver Setup",
+ "date": "2026-10-08",
+ "url": "https://github.com/PyAutoLabs/PyAutoPulse/blob/main/decisions/solver.md",
+ }
+ ],
+ ):
+ history_path = Path(tmp) / "history.html"
+ history_path.write_text(board.render_html([snapshot]))
+ page.goto(history_path.as_uri())
+ history = page.locator("#decision-history")
+ disclosure = history.locator("xpath=ancestor-or-self::details[1]")
+ assert disclosure.get_attribute("open") is None
+ disclosure.locator("summary").first.click()
+ link = history.get_by_role("link", name="NNLS Solver Setup", exact=True)
+ assert link.is_visible()
+ assert link.get_attribute("target") == "_blank"
+ assert (
+ link.get_attribute("href")
+ == "https://github.com/PyAutoLabs/PyAutoPulse/blob/main/decisions/solver.md"
+ )
+ page.set_viewport_size({"width": 390, "height": 844})
+ assert page.evaluate("document.documentElement.scrollWidth <= innerWidth")
assert not errors, errors
browser.close()
print(
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 381c39b..668cea1 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -36,3 +36,33 @@ def test_check_rejects_receipt_revision_different_from_snapshot(
doc["resolved_commit"] = SHA_B
path.write_text(json.dumps(doc))
assert cli.main([*base, "check", *flags]) == 1
+
+
+def test_decision_only_change_requires_regeneration(
+ tmp_path, registry_file, fake_mind, web, monkeypatch, capsys
+):
+ from insight import decisions
+
+ inst = registry.load(registry_file, mind=fake_mind)[0]
+ web.publish(inst.github, SHA_A, inst.summary_path, fixture_doc("lens_summary_v1.json"))
+ ingest.ingest(inst, tmp_path, now="2026-10-04T00:00:00Z")
+ base = ["--registry", str(registry_file)]
+ flags = ["--mind", str(fake_mind), "--out", str(tmp_path), "--offline"]
+ monkeypatch.setattr(decisions, "load", lambda: [])
+ assert cli.main([*base, "board", *flags]) == 0
+ monkeypatch.setattr(
+ decisions,
+ "load",
+ lambda: [
+ {
+ "id": "solver",
+ "title": "Solver choice",
+ "date": "2026-10-08",
+ "url": "https://github.com/PyAutoLabs/PyAutoPulse/blob/main/decisions/solver.md",
+ }
+ ],
+ )
+ assert cli.main([*base, "check", *flags]) == 1
+ assert "FAIL decisions" in capsys.readouterr().out
+ assert cli.main([*base, "board", *flags]) == 0
+ assert cli.main([*base, "check", *flags]) == 0
diff --git a/tests/test_decisions.py b/tests/test_decisions.py
new file mode 100644
index 0000000..30fe511
--- /dev/null
+++ b/tests/test_decisions.py
@@ -0,0 +1,96 @@
+from copy import deepcopy
+
+import pytest
+import yaml
+
+from insight import board, decisions
+
+
+def row(key="solver", day="2026-10-08", repo="PyAutoInsight"):
+ return {
+ "id": key,
+ "title": "NNLS & choice",
+ "date": day,
+ "url": f"https://github.com/PyAutoLabs/{repo}/blob/main/decisions/{key}.md",
+ }
+
+
+def write(root, rows):
+ (root / "decisions.yaml").write_text(yaml.safe_dump({"decisions": rows}))
+ (root / "decisions").mkdir(exist_ok=True)
+ for item in rows:
+ (root / "decisions" / f"{item['id']}.md").write_text(
+ f"# {item['title']}\n\nDate: {item['date']}\n"
+ )
+
+
+def test_records_sorted_and_cross_organ_has_one_canonical_url(tmp_path):
+ rows = [row("old", "2026-09-01"), row("new", repo="PyAutoPulse")]
+ write(tmp_path, rows)
+ (tmp_path / "decisions/new.md").unlink()
+ loaded = decisions.load(tmp_path)
+ assert [r["id"] for r in loaded] == ["new", "old"]
+ html = decisions.render_html(loaded)
+ assert 'target="_blank" rel="noopener"' in html
+ assert "NNLS <solver> & choice" in html
+ assert "NNLS " not in html
+ assert loaded[0]["url"] in html
+ assert loaded[0]["url"] in decisions.markdown(loaded)
+
+
+@pytest.mark.parametrize(
+ "mutation",
+ [
+ {"url": "javascript:alert(1)"},
+ {"url": "https://github.com.evil/PyAutoLabs/PyAutoInsight/blob/main/decisions/solver.md"},
+ {"url": "https://github.com/PyAutoLabs/PyAutoInsight/blob/main/decisions/other.md"},
+ {"date": "2026-02-30"},
+ {"date": "2026-1-01"},
+ {"id": "../escape"},
+ {"title": "bad\nheading"},
+ {"extra": "typo"},
+ ],
+)
+def test_invalid_index_rejected(tmp_path, mutation):
+ entry = row()
+ entry.update(mutation)
+ (tmp_path / "decisions.yaml").write_text(yaml.safe_dump({"decisions": [entry]}))
+ with pytest.raises(ValueError):
+ decisions.load(tmp_path)
+
+
+def test_duplicate_missing_and_mismatched_owned_records(tmp_path):
+ entry = row()
+ write(tmp_path, [entry, deepcopy(entry)])
+ with pytest.raises(ValueError, match="duplicate"):
+ decisions.load(tmp_path)
+ write(tmp_path, [entry])
+ (tmp_path / "decisions/solver.md").write_text("# Different\nDate: 2026-10-08\n")
+ with pytest.raises(ValueError, match="differ"):
+ decisions.load(tmp_path)
+ (tmp_path / "decisions/solver.md").unlink()
+ with pytest.raises(ValueError, match="Missing"):
+ decisions.load(tmp_path)
+
+
+def test_board_disclosure_and_markdown_include_history(monkeypatch):
+ monkeypatch.setattr(decisions, "load", lambda: [row(repo="PyAutoPulse")])
+ html = board.render_html([])
+ assert 'href="#decision-history"' in html
+ assert 'id="decision-history"' in html
+ assert "NNLS <solver> & choice" in html
+ assert "Decision History" in board.render_markdown([])
+ assert row(repo="PyAutoPulse")["url"] in board.render_markdown([])
+ monkeypatch.setattr(decisions, "load", lambda: [])
+ assert "No decisions recorded yet." in board.render_html([])
+
+
+def test_cli_rejects_invalid_decision_index(monkeypatch, capsys):
+ from insight import cli
+
+ def invalid():
+ raise ValueError("broken decision index")
+
+ monkeypatch.setattr(decisions, "load", invalid)
+ assert cli.main(["check", "--offline"]) == 1
+ assert "FAIL decisions: broken decision index" in capsys.readouterr().out