aboutsummaryrefslogtreecommitdiff
path: root/.claude
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-13 07:31:59 -0500
committerCraig Jennings <c@cjennings.net>2026-05-13 07:31:59 -0500
commit22594dc3fa6af13af8a3ef0910fb8ca1eb543b06 (patch)
tree187d7ecf8f6150ab4b83c66e7fb32ad0bcc77234 /.claude
parent1605544b4f5cde9bea635622f0f66aa044536bf6 (diff)
downloadrulesets-22594dc3fa6af13af8a3ef0910fb8ca1eb543b06.tar.gz
rulesets-22594dc3fa6af13af8a3ef0910fb8ca1eb543b06.zip
feat(rules): cross-project boundary rule + cj-comments preflight
New `claude-rules/cross-project.md` codifies the per-project `.ai/` scope boundary. Stop-and-ask when a request targets another project's files, inline numbered options, handoff-file convention when the user opts to do it from here. `/respond-to-cj-comments` gains a section-0 preflight (boundary check before reading the target file) and a section-7 handoff step (writes the carry-forward file in the target project's `inbox/` when the boundary crossing was approved).
Diffstat (limited to '.claude')
-rw-r--r--.claude/commands/respond-to-cj-comments.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/.claude/commands/respond-to-cj-comments.md b/.claude/commands/respond-to-cj-comments.md
index 54308e6..01a76ac 100644
--- a/.claude/commands/respond-to-cj-comments.md
+++ b/.claude/commands/respond-to-cj-comments.md
@@ -40,6 +40,33 @@ Treat the whole contiguous block as one `cj:` item.
## Instructions
+### 0. Cross-Project Boundary Check (run before reading the file)
+
+Before scanning the target file, compare its path against the current cwd. If the file lives under a *different* project's `.ai/`-scoped root than the cwd does, stop and surface the boundary crossing — don't read the file yet.
+
+Detection: find the nearest ancestor of the target path that contains an `.ai/` directory (or, lacking that, the nearest ancestor that is a git repo root). Do the same for cwd. If the two roots differ, this is a cross-project invocation.
+
+When triggered, present inline numbered options (no popup):
+
+```
+The target <path> looks like it belongs to <other-project>'s session
+(its root is <other-root>, the current cwd is <cwd-root>).
+
+1. Do it from here — I'll process the file and drop a handoff note in <other-project>/inbox/ so the other project's next session picks up the carry-forward.
+2. Switch projects — stop here; reopen Claude with cwd = <other-root> and re-run.
+
+Pick a number.
+```
+
+Wait for the answer:
+
+- **Option 1 ("do it from here")** — proceed. Plan to write a handoff file at `<other-project>/inbox/YYYY-MM-DD-handoff-from-<this-project>-<topic>.org` as part of the cleanup pass at the end of the run. The handoff covers: scope of changes, files touched, carry-forward context, any pending Craig-asks (STALLED entries, drafts awaiting approval), and subagent-output traceability.
+- **Option 2 ("switch projects")** — stop the skill, output a short confirmation, exit. Do not read the file.
+
+If the target file is *inside* the cwd's project root, skip this step silently.
+
+Canonical rule: `~/code/rulesets/claude-rules/cross-project.md`.
+
### 1. Scan the file
Read the target file and collect every `cj:` comment. For each one, record:
@@ -184,6 +211,27 @@ Remove every `cj:` comment that was handled in step 4 (instructions done) or ste
Confirm the cleanup by re-scanning the file after removals. If any `cj:` line survives that shouldn't, remove it and note the correction.
+### 7. Cross-project handoff (only if step 0 triggered)
+
+If step 0 detected a cross-project invocation and Craig picked option 1, write the handoff before exiting:
+
+```
+<other-project>/inbox/YYYY-MM-DD-handoff-from-<this-project>-<topic>.org
+```
+
+Contents:
+
+- Top-of-file note: this work happened cross-project. The acting Claude was running in `<this-project>` cwd; the file lives in `<other-project>`. The target project's next Claude reads this during inbox processing and folds the work-log into its own `session-context.org` before deleting the handoff.
+- Scope of changes: what `cj:` items were processed, what was changed, what's still open.
+- Files touched: full paths, line-level granularity where it helps.
+- Pending Craig-asks: every `STALLED` entry the run created or left in place.
+- Subagent traceability: which subagents ran, what they cited, what changes they proposed.
+- Carry-forward findings: anything substantive the next session needs to know.
+
+Mention the handoff in the current session's own `session-context.org` too, so both projects' logs are internally consistent.
+
+See `~/code/rulesets/claude-rules/cross-project.md` for the canonical rule.
+
## Principles
- **Accuracy > speed.** Subagent generously. A wrong answer to a `cj:` comment is worse than a slow one.