
## In a session

| Command | What |
|---|---|
| `/context` | What is loaded, how full you are, which memory files loaded |
| `/usage` | What each thing cost, what drives your limits, cache hit ratio |
| `/btw <q>` | Side question that never enters the history |
| `/compact <instructions>` | Summarise, steered. Do it between tasks |
| `/clear` | Fresh context. After two failed corrections, do this and write a better prompt |
| `/rewind` | Restore conversation, code, or both to a checkpoint. Or summarise from a point |
| `/doctor` | Setup checkup. Proposes CLAUDE.md cuts |
| `/config` | Any setting, including Output style, Concise |
| `/memory` | CLAUDE.md files and the auto-memory folder |
| `/permissions` | The effective allow, ask, deny set |
| `/agents` | Subagents available here |
| `/hooks` | Hooks configured here |
| `/goal <condition>` | Keep working until the condition holds |
| `/verify` | Check the change against the running app |
| `/code-review` | Review the diff in a fresh subagent. `ultra` for the cloud version |
| `/batch <instruction>` | Split a change across 5 to 30 subagents, each in a worktree |
| `/rename`, `/resume` | Name a session, pick one up later |
| `Shift+Tab` | Cycle permission modes. Plan mode reads without editing |
| `Ctrl+G` | Open the plan in your editor |
| `Esc` twice | Rewind menu |

## From the terminal

```bash
claude -p "prompt"                            # headless, plain text
claude -p "prompt" --output-format json       # for scripts
tail -200 app.log | claude -p "anything wrong?"
claude --continue                             # last session here
claude --resume                               # pick a session
claude --permission-mode plan                 # start in plan mode
claude --worktree feature-x                   # isolated checkout
claude --channels plugin:telegram@claude-plugins-official
claude agents                                 # agent view
```

## Files

| Path | What |
|---|---|
| `~/.claude/CLAUDE.md` | Your rules, every project |
| `./CLAUDE.md` | Project rules, checked in. Under 200 lines |
| `./CLAUDE.local.md` | Project rules for you only, gitignored |
| `./.claude/rules/*.md` | Topic files; add `paths:` frontmatter to load only for matching files |
| `./.claude/agents/<name>.md` | Subagents |
| `./.claude/skills/<name>/SKILL.md` | Skills |
| `./.claude/settings.json` | Permissions, hooks, output style. `.local.json` for you only |
| `~/.claude/projects/<repo>/memory/` | Auto memory. `MEMORY.md` index, 200 lines loaded |
| `~/.claude/channels/telegram/.env` | Channel token |
| `~/Library/LaunchAgents/*.plist` | Things that survive a reboot |

## Subagent frontmatter

```markdown
name: scout
description: Use when you need to find where something lives before changing it.
tools: Read, Grep, Glob
model: haiku
memory: project
```

`model`: haiku for errands, sonnet for judgement, opus when the task is the hard part. Omit `Edit` and `Write` from `tools` and it cannot change files.

## Skill frontmatter

```markdown
name: fix-issue
description: Fix a GitHub issue by number
disable-model-invocation: true
Analyse and fix issue $ARGUMENTS ...
```

`disable-model-invocation: true` for anything with side effects, so only `/fix-issue 123` runs it.

## Permission rules

```json
{ "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git commit *)"],
    "ask":   ["Bash(git push *)"],
    "deny":  ["Bash(rm -rf *)", "Read(./.env)", "Read(./secrets/**)", "WebFetch(domain:example.com)"]
} }
```

Deny beats allow. Bare `Bash` removes the tool. `Bash(ls *)` matches `ls`, not `lsof`. Operators are understood: `Bash(safe *)` does not cover `safe && rm`.

## Hooks

The events you will use: `PreToolUse` to refuse a command, `PostToolUse` to format after an edit, `Stop` to block the turn until a check passes, `Notification` to make Claude talk to you when it is done. Claude writes them: "Write a hook that ..."

## The prompt cache

| Breaks it | Keeps it |
|---|---|
| `/model`, `/effort`, fast mode on | Editing files |
| MCP server connect or disconnect | Editing CLAUDE.md (but the edit waits for `/clear`) |
| Denying a whole tool by name | Changing output style (same) |
| `/compact` | Skills, `/rewind`, subagents |
| Upgrading Claude Code | Changing permission mode |

Pick model and effort at the top of a session. `/usage` shows the hit ratio.

## Always-on, the recipe

1. Bun, then `/plugin install telegram@claude-plugins-official`, `/telegram:configure <token>`.
2. `tmux new -s agent` then `claude --channels plugin:telegram@claude-plugins-official`.
3. Pair: `/telegram:access pair <code>`, `/telegram:access policy allowlist`.
4. The plist from Downloads into `~/Library/LaunchAgents/`, `launchctl load` it.
5. `sudo pmset -a autorestart 1`. Automatic login on.
6. Deny rules and a Stop hook before you walk away.

Home account only. Channels do not exist on Bedrock.

## The six-line brief

Goal. Current state. Relevant files. Constraints. Done when. Checks to run. One line each. If you cannot fill one in, the work is not ready to hand off.

## Bedrock versus home

Both: subagents, hooks, skills, CLAUDE.md, MCP, workflows, `/batch`, checkpoints. Home only: channels, routines, remote control, web and mobile sessions, Desktop, Chrome, computer use, web search, `/ultrareview`. Bedrock starts in Manual mode; auto mode needs Sonnet 5, Opus 4.7 or later, or Fable 5.
