-
Notifications
You must be signed in to change notification settings - Fork 0
platform: promote 10 generic rules from custom/ for family-agent inheritance #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fitz123
wants to merge
5
commits into
main
Choose a base branch
from
platform/promote-generic-custom-rules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cc9761d
platform: promote 10 generic rules from custom/ for family-agent inhe…
fitz123 4956461
fix: address review comments on PR #125
fitz123 cdf4105
hook: extend protect-files.sh to enforce bot-code-readonly paths
fitz123 c03fe60
hook: anchor protect-files patterns to repo root (Copilot review)
fitz123 ad63baf
test: stabilize protect-files hook tests with explicit project root env
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Anti-Amnesia | ||
|
|
||
| Before claiming "we did this" or "this was decided" — verify it exists. If you can't find a source, say "I don't remember this, let me check" instead of guessing. Wrong confidence is worse than honest amnesia. | ||
|
|
||
| If you want to remember something — WRITE IT TO A FILE. "Mental notes" don't survive sessions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| paths: | ||
| - bot/** | ||
| - .claude/hooks/** | ||
| - .claude/rules/platform/** | ||
| - .claude/skills/workspace-health/scripts/** | ||
| - .github/workflows/** | ||
| - .githooks/** | ||
| - .gitleaks.toml | ||
| - .gitleaksignore | ||
| - README.md | ||
| - config.local.yaml.example | ||
| --- | ||
|
|
||
| # Bot & Platform Files — Read-Only in Workspace | ||
|
|
||
| These files come from upstream (`fitz123/claude-code-bot`). Never edit them here. | ||
|
|
||
| To change: PR in public repo (`~/src/claude-code-bot/`) → merge → `git fetch upstream && git merge upstream/main` in workspace. | ||
|
|
||
| The `paths:` list above is the canonical set of upstream-owned paths. Any local edit to these breaks the next `git merge upstream/main` (divergence/conflicts) and risks losing your change. The `protect-files.sh` hook enforces this list for **all** sessions — `Edit`/`Write` on a matching path fails fast with a pointer back to this rule. | ||
|
|
||
| Files that **look upstream but are workspace-local** (excluded from the list above) and ARE safe to edit: | ||
|
|
||
| - `CLAUDE.md` — `.gitattributes merge=ours` keeps your local version on merge. | ||
| - `config.yaml`, `config.local.yaml` — each workspace has its own bindings/agents. | ||
| - `USER.md`, `IDENTITY.md`, `MEMORY.md`, `memory/`, `.claude/rules/custom/`, `.claude/skills/` (outside upstream-tracked names), `reference/`, `docs/`, `scripts/`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Contradictions Must Be Flagged | ||
|
|
||
| When a request contradicts an existing rule, decision, evidence gate, ADR, or prior agreement — **STOP and flag it to the user before acting.** | ||
|
|
||
| Do not silently resolve contradictions by ignoring one side. Explain: "This contradicts X because Y. How do you want to handle it?" | ||
|
|
||
| The user may forget or miss contradictions too — that's expected. You are the filter. This applies everywhere: plans, tasks, implementation, cron setup, any decision point. | ||
|
|
||
| We don't work with contradictions without an explicit reason. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Runtime Context | ||
|
|
||
| You are running as a **Claude Code CLI subprocess**, spawned by the grammY Telegram bot. | ||
|
|
||
| ## How you were started | ||
|
|
||
| - The Telegram bot spawned your process via `claude -p` with stream-json protocol | ||
| - Messages arrive from Telegram, routed through bot bindings to your session | ||
| - Each Telegram chat gets its own Claude Code subprocess with separate conversation context | ||
| - The bot runs under a Max subscription (no API keys, fixed monthly cost) — applies to all agents spawned by this bot | ||
|
|
||
| ## What this means | ||
|
|
||
| - You are a Claude Code CLI process. You have full Claude Code capabilities (Read, Edit, Write, Bash, Agent, etc.) | ||
| - You are NOT running in a terminal. Messages come from Telegram users, not a keyboard | ||
| - Your responses are sent back to Telegram via the bot's stream relay | ||
| - Your workspace is your current working directory. Other agents live in sibling directories alongside it; check the bot's `config.yaml` (in the main workspace) for the full agent roster and which Telegram chats route to which agent | ||
| - Bot tools are available: `bot/scripts/deliver.sh` for Telegram messaging, `launchctl` for cron management | ||
|
|
||
| ## Session transcripts | ||
|
|
||
| Claude Code CLI stores session transcripts as JSONL files. Path pattern: | ||
| ``` | ||
| ~/.claude/projects/-<workspace-path-dashed>/*.jsonl | ||
| ``` | ||
| The workspace path is dash-encoded (every `/` becomes `-`). To find your own transcripts: `pwd | sed 's:/:-:g'` then look under `~/.claude/projects/`. | ||
|
|
||
| Use these to search conversation history, find when/where decisions were made, trace WebFetch URLs, etc. | ||
|
|
||
| ## Delegation | ||
|
|
||
| - Use Claude Code's native `Agent` tool for sub-tasks (NOT `sessions_spawn`) | ||
| - For cron/scheduled tasks: launchd plists in `~/Library/LaunchAgents/` | ||
| - For one-off delayed tasks: `at` command or launchd one-shot plist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # SOPS: Never decrypt to stdout in agent transcripts | ||
|
|
||
| `sops -d <file>` outputs plaintext secrets to stdout. In a Claude Code Bash tool | ||
| call, that stdout lands in the session JSONL transcript and persists on disk. | ||
| **Plaintext secrets in transcripts = compromise.** Real incident on file: | ||
| a sub-agent ran `sops -d <encrypted-env-file>` without filtering and leaked | ||
| API tokens into the agent transcript. | ||
|
|
||
| ## Rule | ||
|
|
||
| When verifying sops-encrypted files in Bash: | ||
|
|
||
| - **ALLOWED:** pipe to filter that strips values | ||
| - `sops -d <file> | cut -d= -f1` (keys only) | ||
| - `sops -d <file> | wc -l` (count only) | ||
| - `sops -d <file> | grep -c '=' ` (count of entries) | ||
| - `sops -d <file> >/dev/null && echo ok` (round-trip check) | ||
| - **FORBIDDEN:** raw decrypt to terminal | ||
| - `sops -d <file>` (alone) | ||
| - `sops -d <file> | head` | ||
| - `sops -d <file> 2>&1` (without filter) | ||
|
|
||
| ## When delegating review to sub-agents | ||
|
|
||
| Review prompts that ask sub-agents to inspect sops files **MUST include**: | ||
|
|
||
| > Do NOT run `sops -d` without piping to a value-stripping filter (`cut -d= -f1`, | ||
| > `wc -l`, or `>/dev/null`). Plaintext to stdout leaks into transcripts. | ||
|
|
||
| ## Editing secrets | ||
|
|
||
| Use `sops <file>` (interactive, no stdout) — it spawns `$EDITOR` on a temp | ||
| plaintext file, re-encrypts on save. Never `sops -d > tmp; edit tmp; sops -e tmp`. | ||
|
|
||
| ## Why this matters | ||
|
|
||
| Transcripts under `~/.claude/projects/-*/` are not gitignored from system | ||
| backups (Time Machine, rsync), they're readable by any process running as | ||
| the user, and they're a long-lived record. One careless `sops -d` = persistent | ||
| disclosure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| @USER.md | ||
| @IDENTITY.md | ||
| @MEMORY.md | ||
| @reference/governance/decisions.md | ||
|
|
||
| ## Critical Rules | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.