diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 7fd0d36..73d14ad 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1508,3 +1508,22 @@ Plus: ops-layer split during the same session (yopstack created as own public re - The PR watch shows `STALL 1` first and `STALL 2` only a full window after `STALL 1` was shown, as `ytstack-watch` does; the step shown is kept per session (`stall:`). The lane lookup is one `ytstack-frontier owner --pr N,N,...` call per checkout within one 3-second budget, made before the fingerprints are saved; any failure leaves the line without a lane. A comment does not lift a changes request of the same reviewer, in `ytstack-watch` and in `ytstack-finish-lane gates`. `owner` prefers a held row. A fresh worker gets its own worktree: `git worktree add --detach origin/`, `claim --worktree ` (PR #92 independent review). **Supersedes:** None. Extends "2026-11-15: Lane liveness is part of `ytstack-frontier check`, worktree cleanup only prints commands, peers are list lines in `LANES.md` (issue #84)" and "2026-11-15: PR watch bulk registration takes only your own ready PRs; bins are called through `YT_BIN` (issue #85)". + +## 2026-11-15: A coordinator decides what nobody reserved; a person gets only a closed list of escalations, and a question names its source and purpose (issue #78) + +**Context:** A four-day coordinator run (about 500 human prompts, 23 compactions) kept sending decisions to the human that were not his: he corrected that 14 times and asked "what is on me?" 12 more times. A plan sentence that named him as the author of an analysis was read as a reservation of the decision, and a token was requested with neither its source nor its purpose. Step 8 of `coordinate` said when to ask, not who decides; `--decides` was free text and `ask` accepted an empty Context. + +**Options considered:** +- A) More text in Step 8. +- B) A closed list in `PREFERENCES.md` (`escalate:`), a default in Step 8 (the coordinator decides the rest and records it), and the question script enforcing it: `--decides` needs `--because `, `ask` needs `Source:` and `Purpose:` in the Context. +- C) As B, with free-text reasons instead of a list. + +**Chose:** B. The list is `violation, deviation, irreversible, secret, spend`, default all five; a value with another item reads as all five and warns (like `merge_by`, a typo never takes something away from the person). `reserved` stands beside the list and always holds: a plan line reserves only when it says verdict, approval or sign-off, or a standing entry reserves the decision. Question files get `class: escalation|info` and `because:`; `--info ` is for a fact only a person has and decides nothing. A file without `class` reads as `escalation` and stays valid; `check` validates an item against all six, not against the project's list of today. `ask` refuses a Context without both lines also for old files. `ytstack-upkeep` writes its report as `info`; the lesson proposals and the gates of `reassess-roadmap` are `reserved`. The rule is line 6 of the operating checklist, which survives compactions. + +**Reason:** The corrections came after compactions, when only files and injected blocks were left; a sentence in Step 8 alone was what failed. A closed list makes "is this mine?" a lookup, and the script refusing a question without its item or its source and purpose puts the check on the path. C would let every question name a reason. + +**How to apply:** +- Unsure whether something is on the list: the coordinator decides it and says why in the `DECISIONS.md` entry. +- `escalate:` narrows only the five; it cannot add new items. A project that wants more reserves it in the plan or a standing entry. + +**Supersedes:** None. Narrows "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files ...": `questions/` holds what a person decides by the list, not every open point. diff --git a/.ytstack/PREFERENCES.md b/.ytstack/PREFERENCES.md index 01375a4..8a87a45 100644 --- a/.ytstack/PREFERENCES.md +++ b/.ytstack/PREFERENCES.md @@ -19,6 +19,7 @@ minimal_code: on # inject the minimal-code guard (YAGNI ladder, never-cu team: off # off = spawn-milestone-team dispatches worktree subagents (default); on = Claude Code Agent Teams (experimental) upstream_feedback: suggest # this is the ytstack repository: its own artifacts are the place; the channel is for consumer projects merge_by: human # the maintainer merges every pull request here (decided 2026-11-15); no REVIEW.md, no auto_merge +escalate: violation, deviation, irreversible, secret, spend # the full list: the maintainer wants rule and plan breaks, one-way steps, secrets and spend; the rest the coordinator decides (issue #78) ## Model preferences diff --git a/.ytstack/questions/Q001-is-gate-g01-of-m024-the-coordinator-pipeline-wor.md b/.ytstack/questions/Q001-is-gate-g01-of-m024-the-coordinator-pipeline-wor.md index fa852b7..d002384 100644 --- a/.ytstack/questions/Q001-is-gate-g01-of-m024-the-coordinator-pipeline-wor.md +++ b/.ytstack/questions/Q001-is-gate-g01-of-m024-the-coordinator-pipeline-wor.md @@ -12,6 +12,9 @@ blocks: gate G01 (M024-S02, archived 2026-11-15) ## Context +Source: gate G01 of M024 (`archive/2026-11-15/M024/M024-S02-PLAN.md`, line 28) and `STATE.md` +Purpose: decide whether G01 closes once a context-mcp lane went fully through `finish-lane`, which the maintainer agreed to wait for + Gate G01 (`archive/2026-11-15/M024/M024-S02-PLAN.md`, line 28): "The pipeline works against a real pull request host | decides: the operator | how: the first lane of a consumer project finished with it, receipt in that project | lapses: never". Evidence so far, all from context-mcp (meinKontext): a coordinator ran `coordinate` for days with dozens of subagent lanes and about 40 merged PRs on 2026-11-14 (issue #54); PR watch registration and delivery worked from 0.9.2 on (issue #61 comment); `review-lessons` turned a merged PR's finding into a reviewer checklist line; `ytstack-risk route` was adopted but routed every change to `person` until 0.11.0 read the round from the host. Not seen yet: a lane that went through `finish-lane` end to end with an `unattended` merge, and a receipt for it in that project. ## Options diff --git a/.ytstack/spec/artifacts.md b/.ytstack/spec/artifacts.md index 78bd9c8..ea49aa8 100644 --- a/.ytstack/spec/artifacts.md +++ b/.ytstack/spec/artifacts.md @@ -65,7 +65,7 @@ The `.ytstack/` artifact model: the Markdown files that hold a project's memory | `spec/SPEC.md`, `spec/.md` | `init-project` (every area `planned`), `adopt-brownfield` (pointer-only over existing documents; also for a project that has `.ytstack/` and no spec) | the task that changes the area, in its own commits; `reassess-roadmap` sets `verified_at` when it answers the drift report | | `HANDOFF.md` | `handoff-session`; `coordinate` when it rotates (its format with the "Rotation" block of `docs/ux/coordinator-format.md`) | the user; the rotating coordinator appends its workers' reports under "Reports after the rotation"; no hook writes it | | `LANES.md` | `bin/ytstack-frontier claim` or `peer set` (first write) | `bin/ytstack-frontier` (`set`, `release`), one row per call; called by `spawn-milestone-team`, `coordinate`, `finish-lane`; its `## Peers` lines (sessions in other repositories) by `ytstack-frontier peer set` from `coordinate` | -| `questions/Q###-.md` | `bin/ytstack-questions new` (from `coordinate`, `reassess-roadmap`, `review-lessons` (a proposed line for a role file, `blocks:` the finding), and from `bin/ytstack-upkeep --question`, which keeps at most one open or asked file titled `Upkeep found ...`) | the agent fills Context, Options, Recommendation; `ask` and `answer` change the state; the answer text is the human's | +| `questions/Q###-.md` | `bin/ytstack-questions new` (from `coordinate`, `reassess-roadmap`, `review-lessons` (a proposed line for a role file, `blocks:` the finding), and from `bin/ytstack-upkeep --question`, which keeps at most one open or asked file titled `Upkeep found ...`) | `class: escalation` with `because: ` (`--decides --because`) or `class: info` (`--info`); a file without `class` reads as escalation. The agent fills Context (first `Source:` and `Purpose:`, which `ask` requires), Options, Recommendation; `ask` and `answer` change the state; the answer text is the human's | | `standing/-.md`, `STANDING.md` | `coordinate` through `bin/ytstack-standing add`, when the human gives an instruction that holds beyond the task: a new file with `given`, `scope`, `supersedes` and optionally `until`, `until-condition`, `until-check`, `check` (`docs/ux/coordinator-format.md`), by default on the day's `standing/` branch and pull request; appended to `STANDING.md` only where no `standing/` exists | an entry is never edited; a newer one supersedes it by name, an ended one is closed by an entry of `kind: end` (`ytstack-standing end`), readers skip both and an entry whose `until` passed; `STANDING.md` alone stays valid, also as an index, and is read beside the directory | | `handover/-.sh` and its receipt | `handover-step` through `bin/ytstack-handover new`; the receipt by the script when the human runs it | a script that ran is not edited | | `retro/LANES-.md` | `lane-retro`, with a `## Upstream` section like the retro's | appended on a second run of the same day | @@ -189,7 +189,7 @@ Automatic handoffs and the session journal are not artifacts. `hooks/pre-compact - DECISIONS.md -- "2026-11-13: The technical spec is a set of artifacts of its own under `.ytstack/spec/` (M022, issue #36)" - DECISIONS.md -- "2026-11-13: Verification, review and orchestration work are bounded like code (M023, issue #35)" (the `Runs:` line, `## Gates`, `## Review`, the evidence fields of a summary) - DECISIONS.md -- "2026-11-13: `STATE.md` is a pointer with a size bound; history leaves it through `reconcile`, a closed milestone is folded into the spec (M022-S03)"; "2026-11-15: A plan outside `.ytstack/` is detected by a script and mapped by the agent, after one question (M031-S05, issue #54)" (the external plan class); "2026-11-15: `reconcile` writes task-plan skeletons and fixes the STATE pointer, after asking; the logic is `bin/ytstack-reconcile` (issue #76)"; "2026-11-15: A brief for an unplanned task makes the task plan its first deliverable (issue #76)" (the second writer of a task plan) -- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)" (the lanes table is not part of `STATE.md`, which narrows the proposal in issue #34) +- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)" (the lanes table is not part of `STATE.md`, which narrows the proposal in issue #34), narrowed by "2026-11-15: A coordinator decides what nobody reserved; a person gets only a closed list of escalations, and a question names its source and purpose (issue #78)" (`class`, `because`, `Source:` and `Purpose:` of a question file) - DECISIONS.md -- "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)", extended by "2026-11-15: Standing entries end by `until`, `until-condition` or `until-check` and are closed by an entry of `kind: end`; their commands run only in `ytstack-standing list` (issues #73, #74)" - DECISIONS.md -- "2026-04-23: `.ytstack/` location is user-chosen (project vs user vs both)"; "2026-11-15: New artifacts follow the directory a milestone already lives in (issue #70)" - DECISIONS.md -- "2026-05-31: active_slice is plan-task-owned and team-member-guarded (M012 / issue #21-RC1)" diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 8519494..b0d3fa4 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -95,7 +95,7 @@ Everything that tells a contributor whether a change is acceptable: the static c - `bin/ytstack-frontier`: `list` prints lane, state and detail per slice (done, claimed, blocked, ready) of the current milestone (with `none`: the highest roadmap not `done`, `dropped`, `shipped-informally` or `backlog`), then one lesson lane `lesson-F###` per open or planned lesson whose target is a check (blocked without non-empty "Files" and "Verification" in the lesson; listed also without a milestone); `claim` refuses a held lane and names the holder; `claim`, `set` and `release` change one row of `LANES.md` under a lock; `check` validates the file and then prints one `stale:` line per lane that stalls, exit 2 (issue #84): a `running` row whose worktree no longer exists, an `implement` row whose branch had no commit for `--minutes` (default 60, from the claim when that is newer, or from the first sight of its fix round when the row carries a pull request), a `review` or `prepare` row running 3 x `--minutes` since its claim, and a `ready` lane nobody claimed for `--minutes` since a check first saw it (first sights in `/repos//frontier-seen`, outside the tree, under a noclobber lock); `owner --pr N[,N...]` prints the lane whose `PR` cell is `N` or `#N` (a held row before a dropped or merged one; with several PRs one line each, led by the number and a tab), its holder and status and the age of the last commit on its branch (local, else `origin/`) or of the claim when that is newer, the clock of `check` (exit 1 without a lanes file or row; issue #91); `peer set` and `peer list` keep the `## Peers` lines of `LANES.md` (role, repository, address, last contact), list items that no table reader sees. The lock is the file `LANES.md.lock`, created by the shell under noclobber and not by `mkdir`, which is no lock on Ubuntu 26.04 (see `.ytstack/KNOWLEDGE.md`). - `bin/ytstack-plans` (`docs/ux/external-plans.md`): `scan` counts the work rows (task-list items, rows of tables with a status or checkbox column, nothing in a code fence) of `plans/`, `roadmap/` and their variants and prints one line per directory with `verdict=large` from 10 open rows and the answer recorded in `PREFERENCES.md`; exit 0 only for a large directory without an answer. `rows` prints `path:line`, state, id, section and title per row; a relative PATH is read from where the command was started, else from the repository root, and the output names files relative to the root. It writes nothing; the mapping is the agent's (`reconcile`, `adopt-brownfield`). `bin/ytstack-reconcile` (the two migration classes of `reconcile`, issue #76): `skeletons` lists, per open task of a slice that has no task plan at all and no `## Files` of its own, in a milestone not done, dropped, shipped-informally or backlog, the task, the plan to write beside the slice plan and the number of paths found; `--write` (optionally `--slice M###-S##`) writes each in `plan-task`'s format with Files from the task line's backticked paths or the slice plan's `Own:`/`Files:` lines, Spec impact lines per area with `TODO` fields that `ytstack-spec impact` rejects until filled, a `TODO` verification, `skeleton: reconcile `, and never over an existing file. `pointer` says `ok`, `no milestone in progress` or `behind` (exit 10) when `current_milestone` is closed, `none` or older than the newest roadmap `in-progress`; `--fix` sets `current_milestone`, `active_slice` (its first open slice), `active_task: none` and `last_updated` in the pointer block only (the frontmatter, or the `key: value` lines a file without one starts with), adds the keys that are missing there, refuses a file with neither (exit 1, nothing written) and reports what the file says after the write. -- `bin/ytstack-questions`: `new`, `list`, `next`, `ask` (once), `answer` (refused without text under "Answer"), `check`. `bin/ytstack-standing` (`docs/ux/coordinator-format.md`, "standing/"): `add` writes one entry, validated by `ytstack-check --standing` before anything is committed, by default in its own worktree outside the checkout on `standing/` with a commit, a push and one pull request per UTC day (opened through `ytstack-pr-watch create` when `pr_watch=on` and the session has an id, else `gh pr create`; updated when one is open); `--here` and user scope write into the resolved directory only; exit 3 when the commit stands but the push or the PR failed; a new day's branch starts from the newest pending standing branch, an earlier one with unpushed commits is pushed first. `end` writes the closing entry of `kind: end`, also of a pending entry. `list` prints the newest entry's age and the human prompts since (from the coordinate session's counter), the active entries with the pending ones marked (local `standing/*` branches and their upstreams only), then the ended ones, the conditions to check and the failed checks; it is the only place `until-check` and `check` run, and only for a working-tree entry identical to the default branch's (bash in its own process group, killed on timeout, stdin closed, `YTSTACK_STANDING_TIMEOUT` seconds each, default 5, at most ten per call, every one not run says why), `--no-checks` runs none. Its suite uses a stand-in for `gh`, a local bare remote behind an `insteadOf` URL and the real `ytstack-pr-watch create`. +- `bin/ytstack-questions`: `new` (`--decides` needs `--because` with an item of `escalate` or `reserved`, exit 64 otherwise; `--info` writes `class: info`), `list`, `next`, `ask` (once, and refused while `## Context` has no `Source:` or no `Purpose:` line with a value), `answer` (refused without text under "Answer"), `check` (also `class` and `because`; a file without them is valid). `bin/ytstack-standing` (`docs/ux/coordinator-format.md`, "standing/"): `add` writes one entry, validated by `ytstack-check --standing` before anything is committed, by default in its own worktree outside the checkout on `standing/` with a commit, a push and one pull request per UTC day (opened through `ytstack-pr-watch create` when `pr_watch=on` and the session has an id, else `gh pr create`; updated when one is open); `--here` and user scope write into the resolved directory only; exit 3 when the commit stands but the push or the PR failed; a new day's branch starts from the newest pending standing branch, an earlier one with unpushed commits is pushed first. `end` writes the closing entry of `kind: end`, also of a pending entry. `list` prints the newest entry's age and the human prompts since (from the coordinate session's counter), the active entries with the pending ones marked (local `standing/*` branches and their upstreams only), then the ended ones, the conditions to check and the failed checks; it is the only place `until-check` and `check` run, and only for a working-tree entry identical to the default branch's (bash in its own process group, killed on timeout, stdin closed, `YTSTACK_STANDING_TIMEOUT` seconds each, default 5, at most ten per call, every one not run says why), `--no-checks` runs none. Its suite uses a stand-in for `gh`, a local bare remote behind an `insteadOf` URL and the real `ytstack-pr-watch create`. - `bin/ytstack-finish-lane`: one step per call (`leftovers`, `commit`, `push`, `open-pr`, `wait-head`, `body-check`, `gates`, `merge`, `route`); every gate is read from GitHub through `gh` at the moment of the call, and `merge` passes the reviewed commit to the host so that a moved head cannot be merged. `route --lane [--pr ] [--report ]` reads the lane's worker (the author) and plan from `LANES.md` and runs `bin/ytstack-risk route`; with `--pr` it passes the pull request on, and a lane without a plan file is routed from the host's reviews. With a technical spec it then checks the spec delta and prints `spec:` lines: every plan of the lane that belongs to the range (changed in it, or a commit `:` in it; a slice lane's task plans too) with a "Spec impact" through `ytstack-spec impact --base --head`; then every area the diff touches (`--no-renames`) needs its area file or a source in the diff, a plan of the range with `none -- ` for the files of its commits, or `Spec: none -- ` in the worker's report; a path the report names is the area file or a source of its area, and in the diff. Each gap is a `reason: spec` line and turns `unattended` into `person` (exit 10). When `REVIEW.md` keeps a "Checks" section and the diff edits CI without touching `REVIEW.md`, one `checks:` line says so (a note, CI changes go to a person anyway). `leftovers` and `commit` leave the evidence directory out. Its suite uses a stand-in for `gh` and a local bare remote. - `bin/ytstack-handover`: `new` copies `skills/handover-step/template.sh`; `check` is the static verification of a staged script (syntax, unchanged helper block, no raw command, a confirmation of its own before every mutation, no pipe into a shell). The helpers hold the same rule when the script runs: one yes carries one change. - `bin/ytstack-watch`: polls pull requests through `gh` and prints a line only when head, checks, review or mergeability changed; `--once` prints the snapshot with its read time. `--focus N[,N...]` lists those first and reads them every 20 seconds while one is open, the others every `--interval`; `--stall MINUTES` (default 15, 0 off, not with `--once`) prints `#N STALL 1:` when an open pull request had red checks, a conflict or a reviewer whose newest review on the head requests changes for that long without a new head, `STALL 2` after the next window, with the line of `ytstack-frontier owner` at the end (issue #91); a reviewer blocks when the newest of their reviews on the head that is not a comment requests changes (also in `ytstack-finish-lane gates`). `release --commit ` runs `deployed` of "Release" until it names the commit (or `--timeout`, default 900 s), then `healthy` for the settle time, and ends with five receipt lines (`Target:`, `Commit:`, `Arrived:`, `Health:`, `Result:`) with read times. Exit 0 released or no health command, 2 not arrived, 3 unhealthy, 4 no "Release" section, 1 `RUNTIME.md` fails its check. It runs only those two commands and changes nothing. @@ -188,7 +188,7 @@ Not covered by these checks: `claude plugin eval` (costs money). `bash tests/run - DECISIONS.md -- "2026-11-13: Production findings and incidents are skill work on read-only access; a mitigation is a handover script a person runs (M027)". Source of `bin/ytstack-signals`. "2026-11-15: Feedback about ytstack itself goes through one channel with a setting; a script checks the body, the agent posts (M033-S01, issue #55)" is the source of `bin/ytstack-upstream`. - DECISIONS.md -- "2026-11-13: The technical spec is a set of artifacts of its own under `.ytstack/spec/` (M022, issue #36)". Source of `bin/ytstack-spec` and the two spec checks. - DECISIONS.md -- "2026-11-13: Verification, review and orchestration work are bounded like code (M023, issue #35)". Source of `bin/ytstack-brief`. Extended by "2026-11-15: The spec delta is the report's existing `Spec:` label, checked for its form (issue #75)" and "2026-11-15: A brief for an unplanned task makes the task plan its first deliverable (issue #76)". "2026-11-15: `finish-lane`'s route checks the spec delta; a gap routes to a person (issue #75)" and "2026-11-15: The checks inventory is a `## Checks` section of `REVIEW.md`, not an area file (issue #75)" are the source of the `spec:` and `checks:` lines of `ytstack-finish-lane route`, `ytstack-spec impact --head` and the "Checks" rules of `ytstack-risk check`; "2026-11-15: `reconcile` writes task-plan skeletons and fixes the STATE pointer, after asking; the logic is `bin/ytstack-reconcile` (issue #76)" of `bin/ytstack-reconcile`. -- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)". Source of the five coordinator scripts; the pipeline and the watcher support GitHub through `gh` only. Extended by "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)", the source of `check_standing`, by "2026-11-15: Standing entries end by `until`, `until-condition` or `until-check` and are closed by an entry of `kind: end`; their commands run only in `ytstack-standing list` (issues #73, #74)", the source of `bin/ytstack-standing` and the optional keys of `check_standing`, and by "2026-11-15: A plan outside `.ytstack/` is detected by a script and mapped by the agent, after one question (M031-S05, issue #54)", the source of `bin/ytstack-plans`. +- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)". Source of the five coordinator scripts; the pipeline and the watcher support GitHub through `gh` only. Extended by "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)", the source of `check_standing`, by "2026-11-15: Standing entries end by `until`, `until-condition` or `until-check` and are closed by an entry of `kind: end`; their commands run only in `ytstack-standing list` (issues #73, #74)", the source of `bin/ytstack-standing` and the optional keys of `check_standing`, and by "2026-11-15: A plan outside `.ytstack/` is detected by a script and mapped by the agent, after one question (M031-S05, issue #54)", the source of `bin/ytstack-plans`. Narrowed by "2026-11-15: A coordinator decides what nobody reserved; a person gets only a closed list of escalations, and a question names its source and purpose (issue #78)", the source of the `--because` and `--info` checks of `ytstack-questions new`, the Context gate of `ask` and the `class`/`because` lines of `check`. - DECISIONS.md -- "2026-04-23: UX contracts enforced by CI, not convention" - DECISIONS.md -- "2026-05-31: Add `kind: reference` skill class (exempt from procedure-section contract)" - DECISIONS.md -- "2026-11-07: Hooks never write relative to CLAUDE_PROJECT_DIR; volatile state lives out-of-tree, per session and per worktree". Source of the banned shell patterns and the shared-resolver rule in the checker. diff --git a/.ytstack/spec/dependencies.md b/.ytstack/spec/dependencies.md index 03d0247..57accae 100644 --- a/.ytstack/spec/dependencies.md +++ b/.ytstack/spec/dependencies.md @@ -7,7 +7,7 @@ paths: - NOTICE - hooks/lib/git-ctx.sh - bin/ytstack-gstack-diff -verified_at: 39275b7 +verified_at: 97beca9 --- # dependencies diff --git a/.ytstack/spec/hooks-and-state.md b/.ytstack/spec/hooks-and-state.md index 01e5f77..8cd1f17 100644 --- a/.ytstack/spec/hooks-and-state.md +++ b/.ytstack/spec/hooks-and-state.md @@ -31,7 +31,7 @@ The lifecycle hooks under `hooks/` and the shared library `hooks/lib/git-ctx.sh` - `yt_resolve_yt_dir` finds the `.ytstack` directory: `/.ytstack` first (scope `project`), else `~/.ytstack/projects/` (scope `user`), else none. A linked worktree uses its own copy, not the main checkout's. - Volatile state lives outside the tree under `/repos//worktrees//sessions//`. `yt_state_base` defines the order of candidate bases. A missing session id becomes `nosession`. - If the base cannot be created, the state directory falls back to `/.ytstack/.local` when the checkout has a `.ytstack`, else to a per-user temp directory. `yt_ensure_gitignore` adds the ignore line for that fallback. Skills call it, hooks do not. -- `yt_pref` reads one key from `PREFERENCES.md` (`key: value` or `key=value`; quotes and a trailing comment are stripped). `yt_prefs` reads the ceremony dials and sets `YT_PREF_MERGE_BY` (default `risk`) and `YT_PREF_EVIDENCE_DIR` (default `.ytstack/evidence`). An invalid value is replaced by its default and reported in `YT_PREF_WARNINGS`; an invalid `merge_by` is replaced by `human`, so that a typo never merges without a person. `yt_upstream_feedback` (called by `yt_prefs`) sets `YT_PREF_UPSTREAM_FEEDBACK` from `PREFERENCES.md`, else from the last `upstream_feedback=` line of `~/.ytstack/config`, else `suggest`, and `YT_PREF_UPSTREAM_FEEDBACK_FROM` (`preferences`, `config`, `default`); an invalid value reads as `suggest`, so that a typo never publishes. `hooks/session-start` injects nothing for it; the injected `using-ytstack` names the channel. +- `yt_pref` reads one key from `PREFERENCES.md` (`key: value` or `key=value`; quotes and a trailing comment are stripped). `yt_prefs` reads the ceremony dials and sets `YT_PREF_MERGE_BY` (default `risk`) and `YT_PREF_EVIDENCE_DIR` (default `.ytstack/evidence`). An invalid value is replaced by its default and reported in `YT_PREF_WARNINGS`; an invalid `merge_by` is replaced by `human`, so that a typo never merges without a person. `YT_PREF_ESCALATE` is the comma separated escalation list (default and fallback for an invalid item: all five of `violation, deviation, irreversible, secret, spend`), so that a typo never takes a class away from the person. `yt_upstream_feedback` (called by `yt_prefs`) sets `YT_PREF_UPSTREAM_FEEDBACK` from `PREFERENCES.md`, else from the last `upstream_feedback=` line of `~/.ytstack/config`, else `suggest`, and `YT_PREF_UPSTREAM_FEEDBACK_FROM` (`preferences`, `config`, `default`); an invalid value reads as `suggest`, so that a typo never publishes. `hooks/session-start` injects nothing for it; the injected `using-ytstack` names the channel. - `yt_epoch` turns an ISO time into seconds with BSD `date -j`, GNU `date -d`, or, for BusyBox, `date -d` on the form `YYYY-MM-DD HH:MM:SS`. - `yt_brownfield_signals` counts up to six signs of an existing codebase and names which file would feed which artifact. The comment above the function lists the counted signals and the hint-only ones. - `yt_commit_ref_pattern` renders a task's commit pattern from `commit_ref_pattern` in `PREFERENCES.md`, or from the default. `yt_task_commits` lists commits whose subject matches it. When none match, it falls back to the commits on the current branch after the merge-base with the default branch, and reports which source it used. diff --git a/.ytstack/spec/skills.md b/.ytstack/spec/skills.md index 040fc55..bd38fbd 100644 --- a/.ytstack/spec/skills.md +++ b/.ytstack/spec/skills.md @@ -61,6 +61,7 @@ Read from `PREFERENCES.md` in the resolved `.ytstack` directory by `yt_prefs` in | `team` | `off`: `spawn-milestone-team` dispatches worktree subagents. `on`: it emits an Agent Teams instruction and requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. | `spawn-milestone-team` | | `merge_by` | `risk` (default): the coordinator merges when `bin/ytstack-risk route` says `unattended` and the host's gates hold, otherwise a person. `human`: always a person. `coordinator`: always the coordinator, except that a `reason: spec` line of the route sends the lane back to the worker first. A value outside the three reads as `human`. | `finish-lane` | | `evidence_dir` | Where a visual review stores its screenshots, default `.ytstack/evidence`, relative to the main checkout. | `visual-review`, `bin/ytstack-risk`, `bin/ytstack-finish-lane` | +| `escalate` | What a coordinator brings to a person (`docs/ux/coordinator-format.md`, "Who decides"): a comma separated subset of `violation`, `deviation`, `irreversible`, `secret`, `spend`, default all five; `reserved` (a plan line that says verdict, approval or sign-off, or a standing entry) always holds. Everything else the coordinator decides and records in `DECISIONS.md`. A value with an item outside the five reads as all five. | `coordinate` (preamble `ESCALATE`, Step 8), `bin/ytstack-questions new` | | `upstream_feedback` | What concerns ytstack itself (`docs/ux/upstream-feedback.md`). `suggest` (default): a draft checked by `bin/ytstack-upstream check`, shown to the person, nothing sent. `file`: searched, then filed or commented at Yesterday-AI/ytstack with `gh`; without a `gh` login, or in a non-interactive, CI or teammate session, it reads as `suggest`. `off`: nothing. Without the key, the last `upstream_feedback=` line of `~/.ytstack/config`; an invalid value reads as `suggest`. `using-ytstack` names the channel at every session start. | `using-ytstack`, `retro`, `lane-retro`, `lesson`, `bin/ytstack-upstream` | ### Non-interactive mode @@ -105,7 +106,7 @@ Read from `PREFERENCES.md` in the resolved `.ytstack` directory by `yt_prefs` in Formats: `docs/ux/coordinator-format.md`. The four skills below are for the session that owns a plan and delegates all of it; none of them writes product code. -- `coordinate` is a loop with a fixed order: start from the standing instructions (the entries of `standing/` in the resolved `YT_DIR`, project or user scope, newest first without superseded ones, and `STANDING.md`), `LANES.md`, the frontier and the questions (never from a conversation summary), read host facts fresh and stamp them with their read time, claim a lane before dispatching it, finish lanes through `finish-lane`, run the factory tools of Step 7 (one table of command, when and skip condition; the preamble prints `MERGE_BY`, `REVIEW_POLICY`, `OWN_REVIEWERS`, `PR_WATCH` with the heartbeat age, `RELEASE` and `SIGNALS`, and `YT_BIN=`, through which it runs every bin): the route before every merge, also one it makes itself outside `finish-lane` (then through `ytstack-finish-lane merge` and `finish-lane`'s rule of who merges), with the PR watch on (flag set and a worker heartbeat under 10 minutes old) register the repository's open pull requests by its own GitHub login, without drafts and do-not-merge labels, to itself as their owning session (`ytstack-pr-watch register --all-open` without `--session`, at the start, after every restart or rotation and after a worker opened one) and otherwise poll through `bin/ytstack-watch`, `ytstack-watch release` after every merge to production, `signal-intake` / `incident` for signals and `review-lessons` after a merge with a bot finding, `lesson` on a red `main` and on every slip of a lane or its own (the open lessons in every status from the preamble's `LESSONS` line, a lesson proposal asked with the daily question, lesson lanes `lesson-F###` dispatched from the frontier with `ytstack-brief render --lesson` and set `fixed` after their merge), ask one question at a time from a question file, write a standing instruction down when it is given, before the next dispatch, with `ytstack-standing add` (a new file in `standing/` on the day's standing branch and pull request, `--here` in user scope; `STANDING.md` only where no `standing/` exists; agent memory is no substitute), close an ended one with `ytstack-standing end`, act on the ended, to-check and failed-check lines its preamble prints from `ytstack-standing list` (with the newest entry's age and the human prompts since), its preamble writes the coordinate session marker (the resolved `.ytstack` and the repository key) the coordinate-mode hooks act on, finds the automatic handoff through `yt_latest_handoff`, and prints the operating checklist of `docs/ux/coordinator-format.md` (the same block `session-start` injects), stop a lane that failed verification twice or needs a third review, and rotate after the first compaction in one step while lanes run: a handoff written from the files with the "Rotation" block of `docs/ux/coordinator-format.md` (PR watch session, background watches, each running worker's address), the successor's Step 3 takes the PR watches over with `ytstack-pr-watch handover --from `, and the old session stays open only as a relay that appends its workers' reports to `HANDOFF.md`. It also prints the sessions in other repositories it works with between `PEERS_BEGIN` and `PEERS_END` (`ytstack-frontier peer list`, the `## Peers` lines of `LANES.md`), carries them under `Peers:` in the Rotation block, and takes progress per phase for a status from `ytstack-status --phases` (issues #81, #84). A pull request other lanes wait on is registered as a focus PR (`register --pr N --focus`, or `ytstack-watch --focus N`); on `STALL 1` it asks the holding lane once for an ETA, on `STALL 2` it releases the lane and claims a fresh worker on the same branch in a new worktree instead of relaying the same instruction again (issue #91). +- `coordinate` is a loop with a fixed order: start from the standing instructions (the entries of `standing/` in the resolved `YT_DIR`, project or user scope, newest first without superseded ones, and `STANDING.md`), `LANES.md`, the frontier and the questions (never from a conversation summary), read host facts fresh and stamp them with their read time, claim a lane before dispatching it, finish lanes through `finish-lane`, run the factory tools of Step 7 (one table of command, when and skip condition; the preamble prints `MERGE_BY`, `REVIEW_POLICY`, `OWN_REVIEWERS`, `PR_WATCH` with the heartbeat age, `RELEASE` and `SIGNALS`, and `YT_BIN=`, through which it runs every bin): the route before every merge, also one it makes itself outside `finish-lane` (then through `ytstack-finish-lane merge` and `finish-lane`'s rule of who merges), with the PR watch on (flag set and a worker heartbeat under 10 minutes old) register the repository's open pull requests by its own GitHub login, without drafts and do-not-merge labels, to itself as their owning session (`ytstack-pr-watch register --all-open` without `--session`, at the start, after every restart or rotation and after a worker opened one) and otherwise poll through `bin/ytstack-watch`, `ytstack-watch release` after every merge to production, `signal-intake` / `incident` for signals and `review-lessons` after a merge with a bot finding, `lesson` on a red `main` and on every slip of a lane or its own (the open lessons in every status from the preamble's `LESSONS` line, a lesson proposal asked with the daily question, lesson lanes `lesson-F###` dispatched from the frontier with `ytstack-brief render --lesson` and set `fixed` after their merge), decide itself, and record in `DECISIONS.md`, what no plan line (only one that says verdict, approval or sign-off) and no standing entry reserves and no item of `escalate` (the preamble's `ESCALATE` line) names, write a question file with its class and item (`--decides --because `, or `--info ` for a fact) otherwise, ask one question at a time from a question file whose Context names its source and purpose, write a standing instruction down when it is given, before the next dispatch, with `ytstack-standing add` (a new file in `standing/` on the day's standing branch and pull request, `--here` in user scope; `STANDING.md` only where no `standing/` exists; agent memory is no substitute), close an ended one with `ytstack-standing end`, act on the ended, to-check and failed-check lines its preamble prints from `ytstack-standing list` (with the newest entry's age and the human prompts since), its preamble writes the coordinate session marker (the resolved `.ytstack` and the repository key) the coordinate-mode hooks act on, finds the automatic handoff through `yt_latest_handoff`, and prints the operating checklist of `docs/ux/coordinator-format.md` (the same block `session-start` injects), stop a lane that failed verification twice or needs a third review, and rotate after the first compaction in one step while lanes run: a handoff written from the files with the "Rotation" block of `docs/ux/coordinator-format.md` (PR watch session, background watches, each running worker's address), the successor's Step 3 takes the PR watches over with `ytstack-pr-watch handover --from `, and the old session stays open only as a relay that appends its workers' reports to `HANDOFF.md`. It also prints the sessions in other repositories it works with between `PEERS_BEGIN` and `PEERS_END` (`ytstack-frontier peer list`, the `## Peers` lines of `LANES.md`), carries them under `Peers:` in the Rotation block, and takes progress per phase for a status from `ytstack-status --phases` (issues #81, #84). A pull request other lanes wait on is registered as a focus PR (`register --pr N --focus`, or `ytstack-watch --focus N`); on `STALL 1` it asks the holding lane once for an ETA, on `STALL 2` it releases the lane and claims a fresh worker on the same branch in a new worktree instead of relaying the same instruction again (issue #91). - `spawn-milestone-team` claims each lane with `bin/ytstack-frontier` before it dispatches, keeps the lane's row current, and looks at the frontier again whenever a lane is verified or merged. - `finish-lane` takes a reported lane to a merged pull request with `bin/ytstack-finish-lane`: review pinned to the host's head, the required lenses, `route` with the worker's report (its spec delta is checked against the diff, so a lane that skipped `summarize-task` and changed an area without its description or a reason goes to a person, under `merge_by: coordinator` back to the worker; a `checks:` line notes a CI edit that the checks inventory of `REVIEW.md` did not follow and goes to the person who merges), the gates read from the host, the merge decided by `merge_by` and the route, then `bin/ytstack-watch release` on the merge commit when `RUNTIME.md` has a "Release" section (in the background; the receipt goes into the report, nothing is rolled back). A merge without a person is reported in one line with class, ceiling and lenses. After a merge it made itself, and when `REVIEW.md` declares own reviewers, it invokes `review-lessons` for the pull request. Before a lane goes back for a review that requested changes, a failed lens or a failed check, it invokes `lesson` (its Step 14). These two are the skills it may invoke. The pipeline supports GitHub through `gh` only; on another host the skill stops after the route. - **The class of a change.** `code-review` prints the floor of `bin/ytstack-risk` and has a reviewer that is not the author end with `Risk:`, `Severity:`, `Reach:` and `Invariants touched:`, read against "Invariants and security boundaries" and "Decisions that apply now" of the touched areas, also when only code moved. The round line records class, invariants and reviewer; a session reviewing its own change writes `by: self`, which routes to a person. On a pull request `finish-lane` and `code-review` post the round and lens lines in the body of a review on the reviewed head, and `finish-lane` routes with `--pr`: the record needs no commit that would move the head away from a head-bound review. Each lens the floor names gets a separate fresh reviewer with the lens brief (`bin/ytstack-brief render --kind review --lens `) and one lens line. @@ -119,8 +120,7 @@ Formats: `docs/ux/coordinator-format.md`. The four skills below are for the sess ## Interfaces and contracts - `docs/ux/skill-structure.md`: frontmatter, required sections, the resolver block, banned preamble patterns, terminal state, artifact states. -- `docs/ux/askuserquestion-format.md`: the four-part question body, option annotations, tiers. -- `docs/ux/agent-structure.md`: agent frontmatter, body sections, size limit. +- `docs/ux/askuserquestion-format.md`: the four-part question body, option annotations, tiers. `docs/ux/agent-structure.md`: agent frontmatter, body sections, size limit. - `hooks/lib/git-ctx.sh`: the comment above each function names the globals it sets. - The worker brief and the report shape: `skills/spawn-milestone-team/brief-template.md`, rendered by `bin/ytstack-brief`; its "Standing instructions" carry the whole text of each entry for the lane's role, pending ones included. Dispatch, report check and verifier prompt: `skills/spawn-milestone-team/SKILL.md`, Steps 5 to 7. - The artifacts skills read and write: [artifacts.md](artifacts.md). @@ -196,5 +196,5 @@ Formats: `docs/ux/coordinator-format.md`. The four skills below are for the sess - DECISIONS.md -- "2026-10-13: Remove generated Codex copies; load the existing skills directly" (one skill tree for both hosts) - DECISIONS.md -- "2026-11-13: The technical spec is a set of artifacts of its own under `.ytstack/spec/` (M022, issue #36)" (the spec steps in the loop) - DECISIONS.md -- "2026-11-13: Verification, review and orchestration work are bounded like code (M023, issue #35)" (the work contract; extends the ceremony entry of 2026-11-07 from code to evidence and review), extended by "2026-11-15: The spec delta is the report's existing `Spec:` label, checked for its form (issue #75)", "2026-11-15: A brief for an unplanned task makes the task plan its first deliverable (issue #76)", "2026-11-15: `finish-lane`'s route checks the spec delta; a gap routes to a person (issue #75)" as narrowed by "2026-11-15: The spec delta of a lane is checked per area, from the plans of its own range (PR #88 review)", and "2026-11-15: The checks inventory is a `## Checks` section of `REVIEW.md`, not an area file (issue #75)" (the `code-review` finding) -- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)", extended by "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)", by "2026-11-15: PR watch bulk registration takes only your own ready PRs; bins are called through `YT_BIN` (issue #85)", by "2026-11-15: Lane liveness is part of `ytstack-frontier check`, worktree cleanup only prints commands, peers are list lines in `LANES.md` (issue #84)" (the peers of `coordinate`), by "2026-11-15: Coordinate mode is a session marker the coordinate preamble writes; the standing hooks act only with it (issue #72)", "2026-11-15: In coordinate mode the operating path is injected and checked by hooks that warn; a lint repeated in three sessions blocks once (issue #76)" and "2026-11-15: Standing entries end by `until`, `until-condition` or `until-check` and are closed by an entry of `kind: end`; their commands run only in `ytstack-standing list` (issues #73, #74)" and "2026-11-15: STALL detection lives in both watchers, owner liveness in `ytstack-frontier owner`; focus PRs are read every tick (issue #91)" (focus PRs and the two STALL steps of `coordinate`) +- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, issue #34)", extended by "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)", by "2026-11-15: PR watch bulk registration takes only your own ready PRs; bins are called through `YT_BIN` (issue #85)", by "2026-11-15: Lane liveness is part of `ytstack-frontier check`, worktree cleanup only prints commands, peers are list lines in `LANES.md` (issue #84)" (the peers of `coordinate`), by "2026-11-15: Coordinate mode is a session marker the coordinate preamble writes; the standing hooks act only with it (issue #72)", "2026-11-15: In coordinate mode the operating path is injected and checked by hooks that warn; a lint repeated in three sessions blocks once (issue #76)" and "2026-11-15: Standing entries end by `until`, `until-condition` or `until-check` and are closed by an entry of `kind: end`; their commands run only in `ytstack-standing list` (issues #73, #74)" and "2026-11-15: STALL detection lives in both watchers, owner liveness in `ytstack-frontier owner`; focus PRs are read every tick (issue #91)" (focus PRs and the two STALL steps of `coordinate`); narrowed by "2026-11-15: A coordinator decides what nobody reserved; a person gets only a closed list of escalations, and a question names its source and purpose (issue #78)" (`escalate`, Step 8 of `coordinate`) - DECISIONS.md -- "2026-11-13: `STATE.md` is a pointer with a size bound; history leaves it through `reconcile`, a closed milestone is folded into the spec (M022-S03)"; "2026-11-15: `reconcile` writes task-plan skeletons and fixes the STATE pointer, after asking; the logic is `bin/ytstack-reconcile` (issue #76)" narrows its rule that `reconcile` leaves the pointer alone diff --git a/CHANGELOG.md b/CHANGELOG.md index ed58779..ca9fd14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 seconds. `coordinate` 0.6.3, Step 7: on `STALL 1` ask the lane once for an ETA, on `STALL 2` release the lane and give the branch to a fresh worker instead of relaying the same instruction again. +- **Who decides** (issue #78): a coordinator decides what no plan line and + no standing entry reserves, and records it in `DECISIONS.md`. A person + gets only what `escalate:` in `PREFERENCES.md` lists (default: a rule or + concept violation, a plan deviation, an irreversible or production step + without a plan line, a secret, spend) and what is `reserved`; a plan line + reserves only when it says verdict, approval or sign-off. The + `coordinate` preamble (0.7.1) prints `ESCALATE`, Step 8 carries the + default, and the operating checklist has the rule as line 6. +- **Question class and context gate** (issue #78): question files carry + `class: escalation|info` and `because:`. `ytstack-questions new --decides` + needs `--because ` and refuses an item that is not on the list; + `--info ` asks for a fact and decides nothing. `ytstack-questions ask` + refuses a question whose Context has no `Source:` or no `Purpose:` line. + Files without `class` stay valid and read as escalation. `ytstack-upkeep + --question` writes its report as `class: info`; `reassess-roadmap`, + `lesson`, `review-lessons` and `handover-step` write theirs with an item. - **Progress per phase** (issue #81): `ytstack-status --phases [--json]` prints done, in review and total per milestone and in total. When a total diff --git a/README.md b/README.md index 1c9f463..58c12a6 100644 --- a/README.md +++ b/README.md @@ -356,6 +356,7 @@ ytstack's milestone / slice / task loop is the default, not a mandate. These key | `upstream_feedback` | `suggest`, `file`, `off` | what concerns ytstack itself: `suggest` drafts an issue and asks you; `file` searches, then files or comments at Yesterday-AI/ytstack (public, so opt-in); `off` sends nothing. Falls back to `upstream_feedback=` in `~/.ytstack/config` | | `merge_by` | `risk`, `human`, `coordinator` | who merges a finished lane: `risk` lets the coordinator merge when `bin/ytstack-risk route` says `unattended` and the host's gates hold, otherwise you; `human` always you; `coordinator` always the coordinator. A value outside the three reads as `human` | | `evidence_dir` | a path, default `.ytstack/evidence` | where a visual review stores its screenshots and their `MANIFEST` | +| `escalate` | a list of `violation`, `deviation`, `irreversible`, `secret`, `spend` (default all five) | what a coordinator brings to you: a rule or concept violation, a plan deviation, an irreversible or production step no plan line covers, a secret, spend. Everything else that no plan line (verdict, approval, sign-off) or standing instruction reserves, it decides and records in `DECISIONS.md`. An item outside the five reads as all five | **Work is bounded like code.** The same contract limits checking, reviewing and orchestrating, and it reaches every worker: `bin/ytstack-brief render` builds the brief for a dispatched agent (a Claude subagent or `codex exec`) from the plan files and includes the contract verbatim, and `bin/ytstack-brief check` validates the worker's report, which has fixed labels (a status, the checks with their exit codes, "Not checked:", the next action). A plan's Verification section names the command, how often it runs and where; execution does not add passes. A review has rounds: the first is complete, the second covers the fix, a third becomes a diagnosis of scope, conflicting rules or solution. A reviewer states the load it assumed and gives a concrete case for every finding; the project's own severity policy decides what blocks. Evidence is a check on a commit in an environment and does not expire because a new session reads it. What only a person can decide is written as a gate (who decides, how, when it lapses); `reassess-roadmap` brings all open gates in one question and reports two numbers, closed by work and accepted. diff --git a/bin/ytstack-questions b/bin/ytstack-questions index 7733ca0..0e5aa33 100755 --- a/bin/ytstack-questions +++ b/bin/ytstack-questions @@ -4,7 +4,7 @@ # # ytstack-questions [-C DIR] list [--state open|asked|answered] # ytstack-questions [-C DIR] next -# ytstack-questions [-C DIR] new --question TEXT --decides WHO [--blocks REFS] +# ytstack-questions [-C DIR] new --question TEXT (--decides WHO --because ITEM | --info WHO) [--blocks REFS] # ytstack-questions [-C DIR] ask # ytstack-questions [-C DIR] answer # ytstack-questions [-C DIR] check @@ -13,12 +13,21 @@ # (default: $PWD). ask and answer change the frontmatter only; the text of an # answer is written into the file by whoever heard it, never by this script. # +# Who decides (issue #78): --decides writes class escalation and needs +# --because, one item of `escalate:` in PREFERENCES.md (default violation, +# deviation, irreversible, secret, spend) or `reserved` (a plan line or a +# standing entry reserves the verdict). Everything else the coordinator +# decides itself. --info writes class info: WHO supplies a fact or takes +# note, the decision stays with the coordinator. +# # Exit codes # list 0; one line per file: id, state, decides, blocks, question (tab # separated); without --state the open and the asked ones # next 0 "" of the oldest open question; 1 none is open -# new 0 the path of the new file; 1 no .ytstack directory; 64 usage -# ask 0; 1 unknown id, or the state is not open (a question is asked once) +# new 0 the path of the new file; 1 no .ytstack directory; 64 usage, +# also --decides without an item of the list +# ask 0; 1 unknown id, the state is not open (a question is asked once), +# or "## Context" has no "Source:" or no "Purpose:" line with a value # answer 0; 1 unknown id, already answered, or no text under "## Answer" # check 0 clean, or "no questions" without the directory; 1 one line per problem @@ -31,6 +40,8 @@ if [ "${1:-}" = "-C" ]; then DIR="${2:-}"; shift 2 || true; fi CMD="${1:-}"; [ $# -gt 0 ] && shift usage() { sed -n '5,10p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; } +# The items --because takes beside the project's list; check knows all of them. +REASONS_ALL="violation|deviation|irreversible|secret|spend|reserved" die() { echo "ytstack-questions: $*" >&2; exit 1; } case "$CMD" in list|next|new|ask|answer|check) ;; -h|--help|help) usage; exit 0 ;; *) usage >&2; exit 64 ;; esac # The resolver falls back to $PWD for a missing directory: refuse it here. @@ -89,6 +100,19 @@ answer_text() { on && NF && $0 !~ /^[ \t]*<.*>[ \t]*$/ { print } ' "$1" } +# context_names