aboutsummaryrefslogtreecommitdiff
path: root/claude-rules
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-rules
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-rules')
-rw-r--r--claude-rules/cross-project.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/claude-rules/cross-project.md b/claude-rules/cross-project.md
new file mode 100644
index 0000000..b451c5a
--- /dev/null
+++ b/claude-rules/cross-project.md
@@ -0,0 +1,50 @@
+# Cross-Project Boundaries
+
+Applies to: `**/*`
+
+How to handle requests that target files or tasks belonging to a different project's `.ai/` scope than the current session.
+
+## The Rule
+
+When a request points at a file or task living under a *different* project's `.ai/` scope, stop before doing the work. Surface the boundary crossing in one line and ask: "this looks like it belongs to `<other project>`'s session — confirm you want me to do it from here, or switch projects?"
+
+Each project's `.ai/` directory is the scope boundary. It carries that project's `protocols.org`, `session-context.org`, `sessions/`, `notes.org`, `todo.org`, `inbox/`, and its own memory dir under `~/.claude/projects/<encoded-cwd>/memory/`. Crossing the boundary without flagging it pollutes the current session's log with the other project's content, drops memories into the wrong dir, and skips the other project's protocols / CLAUDE.md / startup-extras that would otherwise apply.
+
+## When to Detect
+
+Trigger the check on any of these:
+
+- A skill or tool argument names a file under another known project (e.g. cwd is `~/.emacs.d/` and the path is `~/projects/work/todo.org`).
+- A file read or write would cross into another project's `.ai/`.
+- A user request names another project by topic ("the work todo", "the deepsat repo", "my emacs config") while we're not in that project.
+
+## How to Apply
+
+State the mismatch and offer the two acceptable answers. Inline numbered options per `interaction.md` — no popup.
+
+Two acceptable outcomes:
+
+1. **"Yes, do it from here"** — proceed. Record the cross-project artifact in a handoff file under the *other* project's `inbox/`, named `YYYY-MM-DD-handoff-from-<this-project>-<topic>.org`, with a top note explaining the crossover. The other project's startup workflow picks it up during inbox processing.
+2. **"Switch projects"** — stop. Let the user reopen Claude in the right cwd.
+
+Don't assume which one was meant. Either guess is wrong half the time and the cost of asking once is one short turn.
+
+## Recovery When It Goes Wrong
+
+If you do the work first and the boundary issue surfaces afterwards:
+
+1. Move the cross-project session-log entries out of the current session's `.ai/session-context.org` into `<other-project>/inbox/YYYY-MM-DD-handoff-from-<this-project>-<topic>.org`. Top of that file: a heads-up explaining the crossover so the other project's next session knows what happened.
+2. Replace the moved content in `session-context.org` with a brief stub pointing at the handoff file.
+3. Move any project-specific memories you saved into the right project's memory dir, or note them in the handoff file if you can't move them.
+
+## Why
+
+The user sometimes invokes a skill from whatever shell they happen to be in. The request may be accidental (they meant to be in the other project's terminal) or deliberate (knowing cross-project handoff). The model can't tell from the request alone, and assuming wrong both times costs more than asking once.
+
+The per-project scope of `.ai/` is the design — protocols, history, memory, inbox, and todo all coupled to one project. Cross-project work breaks every assumption the next session of each project will make.
+
+## Related
+
+- `subagents.md` — the per-agent context-isolation discipline. Same principle, smaller scope.
+- `interaction.md` — inline numbered options for the "from here / switch?" prompt.
+- Per-project `.ai/protocols.org` — the project-scoped instructions this rule protects.