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
32 changes: 20 additions & 12 deletions docs/roadmap/alternatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The verdict is `covers`, `partly` or `none`. For every item except those named b

The model can propose two more verdicts: `rejected` and `in-use`. The job gives each one only when the text confirms it. If the text does not confirm a proposal, the job drops it and keeps the verdict of the reply. The model cannot give either verdict as its own. A reply with one gets one more turn. Refine asks a person nothing about a `rejected` or `in-use` check.

The comment of a `rejected` check names the ADR and keeps the tool URL, because a newer fact can change an ADR.
The block of a `rejected` check names the ADR and keeps the tool URL, because a newer fact can change an ADR.

### What the check reads of the ADRs

Expand All @@ -20,7 +20,7 @@ The request holds the entries as `decisions`, the newest ADR first. The text has

### How the job confirms a proposal

The model proposes `rejected` in the key `adr`, with the number of the ADR that rejected its tool. The job gives `rejected` when `decisions` holds that ADR, an item of its `Considered Options` list names the tool, and no chosen or adopted option names it. A chosen or adopted option that names the tool wins even when it also says `not chosen` or `not adopted`. ADR 0010 names OpenSpec in its chosen option and in other options, so it rejects no OpenSpec. The comment shows the ADR number to a person.
The model proposes `rejected` in the key `adr`, with the number of the ADR that rejected its tool. The job gives `rejected` when `decisions` holds that ADR, an item of its `Considered Options` list names the tool, and no chosen or adopted option names it. A chosen or adopted option that names the tool wins even when it also says `not chosen` or `not adopted`. ADR 0010 names OpenSpec in its chosen option and in other options, so it rejects no OpenSpec. The block shows the ADR number to a person.

The model proposes `in-use` in the key `in_use`. The job gives `in-use` when the title or the body of the item names the tool. It reads the body outside its own block and outside the refine section, because both name the tool of an earlier check. Without the flag of the model, the text of the item never gives `in-use`. The tools in use can (see [The tools in use](#the-tools-in-use)).

Expand All @@ -40,7 +40,7 @@ An item of the type `test`, `docs`, `refactor`, `chore`, `ci` or `perf`, and a `

### The tools in use

Once for a run that checks an item of no skip class, the check reads the inventory of the repository at HEAD. A `covers` or `partly` tool that the inventory holds gets `in-use` with no proposal of the model. An ADR that rejects the tool comes first. The comment and the block say "The repository already uses this tool." The inventory has three sources, the cheapest first:
Once for a run that checks an item of no skip class, the check reads the inventory of the repository at HEAD. A `covers` or `partly` tool that the inventory holds gets `in-use` with no proposal of the model. An ADR that rejects the tool comes first. The block says "The repository already uses this tool." The inventory has three sources, the cheapest first:

1. The SPDX SBOM that the dependency graph of the repository exports (`GET /repos/{owner}/{repo}/dependency-graph/sbom`), with one request. It holds the package URL of each package of a manifest, a lock file or a workflow. A PyPI package matches by its canonical name, an action by its repository (`pkg:githubactions/github/codeql-action/init` is `github/codeql-action`), and the npm package `@<owner>/<name>` by the repository of the same name. A dependency graph that is off gives an empty SBOM.
2. The files under `roadmap.alternatives.inventory_paths` of a clone (`k8s`, `tf`, `.devcontainer` and the tools lock by default). They name the services, images and CLIs that no manifest holds, such as LiteLLM or Grafana. The name of the repository or of the package counts as a whole word in any case, as `git grep -i -w -F` finds it. The Service row uses the clone of its lane. On a workstation, `--source <clone>` gives the clone, and with no clone the check uses the other two sources.
Expand All @@ -59,19 +59,27 @@ A check of an item of no skip class also records `alternatives.adr_hash`, the ha
With `--confirm`, a check does these things:

1. It replaces the block `devops-roadmap-alternatives` in the body of the item and records the check in the job record. One request writes both, so a stop never leaves the new block without the record of the check.
2. It posts one comment, in a separate request after the write, for a first check and for a recheck whose verdict or tool differs from the record of the earlier check. A recheck with the same verdict and the same tool posts no comment: the thread shows only changes. Its block holds the new date, and its record holds the new check time.
2. It posts one comment, in a separate request after the write, for a first check and for a recheck whose verdict or tool differs from the record of the earlier check. A recheck with the same verdict and the same tool posts no comment: the thread shows only changes. Its block holds the new date, and its record holds the new check time. A check of a skip class posts no comment, because it has no evidence.

A check changes no label and closes no issue. A person decides what a tool means for the item.

The comment gives:
The block holds the current result of the check:

- the verdict and the reason of the model for it;
- the tool on one line, with its URL, license, last activity and maintained state, as in the block;
- what the tool covers and lacks;
- one block that GitHub shows closed, `Searches (<count>)`. It holds the tools considered: every tool whose facts the run read, each with its URL, license and last activity. It also holds the answered searches with their number of results. Last, it holds every source of the reply. GitHub shows each URL as a link;
- one sentence that says a person decides what the check means for the item.
- the date and the verdict;
- the skip class, for an item of a skip class;
- the basis of a `rejected` or `in-use` verdict;
- the tool on one line, with its URL, license, last activity and maintained state;
- the reason of the model for the verdict;
- what the tool covers and lacks.

The prompt asks the model for a brief reply: a reason of one sentence, and a few short items in `covers`, `lacks` and `sources`. The check refuses no reply for its length and cuts no text or list of the model. The comment of a skip class is one line, for example `Alternatives check: not-applicable (docs item; no search).`
The comment is the event of a change of the result. It repeats no line of the block. It gives:

- one line. It says that the result in the block of the issue body changed, and what the result was before the check. It also says that a person decides what the new result means for the item;
- one block that GitHub shows closed, `Searches (<count>)`. It holds the tools considered: every tool whose facts the run read, each with its URL, license and last activity. It also holds the answered searches with their number of results. Last, it holds every source of the reply. GitHub shows each URL as a link.

The prompt asks the model for a brief reply: a reason of one sentence, and a few short items in `covers`, `lacks` and `sources`. The check refuses no reply for its length and cuts no text or list of the model.

Refine reads the result from the block, and the evidence from the latest comment of the job, whole. A comment of an older form also holds what the tool covers and lacks. Refine reads them there when the block has no such list.

A check that posts a comment adds a new one. It never changes the comment of an earlier check.

Expand Down Expand Up @@ -100,7 +108,7 @@ The command exits 1 only when it tried items and checked none.
| Flag | What the run does |
| :--- | :--- |
| `--plan` (the default) | Runs the checks and prints them. It writes nothing. |
| `--confirm` | Writes each check to GitHub as soon as the item is checked: its body block, its job record and, for a first or changed result, its comment. |
| `--confirm` | Writes each check to GitHub as soon as the item is checked: its body block, its job record and, for a first or changed result of an item that is no skip class, its comment. |
| `--dry-run` | Makes no request. It prints the requests that a run makes, with placeholders. |

## Where the rules are
Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap/intake.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ A candidate that has no urgent impact receives `P2-Medium` or `P3-Low`. Verified

The model compares each candidate with the items and with the issues that a person closed as not planned. It does not compare a candidate with an issue that has sub-issues, because the sub-issues deliver that issue.

To find the nearest items, intake embeds each item and each candidate. The embedder looks for each vector in the memory of the process, then in Valkey, then in the file `ai/embeddings.db` under the data directory. Only the texts that no cache holds go to the embedding model. The file keeps the vectors between two runs, so a run sends only the texts that changed since an earlier run. Its key is the provider, the model name that the request sends and the SHA-256 of the text, so a changed text, another model or another provider is a miss. A stored vector with a length that differs from the length of the model is a miss too. The file is a cache only: you can delete it at any time. A run removes each vector that no run used for 30 days.
To find the nearest items, intake embeds each item and each candidate. For an item, it embeds the title and the text that a person wrote. That text is the body without the block of the alternatives job and without the section of refine, as in the consolidation job. The text of a job is no sign of a duplicate. The shortlist that the model reads holds the same text. The embedder looks for each vector in the memory of the process, then in Valkey, then in the file `ai/embeddings.db` under the data directory. Only the texts that no cache holds go to the embedding model. The file keeps the vectors between two runs, so a run sends only the texts that changed since an earlier run. Its key is the provider, the model name that the request sends and the SHA-256 of the text, so a changed text, another model or another provider is a miss. A stored vector with a length that differs from the length of the model is a miss too. The file is a cache only: you can delete it at any time. A run removes each vector that no run used for 30 days.

The model can name a possible duplicate. Intake then places the candidate as usual, and the report and the reason comment name the possible original for a person to close. Intake never closes an issue and never drops a candidate. This holds for a new candidate too: intake files it even when it is a possible duplicate.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-17
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Design

## Decisions
- **The block is the result, the comment is the event.** The body block holds what is true now. The comment says that the result changed, what it was before, and gives the evidence of that run. A recheck with the same result writes only the block, as before (#4054).
- **The result before the check comes from the job record.** `alternatives.verdict` and `alternatives.tool` of the item as the run read it give the earlier result. A first check names no check. `_result_changed` reads the same keys, so the line and the gate agree.
- **The sentence about a person stays.** The footer said that a person decides what the check means for the item. It is now the end of the one line of the change, so no text is lost and the comment has no date that the block also holds.
- **The block has blank lines between its parts.** GitHub reads a line after a list item as a part of that item, so `Covers:` and `Lacks:` are each a paragraph. Every reader of the block reads it whole or leaves it out, so no reader parses a line.
- **Refine keeps the record keys.** The request keeps `verdict` and `tool`: the prompt uses them to choose what to do (a `covers` question, a `rejected` ADR). The block holds the rest of the result.
- **Refine reads the whole comment.** The comment is now the evidence only, and the owner rule of 2026-11-17 refuses a cut that drops context.
- **Intake compares the text of a person.** `text_of_a_person` leaves out the block and the refine section, as the consolidation job does. The candidate still goes through the same shortlist and verdict, so a possible duplicate is still flagged.
- **The dry-run plan states the skip class as a condition.** A dry run makes no request, so it cannot know the class of an item. The comment carries the condition that the item is no skip class.

## Rejected alternatives
- **Keep a short comment for a skip class**: the comment repeats the class and the verdict of the block, and a skip class has no evidence. The live census of #6193 shows the 6 `not-applicable` comments are 99% body text.
- **Move the evidence into the block too**: the body would grow by the sources and searches of each run, and stage and refine read the body under a cap. The evidence belongs to one run, so the comment of that run holds it.
- **Remove `verdict` and `tool` from the refine request**: the prompt branches on them, and the model would have to parse them from the text of the block.
- **Cut the comment at a larger cap**: the owner refused hard caps that drop context (2026-11-17).
- **Compare raw bodies in intake and filter the block in the embedder**: `text_of_a_person` already does this for the consolidation job, so a second filter would be a second rule for the same text.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Proposal: #6195

## Why
#6195 is area 2 of #6193. The owner rule of #6193: no job posts the same content to an issue twice, and content in the body of an issue is not in a comment too. The alternatives job breaks it:

- `_block_of` writes the verdict, the skip class, `_basis` and `_tool_line` to the body block. `_comment_of` writes the same `_basis` and `_tool_line` to the comment. A skip-class comment only repeats the verdict and the class of the block.
- Refine sends the record verdict and tool, the block and the comment, so its model gets these facts three times. Refine also cuts the comment to `CONST_ROADMAP_REFINE_MAX_REPLY_TOKENS`, against the owner rule of 2026-11-17 on hard caps.
- Live: 22 of 22 sampled alternatives comments repeat the block. The 6 `not-applicable` comments are 99% body text (1,554 of 1,788 B).

## What Changes
- The body block holds the current result: the date, the verdict, the skip class, the basis, the tool line, the model reason, `Covers:` and `Lacks:`.
- The comment is an event. It posts only when `_result_changed` is true, for an item that is no skip class. It holds the marker, one line that says the result in the block changed and what the record held before, and the folded evidence of the run: the tools considered, the searches with their result counts and every source. It repeats no line of the block. The footer sentence is now a part of that one line.
- A skip-class check posts no comment.
- Refine sends the latest alternatives comment whole, with no cut. The block is the source of the reason, the covers and the lacks. An older comment still holds the covers and the lacks, and refine keeps it.
- `roadmap_refine_proposal.md` and `roadmap_refine_investigation.md` name `block` as the source, tell the model to cite the block and not restate it, and tell it not to write that no alternatives check has run when the block holds a result.
- Intake compares the text that a person wrote (`text_of_a_person`), as the consolidation job does, so the bigger block makes no false duplicate flag. A possible duplicate is still flagged.
- The alternatives dry-run plan lists the comment with the condition that the item is no skip class.

The comment, the block, the refine request and the intake comparison are observable, so the change carries spec deltas.

## Capabilities
- `roadmap-alternatives`: the block, the comment, the skip class and the dry-run plan change.
- `roadmap-refine/alternatives`: the request keeps the comment whole, and the prompts name the block as the source.
- `roadmap-intake-duplicates`: intake compares the text that a person wrote.

## Impact
- A typical check (a reason of three sentences, three covers, three lacks, four searches, three sources) has a block of 857 characters (212 tokens) and a comment of 655 characters (170 tokens). Before, the block had 228 characters (62 tokens) and the comment 1,337 characters (342 tokens). The block grows by about 150 tokens, and the comment drops by about 170 tokens.
- The stage job caps the body at `CONST_ROADMAP_STAGE_BODY_MAX_TOKENS`, and the comments take the room under the cap that the body leaves, so the first request does not grow. The stage window test gives the same counts before and after, within the noise of the timestamps of the messages.
- The largest open issue body holds 55,095 characters, under the refine limit `CONST_ROADMAP_REFINE_MAX_BODY_CHARS` of 65,536.
- Old comments stay on GitHub. Refine reads an old comment and a new comment, and the block of each form.
- No setting, no command and no dependency changes. The change fits one pull request.

## Feasibility
- `src/devops_cli/roadmap/alternatives.py` on main: `_comment_of` writes `_basis(check)` and `_tool_line(check.tool)`, and `_block_of` writes the same two; `_result_changed` already gates the comment in `AlternativesWriter.settle`.
- `src/devops_cli/roadmap/refine/refine.py` `_alternatives_request` cuts the comment with `truncate_to_token_limit(..., CONST_ROADMAP_REFINE_MAX_REPLY_TOKENS)`.
- `src/devops_cli/roadmap/intake/intake.py` `_comparison` gives `issue.body` to `_Entry`, whose `text` goes to `embedding_text` and whose `excerpt` goes to the model. `consolidate.py` `_item` uses `text_of_a_person` from `body_hash.py`.
- `src/devops_cli/roadmap/request_plan.py` `alternatives_requests` lists the comment with the condition `check_changed` only.
- Readers of the comment: refine reads the marker and the whole comment; `comment_repeat.py` and `alternatives._request` read the marker only. Readers of the block: refine (`recorded_check`) reads it whole; `body_hash.py` and `_person_text` leave it out. No code parses a line of either.
- `devops gh api repos/dan-petty/devops-cli/issues?state=open` gives 753 open issues; the largest body holds 55,095 characters.

## Existing Tool Considered
The change uses code that the repository holds: `text_of_a_person` from `body_hash.py`, the `<details>` fold of GitHub Markdown, and the builders of the block and the comment. No open tool covers the split of a job's text between an issue body and a comment. The change deletes the skip-class line of the comment, the heading, the tool line and the footer of the comment, and the cut of the comment in refine.
Loading