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
23 changes: 23 additions & 0 deletions .ytstack/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1061,3 +1061,26 @@ Plus: ops-layer split during the same session (yopstack created as own public re
**How to apply:** SessionStart and PostCompact prepare pending context; UserPromptSubmit emits and removes it at most once. PreCompact and SessionEnd delegate to the shared scripts. Document the tested versions and host limits, including headless SessionEnd #4380, interactive Ctrl+C-twice close and unverified web close paths. Do not add a Kimi `extra_skill_dirs` requirement or external gstack install.

**Supersedes:** The user-level setup proposed in issue #30. The 2026-11-09 shared-source rule and the 2026-11-14 in-tree gstack adaptations remain in force.

---

## 2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)

**Context:** In a busy repository almost every coordinator pull request appended a line to `STANDING.md`. The appends land at the end of the same file, so parallel pull requests conflicted there, and a private repository on the Team plan has no merge queue to absorb it. A consumer (meinKontext) had already moved its instructions to `.ytstack/standing/<YYYYMMDDTHHMMZ>-<slug>.md` with the frontmatter `given`, `scope`, `supersedes` and kept `STANDING.md` as an index, while `coordinate` still read only `STANDING.md`.

**Options considered:**
- A) Keep the single file and rely on a merge queue or on rebasing each pull request.
- B) One file per instruction in `.ytstack/standing/`, the shape `questions/` already has, with `STANDING.md` still read where it exists.
- C) One file per instruction and `STANDING.md` rendered from them on demand.

**Chose:** B, in the consumer's format, so that its files pass unchanged. Name `<YYYYMMDDTHHMMZ>-<slug>.md` (UTC, seconds optional, lowercase slug). Frontmatter `given` (ISO UTC in the minute of the name), `scope` (not empty), `supersedes` (empty, or the name of an earlier entry without `.md`). The body is the instruction. An entry is never edited; a replacement is a new file that supersedes the old one.

**Reason:** Two pull requests that each add an instruction add two files and cannot conflict. Superseding by name keeps the history that a struck-through line kept, without editing an old line. A rendered `STANDING.md` (C) would bring the conflict back on every render.

**How to apply:**
- Readers (`coordinate`, `finish-lane`, `signal-intake`, `handover-step`, `review-lessons`) take the entries newest first and skip every superseded one (`yt_standing` in `hooks/lib/git-ctx.sh`), and still read `STANDING.md` where it exists, also when it is only an index.
- `coordinate` writes a new instruction as a new file, also in a project that has neither form yet. It appends to `STANDING.md` only in a project that has `STANDING.md` and no `standing/` directory.
- `bin/ytstack-risk` routes a change under `.ytstack/standing/` to a person, like `STANDING.md`.
- `bin/ytstack-check --standing [<project dir>]` validates the names, the frontmatter and that every `supersedes` names an earlier existing entry; the full run checks the plugin's own directory.

**Supersedes:** None. Extends the 2026-11-13 coordinator-mode entry: `STANDING.md` is no longer the only place for standing instructions.
7 changes: 4 additions & 3 deletions .ytstack/spec/artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sources:
- docs/ux/runtime-format.md
- docs/ux/signal-format.md
- docs/statusline.md
verified_at: 08dab40
verified_at: 54a25e7
---

# artifacts
Expand Down Expand Up @@ -65,7 +65,7 @@ The `.ytstack/` artifact model: the Markdown files that hold a project's memory
| `HANDOFF.md` | `handoff-session` | the user; no hook writes it |
| `LANES.md` | `bin/ytstack-frontier claim` (first claim) | `bin/ytstack-frontier` (`set`, `release`), one row per call; called by `spawn-milestone-team`, `coordinate`, `finish-lane` |
| `questions/Q###-<slug>.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 |
| `STANDING.md` | `coordinate`, when the human gives an instruction that holds beyond the task | appended; an overtaken line is struck through and dated, not removed |
| `standing/<YYYYMMDDTHHMMZ>-<slug>.md`, `STANDING.md` | `coordinate`, when the human gives an instruction that holds beyond the task: a new file with `given`, `scope`, `supersedes` (`docs/ux/coordinator-format.md`); appended to `STANDING.md` only where no `standing/` exists | an entry is never edited; a newer one supersedes it by name, readers skip it; `STANDING.md` alone stays valid, also as an index, and is read beside the directory |
| `handover/<date>-<slug>.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-<date>.md` | `lane-retro` | appended on a second run of the same day |
| `archive/<date>/`, `archive/INDEX.md`, `RECONCILE-<date>.md` | `reconcile` | -- |
Expand Down Expand Up @@ -141,7 +141,7 @@ Automatic handoffs and the session journal are not artifacts. `hooks/pre-compact
- No state lives in `~/.ytstack/.<name>` sentinel files. An ask-once answer is recorded in the artifact it concerns (`docs/ux/skill-structure.md`, "Ask-once answers").
- `RUNTIME.md` written by `adopt-brownfield` records environment variable names, never values. The three sections of `RUNTIME.md` hold names of credentials, never values; `bin/ytstack-runtime check` fails on a token-looking string there. In those sections only list lines are read; a section without a list line counts as absent.
- The commands under "Release" and "Signals" of `RUNTIME.md` only read. No skill and no script runs a command that changes a target; a mitigation is a handover script a person runs.
- A change to `spec/REVIEW.md`, `DECISIONS.md`, `STANDING.md`, `PREFERENCES.md`, an instruction file, the frontmatter of an area file (a `verified_at` stamp on its own excepted) or its sections "Invariants and security boundaries" and "Decisions that apply now" always goes to a person (`bin/ytstack-risk floor`).
- A change to `spec/REVIEW.md`, `DECISIONS.md`, `STANDING.md`, a file under `standing/`, `PREFERENCES.md`, an instruction file, the frontmatter of an area file (a `verified_at` stamp on its own excepted) or its sections "Invariants and security boundaries" and "Decisions that apply now" always goes to a person (`bin/ytstack-risk floor`).
- `## Decisions` of an incident record holds only what a person ordered, in own words.

## Error behavior
Expand Down Expand Up @@ -190,6 +190,7 @@ Automatic handoffs and the session journal are not artifacts. `hooks/pre-compact
- 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)"
- 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-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)"
- DECISIONS.md -- "2026-04-23: `.ytstack/` location is user-chosen (project vs user vs both)"
- DECISIONS.md -- "2026-05-31: active_slice is plan-task-owned and team-member-guarded (M012 / issue #21-RC1)"
- DECISIONS.md -- "2026-05-31: post-tool-use-bash is stub-once; summarize-task owns commit-to-task linking (M015 / issue #22)"
Expand Down
9 changes: 5 additions & 4 deletions .ytstack/spec/checks-and-evals.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sources:
- docs/ux/review-policy-format.md
- docs/ux/runtime-format.md
- docs/ux/signal-format.md
verified_at: 1b7bfc8
verified_at: 851b2f4
---

# checks-and-evals
Expand All @@ -40,6 +40,7 @@ Everything that tells a contributor whether a change is acceptable: the static c
**`bin/ytstack-check`: static contracts**

- A Python script on the standard library. It finds the plugin root by walking up to `.claude-plugin/plugin.json`; an optional path argument sets where it starts.
- `check_standing` validates `.ytstack/standing/` (`docs/ux/coordinator-format.md`): the name `<YYYYMMDDTHHMMZ>-<slug>.md` with a date and time that exist, `given` as an existing ISO UTC time in the minute of the name, a `scope`, a body, and a `supersedes` that names an earlier existing entry (missing seconds count as `00`). The full run checks the plugin's own directory; `--standing [<project dir>]` runs only this check in any project with `.ytstack/`, resolved through `hooks/lib/git-ctx.sh` like the preambles (user scope included), and needs no plugin root (exit 0 or 1).
- It reads `skills/*/SKILL.md`, `agents/*.md`, the scripts in `hooks/`, both manifests in `.claude-plugin/` and this repository's own `.ytstack/spec/`. One function per contract: `check_skill`, `check_agent`, `check_cross_refs`, `check_vendor_sibling_refs`, `check_resolver_contract`, `check_inline_leaks`, `check_gstack_adapted`, `check_spec`, `check_keeping_block`. Those functions are the complete rule list; the two groups below summarize them.
- `check_spec` runs `bin/ytstack-spec lint` and `drift` on the plugin root and is skipped when the tree has no `.ytstack/spec/`. A format error is a failure; an area whose paths changed after its description is a warning to look. `check_keeping_block` fails when the "Keeping this true" block in `skills/init-project/SKILL.md` or `skills/adopt-brownfield/SKILL.md` differs from the one in `docs/ux/spec-format.md`.
- Failures (`[fail]`): skill frontmatter missing, `name` different from the directory, no description or one over the length limit; a procedure skill without `## Checklist` or `## Terminal State`; an agent file that breaks `docs/ux/agent-structure.md` (required fields, examples, existing `ytstack:` skills, hard line limit); a role named in `skills/spawn-milestone-team/SKILL.md` without `agents/<role>.md`; a wrapper naming a vendored `SKILL.md` that does not exist; a banned shell pattern (`_BANNED`) in a skill or hook; a preamble or hook that does not source `hooks/lib/git-ctx.sh`; inlined vendor text without a covering `## Namespace note`; an adapted gstack skill without `metadata.upstream`, with a gstack runtime reference, a symlink or an em-dash.
Expand Down Expand Up @@ -173,10 +174,10 @@ Run from the repository root.
- `bash tests/run-all.sh` -- pass: exit 0, one `PASS` line per file in `tests/*.test.sh`, last line `ALL SUITES PASSED`.
- `python3 -m unittest discover -s tests -p 'codex*_test.py'` -- pass: last line `OK`.
- `python3 -m unittest discover -s tests -p 'kimi_plugin_test.py' -v` and the same pattern for `kimi_lifecycle_test.py` -- pass: two and nine tests, each `OK`.
- `python3 -m unittest discover -s tests -p 'kimi_live_test.py' -v` -- seven native tests on a machine with Kimi; local 2.5.3 and official Linux 2.6.2 each passed without skips at `verified_at`.
- `python3 -m unittest discover -s tests -p 'kimi_live_test.py' -v` -- seven native tests on a machine with Kimi; local 2.5.3 and official Linux 2.6.2 each passed without skips at `1b7bfc8`.
- `claude plugin validate .` -- pass: `✔ Validation passed`, exit 0.

Not covered by these checks: `claude plugin eval` (costs money). `bash tests/run-all.sh --linux` (Docker) also passed all 26 suites from an export of `verified_at`.
Not covered by these checks: `claude plugin eval` (costs money). `bash tests/run-all.sh --linux` (Docker) also passed all 26 suites from an export of `1b7bfc8`.

## Decisions that apply now

Expand All @@ -187,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`.
- 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`.
- 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.
- 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`.
- 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.
Expand Down
2 changes: 1 addition & 1 deletion .ytstack/spec/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
- NOTICE
- hooks/lib/git-ctx.sh
- bin/ytstack-gstack-diff
verified_at: 1ae7f2c
verified_at: 851b2f4
---

# dependencies
Expand Down
3 changes: 2 additions & 1 deletion .ytstack/spec/hooks-and-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sources:
- docs/statusline.md
- docs/pr-watch.md
- docs/kimi.md
verified_at: 08dab40
verified_at: 851b2f4
---

# hooks-and-state
Expand All @@ -36,6 +36,7 @@ The lifecycle hooks under `hooks/` and the shared library `hooks/lib/git-ctx.sh`
- `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.
- `yt_find_artifacts` lists artifacts newest first from the flat layout and from the alternative layouts named in its comment. Reading tolerates those layouts. Writing stays flat.
- `yt_standing` lists the standing instructions in force from `.ytstack/standing/` (name, `given`, `scope`, tab separated), newest first by the time in the name (missing seconds count as `00`), without the entries another entry names in `supersedes`. It prints nothing without the directory; `STANDING.md` is read by the skills themselves.

### STATE lint and progress block

Expand Down
6 changes: 3 additions & 3 deletions .ytstack/spec/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sources:
- docs/ux/skill-structure.md
- docs/ux/askuserquestion-format.md
- docs/ux/agent-structure.md
verified_at: 1b7bfc8
verified_at: 54a25e7
---

# skills
Expand Down Expand Up @@ -105,7 +105,7 @@ No other skill reads the flag.

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 `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`, with the PR watch on (flag set and a worker heartbeat under 10 minutes old) register the repository's open pull requests to itself as their owning session (`ytstack-pr-watch register --all-open` without `--session`, at the start and after every restart) and otherwise poll through `bin/ytstack-watch`, ask one question at a time from a question file, write a standing instruction down when it is given, stop a lane that failed verification twice or needs a third review, and rotate through a handoff after the first compaction.
- `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`, with the PR watch on (flag set and a worker heartbeat under 10 minutes old) register the repository's open pull requests to itself as their owning session (`ytstack-pr-watch register --all-open` without `--session`, at the start and after every restart) and otherwise poll through `bin/ytstack-watch`, ask one question at a time from a question file, write a standing instruction down when it is given (a new file in `standing/`; `STANDING.md` only where no `standing/` exists), stop a lane that failed verification twice or needs a third review, and rotate through a handoff after the first compaction.
- `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`, 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: the one skill 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. Each lens the floor names gets a separate fresh reviewer with the lens brief (`bin/ytstack-brief render --kind review --lens <name>`) and one lens line.
Expand Down Expand Up @@ -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)
- DECISIONS.md -- "2026-11-13: Coordinator mode keeps lanes, questions and standing instructions in files and reads host facts fresh (M024, 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)", extended by "2026-11-14: Standing instructions are one file per entry in `.ytstack/standing/`; `STANDING.md` stays valid (issue #57)"
- 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)"
Loading
Loading