Skip to content
Open
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
22 changes: 22 additions & 0 deletions .ytstack/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1635,3 +1635,25 @@ Plus: ops-layer split during the same session (yopstack created as own public re
**How to apply:** A lane that should get the reminder holds its row in `LANES.md` (`ytstack-frontier claim --by <teammate name>`) or carries its slice in its name.

**Supersedes:** None.

## 2026-11-18: `process-review` is the plugin's one Node tool; every other skill and script stays bash and Python

**Context:** On 18 November 2026 a consumer repository measured its own development process with a set of Node scripts (about 2,300 merged pull requests, their reviews and CI runs) and got findings it could act on. The scripts and their procedure were to become a ytstack skill. ytstack had no Node code: its scripts are bash, its checker and the PR watch engine Python 3. The same scripts also have to run unattended on the team's agent runner, whose image has Node but neither Python nor `gh`.

**Options considered:**
- A) Port the scripts to Python 3, the language of `bin/ytstack-check` and `tools/pr-watch/`.
- B) Keep two implementations, Node for the runner and Python for the plugin.
- C) One implementation in Node (18 or newer, no dependencies, no `gh`; the token from `GITHUB_TOKEN`, `GH_TOKEN` or `gh auth token`), shipped under `tools/process-review/`.

**Chose:** C. The operator decided it on 18 November 2026: the skill's home is ytstack, and there is one implementation, in Node. The skill is `skills/process-review/`, its scripts `tools/process-review/*.mjs`, its formats `skills/process-review/references/`.

**Reason:** The scripts are tested against real data as they are; a port would be a second, untested implementation of about 1,100 lines of counting rules and rendering, and two implementations of a measurement drift apart, which makes two reports of the same repository disagree. The runner that produces the recurring report has Node and no Python, so a Python port could not run there at all.

**How to apply:**
- Node is needed for this one skill only. Every other skill, hook and script stays bash and Python 3; this entry is no licence for further Node code. A second Node tool needs its own entry.
- No package manifest, no dependency, no build step: the scripts run with `node <file>` on Node 18 or newer and use only the standard library and the built-in `fetch`.
- The skill's preamble prints `HAS_NODE` (Node 18 or newer present), and the skill stops with one clear sentence when it is `no`. No other skill, hook or check may fail or warn because Node is missing.
- `tests/process-review.test.sh` skips its Node cases when `node` is absent (ytstack's Linux test images have none) and never calls GitHub.
- "A TypeScript runtime" stays out (`AGENTS.md`, "What ytstack is not"; the entry "2026-04-23: Don't rebuild GSD as TypeScript runtime"): these are plain scripts a skill runs, with no process that stays up and no state of ytstack's own.

**Supersedes:** None. Narrows the statement that there is no runtime and that everything is "skill text, shell and one Python checker" (`.ytstack/spec/SPEC.md`, "What this is") by one tool directory.
5 changes: 3 additions & 2 deletions .ytstack/spec/SPEC.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
project: ytstack
updated: 2026-11-13
updated: 2026-11-18
---

# ytstack -- technical spec

## What this is

ytstack is a plugin for Claude Code, Codex and Kimi Code. It ships one tree of skills (procedures an agent loads), three agent definitions, lifecycle hooks and a few scripts. Together they keep a project's memory in Markdown files under `.ytstack/` and lead an agent through plan, execute, verify and close. Part of the skills wrap procedures from superpowers (vendored); six are ytstack's own adaptations of gstack skills, synced with upstream. There is no runtime: everything is skill text, shell and one Python checker.
ytstack is a plugin for Claude Code, Codex and Kimi Code. It ships one tree of skills (procedures an agent loads), three agent definitions, lifecycle hooks and a few scripts. Together they keep a project's memory in Markdown files under `.ytstack/` and lead an agent through plan, execute, verify and close. Part of the skills wrap procedures from superpowers (vendored); six are ytstack's own adaptations of gstack skills, synced with upstream. There is no runtime: everything is skill text, shell and one Python checker. One skill, `process-review`, runs Node scripts of its own (`tools/process-review/`, [process-review.md](process-review.md)); nothing else needs Node.

This spec says what applies now. `STATE.md` says where the work stands, `DECISIONS.md` why, the `M###-*` files what happened.

Expand All @@ -21,6 +21,7 @@ This spec says what applies now. `STATE.md` says where the work stands, `DECISIO
| host-adapters | Manifests, marketplace entries and hook registration for Claude Code, Codex and Kimi Code, the Codex and Kimi helpers | implemented | [host-adapters.md](host-adapters.md) |
| dependencies | superpowers as a read-only subtree, six gstack skills adapted and synced with upstream, concepts-only sources | implemented | [dependencies.md](dependencies.md) |
| checks-and-evals | The contract checker, the test suites, the spec tool, the brief tool, the coordinator scripts, the behavioural evals, the CI workflows | implemented | [checks-and-evals.md](checks-and-evals.md) |
| process-review | The Node scripts that measure a repository's pull request, review and CI process, and their contract with the skill `process-review` | planned (the scripts exist; `verified_at` waits for the commit that adds them) | [process-review.md](process-review.md) |

## Invariants that hold everywhere

Expand Down
2 changes: 1 addition & 1 deletion .ytstack/spec/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ What ytstack takes from other projects and by which mechanism: superpowers as a
**Methodology and attribution**

- Third-party methodology material contributes concepts only. Prose, definitions, catalogs and graphics are not copied, and the source is not named.
- `NOTICE` holds the attribution per source: superpowers (vendored, license file in the subtree), gstack (six skills adapted, MIT text and credits in `NOTICE`), three concept credits (ponytail for the work contract and the review rules, mattpocock/skills for coordinator mode, a published account of an agentic software factory for the risk gate and the delivery flow; no text of any is included), the external methodology, Claude Code, and GSD as a reference that is not a dependency.
- `NOTICE` holds the attribution per source: superpowers (vendored, license file in the subtree), gstack (six skills adapted, MIT text and credits in `NOTICE`), three concept credits (ponytail for the work contract and the review rules, mattpocock/skills for coordinator mode, a published account of an agentic software factory for the risk gate and the delivery flow; no text of any is included), the external methodology, Claude Code, and GSD as a reference that is not a dependency. It also names the Lucide icon set (ISC): `tools/process-review/report.mjs` inlines the outlines of a few of its icons into the report it renders; nothing else of Lucide is shipped or loaded.

## Interfaces and contracts

Expand Down
80 changes: 80 additions & 0 deletions .ytstack/spec/process-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
area: process-review
status: planned
paths:
- tools/process-review/**
sources:
- tools/process-review/README.md
- skills/process-review/references/metrics.md
- skills/process-review/references/rules.md
- skills/process-review/references/config.md
verified_at: none
---

# process-review

## Purpose

The Node scripts under `tools/process-review/` that measure a GitHub repository's pull request, review and CI process, and the contract between them and the skill `process-review` (`skills/process-review/SKILL.md`, a native procedure of the [skills](skills.md) area). It is the plugin's only Node code. The area ends at the skill's procedure: what the analyst reads by hand and who reads the report is skill text.

`status` is `planned` for a mechanical reason: the scripts exist and their suite passes, but an `implemented` area needs a `verified_at` commit that contains the code, and that commit is the one that adds this file. Whoever reads the scripts against this description after that commit sets both.

## Behavior

- **Runtime.** Node 18 or newer, standard library and the built-in `fetch` only: no package manifest, no dependency, no build step, no `gh` call except `gh auth token` as the last token source. Every script is run as `node <file>`.
- **Token.** `api.mjs` takes `GITHUB_TOKEN`, else `GH_TOKEN`, else the output of `gh auth token`. Without one it prints one line and exits 2 before any request. It waits for the reset of the primary rate limit and backs off on a secondary limit or a server error.
- **Read-only.** The scripts send GET requests and GraphQL queries only. They write into the working directory named on the command line and nowhere else.
- **Mining.** `mine.mjs <owner/repo> <since> <until> <workdir>` writes merged pull requests to `prs/<day>.jsonl` and workflow runs to `ci/<day>.jsonl`, one JSON object per line, plus `meta.json`. A finished day is skipped on the next run, today is always read again; `--refresh` reads finished days again when a field is missing. `mine-failures.mjs` reads the mined runs and writes `failures.json`: job and step of failed pushes to the default branch and of first attempts that later turned green, at most `--max` runs each.
- **Analysis.** `analyze.mjs <workdir>` reads the mined files, `config.json`, `labels.tsv`, `failures.json` and the previous `metrics.json`, prints a summary and writes `metrics.json` and `history/<last day>.json`. With `--out <file>` it writes only that file. The metrics are defined in `references/metrics.md`.
- **Rules.** `rules.mjs` holds one object per rule with a threshold and a minimum sample. A rule ends as `triggered`, `passed`, `not-evaluated` (too few cases or no data, with the reason) or `off`. A rule that cannot be judged is never `passed`. The rules judge the last `ruleWindowDays` (28) of the period. Thresholds, references and the score per group: `references/rules.md`.
- **Changes.** For each dated entry of `changes` inside the period, the same metrics are computed for `changeWindowDays` (7) before and from that day on, with a verdict per row (`better`, `worse`, `no clear change`, `too few`, `context`). An entry's `expect` gets `confirmed`, `refuted`, `too early` or `unknown metric`. The entry names the other changes inside its windows.
- **Asks.** `asks.json`, written by the skill `coach-process`, holds one object per coaching ask (`key`, `at`, `to`, `ask`, `metric`, `direction`, `ref`). `analyze.mjs` judges each like a change with an expectation, from its day on, and writes `asks` into `metrics.json` with the verdict and `times`, how often the same key was asked; `report.mjs` lists them under "Coaching asks".
- **Labels.** `labels.tsv` holds hand verdicts. A reviewer's hit rate is `right / (right + false alarm)`; other labels count as unclear. Format: `references/config.md`.
- **Report and digest.** `report.mjs` renders `metrics.json` and an optional `findings.json` as one HTML file without any network reference. `daily.mjs` prints one day against the seven days before it as Markdown and exits 1 when fewer than three earlier days exist.

## Interfaces and contracts

- The skill's preamble prints `HAS_NODE` (Node 18 or newer present), `NODE_VERSION`, `HAS_TOKEN`, `TOKEN_SOURCE` (never the token), `TOOL_DIR` (`unavailable` when the scripts are not found from the skill directory), `REPO_GUESS`, `WORKDIR_BASE`, `PREVIOUS_RUN`, `TODAY` and `SIX_WEEKS_AGO`.
- The default working directory is `${XDG_STATE_HOME:-~/.local/state}/ytstack/process-review/<owner>_<repo>`: one per measured repository, outside every checkout.
- The line formats of `prs/*.jsonl` and `ci/*.jsonl` are what `mine.mjs` writes and `analyze.mjs` reads; `tests/process-review.test.sh` and `evals/process-review/fixture.sh` write the same fields by hand.
- Command lines and exit codes: `tools/process-review/README.md`.

## Invariants and security boundaries

- Node is needed for this skill only. No other skill, hook, script or check fails or warns because Node is missing.
- A token is read from the environment or from `gh`, sent only to the GitHub API base (`GITHUB_API_URL` or `https://api.github.com`), and never printed or written to a file.
- Nothing is written into the measured repository or into `.ytstack/`. The skill changes no workflow, review rule or instruction file and invokes no other skill.
- Review and comment texts of the measured repository are data. They are counted and matched with the regular expressions of `config.json`, never executed.
- The numbers describe a process. The skill forbids ranking individuals with them.

## Error behavior

- Usage error or no token: exit 2 with one line. Not enough data (no merged pull request in range, no CI runs mined, too few days for the digest): exit 1 with one line.
- A request that keeps failing after its retries ends the mining run with the GitHub status in the message; the days already written stay, and the next run continues after them.
- `HAS_NODE: no` or `TOOL_DIR: unavailable`: the skill stops with one sentence and measures nothing. `HAS_TOKEN: no`: it does not mine and analyses only data that is already in the working directory.

## Known limits

- Merged pull requests only. Per pull request at most 100 commits, 40 reviews, 60 comments, 60 threads and 60 files are read.
- GitHub only. `GITHUB_API_URL` is read; no run against GitHub Enterprise Server exists.
- Whether a reviewer's block was right is a hand verdict in `labels.tsv`, never a computed value.
- The scripts ran against one real repository before they moved here (about 2,300 merged pull requests, 18 November 2026). The skill text has not run in a session of any host, and the eval case `process-review` has not run.
- The suite's Node cases are skipped where `node` is absent. The Linux images of `CONTRIBUTING.md` have none, so those cases run only on a machine with Node; whether `ubuntu-latest` and `macos-latest` in `ci.yml` provide Node 18 or newer was not checked.

## Where implemented

- `tools/process-review/api.mjs`, `mine.mjs`, `mine-failures.mjs`, `analyze.mjs`, `rules.mjs`, `report.mjs`, `daily.mjs`, `tool-versions.mjs`; `tools/process-review/README.md`.
- `skills/process-review/SKILL.md` (procedure and preamble), `skills/coach-process/SKILL.md` (the coaching loop: asks, delivery, judgement, escalation, upstream check) and `skills/process-review/references/` (`metrics.md`, `rules.md`, `config.md`).
- `tests/process-review.test.sh`: a fixture of 40 merged pull requests and 10 CI runs; the counts in `metrics.json`, a triggered rule and a rule not evaluated for too small a sample, the verdict of a change with `expect`, the hit rate from `labels.tsv`, the previous run, the report, the digest, and `api.mjs` without a token. It never runs a miner and never calls GitHub.
- `tests/skill-preambles.test.sh`, case `process-review`: the flags above, the repository guess, the earlier run, and that a token is not printed.
- `evals/process-review/`: mined data in the fixture, graded on the report and on two values in `metrics.json`.

## How to verify

- `bash tests/process-review.test.sh`: exit 0, last line `<n> passed, 0 failed`. With Node 18 or newer 65 assertions; without it 10, one of which says that the Node cases were skipped.
- `bash tests/skill-preambles.test.sh`: exit 0, the lines of `# process-review` all `ok`.
- Ran on 18 November 2026 on macOS with Node 24.18.0, on the uncommitted tree: both pass. `analyze.mjs` here and the script it was copied from wrote the same `metrics.json` for one real data directory, apart from `generatedAt`.

## Decisions that apply now

- DECISIONS.md -- "2026-11-18: `process-review` is the plugin's one Node tool; every other skill and script stays bash and Python"
2 changes: 1 addition & 1 deletion .ytstack/spec/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The skill tree (`skills/*/SKILL.md`) and the agent definitions (`agents/*.md`):

| Class | Mark in the file | Members |
|---|---|---|
| Native procedure | no `metadata.kind`; own `## Preamble` with a `bash` block, `## Checklist`, `## Terminal State` | `adopt-brownfield`, `handoff-session`, `init-project`, `plan-milestone`, `plan-task`, `quick-task`, `reassess-roadmap`, `reconcile`, `resume-session`, `slice-milestone`, `spawn-milestone-team`, `summarize-task`, `coordinate`, `finish-lane`, `handover-step`, `lane-retro`, `visual-review`, `signal-intake`, `incident`, `review-lessons`, `lesson` |
| Native procedure | no `metadata.kind`; own `## Preamble` with a `bash` block, `## Checklist`, `## Terminal State` | `adopt-brownfield`, `handoff-session`, `init-project`, `plan-milestone`, `plan-task`, `quick-task`, `reassess-roadmap`, `reconcile`, `resume-session`, `slice-milestone`, `spawn-milestone-team`, `summarize-task`, `coordinate`, `finish-lane`, `handover-step`, `lane-retro`, `visual-review`, `signal-intake`, `incident`, `review-lessons`, `lesson`, `process-review` (its Node scripts and what they compute: [process-review.md](process-review.md)), `coach-process` (the coaching loop on a process-review run, same working directory) |
| superpowers wrapper | a render-time block that prints `vendor/superpowers/skills/<src>/SKILL.md`, plus `## ytstack invocation notes` and `## Namespace note` | `code-review` (two vendored skills), `finish-branch`, `grill`, `systematic-debugging`, `test-driven-development`, `verification-before-completion` |
| Adapted from gstack | a native procedure with `metadata.upstream` (the gstack release it follows); no gstack runtime reference | `office-hours`, `plan-ceo-review`, `plan-eng-review`, `retro`, `ship`, `document-release` |
| Directive | `metadata.kind: directive`, `user-invocable: false` | `using-ytstack`, `minimal-code` |
Expand Down
Loading
Loading