Skip to content

feat: the host is the ledger of a lane, goal mode (#79, #99) - #102

Merged
lx-0 merged 5 commits into
mainfrom
feat/79-99-host-ledger-goal
Nov 17, 2026
Merged

lx-0 merged 5 commits into
mainfrom
feat/79-99-host-ledger-goal

Conversation

@lx-0

@lx-0 lx-0 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Changes

#79: the host is the ledger of a lane (commit 94836d8)

  • A lane's state is its pull request, read fresh. What only the coordinator knows (holder, next action, round, PR-less lanes) lives in one lanes file per repository, out of tree: ${XDG_STATE_HOME:-~/.local/state}/ytstack/repos/<repo key>/LANES.md, next to the coordinate marker and keyed like the automatic handoff. Every linked worktree reads the same file.
  • One resolver, yt_lanes_file in hooks/lib/git-ctx.sh, serves every reader: ytstack-frontier, the Stop hook's lanes lint, ytstack-upkeep (report and --worktrees), ytstack-status --phases, ytstack-finish-lane route, and the preambles of coordinate, finish-lane and lane-retro.
  • New ytstack-frontier where | migrate | snapshot.
  • finish-lane Step 3 now puts what lasts on the lane's branch before the push: the roadmap tick, the lane's DECISIONS/spec lines, and the snapshot in a milestone's last lane.
  • ytstack-upkeep has a new bookkeeping section: UTC days of the last 7 with more than 3 merged PRs that changed only .ytstack/. It reads local refs only (first-parent history of origin's default branch) and makes no gh call.
  • questions/ and standing/ stay in the repo.

#99: goal mode (commit 11082ac)

  • ytstack-goal set <M###>|"<sentence>" [--check cmd] [--file path] [--until UTC] [--rounds N] [--if-unset], plus status (runs the checks), block "<why>" / block --clear, clear, and hook. The marker lives out of tree at <session home>/<id>/goal.
  • hooks/stop part 5 holds the stop while the goal is open. The block names the open slices, up to 3 exit criteria from M###-CONTEXT.md, missing files and failed or unrun checks.
  • The stop still goes through for an asked question, a recorded blocker, a running lane, a PR the PR watch watches for this session while its worker ticks, or a reached bound. The bound and a reached goal are each said once.
  • Loop guards: inside a hook-continued turn (stop_hook_active) the goal is the only part that runs. It blocks again only when the transcript shows a tool_use after its last block, and never when there is no transcript. If a standing or lint block already holds the same stop, the goal adds no second block.
  • coordinate 0.9.0 sets the current milestone as the goal with --if-unset (GOAL: line) and clears it in checklist item 14. On Codex it points to the native /goal; ytstack registers no Stop hook there.

Skill versions: coordinate 0.7.2 -> 0.9.0, finish-lane 0.7.1 -> 0.8.0, lane-retro 0.2.0 -> 0.2.1, spawn-milestone-team 0.5.2 -> 0.5.3.

Decisions

Two new DECISIONS entries (2026-11-16):

Notable choices:

  • The lanes file uses the XDG base, not yt_state_base, because CLAUDE_PLUGIN_DATA reaches hooks only.
  • The goal hook never runs a command; status runs the checks and records the results.
  • The upkeep count comes from local refs.

Migration

Nothing changes until you migrate. An existing repo .ytstack/LANES.md without a snapshot: key stays the lanes file as long as no out-of-tree file exists, and the coordinate preamble prints LANES_MIGRATE.

ytstack-frontier migrate copies the file out of tree and adds snapshot: <UTC> to the repo copy. A snapshot is never read as the lanes file again; commit it with the next lane or remove it there.

On a new machine with only a snapshot, migrate copies the snapshot (held rows have to be checked against their PRs), or the rows can be rebuilt from the PRs and branches.

Verification

  • python3 bin/ytstack-check: OK (9 pre-existing warnings; none new)
  • bin/ytstack-spec lint: 0 failures, 0 warnings. bin/ytstack-spec drift: no area to look at
  • bash tests/run-all.sh (macOS bash 3.2): ALL SUITES PASSED, 37 suites. Includes frontier 228, upkeep 168, goal 52 (new), skill-preambles 769+, hooks-coordinate 91, status 66
  • bash tests/run-all.sh --linux from a git archive HEAD export (bash 5.3, alpine): ALL SUITES PASSED
  • Coordinator SessionStart injection on this repo (unchanged, hooks/session-start not touched): 9437 chars on startup, 9485 after compact

Not done

Closes #79
Closes #99

🤖 Generated with Claude Code

lx-0 and others added 2 commits November 16, 2026 22:30
A lane's state is its pull request, read fresh. What only the coordinator
knows lives in one lanes file per repository, out of tree at
${XDG_STATE_HOME:-~/.local/state}/ytstack/repos/<repo key>/LANES.md,
resolved by yt_lanes_file for every reader (frontier, stop lint, upkeep,
status --phases, finish-lane route, coordinate/finish-lane/lane-retro
preambles).

- ytstack-frontier where | migrate | snapshot; a repo LANES.md without a
  snapshot: key stays the lanes file until migrate (LANES_MIGRATE in the
  coordinate preamble)
- finish-lane bundles roadmap tick, decisions and the milestone snapshot
  on the lane branch before the push
- ytstack-upkeep: bookkeeping section, days with more than 3 merged PRs
  that changed only .ytstack/ (local refs)
- coordinate 0.8.0, finish-lane 0.8.0, lane-retro 0.2.1,
  spawn-milestone-team 0.5.3; DECISIONS, spec, docs, CHANGELOG
- tests isolate XDG_STATE_HOME; widen a timing-sensitive heartbeat check

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ytstack-goal set <M###>|"<sentence>" writes a goal marker out of tree
(<session home>/<id>/goal). The Stop hook holds the stop while the goal is
open, naming open slices, the milestone's exit criteria, missing files and
failed checks, and lets it through for an asked question, a recorded
blocker (ytstack-goal block), a running lane or a PR watched for this
session, or a reached bound (--until, --rounds), said once. Inside a
hook-continued turn it blocks again only after a tool call in the
transcript, so it cannot loop; a standing or lint block comes first.

- ytstack-goal set | status (runs --check) | block | clear | hook
- coordinate 0.9.0: sets the current milestone as the goal (--if-unset),
  checklist item 14 clears it; Codex uses its native /goal
- DECISIONS, spec, coordinator-format "Goal mode", docs/codex.md, CHANGELOG
- spec dependencies verified_at moved (git-ctx resolver only, no
  dependency change)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11082acd28

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hooks/stop
Comment on lines +53 to +54
elif printf '%s' "${YT_STDIN:-}" | grep -Eq '"stop_hook_active"[[:space:]]*:[[:space:]]*true'; then
ACTIVE=true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse the transcript in the no-jq fallback

On a Claude Code installation without jq, this branch detects stop_hook_active but leaves TRANSCRIPT empty. goal_check consequently calls ytstack-goal hook without --transcript, whose active path returns pass, so after the first goal block the agent can stop even after making another tool call while the goal remains open. Parse transcript_path through the supported Python fallback as well.

Useful? React with 👍 / 👎.

# goal mode (issue #99): the current milestone becomes the session's goal
has "$s: without a session id no goal" "$OUT" "GOAL: ytstack-goal: no session id"
PRE_SID=goal-s1 run_pre "$P" "$WT"
hasnt "$s: with a session id the goal is tried" "$OUT" "GOAL: ytstack-goal: no session id"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Define the negative assertion helper before using it

When this case runs, hasnt is not defined anywhere in the test script. Because the suite uses set -uo pipefail without -e, the resulting command not found does not increment FAIL, and the intended assertion is silently skipped; a regression that still emits the no-session message with a session ID can therefore pass this test.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T21:50:25.454647Z 11082ac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lx-0 and others added 3 commits November 16, 2026 23:01
tests/codex_plugin_test.py allows another host's name only in shell
comments; the goal lines now say "a host with its own /goal".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- yt_lanes_file is the unified resolver (also for PR #101's callers):
  out-of-tree file, else the main checkout's LANES.md, else <yt_dir>'s
  (no snapshots), else the out-of-tree path; prints the path and sets
  YT_LANES_FILE/YT_LANES_SOURCE
- migrate takes the main checkout's copy, refuses while a worktree's copy
  differs, marks both; migrate --from <old path|key> for a moved checkout;
  where says how to recover
- goal: coordinate sets --rounds 30; ytstack-goal calls do not re-arm; the
  stop goes through once every open slice waits for a person; a stale or
  unreadable running row is no background work; any Stop-hook block leaves
  its transcript offset; scan at most 2 MB; --if-unset replaces a reached
  goal; hooks/stop prints through python without jq before a message counts
  as said
- upkeep: merge-commit subjects no longer give "##N"
- docs: QUICKSTART, README, coordinator-format example, evals note

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve against #101: keep the unified yt_lanes_file (out of tree first,
then the main checkout's non-snapshot LANES.md) and drop #101's duplicate;
keep both CHANGELOG sections and DECISIONS entries; spec row and test
lists carry both idle-said and goal mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lx-0
lx-0 merged commit 4e047c3 into main Nov 17, 2026
4 checks passed
@lx-0
lx-0 deleted the feat/79-99-host-ledger-goal branch November 17, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant