Skip to content

fix(session-flow): no-project-root handoff fallback wording and memory-dir default (#4295) - #4793

Merged
kyle-sexton merged 4 commits into
mainfrom
cursor/4295-no-project-root-handoff-dfbc
Sep 28, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
cursor/4295-no-project-root-handoff-dfbc

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Closes #4295

Summary

When cwd has no git top level, save_point.py new run without --memory-dir now writes the handoff under the plugin data dir's topic-docs/ instead of a bare .work in cwd. It reads CLAUDE_PLUGIN_DATA when set and otherwise derives the dir from its own installed cache path, because Claude Code does not export that variable to Bash-tool commands. reference/topic-docs.md no longer says "nothing persisted" of that fallback.

Fix

  • save_point.py: _plugin_data_root / _default_memory_dir resolve the no-project-root memory root; new refuses with a --memory-dir hint when neither source is available. Inside a git work tree the .work default is unchanged.
  • New save_point.py memory-root subcommand prints that same resolved root.
  • find-handoff rung 1 (skills/find-handoff/reference/rung-1-known-location.md) now globs <memory-root>/handoffs/ on the no-project-root branch instead of ${CLAUDE_PLUGIN_DATA}/topic-docs/handoffs/, which is unset in Bash-tool commands. Without this, find-handoff could not find the handoffs the writer saves. No other reader globs that path.
  • reference/topic-docs.md and reference/structure.md wording; CHANGELOG entry; version 0.38.24 (one patch above main).
  • Considered and declined: the issue's third bullet (.work naming symmetry). The .work default is consumer-configurable through the topic-docs binding, and renaming it is out of scope for this fix.

Verification

  • plugins/session-flow/scripts/tests/test_save_point.py: 128 passed, including the new memory-root test
  • All session-flow pytest suites (pytest plugins/session-flow): 242 passed
  • session-flow *.test.sh suites: hop_chain, check-usage-limit-reset, observer pass
  • scripts/check-changelog-parity.sh --check, --check-bump, --check-preserved, --check-order: pass
  • scripts/check-changed-skills.sh origin/main: find-handoff PASS (0 errors, 1 warning)
  • scripts/validate-plugins.sh: pass
  • scripts/run-ruff.sh check on the changed Python: pass
  • markdownlint-cli2 on the changed markdown: 0 issues
  • Full CI (runs when the PR is marked ready)

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hx63mvV8t39y644DQ3uLnn

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

PR body contract — issue linkage

This PR body conforms to the issue-linkage contract. Nothing to do.

@cursor
cursor Bot force-pushed the cursor/4295-no-project-root-handoff-dfbc branch from 76e11df to b8cb6c5 Compare September 28, 2026 12:29
…ir (#4295)

save_point.py new with no --memory-dir outside a git work tree now
resolves <plugin data>/topic-docs from CLAUDE_PLUGIN_DATA or, since the
variable is not exported to Bash-tool commands, from its own installed
cache path. It refuses with a named fix when neither is available. The
topic-docs binding no longer says nothing is persisted at the fallback.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/4295-no-project-root-handoff-dfbc branch from b8cb6c5 to f318b86 Compare September 28, 2026 12:39
@cursor
cursor Bot marked this pull request as ready for review September 28, 2026 13:12
@claude

claude Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 45s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Review save_point.py changes for security issues
  • Review find-handoff rung-1 doc changes
  • Review docs/changelog changes
  • Post findings

I reviewed this PR's diff (origin/main...HEAD) against the CI security-review criteria: injection surfaces, authz/access-control gaps, and unsafe handling of tokens/secrets/credentials.

Scope: save_point.py adds _plugin_data_root(), _default_memory_dir(), and a memory-root subcommand that resolve a no-project-root fallback for the handoff memory dir; rung-1-known-location.md, topic-docs.md, and structure.md update matching docs; the test file adds coverage.

Findings: none.

  • _plugin_data_root() (save_point.py#L1305-L1326) reads CLAUDE_PLUGIN_DATA directly as a path — this is a plugin-runtime-controlled environment variable, not attacker/user input, consistent with how the rest of the script already trusts CLAUDE_PLUGIN_ROOT-style variables.
  • When deriving the data dir from the script's own install path, the plugin id is built with re.sub(r"[^A-Za-z0-9_-]", "-", ...), which collapses every . and / in the directory-name components (so a hypothetical .. segment becomes --) before it's used as a single path segment. No traversal path out of <config>/plugins/data/.
  • No new subprocess/shell calls were introduced in this diff, and no untrusted data reaches string formatting into a command — the new logic is pure pathlib manipulation.
  • The doc change in rung-1-known-location.md instructs running save_point.py memory-root to obtain the root rather than globbing ${CLAUDE_PLUGIN_DATA} directly in Bash — this closes a correctness gap (the var being unset in Bash-tool commands) and doesn't introduce a new trust boundary; ${CLAUDE_PLUGIN_ROOT} there is the same trusted plugin-root variable used throughout this skill's other reference docs.
  • No secrets, tokens, or credentials are touched by this change.

No GitHub Actions workflow files are part of this diff, so there's nothing in zizmor's lane to note either.

@claude

claude Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 3m 35s —— View job


Claude code review

  • Gather context (PR diff, changed files)
  • Read repo CLAUDE.md / AGENTS.md conventions
  • Review save_point.py changes
  • Review test_save_point.py changes
  • Review reference docs and CHANGELOG changes
  • Post findings

No blocking findings.

Reviewed against the /review:code-review criteria (correctness + maintainability, security out of scope for this lane).

What I checked:

  • _plugin_data_root() / _default_memory_dir() (save_point.py): the derived-id algorithm (<plugin>@<marketplace>, non-[A-Za-z0-9_-] → -) matches the documented convention elsewhere in this repo (e.g. plugins/claude-config/skills/audit-pass/reference/report-location-and-schema.md's formatter@my-marketplace → formatter-my-marketplace worked example), and the assumed cache layout (cache/<marketplace>/<plugin>/<version>/scripts/) matches the real installed layout on this host. The new test test_new_without_memory_dir_outside_git_derives_data_dir_from_cache exercises this path end-to-end with a synthetic cache tree and a dotted marketplace name, which is good coverage for the trickiest part of this change.
  • cmd_new's new branching (--memory-dir / --repo-root / neither): the elif args.repo_root branch preserves the exact pre-PR default (.work resolved against cwd) for any caller that passes --repo-root without --memory-dir, so existing behavior for that combination (unused in-repo today — only tests exercise --repo-root, and none pair it with an omitted --memory-dir) is unchanged. The new no-project-root fallback only activates when both flags are absent, which is the intended fix.
  • Docs: structure.md's new "No project root" paragraph, topic-docs.md's reworded fallback paragraph, and rung-1-known-location.md's switch from globbing the unexpanded ${CLAUDE_PLUGIN_DATA} literal to shelling out to the new memory-root subcommand are internally consistent with each other and with the script. Grepped the rest of the plugin for other readers of the old ${CLAUDE_PLUGIN_DATA}/topic-docs/handoffs/ glob pattern; none found, matching the PR body's claim that no other reader globs that path.
  • CHANGELOG / plugin.json: version bump (0.38.23 → 0.38.24) and changelog entry match.

Minor (not blocking, not filed as a finding): rung-1-known-location.md doesn't spell out what to do if memory-root itself exits 1 (no git top level and no derivable plugin data dir — e.g. a --plugin-dir dev install). In practice this is an unusual environment for find-handoff to run in, and the natural reading is "no fallback root to glob," so I don't think it's worth a required doc change.

Not independently verified: I hit sandbox approval prompts trying to run pytest/ruff myself, so I read the code and tests rather than executing them. The PR body's test-run claims (242 passed, etc.) are author-reported and unverified by me here.

@kyle-sexton
kyle-sexton merged commit 05c1345 into main Sep 28, 2026
3 checks passed
@kyle-sexton
kyle-sexton deleted the cursor/4295-no-project-root-handoff-dfbc branch September 28, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session-flow: the no-project-root handoff fallback contradicts itself and CLAUDE_PLUGIN_DATA is unset

2 participants