Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/dashboard_refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ on:
paths:
- "registry.yaml"
- "campaigns.yaml"
- "decisions.yaml"
- "decisions/**"
- "sampler_candidates.json"
- "tasks/**"
- "migration.yaml"
Expand Down
22 changes: 22 additions & 0 deletions CHECKIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,25 @@ candidates, retained implementation/dependency ownership and pinned source
revisions. Destination files must land before deleting source task files or
removing the migrated ideas line. Keep historical completion records intact;
repair current routing references to canonical Insight URLs after landing.

## Record a key decision

When the user says "record this decision" or explicitly flags a key campaign
decision, use `decisions/README.md` to produce a high-level campaign summary.
Read the relevant campaign/task history and cited project/Cortex evidence;
preserve hardware, dataset, model and cold/warm-start distinctions. Summarize
the evidence, alternatives, the human's choice and its implications, with
source links and limitations. Do not infer an accepted choice from timings,
a passing run, or an agent recommendation. If the user is still deciding,
prepare a draft and ask for the missing choice before adding a history entry.

Write one canonical Markdown record in the campaign-leading organ and link it
from `decisions.yaml` on each relevant board. Do not categorize by repository
or dataset and do not duplicate the prose. Explicit direction to record a
stated decision authorizes the capture; ask only about genuinely missing facts.
Keep scientific sources authoritative and cite them. Preserve old decisions;
a changed choice receives a new dated record with supersession links.
Publish the owning record before adding its cross-dashboard link, verify the
GitHub destination, regenerate and check both affected boards through the
normal development workflow. Recording a decision does not authorize its
implementation or compute. Never turn an illustrative title into a decision.
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,12 @@ Routine capture/integrity metadata is available in the machine-readable receipts
and snapshots, not an Evidence details disclosure. Actual stale, failed, cached
and local-preview warnings remain visible. JAX choices carry an explicit (JAX) label. Campaign tables display only
name, recent progress and next steps; the complete ledger remains authoritative.

## Decision History

`decisions.yaml` indexes human-authored campaign summaries; `decisions/README.md`
defines capture, ownership, record format and supersession. The flat list follows
Results in HTML and Markdown. Both boards can link to one canonical record.
The reader validates IDs, dates, GitHub destinations and owned record metadata;
it never makes a scientific decision. Remote record existence is checked when
publishing the cross-dashboard link, not by offline rendering.
2 changes: 1 addition & 1 deletion dashboard.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -12125,6 +12125,12 @@ Archived rows belong to this project's September 2026 runs and are historical, n

</details>


<!-- decision-history:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945 -->
## Decision History

No decisions recorded yet.

## Sampler candidates

[Browse candidates and copy investigation prompts](https://pyautolabs.github.io/PyAutoInsight/#sampler-candidates)
Expand Down
2 changes: 2 additions & 0 deletions decisions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Human decisions only; see decisions/README.md for capture and record format.
decisions: []
68 changes: 68 additions & 0 deletions decisions/README.md
Original file line number Diff line number Diff line change
@@ -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/<id>.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/<owning-organ>/blob/main/decisions/<id>.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
# <Decision title>

Date: YYYY-MM-DD
Decision maker: <human>
Decision source: <human statement and durable source link, or dated conversation quotation>

## Campaign
<Goal, motivation and scope across repositories/datasets.>

## Evidence
<High-level findings with pinned links; hardware, precision, model, cold/warm
start and timing definitions where relevant. Include uncertainty and failures.>

## Options considered
<Alternatives and consequential tradeoffs.>

## Decision
<The human's actual choice, its scope and any exceptions.>

## Implications
<Effects on likelihoods, SLaM/inference defaults, compatibility and follow-up
work. Distinguish decided direction from implementation already shipped.>

## Revisit conditions
<Remaining uncertainty and what new evidence would change the choice.>

## History
<Supersedes/superseded-by links when applicable.>
```
5 changes: 4 additions & 1 deletion insight/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down Expand Up @@ -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"},
],
)
Expand All @@ -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())
+ '</div><div id="inference-pages">'
+ "".join(setup_browser.render(s, now)[1] for s in views)
Expand Down Expand Up @@ -386,6 +388,7 @@ def render_markdown(views, now=None, campaign_data=None):
+ md(summary.comparison_refusals(s.doc, c) or c["protocol"])
)
out += ["", "</details>", ""]
out += ["", decisions.markdown()]
out += [
"## Sampler candidates",
"",
Expand Down
14 changes: 13 additions & 1 deletion insight/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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():
Expand Down
106 changes: 106 additions & 0 deletions insight/decisions.py
Original file line number Diff line number Diff line change
@@ -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/<id>.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"<!-- decision-history:{digest} -->"


def render_html(rows=None):
rows = load() if rows is None else rows
links = "".join(
f'<a class="model-choice" href="{html.escape(row["url"], quote=True)}" target="_blank" rel="noopener" title="Opens in a new tab">'
f"{html.escape(row['title'])}</a>"
for row in rows
)
return (
marker(rows)
+ '<section id="decision-history"><h2>Decision History</h2>'
+ (links or "<p>No decisions recorded yet.</p>")
+ "</section>"
)


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'- <a href="{html.escape(row["url"], quote=True)}">{html.escape(row["title"])}</a>'
for row in rows
]
return "\n".join(
[marker(rows), "## Decision History", "", *(links or ["No decisions recorded yet."]), ""]
)
28 changes: 28 additions & 0 deletions tests/browser_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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(
Expand Down
30 changes: 30 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading