Skip to content

feat(roadmap): run brain repair, consolidate and evaluate daily #4687

Open

Description

@dan-petty

Problem or Motivation

No job keeps the brain good. The consolidate judge runs only by hand: on 2026-11-10 it judged 6 of 82 shortlists (limit 10 a run, DEFAULT_ROADMAP_CONSOLIDATE_JUDGED, src/devops_cli/config/defaults.py:978), and its plan is a local file with no durable copy. The owner asked on 2026-11-11 for repair, consolidate and evaluate as Jobs or Argo Workflows, never as a loop in a Service pod.

Proposed Solution & Architectural Design

  • Commands devops roadmap brain daily|repair|consolidate|evaluate, thin over brain-sync, consolidate_shortlist.py, consolidate_judge.py, the decision point module and the store. --dry-run sends 0 requests and prints the requests it would send.
  • WorkflowTemplate roadmap-brain in namespace devops (the Service image, the feat(roadmap): label Service Jobs by repository and item #4558 labels with row=brain, one model call in flight). CronWorkflow brain-daily: schedules: ["30 2 * * *"], timezone UTC, concurrencyPolicy: Forbid, startingDeadlineSeconds: 3600, synchronization.mutexes: [brain], retryStrategy for exit 75 only, activeDeadlineSeconds: 3000. One pod for each run: repair, then signals (the weekly child adds the runner), then consolidate, then evaluate.
  • No due mark (feat(roadmap): track the roadmap pipeline split into jobs #5482, 2026-11-13). Work that a run leaves waits for the next daily run.
  • Repair: rebuild brain-item, brain-tool and brain-ref from the blocks (GitHub wins); rebuild missing insights from the tracker comments; check at most 100 reference links (a 404 two runs in a row marks a reference dead); correct at most 10 item blocks through AlternativesWriter (read before write); delete old kinds, orphans, and insights superseded or declined for 30 days; set a TTL on a valkey-devops brain key that has none; create the tracker issue when its marker is missing; write the index marker last (the index of feat(roadmap): keep alternatives results in a brain index #4676 has the marker brain-sync, which the sync owns; no kind brain-built exists). Bounds: 1,000 deleted keys, 100 link reads, 10 issue writes, 0 model spend, 600 s.
  • Consolidate: rules first (ADR 0020). Merge tool names with one canonical id, references of one repository and path, and insights whose member sets overlap with Jaccard 0.5 or more. Judge at most 10 shortlists that were not judged before with the existing judge. An ambiguous pair goes to the decision point brain.merge_same_need in shadow mode. Bounds: 200 changed entries, 10 shortlists, 20 Jev questions, 0.05 USD, 900 s.
  • Evaluate: rules first (freshness, source state, use, support); a fixed score marks stale or weak. The decision point brain.entry_quality asks Jev one score question for each insight in shadow mode. Bounds: 300 entries, 50 Jev questions, 0 generative calls, 0.05 USD, 600 s.
  • The tracker issue: one for each repository, label type/epic and a marker. Repair creates it once and reads the marker first (ADR 0021 rule 5). The selections of intake, refine, alternatives and stage skip it.
  • Audit for every task: one JSON log line for each change (logger devops_cli.roadmap.brain, ids only, never issue text); counters; an XADD to brain-events; one summary comment on the tracker issue for a run that changed something, with one hidden block for each changed insight (at most 40 blocks a comment, at most 2 comments a day).
  • Safe stop for every task: each change is one WATCH/MULTI/EXEC transaction; a rebuild writes a temporary key and RENAMEs it; the run record and the cursor are written last. On SIGTERM, the task stops between two transactions, writes result=stopped and exits 0.
  • Instruments: devops_cli_brain_task_runs_total, devops_cli_brain_task_last_success_timestamp_seconds, devops_cli_brain_entries_changed_total, devops_cli_brain_keys_removed_total, devops_cli_brain_undurable_entries.
  • Spec in openspec/specs/project-brain/upkeep/spec.md.

Target Subsystem

SDLC, Git & PR Governance (roadmap upkeep), with Kubernetes manifests in k8s/devops/.

Existing Tool Considered

Argo CronWorkflows and WorkflowTemplates (v4.1.5, the schedules and mutexes fields), the existing consolidate shortlist and judge, the Jev decision point module, valkey-py and OpenTelemetry instruments. #3745 is related: its weekly Service row becomes obsolete. Cost: about 300,000 tokens and 7 hours to build.

Acceptance Criteria

  • A test (T9): a task stopped after k transactions and run again gives the state of a clean run.
  • A test (T10): each selection skips the tracker issue.
  • A test: --dry-run sends 0 requests.
  • A test: repair rebuilds brain-item from fixture blocks with 0 GitHub requests.
  • Cluster drill: the template with the Valkey address 192.0.2.1 (RFC 5737) exits 75 within 61 s and writes nothing to GitHub.
  • Live: brain-daily runs 7 days in a row with result ok or partial, and the 82 open shortlists are judged within 10 days.

Dependencies

#4566 (Argo Workflows runs roadmap pods in devops), #4676. Related: #3745, #3743. Part of the project brain plan #4624.

Source: #4624

Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: Argo Workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-12-01, maintained.
Reason: Searches and the repository facts confirm Argo Workflows gives the CronWorkflow schedule, concurrency policy, mutex and retry by exit code that the daily brain run needs, and the issue already names it as the chosen engine.

Covers:

  • Cron schedule with timezone and startingDeadlineSeconds
  • concurrencyPolicy Forbid for overlapping starts
  • synchronization mutexes to block a manual run
  • retryStrategy keyed on exit code 75
  • WorkflowTemplate steps run one pod per run

Lacks:

  • Brain repair rebuild and key removal logic
  • Consolidate rules, judge and decision points
  • Evaluate score and stale marking
  • Audit log, brain-events XADD and summary comments
  • WATCH/MULTI/EXEC safe-stop transactions

Proposed design

Problem statement

No scheduled job keeps the project brain good. The consolidate judge runs only by hand. Its plan is a local file with no durable copy. The owner asked for repair, consolidate and evaluate as Jobs or Argo Workflows. The change adds the daily run and its tasks.

Acceptance criteria

Requirement: Brain command group

The change SHALL add the command group devops roadmap brain with the subcommands daily, repair, consolidate and evaluate.

Scenario: Each subcommand parses

  • WHEN A test runs each brain subcommand with --help.
  • THEN Each subcommand exits 0 and prints its name and its options.

Requirement: Dry run sends no request

Each brain subcommand SHALL send no request when --dry-run is set.

Scenario: Repair dry run

  • WHEN A test runs devops roadmap brain repair --dry-run with a fake GitHub client and a fake Valkey client.
  • THEN Both clients record 0 requests and the command prints the requests that it would send.

Requirement: Daily task order

The daily subcommand SHALL run repair, signals, consolidate and evaluate in that order.

Scenario: Fake tasks record their order

  • WHEN A test runs devops roadmap brain daily with fake task functions.
  • THEN The recorded order is repair, signals, consolidate, evaluate.

Requirement: Repair rebuilds the index keys

Repair SHALL rebuild brain-item, brain-tool and brain-ref from the blocks with 0 GitHub requests and SHALL leave the brain-sync marker to the sync.

Scenario: Rebuild from fixture blocks

  • WHEN A test runs repair on fixture blocks with a fake GitHub client.
  • THEN The three keys match the fixture, the GitHub client records 0 requests and the brain-sync marker is unchanged.

Requirement: Repair rebuilds the member lists

Repair SHALL rebuild the items field of each brain-tool and each brain-ref from the blocks.

Scenario: One item changes its tool

  • WHEN A test runs repair on blocks where one item moved from tool A to tool B.
  • THEN The brain-tool for tool A holds no item, the brain-tool for tool B holds the item, and each brain-ref items field matches the blocks.

Requirement: Repair removes the keys of an off repository

Repair SHALL remove the brain-item, brain-tool and brain-ref keys of a repository whose alternatives check is off in its first run, before the 1,000-key deletion bound.

Scenario: One off repository and many orphan keys

  • WHEN A test runs repair on one repository whose alternatives check is off with three brain keys and on 1,200 orphan keys.
  • THEN The three keys are absent, repair deletes 1,000 orphan keys, and the run record lists the removal.

Requirement: Repair rebuilds missing insights

Repair SHALL rebuild each missing insight from the tracker comments and SHALL keep the newest version of each insight.

Scenario: One missing insight and two comment versions

  • WHEN A test runs repair on a tracker issue with two comment versions of one missing insight.
  • THEN The store holds one insight and its newest version.

Requirement: Reference link check

Repair SHALL check at most 100 reference links and SHALL mark a reference dead only when two runs return 404.

Scenario: A repeated 404

  • WHEN A test runs repair twice on 150 references and the fetcher returns 404 for one reference.
  • THEN The fetcher records 100 reads in each run and that reference holds dead after the second run.

Requirement: Bounded deletion and TTL repair

Repair SHALL delete at most 1,000 old-kind, orphan, superseded or declined-for-30-days keys and SHALL set a TTL on a brain key of valkey-devops that has none.

Scenario: 1,200 orphan keys and one key with no TTL

  • WHEN A test runs repair on 1,200 orphan keys and one valkey-devops brain key with no TTL.
  • THEN Repair deletes exactly 1,000 keys and the key holds a TTL.

Requirement: Bounded item block correction

Repair SHALL correct at most 10 item blocks and SHALL read the issue before each write through AlternativesWriter.

Scenario: 15 blocks need correction

  • WHEN A test runs repair on 15 item blocks that need correction and a fake writer.
  • THEN The writer records 10 reads and 10 writes, each write follows the read of the same issue, and the task records 0 model calls.

Requirement: Tracker issue per repository

Repair SHALL create the tracker issue only when its marker is absent and SHALL read the marker first.

Scenario: Two repair runs

  • WHEN A test runs repair twice on a repository with no tracker issue and a fake GitHub client.
  • THEN The client records one issue creation, and the second run records a marker read and no creation.

Requirement: Selections skip the tracker issue

Each roadmap selection SHALL skip an issue that carries the type/epic label and the tracker marker.

Scenario: One tracker issue and one item

  • WHEN A test gives the intake, refine, alternatives and stage selections one tracker issue and one item.
  • THEN Each selection returns the item alone.

Requirement: Consolidate merges by rule

Consolidate SHALL merge tool names with one canonical id, references of one repository and path, and insights whose member sets reach Jaccard 0.5.

Scenario: One canonical id and a shared member set

  • WHEN A test runs consolidate on two tool entries that name one canonical id and two insights that share half of their members.
  • THEN The tool entries become one entry and the two insights become one insight.

Requirement: Consolidate bounds and judge

Consolidate SHALL change at most 200 entries, SHALL judge at most 10 shortlists that carry no judge result and SHALL ask at most 20 Jev questions.

Scenario: 12 unjudged and 3 judged shortlists

  • WHEN A test runs consolidate on 12 unjudged shortlists, 3 judged shortlists and 250 mergeable pairs.
  • THEN The judge records 10 calls, the 3 judged shortlists get no call, the run asks 20 Jev questions and stops at 200 changed entries.

Requirement: Decision points in shadow mode

The decision points brain.merge_same_need and brain.entry_quality SHALL run in shadow mode and SHALL return one band of the closed set.

Scenario: One merge pair and one insight

  • WHEN A test resolves brain.merge_same_need on an ambiguous pair and brain.entry_quality on one insight in shadow mode.
  • THEN Each resolver returns a band, the registry holds both points with mode shadow and no entry changes.

Requirement: Evaluate score

Evaluate SHALL compute the fixed score from freshness, source state, use and support, and SHALL mark an entry stale or weak from that score.

Scenario: An old, unused entry among 300

  • WHEN A test runs evaluate on 300 entries and one entry whose source commit is old and which no job used.
  • THEN That entry holds stale.

Requirement: Evaluate bounds

Evaluate SHALL score at most 300 entries, SHALL ask at most 50 Jev questions and SHALL make 0 generative calls.

Scenario: 350 entries

  • WHEN A test runs evaluate on 350 entries.
  • THEN The run scores 300 entries, asks 50 Jev questions and records 0 generative calls.

Requirement: Stop between transactions

Each task SHALL write each change in one WATCH/MULTI/EXEC transaction, SHALL write a rebuild to a temporary key and RENAME it, and SHALL write the run record and the cursor last.

Scenario: Stop after k transactions and run again

  • WHEN A test stops a repair after k transactions and runs repair again.
  • THEN The keys and the run record equal those of an uninterrupted run.

Requirement: Safe stop on SIGTERM

A task SHALL stop between two transactions on SIGTERM, write result=stopped and exit 0.

Scenario: SIGTERM after the first transaction

  • WHEN A test sends SIGTERM to a repair run after its first transaction.
  • THEN The run record holds result=stopped and the process exits 0.

Requirement: Try again later on a store failure

A task SHALL exit 75 when the Valkey client cannot connect and SHALL send no GitHub request.

Scenario: A refused connection

  • WHEN A test gives a Valkey client that raises a connection error and a fake GitHub client.
  • THEN The task exits 75, the GitHub client records 0 requests and no key is written.

Requirement: Workflow manifests

The change SHALL add WorkflowTemplate roadmap-brain and CronWorkflow brain-daily to k8s/devops/ with the schedule, concurrency policy, start deadline, mutex, active deadline and retry of this issue.

Scenario: Validate the brain manifests

  • WHEN A validator runs uv run devops ci --check --only k8s.
  • THEN The command exits 0 and reports no error for k8s/devops/workflowtemplate-roadmap-brain.yaml and k8s/devops/cronworkflow-brain-daily.yaml.

Requirement: One pod runs the daily tasks

The WorkflowTemplate SHALL run the daily command in one pod with the Service image and the row=brain label.

Scenario: Check the live daily workflow

  • WHEN A live check runs kubectl get workflowtemplate roadmap-brain -n devops -o jsonpath='{.spec.templates[0].container.image} {.spec.templates[0].metadata.labels.row}'.
  • THEN The command prints the Service image and brain.

Requirement: Audit log and events

Each task SHALL write one JSON log line for each change with ids only and SHALL add one XADD to the stream brain-events.

Scenario: One changed insight

  • WHEN A test runs repair on one insight that changed and a fake GitHub client.
  • THEN The log holds one line under logger devops_cli.roadmap.brain with ids and no issue text, and brain-events holds one entry.

Requirement: Summary comments

Each task SHALL write at most 2 summary comments a day, each with at most 40 hidden blocks.

Scenario: One changed insight

  • WHEN A test runs repair on one insight that changed and a fake GitHub client.
  • THEN The client records one summary comment with one hidden block.

Requirement: Brain instruments

The change SHALL expose the five devops_cli_brain_* instruments and SHALL update them on each run.

Scenario: One consolidate run that changes an entry

  • WHEN A test runs a consolidate task that changes one entry and reads the instrument registry.
  • THEN devops_cli_brain_task_runs_total and devops_cli_brain_entries_changed_total each carry one increment and devops_cli_brain_task_last_success_timestamp_seconds is set.

Requirement: No due marks

Repair and consolidate SHALL set no due mark and SHALL leave work that exceeds their bounds for the next daily run.

Scenario: More than 10 unjudged shortlists

  • WHEN A test runs consolidate on more than 10 unjudged shortlists.
  • THEN The store holds no brain-consolidate key and the run records the remaining shortlists for the next daily run.

Requirement: ADR status history

The change SHALL add one dated Fact out of date line to the ## Status History section of ADR 0023 for the due-mark bullet (#5482).

Scenario: ADR 0023 status history

  • WHEN A test runs the ADR body-hash check of the repository.
  • THEN The body hash of ADR 0023 is unchanged and the last line of its Status History is dated, holds Fact out of date: and ends with (#5482).

Requirement: Spec delta

The change SHALL write the spec delta at openspec/changes/4687-brain-daily/specs/project-brain/upkeep/spec.md and MUST NOT edit openspec/specs/.

Scenario: Validate the spec delta

  • WHEN A validator runs uv run openspec validate 4687-brain-daily --strict.
  • THEN The command exits 0 and reports the change 4687-brain-daily as valid.

Requirement: Pending a person after the merge

After the merge, a person SHALL run the cluster drill with the Valkey address 192.0.2.1 and SHALL confirm 7 daily runs with result ok or partial and 82 judged shortlists within 10 days.

Scenario: Cluster drill and seven daily runs

  • WHEN A person runs the cluster drill with the Valkey address 192.0.2.1 and checks the run records after the merge.
  • THEN The drill exits 75 within 61 s and writes nothing to GitHub; 7 brain-daily run records hold result ok or partial; the 82 open shortlists hold judge results within 10 days.

Existing Tool Considered

The alternatives check of 2026-11-26 in the issue body records in-use for argoproj/argo-workflows (Apache-2.0, maintained). The block gives what the tool covers and lacks. The change uses the tool for the daily engine. It builds the repair, consolidate, evaluate, safe-stop, audit, events, link-check and shadow-decision logic itself, which the block lists as lacking. That build costs about 300,000 tokens and 7 hours.

Key questions

  • Which component runs the daily brain tasks?: Argo Workflows runs them. CronWorkflow brain-daily in namespace devops starts WorkflowTemplate roadmap-brain at 02:30 UTC every day. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, CONTEXT.md]
    • Chosen: Argo CronWorkflow. Argo Workflows is in use. It gives the cron schedule, the mutex and the retry by exit code.
    • Rejected: Loop in a Service pod. The owner refused a loop in a Service pod. Only the router and the sweep create a unit of work.
    • Rejected: Plain Kubernetes CronJob. A CronJob gives no step template, no mutex field and no retry by exit code.
  • How does the schedule stop a second brain run and a missed start?: The CronWorkflow sets concurrencyPolicy: Forbid, startingDeadlineSeconds: 3600 and synchronization.mutexes: [brain]. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Forbid and mutex together. Forbid drops an overlapping start. The mutex also blocks a manual run.
    • Rejected: concurrencyPolicy: Forbid only. It covers one CronWorkflow. It does not cover a manual brain repair run.
    • Rejected: Mutex only. A mutex waits for the other run. It does not bound a missed start.
  • Which tasks does brain-daily run, and in which order?: Repair, signals, consolidate and evaluate run in that order. brain-weekly runs aggregate and improve and is outside this item. [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
  • How does one pod run all daily tasks?: The WorkflowTemplate runs the daily command in one pod. That command runs repair, signals, consolidate and evaluate in order. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: One daily command in one pod. ADR 0023 records one pod for all tasks of one run. The command keeps the order.
    • Rejected: A separate pod for each task. It adds pods, labels and retry policy for each task. It breaks the one-pod order.
    • Rejected: A loop in the Service pod. The owner refused a loop in a Service pod.
  • Which existing modules do the new commands call?: The command group joins src/devops_cli/commands/roadmap.py. The tasks call src/devops_cli/roadmap/brain_sync.py, consolidate.py, consolidate_judge.py, decision_table.py, run.py, brain_index.py and src/devops_cli/roadmap/stores/brain_issues.py. Each item block write goes through AlternativesWriter at src/devops_cli/roadmap/alternatives.py:1893. [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/brain_sync.py, src/devops_cli/roadmap/consolidate.py, src/devops_cli/roadmap/consolidate_judge.py, src/devops_cli/roadmap/decision_table.py, src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/brain_index.py, src/devops_cli/roadmap/stores/brain_issues.py, src/devops_cli/roadmap/alternatives.py:1893]
  • What is the current consolidate judge limit for one run?: The limit is 10 shortlists a run. DEFAULT_ROADMAP_CONSOLIDATE_JUDGED sets it at src/devops_cli/config/defaults.py:995. [sources: src/devops_cli/config/defaults.py:995, src/devops_cli/roadmap/consolidate.py]
  • Which mode do the new decision points use at first?: Both brain.merge_same_need and brain.entry_quality start in shadow mode. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, CONTEXT.md]
    • Chosen: shadow. A shadow run records the band and changes no entry. A person compares it with the rules.
    • Rejected: off. No data would show whether the bands fit these points.
    • Rejected: on. No measured bands exist for these points.
  • How does a task keep the store consistent when it stops?: Each change is one WATCH/MULTI/EXEC transaction. Each rebuild writes a temporary key and RENAMEs it. The run record and the cursor are written last. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
    • Chosen: One transaction for each change. A stop lands between two changes. The store keeps every completed change.
    • Rejected: One transaction for the whole run. The bounds reach 1,000 keys. A long WATCH fails more often.
    • Rejected: No transaction, with an idempotent re-run. A reader sees a half-rebuilt key set.
  • How do the roadmap selections skip the tracker issue?: The tracker issue carries the label type/epic and a hidden marker. Each selection skips an issue that holds both. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, CONTEXT.md]
    • Chosen: Label and marker together. Either one alone can be lost. The two together survive a hand edit of the other.
    • Rejected: Label only. A person can add a priority label by hand.
    • Rejected: Marker only. A person can remove the marker.
  • How does a run handle work that exceeds its bounds?: It sets no due mark. It leaves the work for the next daily run. (best practice) [sources: docs/guidelines/agentic-jobs.md, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
    • Chosen: No due mark. docs/guidelines/agentic-jobs.md gives one due predicate per job and no second list of due work.
    • Rejected: A due mark read by the sweep. No sweep reads a brain due mark after the split. This item does not wait for the brain due predicate.
    • Rejected: A due mark read by the next daily run. The daily CronWorkflow starts at 02:30 UTC by its schedule. A mark adds the second due list that the guideline forbids.
  • Which store holds the brain key that repair gives a TTL?: The cache tier valkey-devops holds it. The index keys live in valkey-roadmap. Each key there has a TTL or one owner. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: valkey-devops. ADR 0023 puts the caches in valkey-devops. The body names that store.
    • Rejected: valkey-roadmap. The index keys of valkey-roadmap are not the keys that the TTL repair names.
  • What is the index marker, and does repair write it?: The index marker is brain-sync, and the sync owns it. No kind brain-built exists. Repair rebuilds the index entries and leaves the marker. [sources: src/devops_cli/roadmap/brain_index.py, src/devops_cli/roadmap/brain_sync.py]
  • Which parts of the repair already exist?: The sync copies each check into an empty index at src/devops_cli/roadmap/brain_sync.py. The removal of the keys of an off repository and the rebuild of the items field do not exist. They are new work. [sources: src/devops_cli/roadmap/brain_sync.py, src/devops_cli/roadmap/brain_index.py, tests/roadmap/test_brain_sync.py]
  • Where does the change write the brain upkeep spec?: The change writes a spec delta at openspec/changes/4687-brain-daily/specs/project-brain/upkeep/spec.md. Only openspec archive writes openspec/specs/project-brain/upkeep/spec.md. (best practice) [sources: CONTEXT.md, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
    • Chosen: A spec delta in the change folder. Only openspec archive writes a living spec.
    • Rejected: Edit the living spec in the pull request. CONTEXT.md reserves the living spec to openspec archive.
  • Where do the WorkflowTemplate and the CronWorkflow live?: They live in k8s/devops/, beside the other roadmap Job manifests. [sources: k8s/devops/cronjob-runner.yaml, k8s/devops/cronjob-stage.yaml, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
  • Which ADR record changes for the removed due mark?: The change adds one dated Fact out of date line at the end of the ## Status History section of ADR 0023. The line covers the due-mark bullet (feat(roadmap): track the roadmap pipeline split into jobs #5482). The body of the accepted record does not change. (best practice) [sources: docs/adr/README.md, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
    • Chosen: One Fact out of date line in Status History. docs/adr/README.md allows only a dated line at the end of the Status History. It gives the Fact out of date form for a bullet that is no longer true.
    • Rejected: Edit the due-mark bullet in the body. docs/adr/README.md freezes the body of an accepted record. The body-hash check fails.
    • Rejected: Leave ADR 0023 unchanged. The due-mark bullet would stay wrong. docs/adr/README.md says the same pull request adds the line.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4566, #4676

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/high
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The brain degrades without daily upkeep, but the system still functions and the owner has not flagged it as urgent.
    • Value: Medium. Automates manual maintenance and prevents silent data drift in the roadmap brain.
    • Effort: High. Requires new commands, a CronWorkflow, repair and evaluate logic, audit, safe-stop handling, and a spec.
    • Related: feat(roadmap): run the reconcile sweep on a cluster schedule #4574, which asks for a different change. Both add a CronWorkflow for a roadmap job on a cluster schedule, but #4574 schedules the reconcile sweep while the candidate schedules brain repair, consolidate, and evaluate.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Scope from the content freshness plan (2026-11-11)

    This issue is child 17 of #4880, the content freshness tracker. The scope adds document citations and the scheduled document rules to the daily run.

    Why

    Brain-daily repair rebuilds item, tool and reference entries, but it does not check document citations. A moved or changed span keeps a stale citation until someone sees it. Nothing runs the scheduled document rules.

    New scope

    1. Repair runs one git diff --name-status -M <last>..<head> for each run. It intersects the result in memory with the cited paths (at most 300 entries).
    2. It marks each citation stale, moved or removed, and re-anchors it with the citation module of feat(roadmap): re-anchor a stale citation that matches one line #4479.
    3. A generated citation heals when git diff --quiet <commit> HEAD -- <generated_from> fails. Repair then asks the resolver of feat(ai): generate the project digest from code at run time #3904 again and files no issue.
    4. Evaluate adds the features "changed span", "superseded ADR" and "knowledge base drift".
    5. A content step runs devops docs drift --format json (feat(docs): devops docs drift reports the drift that no PR check finds #4920) at the main head and sets the gauge devops_cli_docs_drift_findings.

    No new key family: below 10,000 entries the diff is enough, and weekly improve runs the command again. The bounds of this issue stay: at most 60 GitHub requests, 0 model calls and 600 s. Update k8s/README.md and docs/ROUTINE_TASKS.md.

    Acceptance added

    • The acceptance of this issue stays.
    • A test moves a cited span and sees repair re-anchor it with 0 GitHub requests.
    • A test changes the source of a generated page and sees the citation heal with no issue.
    • The gauge has one series for each rule.

    Depends on: #4920, #4479, #3904, and the dependencies that this issue already names.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches point to Argo Workflows as the Kubernetes-native workflow engine for scheduled, cron-driven workflows, and the issue itself already builds on it (#4566, ADR 0008 and ADR 0021 run roadmap jobs as cluster pods). It covers the scheduling and orchestration half of the need, but none of the brain repair, consolidate, evaluate, audit or safe-stop logic, which this issue must still write.

    The repository already uses this tool.

    Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows)

    • License: Apache-2.0
    • Last activity: 2026-11-14
    • Maintained: yes

    Covers:

    • A CronWorkflow with cron schedules, timezone, concurrencyPolicy, startingDeadlineSeconds and activeDeadlineSeconds for a daily run
    • A WorkflowTemplate whose steps run repair, signals, consolidate and evaluate in sequence in one pod
    • synchronization.mutexes to keep one brain run in flight
    • retryStrategy limited to a given exit code, so a failed run can be retried selectively

    Lacks:

    • The brain repair logic: rebuilding brain-item, brain-tool and brain-ref, link checks, old-key deletion, TTL repair, tracker issue creation
    • The consolidate rules and the 10-shortlist judge run, and the evaluate rules with their scores
    • WATCH/MULTI/EXEC transactions, temporary-key plus RENAME rebuilds, and the stop-between-transactions safe stop on SIGTERM
    • The audit trail: JSON log lines, XADD to brain-events, and summary comments with hidden blocks on the tracker issue
    • The devops_cli_brain_* instruments, the brain-repair/brain-consolidate due marks, and the document-citation scope added by feat(docs): track current content and brain-fed reference docs #4880

    Tools considered:

    Searches run:

    • Argo Workflows CronWorkflow mutex concurrencyPolicy scheduled workflow, results: 5
    • argo-workflows cron workflow documentation synchronization mutexes, results: 5
    • CronWorkflow argo-workflows.readthedocs.io fields schedules timezone concurrencyPolicy, results: 5
    • github argoproj argo-workflows docs cron-workflows.md, results: 5
    • Argo Workflows CronWorkflow, results: 5
    • kubernetes workflow engine cron schedule concurrencyPolicy mutex retryStrategy workflow template, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 46c62f3 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  8. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Dependency decision: remove #4574 from this item.

    The owner approved the pipeline split on 2026-11-13. In that design, no job writes a due mark, and due_jobs is the only source of due work. #4574 runs due_jobs and reads no due mark (owner decision of 2026-11-13 in #4574). So no sweep reads brain-repair or brain-consolidate, and this item does not need #4574.

    Scope change:

    Dependencies: #4566, #4676. #4574, #5482, #5502, #5504 and #6596 are sources, not dependencies of this item.

  9. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  10. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Requirement for repair, from the build of the brain index (#4676, pull request #7320, 2026-11-26):

    • The index removes nothing. The entries of a repository whose alternatives check goes off, for example because the repository becomes private, stay until their TTL ends after 45 days. Repair must remove the brain-item, brain-tool, brain-ref and brain-events keys of such a repository in its first run after the change. fix(roadmap): remove cached issues when a repository becomes private #7298 holds the same case for the issue cache, with the bound of 1 hour of the snapshot.
    • An item that changes its tool stays in the items field of its old brain-tool hash until that hash is written again or expires. Repair rebuilds the items of each tool and each reference from the blocks.
  11. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  12. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    Design check, 2026-11-26

    Body, 2 corrections: the judge limit is at src/devops_cli/config/defaults.py:978. The index has the marker brain-sync and no kind brain-built (src/devops_cli/roadmap/brain_index.py:56-60).

    Refine block

    • The scenario of "Bounded deletion and TTL repair" expects brain-built as the last key.
    • The same requirement sets a TTL on a valkey-devops brain key. The index keys are in valkey-roadmap. Not verified: which store the body means.
    • The rebuild of brain-item, brain-tool and brain-ref exists in part: the sync copies each check into an empty index (src/devops_cli/roadmap/brain_sync.py:219). The removal and the rebuild of items do not exist.

    Dependencies: #4676 is closed. #4566 is open. It waits for #5289 (open). dan-petty/homelab#320 closed on 2026-11-27.

    Open question: the scope comment of 2026-11-12 uses #4920 (open). The body does not name it.

  13. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  14. added
    status/ready
    and removed
    status/new
    on Dec 1, 2026
  15. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/roadmapsource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions