Skip to content

The one-page version

← Technical edition start · The friendly primer

The whole technical edition on one page. Commands are for Claude Code 2.1.332 unless they say otherwise; check your version's docs.

Six facts

  1. It remembers nothing between sessions. The repo is the memory: rules file, plan, handoff note.
  2. Context is finite. Paths and the relevant lines, not whole logs.
  3. It's a loop: model proposes, harness checks, tool runs, result goes back in.
  4. Safety lives in the harness. The wish goes in the rules file; the wall goes in permissions, hooks and the sandbox.
  5. Everything it reads is input, not instruction: pages, issues, logs, tool output.
  6. It sounds the same when it's wrong. Ask for evidence.

Starting a session

  • Open it in the repo, on a branch, with a clean working tree.
  • Say what done looks like and what's out of scope.
  • Bigger than a few files? Plan mode first (/plan or Shift+Tab), and save the plan to PLAN.md.
  • Picking up old work: "Read HANDOFF.md and PLAN.md, then tell me the next step."

Ending a session

  • "Update HANDOFF.md: what's done, what's next, what you tried that didn't work."
  • Commit, even on a branch nobody else sees.

Three tiers

Tier Examples Where it lives
Go ahead read, search, test, lint, build, plan, --check, commit on a branch allow rules
Ask me first push, install, network fetches, anything outside the repo ask rules
Never force push, reset --hard, apply, destroy, reading secrets deny rules, a hook, the sandbox

Deny beats ask beats allow, at every scope. Deny rules match command text, so back them with a hook and the sandbox.

Before you trust an answer

  • "Show me the command you ran and its output."
  • "Cite file:line." "Did you read that file, or guess from its name?"
  • "What are you least sure about?"
  • Library or flag claims: check the docs for your installed version.
  • Numbers: from a metrics file or a log, with the path.

Before you merge

  • The diff touches only what it should. No drive-by refactors.
  • Test changes read separately: git diff main...HEAD -- tests/.
  • No new skip, looser assertion, swallowed error or unexplained dependency.
  • The full check passes: make check, or whatever yours is.
  • The pull request's CI checks are green, and you read the log of any that weren't.
  • For infra: you read the plan yourself, especially every destroy and replace.

Commands worth knowing

Command What it does
/init Draft a CLAUDE.md from the repo. Then cut it down.
/memory Edit the rules files it has loaded
/permissions See and edit allow, ask and deny rules by scope
/sandbox Turn the sandbox on or off, where it's supported
/hooks See the hooks that are configured
/mcp Manage MCP servers
/context See what's using the context window
/compact [focus] Summarize the conversation to free up context
/clear Start fresh. Do this between unrelated tasks.
/rewind, or Esc twice Go back to an earlier point. Files changed only by shell commands aren't restored, so use git.
/doctor Check the installation and settings
gh pr checks / gh run view --log-failed See a pull request's checks, and the log of the ones that failed
claude --continue / --resume Pick up the last session, or choose one
claude -w <name> Work in a new git worktree
claude -p "<prompt>" One-shot, non-interactive. Starts in Manual mode.

Codex CLI: --sandbox read-only|workspace-write|danger-full-access and --ask-for-approval on-request|never. Its Auto preset is workspace-write with on-request.

Scripts it writes for you

  • Dry run by default. Real changes need --apply.
  • Print each action before doing it. Log what was done.
  • No hard-coded hosts, paths or secrets.
  • First real run is yours, on one host or a small batch.

When it goes wrong

If it Then
keeps making the same mistake add a line to the rules file
gets worse as the session goes on handoff note, /clear, start again
invents a function, flag or package point it at the installed source or the docs for your version
changes the test instead of the code review test diffs on their own, and add the rule
tries something you've blocked, over and over say in the rules file that it's blocked and why
asks about every little thing add an allow rule for it
ran something it shouldn't have add a deny rule and a hook, then check your sandbox
brings back output with instructions in it treat it as untrusted, and tighten what that tool can reach

← Back: Rules files · Next: Technical templates → · Technical edition start