CUST-WP-0055 T06: workplan-first curate decision scope
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 10s

Dual-write workplan_id and legacy workstream_id on State Hub decisions;
add --workplan-id CLI flag. Archive grandfather notes (T07).
This commit is contained in:
tegwick 2026-07-08 20:26:24 +02:00
parent a338d8debe
commit a08d988157
3 changed files with 32 additions and 13 deletions

View file

@ -1,7 +1,7 @@
"""Curate entrypoint (T06): review detect candidates into the Pattern Catalog.
python -m session_memory.curate [--config PATH] [--auto-approve] [--json]
[--workstream-id ID]
[--workplan-id ID] [--workstream-id ID]
Refreshes candidate patterns (runs the detect pipeline), then drives them through
the review workflow **interactive** by default, or **batch** with
@ -31,8 +31,8 @@ def _curate_paths(config: dict):
catalog_dir = _expand(c.get("catalog_dir", "session_memory/catalog"))
review_log = _expand(c.get("review_log", "session_memory/.store/reviews.jsonl"))
queue = _expand(c.get("decision_queue", "session_memory/.store/decisions.queue.jsonl"))
ws_id = c.get("state_hub_workstream_id")
return catalog_dir, review_log, queue, ws_id
wp_id = c.get("state_hub_workplan_id") or c.get("state_hub_workstream_id")
return catalog_dir, review_log, queue, wp_id
def _render_candidate(cand: dict, gate, existing) -> str:
@ -96,7 +96,12 @@ def main(argv=None) -> int:
ap.add_argument("--auto-approve", action="store_true",
help="batch mode: promote everything clearing the evidence bar")
ap.add_argument("--min-frequency", type=int, default=2)
ap.add_argument("--workstream-id", default=None, help="hub workstream for decisions")
ap.add_argument("--workplan-id", default=None, help="hub workplan for decisions")
ap.add_argument(
"--workstream-id",
default=None,
help="legacy State Hub scope alias (workstream_id flag)",
)
ap.add_argument("--json", action="store_true", help="emit machine-readable JSON")
args = ap.parse_args(argv)
@ -107,7 +112,8 @@ def main(argv=None) -> int:
gate = gate_config(config)
catalog = Catalog(catalog_dir)
log = ReviewLog(review_log_path)
recorder = DecisionRecorder(queue_path, workstream_id=args.workstream_id or ws_id)
scope_id = args.workplan_id or args.workstream_id or ws_id
recorder = DecisionRecorder(queue_path, workplan_id=scope_id)
decide = _auto_decider(gate) if args.auto_approve else _interactive_decider(gate, catalog)
result = review(candidates, decide, catalog, log, gate=gate, recorder=recorder)