From 3d35792df823575cdec0d758460a4acb2a00d81d Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:15:58 -0500 Subject: [PATCH 1/7] test(iss-58-t61): acceptance tests Co-Authored-By: Claude Opus 5.5 --- tests/test_glossary_heading.py | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/test_glossary_heading.py diff --git a/tests/test_glossary_heading.py b/tests/test_glossary_heading.py new file mode 100644 index 0000000..04b2476 --- /dev/null +++ b/tests/test_glossary_heading.py @@ -0,0 +1,86 @@ +"""Acceptance tests for #58, ticket #61: a new glossary's top heading is the GitHub repo name. + +Black-box, via the sync CLI: build the skills in a SyncSandbox and read the installed +domain-modeling skill. The single-context line ships in the skill's GLOSSARY-FORMAT.md +(next to SKILL.md), so every installed .md file of the skill is searched for it. Every +assertion is scoped to the single-context paragraph (the one starting `**Single context`), +so a phrase elsewhere in the skill can't satisfy it. +""" +import os +import re +import unittest + +from tests.harness import SyncSandbox + +SKILL_DIR = "~/.claude/skills/domain-modeling" + + +def _single_context_paragraph(text): + """The paragraph starting with `**Single context`, up to the next blank line.""" + lines = text.splitlines() + for i, line in enumerate(lines): + if line.lstrip().startswith("**Single context"): + para = [] + for l in lines[i:]: + if not l.strip(): + break + para.append(l) + return "\n".join(para) + return "" + + +class GlossaryHeadingTest(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.sb = SyncSandbox() + try: + cls.result = cls.sb.run() + d = cls.sb.home_path(SKILL_DIR) + paras = [] + for name in sorted(os.listdir(d)) if os.path.isdir(d) else []: + path = os.path.join(d, name) + if name.endswith(".md") and os.path.isfile(path): + with open(path, encoding="utf-8") as f: + paras.append(_single_context_paragraph(f.read())) + cls.para = "\n\n".join(p for p in paras if p) + except Exception: + cls.sb.close() + raise + + @classmethod + def tearDownClass(cls): + cls.sb.close() + + def test_sync_succeeds_and_installs_the_single_context_line(self): + # characterization: the sync and the line exist today; this guards the scoping + r = self.result + self.assertEqual(r.returncode, 0, r.stdout + r.stderr) + self.assertNotEqual(self.para, "", "no **Single context line in the installed skill") + + def test_top_heading_is_the_github_repo_name(self): + # #58, ticket #61: the top heading is the GitHub repo name + self.assertRegex( + self.para, + re.compile(r"top heading.*GitHub repo(sitory)? name" + r"|GitHub repo(sitory)? name.*top heading", re.I | re.S)) + + def test_gives_the_gh_command_that_reads_the_repo_name(self): + # #58, ticket #61: read the name with `gh repo view --json name -q .name` + self.assertRegex( + self.para, + re.compile(r"gh\s+repo\s+view\s+--json\s+name\s+-q\s+['\"]?\.name", re.I)) + + def test_heading_rule_applies_when_creating_the_glossary(self): + # #58, ticket #61: the rule applies when creating docs/GLOSSARY.md + self.assertRegex(self.para, re.compile(r"creat", re.I)) + + def test_existing_heading_is_never_renamed(self): + # #58, ticket #61: never rename an existing heading + self.assertRegex( + self.para, + re.compile(r"never\W+(\w+\W+){0,3}renam\w*\W+(\w+\W+){0,3}existing" + r"|existing\W+(\w+\W+){0,4}never\W+(\w+\W+){0,2}renam", re.I)) + + +if __name__ == "__main__": + unittest.main() From 24cd8cab5018d0d6ba4769a713cd9f1686bb226c Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:16:02 -0500 Subject: [PATCH 2/7] test(iss-58-t59): acceptance tests Co-Authored-By: Claude Opus 5.5 --- tests/test_worktree_cwd_rule.py | 97 +++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 tests/test_worktree_cwd_rule.py diff --git a/tests/test_worktree_cwd_rule.py b/tests/test_worktree_cwd_rule.py new file mode 100644 index 0000000..4e5410c --- /dev/null +++ b/tests/test_worktree_cwd_rule.py @@ -0,0 +1,97 @@ +"""Acceptance tests for #58, ticket #59: the working-directory rule (black-box, via the sync CLI). + +Workflows run from the main checkout and reach a worktree with `git -C` or a subshell +`(cd … && …)`, never a bare `cd` (#58, Implementation Decisions, "Working directory (#19)"). +These pin that each rule's key phrases reach the installed text the agent reads. +""" +import re +import unittest + +from tests.harness import SyncSandbox + +START = "" + +# a subshell `(cd`, not a command substitution `$(cd` +SUBSHELL_CD = re.compile(r"(? Date: Wed, 4 Nov 2026 01:18:29 -0500 Subject: [PATCH 3/7] test(iss-58-t60): acceptance tests Co-Authored-By: Claude Opus 5.5 --- tests/test_resume_mode.py | 163 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 tests/test_resume_mode.py diff --git a/tests/test_resume_mode.py b/tests/test_resume_mode.py new file mode 100644 index 0000000..f9f9162 --- /dev/null +++ b/tests/test_resume_mode.py @@ -0,0 +1,163 @@ +"""Acceptance tests for #58, ticket #60: a resume keeps the recorded mode, and `#N` parsing. + +Black-box: `sync.sh` runs in a SyncSandbox and the installed dev-multi and dev-single +SKILL.md files are read from the sandbox HOME. The smoke checklist is read from the repo. +These pin each rule's key phrases (case-insensitive), not whole sentences. +""" +import os +import re +import unittest + +from tests.harness import SyncSandbox + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Phrases saying "no --fast / --rigor flag was given". +FLAGLESS = r"flagless|\bno\s+(?:mode\s+)?flags?\b|without\s+(?:a\s+)?(?:mode\s+)?flags?\b" +ISSUE_TOKEN = r"#(?:N\b||\d+)" + + +def _read(path): + with open(path, encoding="utf-8") as f: + return f.read() + + +def parse_section(text): + """'## 1. Parse arguments' up to the next '## ' heading ('' if absent).""" + m = re.search(r"^## 1\. Parse arguments.*?(?=^## |\Z)", text, re.M | re.S) + return m.group(0) if m else "" + + +def block(text, start): + """From the line starting with `start` up to the next blank line or heading ('' if absent).""" + m = re.search(r"^" + re.escape(start) + r".*?(?=\n\s*\n|\n#|\Z)", text, re.M | re.S) + return m.group(0) if m else "" + + +def mode_list(section): + """The '- **Mode:**' bullet and its indented sub-bullets ('' if absent).""" + m = re.search(r"^- \*\*Mode:\*\*.*?(?=\n\S|\n\n|\Z)", section, re.M | re.S) + return m.group(0) if m else "" + + +def units(text): + """Sentences, also split at line ends (bullets).""" + return [u for u in re.split(r"(?<=[.!?])\s+|\n", text) if u.strip()] + + +def has_unit_with(text, *patterns): + """True if one sentence or line of `text` matches every pattern (case-insensitive).""" + return any(all(re.search(p, u, re.I) for p in patterns) for u in units(text)) + + +class InstalledSkillChecks: + """Shared checks; mixed into one TestCase per installed skill.""" + skill = None + + @classmethod + def setUpClass(cls): + sb = SyncSandbox() + try: + r = sb.run() + cls.sync_ok = (r.returncode == 0, r.stdout + r.stderr) + path = sb.home_path("~/.claude/skills/%s/SKILL.md" % cls.skill) + cls.text = _read(path) if os.path.isfile(path) else "" + finally: + sb.close() + cls.section = parse_section(cls.text) + + # Harness guard (passes today): the sandbox sync itself must succeed. + def test_sync_succeeds(self): + self.assertTrue(self.sync_ok[0], self.sync_ok[1]) + + # #58 / #60: resume or upgrade only when the only non-flag argument is a single #N. + def test_resume_only_when_sole_non_flag_argument_is_issue(self): + self.assertTrue( + has_unit_with(self.section, r"\bonly\b", r"non-flag|other than (?:the )?flags", + ISSUE_TOKEN), + "no parse rule saying the only non-flag argument must be a single #N:\n" + + self.section) + + # #58 / #60: otherwise issue numbers in the description are references. + def test_issue_numbers_in_description_are_references(self): + self.assertTrue( + has_unit_with(self.section, r"\breferences?\b", r"issue|#"), + "no rule saying issue numbers in a description are references:\n" + self.section) + + +class DevMultiResumeModeTest(InstalledSkillChecks, unittest.TestCase): + skill = "dev-multi" + + # #58 / #60: "Neither → MIXED for a new run". + def test_neither_flag_means_mixed_only_for_new_run(self): + self.assertRegex(mode_list(self.section), re.compile(r"new run", re.I)) + + # #58 / #60: "on #N, the recorded mode". + def test_neither_flag_on_resume_means_recorded_mode(self): + self.assertRegex(mode_list(self.section), re.compile(r"recorded mode", re.I)) + + # #58 / #60: the resuming paragraph changes the mode only when --fast or --rigor is given. + def test_resume_changes_mode_only_with_explicit_flag(self): + para = block(self.text, "**Resuming") + self.assertTrue(has_unit_with(para, r"\bonly\b", r"--fast", r"--rigor"), + "resuming paragraph:\n" + para) + + # #58 / #60: the old "differs → update" rule is gone. + def test_resume_no_longer_updates_mode_because_it_differs(self): + old = "If the mode differs from the state file's, update it." + self.assertFalse(old in self.text, "old rule still installed: " + old) + + # #58 / #60: upgrading from dev-single with no flag sets mode MIXED. + def test_flagless_upgrade_from_dev_single_is_mixed(self): + para = block(self.text, "**Upgrading from") + self.assertTrue(has_unit_with(para, r"\bMIXED\b", FLAGLESS), + "upgrade paragraph:\n" + para) + + # #58 / #60: the --auto rules are unchanged. Characterization: passes before the change. + def test_resume_without_auto_still_resets_auto(self): + self.assertIn( + "If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`", + self.text) + + +class DevSingleResumeModeTest(InstalledSkillChecks, unittest.TestCase): + skill = "dev-single" + + # #58 / #60: a flagless resume keeps the recorded mode. + def test_resume_keeps_recorded_mode(self): + self.assertRegex(block(self.text, "**Resuming"), re.compile(r"recorded mode", re.I)) + + # #58 / #60: FAST stays the default for a new run only. + def test_fast_is_default_only_for_new_run(self): + self.assertTrue(has_unit_with(self.section, r"\bdefault\b", r"new run"), + "parse section:\n" + self.section) + + # #58 / #60: the old "differs → update" rule is gone. + def test_resume_no_longer_updates_mode_because_it_differs(self): + old = "If the state file's `mode` differs from this invocation's mode, update it." + self.assertFalse(old in self.text, "old rule still installed: " + old) + + +class SmokeChecklistTest(unittest.TestCase): + """#58 user story 21 / #60: three new checklist items for the live smoke run.""" + + @classmethod + def setUpClass(cls): + cls.items = [l for l in _read(os.path.join(ROOT, "smoke", "CHECKLIST.md")).splitlines() + if l.lstrip().startswith("- [ ]")] + + def has_item(self, *patterns): + return any(all(re.search(p, l, re.I) for p in patterns) for l in self.items) + + def test_flagless_resume_keeps_recorded_mode_item(self): + self.assertTrue(self.has_item(FLAGLESS, r"recorded mode")) + + def test_flagless_upgrade_from_dev_single_is_mixed_item(self): + self.assertTrue(self.has_item(FLAGLESS, r"dev-single", r"\bMIXED\b")) + + def test_description_with_issue_tokens_starts_new_run_item(self): + self.assertTrue(self.has_item(ISSUE_TOKEN, r"\bdesc(?:ription)?\b", r"new run")) + + +if __name__ == "__main__": + unittest.main() From 38508e94911dad802edcbacb73bbd91ccbf77faa Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:19:25 -0500 Subject: [PATCH 4/7] fix(iss-58-t61): new glossary's top heading is the GitHub repo name domain-modeling's single-context line now says: when creating docs/GLOSSARY.md, its top heading is the GitHub repo name (`gh repo view --json name -q .name`), and an existing heading is never renamed. Co-Authored-By: Claude Opus 5.5 --- patches/domain-modeling.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/patches/domain-modeling.patch b/patches/domain-modeling.patch index 4eac7e8..4c170e1 100644 --- a/patches/domain-modeling.patch +++ b/patches/domain-modeling.patch @@ -1,6 +1,6 @@ diff -ruN a/ADR-FORMAT.md b/ADR-FORMAT.md ---- a/ADR-FORMAT.md 2026-10-21 14:32:12 -+++ b/ADR-FORMAT.md 2026-10-21 16:51:15 +--- a/ADR-FORMAT.md 2026-10-24 03:21:40 ++++ b/ADR-FORMAT.md 2026-11-04 01:16:47 @@ -1,6 +1,6 @@ # ADR Format @@ -19,14 +19,14 @@ diff -ruN a/ADR-FORMAT.md b/ADR-FORMAT.md ## When to offer an ADR diff -ruN a/GLOSSARY-FORMAT.md b/GLOSSARY-FORMAT.md ---- a/GLOSSARY-FORMAT.md 2026-10-21 14:32:12 -+++ b/GLOSSARY-FORMAT.md 2026-10-21 16:51:15 +--- a/GLOSSARY-FORMAT.md 2026-10-24 03:21:40 ++++ b/GLOSSARY-FORMAT.md 2026-11-04 01:16:50 @@ -31,7 +31,7 @@ ## Single vs multi-context repos -**Single context (most repos):** One `GLOSSARY.md` at the repo root. -+**Single context (most repos):** One `docs/GLOSSARY.md` (devflow layout). Its top heading is the repo name, never a feature-specific context name. ++**Single context (most repos):** One `docs/GLOSSARY.md` (devflow layout). When creating it, make its top heading the GitHub repo name (`gh repo view --json name -q .name`), never a feature-specific context name. Never rename an existing heading. **Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other: @@ -41,8 +41,8 @@ diff -ruN a/GLOSSARY-FORMAT.md b/GLOSSARY-FORMAT.md When multiple contexts exist, infer which one the current topic relates to. If unclear, ask. diff -ruN a/SKILL.md b/SKILL.md ---- a/SKILL.md 2026-10-21 14:32:12 -+++ b/SKILL.md 2026-10-21 16:52:24 +--- a/SKILL.md 2026-10-24 03:21:40 ++++ b/SKILL.md 2026-11-04 01:16:47 @@ -13,11 +13,11 @@ ``` From 57c2d2174ecf989b0b970d924c4856b8b4e29d0b Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:19:34 -0500 Subject: [PATCH 5/7] fix(iss-58-t59): run worktree commands from the main checkout via git -C or a subshell Devflow section gains a Working directory rule; finishing-a-development-branch Step 2 and subagent-driven-development's DONE review-package step use a (cd && ...) subshell, never a bare cd. Co-Authored-By: Claude Opus 5.5 --- global/claude-md-section.md | 1 + patches/finishing-a-development-branch.patch | 19 ++++++++++++++----- patches/subagent-driven-development.patch | 18 +++++++++--------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/global/claude-md-section.md b/global/claude-md-section.md index 6518520..8d01620 100644 --- a/global/claude-md-section.md +++ b/global/claude-md-section.md @@ -17,6 +17,7 @@ Rules: - run state: `runs/iss-N.json` Give subagents absolute paths, never pasted content. +- **Working directory:** workflows run from the main checkout and reach a worktree with `git -C` or a subshell `(cd … && …)`, never a bare `cd`. - **Repo conventions** (tracker, domain docs): `/.devflow/agents/`. - **Domain docs:** the glossary is `docs/GLOSSARY.md` and ADRs are in `docs/adr/`. Any skill that mentions `GLOSSARY.md` means `docs/GLOSSARY.md`. - **Test reporting:** name every failure, and separate new failures from pre-existing ones. diff --git a/patches/finishing-a-development-branch.patch b/patches/finishing-a-development-branch.patch index 1b1b630..abece8c 100644 --- a/patches/finishing-a-development-branch.patch +++ b/patches/finishing-a-development-branch.patch @@ -1,7 +1,16 @@ diff -ruN a/SKILL.md b/SKILL.md ---- a/SKILL.md 2026-10-19 13:08:29 -+++ b/SKILL.md 2026-10-19 15:15:10 -@@ -48,10 +48,14 @@ +--- a/SKILL.md 2026-10-24 03:21:39 ++++ b/SKILL.md 2026-11-04 01:17:02 +@@ -35,6 +35,8 @@ + WORKTREE_PATH=$(git rev-parse --show-toplevel) + ``` + ++Devflow callers run this block in a subshell, `(cd "$WT" && …)`, so the session stays in the main checkout. ++ + This determines which menu to show and how cleanup works: + + | State | Menu | Cleanup | +@@ -48,10 +50,14 @@ The base branch is whatever this work forked from — usually named in the plan, the conversation, or the branch's upstream. If it is not already known, ask: "This branch split from - is that correct?" @@ -17,7 +26,7 @@ diff -ruN a/SKILL.md b/SKILL.md **Normal repo and named-branch worktree — present exactly these 3 options:** ``` -@@ -85,6 +89,8 @@ +@@ -85,6 +91,8 @@ ### Option 1: Merge Locally @@ -26,7 +35,7 @@ diff -ruN a/SKILL.md b/SKILL.md ```bash # Get main repo root for CWD safety MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel) -@@ -119,7 +125,7 @@ +@@ -119,7 +127,7 @@ ``` Then create the pull/merge request against with the forge's diff --git a/patches/subagent-driven-development.patch b/patches/subagent-driven-development.patch index 0d0fb24..7a4c767 100644 --- a/patches/subagent-driven-development.patch +++ b/patches/subagent-driven-development.patch @@ -1,6 +1,6 @@ diff -ruN a/SKILL.md b/SKILL.md ---- a/SKILL.md 2026-10-21 21:16:54 -+++ b/SKILL.md 2026-10-24 01:24:35 +--- a/SKILL.md 2026-10-24 03:21:39 ++++ b/SKILL.md 2026-11-04 01:17:02 @@ -32,30 +32,8 @@ ## When to Use @@ -72,7 +72,7 @@ diff -ruN a/SKILL.md b/SKILL.md Implementer subagents report one of four statuses. Handle each appropriately: -**DONE:** Generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. -+**DONE:** Generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD "" TEST_COMMIT`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. ++**DONE:** In a subshell, `(cd && …)`, never a bare `cd`, generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD "" TEST_COMMIT`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. **DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review. @@ -128,8 +128,8 @@ diff -ruN a/SKILL.md b/SKILL.md ## Common Rationalizations diff -ruN a/implementer-prompt.md b/implementer-prompt.md ---- a/implementer-prompt.md 2026-10-21 21:16:54 -+++ b/implementer-prompt.md 2026-10-24 01:24:35 +--- a/implementer-prompt.md 2026-10-24 03:21:39 ++++ b/implementer-prompt.md 2026-11-04 01:16:51 @@ -33,11 +33,14 @@ Once you're clear on requirements: @@ -169,8 +169,8 @@ diff -ruN a/implementer-prompt.md b/implementer-prompt.md If BLOCKED or NEEDS_CONTEXT, put the specifics in the final message itself — the controller acts on it directly. diff -ruN a/scripts/review-package b/scripts/review-package ---- a/scripts/review-package 2026-10-21 21:16:54 -+++ b/scripts/review-package 2026-10-24 01:24:35 +--- a/scripts/review-package 2026-10-24 03:21:39 ++++ b/scripts/review-package 2026-11-04 01:16:51 @@ -4,30 +4,37 @@ # call. Using the recorded per-task BASE (not HEAD~1) keeps multi-commit # tasks intact. @@ -252,8 +252,8 @@ diff -ruN a/scripts/review-package b/scripts/review-package git diff -U10 "${base}..${head}" } > "$out" diff -ruN a/scripts/task-brief b/scripts/task-brief ---- a/scripts/task-brief 2026-10-21 21:16:54 -+++ b/scripts/task-brief 2026-10-24 01:24:35 +--- a/scripts/task-brief 2026-10-24 03:21:39 ++++ b/scripts/task-brief 2026-11-04 01:16:51 @@ -3,6 +3,9 @@ # implementer reads in one call, so the task text never has to be pasted # through the controller's context. From 80d145a434d66e941f48f69b751080e8891935c1 Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:22:18 -0500 Subject: [PATCH 6/7] fix(iss-58-t60): flagless resume keeps the recorded mode; #N resumes only when alone Both workflows resume or upgrade issue N only when the sole non-flag argument is a single #N; issue numbers in a description are references. A resume changes the mode only with --fast or --rigor; dev-multi's flagless upgrade from dev-single is MIXED. Adds three smoke checklist items. Co-Authored-By: Claude Opus 5.5 --- owned/dev-multi/SKILL.md | 8 ++++---- owned/dev-single/SKILL.md | 6 +++--- smoke/CHECKLIST.md | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/owned/dev-multi/SKILL.md b/owned/dev-multi/SKILL.md index 930da0a..3c2e2d7 100644 --- a/owned/dev-multi/SKILL.md +++ b/owned/dev-multi/SKILL.md @@ -14,18 +14,18 @@ Arguments: `$ARGUMENTS` - **Allowed flags:** `--fast`, `--rigor`, `--auto`. `--fast` and `--rigor` are mutually exclusive. - Any other token starting with `-` → reply `Unknown flag . /dev-multi accepts --fast, --rigor, --auto.` and **stop**. - Both `--fast` and `--rigor` → say so and stop. -- A token matching `#` means **resume or upgrade issue N**. Everything else is the feature description. +- **Resume or upgrade issue N** only when the only non-flag argument is a single `#N`. Otherwise all non-flag text is the feature description, and issue numbers in it are references. - No description and no `#N` → ask for a one-line feature description and stop. - **Mode:** - `--fast` → FAST: every ticket's lane is pre-filled `fast`. - `--rigor` → RIGOR: every ticket's lane is pre-filled `rigor`. - - Neither → MIXED: lanes are proposed per ticket. + - Neither → MIXED for a new run (lanes proposed per ticket); on `#N`, the recorded mode. - **`--auto`:** the user's permission for this run to make the calls it would otherwise stop for. Follow `align`'s [AUTO.md](../align/AUTO.md). - State the mode in one line before doing anything else, adding `, AUTO` when auto mode is on. -**Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. If the mode differs from the state file's, update it. A mode change only re-labels tickets that are still `open`. `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. +**Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. The mode changes only when `--fast` or `--rigor` is given, and re-labels only tickets still `open`. `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. -**Upgrading from `/dev-single`:** if the state file says `dev-single` and no build has started, switch it to `dev-multi` and continue at step 3. +**Upgrading from `/dev-single`:** if the state file says `dev-single` and no build has started, switch it to `dev-multi` (mode MIXED with no flag, else the flag's mode) and continue at step 3. ## 2. Align diff --git a/owned/dev-single/SKILL.md b/owned/dev-single/SKILL.md index fb90b81..c483778 100644 --- a/owned/dev-single/SKILL.md +++ b/owned/dev-single/SKILL.md @@ -11,16 +11,16 @@ Arguments: `$ARGUMENTS` ## 1. Parse arguments (strictly) -- **Allowed flags:** `--fast` (the default mode, accepted for symmetry with `/dev-multi`), `--rigor`, `--auto`. `--fast` and `--rigor` are mutually exclusive. +- **Allowed flags:** `--fast` (the default for a new run, accepted for symmetry with `/dev-multi`), `--rigor`, `--auto`. `--fast` and `--rigor` are mutually exclusive. - Any other token starting with `-` (for example `--rigour`) → reply `Unknown flag . /dev-single accepts --fast, --rigor, --auto.` and **stop**. - Both `--fast` and `--rigor` → say so and stop. - **`--auto`:** the user's permission for this run to make the calls it would otherwise stop for. Follow `align`'s [AUTO.md](../align/AUTO.md). -- A token matching `#` means **resume or upgrade issue N**. Everything else is the feature description. +- **Resume or upgrade issue N** only when the only non-flag argument is a single `#N`. Otherwise all non-flag text is the feature description, and issue numbers in it are references. - No description and no `#N` → ask for a one-line feature description and stop. - Before doing anything else, state the mode in one line, for example: `/dev-single, FAST mode, new feature: ""`, `/dev-single, FAST mode, AUTO, new feature: ""` or `/dev-single, RIGOR mode, resuming #42`. **Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. -- If the state file's `mode` differs from this invocation's mode, update it. +- A flagless resume keeps the recorded mode; only `--fast` or `--rigor` changes it. - `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. - If the run already has tickets (it was a `/dev-multi` run), stop and tell the user to continue with `/dev-multi #N`. diff --git a/smoke/CHECKLIST.md b/smoke/CHECKLIST.md index 9509258..973d470 100644 --- a/smoke/CHECKLIST.md +++ b/smoke/CHECKLIST.md @@ -51,12 +51,15 @@ What each scenario of a [smoke run](README.md) should show. Re-run after changin ## 5. Resume `/dev-multi #N --rigor` in a fresh session (new label) - [ ] Resume report: parent #N, stage, mode, ticket table, next step, before any state change - [ ] Mode switch re-labels open tickets only; pending plan reused +- [ ] Flagless `/dev-multi #N` resume keeps the recorded mode +- [ ] Flagless `/dev-multi #N` on a `/dev-single` run (no build yet) upgrades it as MIXED - [ ] "Go auto from here" at the plan pause sets `auto` (`auto_source: chat`); the rest runs unattended - [ ] Opened outside the repo: asks for the repo path, doesn't search the disk ## 6. Flags - [ ] `/dev-single --rigour ` refused with `Unknown flag --rigour. /dev-single accepts --fast, --rigor, --auto.`; nothing created - [ ] `/dev-single --fast --rigor` refused; `--auto-approve-plans` is an unknown flag +- [ ] `/dev-single ` starts a new run; `#12` is a reference ## 7. `--auto` - [ ] `/dev-single --fast --auto`: mode line says AUTO; no questions until the PR opens From cf8b3c4e80b84fa4fee73d32a0720143cfcca1f8 Mon Sep 17 00:00:00 2001 From: maceorichards Date: Wed, 4 Nov 2026 01:37:46 -0500 Subject: [PATCH 7/7] fix(iss-58): final review fixes for worktree cwd and resume mode wording Co-Authored-By: Claude Opus 5.5 --- owned/dev-multi/SKILL.md | 10 +- owned/dev-single/SKILL.md | 6 +- patches/finishing-a-development-branch.patch | 4 +- patches/subagent-driven-development.patch | 10 +- tests/test_iss58_review_fixes.py | 123 +++++++++++++++++++ 5 files changed, 138 insertions(+), 15 deletions(-) create mode 100644 tests/test_iss58_review_fixes.py diff --git a/owned/dev-multi/SKILL.md b/owned/dev-multi/SKILL.md index 3c2e2d7..54af7fb 100644 --- a/owned/dev-multi/SKILL.md +++ b/owned/dev-multi/SKILL.md @@ -14,18 +14,18 @@ Arguments: `$ARGUMENTS` - **Allowed flags:** `--fast`, `--rigor`, `--auto`. `--fast` and `--rigor` are mutually exclusive. - Any other token starting with `-` → reply `Unknown flag . /dev-multi accepts --fast, --rigor, --auto.` and **stop**. - Both `--fast` and `--rigor` → say so and stop. -- **Resume or upgrade issue N** only when the only non-flag argument is a single `#N`. Otherwise all non-flag text is the feature description, and issue numbers in it are references. +- **Resume or upgrade issue N** only when the sole non-flag argument is `#N`; otherwise the non-flag text is the description, and issue numbers in it are references. - No description and no `#N` → ask for a one-line feature description and stop. - **Mode:** - `--fast` → FAST: every ticket's lane is pre-filled `fast`. - `--rigor` → RIGOR: every ticket's lane is pre-filled `rigor`. - - Neither → MIXED for a new run (lanes proposed per ticket); on `#N`, the recorded mode. + - Neither → MIXED (lanes proposed per ticket) for a new run or upgrade; a `#N` resume keeps its recorded mode (MIXED if none). - **`--auto`:** the user's permission for this run to make the calls it would otherwise stop for. Follow `align`'s [AUTO.md](../align/AUTO.md). -- State the mode in one line before doing anything else, adding `, AUTO` when auto mode is on. +- State the mode in one line first (on `#N`, once the state file is read), adding `, AUTO` when auto mode is on. -**Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. The mode changes only when `--fast` or `--rigor` is given, and re-labels only tickets still `open`. `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. +**Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. Only `--fast` or `--rigor` changes the mode, re-labelling only tickets still `open`. `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. -**Upgrading from `/dev-single`:** if the state file says `dev-single` and no build has started, switch it to `dev-multi` (mode MIXED with no flag, else the flag's mode) and continue at step 3. +**Upgrading from `/dev-single`:** if the state file says `dev-single` and no build has started, switch it to `dev-multi` (MIXED with no flag) and continue at step 3. ## 2. Align diff --git a/owned/dev-single/SKILL.md b/owned/dev-single/SKILL.md index c483778..7e2c258 100644 --- a/owned/dev-single/SKILL.md +++ b/owned/dev-single/SKILL.md @@ -15,12 +15,12 @@ Arguments: `$ARGUMENTS` - Any other token starting with `-` (for example `--rigour`) → reply `Unknown flag . /dev-single accepts --fast, --rigor, --auto.` and **stop**. - Both `--fast` and `--rigor` → say so and stop. - **`--auto`:** the user's permission for this run to make the calls it would otherwise stop for. Follow `align`'s [AUTO.md](../align/AUTO.md). -- **Resume or upgrade issue N** only when the only non-flag argument is a single `#N`. Otherwise all non-flag text is the feature description, and issue numbers in it are references. +- **Resume or upgrade issue N** only when the sole non-flag argument is `#N`; otherwise the non-flag text is the description, and issue numbers in it are references. - No description and no `#N` → ask for a one-line feature description and stop. -- Before doing anything else, state the mode in one line, for example: `/dev-single, FAST mode, new feature: ""`, `/dev-single, FAST mode, AUTO, new feature: ""` or `/dev-single, RIGOR mode, resuming #42`. +- State the mode in one line first (on `#N`, once the state file is read), for example: `/dev-single, FAST mode, new feature: ""`, `/dev-single, FAST mode, AUTO, new feature: ""` or `/dev-single, RIGOR mode, resuming #42`. **Resuming (`#N`):** follow the Resume section of the `align` skill, whose report states the changes below; then make them and continue from the recorded stage. -- A flagless resume keeps the recorded mode; only `--fast` or `--rigor` changes it. +- A flagless resume keeps the recorded mode (FAST if none or MIXED); only `--fast` or `--rigor` changes it. - `--auto` turns auto mode on from the current stage. If the state has `auto: true` and this invocation lacks `--auto`, reset it to `false`. - If the run already has tickets (it was a `/dev-multi` run), stop and tell the user to continue with `/dev-multi #N`. diff --git a/patches/finishing-a-development-branch.patch b/patches/finishing-a-development-branch.patch index abece8c..f6421a9 100644 --- a/patches/finishing-a-development-branch.patch +++ b/patches/finishing-a-development-branch.patch @@ -1,11 +1,11 @@ diff -ruN a/SKILL.md b/SKILL.md --- a/SKILL.md 2026-10-24 03:21:39 -+++ b/SKILL.md 2026-11-04 01:17:02 ++++ b/SKILL.md 2026-11-04 01:33:20 @@ -35,6 +35,8 @@ WORKTREE_PATH=$(git rev-parse --show-toplevel) ``` -+Devflow callers run this block in a subshell, `(cd "$WT" && …)`, so the session stays in the main checkout. ++Devflow callers run Steps 1–2 in a subshell, `(cd && … && echo "$GIT_DIR $GIT_COMMON $WORKTREE_PATH")`, keep the printed values, and stay in the main checkout. + This determines which menu to show and how cleanup works: diff --git a/patches/subagent-driven-development.patch b/patches/subagent-driven-development.patch index 7a4c767..209eea0 100644 --- a/patches/subagent-driven-development.patch +++ b/patches/subagent-driven-development.patch @@ -1,6 +1,6 @@ diff -ruN a/SKILL.md b/SKILL.md --- a/SKILL.md 2026-10-24 03:21:39 -+++ b/SKILL.md 2026-11-04 01:17:02 ++++ b/SKILL.md 2026-11-04 01:33:20 @@ -32,30 +32,8 @@ ## When to Use @@ -72,7 +72,7 @@ diff -ruN a/SKILL.md b/SKILL.md Implementer subagents report one of four statuses. Handle each appropriately: -**DONE:** Generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. -+**DONE:** In a subshell, `(cd && …)`, never a bare `cd`, generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD "" TEST_COMMIT`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. ++**DONE:** Generate the review package in a subshell, never a bare `cd` (`(cd && bash /scripts/review-package PLAN_FILE BASE HEAD "" TEST_COMMIT)` — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. **DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review. @@ -129,7 +129,7 @@ diff -ruN a/SKILL.md b/SKILL.md diff -ruN a/implementer-prompt.md b/implementer-prompt.md --- a/implementer-prompt.md 2026-10-24 03:21:39 -+++ b/implementer-prompt.md 2026-11-04 01:16:51 ++++ b/implementer-prompt.md 2026-11-04 01:32:46 @@ -33,11 +33,14 @@ Once you're clear on requirements: @@ -170,7 +170,7 @@ diff -ruN a/implementer-prompt.md b/implementer-prompt.md itself — the controller acts on it directly. diff -ruN a/scripts/review-package b/scripts/review-package --- a/scripts/review-package 2026-10-24 03:21:39 -+++ b/scripts/review-package 2026-11-04 01:16:51 ++++ b/scripts/review-package 2026-11-04 01:32:46 @@ -4,30 +4,37 @@ # call. Using the recorded per-task BASE (not HEAD~1) keeps multi-commit # tasks intact. @@ -253,7 +253,7 @@ diff -ruN a/scripts/review-package b/scripts/review-package } > "$out" diff -ruN a/scripts/task-brief b/scripts/task-brief --- a/scripts/task-brief 2026-10-24 03:21:39 -+++ b/scripts/task-brief 2026-11-04 01:16:51 ++++ b/scripts/task-brief 2026-11-04 01:32:46 @@ -3,6 +3,9 @@ # implementer reads in one call, so the task text never has to be pasted # through the controller's context. diff --git a/tests/test_iss58_review_fixes.py b/tests/test_iss58_review_fixes.py new file mode 100644 index 0000000..ddf3a18 --- /dev/null +++ b/tests/test_iss58_review_fixes.py @@ -0,0 +1,123 @@ +"""#58 final-review fixes: worktree subshells that actually work, and when the mode line is stated. + +Black-box: `sync.sh` runs in a SyncSandbox and the installed SKILL.md files are read from the +sandbox HOME. These pin each fix's key phrases (case-insensitive), not whole sentences. +""" +import re +import unittest + +from tests.harness import SyncSandbox + +SUBSHELL_CD = re.compile(r"(?/scripts/review-package")) + + def test_sdd_done_has_no_relative_script_path(self): + self.assertNotIn("bash scripts/review-package", self.sdd_done) + + # Finding 3: on #N the mode line comes after the recorded mode is read; fallback stated. + + def test_dev_multi_mode_line_on_resume_waits_for_state_file(self): + lines = _lines_with(self.multi, r"state the mode in one line") + self.assertTrue(any(re.search(r"#N", l) and re.search(r"state file", l, re.I) for l in lines), + lines) + + def test_dev_single_mode_line_on_resume_waits_for_state_file(self): + lines = _lines_with(self.single, r"state the mode in one line") + self.assertTrue(any(re.search(r"#N", l) and re.search(r"state file", l, re.I) for l in lines), + lines) + + def test_dev_multi_flagless_resume_without_recorded_mode_is_mixed(self): + self.assertTrue(_has_unit_with(self.multi, r"recorded mode", r"MIXED if none")) + + def test_dev_multi_mode_bullet_agrees_upgrade_is_mixed(self): + self.assertTrue(_has_unit_with(self.multi, r"^\s*- Neither", r"\bMIXED\b", r"upgrade")) + + def test_dev_single_flagless_resume_without_recorded_mode_is_fast(self): + self.assertTrue(_has_unit_with(_block(self.single, "**Resuming"), + r"recorded mode", r"FAST if none")) + + # Finding 4: dev-single can't build MIXED, so a recorded MIXED resumes as FAST. + + def test_dev_single_recorded_mixed_resumes_as_fast(self): + self.assertTrue(_has_unit_with(_block(self.single, "**Resuming"), + r"\bFAST if\b[^.;]*\bMIXED\b")) + + +if __name__ == "__main__": + unittest.main()